storage

package
v0.0.0-...-aa8370d Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSearchRange      = errors.New("Storage: Illegal search range")
	ErrTimestampOrder   = errors.New("Memlog: Timestamp order error")
	ErrTimestampMissing = errors.New("Memlog: Start timestamp not yet in log")
)
View Source
var LOGSIZE uint64 = 5
View Source
var SEGSIZE uint64 = 10 //10

Functions

This section is empty.

Types

type Image

type Image = []byte

type ImageLogSeg

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

Image log Not explicitly protected by a lock, but should be used with timstamp lock

type ImageMemLog

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

func NewImageMemLog

func NewImageMemLog() *ImageMemLog

type ImageTimestamp

type ImageTimestamp struct {
	Im Image
	Ts Timestamp
}

type MemLog

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

Mem log is composed of timstamp and image logs

func NewMemLog

func NewMemLog(segsize, logsize uint64) *MemLog

func (*MemLog) Append

func (memlog *MemLog) Append(im Image, t Timestamp) error

Store methods Apppend: Input - image and associated timestamp

func (*MemLog) AppendStats

func (memlog *MemLog) AppendStats() (int, uint64, Timestamp)

func (*MemLog) Backup

func (memlog *MemLog) Backup(fPath string)

func (*MemLog) Read

func (memlog *MemLog) Read(imts chan<- ImageTimestamp, tstart, tstop Timestamp, err chan<- error)

Read: Input - start and stop timestamps. Output - slice of images, timestamps of first and last images

func (*MemLog) Recover

func (memlog *MemLog) Recover(recoveryFile *os.File, camid string)

type Store

type Store interface {
	Recover(recoveryFile *os.File, camid string)
	Append(im Image, t Timestamp) error
	Read(imts chan<- ImageTimestamp, tstart, tstop Timestamp, err chan<- error)
	AppendStats() (int, uint64, Timestamp)
	Backup(fPath string)
}

type Timestamp

type Timestamp = time.Time

type TimestampLogSeg

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

Timestamp log

type TimestampMemLog

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

func NewTimestampMemLog

func NewTimestampMemLog() *TimestampMemLog

Constructors

Jump to

Keyboard shortcuts

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