cas

package
v0.0.0-...-d12bbc4 Latest Latest
Warning

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

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

Documentation

Overview

Package cas contains a Content Addressable Store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryStorage

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

BinaryStorage is a CAS intended for storing binary images keyed by their hash string that uses a SQL Database as its backing store.

func NewBinaryStorage

func NewBinaryStorage(db *sql.DB) (*BinaryStorage, error)

NewBinaryStorage creates a new CAS that uses the given DB as a backend. The DB will be initialized if needed.

func (*BinaryStorage) Retrieve

func (bs *BinaryStorage) Retrieve(key []byte) ([]byte, error)

Retrieve gets a binary image that was previously stored.

func (*BinaryStorage) Store

func (bs *BinaryStorage) Store(key, image []byte) error

Store stores a binary image under the given key (which should be a hash of its data). If there was an existing value under the key then it will not be updated. TODO(mhutchinson): Consider validating that the image is exactly the same if the key already exists. This should only happen if the hash function isn't strong.

Jump to

Keyboard shortcuts

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