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 ¶
- type MemoryTopo
- func (mt *MemoryTopo) Create(ctx context.Context, cell, filePath string, contents []byte) (topo.Version, error)
- func (mt *MemoryTopo) Delete(ctx context.Context, cell, filePath string, version topo.Version) error
- func (mt *MemoryTopo) Get(ctx context.Context, cell, filePath string) ([]byte, topo.Version, error)
- func (mt *MemoryTopo) GetKnownCells(ctx context.Context) ([]string, error)
- func (mt *MemoryTopo) ListDir(ctx context.Context, cell, dirPath string) ([]string, error)
- func (mt *MemoryTopo) Update(ctx context.Context, cell, filePath string, contents []byte, ...) (topo.Version, error)
- func (mt *MemoryTopo) Watch(ctx context.Context, cell string, filePath string) (*topo.WatchData, <-chan *topo.WatchData, topo.CancelFunc)
- type NodeVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryTopo ¶
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) GetKnownCells ¶
func (mt *MemoryTopo) GetKnownCells(ctx context.Context) ([]string, error)
GetKnownCells is part of the topo.Server interface.
type NodeVersion ¶
type NodeVersion uint64
NodeVersion is the local topo.Version implementation
func (NodeVersion) String ¶
func (v NodeVersion) String() string