small optimizations and os backend refactor

This commit is contained in:
Green Sky
2025-01-18 01:44:46 +01:00
parent a9ebaa2c2f
commit db73c90e34
4 changed files with 12 additions and 9 deletions

View File

@ -28,7 +28,7 @@ struct SHA1MappedFilesystem_InfoBuilderState {
SHA1MappedFilesystem::SHA1MappedFilesystem(
ObjectStore2& os
) : StorageBackendI::StorageBackendI(os), _ibs(std::make_unique<SHA1MappedFilesystem_InfoBuilderState>()) {
) : _os(os), _ibs(std::make_unique<SHA1MappedFilesystem_InfoBuilderState>()) {
}
SHA1MappedFilesystem::~SHA1MappedFilesystem(void) {
@ -46,10 +46,11 @@ void SHA1MappedFilesystem::tick(void) {
}
}
ObjectHandle SHA1MappedFilesystem::newObject(ByteSpan id) {
ObjectHandle SHA1MappedFilesystem::newObject(ByteSpan id, bool throw_construct) {
ObjectHandle o{_os.registry(), _os.registry().create()};
o.emplace<ObjComp::Ephemeral::Backend>(this);
o.emplace<ObjComp::Ephemeral::BackendMeta>(this);
o.emplace<ObjComp::Ephemeral::BackendFile2>(this);
o.emplace<ObjComp::ID>(std::vector<uint8_t>{id});
//o.emplace<ObjComp::Ephemeral::FilePath>(object_file_path.generic_u8string());

View File

@ -11,7 +11,8 @@ namespace Backends {
// fwd to hide the threading headers
struct SHA1MappedFilesystem_InfoBuilderState;
struct SHA1MappedFilesystem : public StorageBackendI {
struct SHA1MappedFilesystem : public StorageBackendIMeta, public StorageBackendIFile2 {
ObjectStore2& _os;
std::unique_ptr<SHA1MappedFilesystem_InfoBuilderState> _ibs;
SHA1MappedFilesystem(
@ -23,7 +24,7 @@ struct SHA1MappedFilesystem : public StorageBackendI {
// call from main thread (os thread?) often
void tick(void);
ObjectHandle newObject(ByteSpan id) override;
ObjectHandle newObject(ByteSpan id, bool throw_construct = true) override;
// performs async file hashing
// create message in cb