cache

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Cache will maintain the data info of all the peers across cluster.

func NewCache

func NewCache() *Cache

func (*Cache) AddChunks

func (c *Cache) AddChunks(chunks []api.ChunkTracker, nodename string)

func (*Cache) ChunkExist

func (c *Cache) ChunkExist(chunkname string) bool

func (*Cache) ChunkExistInNode added in v0.0.2

func (c *Cache) ChunkExistInNode(nodename, chunkname string) bool

func (*Cache) ChunkNodes

func (c *Cache) ChunkNodes(chunkname string) []string

func (*Cache) DeleteChunks

func (c *Cache) DeleteChunks(chunks []api.ChunkTracker, nodename string)

DeleteChunks will delete chunks from one node.

func (*Cache) Load

func (c *Cache) Load(k string) interface{}

func (*Cache) NodeTotalSizeBytes

func (c *Cache) NodeTotalSizeBytes(nodename string) (size int64)

Maybe we can add a field to nodes to represents the totalSize and calculated when adding or removing.

func (*Cache) Snapshot

func (c *Cache) Snapshot() *Cache

Snapshot is called before dispatching.

func (*Cache) Store

func (c *Cache) Store(k string, v interface{})

type ChunkInfo

type ChunkInfo struct {
	Name string
	// nodes represents the node contains the chunk.
	// Nodes is empty when part of the cache.nodes.
	Nodes sets.Set[string]
	// SizeBytes represents the chunk size.
	SizeBytes int64
}

Jump to

Keyboard shortcuts

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