Documentation
¶
Index ¶
- Variables
- func StreamItems[I any](store Store[I], target Target, doneCh <-chan struct{}, logger logger)
- type Batch
- type BatchConfig
- type Key
- type QueueStore
- func (store *QueueStore[_]) Del(key Key) error
- func (store *QueueStore[_]) Delete() error
- func (store *QueueStore[I]) Get(key Key) (item I, err error)
- func (store *QueueStore[I]) GetMultiple(key Key) (items []I, err error)
- func (store *QueueStore[I]) GetRaw(key Key) (raw []byte, err error)
- func (store *QueueStore[_]) Len() int
- func (store *QueueStore[_]) List() (keys []Key)
- func (store *QueueStore[_]) Open() error
- func (store *QueueStore[I]) Put(item I) (Key, error)
- func (store *QueueStore[I]) PutMultiple(items []I) (Key, error)
- func (store *QueueStore[I]) PutRaw(b []byte) (Key, error)
- type Store
- type Target
Constants ¶
This section is empty.
Variables ¶
var ErrBatchFull = errors.New("batch is full")
ErrBatchFull indicates that the batch is full
var ErrNotConnected = errors.New("not connected to target server/service")
ErrNotConnected - indicates that the target connection is not active.
Functions ¶
func StreamItems ¶
StreamItems reads the keys from the store and replays the corresponding item to the target.
Types ¶
type Batch ¶
Batch represents an ordered batch
type BatchConfig ¶
type BatchConfig[I any] struct { Limit uint32 Store Store[I] CommitTimeout time.Duration Log logger }
BatchConfig represents the batch config
type QueueStore ¶
QueueStore - Filestore for persisting items.
func NewQueueStore ¶
func NewQueueStore[I any](directory string, limit uint64, ext string) *QueueStore[I]
NewQueueStore - Creates an instance for QueueStore.
func (*QueueStore[_]) Del ¶
func (store *QueueStore[_]) Del(key Key) error
Del - Deletes an entry from the store.
func (*QueueStore[_]) Delete ¶
func (store *QueueStore[_]) Delete() error
Delete - Remove the store directory from disk
func (*QueueStore[I]) Get ¶
func (store *QueueStore[I]) Get(key Key) (item I, err error)
Get - gets an item from the store.
func (*QueueStore[I]) GetMultiple ¶
func (store *QueueStore[I]) GetMultiple(key Key) (items []I, err error)
GetMultiple will read the multi payload file and fetch the items
func (*QueueStore[I]) GetRaw ¶
func (store *QueueStore[I]) GetRaw(key Key) (raw []byte, err error)
GetRaw - gets an item from the store.
func (*QueueStore[_]) List ¶
func (store *QueueStore[_]) List() (keys []Key)
List - lists all files registered in the store.
func (*QueueStore[_]) Open ¶
func (store *QueueStore[_]) Open() error
Open - Creates the directory if not present.
func (*QueueStore[I]) Put ¶
func (store *QueueStore[I]) Put(item I) (Key, error)
Put - puts an item to the store.
func (*QueueStore[I]) PutMultiple ¶
func (store *QueueStore[I]) PutMultiple(items []I) (Key, error)
PutMultiple - puts an item to the store.
type Store ¶
type Store[I any] interface { Put(item I) (Key, error) PutMultiple(item []I) (Key, error) Get(key Key) (I, error) GetMultiple(key Key) ([]I, error) GetRaw(key Key) ([]byte, error) PutRaw(b []byte) (Key, error) Len() int List() []Key Del(key Key) error Open() error Delete() error }
Store - Used to persist items.