/* * DirectorySubspace.h * * This source file is part of the FoundationDB open source project * * Copyright 2013-2024 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 FDB_FLOW_DIRECTORY_SUBSPACE_H #define FDB_FLOW_DIRECTORY_SUBSPACE_H #pragma once #include "IDirectory.h" #include "DirectoryLayer.h" #include "Subspace.h" namespace FDB { class DirectorySubspace : public IDirectory, public Subspace { public: DirectorySubspace(Path const& path, StringRef const& prefix, Reference directorLayer, Standalone const& layer = Standalone()); virtual ~DirectorySubspace() {} virtual Future> create( Reference const& tr, Path const& path, Standalone const& layer = Standalone(), Optional> const& prefix = Optional>()); virtual Future> open(Reference const& tr, Path const& path, Standalone const& layer = Standalone()); virtual Future> createOrOpen( Reference const& tr, Path const& path, Standalone const& layer = Standalone()); virtual Future exists(Reference const& tr, Path const& path = Path()); virtual Future>> list(Reference const& tr, Path const& path = Path()); virtual Future> move(Reference const& tr, Path const& oldPath, Path const& newPath); virtual Future> moveTo(Reference const& tr, Path const& newAbsolutePath); virtual Future remove(Reference const& tr, Path const& path = Path()); virtual Future removeIfExists(Reference const& tr, Path const& path = Path()); virtual Reference getDirectoryLayer(); virtual const Standalone getLayer() const; virtual const Path getPath() const; protected: Reference directoryLayer; Path path; Standalone layer; virtual Path getPartitionSubpath(Path const& path, Reference directoryLayer = Reference()) const; virtual Reference getDirectoryLayerForPath(Path const& path) const; }; } // namespace FDB #endif