2020-11-30 14:16:11 +00:00
|
|
|
package blobstor
|
|
|
|
|
2022-06-27 08:36:32 +00:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2020-11-30 14:16:11 +00:00
|
|
|
// Open opens BlobStor.
|
2022-06-28 13:42:50 +00:00
|
|
|
func (b *BlobStor) Open(readOnly bool) error {
|
2020-11-30 14:16:11 +00:00
|
|
|
b.log.Debug("opening...")
|
|
|
|
|
2022-07-05 13:47:39 +00:00
|
|
|
return b.blobovniczas.Open(readOnly)
|
2020-11-30 14:16:11 +00:00
|
|
|
}
|
|
|
|
|
2022-06-27 08:36:32 +00:00
|
|
|
// ErrInitBlobovniczas is returned when blobovnicza initialization fails.
|
|
|
|
var ErrInitBlobovniczas = errors.New("failure on blobovnicza initialization stage")
|
|
|
|
|
2020-11-30 14:16:11 +00:00
|
|
|
// Init initializes internal data structures and system resources.
|
|
|
|
//
|
2022-04-21 11:28:05 +00:00
|
|
|
// If BlobStor is already initialized, no action is taken.
|
2022-06-27 08:36:32 +00:00
|
|
|
//
|
|
|
|
// Returns wrapped ErrInitBlobovniczas on blobovnicza tree's initializaiton failure.
|
2020-11-30 14:16:11 +00:00
|
|
|
func (b *BlobStor) Init() error {
|
|
|
|
b.log.Debug("initializing...")
|
|
|
|
|
2022-07-05 13:47:39 +00:00
|
|
|
err := b.blobovniczas.Init()
|
2022-06-27 08:36:32 +00:00
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("%w: %v", ErrInitBlobovniczas, err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
2020-11-30 14:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Close releases all internal resources of BlobStor.
|
|
|
|
func (b *BlobStor) Close() error {
|
|
|
|
b.log.Debug("closing...")
|
|
|
|
|
2022-07-05 13:47:39 +00:00
|
|
|
return b.blobovniczas.Close()
|
2020-11-30 14:16:11 +00:00
|
|
|
}
|