memorytopo

package
v2.1.0-alpha.2+incompa... Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2017 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package memorytopo contains an implementation of the topo.Backend API based on an in-process memory map.

At the moment, it is actually a topo.Impl implementation as well, based on faketopo. As we convert more and more code to the new file-based topo.Backend APIs, this will grow. Eventually, the topo.Impl interface will be retired.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryTopo

type MemoryTopo struct {
	faketopo.FakeTopo
	// contains filtered or unexported fields
}

MemoryTopo is a memory-based implementation of topo.Backend. It takes a file-system like approach, with directories at each level being an actual directory node. This is meant to be closer to file-system like servers, like ZooKeeper or Chubby. The fake etcd version is closer to a node-based fake.

func NewMemoryTopo

func NewMemoryTopo(cells []string) *MemoryTopo

NewMemoryTopo returns a new MemoryTopo for all the cells.

func (*MemoryTopo) Create

func (mt *MemoryTopo) Create(ctx context.Context, cell, filePath string, contents []byte) (topo.Version, error)

Create is part of topo.Backend interface.

func (*MemoryTopo) Delete

func (mt *MemoryTopo) Delete(ctx context.Context, cell, filePath string, version topo.Version) error

Delete is part of topo.Backend interface.

func (*MemoryTopo) Get

func (mt *MemoryTopo) Get(ctx context.Context, cell, filePath string) ([]byte, topo.Version, error)

Get is part of topo.Backend interface.

func (*MemoryTopo) GetKnownCells

func (mt *MemoryTopo) GetKnownCells(ctx context.Context) ([]string, error)

GetKnownCells is part of the topo.Server interface.

func (*MemoryTopo) ListDir

func (mt *MemoryTopo) ListDir(ctx context.Context, cell, dirPath string) ([]string, error)

ListDir is part of the topo.Backend interface.

func (*MemoryTopo) Update

func (mt *MemoryTopo) Update(ctx context.Context, cell, filePath string, contents []byte, version topo.Version) (topo.Version, error)

Update is part of topo.Backend interface.

func (*MemoryTopo) Watch

func (mt *MemoryTopo) Watch(ctx context.Context, cell string, filePath string) (*topo.WatchData, <-chan *topo.WatchData, topo.CancelFunc)

Watch is part of the topo.Backend interface.

type NodeVersion

type NodeVersion uint64

NodeVersion is the local topo.Version implementation

func (NodeVersion) String

func (v NodeVersion) String() string

Jump to

Keyboard shortcuts

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