zk

package
v0.0.0-...-082c416 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Repo        = Repository{}
	CachingRepo = CachingRepository{Repo: Repo}
)

Functions

func OrderedBy

func OrderedBy(less ...lessFunc) *multiSorter

OrderedBy returns a Sorter that sorts using the less functions, in order. Call its Sort method to sort the data.

func Reset

func Reset()

Types

type Accessor

type Accessor interface {
	SetConnInfo(connInfo *core.ConnInfo)
	Get(path string) (*Node, error)

	//todo consider to remove next three methods and use Get instead
	GetMeta(path string) (*goZk.Stat, error)
	GetValue(path string) (*Node, error)
	GetChildren(path string) ([]*Node, error)

	GetRootNode() (*Node, error)
	SaveChild(parentPath string, childName string, acl []goZk.ACL) error
	SaveValue(parentPath string, node *Node) error
	Delete(path string, version int32) error
	Close()
}

todo measure timings for each operation

type CachingRepository

type CachingRepository struct {
	CachingRepositoryAccessor

	Repo Repository
}

func (*CachingRepository) Close

func (c *CachingRepository) Close()

func (*CachingRepository) Delete

func (c *CachingRepository) Delete(path string, node *Node) error

func (*CachingRepository) Export

func (c *CachingRepository) Export(ctx context.Context, cancelFunc context.CancelFunc, path string) (*Node, error)

func (*CachingRepository) Get

func (c *CachingRepository) Get(path string) (*Node, error)

func (*CachingRepository) GetChildren

func (c *CachingRepository) GetChildren(path string) ([]*Node, error)

func (*CachingRepository) GetMeta

func (c *CachingRepository) GetMeta(path string) (*goZk.Stat, error)

func (*CachingRepository) GetRootNode

func (c *CachingRepository) GetRootNode() (*Node, error)

func (*CachingRepository) GetValue

func (c *CachingRepository) GetValue(path string) (*Node, error)

func (*CachingRepository) Invalidate

func (c *CachingRepository) Invalidate(path string)

func (*CachingRepository) InvalidateAll

func (c *CachingRepository) InvalidateAll()

func (*CachingRepository) SaveChild

func (c *CachingRepository) SaveChild(path string, child *Node) error

func (*CachingRepository) SaveValue

func (c *CachingRepository) SaveValue(path string, node *Node) error

func (*CachingRepository) SetConnInfo

func (c *CachingRepository) SetConnInfo(connInfo *core.ConnInfo)

type CachingRepositoryAccessor

type CachingRepositoryAccessor interface {
	InvalidateAll()
	Invalidate(path string)
	Export(path string) (*Node, error)

	Accessor
}

type Node

type Node struct {
	Name     string     `json:"name"`
	Value    string     `json:"value,omitempty"`
	Meta     *goZk.Stat `json:"-"`
	Children []*Node    `json:"children,omitempty"`
	Acl      []goZk.ACL `json:"-"`
}

type Repository

type Repository struct {
	Accessor
	// contains filtered or unexported fields
}

func (*Repository) Close

func (r *Repository) Close()

func (*Repository) Delete

func (r *Repository) Delete(path string, node *Node) error

func (*Repository) Get

func (r *Repository) Get(path string) (*Node, error)

func (*Repository) GetChildren

func (r *Repository) GetChildren(path string) ([]*Node, error)

func (*Repository) GetMeta

func (r *Repository) GetMeta(path string) (*goZk.Stat, error)

func (*Repository) GetRootNode

func (r *Repository) GetRootNode() (*Node, error)

func (*Repository) GetValue

func (r *Repository) GetValue(path string) (*Node, error)

func (*Repository) Init

func (r *Repository) Init(connInfo *core.ConnInfo)

func (*Repository) SaveChild

func (r *Repository) SaveChild(parentPath string, child *Node) error

func (*Repository) SaveValue

func (r *Repository) SaveValue(absPath string, node *Node) error

func (*Repository) SetConnInfo

func (r *Repository) SetConnInfo(connInfo *core.ConnInfo)

Jump to

Keyboard shortcuts

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