diff options
author | pavely <pavely@chromium.org> | 2015-03-25 16:47:54 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-25 23:48:49 +0000 |
commit | dc577c86a31224a121b37e0f46e6de8f5e7f6435 (patch) | |
tree | 2ef9a8f05c1a9efc1a597ee07df5a67df3fbb765 | |
parent | a8b89aa94a3320ee053d0f24869835914742c860 (diff) | |
download | chromium_src-dc577c86a31224a121b37e0f46e6de8f5e7f6435.zip chromium_src-dc577c86a31224a121b37e0f46e6de8f5e7f6435.tar.gz chromium_src-dc577c86a31224a121b37e0f46e6de8f5e7f6435.tar.bz2 |
[Sync] Introduce AttachmentStoreForSync class
In this change:
- Add AttachmentStoreForSync class. It has functions that will be called by AttachmentServiceImpl to manage sync’s references to attachments.
- Change AttachmentServiceImpl to call those functions. The rule is that for all attachments that we start uploading call AddSyncReference, for all attachments that we no longer upload (for whatever reason) call DropSyncReference.
Couple of notes:
- There is no storage implementation for those functions, it will come in the next change.
- There is growing confusion between AttachmentIdSet and AttachmentIdList. I’ll resolve this next week in a separate change.
BUG=457735
R=maniscalco@chromium.org
TEST=No user facing behavior. Change covered by sync_unit_tests.
Review URL: https://codereview.chromium.org/1002263005
Cr-Commit-Position: refs/heads/master@{#322263}
29 files changed, 257 insertions, 116 deletions
diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc index 1d05147..c59de6e 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc @@ -641,7 +641,7 @@ OAuth2TokenService* TokenServiceProvider::GetTokenService() { scoped_ptr<syncer::AttachmentService> ProfileSyncComponentsFactoryImpl::CreateAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store, + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, const syncer::UserShare& user_share, const std::string& store_birthday, syncer::ModelType model_type, diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.h b/chrome/browser/sync/profile_sync_components_factory_impl.h index ca8037a..0014e0a 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.h +++ b/chrome/browser/sync/profile_sync_components_factory_impl.h @@ -66,7 +66,7 @@ class ProfileSyncComponentsFactoryImpl : public ProfileSyncComponentsFactory { base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( syncer::ModelType type) override; scoped_ptr<syncer::AttachmentService> CreateAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store, + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, const syncer::UserShare& user_share, const std::string& store_birthday, syncer::ModelType model_type, diff --git a/chrome/browser/sync/profile_sync_components_factory_mock.cc b/chrome/browser/sync/profile_sync_components_factory_mock.cc index c6181ac..30f57a0 100644 --- a/chrome/browser/sync/profile_sync_components_factory_mock.cc +++ b/chrome/browser/sync/profile_sync_components_factory_mock.cc @@ -37,7 +37,7 @@ ProfileSyncComponentsFactoryMock::~ProfileSyncComponentsFactoryMock() {} scoped_ptr<syncer::AttachmentService> ProfileSyncComponentsFactoryMock::CreateAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store, + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, const syncer::UserShare& user_share, const std::string& store_birthday, syncer::ModelType model_type, diff --git a/chrome/browser/sync/profile_sync_components_factory_mock.h b/chrome/browser/sync/profile_sync_components_factory_mock.h index ae0a1a1..3e10696 100644 --- a/chrome/browser/sync/profile_sync_components_factory_mock.h +++ b/chrome/browser/sync/profile_sync_components_factory_mock.h @@ -52,7 +52,7 @@ class ProfileSyncComponentsFactoryMock : public ProfileSyncComponentsFactory { MOCK_METHOD1(GetSyncableServiceForType, base::WeakPtr<syncer::SyncableService>(syncer::ModelType)); virtual scoped_ptr<syncer::AttachmentService> CreateAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store, + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, const syncer::UserShare& user_share, const std::string& store_birthday, syncer::ModelType model_type, diff --git a/components/sync_driver/device_info_data_type_controller_unittest.cc b/components/sync_driver/device_info_data_type_controller_unittest.cc index e2b7cbc3..50f43f9 100644 --- a/components/sync_driver/device_info_data_type_controller_unittest.cc +++ b/components/sync_driver/device_info_data_type_controller_unittest.cc @@ -65,7 +65,7 @@ class DeviceInfoDataTypeControllerTest : public testing::Test, } scoped_ptr<syncer::AttachmentService> CreateAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store, + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, const syncer::UserShare& user_share, const std::string& store_birthday, syncer::ModelType model_type, diff --git a/components/sync_driver/generic_change_processor.cc b/components/sync_driver/generic_change_processor.cc index 70ee4cb..3a1f19f 100644 --- a/components/sync_driver/generic_change_processor.cc +++ b/components/sync_driver/generic_change_processor.cc @@ -94,7 +94,7 @@ GenericChangeProcessor::GenericChangeProcessor( const base::WeakPtr<syncer::SyncMergeResult>& merge_result, syncer::UserShare* user_share, SyncApiComponentFactory* sync_factory, - scoped_ptr<syncer::AttachmentStore> attachment_store) + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store) : ChangeProcessor(error_handler), type_(type), local_service_(local_service), diff --git a/components/sync_driver/generic_change_processor.h b/components/sync_driver/generic_change_processor.h index e49d8ac..e692233 100644 --- a/components/sync_driver/generic_change_processor.h +++ b/components/sync_driver/generic_change_processor.h @@ -54,7 +54,7 @@ class GenericChangeProcessor : public ChangeProcessor, const base::WeakPtr<syncer::SyncMergeResult>& merge_result, syncer::UserShare* user_share, SyncApiComponentFactory* sync_factory, - scoped_ptr<syncer::AttachmentStore> attachment_store); + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store); ~GenericChangeProcessor() override; // ChangeProcessor interface. diff --git a/components/sync_driver/generic_change_processor_unittest.cc b/components/sync_driver/generic_change_processor_unittest.cc index 0622ec1..9d34f11 100644 --- a/components/sync_driver/generic_change_processor_unittest.cc +++ b/components/sync_driver/generic_change_processor_unittest.cc @@ -37,7 +37,8 @@ namespace { // A mock that keeps track of attachments passed to UploadAttachments. class MockAttachmentService : public syncer::AttachmentServiceImpl { public: - MockAttachmentService(scoped_ptr<syncer::AttachmentStore> attachment_store); + MockAttachmentService( + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store); ~MockAttachmentService() override; void UploadAttachments( const syncer::AttachmentIdList& attachment_ids) override; @@ -48,7 +49,7 @@ class MockAttachmentService : public syncer::AttachmentServiceImpl { }; MockAttachmentService::MockAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store) + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store) : AttachmentServiceImpl(attachment_store.Pass(), scoped_ptr<syncer::AttachmentUploader>( new syncer::FakeAttachmentUploader), @@ -87,7 +88,7 @@ class MockSyncApiComponentFactory : public SyncApiComponentFactory { } scoped_ptr<syncer::AttachmentService> CreateAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store, + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, const syncer::UserShare& user_share, const std::string& store_birthday, syncer::ModelType model_type, @@ -163,7 +164,7 @@ class SyncGenericChangeProcessorTest : public testing::Test { type, &data_type_error_handler_, syncable_service_ptr_factory_.GetWeakPtr(), merge_result_ptr_factory_->GetWeakPtr(), test_user_share_->user_share(), - &sync_factory, attachment_store.Pass())); + &sync_factory, attachment_store->CreateAttachmentStoreForSync())); mock_attachment_service_ = sync_factory.GetMockAttachmentService(); } diff --git a/components/sync_driver/shared_change_processor_unittest.cc b/components/sync_driver/shared_change_processor_unittest.cc index 8177e01..d65fb54 100644 --- a/components/sync_driver/shared_change_processor_unittest.cc +++ b/components/sync_driver/shared_change_processor_unittest.cc @@ -51,7 +51,7 @@ class SyncSharedChangeProcessorTest : } virtual scoped_ptr<syncer::AttachmentService> CreateAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store, + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, const syncer::UserShare& user_share, const std::string& store_birthday, syncer::ModelType model_type, diff --git a/components/sync_driver/sync_api_component_factory.h b/components/sync_driver/sync_api_component_factory.h index 7ba8200..f781c08 100644 --- a/components/sync_driver/sync_api_component_factory.h +++ b/components/sync_driver/sync_api_component_factory.h @@ -37,7 +37,7 @@ class SyncApiComponentFactory { // provided. AttachmentService doesn't take ownership of delegate, the pointer // must be valid throughout AttachmentService lifetime. virtual scoped_ptr<syncer::AttachmentService> CreateAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store, + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, const syncer::UserShare& user_share, const std::string& store_birthday, syncer::ModelType model_type, diff --git a/components/sync_driver/ui_data_type_controller_unittest.cc b/components/sync_driver/ui_data_type_controller_unittest.cc index f6f2b94..8d0f70c 100644 --- a/components/sync_driver/ui_data_type_controller_unittest.cc +++ b/components/sync_driver/ui_data_type_controller_unittest.cc @@ -57,7 +57,7 @@ class SyncUIDataTypeControllerTest : public testing::Test, } scoped_ptr<syncer::AttachmentService> CreateAttachmentService( - scoped_ptr<syncer::AttachmentStore> attachment_store, + scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, const syncer::UserShare& user_share, const std::string& store_birthday, syncer::ModelType model_type, diff --git a/sync/api/attachments/attachment_store.cc b/sync/api/attachments/attachment_store.cc index 7cf774e..b945c9f 100644 --- a/sync/api/attachments/attachment_store.cc +++ b/sync/api/attachments/attachment_store.cc @@ -16,10 +16,16 @@ namespace syncer { +namespace { + +void NoOpDropCallback(const AttachmentStore::Result& result) { +} +} + AttachmentStore::AttachmentStore( const scoped_refptr<AttachmentStoreFrontend>& frontend, - AttachmentReferrer referrer) - : frontend_(frontend), referrer_(referrer) { + Component component) + : frontend_(frontend), component_(component) { } AttachmentStore::~AttachmentStore() { @@ -32,12 +38,12 @@ void AttachmentStore::Read(const AttachmentIdList& ids, void AttachmentStore::Write(const AttachmentList& attachments, const WriteCallback& callback) { - frontend_->Write(referrer_, attachments, callback); + frontend_->Write(component_, attachments, callback); } void AttachmentStore::Drop(const AttachmentIdList& ids, const DropCallback& callback) { - frontend_->Drop(referrer_, ids, callback); + frontend_->DropReference(component_, ids, callback); } void AttachmentStore::ReadMetadata(const AttachmentIdList& ids, @@ -46,14 +52,14 @@ void AttachmentStore::ReadMetadata(const AttachmentIdList& ids, } void AttachmentStore::ReadAllMetadata(const ReadMetadataCallback& callback) { - frontend_->ReadAllMetadata(referrer_, callback); + frontend_->ReadAllMetadata(component_, callback); } -scoped_ptr<AttachmentStore> AttachmentStore::CreateAttachmentStoreForSync() - const { - scoped_ptr<AttachmentStore> attachment_store( - new AttachmentStore(frontend_, SYNC)); - return attachment_store.Pass(); +scoped_ptr<AttachmentStoreForSync> +AttachmentStore::CreateAttachmentStoreForSync() const { + scoped_ptr<AttachmentStoreForSync> attachment_store_for_sync( + new AttachmentStoreForSync(frontend_, component_, SYNC)); + return attachment_store_for_sync.Pass(); } scoped_ptr<AttachmentStore> AttachmentStore::CreateInMemoryStore() { @@ -103,4 +109,21 @@ scoped_ptr<AttachmentStore> AttachmentStore::CreateMockStoreForTest( return attachment_store.Pass(); } +AttachmentStoreForSync::AttachmentStoreForSync( + const scoped_refptr<AttachmentStoreFrontend>& frontend, + Component consumer_component, + Component sync_component) + : AttachmentStore(frontend, consumer_component), + sync_component_(sync_component) { +} + +void AttachmentStoreForSync::SetSyncReference(const AttachmentIdList& ids) { + frontend()->SetReference(sync_component_, ids); +} + +void AttachmentStoreForSync::DropSyncReference(const AttachmentIdList& ids) { + frontend()->DropReference(sync_component_, ids, + base::Bind(&NoOpDropCallback)); +} + } // namespace syncer diff --git a/sync/api/attachments/attachment_store.h b/sync/api/attachments/attachment_store.h index e8d8f5c..cc83619 100644 --- a/sync/api/attachments/attachment_store.h +++ b/sync/api/attachments/attachment_store.h @@ -20,8 +20,9 @@ class SequencedTaskRunner; namespace syncer { -class AttachmentStoreFrontend; class AttachmentStoreBackend; +class AttachmentStoreForSync; +class AttachmentStoreFrontend; // AttachmentStore is a place to locally store and access Attachments. // @@ -50,7 +51,7 @@ class SYNC_EXPORT AttachmentStore { // Each attachment can have references from sync or model type. Tracking these // references is needed for lifetime management of attachment, it can only be // deleted from the store when it doesn't have references. - enum AttachmentReferrer { + enum Component { MODEL_TYPE, SYNC, }; @@ -121,7 +122,7 @@ class SYNC_EXPORT AttachmentStore { // Given current AttachmentStore (this) creates separate AttachmentStore that // will be used by sync components (AttachmentService). Resulting // AttachmentStore is backed by the same frontend/backend. - scoped_ptr<AttachmentStore> CreateAttachmentStoreForSync() const; + scoped_ptr<AttachmentStoreForSync> CreateAttachmentStoreForSync() const; // Creates an AttachmentStore backed by in-memory implementation of attachment // store. For now frontend lives on the same thread as backend. @@ -145,18 +146,47 @@ class SYNC_EXPORT AttachmentStore { static scoped_ptr<AttachmentStore> CreateMockStoreForTest( scoped_ptr<AttachmentStoreBackend> backend); - private: + protected: AttachmentStore(const scoped_refptr<AttachmentStoreFrontend>& frontend, - AttachmentReferrer referrer); + Component component); + + const scoped_refptr<AttachmentStoreFrontend>& frontend() { return frontend_; } + private: scoped_refptr<AttachmentStoreFrontend> frontend_; // Modification operations with attachment store will be performed on behalf - // of |referrer_|. - const AttachmentReferrer referrer_; + // of |component_|. + const Component component_; DISALLOW_COPY_AND_ASSIGN(AttachmentStore); }; +// AttachmentStoreForSync extends AttachmentStore and provides additional +// functions necessary for AttachmentService. These are needed when +// AttachmentService writes attachment on behalf of model type after download +// and takes reference on attachment for the duration of upload. +// Model type implementation shouldn't use this interface. +class AttachmentStoreForSync : public AttachmentStore { + public: + // Asynchronously adds reference from sync to attachments. + void SetSyncReference(const AttachmentIdList& ids); + + // Asynchronously drops sync reference from attachments. + void DropSyncReference(const AttachmentIdList& ids); + + private: + friend class AttachmentStore; + AttachmentStoreForSync(const scoped_refptr<AttachmentStoreFrontend>& frontend, + Component consumer_component, + Component sync_component); + + // |sync_component_| is passed to frontend when sync related operations are + // perfromed. + const Component sync_component_; + + DISALLOW_COPY_AND_ASSIGN(AttachmentStoreForSync); +}; + } // namespace syncer #endif // SYNC_API_ATTACHMENTS_ATTACHMENT_STORE_H_ diff --git a/sync/api/attachments/attachment_store_backend.h b/sync/api/attachments/attachment_store_backend.h index 74859fe..73bc0fb 100644 --- a/sync/api/attachments/attachment_store_backend.h +++ b/sync/api/attachments/attachment_store_backend.h @@ -36,17 +36,19 @@ class SYNC_EXPORT 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, + virtual void Write(AttachmentStore::Component component, const AttachmentList& attachments, const AttachmentStore::WriteCallback& callback) = 0; - virtual void Drop(AttachmentStore::AttachmentReferrer referrer, - const AttachmentIdList& ids, - const AttachmentStore::DropCallback& callback) = 0; + virtual void SetReference(AttachmentStore::Component component, + const AttachmentIdList& ids) = 0; + virtual void DropReference(AttachmentStore::Component component, + 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, + AttachmentStore::Component component, const AttachmentStore::ReadMetadataCallback& callback) = 0; protected: diff --git a/sync/api/fake_syncable_service.cc b/sync/api/fake_syncable_service.cc index d2177e9..342dd2d 100644 --- a/sync/api/fake_syncable_service.cc +++ b/sync/api/fake_syncable_service.cc @@ -70,9 +70,10 @@ SyncError FakeSyncableService::ProcessSyncChanges( return process_sync_changes_error_; } -scoped_ptr<AttachmentStore> FakeSyncableService::GetAttachmentStoreForSync() { +scoped_ptr<AttachmentStoreForSync> +FakeSyncableService::GetAttachmentStoreForSync() { return attachment_store_ ? attachment_store_->CreateAttachmentStoreForSync() - : scoped_ptr<AttachmentStore>(); + : scoped_ptr<AttachmentStoreForSync>(); } void FakeSyncableService::SetAttachmentService( diff --git a/sync/api/fake_syncable_service.h b/sync/api/fake_syncable_service.h index 9b75647..4fd0c55 100644 --- a/sync/api/fake_syncable_service.h +++ b/sync/api/fake_syncable_service.h @@ -43,7 +43,7 @@ class FakeSyncableService : public SyncableService { SyncDataList GetAllSyncData(ModelType type) const override; SyncError ProcessSyncChanges(const tracked_objects::Location& from_here, const SyncChangeList& change_list) override; - scoped_ptr<AttachmentStore> GetAttachmentStoreForSync() override; + scoped_ptr<AttachmentStoreForSync> GetAttachmentStoreForSync() override; void SetAttachmentService( scoped_ptr<AttachmentService> attachment_service) override; diff --git a/sync/api/syncable_service.cc b/sync/api/syncable_service.cc index f0cfe67..a5d67c4 100644 --- a/sync/api/syncable_service.cc +++ b/sync/api/syncable_service.cc @@ -8,8 +8,9 @@ namespace syncer { SyncableService::~SyncableService() {} -scoped_ptr<AttachmentStore> SyncableService::GetAttachmentStoreForSync() { - return scoped_ptr<AttachmentStore>(); +scoped_ptr<AttachmentStoreForSync> +SyncableService::GetAttachmentStoreForSync() { + return scoped_ptr<AttachmentStoreForSync>(); } void SyncableService::SetAttachmentService( diff --git a/sync/api/syncable_service.h b/sync/api/syncable_service.h index 0d5aae4..a6f8b81 100644 --- a/sync/api/syncable_service.h +++ b/sync/api/syncable_service.h @@ -68,14 +68,15 @@ class SYNC_EXPORT SyncableService // Returns AttachmentStore for use by sync when uploading or downloading // attachments. - // GetAttachmentStore is called right before MergeDataAndStartSyncing. If at - // that time GetAttachmentStore returns NULL then datatype is considered not - // using attachments and all attempts to upload/download attachments will - // fail. Default implementation returns NULL. Datatype that uses sync - // attachments should create attachment store, implement GetAttachmentStore - // to return result of AttachmentStore::CreateAttachmentStoreForSync() from - // attachment store object. - virtual scoped_ptr<AttachmentStore> GetAttachmentStoreForSync(); + // GetAttachmentStoreForSync is called right before MergeDataAndStartSyncing. + // If at that time GetAttachmentStoreForSync returns NULL then datatype is + // considered not using attachments and all attempts to upload/download + // attachments will fail. Default implementation returns NULL. Datatype that + // uses sync attachments should create attachment store, implement + // GetAttachmentStoreForSync to return result of + // AttachmentStore::CreateAttachmentStoreForSync() from attachment store + // object. + virtual scoped_ptr<AttachmentStoreForSync> GetAttachmentStoreForSync(); // Called by sync to provide AttachmentService to be used to download // attachments. diff --git a/sync/internal_api/attachments/attachment_service_impl.cc b/sync/internal_api/attachments/attachment_service_impl.cc index 2db63c3..fb65172 100644 --- a/sync/internal_api/attachments/attachment_service_impl.cc +++ b/sync/internal_api/attachments/attachment_service_impl.cc @@ -110,7 +110,7 @@ AttachmentServiceImpl::GetOrDownloadState::PostResultIfAllRequestsCompleted() { } AttachmentServiceImpl::AttachmentServiceImpl( - scoped_ptr<AttachmentStore> attachment_store, + scoped_ptr<AttachmentStoreForSync> attachment_store, scoped_ptr<AttachmentUploader> attachment_uploader, scoped_ptr<AttachmentDownloader> attachment_downloader, Delegate* delegate, @@ -151,12 +151,10 @@ scoped_ptr<syncer::AttachmentService> AttachmentServiceImpl::CreateForTest() { scoped_ptr<AttachmentDownloader> attachment_downloader( new FakeAttachmentDownloader()); scoped_ptr<syncer::AttachmentService> attachment_service( - new syncer::AttachmentServiceImpl(attachment_store.Pass(), - attachment_uploader.Pass(), - attachment_downloader.Pass(), - NULL, - base::TimeDelta(), - base::TimeDelta())); + new syncer::AttachmentServiceImpl( + attachment_store->CreateAttachmentStoreForSync(), + attachment_uploader.Pass(), attachment_downloader.Pass(), NULL, + base::TimeDelta(), base::TimeDelta())); return attachment_service.Pass(); } @@ -223,8 +221,11 @@ void AttachmentServiceImpl::UploadDone( const AttachmentUploader::UploadResult& result, const AttachmentId& attachment_id) { DCHECK(CalledOnValidThread()); + AttachmentIdList ids; + ids.push_back(attachment_id); switch (result) { case AttachmentUploader::UPLOAD_SUCCESS: + attachment_store_->DropSyncReference(ids); upload_task_queue_->MarkAsSucceeded(attachment_id); if (delegate_) { delegate_->OnAttachmentUploaded(attachment_id); @@ -236,6 +237,7 @@ void AttachmentServiceImpl::UploadDone( break; case AttachmentUploader::UPLOAD_UNSPECIFIED_ERROR: // TODO(pavely): crbug/372622: Deal with UploadAttachment failures. + attachment_store_->DropSyncReference(ids); upload_task_queue_->MarkAsFailed(attachment_id); break; } @@ -278,6 +280,8 @@ void AttachmentServiceImpl::UploadAttachments( if (!attachment_uploader_.get()) { return; } + attachment_store_->SetSyncReference(attachment_ids); + for (auto iter = attachment_ids.begin(); iter != attachment_ids.end(); ++iter) { upload_task_queue_->AddToQueue(*iter); @@ -304,6 +308,7 @@ void AttachmentServiceImpl::ReadDoneNowUpload( for (; iter != end; ++iter) { upload_task_queue_->Cancel(*iter); } + attachment_store_->DropSyncReference(*unavailable_attachment_ids); } AttachmentMap::const_iterator iter = attachments->begin(); diff --git a/sync/internal_api/attachments/attachment_service_impl_unittest.cc b/sync/internal_api/attachments/attachment_service_impl_unittest.cc index a29b68d..f619b75 100644 --- a/sync/internal_api/attachments/attachment_service_impl_unittest.cc +++ b/sync/internal_api/attachments/attachment_service_impl_unittest.cc @@ -39,17 +39,23 @@ class MockAttachmentStoreBackend read_callbacks.push_back(callback); } - void Write(AttachmentStore::AttachmentReferrer referrer, + void Write(AttachmentStore::Component component, const AttachmentList& attachments, const AttachmentStore::WriteCallback& callback) override { write_attachments.push_back(attachments); write_callbacks.push_back(callback); } - void Drop(AttachmentStore::AttachmentReferrer referrer, - const AttachmentIdList& ids, - const AttachmentStore::DropCallback& callback) override { - NOTREACHED(); + void SetReference(AttachmentStore::Component component, + const AttachmentIdList& ids) override { + set_reference_ids.push_back(ids); + } + + void DropReference(AttachmentStore::Component component, + const AttachmentIdList& ids, + const AttachmentStore::DropCallback& callback) override { + ASSERT_EQ(AttachmentStore::SYNC, component); + drop_ids.push_back(ids); } void ReadMetadata( @@ -59,7 +65,7 @@ class MockAttachmentStoreBackend } void ReadAllMetadata( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentStore::ReadMetadataCallback& callback) override { NOTREACHED(); } @@ -100,7 +106,6 @@ class MockAttachmentStoreBackend // Respond to Write request with |result|. void RespondToWrite(const AttachmentStore::Result& result) { AttachmentStore::WriteCallback callback = write_callbacks.back(); - AttachmentList attachments = write_attachments.back(); write_callbacks.pop_back(); write_attachments.pop_back(); base::MessageLoop::current()->PostTask(FROM_HERE, @@ -111,6 +116,8 @@ class MockAttachmentStoreBackend std::vector<AttachmentStore::ReadCallback> read_callbacks; std::vector<AttachmentList> write_attachments; std::vector<AttachmentStore::WriteCallback> write_callbacks; + std::vector<AttachmentIdList> set_reference_ids; + std::vector<AttachmentIdList> drop_ids; private: DISALLOW_COPY_AND_ASSIGN(MockAttachmentStoreBackend); @@ -223,8 +230,9 @@ class AttachmentServiceImplTest : public testing::Test, attachment_downloader_ = downloader->AsWeakPtr(); } attachment_service_.reset(new AttachmentServiceImpl( - attachment_store.Pass(), uploader.Pass(), downloader.Pass(), delegate, - base::TimeDelta::FromMinutes(1), base::TimeDelta::FromMinutes(8))); + attachment_store->CreateAttachmentStoreForSync(), uploader.Pass(), + downloader.Pass(), delegate, base::TimeDelta::FromMinutes(1), + base::TimeDelta::FromMinutes(8))); scoped_ptr<base::MockTimer> timer_to_pass( new base::MockTimer(false, false)); @@ -434,7 +442,8 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_Success) { attachment_ids.push_back(AttachmentId::Create(0, 0)); } attachment_service()->UploadAttachments(attachment_ids); - + RunLoop(); + EXPECT_FALSE(store()->set_reference_ids.empty()); for (unsigned i = 0; i < num_attachments; ++i) { RunLoopAndFireTimer(); // See that the service has issued a read for at least one of the @@ -456,6 +465,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_Success) { ++iter) { EXPECT_THAT(on_attachment_uploaded_list(), testing::Contains(*iter)); } + EXPECT_EQ(num_attachments, store()->drop_ids.size()); } TEST_F(AttachmentServiceImplTest, UploadAttachments_Success_NoDelegate) { @@ -502,6 +512,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_SomeMissingFromStore) { RunLoop(); // No upload requests since the read failed. ASSERT_EQ(0U, uploader()->upload_requests.size()); + EXPECT_EQ(attachment_ids.size(), store()->drop_ids.size()); } TEST_F(AttachmentServiceImplTest, UploadAttachments_AllMissingFromStore) { @@ -524,6 +535,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_AllMissingFromStore) { EXPECT_EQ(0U, uploader()->upload_requests.size()); // See that the delegate was never called. ASSERT_EQ(0U, on_attachment_uploaded_list().size()); + EXPECT_EQ(num_attachments, store()->drop_ids.size()); } TEST_F(AttachmentServiceImplTest, UploadAttachments_NoUploader) { @@ -537,6 +549,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_NoUploader) { RunLoop(); EXPECT_EQ(0U, store()->read_ids.size()); ASSERT_EQ(0U, on_attachment_uploaded_list().size()); + EXPECT_EQ(0U, store()->drop_ids.size()); } // Upload three attachments. For one of them, server responds with error. @@ -567,6 +580,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_OneUploadFails) { RunLoop(); } ASSERT_EQ(2U, on_attachment_uploaded_list().size()); + EXPECT_EQ(num_attachments, store()->drop_ids.size()); } // Attempt an upload, respond with transient error to trigger backoff, issue diff --git a/sync/internal_api/attachments/attachment_store_frontend.cc b/sync/internal_api/attachments/attachment_store_frontend.cc index 97547de..b9d6995 100644 --- a/sync/internal_api/attachments/attachment_store_frontend.cc +++ b/sync/internal_api/attachments/attachment_store_frontend.cc @@ -56,25 +56,33 @@ void AttachmentStoreFrontend::Read( } void AttachmentStoreFrontend::Write( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentList& attachments, const AttachmentStore::WriteCallback& callback) { DCHECK(CalledOnValidThread()); backend_task_runner_->PostTask( FROM_HERE, base::Bind(&AttachmentStoreBackend::Write, - base::Unretained(backend_.get()), referrer, + base::Unretained(backend_.get()), component, attachments, callback)); } -void AttachmentStoreFrontend::Drop( - AttachmentStore::AttachmentReferrer referrer, +void AttachmentStoreFrontend::SetReference(AttachmentStore::Component component, + const AttachmentIdList& ids) { + DCHECK(CalledOnValidThread()); + backend_task_runner_->PostTask( + FROM_HERE, base::Bind(&AttachmentStoreBackend::SetReference, + base::Unretained(backend_.get()), component, ids)); +} + +void AttachmentStoreFrontend::DropReference( + AttachmentStore::Component component, const AttachmentIdList& ids, const AttachmentStore::DropCallback& callback) { DCHECK(CalledOnValidThread()); backend_task_runner_->PostTask( FROM_HERE, - base::Bind(&AttachmentStoreBackend::Drop, - base::Unretained(backend_.get()), referrer, ids, callback)); + base::Bind(&AttachmentStoreBackend::DropReference, + base::Unretained(backend_.get()), component, ids, callback)); } void AttachmentStoreFrontend::ReadMetadata( @@ -87,13 +95,13 @@ void AttachmentStoreFrontend::ReadMetadata( } void AttachmentStoreFrontend::ReadAllMetadata( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentStore::ReadMetadataCallback& callback) { DCHECK(CalledOnValidThread()); backend_task_runner_->PostTask( FROM_HERE, base::Bind(&AttachmentStoreBackend::ReadAllMetadata, - base::Unretained(backend_.get()), referrer, callback)); + base::Unretained(backend_.get()), component, callback)); } } // namespace syncer diff --git a/sync/internal_api/attachments/attachment_store_frontend_unittest.cc b/sync/internal_api/attachments/attachment_store_frontend_unittest.cc index 696b43a..a1e8740 100644 --- a/sync/internal_api/attachments/attachment_store_frontend_unittest.cc +++ b/sync/internal_api/attachments/attachment_store_frontend_unittest.cc @@ -25,7 +25,8 @@ class MockAttachmentStore : public AttachmentStoreBackend { MockAttachmentStore(const base::Closure& init_called, const base::Closure& read_called, const base::Closure& write_called, - const base::Closure& drop_called, + const base::Closure& set_reference_called, + const base::Closure& drop_reference_called, const base::Closure& read_metadata_called, const base::Closure& read_all_metadata_called, const base::Closure& dtor_called) @@ -33,7 +34,8 @@ class MockAttachmentStore : public AttachmentStoreBackend { init_called_(init_called), read_called_(read_called), write_called_(write_called), - drop_called_(drop_called), + set_reference_called_(set_reference_called), + drop_reference_called_(drop_reference_called), read_metadata_called_(read_metadata_called), read_all_metadata_called_(read_all_metadata_called), dtor_called_(dtor_called) {} @@ -49,16 +51,21 @@ class MockAttachmentStore : public AttachmentStoreBackend { read_called_.Run(); } - void Write(AttachmentStore::AttachmentReferrer referrer, + void Write(AttachmentStore::Component component, const AttachmentList& attachments, const AttachmentStore::WriteCallback& callback) override { write_called_.Run(); } - void Drop(AttachmentStore::AttachmentReferrer referrer, - const AttachmentIdList& ids, - const AttachmentStore::DropCallback& callback) override { - drop_called_.Run(); + void SetReference(AttachmentStore::Component component, + const AttachmentIdList& ids) override { + set_reference_called_.Run(); + } + + void DropReference(AttachmentStore::Component component, + const AttachmentIdList& ids, + const AttachmentStore::DropCallback& callback) override { + drop_reference_called_.Run(); } void ReadMetadata( @@ -68,7 +75,7 @@ class MockAttachmentStore : public AttachmentStoreBackend { } void ReadAllMetadata( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentStore::ReadMetadataCallback& callback) override { read_all_metadata_called_.Run(); } @@ -76,7 +83,8 @@ class MockAttachmentStore : public AttachmentStoreBackend { base::Closure init_called_; base::Closure read_called_; base::Closure write_called_; - base::Closure drop_called_; + base::Closure set_reference_called_; + base::Closure drop_reference_called_; base::Closure read_metadata_called_; base::Closure read_all_metadata_called_; base::Closure dtor_called_; @@ -90,6 +98,7 @@ class AttachmentStoreFrontendTest : public testing::Test { : init_call_count_(0), read_call_count_(0), write_call_count_(0), + add_component_call_count_(0), drop_call_count_(0), read_metadata_call_count_(0), read_all_metadata_call_count_(0), @@ -103,7 +112,9 @@ class AttachmentStoreFrontendTest : public testing::Test { base::Unretained(this)), base::Bind(&AttachmentStoreFrontendTest::WriteCalled, base::Unretained(this)), - base::Bind(&AttachmentStoreFrontendTest::DropCalled, + base::Bind(&AttachmentStoreFrontendTest::SetReferenceCalled, + base::Unretained(this)), + base::Bind(&AttachmentStoreFrontendTest::DropReferenceCalled, base::Unretained(this)), base::Bind(&AttachmentStoreFrontendTest::ReadMetadataCalled, base::Unretained(this)), @@ -136,7 +147,9 @@ class AttachmentStoreFrontendTest : public testing::Test { void WriteCalled() { ++write_call_count_; } - void DropCalled() { ++drop_call_count_; } + void SetReferenceCalled() { ++add_component_call_count_; } + + void DropReferenceCalled() { ++drop_call_count_; } void ReadMetadataCalled() { ++read_metadata_call_count_; } @@ -154,6 +167,7 @@ class AttachmentStoreFrontendTest : public testing::Test { int init_call_count_; int read_call_count_; int write_call_count_; + int add_component_call_count_; int drop_call_count_; int read_metadata_call_count_; int read_all_metadata_call_count_; @@ -162,7 +176,7 @@ class AttachmentStoreFrontendTest : public testing::Test { // Test that method calls are forwarded to backend loop TEST_F(AttachmentStoreFrontendTest, MethodsCalled) { - AttachmentIdList ids; + AttachmentIdList id_list; AttachmentList attachments; attachment_store_frontend_->Init( @@ -172,7 +186,7 @@ TEST_F(AttachmentStoreFrontendTest, MethodsCalled) { EXPECT_EQ(init_call_count_, 1); attachment_store_frontend_->Read( - ids, base::Bind(&AttachmentStoreFrontendTest::ReadDone)); + id_list, base::Bind(&AttachmentStoreFrontendTest::ReadDone)); EXPECT_EQ(read_call_count_, 0); RunMessageLoop(); EXPECT_EQ(read_call_count_, 1); @@ -184,15 +198,17 @@ TEST_F(AttachmentStoreFrontendTest, MethodsCalled) { RunMessageLoop(); EXPECT_EQ(write_call_count_, 1); - attachment_store_frontend_->Drop( - AttachmentStore::SYNC, ids, + attachment_store_frontend_->SetReference(AttachmentStore::SYNC, id_list); + + attachment_store_frontend_->DropReference( + AttachmentStore::SYNC, id_list, base::Bind(&AttachmentStoreFrontendTest::DoneWithResult)); EXPECT_EQ(drop_call_count_, 0); RunMessageLoop(); EXPECT_EQ(drop_call_count_, 1); attachment_store_frontend_->ReadMetadata( - ids, base::Bind(&AttachmentStoreFrontendTest::ReadMetadataDone)); + id_list, base::Bind(&AttachmentStoreFrontendTest::ReadMetadataDone)); EXPECT_EQ(read_metadata_call_count_, 0); RunMessageLoop(); EXPECT_EQ(read_metadata_call_count_, 1); diff --git a/sync/internal_api/attachments/attachment_store_test_template.h b/sync/internal_api/attachments/attachment_store_test_template.h index 6292b01..80208a3 100644 --- a/sync/internal_api/attachments/attachment_store_test_template.h +++ b/sync/internal_api/attachments/attachment_store_test_template.h @@ -128,6 +128,13 @@ class AttachmentStoreTest : public testing::Test { TYPED_TEST_CASE_P(AttachmentStoreTest); +// Verify that CreateAttachmentStoreForSync() creates valid object. +TYPED_TEST_P(AttachmentStoreTest, CreateAttachmentStoreForSync) { + scoped_ptr<AttachmentStoreForSync> attachment_store_for_sync = + this->store->CreateAttachmentStoreForSync(); + EXPECT_NE(nullptr, attachment_store_for_sync); +} + // Verify that we do not overwrite existing attachments and that we do not treat // it as an error. TYPED_TEST_P(AttachmentStoreTest, Write_NoOverwriteNoError) { @@ -386,6 +393,7 @@ TYPED_TEST_P(AttachmentStoreTest, ReadAllMetadata) { } REGISTER_TYPED_TEST_CASE_P(AttachmentStoreTest, + CreateAttachmentStoreForSync, Write_NoOverwriteNoError, Write_RoundTrip, Read_OneNotFound, diff --git a/sync/internal_api/attachments/in_memory_attachment_store.cc b/sync/internal_api/attachments/in_memory_attachment_store.cc index ba21426..b0fb846 100644 --- a/sync/internal_api/attachments/in_memory_attachment_store.cc +++ b/sync/internal_api/attachments/in_memory_attachment_store.cc @@ -66,7 +66,7 @@ void InMemoryAttachmentStore::Read( } void InMemoryAttachmentStore::Write( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentList& attachments, const AttachmentStore::WriteCallback& callback) { DCHECK(CalledOnValidThread()); @@ -78,12 +78,25 @@ void InMemoryAttachmentStore::Write( PostCallback(base::Bind(callback, AttachmentStore::SUCCESS)); } -void InMemoryAttachmentStore::Drop( - AttachmentStore::AttachmentReferrer referrer, +void InMemoryAttachmentStore::SetReference(AttachmentStore::Component component, + const AttachmentIdList& ids) { + DCHECK(CalledOnValidThread()); + DCHECK_EQ(AttachmentStore::SYNC, component); +} + +void InMemoryAttachmentStore::DropReference( + AttachmentStore::Component component, const AttachmentIdList& ids, const AttachmentStore::DropCallback& callback) { DCHECK(CalledOnValidThread()); AttachmentStore::Result result = AttachmentStore::SUCCESS; + if (component == AttachmentStore::SYNC) { + // TODO(pavely): There is no reference handling implementation yet. All + // calls to AddReferrer are ignored. Calls to Drop coming from sync should + // be ignored too. + PostCallback(base::Bind(callback, AttachmentStore::SUCCESS)); + return; + } AttachmentIdList::const_iterator ids_iter = ids.begin(); AttachmentIdList::const_iterator ids_end = ids.end(); for (; ids_iter != ids_end; ++ids_iter) { @@ -117,7 +130,7 @@ void InMemoryAttachmentStore::ReadMetadata( } void InMemoryAttachmentStore::ReadAllMetadata( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentStore::ReadMetadataCallback& callback) { DCHECK(CalledOnValidThread()); AttachmentStore::Result result_code = AttachmentStore::SUCCESS; diff --git a/sync/internal_api/attachments/on_disk_attachment_store.cc b/sync/internal_api/attachments/on_disk_attachment_store.cc index 699e1f5..98ccae4 100644 --- a/sync/internal_api/attachments/on_disk_attachment_store.cc +++ b/sync/internal_api/attachments/on_disk_attachment_store.cc @@ -134,7 +134,7 @@ void OnDiskAttachmentStore::Read( } void OnDiskAttachmentStore::Write( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentList& attachments, const AttachmentStore::WriteCallback& callback) { DCHECK(CalledOnValidThread()); @@ -153,11 +153,24 @@ void OnDiskAttachmentStore::Write( PostCallback(base::Bind(callback, result_code)); } -void OnDiskAttachmentStore::Drop( - AttachmentStore::AttachmentReferrer referrer, +void OnDiskAttachmentStore::SetReference(AttachmentStore::Component component, + const AttachmentIdList& ids) { + DCHECK(CalledOnValidThread()); + DCHECK_EQ(AttachmentStore::SYNC, component); +} + +void OnDiskAttachmentStore::DropReference( + AttachmentStore::Component component, const AttachmentIdList& ids, const AttachmentStore::DropCallback& callback) { DCHECK(CalledOnValidThread()); + if (component == AttachmentStore::SYNC) { + // TODO(pavely): There is no reference handling implementation yet. All + // calls to AddReferrer are ignored. Calls to Drop coming from sync should + // be ignored too. + PostCallback(base::Bind(callback, AttachmentStore::SUCCESS)); + return; + } AttachmentStore::Result result_code = AttachmentStore::STORE_INITIALIZATION_FAILED; if (db_) { @@ -208,7 +221,7 @@ void OnDiskAttachmentStore::ReadMetadata( } void OnDiskAttachmentStore::ReadAllMetadata( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentStore::ReadMetadataCallback& callback) { DCHECK(CalledOnValidThread()); AttachmentStore::Result result_code = diff --git a/sync/internal_api/public/attachments/attachment_service_impl.h b/sync/internal_api/public/attachments/attachment_service_impl.h index 03d921f..04b4121 100644 --- a/sync/internal_api/public/attachments/attachment_service_impl.h +++ b/sync/internal_api/public/attachments/attachment_service_impl.h @@ -50,7 +50,7 @@ class SYNC_EXPORT AttachmentServiceImpl // // |max_backoff_delay| the maxmium delay between upload attempts when backed // off. - AttachmentServiceImpl(scoped_ptr<AttachmentStore> attachment_store, + AttachmentServiceImpl(scoped_ptr<AttachmentStoreForSync> attachment_store, scoped_ptr<AttachmentUploader> attachment_uploader, scoped_ptr<AttachmentDownloader> attachment_downloader, Delegate* delegate, @@ -97,7 +97,7 @@ class SYNC_EXPORT AttachmentServiceImpl scoped_ptr<AttachmentMap> attachments, scoped_ptr<AttachmentIdList> unavailable_attachment_ids); - scoped_ptr<AttachmentStore> attachment_store_; + scoped_ptr<AttachmentStoreForSync> attachment_store_; // May be null. const scoped_ptr<AttachmentUploader> attachment_uploader_; diff --git a/sync/internal_api/public/attachments/attachment_store_frontend.h b/sync/internal_api/public/attachments/attachment_store_frontend.h index ec4a33f..682cb4c 100644 --- a/sync/internal_api/public/attachments/attachment_store_frontend.h +++ b/sync/internal_api/public/attachments/attachment_store_frontend.h @@ -40,18 +40,19 @@ class SYNC_EXPORT AttachmentStoreFrontend void Read(const AttachmentIdList& ids, const AttachmentStore::ReadCallback& callback); - void Write(AttachmentStore::AttachmentReferrer referrer, + void Write(AttachmentStore::Component component, const AttachmentList& attachments, const AttachmentStore::WriteCallback& callback); - - void Drop(AttachmentStore::AttachmentReferrer referrer, - const AttachmentIdList& ids, - const AttachmentStore::DropCallback& callback); + void SetReference(AttachmentStore::Component component, + const AttachmentIdList& ids); + void DropReference(AttachmentStore::Component component, + const AttachmentIdList& ids, + const AttachmentStore::DropCallback& callback); void ReadMetadata(const AttachmentIdList& ids, const AttachmentStore::ReadMetadataCallback& callback); - void ReadAllMetadata(AttachmentStore::AttachmentReferrer referrer, + void ReadAllMetadata(AttachmentStore::Component component, const AttachmentStore::ReadMetadataCallback& callback); private: diff --git a/sync/internal_api/public/attachments/in_memory_attachment_store.h b/sync/internal_api/public/attachments/in_memory_attachment_store.h index 5f85992..e511474 100644 --- a/sync/internal_api/public/attachments/in_memory_attachment_store.h +++ b/sync/internal_api/public/attachments/in_memory_attachment_store.h @@ -33,17 +33,19 @@ class SYNC_EXPORT InMemoryAttachmentStore : public AttachmentStoreBackend, void Init(const AttachmentStore::InitCallback& callback) override; void Read(const AttachmentIdList& ids, const AttachmentStore::ReadCallback& callback) override; - void Write(AttachmentStore::AttachmentReferrer referrer, + void Write(AttachmentStore::Component component, const AttachmentList& attachments, const AttachmentStore::WriteCallback& callback) override; - void Drop(AttachmentStore::AttachmentReferrer referrer, - const AttachmentIdList& ids, - const AttachmentStore::DropCallback& callback) override; + void SetReference(AttachmentStore::Component component, + const AttachmentIdList& ids) override; + void DropReference(AttachmentStore::Component component, + const AttachmentIdList& ids, + const AttachmentStore::DropCallback& callback) override; void ReadMetadata( const AttachmentIdList& ids, const AttachmentStore::ReadMetadataCallback& callback) override; void ReadAllMetadata( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentStore::ReadMetadataCallback& callback) override; private: diff --git a/sync/internal_api/public/attachments/on_disk_attachment_store.h b/sync/internal_api/public/attachments/on_disk_attachment_store.h index 62cec5b..bde55c8 100644 --- a/sync/internal_api/public/attachments/on_disk_attachment_store.h +++ b/sync/internal_api/public/attachments/on_disk_attachment_store.h @@ -43,17 +43,19 @@ class SYNC_EXPORT OnDiskAttachmentStore : public AttachmentStoreBackend, void Init(const AttachmentStore::InitCallback& callback) override; void Read(const AttachmentIdList& ids, const AttachmentStore::ReadCallback& callback) override; - void Write(AttachmentStore::AttachmentReferrer referrer, + void Write(AttachmentStore::Component component, const AttachmentList& attachments, const AttachmentStore::WriteCallback& callback) override; - void Drop(AttachmentStore::AttachmentReferrer referrer, - const AttachmentIdList& ids, - const AttachmentStore::DropCallback& callback) override; + void SetReference(AttachmentStore::Component component, + const AttachmentIdList& ids) override; + void DropReference(AttachmentStore::Component component, + const AttachmentIdList& ids, + const AttachmentStore::DropCallback& callback) override; void ReadMetadata( const AttachmentIdList& ids, const AttachmentStore::ReadMetadataCallback& callback) override; void ReadAllMetadata( - AttachmentStore::AttachmentReferrer referrer, + AttachmentStore::Component component, const AttachmentStore::ReadMetadataCallback& callback) override; private: |