Documentation ¶
Index ¶
- Constants
- func CreateHistoryArchiveFromNetworkName(ctx context.Context, networkName string) (historyarchive.ArchiveInterface, error)
- func GetHistoryArchivesCheckPointFrequency() uint32
- func GetLatestLedgerSequenceFromHistoryArchives(archive historyarchive.ArchiveInterface) (uint32, error)
- type DataStore
- func FromGCSClient(ctx context.Context, client *storage.Client, bucketPath string, network string) (DataStore, error)
- func NewDataStore(ctx context.Context, datastoreConfig DataStoreConfig, network string) (DataStore, error)
- func NewGCSDataStore(ctx context.Context, bucketPath string, network string) (DataStore, error)
- type DataStoreConfig
- 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) 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 LedgerBatchConfig
- 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) PutFile(ctx context.Context, path string, in io.WriterTo) error
- func (m *MockDataStore) PutFileIfNotExists(ctx context.Context, path string, in io.WriterTo) (bool, error)
- func (m *MockDataStore) Size(ctx context.Context, path string) (int64, error)
- type MockResumableManager
- type ResumableManager
Constants ¶
View Source
const Pubnet = "pubnet"
View Source
const Testnet = "testnet"
Variables ¶
This section is empty.
Functions ¶
func CreateHistoryArchiveFromNetworkName ¶
func CreateHistoryArchiveFromNetworkName(ctx context.Context, networkName string) (historyarchive.ArchiveInterface, error)
func GetHistoryArchivesCheckPointFrequency ¶
func GetHistoryArchivesCheckPointFrequency() uint32
func GetLatestLedgerSequenceFromHistoryArchives ¶
func GetLatestLedgerSequenceFromHistoryArchives(archive historyarchive.ArchiveInterface) (uint32, error)
Types ¶
type DataStore ¶
type DataStore interface { GetFile(ctx context.Context, path string) (io.ReadCloser, error) PutFile(ctx context.Context, path string, in io.WriterTo) error PutFileIfNotExists(ctx context.Context, path string, in io.WriterTo) (bool, error) Exists(ctx context.Context, path string) (bool, error) Size(ctx context.Context, path string) (int64, error) Close() error }
DataStore defines an interface for interacting with data storage
func FromGCSClient ¶
func NewDataStore ¶
func NewDataStore(ctx context.Context, datastoreConfig DataStoreConfig, network string) (DataStore, error)
NewDataStore factory, it creates a new DataStore based on the config type
type DataStoreConfig ¶
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) PutFileIfNotExists ¶
func (b GCSDataStore) PutFileIfNotExists(ctx context.Context, filePath string, in io.WriterTo) (bool, error)
PutFileIfNotExists uploads a file to GCS only if it doesn't already exist.
type LedgerBatchConfig ¶
type LedgerBatchConfig struct { LedgersPerFile uint32 `toml:"ledgers_per_file"` FilesPerPartition uint32 `toml:"files_per_partition"` }
func (LedgerBatchConfig) GetObjectKeyFromSequenceNumber ¶
func (ec LedgerBatchConfig) GetObjectKeyFromSequenceNumber(ledgerSeq uint32) string
GetObjectKeyFromSequenceNumber generates the object key name from the ledger sequence number based on configuration.
func (LedgerBatchConfig) GetSequenceNumberEndBoundary ¶
func (ec LedgerBatchConfig) GetSequenceNumberEndBoundary(ledgerSeq uint32) uint32
func (LedgerBatchConfig) GetSequenceNumberStartBoundary ¶
func (ec LedgerBatchConfig) GetSequenceNumberStartBoundary(ledgerSeq uint32) uint32
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) 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, network string, ledgerBatchConfig LedgerBatchConfig, archive historyarchive.ArchiveInterface) ResumableManager
Click to show internal directories.
Click to hide internal directories.