| Index: sync/api/attachments/attachment_store_backend.h
|
| diff --git a/sync/api/attachments/attachment_store_backend.h b/sync/api/attachments/attachment_store_backend.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..74859fe72601e816fddde2764617a2fbcbe9aa1a
|
| --- /dev/null
|
| +++ b/sync/api/attachments/attachment_store_backend.h
|
| @@ -0,0 +1,64 @@
|
| +// 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_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
|
| +#define SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "sync/api/attachments/attachment.h"
|
| +#include "sync/api/attachments/attachment_id.h"
|
| +#include "sync/api/attachments/attachment_store.h"
|
| +#include "sync/base/sync_export.h"
|
| +
|
| +namespace base {
|
| +class SequencedTaskRunner;
|
| +} // namespace base
|
| +
|
| +namespace syncer {
|
| +
|
| +// Interface for AttachmentStore backends.
|
| +//
|
| +// AttachmentStoreBackend provides interface for different backends (on-disk,
|
| +// in-memory). Factory methods in AttachmentStore create corresponding backend
|
| +// and pass reference to AttachmentStore.
|
| +// All functions in AttachmentStoreBackend mirror corresponding functions in
|
| +// AttachmentStore.
|
| +// All callbacks and result codes are used directly from AttachmentStore.
|
| +// AttachmentStoreFrontend only passes callbacks and results without modifying
|
| +// them, there is no need to declare separate set.
|
| +class SYNC_EXPORT AttachmentStoreBackend {
|
| + public:
|
| + explicit AttachmentStoreBackend(
|
| + const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner);
|
| + virtual ~AttachmentStoreBackend();
|
| + virtual void Init(const AttachmentStore::InitCallback& callback) = 0;
|
| + virtual void Read(const AttachmentIdList& ids,
|
| + const AttachmentStore::ReadCallback& callback) = 0;
|
| + virtual void Write(AttachmentStore::AttachmentReferrer referrer,
|
| + const AttachmentList& attachments,
|
| + const AttachmentStore::WriteCallback& callback) = 0;
|
| + virtual void Drop(AttachmentStore::AttachmentReferrer referrer,
|
| + const AttachmentIdList& ids,
|
| + const AttachmentStore::DropCallback& callback) = 0;
|
| + virtual void ReadMetadata(
|
| + const AttachmentIdList& ids,
|
| + const AttachmentStore::ReadMetadataCallback& callback) = 0;
|
| + virtual void ReadAllMetadata(
|
| + AttachmentStore::AttachmentReferrer referrer,
|
| + const AttachmentStore::ReadMetadataCallback& callback) = 0;
|
| +
|
| + protected:
|
| + // Helper function to post callback on callback_task_runner.
|
| + void PostCallback(const base::Closure& callback);
|
| +
|
| + private:
|
| + scoped_refptr<base::SequencedTaskRunner> callback_task_runner_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(AttachmentStoreBackend);
|
| +};
|
| +
|
| +} // namespace syncer
|
| +
|
| +#endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_BACKEND_H_
|
|
|