blob: e82e8bb532be270c03d04d3a0b2daded6af90349 [file] [log] [blame]
Tej Singha0c89dd2019-01-25 16:39:18 -08001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
Ruchir Rastogie449b0c2020-02-10 17:40:09 -080019#include <aidl/android/os/IPullAtomCallback.h>
Tej Singha0c89dd2019-01-25 16:39:18 -080020#include "StatsPuller.h"
21
Ruchir Rastogie449b0c2020-02-10 17:40:09 -080022using aidl::android::os::IPullAtomCallback;
23using std::shared_ptr;
24
Tej Singha0c89dd2019-01-25 16:39:18 -080025namespace android {
26namespace os {
27namespace statsd {
28
29class StatsCallbackPuller : public StatsPuller {
30public:
Ruchir Rastogie449b0c2020-02-10 17:40:09 -080031 explicit StatsCallbackPuller(int tagId, const shared_ptr<IPullAtomCallback>& callback,
Tej Singh5b4951b2020-01-24 13:23:56 -080032 const int64_t coolDownNs, const int64_t timeoutNs,
33 const std::vector<int> additiveFields);
Tej Singha0c89dd2019-01-25 16:39:18 -080034
35private:
Ruchir Rastogie449b0c2020-02-10 17:40:09 -080036 bool PullInternal(vector<std::shared_ptr<LogEvent>>* data) override;
37 const shared_ptr<IPullAtomCallback> mCallback;
Tej Singh89817632019-12-09 16:58:08 -080038
39 FRIEND_TEST(StatsCallbackPullerTest, PullFail);
40 FRIEND_TEST(StatsCallbackPullerTest, PullSuccess);
41 FRIEND_TEST(StatsCallbackPullerTest, PullTimeout);
Tej Singha0c89dd2019-01-25 16:39:18 -080042};
43
44} // namespace statsd
45} // namespace os
46} // namespace android