Documentation ¶
Index ¶
- type DataStore
- func FromGCSClient(ctx context.Context, client *storage.Client, bucketPath string, ...) (DataStore, error)
- func NewDataStore(ctx context.Context, datastoreConfig DataStoreConfig) (DataStore, error)
- func NewGCSDataStore(ctx context.Context, bucketPath string, schema DataStoreSchema) (DataStore, error)
- type DataStoreConfig
- type DataStoreSchema
- type GCSDataStore
- func (b GCSDataStore) Close() error
- func (b GCSDataStore) Exists(ctx context.Context, pth string) (bool, error)
- func (b GCSDataStore) GetFile(ctx context.Context, filePath string) (io.ReadCloser, error)
- func (b GCSDataStore) GetFileMetadata(ctx context.Context, filePath string) (map[string]string, error)
- func (b GCSDataStore) GetSchema() DataStoreSchema
- func (b GCSDataStore) PutFile(ctx context.Context, filePath string, in io.WriterTo, ...) error
- func (b GCSDataStore) PutFileIfNotExists(ctx context.Context, filePath string, in io.WriterTo, ...) (bool, error)
- func (b GCSDataStore) Size(ctx context.Context, pth string) (int64, error)
- type MetaData
- type MockDataStore
- func (m *MockDataStore) Close() error
- func (m *MockDataStore) Exists(ctx context.Context, path string) (bool, error)
- func (m *MockDataStore) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
- func (m *MockDataStore) GetFileMetadata(ctx context.Context, path string) (map[string]string, error)
- func (m *MockDataStore) GetSchema() DataStoreSchema
- func (m *MockDataStore) PutFile(ctx context.Context, path string, in io.WriterTo, metadata map[string]string) error
- func (m *MockDataStore) PutFileIfNotExists(ctx context.Context, path string, in io.WriterTo, metadata map[string]string) (bool, error)
- func (m *MockDataStore) Size(ctx context.Context, path string) (int64, error)
- type MockResumableManager
- type ResumableManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataStore ¶
type DataStore interface { GetFileMetadata(ctx context.Context, path string) (map[string]string, error) GetFile(ctx context.Context, path string) (io.ReadCloser, error) PutFile(ctx context.Context, path string, in io.WriterTo, metaData map[string]string) error PutFileIfNotExists(ctx context.Context, path string, in io.WriterTo, metaData map[string]string) (bool, error) Exists(ctx context.Context, path string) (bool, error) Size(ctx context.Context, path string) (int64, error) GetSchema() DataStoreSchema Close() error }
DataStore defines an interface for interacting with data storage
func FromGCSClient ¶
func NewDataStore ¶
func NewDataStore(ctx context.Context, datastoreConfig DataStoreConfig) (DataStore, error)
NewDataStore factory, it creates a new DataStore based on the config type
func NewGCSDataStore ¶
type DataStoreConfig ¶
type DataStoreConfig struct { Type string `toml:"type"` Params map[string]string `toml:"params"` Schema DataStoreSchema `toml:"schema"` }
type DataStoreSchema ¶
type DataStoreSchema struct { LedgersPerFile uint32 `toml:"ledgers_per_file"` FilesPerPartition uint32 `toml:"files_per_partition"` }
func (DataStoreSchema) GetObjectKeyFromSequenceNumber ¶
func (ec DataStoreSchema) GetObjectKeyFromSequenceNumber(ledgerSeq uint32) string
GetObjectKeyFromSequenceNumber generates the object key name from the ledger sequence number based on configuration.
func (DataStoreSchema) GetSequenceNumberEndBoundary ¶
func (ec DataStoreSchema) GetSequenceNumberEndBoundary(ledgerSeq uint32) uint32
func (DataStoreSchema) GetSequenceNumberStartBoundary ¶
func (ec DataStoreSchema) GetSequenceNumberStartBoundary(ledgerSeq uint32) uint32
type GCSDataStore ¶
type GCSDataStore struct {
// contains filtered or unexported fields
}
GCSDataStore implements DataStore for GCS
func (GCSDataStore) Close ¶
func (b GCSDataStore) Close() error
Close closes the GCS client connection.
func (GCSDataStore) GetFile ¶
func (b GCSDataStore) GetFile(ctx context.Context, filePath string) (io.ReadCloser, error)
GetFile retrieves a file from the GCS bucket.
func (GCSDataStore) GetFileMetadata ¶
func (b GCSDataStore) GetFileMetadata(ctx context.Context, filePath string) (map[string]string, error)
GetFileMetadata retrieves the metadata for the specified file in the GCS bucket.
func (GCSDataStore) GetSchema ¶
func (b GCSDataStore) GetSchema() DataStoreSchema
GetSchema returns the schema information which defines the structure and organization of data in the datastore.
func (GCSDataStore) PutFile ¶
func (b GCSDataStore) PutFile(ctx context.Context, filePath string, in io.WriterTo, metaData map[string]string) error
PutFile uploads a file to GCS
type MetaData ¶
type MockDataStore ¶
MockDataStore is a mock implementation for the Storage interface.
func (*MockDataStore) Close ¶
func (m *MockDataStore) Close() error
func (*MockDataStore) GetFile ¶
func (m *MockDataStore) GetFile(ctx context.Context, path string) (io.ReadCloser, error)
func (*MockDataStore) GetFileMetadata ¶
func (*MockDataStore) GetSchema ¶
func (m *MockDataStore) GetSchema() DataStoreSchema
func (*MockDataStore) PutFileIfNotExists ¶
type MockResumableManager ¶
type ResumableManager ¶
type ResumableManager interface { // Given a requested ledger range, return the first absent ledger within the // requested range of [start, end]. // // start - begin search inclusive from this ledger, must be greater than 0. // end - stop search inclusive to this ledger. // // If start=0, invalid, error will be returned. // // If end=0, is provided as a convenience, to allow requesting an effectively // dynamic end value for the range, which will be an approximation of the network's // most recent checkpointed ledger + (2 * checkpoint_frequency). // // return: // absentLedger - will be non-zero, the oldest ledger sequence between range of [start, end] // which is not populated on data store. // ok - if true, 'absentLedger' has a usable non-zero value, if false, there is no absent ledger in the requested range and 'absentLedger' is set to zero. // err - the search was cancelled due to this unexpected error, 'absentLedger' and 'ok' return values should be ignored. // // When no error, the two return values will compose the following truth table: // 1. datastore had no data in the requested range: absentLedger={start}, ok=true // 2. datastore had partial data in the requested range: absentLedger={a value > start and <= end}, ok=true // 3. datastore had all data in the requested range: absentLedger=0, ok=false FindStart(ctx context.Context, start, end uint32) (absentLedger uint32, ok bool, err error) }
func NewResumableManager ¶
func NewResumableManager(dataStore DataStore, ledgerBatchConfig DataStoreSchema, archive historyarchive.ArchiveInterface) ResumableManager