cas

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChunkSize is the size of each chunk for splitting large values
	ChunkSize = 1024 * 1024 // 1MB
)

Variables

This section is empty.

Functions

func ComputeHash

func ComputeHash(data []byte) []byte

ComputeHash computes the SHA-256 hash of data

Types

type Store

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

Store provides content-addressable storage for Atlas-DB. This is a thin client wrapper that chunks data and makes RPC calls. Actual storage happens on the server side via the consensus layer.

func NewStore

func NewStore(quorumMgr consensus.QuorumManager) *Store

NewStore creates a new CAS store

func (*Store) Get

func (s *Store) Get(ctx context.Context, hash []byte) ([]byte, error)

Get retrieves data by its hash from the cluster. It fetches chunks from peers using DeReference RPC and reassembles them.

func (*Store) Put

func (s *Store) Put(ctx context.Context, key []byte, data []byte) (hash []byte, err error)

Put stores data in the CAS and returns its hash. The data is chunked and replicated to all nodes in the cluster via RPC. This operation is idempotent - storing the same data multiple times is safe. No data is stored locally; everything goes directly to the server.

Jump to

Keyboard shortcuts

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