Documentation
¶
Overview ¶
Package mysql contains a MySQL-based storage implementation for Tessera.
Index ¶
- type MigrationStorage
- type Storage
- func (s *Storage) Appender(ctx context.Context, opts *tessera.AppendOptions) (*tessera.Appender, tessera.LogReader, error)
- func (s *Storage) IntegratedSize(ctx context.Context) (uint64, error)
- func (s *Storage) MigrationWriter(ctx context.Context, opts *tessera.MigrationOptions) (tessera.MigrationWriter, tessera.LogReader, error)
- func (s *Storage) NextIndex(ctx context.Context) (uint64, error)
- func (s *Storage) ReadCheckpoint(ctx context.Context) ([]byte, error)
- func (s *Storage) ReadEntryBundle(ctx context.Context, index uint64, p uint8) ([]byte, error)
- func (s *Storage) ReadTile(ctx context.Context, level, index uint64, p uint8) ([]byte, error)
- func (s *Storage) StreamEntries(ctx context.Context, fromEntry uint64) (next func() (ri layout.RangeInfo, bundle []byte, err error), cancel func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MigrationStorage ¶ added in v0.1.1
type MigrationStorage struct {
// contains filtered or unexported fields
}
MigrationStorgage implements the tessera.MigrationTarget lifecycle contract.
func (*MigrationStorage) AwaitIntegration ¶ added in v0.1.1
AwaitIntegration blocks until the local integrated tree has grown to the provided size.
This implements part of the tessera MigrationTarget lifecycle contract.
As well as waiting for the integration to reach the desired size, this method is where the integration process itself actually happens.
func (*MigrationStorage) IntegratedSize ¶ added in v0.1.1
func (m *MigrationStorage) IntegratedSize(ctx context.Context) (uint64, error)
IntegratedSize returns the current size of the locally integrated log.
Implements the tessera MigrationTarget lifecycle contract.
func (*MigrationStorage) SetEntryBundle ¶ added in v0.1.1
func (m *MigrationStorage) SetEntryBundle(ctx context.Context, index uint64, partial uint8, bundle []byte) error
SetEntryBundle stores the provided serialised entry bundle at the location implied by the provided entry bundle index and partial size.
Implements the tessera MigrationTarget lifecycle contract.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a MySQL-based storage implementation for Tessera.
func (*Storage) Appender ¶ added in v0.1.1
func (s *Storage) Appender(ctx context.Context, opts *tessera.AppendOptions) (*tessera.Appender, tessera.LogReader, error)
Note that `tessera.WithCheckpointSigner()` is mandatory in the `opts` argument.
func (*Storage) IntegratedSize ¶ added in v0.1.1
IntegratedSize returns the current size of the integrated tree.
This is part of the tessera LogReader contract.
func (*Storage) MigrationWriter ¶ added in v0.1.2
func (s *Storage) MigrationWriter(ctx context.Context, opts *tessera.MigrationOptions) (tessera.MigrationWriter, tessera.LogReader, error)
MigrationWriter creates a new MySQL storage for the MigrationTarget lifecycle mode.
func (*Storage) NextIndex ¶ added in v0.1.2
NextIndex returns the next available leaf index.
Currently, this is the same as the integrated size since new leaves are integrated synchronously. This is part of the tessera LogReader contract.
func (*Storage) ReadCheckpoint ¶
ReadCheckpoint returns the latest stored checkpoint. If the checkpoint is not found, it returns os.ErrNotExist.
func (*Storage) ReadEntryBundle ¶
ReadEntryBundle returns the log entries at the given index. If the entry bundle is not found, it returns os.ErrNotExist.
Note that if a partial tile is requested, but a larger tile is available, this will return the largest tile available. This could be trimmed to return only the number of entries specifically requested if this behaviour becomes problematic.
func (*Storage) ReadTile ¶
ReadTile returns a full tile or a partial tile at the given level, index and treeSize. If the tile is not found, it returns os.ErrNotExist.
Note that if a partial tile is requested, but a larger tile is available, this will return the largest tile available. This could be trimmed to return only the number of entries specifically requested if this behaviour becomes problematic.
func (*Storage) StreamEntries ¶ added in v0.1.1
func (s *Storage) StreamEntries(ctx context.Context, fromEntry uint64) (next func() (ri layout.RangeInfo, bundle []byte, err error), cancel func())
StreamEntries() returns functions `next` and `cancel` which act like a pull iterator for consecutive entry bundles, starting with the entry bundle which contains the requested entry index.
This is part of the tessera LogReader contract.