From d8d38d3476c94e08129dd37f8f6328ba4a3bdaa7 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 30 Nov 2020 17:16:11 +0300 Subject: [PATCH] [#220] blobstor: Add blobovnicza tree structure to BlobStor Add blobovnicza instance to BlobStor structure. Create blobovnicza tree in BlobStor constructor. Implement Open/Init/Close methods. Signed-off-by: Leonard Lyubich --- pkg/local_object_storage/blobstor/blobstor.go | 5 +++- pkg/local_object_storage/blobstor/control.go | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 pkg/local_object_storage/blobstor/control.go diff --git a/pkg/local_object_storage/blobstor/blobstor.go b/pkg/local_object_storage/blobstor/blobstor.go index 0dfb19a2..0ebcbce2 100644 --- a/pkg/local_object_storage/blobstor/blobstor.go +++ b/pkg/local_object_storage/blobstor/blobstor.go @@ -13,6 +13,8 @@ import ( // BlobStor represents NeoFS local BLOB storage. type BlobStor struct { *cfg + + blobovniczas *blobovniczas } // Option represents BlobStor's constructor option. @@ -79,7 +81,8 @@ func New(opts ...Option) *BlobStor { } return &BlobStor{ - cfg: c, + cfg: c, + blobovniczas: newBlobovniczaTree(c), } } diff --git a/pkg/local_object_storage/blobstor/control.go b/pkg/local_object_storage/blobstor/control.go new file mode 100644 index 00000000..c046fba4 --- /dev/null +++ b/pkg/local_object_storage/blobstor/control.go @@ -0,0 +1,24 @@ +package blobstor + +// Open opens BlobStor. +func (b *BlobStor) Open() error { + b.log.Debug("opening...") + + return nil +} + +// Init initializes internal data structures and system resources. +// +// If BlobStor is already initialized, then no action is taken. +func (b *BlobStor) Init() error { + b.log.Debug("initializing...") + + return b.blobovniczas.init() +} + +// Close releases all internal resources of BlobStor. +func (b *BlobStor) Close() error { + b.log.Debug("closing...") + + return b.blobovniczas.close() +}