summaryrefslogtreecommitdiffstats
path: root/sync/api/data_batch.h
blob: d7e769baf15c01b2b34e5f9cd06fcfec8f449366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SYNC_API_DATA_BATCH_H_
#define SYNC_API_DATA_BATCH_H_

#include <algorithm>
#include <string>
#include <utility>

#include "base/memory/scoped_ptr.h"
#include "sync/api/entity_data.h"
#include "sync/base/sync_export.h"

namespace syncer_v2 {

typedef std::pair<std::string, scoped_ptr<EntityData>> TagAndData;

// Interface used by the processor to read data requested from the service.
class SYNC_EXPORT DataBatch {
 public:
  DataBatch() {}
  virtual ~DataBatch() {}

  // Returns if the data batch has another pair or not.
  virtual bool HasNext() const = 0;

  // Returns a pair of storage tag and owned entity data object. Invoking this
  // method will remove the pair from the batch, and should not be called if
  // HasNext() returns false.
  virtual TagAndData Next() = 0;
};

}  // namespace syncer_v2

#endif  // SYNC_API_DATA_BATCH_H_