Documentation
¶
Overview ¶
Package delayed wraps a datastore allowing to artificially delay all operations.
Index ¶
- type D
- type Delayed
- func (dds *Delayed) Batch(ctx context.Context) (ds.Batch, error)
- func (dds *Delayed) Close() error
- func (dds *Delayed) Delete(ctx context.Context, key ds.Key) (err error)
- func (dds *Delayed) DiskUsage(ctx context.Context) (uint64, error)
- func (dds *Delayed) Get(ctx context.Context, key ds.Key) (value []byte, err error)
- func (dds *Delayed) GetSize(ctx context.Context, key ds.Key) (size int, err error)
- func (dds *Delayed) Has(ctx context.Context, key ds.Key) (exists bool, err error)
- func (dds *Delayed) Put(ctx context.Context, key ds.Key, value []byte) (err error)
- func (dds *Delayed) Query(ctx context.Context, q dsq.Query) (dsq.Results, error)
- func (dds *Delayed) Sync(ctx context.Context, prefix ds.Key) error
- type Generator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type D ¶
type D interface {
Set(time.Duration) time.Duration
Wait()
NextWaitTime() time.Duration
Get() time.Duration
}
D (Delay) makes it easy to add (threadsafe) configurable delays to other objects.
func VariableNormal ¶
VariableNormal is a delay following a normal distribution Notice that to implement the D interface Set can only change the mean delay the standard deviation is set only at initialization
type Delayed ¶
type Delayed struct {
// contains filtered or unexported fields
}
Delayed is an adapter that delays operations on the inner datastore.
func (*Delayed) Close ¶
Close closes the inner datastore (if it implements the io.Closer interface).
type Generator ¶
Generator provides an interface for generating wait times
func FixedGenerator ¶
func FixedGenerator() Generator
FixedGenerator returns a delay with fixed latency
func VariableNormalGenerator ¶
VariableNormalGenerator makes delays that following a normal distribution