/* * BackupContainerS3BlobStore.h * * This source file is part of the FoundationDB open source project * * Copyright 2013-2018 Apple Inc. and the FoundationDB project authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FDBCLIENT_BACKUP_CONTAINER_S3_BLOBSTORE_H #define FDBCLIENT_BACKUP_CONTAINER_S3_BLOBSTORE_H #pragma once #include "fdbclient/AsyncFileS3BlobStore.actor.h" #include "fdbclient/BackupContainerFileSystem.h" class BackupContainerS3BlobStore final : public BackupContainerFileSystem, ReferenceCounted { Reference m_bstore; std::string m_name; // All backup data goes into a single bucket std::string m_bucket; std::string dataPath(const std::string& path); // Get the path of the backups's index entry std::string indexEntry(); friend class BackupContainerS3BlobStoreImpl; public: BackupContainerS3BlobStore(Reference bstore, const std::string& name, const S3BlobStoreEndpoint::ParametersT& params, const Optional& encryptionKeyFileName); void addref() override; void delref() override; static std::string getURLFormat(); Future> readFile(const std::string& path) final; static Future> listURLs(Reference bstore, const std::string& bucket); Future> writeFile(const std::string& path) final; Future deleteFile(const std::string& path) final; Future listFiles(const std::string& path, std::function pathFilter) final; Future create() final; // The container exists if the index entry in the blob bucket exists Future exists() final; Future deleteContainer(int* pNumDeleted) final; std::string getBucket() const; }; #endif