testscommon

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdaptedSizedLruCacheStub

type AdaptedSizedLruCacheStub struct {
	AddSizedCalled                 func(key, value interface{}, sizeInBytes int64) bool
	GetCalled                      func(key interface{}) (value interface{}, ok bool)
	ContainsCalled                 func(key interface{}) (ok bool)
	AddSizedIfMissingCalled        func(key, value interface{}, sizeInBytes int64) (ok, evicted bool)
	PeekCalled                     func(key interface{}) (value interface{}, ok bool)
	RemoveCalled                   func(key interface{}) bool
	KeysCalled                     func() []interface{}
	LenCalled                      func() int
	SizeInBytesContainedCalled     func() uint64
	PurgeCalled                    func()
	AddSizedAndReturnEvictedCalled func(key, value interface{}, sizeInBytes int64) map[interface{}]interface{}
}

AdaptedSizedLruCacheStub --

func (*AdaptedSizedLruCacheStub) AddSized

func (a *AdaptedSizedLruCacheStub) AddSized(key, value interface{}, sizeInBytes int64) bool

AddSized -

func (*AdaptedSizedLruCacheStub) AddSizedAndReturnEvicted

func (a *AdaptedSizedLruCacheStub) AddSizedAndReturnEvicted(key, value interface{}, sizeInBytes int64) map[interface{}]interface{}

AddSizedAndReturnEvicted -

func (*AdaptedSizedLruCacheStub) AddSizedIfMissing

func (a *AdaptedSizedLruCacheStub) AddSizedIfMissing(key, value interface{}, sizeInBytes int64) (ok, evicted bool)

AddSizedIfMissing -

func (*AdaptedSizedLruCacheStub) Contains

func (a *AdaptedSizedLruCacheStub) Contains(key interface{}) (ok bool)

Contains -

func (*AdaptedSizedLruCacheStub) Get

func (a *AdaptedSizedLruCacheStub) Get(key interface{}) (value interface{}, ok bool)

Get -

func (*AdaptedSizedLruCacheStub) IsInterfaceNil

func (a *AdaptedSizedLruCacheStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*AdaptedSizedLruCacheStub) Keys

func (a *AdaptedSizedLruCacheStub) Keys() []interface{}

Keys -

func (*AdaptedSizedLruCacheStub) Len

func (a *AdaptedSizedLruCacheStub) Len() int

Len -

func (*AdaptedSizedLruCacheStub) Peek

func (a *AdaptedSizedLruCacheStub) Peek(key interface{}) (value interface{}, ok bool)

Peek -

func (*AdaptedSizedLruCacheStub) Purge

func (a *AdaptedSizedLruCacheStub) Purge()

Purge -

func (*AdaptedSizedLruCacheStub) Remove

func (a *AdaptedSizedLruCacheStub) Remove(key interface{}) bool

Remove -

func (*AdaptedSizedLruCacheStub) SizeInBytesContained

func (a *AdaptedSizedLruCacheStub) SizeInBytesContained() uint64

SizeInBytesContained -

type EvictionHandlerStub

type EvictionHandlerStub struct {
	EvictedCalled func(key []byte)
}

EvictionHandlerStub -

func (*EvictionHandlerStub) Evicted

func (sh *EvictionHandlerStub) Evicted(key []byte)

Evicted -

type MarshalizerMock

type MarshalizerMock struct {
	Fail bool
}

MarshalizerMock that will be used for testing

func (*MarshalizerMock) IsInterfaceNil

func (mm *MarshalizerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MarshalizerMock) Marshal

func (mm *MarshalizerMock) Marshal(obj interface{}) ([]byte, error)

Marshal converts the input object in a slice of bytes

func (*MarshalizerMock) Unmarshal

func (mm *MarshalizerMock) Unmarshal(obj interface{}, buff []byte) error

Unmarshal applies the serialized values over an instantiated object

type MemDbMock

type MemDbMock struct {
	PutCalled func(key, val []byte) error
	// contains filtered or unexported fields
}

MemDbMock represents the memory database storage. It holds a map of key value pairs and a mutex to handle concurrent accesses to the map

func NewMemDbMock

func NewMemDbMock() *MemDbMock

NewMemDbMock creates a new memorydb object

func (*MemDbMock) Close

func (s *MemDbMock) Close() error

Close closes the files/resources associated to the storage medium

func (*MemDbMock) Destroy

func (s *MemDbMock) Destroy() error

Destroy removes the storage medium stored data

func (*MemDbMock) DestroyClosed

func (s *MemDbMock) DestroyClosed() error

DestroyClosed removes the already closed storage medium stored data

func (*MemDbMock) Get

func (s *MemDbMock) Get(key []byte) ([]byte, error)

Get gets the value associated to the key, or reports an error

func (*MemDbMock) Has

func (s *MemDbMock) Has(key []byte) error

Has returns true if the given key is present in the persistence medium, false otherwise

func (*MemDbMock) IsInterfaceNil

func (s *MemDbMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MemDbMock) Put

func (s *MemDbMock) Put(key, val []byte) error

Put adds the value to the (key, val) storage medium

func (*MemDbMock) RangeKeys

func (s *MemDbMock) RangeKeys(handler func(key []byte, value []byte) bool)

RangeKeys will iterate over all contained (key, value) pairs calling the handler for each pair

func (*MemDbMock) Remove

func (s *MemDbMock) Remove(key []byte) error

Remove removes the data associated to the given key

type PersisterStub

type PersisterStub struct {
	PutCalled           func(key, val []byte) error
	GetCalled           func(key []byte) ([]byte, error)
	HasCalled           func(key []byte) error
	CloseCalled         func() error
	RemoveCalled        func(key []byte) error
	DestroyCalled       func() error
	DestroyClosedCalled func() error
	RangeKeysCalled     func(handler func(key []byte, val []byte) bool)
}

PersisterStub -

func (*PersisterStub) Close

func (p *PersisterStub) Close() error

Close -

func (*PersisterStub) Destroy

func (p *PersisterStub) Destroy() error

Destroy -

func (*PersisterStub) DestroyClosed

func (p *PersisterStub) DestroyClosed() error

DestroyClosed -

func (*PersisterStub) Get

func (p *PersisterStub) Get(key []byte) ([]byte, error)

Get -

func (*PersisterStub) Has

func (p *PersisterStub) Has(key []byte) error

Has -

func (*PersisterStub) IsInterfaceNil

func (p *PersisterStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*PersisterStub) Put

func (p *PersisterStub) Put(key, val []byte) error

Put -

func (*PersisterStub) RangeKeys

func (p *PersisterStub) RangeKeys(handler func(key []byte, val []byte) bool)

RangeKeys -

func (*PersisterStub) Remove

func (p *PersisterStub) Remove(key []byte) error

Remove -

type TimeCacheStub

type TimeCacheStub struct {
	AddCalled    func(key string) error
	UpsertCalled func(key string, span time.Duration) error
	HasCalled    func(key string) bool
	SweepCalled  func()
}

TimeCacheStub -

func (*TimeCacheStub) Add

func (tcs *TimeCacheStub) Add(key string) error

Add -

func (*TimeCacheStub) Has

func (tcs *TimeCacheStub) Has(key string) bool

Has -

func (*TimeCacheStub) IsInterfaceNil

func (tcs *TimeCacheStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*TimeCacheStub) Sweep

func (tcs *TimeCacheStub) Sweep()

Sweep -

func (*TimeCacheStub) Upsert

func (tcs *TimeCacheStub) Upsert(key string, span time.Duration) error

Upsert -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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