Documentation ¶
Index ¶
- Constants
- Variables
- type Blob
- func (b *Blob) Close() error
- func (b *Blob) Hash() Hash
- func (b *Blob) Length() int64
- func (m Blob) MarshalBinary() ([]byte, error)
- func (b *Blob) Read(buf []byte) (int, error)
- func (b *Blob) Seek(offset int64, whence int) (int64, error)
- func (b *Blob) String() string
- func (m Blob) UnmarshalBinary(data []byte) error
- func (b *Blob) WriteN(w io.Writer, count int64) (int64, error)
- func (b *Blob) WriteTo(w io.Writer) (written int64, err error)
- type Hash
- type Store
- func (s *Store) CommitRope(ctx context.Context, tID *tenant.ID, ropeID uuid.UUID, hash Hash) error
- func (s *Store) EnsureBlob(ctx context.Context, tID *tenant.ID, data io.Reader) (Hash, error)
- func (s *Store) InsertToRope(ctx context.Context, tID *tenant.ID, ropeID uuid.UUID, data io.Reader, ...) (int64, error)
- func (s *Store) OpenBlob(ctx context.Context, tID *tenant.ID, hash Hash) (*Blob, error)
Constants ¶
const HashSize = sha256.Size
HashSize is the number of bytes used in a Hash.
Variables ¶
var Set = wire.NewSet(ProvideStore)
Set is used by wire.
Functions ¶
This section is empty.
Types ¶
type Blob ¶
type Blob struct {
// contains filtered or unexported fields
}
A Blob provides access to the contents of an immutable blob.
func (Blob) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
func (Blob) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type Hash ¶
Hash is a cryptographically-secure content-hash value.
func (Hash) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
func (*Hash) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides access to blobs.
func ProvideStore ¶
func ProvideStore( ctx context.Context, cache *cache.Cache, config *config.Config, db *pgxpool.Pool, logger *log.Logger, ) (*Store, func())
ProvideStore is used by wire.
func (*Store) CommitRope ¶
CommitRope associates a content hash with the given rope.
func (*Store) EnsureBlob ¶
EnsureBlob will insert the contents provided by the given reader into the database, returning a content hash.
This method is idempotent.
func (*Store) InsertToRope ¶
func (s *Store) InsertToRope( ctx context.Context, tID *tenant.ID, ropeID uuid.UUID, data io.Reader, hasher hash.Hash, offset int64, ) (int64, error)
InsertToRope will append contents provided by the given reader to the given rope, starting at the specified offset. The data will also be fed to the given hash function.