67 const std::filesystem::path objects_dir;
76 std::shared_ptr<ISubject> subject;
91 [[nodiscard]] std::string compress(
const std::string& data)
const;
106 [[nodiscard]] std::string decompress(
const std::string& compressed_data)
const;
125 [[nodiscard]] std::unique_ptr<VcsObject> createObjectFromContent(
126 const std::string& type,
127 const std::string& content
142 explicit ObjectStorage(
const std::string& root_path,
const std::shared_ptr<ISubject>& subject =
nullptr);
162 void setSubject(std::shared_ptr<ISubject> subj) { subject = std::move(subj); };
179 [[nodiscard]] std::string
getObjectPath(
const std::string& hash)
const;
217 [[nodiscard]]
virtual std::unique_ptr<VcsObject>
loadObject(
const std::string& hash)
const;
230 [[nodiscard]]
bool objectExists(
const std::string& hash)
const;
Defines the interface for the Subject (Publisher) component of the Observer pattern.
Definition of the abstract base class for all Version Control System objects.
ObjectStorage(const std::string &root_path, const std::shared_ptr< ISubject > &subject=nullptr)
Constructor for ObjectStorage.
Definition ObjectStorage.cxx:36
void setSubject(std::shared_ptr< ISubject > subj)
Sets or replaces the event subject used by the ObjectStorage.
Definition ObjectStorage.hxx:106
virtual std::unique_ptr< VcsObject > loadObject(const std::string &hash) const
Loads an object from the disk by its hash ID.
Definition ObjectStorage.cxx:151
virtual ~ObjectStorage()
Destructor.
Definition ObjectStorage.cxx:61
bool objectExists(const std::string &hash) const
Checks if an object with the given hash exists on disk.
Definition ObjectStorage.cxx:358
std::string getObjectPath(const std::string &hash) const
Forms the full filesystem path for an object based on its hash.
Definition ObjectStorage.cxx:65
virtual bool saveObject(const VcsObject &obj) const
Saves a VcsObject to the object database.
Definition ObjectStorage.cxx:83
Abstract base class representing any storable, addressable object within the VCS.
Definition VcsObject.hxx:33
Core VCS data structures and object model.
Service layer components and infrastructure services.