processdatastore

package
v0.2.3 Latest Latest
Warning

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

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

Documentation

Overview

Package processdatastore is a package that provides a process data store. The process data store is used to store process data objects associated with an address. For each address, only the most recent object is stored. The number of updates for each address is also stored. The typical use case is to call Write() from one goroutine and List()/Read() from another goroutine, which periodically outputs the process data store. The process data store is thread safe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Object

type Object interface {
	// Timestamp returns the reception timestamp of the object
	Timestamp() int64

	// Address returns the address of the object
	Address() uint32

	// Data returns the data of the object
	Data() []byte

	// Additional Info returns additional info of the object
	AdditionalInfo() []string
}

Object is the interface for all objects that can be stored in the process data store

type Store

type Store struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Store is the process data store

func NewStore

func NewStore() *Store

NewStore creates a new process data store

func (*Store) List

func (s *Store) List() []int

List returns a list of all addresses in the process data store which have received any updates since the store creation. The list is sorted in ascending order.

func (*Store) Read

func (s *Store) Read(address uint32) (Object, int, error)

Read reads the entry for the specified address from the process data store. In addition, it returns the number of updates for the address since the last call to Read(). If the address has never got an update, an error is returned.

func (*Store) Write

func (s *Store) Write(o Object)

Write writes an object to the process data store

type StoreEntry

type StoreEntry struct {
	RecentObject Object
	// contains filtered or unexported fields
}

StoreEntry is the process data store for a single address

Jump to

Keyboard shortcuts

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