revisions

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedOptimizedRevisions

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

CachedOptimizedRevisions does caching and deduplication for requests for optimized revisions.

func NewCachedOptimizedRevisions

func NewCachedOptimizedRevisions(maxRevisionStaleness time.Duration) *CachedOptimizedRevisions

NewCachedOptimizedRevisions returns a CachedOptimizedRevisions for the given configuration

func (*CachedOptimizedRevisions) OptimizedRevision

func (cor *CachedOptimizedRevisions) OptimizedRevision(ctx context.Context) (datastore.Revision, error)

func (*CachedOptimizedRevisions) SetOptimizedRevisionFunc

func (cor *CachedOptimizedRevisions) SetOptimizedRevisionFunc(revisionFunc OptimizedRevisionFunction)

SetOptimizedRevisionFunc must be called after construction, and is the method by which one specializes this helper for a specific datastore.

type OptimizedRevisionFunction

type OptimizedRevisionFunction func(context.Context) (rev datastore.Revision, validFor time.Duration, err error)

OptimizedRevisionFunction instructs the datastore to compute its own current optimized revision given the specific quantization, and return for how long it will remain valid.

type RemoteClockRevisions

type RemoteClockRevisions struct {
	*CachedOptimizedRevisions
	// contains filtered or unexported fields
}

RemoteClockRevisions handles revision calculation for datastores that provide their own clocks.

func NewRemoteClockRevisions

func NewRemoteClockRevisions(gcWindow, maxRevisionStaleness, followerReadDelay, quantization time.Duration) *RemoteClockRevisions

NewRemoteClockRevisions returns a RemoteClockRevisions for the given configuration

func (*RemoteClockRevisions) CheckRevision

func (rcr *RemoteClockRevisions) CheckRevision(ctx context.Context, dsRevision datastore.Revision) error

func (*RemoteClockRevisions) SetNowFunc

func (rcr *RemoteClockRevisions) SetNowFunc(nowFunc RemoteNowFunction)

SetNowFunc sets the function used to determine the head revision

type RemoteNowFunction

type RemoteNowFunction func(context.Context) (revision.Decimal, error)

RemoteNowFunction queries the datastore to get a current revision.

Jump to

Keyboard shortcuts

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