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.