waitingcache

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 8 Imported by: 1

README

Waiting cache

A waiting cache is used at the destination of a migration. When you create NewWaitingCache it returns a local and a remote storage.StorageProvider.

  • Any reads from the local result in a NeedAt being sent. It will then WAIT until all the data is available.
  • Any writes to the remote result in the data being marked as locally available, and will unblock any reads waiting.
  • Any writes to the local result in a DontNeedAt being sent, and the block is marked as locally available.
  • Reads from remote are unsupported.

It should be noted that only COMPLETE blocks are tracked. For this reason remote WriteAts should be aligned and complete blocks - as from a migrator.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWaitingCache

func NewWaitingCache(prov storage.Provider, blockSize int) (*Local, *Remote)

func NewWaitingCacheWithLogger added in v0.1.3

func NewWaitingCacheWithLogger(prov storage.Provider, blockSize int, log types.Logger) (*Local, *Remote)

Types

type Local added in v0.1.0

type Local struct {
	storage.ProviderWithEvents

	NeedAt     func(offset int64, length int32)
	DontNeedAt func(offset int64, length int32)
	// contains filtered or unexported fields
}

func (*Local) Availability added in v0.1.0

func (wcl *Local) Availability() (int, int)

func (*Local) CancelWrites added in v0.1.0

func (wcl *Local) CancelWrites(offset int64, length int64)

func (*Local) Close added in v0.1.0

func (wcl *Local) Close() error

func (*Local) DirtyBlocks added in v0.1.0

func (wcl *Local) DirtyBlocks(blocks []uint)

func (*Local) Flush added in v0.1.0

func (wcl *Local) Flush() error

func (*Local) GetMetrics added in v0.1.5

func (wcl *Local) GetMetrics() *Metrics

func (*Local) ReadAt added in v0.1.0

func (wcl *Local) ReadAt(buffer []byte, offset int64) (int, error)

func (*Local) SendSiloEvent added in v0.1.0

func (wcl *Local) SendSiloEvent(eventType storage.EventType, eventData storage.EventData) []storage.EventReturnData

Relay events to embedded StorageProvider

func (*Local) Size added in v0.1.0

func (wcl *Local) Size() uint64

func (*Local) WriteAt added in v0.1.0

func (wcl *Local) WriteAt(buffer []byte, offset int64) (int, error)

type Metrics added in v0.1.5

type Metrics struct {
	WaitForBlock             uint64
	WaitForBlockHadRemote    uint64
	WaitForBlockHadLocal     uint64
	WaitForBlockTime         time.Duration
	WaitForBlockLock         uint64
	WaitForBlockLockDone     uint64
	MarkAvailableLocalBlock  uint64
	MarkAvailableRemoteBlock uint64
	AvailableLocal           uint64
	AvailableRemote          uint64
}

type Remote added in v0.1.0

type Remote struct {
	storage.ProviderWithEvents
	// contains filtered or unexported fields
}

func (*Remote) CancelWrites added in v0.1.0

func (wcr *Remote) CancelWrites(offset int64, length int64)

func (*Remote) Close added in v0.1.0

func (wcr *Remote) Close() error

func (*Remote) Flush added in v0.1.0

func (wcr *Remote) Flush() error

func (*Remote) GetMetrics added in v0.1.5

func (wcr *Remote) GetMetrics() *Metrics

func (*Remote) ReadAt added in v0.1.0

func (wcr *Remote) ReadAt(_ []byte, _ int64) (int, error)

func (*Remote) SendSiloEvent added in v0.1.0

func (wcr *Remote) SendSiloEvent(eventType storage.EventType, eventData storage.EventData) []storage.EventReturnData

Relay events to embedded StorageProvider

func (*Remote) Size added in v0.1.0

func (wcr *Remote) Size() uint64

func (*Remote) WriteAt added in v0.1.0

func (wcr *Remote) WriteAt(buffer []byte, offset int64) (int, error)

type WaitingCache

type WaitingCache struct {
	// contains filtered or unexported fields
}

*

  • Waiting cache StorageProvider *
  • NB: This tracks COMPLETE blocks only. Not partial ones. *

func (*WaitingCache) GetMetrics added in v0.1.5

func (i *WaitingCache) GetMetrics() *Metrics

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL