persistence

package
v0.0.0-...-8f072b4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SNAPSHOT_FILENAME = "snapshot.gz"
)

Variables

This section is empty.

Functions

func AofExists

func AofExists() (bool, error)

func BootAOF

func BootAOF(cache *cache.Cache, maxAOFSize int64)

BootAOF Reads from log if it exists otherwise creates and writes to one

func BuildCacheFromAof

func BuildCacheFromAof(cache *cache.Cache, logPath string)

BuildCache parses a pre-existing AOF rebuilds cache using contents

func BuildCacheFromSnapshot

func BuildCacheFromSnapshot(bs *[]byte) (lru.LRUCache, error)

BuildCache rebuilds the cache from the byte stream of the snapshot

func CreateAOF

func CreateAOF(logPath string)

func CreateSnapshot

func CreateSnapshot(cache *cache.Cache, config *config.Configuration) (bool, error)

func DecryptData

func DecryptData(data []byte, passphrase string) ([]byte, error)

DecryptData decrypts snapshots which have at-rest encryption enabled.

func EncryptData

func EncryptData(data []byte, passphrase string) ([]byte, error)

EncryptData is our encryption client to encrypt the serialized cache object with 128 bit AES

func FlushBuffer

func FlushBuffer()

func GetAOFSize

func GetAOFSize() int64

func GetBufferBytes

func GetBufferBytes() []byte

GetBuffer returns buffer

func GetBufferString

func GetBufferString() string

func GetSnapshotFilename

func GetSnapshotFilename() string

GetSnapshotFilename builds the filename for the snapshot being taken

func ReadSnapshot

func ReadSnapshot(encryption bool, passphrase ...string) *[]byte

ReadSnapshot reads the compressed snapshot file into buffer and returns a reference to the buffer

func RebootAof

func RebootAof(cache *cache.Cache, maxAofSize int64)

func StartSnapshotter

func StartSnapshotter(cache *cache.Cache, conf *config.Configuration, scheduler *SnapshotScheduler)

* * StartSnapshotter will start the cache snapshot scheduler * * Snapshots are periodically taken of the stores cache until the ticker * is stopped. * StartSnapshotter is generic in nature and will runthe appropriate * snapshotter for the stores underlying cache policy implementation *

func StopSnapshotter

func StopSnapshotter(scheduler *SnapshotScheduler)

StopSnapshotter stops the Snapshotter by passing a bool to the scheduler channel

func WriteBuffer

func WriteBuffer(verb string, key string, value interface{}, ttl int64)

WriteBuffer writes cache command in log format

Types

type SnapshotScheduler

type SnapshotScheduler struct {
	Interval time.Duration
	// contains filtered or unexported fields
}

SnapshotScheduler represents a scheduler for the cache snapshotter

func NewSnapshotScheduler

func NewSnapshotScheduler(interval int32) *SnapshotScheduler

NewSnapshotScheduler initializes a new Snapshot Scheduler

Jump to

Keyboard shortcuts

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