memory

package
v4.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: AGPL-3.0 Imports: 12 Imported by: 1

Documentation

Overview

Package memory provides an in-memory basic implementation of an Endpoint, with nodes stored in a map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBEvent

type DBEvent struct {
	Type   string
	Source string
	Target string
}

type MemDB

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

func NewMemDB

func NewMemDB() *MemDB

func (*MemDB) AddIgnore

func (db *MemDB) AddIgnore(s string)

AddIgnore register a filename to be ignored (for tests only)

func (*MemDB) CreateNode

func (db *MemDB) CreateNode(ctx context.Context, node tree.N, updateIfExists bool) (err error)

func (*MemDB) DeleteNode

func (db *MemDB) DeleteNode(ctx context.Context, path string) (err error)

func (*MemDB) FromJSON

func (db *MemDB) FromJSON(name string) error

FromJSON read a JSON file in memory

func (*MemDB) GetEndpointInfo

func (db *MemDB) GetEndpointInfo() model.EndpointInfo

func (*MemDB) LoadNode

func (db *MemDB) LoadNode(ctx context.Context, path string, extendedStats ...bool) (node tree.N, err error)

func (*MemDB) MoveNode

func (db *MemDB) MoveNode(ctx context.Context, oldPath string, newPath string) (err error)

func (*MemDB) RegisterEventChannel

func (db *MemDB) RegisterEventChannel(out chan DBEvent)

func (*MemDB) SetTestPathURI

func (db *MemDB) SetTestPathURI(s string)

func (*MemDB) Stats

func (db *MemDB) Stats() string

func (*MemDB) String

func (db *MemDB) String() string

func (*MemDB) ToJSON

func (db *MemDB) ToJSON(name string) error

ToJSON outputs contents to JSON file

func (*MemDB) ToJSONBytes added in v4.2.6

func (db *MemDB) ToJSONBytes() ([]byte, error)

ToJSONBytes marshal contents to JSON

func (*MemDB) Walk

func (db *MemDB) Walk(ctx context.Context, walknFc model.WalkNodesFunc, root string, recursive bool) (err error)

func (*MemDB) Watch

func (db *MemDB) Watch(recursivePath string) (*model.WatchObject, error)

type MemDBWithCacheTest

type MemDBWithCacheTest struct {
	MemDB
}

MemDBWithCacheTest provides a structure for testing CachedBranchProvider related functions

func NewMemDBWithCacheTest

func NewMemDBWithCacheTest() *MemDBWithCacheTest

NewMemDBWithCacheTest creates a new MemDB implementing CachedBranchProvider interface

func (*MemDBWithCacheTest) GetCachedBranches

func (m *MemDBWithCacheTest) GetCachedBranches(ctx context.Context, roots ...string) (model.PathSyncSource, error)

GetCachedBranches loads branch in memory

Jump to

Keyboard shortcuts

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