Documentation ¶
Index ¶
Constants ¶
const ( // DataPath the subdir for the data folder containing the p2p data relative to the path. DataPath = "data" // SignaturePath the subdir for the signatures folder containing all the signatures that the relayer query. SignaturePath = "signatures" // EVMKeyStorePath the subdir for the path containing the EVM keystore. EVMKeyStorePath = "keystore/evm" // P2PKeyStorePath the subdir for the path containing the p2p keystore. P2PKeyStorePath = "keystore/p2p" )
Variables ¶
var ( // ErrOpened is thrown on attempt to open already open/in-use Store. ErrOpened = errors.New("store is in use") // ErrNotInited is thrown on attempt to open Store without initialization. ErrNotInited = errors.New("store is not initialized") )
Functions ¶
func DefaultBadgerOptions ¶
DefaultBadgerOptions creates the default options for badger. For our purposes, we don't want the store to perform any garbage collection or expire newly added keys after a certain period, because: 1. the data in the store will be light. 2. we want to keep the data, i.e. confirms, for the longest time possible to be able to retrieve them if needed.
Types ¶
type InitOptions ¶
type InitOptions struct { NeedDataStore bool NeedSignatureStore bool NeedEVMKeyStore bool NeedP2PKeyStore bool }
InitOptions contains the options used to init a path or check if a path is already initiated.
type OpenOptions ¶
type OpenOptions struct { HasDataStore bool BadgerOptions *badger.Options HasSignatureStore bool HasEVMKeyStore bool HasP2PKeyStore bool }
OpenOptions contains the options used to create the store
type Store ¶
type Store struct { // DataStore provides a Datastore - a KV store for dht p2p data to be stored on disk. DataStore datastore.Batching // SignatureStore provides a signature store - a KV store for all orchestrator signatures to be stored on disk. SignatureStore *badger.Datastore // EVMKeyStore provides a keystore for EVM private keys. EVMKeyStore *keystore.KeyStore // P2PKeyStore provides a keystore for P2P private keys. P2PKeyStore *keystore2.FSKeystore // Path the path to the Blobstream storage root. Path string // contains filtered or unexported fields }
Store contains relevant information about the Blobstream store.
func OpenStore ¶
OpenStore creates new FS Store under the given 'path'. To be opened, the Store must be initialized first, otherwise ErrNotInited is thrown. OpenStore takes a file Lock on directory, hence only one Store can be opened at a time under the given 'path', otherwise ErrOpened is thrown. The store is locked only in the case of also opening the data store, however, in the case of the keys, the store can still be opened.