Documentation ¶
Index ¶
- Constants
- func BucketPath(bucket Hash) string
- func Categories() []string
- func CategoryCheckpointPath(cat string, chk uint32) string
- func ConnectBackend(u string, opts storage.ConnectOptions) (storage.Storage, error)
- func DumpXdrAsJson(args []string) error
- func Mirror(src *Archive, dst *Archive, opts *CommandOptions) error
- func NameLockfile(file string) string
- func RangePaths(r Range) []string
- func Repair(src *Archive, dst *Archive, opts *CommandOptions) error
- func SortTxsForHash(txset *xdr.TransactionSet) error
- type Archive
- func (a *Archive) BucketExists(bucket Hash) (bool, error)
- func (a *Archive) BucketSize(bucket Hash) (int64, error)
- func (a *Archive) CategoryCheckpointExists(cat string, chk uint32) (bool, error)
- func (arch *Archive) CheckBucketsMissing() map[Hash]bool
- func (arch *Archive) CheckCheckpointFilesMissing(opts *CommandOptions) map[string][]uint32
- func (arch *Archive) ClearCachedInfo()
- func (a *Archive) GetBucketPathForHash(hash Hash) string
- func (a *Archive) GetCheckpointHAS(chk uint32) (HistoryArchiveState, error)
- func (arch *Archive) GetCheckpointManager() CheckpointManager
- func (a *Archive) GetLatestLedgerSequence() (uint32, error)
- func (a *Archive) GetLedgerHeader(ledger uint32) (xdr.LedgerHeaderHistoryEntry, error)
- func (a *Archive) GetLedgers(start, end uint32) (map[uint32]*Ledger, error)
- func (a *Archive) GetPathHAS(path string) (HistoryArchiveState, error)
- func (a *Archive) GetRootHAS() (HistoryArchiveState, error)
- func (arch *Archive) GetStats() []ArchiveStats
- func (a *Archive) GetXdrStream(pth string) (*XdrStream, error)
- func (a *Archive) GetXdrStreamForHash(hash Hash) (*XdrStream, error)
- func (a *Archive) ListAllBucketHashes() (chan Hash, chan error)
- func (a *Archive) ListAllBuckets() (chan string, chan error)
- func (a *Archive) ListBucket(dp DirPrefix) (chan string, chan error)
- func (a *Archive) ListCategoryCheckpoints(cat string, pth string) (chan uint32, chan error)
- func (arch *Archive) Log(opts *CommandOptions) error
- func (arch *Archive) MustGetBucketSize(hash Hash) int64
- func (arch *Archive) MustGetLedgerHeaderHistoryEntries(chk uint32) []xdr.LedgerHeaderHistoryEntry
- func (arch *Archive) MustGetTransactionHistoryEntries(chk uint32) []xdr.TransactionHistoryEntry
- func (arch *Archive) NoteCheckpointFile(cat string, chk uint32, present bool)
- func (arch *Archive) NoteExistingBucket(bucket Hash)
- func (arch *Archive) NoteReferencedBucket(bucket Hash) bool
- func (a *Archive) PutCheckpointHAS(chk uint32, has HistoryArchiveState, opts *CommandOptions) error
- func (a *Archive) PutPathHAS(path string, has HistoryArchiveState, opts *CommandOptions) error
- func (a *Archive) PutRootHAS(has HistoryArchiveState, opts *CommandOptions) error
- func (arch *Archive) ReportBucketStats()
- func (arch *Archive) ReportCheckpointStats()
- func (arch *Archive) ReportInvalid(opts *CommandOptions) (bool, error)
- func (arch *Archive) ReportMissing(opts *CommandOptions) (bool, error)
- func (arch *Archive) Scan(opts *CommandOptions) error
- func (arch *Archive) ScanAllBuckets() error
- func (arch *Archive) ScanBuckets(opts *CommandOptions) error
- func (arch *Archive) ScanCheckpoints(opts *CommandOptions) error
- func (arch *Archive) ScanCheckpointsFast(opts *CommandOptions) error
- func (arch *Archive) ScanCheckpointsSlow(opts *CommandOptions) error
- func (arch *Archive) VerifyBucketEntries(h Hash) error
- func (arch *Archive) VerifyBucketHash(h Hash) error
- func (arch *Archive) VerifyCategoryCheckpoint(cat string, chk uint32) error
- func (arch *Archive) VerifyLedgerHeaderHistoryEntry(entry *xdr.LedgerHeaderHistoryEntry) error
- func (arch *Archive) VerifyTransactionHistoryEntry(entry *xdr.TransactionHistoryEntry) error
- func (arch *Archive) VerifyTransactionHistoryResultEntry(entry *xdr.TransactionHistoryResultEntry) error
- type ArchiveBucketCache
- type ArchiveInterface
- type ArchiveOptions
- type ArchivePool
- func (pa *ArchivePool) BucketExists(bucket Hash) (bool, error)
- func (pa *ArchivePool) BucketSize(bucket Hash) (int64, error)
- func (pa *ArchivePool) CategoryCheckpointExists(cat string, chk uint32) (bool, error)
- func (pa *ArchivePool) GetCheckpointHAS(chk uint32) (HistoryArchiveState, error)
- func (pa *ArchivePool) GetCheckpointManager() CheckpointManager
- func (pa *ArchivePool) GetLatestLedgerSequence() (uint32, error)
- func (pa *ArchivePool) GetLedgerHeader(chk uint32) (xdr.LedgerHeaderHistoryEntry, error)
- func (pa *ArchivePool) GetLedgers(start, end uint32) (map[uint32]*Ledger, error)
- func (pa *ArchivePool) GetPathHAS(path string) (HistoryArchiveState, error)
- func (pa *ArchivePool) GetRootHAS() (HistoryArchiveState, error)
- func (pa *ArchivePool) GetStats() []ArchiveStats
- func (pa *ArchivePool) GetXdrStream(pth string) (*XdrStream, error)
- func (pa *ArchivePool) GetXdrStreamForHash(hash Hash) (*XdrStream, error)
- func (pa *ArchivePool) ListAllBucketHashes() (chan Hash, chan error)
- func (pa *ArchivePool) ListAllBuckets() (chan string, chan error)
- func (pa *ArchivePool) ListBucket(dp DirPrefix) (chan string, chan error)
- func (pa *ArchivePool) ListCategoryCheckpoints(cat string, pth string) (chan uint32, chan error)
- func (pa *ArchivePool) PutCheckpointHAS(chk uint32, has HistoryArchiveState, opts *CommandOptions) error
- func (pa *ArchivePool) PutPathHAS(path string, has HistoryArchiveState, opts *CommandOptions) error
- func (pa *ArchivePool) PutRootHAS(has HistoryArchiveState, opts *CommandOptions) error
- type ArchiveStats
- type CacheOptions
- type CheckpointManager
- func (c CheckpointManager) GetCheckpoint(i uint32) uint32
- func (c CheckpointManager) GetCheckpointFrequency() uint32
- func (c CheckpointManager) GetCheckpointRange(i uint32) Range
- func (c CheckpointManager) IsCheckpoint(i uint32) bool
- func (c CheckpointManager) MakeRange(low uint32, high uint32) Range
- func (c CheckpointManager) NextCheckpoint(i uint32) uint32
- func (c CheckpointManager) PrevCheckpoint(i uint32) uint32
- type CommandOptions
- type DirPrefix
- type FailingMockArchiveBackend
- func (b *FailingMockArchiveBackend) CanListFiles() bool
- func (b *FailingMockArchiveBackend) Close() error
- func (b *FailingMockArchiveBackend) Exists(pth string) (bool, error)
- func (b *FailingMockArchiveBackend) GetFile(pth string) (io.ReadCloser, error)
- func (b *FailingMockArchiveBackend) ListFiles(pth string) (chan string, chan error)
- func (b *FailingMockArchiveBackend) PutFile(pth string, in io.ReadCloser) error
- func (b *FailingMockArchiveBackend) Size(pth string) (int64, error)
- type FakeReader
- type Hash
- type HistoryArchiveState
- func (h *HistoryArchiveState) BucketListHash() (xdr.Hash, error)
- func (h *HistoryArchiveState) Buckets() ([]Hash, error)
- func (has *HistoryArchiveState) GetChangedBuckets(arch *Archive, prevHas *HistoryArchiveState) (string, int, int64)
- func (h *HistoryArchiveState) LevelSummary() (string, int, error)
- func (h *HistoryArchiveState) Range() Range
- type Ledger
- type MockArchive
- func (m *MockArchive) BucketExists(bucket Hash) (bool, error)
- func (m *MockArchive) BucketSize(bucket Hash) (int64, error)
- func (m *MockArchive) CategoryCheckpointExists(cat string, chk uint32) (bool, error)
- func (m *MockArchive) GetCheckpointHAS(chk uint32) (HistoryArchiveState, error)
- func (m *MockArchive) GetCheckpointManager() CheckpointManager
- func (m *MockArchive) GetLatestLedgerSequence() (uint32, error)
- func (m *MockArchive) GetLedgerHeader(chk uint32) (xdr.LedgerHeaderHistoryEntry, error)
- func (m *MockArchive) GetLedgers(start, end uint32) (map[uint32]*Ledger, error)
- func (m *MockArchive) GetPathHAS(path string) (HistoryArchiveState, error)
- func (m *MockArchive) GetRootHAS() (HistoryArchiveState, error)
- func (m *MockArchive) GetStats() []ArchiveStats
- func (m *MockArchive) GetXdrStream(pth string) (*XdrStream, error)
- func (m *MockArchive) GetXdrStreamForHash(hash Hash) (*XdrStream, error)
- func (m *MockArchive) ListAllBucketHashes() (chan Hash, chan error)
- func (m *MockArchive) ListAllBuckets() (chan string, chan error)
- func (m *MockArchive) ListBucket(dp DirPrefix) (chan string, chan error)
- func (m *MockArchive) ListCategoryCheckpoints(cat string, pth string) (chan uint32, chan error)
- func (m *MockArchive) PutCheckpointHAS(chk uint32, has HistoryArchiveState, opts *CommandOptions) error
- func (m *MockArchive) PutPathHAS(path string, has HistoryArchiveState, opts *CommandOptions) error
- func (m *MockArchive) PutRootHAS(has HistoryArchiveState, opts *CommandOptions) error
- type MockArchiveBackend
- func (b *MockArchiveBackend) CanListFiles() bool
- func (b *MockArchiveBackend) Close() error
- func (b *MockArchiveBackend) Exists(pth string) (bool, error)
- func (b *MockArchiveBackend) GetFile(pth string) (io.ReadCloser, error)
- func (b *MockArchiveBackend) ListFiles(pth string) (chan string, chan error)
- func (b *MockArchiveBackend) PutFile(pth string, in io.ReadCloser) error
- func (b *MockArchiveBackend) Size(pth string) (int64, error)
- type MockArchiveStats
- type Range
- type XdrStream
- func (x *XdrStream) BytesRead() int64
- func (x *XdrStream) Close() error
- func (x *XdrStream) Discard(n int64) (int64, error)
- func (x *XdrStream) ExpectedHash() ([sha256.Size]byte, bool)
- func (x *XdrStream) GzipBytesRead() int64
- func (x *XdrStream) ReadOne(in xdr.DecoderFrom) error
- func (x *XdrStream) SetExpectedHash(hash [sha256.Size]byte)
Constants ¶
const DefaultCheckpointFrequency = uint32(64)
const NumLevels = 11
Variables ¶
This section is empty.
Functions ¶
func BucketPath ¶
func Categories ¶
func Categories() []string
func CategoryCheckpointPath ¶
func ConnectBackend ¶
func DumpXdrAsJson ¶
func Mirror ¶
func Mirror(src *Archive, dst *Archive, opts *CommandOptions) error
Mirror mirrors an archive, it assumes that the source and destination have the same checkpoint ledger frequency
func NameLockfile ¶
func RangePaths ¶
Returns an array of path prefixes to walk to enumerate all the objects in the provided range.
func Repair ¶
func Repair(src *Archive, dst *Archive, opts *CommandOptions) error
Repair repairs a destination archive based on a source archive, it assumes that the source and destination have the same checkpoint ledger frequency
func SortTxsForHash ¶
func SortTxsForHash(txset *xdr.TransactionSet) error
Types ¶
type Archive ¶
type Archive struct {
// contains filtered or unexported fields
}
func MustConnect ¶
func MustConnect(u string, opts ArchiveOptions) *Archive
func (*Archive) CategoryCheckpointExists ¶
func (*Archive) CheckBucketsMissing ¶
func (*Archive) CheckCheckpointFilesMissing ¶
func (arch *Archive) CheckCheckpointFilesMissing(opts *CommandOptions) map[string][]uint32
func (*Archive) ClearCachedInfo ¶
func (arch *Archive) ClearCachedInfo()
func (*Archive) GetBucketPathForHash ¶
func (*Archive) GetCheckpointHAS ¶
func (a *Archive) GetCheckpointHAS(chk uint32) (HistoryArchiveState, error)
func (*Archive) GetCheckpointManager ¶
func (arch *Archive) GetCheckpointManager() CheckpointManager
func (*Archive) GetLatestLedgerSequence ¶
func (*Archive) GetLedgerHeader ¶
func (a *Archive) GetLedgerHeader(ledger uint32) (xdr.LedgerHeaderHistoryEntry, error)
func (*Archive) GetLedgers ¶
func (*Archive) GetPathHAS ¶
func (a *Archive) GetPathHAS(path string) (HistoryArchiveState, error)
func (*Archive) GetRootHAS ¶
func (a *Archive) GetRootHAS() (HistoryArchiveState, error)
func (*Archive) GetStats ¶
func (arch *Archive) GetStats() []ArchiveStats
func (*Archive) GetXdrStreamForHash ¶
func (*Archive) ListAllBucketHashes ¶
func (*Archive) ListAllBuckets ¶
func (*Archive) ListCategoryCheckpoints ¶
func (*Archive) Log ¶
func (arch *Archive) Log(opts *CommandOptions) error
func (*Archive) MustGetBucketSize ¶
func (*Archive) MustGetLedgerHeaderHistoryEntries ¶
func (arch *Archive) MustGetLedgerHeaderHistoryEntries(chk uint32) []xdr.LedgerHeaderHistoryEntry
func (*Archive) MustGetTransactionHistoryEntries ¶
func (arch *Archive) MustGetTransactionHistoryEntries(chk uint32) []xdr.TransactionHistoryEntry
func (*Archive) NoteCheckpointFile ¶
func (*Archive) NoteExistingBucket ¶
func (*Archive) NoteReferencedBucket ¶
func (*Archive) PutCheckpointHAS ¶
func (a *Archive) PutCheckpointHAS(chk uint32, has HistoryArchiveState, opts *CommandOptions) error
func (*Archive) PutPathHAS ¶
func (a *Archive) PutPathHAS(path string, has HistoryArchiveState, opts *CommandOptions) error
func (*Archive) PutRootHAS ¶
func (a *Archive) PutRootHAS(has HistoryArchiveState, opts *CommandOptions) error
func (*Archive) ReportBucketStats ¶
func (arch *Archive) ReportBucketStats()
func (*Archive) ReportCheckpointStats ¶
func (arch *Archive) ReportCheckpointStats()
func (*Archive) ReportInvalid ¶
func (arch *Archive) ReportInvalid(opts *CommandOptions) (bool, error)
func (*Archive) ReportMissing ¶
func (arch *Archive) ReportMissing(opts *CommandOptions) (bool, error)
func (*Archive) Scan ¶
func (arch *Archive) Scan(opts *CommandOptions) error
func (*Archive) ScanAllBuckets ¶
func (*Archive) ScanBuckets ¶
func (arch *Archive) ScanBuckets(opts *CommandOptions) error
func (*Archive) ScanCheckpoints ¶
func (arch *Archive) ScanCheckpoints(opts *CommandOptions) error
func (*Archive) ScanCheckpointsFast ¶
func (arch *Archive) ScanCheckpointsFast(opts *CommandOptions) error
func (*Archive) ScanCheckpointsSlow ¶
func (arch *Archive) ScanCheckpointsSlow(opts *CommandOptions) error
func (*Archive) VerifyBucketEntries ¶
func (*Archive) VerifyBucketHash ¶
func (*Archive) VerifyCategoryCheckpoint ¶
func (*Archive) VerifyLedgerHeaderHistoryEntry ¶
func (arch *Archive) VerifyLedgerHeaderHistoryEntry(entry *xdr.LedgerHeaderHistoryEntry) error
func (*Archive) VerifyTransactionHistoryEntry ¶
func (arch *Archive) VerifyTransactionHistoryEntry(entry *xdr.TransactionHistoryEntry) error
func (*Archive) VerifyTransactionHistoryResultEntry ¶
func (arch *Archive) VerifyTransactionHistoryResultEntry(entry *xdr.TransactionHistoryResultEntry) error
type ArchiveBucketCache ¶
type ArchiveBucketCache struct {
// contains filtered or unexported fields
}
func MakeArchiveBucketCache ¶
func MakeArchiveBucketCache(opts CacheOptions) (*ArchiveBucketCache, error)
MakeArchiveBucketCache creates a cache on the disk at the given path that acts as an LRU cache, mimicking a particular upstream.
func (*ArchiveBucketCache) Close ¶
func (abc *ArchiveBucketCache) Close() error
Close purges the cache and cleans up the filesystem.
func (*ArchiveBucketCache) Evict ¶
func (abc *ArchiveBucketCache) Evict(filepath string)
Evict removes a file from the cache and the filesystem.
func (*ArchiveBucketCache) Exists ¶
func (abc *ArchiveBucketCache) Exists(filepath string) bool
func (*ArchiveBucketCache) GetFile ¶
func (abc *ArchiveBucketCache) GetFile( filepath string, upstream storage.Storage, ) (io.ReadCloser, bool, error)
GetFile retrieves the file contents from the local cache if present. Otherwise, it returns the same result as the upstream, adding that result into the local cache if possible. It returns a 3-tuple of a reader (which may be nil on an error), an indication of whether or not it was *found* in the cache, and any error.
type ArchiveInterface ¶
type ArchiveInterface interface { GetPathHAS(path string) (HistoryArchiveState, error) PutPathHAS(path string, has HistoryArchiveState, opts *CommandOptions) error BucketExists(bucket Hash) (bool, error) BucketSize(bucket Hash) (int64, error) CategoryCheckpointExists(cat string, chk uint32) (bool, error) GetLedgerHeader(chk uint32) (xdr.LedgerHeaderHistoryEntry, error) GetRootHAS() (HistoryArchiveState, error) GetLedgers(start, end uint32) (map[uint32]*Ledger, error) GetLatestLedgerSequence() (uint32, error) GetCheckpointHAS(chk uint32) (HistoryArchiveState, error) PutCheckpointHAS(chk uint32, has HistoryArchiveState, opts *CommandOptions) error PutRootHAS(has HistoryArchiveState, opts *CommandOptions) error ListBucket(dp DirPrefix) (chan string, chan error) ListAllBuckets() (chan string, chan error) ListAllBucketHashes() (chan Hash, chan error) ListCategoryCheckpoints(cat string, pth string) (chan uint32, chan error) GetXdrStreamForHash(hash Hash) (*XdrStream, error) GetXdrStream(pth string) (*XdrStream, error) GetCheckpointManager() CheckpointManager GetStats() []ArchiveStats }
func NewArchivePool ¶
func NewArchivePool(archiveURLs []string, opts ArchiveOptions) (ArchiveInterface, error)
NewArchivePool tries connecting to each of the provided history archive URLs, returning a pool of valid archives.
If none of the archives work, this returns the error message of the last failed archive. Note that the errors for each individual archive are hard to track if there's success overall.
func NewArchivePoolWithBackoff ¶
func NewArchivePoolWithBackoff(archiveURLs []string, opts ArchiveOptions, strategy backoff.BackOff) (ArchiveInterface, error)
type ArchiveOptions ¶
type ArchiveOptions struct { storage.ConnectOptions Logger *supportlog.Entry // NetworkPassphrase defines the expected network of history archive. It is // checked when getting HAS. If network passphrase does not match, error is // returned. NetworkPassphrase string // CheckpointFrequency is the number of ledgers between checkpoints // if unset, DefaultCheckpointFrequency will be used CheckpointFrequency uint32 // CachePath controls where/if bucket files are cached on the disk. CachePath string }
type ArchivePool ¶
type ArchivePool struct {
// contains filtered or unexported fields
}
An ArchivePool is just a collection of `ArchiveInterface`s so that we can distribute requests fairly throughout the pool.
func (*ArchivePool) BucketExists ¶
func (pa *ArchivePool) BucketExists(bucket Hash) (bool, error)
func (*ArchivePool) BucketSize ¶
func (pa *ArchivePool) BucketSize(bucket Hash) (int64, error)
func (*ArchivePool) CategoryCheckpointExists ¶
func (pa *ArchivePool) CategoryCheckpointExists(cat string, chk uint32) (bool, error)
func (*ArchivePool) GetCheckpointHAS ¶
func (pa *ArchivePool) GetCheckpointHAS(chk uint32) (HistoryArchiveState, error)
func (*ArchivePool) GetCheckpointManager ¶
func (pa *ArchivePool) GetCheckpointManager() CheckpointManager
func (*ArchivePool) GetLatestLedgerSequence ¶
func (pa *ArchivePool) GetLatestLedgerSequence() (uint32, error)
func (*ArchivePool) GetLedgerHeader ¶
func (pa *ArchivePool) GetLedgerHeader(chk uint32) (xdr.LedgerHeaderHistoryEntry, error)
func (*ArchivePool) GetLedgers ¶
func (pa *ArchivePool) GetLedgers(start, end uint32) (map[uint32]*Ledger, error)
func (*ArchivePool) GetPathHAS ¶
func (pa *ArchivePool) GetPathHAS(path string) (HistoryArchiveState, error)
func (*ArchivePool) GetRootHAS ¶
func (pa *ArchivePool) GetRootHAS() (HistoryArchiveState, error)
func (*ArchivePool) GetStats ¶
func (pa *ArchivePool) GetStats() []ArchiveStats
func (*ArchivePool) GetXdrStream ¶
func (pa *ArchivePool) GetXdrStream(pth string) (*XdrStream, error)
func (*ArchivePool) GetXdrStreamForHash ¶
func (pa *ArchivePool) GetXdrStreamForHash(hash Hash) (*XdrStream, error)
func (*ArchivePool) ListAllBucketHashes ¶
func (pa *ArchivePool) ListAllBucketHashes() (chan Hash, chan error)
func (*ArchivePool) ListAllBuckets ¶
func (pa *ArchivePool) ListAllBuckets() (chan string, chan error)
func (*ArchivePool) ListBucket ¶
func (pa *ArchivePool) ListBucket(dp DirPrefix) (chan string, chan error)
func (*ArchivePool) ListCategoryCheckpoints ¶
func (pa *ArchivePool) ListCategoryCheckpoints(cat string, pth string) (chan uint32, chan error)
func (*ArchivePool) PutCheckpointHAS ¶
func (pa *ArchivePool) PutCheckpointHAS(chk uint32, has HistoryArchiveState, opts *CommandOptions) error
func (*ArchivePool) PutPathHAS ¶
func (pa *ArchivePool) PutPathHAS(path string, has HistoryArchiveState, opts *CommandOptions) error
func (*ArchivePool) PutRootHAS ¶
func (pa *ArchivePool) PutRootHAS(has HistoryArchiveState, opts *CommandOptions) error
type ArchiveStats ¶
type CacheOptions ¶
type CheckpointManager ¶
type CheckpointManager struct {
// contains filtered or unexported fields
}
func NewCheckpointManager ¶
func NewCheckpointManager(checkpointFrequency uint32) CheckpointManager
NewCheckpointManager creates a CheckpointManager based on a checkpoint frequency (the number of ledgers between ledger checkpoints). If checkpointFrequency is 0 DefaultCheckpointFrequency will be used.
func (CheckpointManager) GetCheckpoint ¶
func (c CheckpointManager) GetCheckpoint(i uint32) uint32
GetCheckPoint gets the checkpoint containing information about the given ledger sequence
func (CheckpointManager) GetCheckpointFrequency ¶
func (c CheckpointManager) GetCheckpointFrequency() uint32
func (CheckpointManager) GetCheckpointRange ¶
func (c CheckpointManager) GetCheckpointRange(i uint32) Range
GetCheckpointRange gets the range of the checkpoint containing information for the given ledger sequence
func (CheckpointManager) IsCheckpoint ¶
func (c CheckpointManager) IsCheckpoint(i uint32) bool
func (CheckpointManager) MakeRange ¶
func (c CheckpointManager) MakeRange(low uint32, high uint32) Range
func (CheckpointManager) NextCheckpoint ¶
func (c CheckpointManager) NextCheckpoint(i uint32) uint32
NextCheckpoint returns the checkpoint ledger following `i`.
func (CheckpointManager) PrevCheckpoint ¶
func (c CheckpointManager) PrevCheckpoint(i uint32) uint32
PrevCheckpoint returns the checkpoint ledger preceding `i`.
type CommandOptions ¶
type FailingMockArchiveBackend ¶
type FailingMockArchiveBackend struct {
// contains filtered or unexported fields
}
FailingMockArchiveBackend is a mocking backend that will fail only when you try to read but otherwise behave like MockArchiveBackend.
func (*FailingMockArchiveBackend) CanListFiles ¶
func (b *FailingMockArchiveBackend) CanListFiles() bool
func (*FailingMockArchiveBackend) Close ¶
func (b *FailingMockArchiveBackend) Close() error
func (*FailingMockArchiveBackend) Exists ¶
func (b *FailingMockArchiveBackend) Exists(pth string) (bool, error)
func (*FailingMockArchiveBackend) GetFile ¶
func (b *FailingMockArchiveBackend) GetFile(pth string) (io.ReadCloser, error)
func (*FailingMockArchiveBackend) ListFiles ¶
func (b *FailingMockArchiveBackend) ListFiles(pth string) (chan string, chan error)
func (*FailingMockArchiveBackend) PutFile ¶
func (b *FailingMockArchiveBackend) PutFile(pth string, in io.ReadCloser) error
type FakeReader ¶
type FakeReader struct {
// contains filtered or unexported fields
}
func (*FakeReader) Close ¶
func (fr *FakeReader) Close() error
type Hash ¶
func DecodeHash ¶
func EmptyXdrArrayHash ¶
func EmptyXdrArrayHash() Hash
func HashEmptyTxSet ¶
func MustDecodeHash ¶
type HistoryArchiveState ¶
type HistoryArchiveState struct { Version int `json:"version"` Server string `json:"server"` CurrentLedger uint32 `json:"currentLedger"` // NetworkPassphrase was added in Stellar-Core v14.1.0. Can be missing // in HAS created by previous versions. NetworkPassphrase string `json:"networkPassphrase"` CurrentBuckets [NumLevels]struct { Curr string `json:"curr"` Snap string `json:"snap"` Next struct { State uint32 `json:"state"` Output string `json:"output,omitempty"` } `json:"next"` } `json:"currentBuckets"` }
func (*HistoryArchiveState) BucketListHash ¶
func (h *HistoryArchiveState) BucketListHash() (xdr.Hash, error)
BucketListHash calculates the hash of bucket list in the HistoryArchiveState. This can be later compared with LedgerHeader.BucketListHash of the checkpoint ledger to ensure data in history archive has not been changed by a malicious actor. Warning: Ledger header should be fetched from a trusted (!) stellar-core instead of ex. history archives!
func (*HistoryArchiveState) Buckets ¶
func (h *HistoryArchiveState) Buckets() ([]Hash, error)
func (*HistoryArchiveState) GetChangedBuckets ¶
func (has *HistoryArchiveState) GetChangedBuckets(arch *Archive, prevHas *HistoryArchiveState) (string, int, int64)
func (*HistoryArchiveState) LevelSummary ¶
func (h *HistoryArchiveState) LevelSummary() (string, int, error)
func (*HistoryArchiveState) Range ¶
func (h *HistoryArchiveState) Range() Range
type Ledger ¶
type Ledger struct { Header xdr.LedgerHeaderHistoryEntry Transaction xdr.TransactionHistoryEntry TransactionResult xdr.TransactionHistoryResultEntry }
type MockArchive ¶
MockArchive is a mockable archive.
func (*MockArchive) BucketExists ¶
func (m *MockArchive) BucketExists(bucket Hash) (bool, error)
func (*MockArchive) BucketSize ¶
func (m *MockArchive) BucketSize(bucket Hash) (int64, error)
func (*MockArchive) CategoryCheckpointExists ¶
func (m *MockArchive) CategoryCheckpointExists(cat string, chk uint32) (bool, error)
func (*MockArchive) GetCheckpointHAS ¶
func (m *MockArchive) GetCheckpointHAS(chk uint32) (HistoryArchiveState, error)
func (*MockArchive) GetCheckpointManager ¶
func (m *MockArchive) GetCheckpointManager() CheckpointManager
func (*MockArchive) GetLatestLedgerSequence ¶
func (m *MockArchive) GetLatestLedgerSequence() (uint32, error)
func (*MockArchive) GetLedgerHeader ¶
func (m *MockArchive) GetLedgerHeader(chk uint32) (xdr.LedgerHeaderHistoryEntry, error)
func (*MockArchive) GetLedgers ¶
func (m *MockArchive) GetLedgers(start, end uint32) (map[uint32]*Ledger, error)
func (*MockArchive) GetPathHAS ¶
func (m *MockArchive) GetPathHAS(path string) (HistoryArchiveState, error)
func (*MockArchive) GetRootHAS ¶
func (m *MockArchive) GetRootHAS() (HistoryArchiveState, error)
func (*MockArchive) GetStats ¶
func (m *MockArchive) GetStats() []ArchiveStats
func (*MockArchive) GetXdrStream ¶
func (m *MockArchive) GetXdrStream(pth string) (*XdrStream, error)
func (*MockArchive) GetXdrStreamForHash ¶
func (m *MockArchive) GetXdrStreamForHash(hash Hash) (*XdrStream, error)
func (*MockArchive) ListAllBucketHashes ¶
func (m *MockArchive) ListAllBucketHashes() (chan Hash, chan error)
func (*MockArchive) ListAllBuckets ¶
func (m *MockArchive) ListAllBuckets() (chan string, chan error)
func (*MockArchive) ListBucket ¶
func (m *MockArchive) ListBucket(dp DirPrefix) (chan string, chan error)
func (*MockArchive) ListCategoryCheckpoints ¶
func (m *MockArchive) ListCategoryCheckpoints(cat string, pth string) (chan uint32, chan error)
func (*MockArchive) PutCheckpointHAS ¶
func (m *MockArchive) PutCheckpointHAS(chk uint32, has HistoryArchiveState, opts *CommandOptions) error
func (*MockArchive) PutPathHAS ¶
func (m *MockArchive) PutPathHAS(path string, has HistoryArchiveState, opts *CommandOptions) error
func (*MockArchive) PutRootHAS ¶
func (m *MockArchive) PutRootHAS(has HistoryArchiveState, opts *CommandOptions) error
type MockArchiveBackend ¶
type MockArchiveBackend struct {
// contains filtered or unexported fields
}
func (*MockArchiveBackend) CanListFiles ¶
func (b *MockArchiveBackend) CanListFiles() bool
func (*MockArchiveBackend) Close ¶
func (b *MockArchiveBackend) Close() error
func (*MockArchiveBackend) GetFile ¶
func (b *MockArchiveBackend) GetFile(pth string) (io.ReadCloser, error)
func (*MockArchiveBackend) ListFiles ¶
func (b *MockArchiveBackend) ListFiles(pth string) (chan string, chan error)
func (*MockArchiveBackend) PutFile ¶
func (b *MockArchiveBackend) PutFile(pth string, in io.ReadCloser) error
type MockArchiveStats ¶
func (*MockArchiveStats) GetBackendName ¶
func (m *MockArchiveStats) GetBackendName() string
func (*MockArchiveStats) GetCacheBandwidth ¶
func (m *MockArchiveStats) GetCacheBandwidth() uint64
func (*MockArchiveStats) GetCacheHits ¶
func (m *MockArchiveStats) GetCacheHits() uint32
func (*MockArchiveStats) GetDownloads ¶
func (m *MockArchiveStats) GetDownloads() uint32
func (*MockArchiveStats) GetRequests ¶
func (m *MockArchiveStats) GetRequests() uint32
func (*MockArchiveStats) GetUploads ¶
func (m *MockArchiveStats) GetUploads() uint32
type Range ¶
func (Range) GenerateCheckpoints ¶
func (r Range) GenerateCheckpoints(cManager CheckpointManager) chan uint32
func (Range) SizeInCheckPoints ¶
func (r Range) SizeInCheckPoints(cManager CheckpointManager) int
type XdrStream ¶
type XdrStream struct {
// contains filtered or unexported fields
}
func CreateXdrStream ¶
func CreateXdrStream(entries ...xdr.BucketEntry) *XdrStream
func NewXdrGzStream ¶
func NewXdrGzStream(in io.ReadCloser) (*XdrStream, error)
func NewXdrStream ¶
func NewXdrStream(in io.ReadCloser) *XdrStream
func (*XdrStream) Close ¶
Close closes all internal readers and checks if the expected hash (if set by SetExpectedHash) matches the actual hash of the stream.
func (*XdrStream) ExpectedHash ¶
ExpectedHash returns the expected hash and a boolean indicating if the expected hash was set
func (*XdrStream) GzipBytesRead ¶
GzipBytesRead returns the number of gzip bytes read in the stream. Returns -1 if underlying reader is not gzipped.