memory

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemEntry

type MemEntry struct {
	*scheduler.StoreTask
	// contains filtered or unexported fields
}

type MemStore

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

MemStore simulates a remote storage. The remote storage is represented by queue that will hold serializable data

func New

func New() *MemStore

func (*MemStore) Clear

func (s *MemStore) Clear(context.Context) error

func (*MemStore) Create

func (s *MemStore) Create(_ context.Context, task *scheduler.StoreTask) error

func (*MemStore) Delete

func (s *MemStore) Delete(ctx context.Context, slug string) error

func (*MemStore) Get

func (s *MemStore) Get(ctx context.Context, slug string) (*scheduler.StoreTask, error)

func (*MemStore) GetSlugs

func (s *MemStore) GetSlugs(context.Context) ([]string, error)

func (*MemStore) Lock

func (*MemStore) NextRun

func (s *MemStore) NextRun(context.Context) (*scheduler.StoreTask, error)

func (*MemStore) Reschedule

func (s *MemStore) Reschedule(ctx context.Context, task *scheduler.StoreTask) error

type PriorityQueue

type PriorityQueue []*MemEntry

PriorityQueue implements the heap.Interface.

func (*PriorityQueue) Head

func (pq *PriorityQueue) Head() *MemEntry

Head returns the first entry of a PriorityQueue without removing it.

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

Len returns the PriorityQueue length.

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

Less is the items less comparator.

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

Pop implements the heap.Interface.Pop. Removes and returns element Len() - 1.

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

Push implements the heap.Interface.Push. Adds x as element Len().

func (*PriorityQueue) Remove

func (pq *PriorityQueue) Remove(i int) *MemEntry

Remove removes and returns the element at index i from the PriorityQueue.

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

Swap exchanges the indexes of the items.

Jump to

Keyboard shortcuts

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