Documentation ¶
Index ¶
- type DiskPersistedStorage
- func (b *DiskPersistedStorage) Delete(k Key) error
- func (b *DiskPersistedStorage) Get(k Key) (io.ReadCloser, error)
- func (b *DiskPersistedStorage) PeriodicallyReportUsageMetrics(ctx context.Context, labels ...string)
- func (b *DiskPersistedStorage) Put(k Key, r io.Reader, t time.Time) error
- func (b *DiskPersistedStorage) Search(parent Prefix) ([]SearchResult, error)
- func (b *DiskPersistedStorage) String() string
- type InMemoryPersistedStorage
- func (b *InMemoryPersistedStorage) Delete(k Key) error
- func (b *InMemoryPersistedStorage) Get(k Key) (io.ReadCloser, error)
- func (b *InMemoryPersistedStorage) PeriodicallyReportUsageMetrics(ctx context.Context, labels ...string)
- func (b *InMemoryPersistedStorage) Put(k Key, r io.Reader, _ time.Time) error
- func (b *InMemoryPersistedStorage) Search(p Prefix) ([]SearchResult, error)
- func (b *InMemoryPersistedStorage) String() string
- type Key
- type ObjectPersistedStorage
- func (s ObjectPersistedStorage) Delete(k Key) error
- func (s ObjectPersistedStorage) Get(k Key) (io.ReadCloser, error)
- func (s ObjectPersistedStorage) PeriodicallyReportUsageMetrics(ctx context.Context, labels ...string)
- func (s ObjectPersistedStorage) Put(k Key, r io.Reader, _ time.Time) error
- func (s ObjectPersistedStorage) Search(p Prefix) ([]SearchResult, error)
- func (s ObjectPersistedStorage) String() string
- type PersistedStorage
- type Prefix
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiskPersistedStorage ¶
type DiskPersistedStorage struct {
// contains filtered or unexported fields
}
func (*DiskPersistedStorage) Delete ¶
func (b *DiskPersistedStorage) Delete(k Key) error
func (*DiskPersistedStorage) Get ¶
func (b *DiskPersistedStorage) Get(k Key) (io.ReadCloser, error)
func (*DiskPersistedStorage) PeriodicallyReportUsageMetrics ¶
func (b *DiskPersistedStorage) PeriodicallyReportUsageMetrics(ctx context.Context, labels ...string)
func (*DiskPersistedStorage) Search ¶
func (b *DiskPersistedStorage) Search(parent Prefix) ([]SearchResult, error)
func (*DiskPersistedStorage) String ¶
func (b *DiskPersistedStorage) String() string
type InMemoryPersistedStorage ¶
type InMemoryPersistedStorage struct {
// contains filtered or unexported fields
}
InMemoryPersistedStorage is a PersistedStorage that stores data in memory. It is, of course, an oxymoron. The type exists for testing only and as fallback for temporary storage when an on-disk temporary store cannot be obtained.
func NewInMemoryPersistedStorage ¶
func NewInMemoryPersistedStorage() *InMemoryPersistedStorage
func (*InMemoryPersistedStorage) Delete ¶
func (b *InMemoryPersistedStorage) Delete(k Key) error
func (*InMemoryPersistedStorage) Get ¶
func (b *InMemoryPersistedStorage) Get(k Key) (io.ReadCloser, error)
func (*InMemoryPersistedStorage) PeriodicallyReportUsageMetrics ¶
func (b *InMemoryPersistedStorage) PeriodicallyReportUsageMetrics(ctx context.Context, labels ...string)
func (*InMemoryPersistedStorage) Search ¶
func (b *InMemoryPersistedStorage) Search(p Prefix) ([]SearchResult, error)
func (*InMemoryPersistedStorage) String ¶
func (b *InMemoryPersistedStorage) String() string
type ObjectPersistedStorage ¶
type ObjectPersistedStorage struct {
// contains filtered or unexported fields
}
func (ObjectPersistedStorage) Delete ¶
func (s ObjectPersistedStorage) Delete(k Key) error
func (ObjectPersistedStorage) Get ¶
func (s ObjectPersistedStorage) Get(k Key) (io.ReadCloser, error)
func (ObjectPersistedStorage) PeriodicallyReportUsageMetrics ¶
func (s ObjectPersistedStorage) PeriodicallyReportUsageMetrics(ctx context.Context, labels ...string)
func (ObjectPersistedStorage) Search ¶
func (s ObjectPersistedStorage) Search(p Prefix) ([]SearchResult, error)
Search returns a list of all prefixes such that there is at least one key in storage with that prefix.
func (ObjectPersistedStorage) String ¶
func (s ObjectPersistedStorage) String() string
type PersistedStorage ¶
type PersistedStorage interface { Put(k Key, reader io.Reader, t time.Time) error // TODO: audit all usages of this to ensure the reader is closed Get(k Key) (io.ReadCloser, error) // Delete deletes the bytes associated with the provided key. // // If the key does not exist in storage, nil is returned. Delete(k Key) error // Search returns a list of all prefixes such that there is at least one key in storage // with that prefix as a superprefix. Search(p Prefix) ([]SearchResult, error) // PeriodicallyReportUsageMetrics periodically reports Prometheus metrics // for the storage, until the context is cancelled. // // Each implementation can require certain labels, or ignore labels entirely. PeriodicallyReportUsageMetrics(ctx context.Context, labels ...string) fmt.Stringer }
PersistedStorage is a place where bytes can be stored under a key.
func NewDiskPersistedStorage ¶
func NewDiskPersistedStorage(root string) PersistedStorage
func NewObjectPersistedStorage ¶
func NewObjectPersistedStorage(ctx context.Context, c *config.ObjectStorage, f *config.Feed) (PersistedStorage, error)
func NewVerifyingStorage ¶
func NewVerifyingStorage(backingStorage PersistedStorage) PersistedStorage
NewVerifyingStorage returns a wrapper around any PersistedStorage that performs data validation when Putting data.
When streaming the data to the underlying PersistedStorage, the wrapper calculates an MD5 checksum of the data. After the underlying storage returns, it re-reads the data in full and verifies the checksums match.
Methods other than Put invoke the underlying type directly.