Documentation ¶
Index ¶
- Variables
- func Deserialize(reader io.Reader, cs ChunkSink, rateLimit chan struct{})
- func DeserializeToChan(reader io.Reader, chunkChan chan<- *Chunk)
- func RegisterLevelDBFlags(flags *flag.FlagSet)
- func Serialize(chunk Chunk, writer io.Writer)
- type BackpressureError
- type Chunk
- type ChunkSink
- type ChunkSource
- type ChunkStore
- type ChunkWriter
- type DynamoStore
- func (s *DynamoStore) Close() error
- func (s *DynamoStore) Get(h hash.Hash) Chunk
- func (s *DynamoStore) Has(h hash.Hash) bool
- func (s *DynamoStore) Put(c Chunk)
- func (s *DynamoStore) PutMany(chunks []Chunk) (e BackpressureError)
- func (s *DynamoStore) Root() hash.Hash
- func (s *DynamoStore) UpdateRoot(current, last hash.Hash) bool
- func (s *DynamoStore) Version() string
- type DynamoStoreFlags
- type Factory
- type GetRequest
- type HasRequest
- type LevelDBStore
- func (l *LevelDBStore) Close() error
- func (l *LevelDBStore) Get(ref hash.Hash) Chunk
- func (l *LevelDBStore) Has(ref hash.Hash) bool
- func (l *LevelDBStore) Put(c Chunk)
- func (l *LevelDBStore) PutMany(chunks []Chunk) (e BackpressureError)
- func (l *LevelDBStore) Root() hash.Hash
- func (l *LevelDBStore) UpdateRoot(current, last hash.Hash) bool
- func (l *LevelDBStore) Version() string
- type LevelDBStoreFactory
- type LevelDBStoreFlags
- type MemoryStore
- func (ms *MemoryStore) Close() error
- func (ms *MemoryStore) Get(h hash.Hash) Chunk
- func (ms *MemoryStore) Has(r hash.Hash) bool
- func (ms *MemoryStore) Len() int
- func (ms *MemoryStore) Put(c Chunk)
- func (ms *MemoryStore) PutMany(chunks []Chunk) (e BackpressureError)
- func (ms *MemoryStore) Root() hash.Hash
- func (ms *MemoryStore) UpdateRoot(current, last hash.Hash) bool
- func (ms *MemoryStore) Version() string
- type MemoryStoreFactory
- type OutstandingGet
- type OutstandingHas
- type OutstandingRequest
- type ReadBatch
- type ReadRequest
- type ReadThroughStore
- func (rts ReadThroughStore) Get(h hash.Hash) Chunk
- func (rts ReadThroughStore) Has(h hash.Hash) bool
- func (rts ReadThroughStore) Put(c Chunk)
- func (rts ReadThroughStore) PutMany(chunks []Chunk) BackpressureError
- func (rts ReadThroughStore) Root() hash.Hash
- func (rts ReadThroughStore) UpdateRoot(current, last hash.Hash) bool
- func (rts ReadThroughStore) Version() string
- type RootTracker
- type TestStore
- type TestStoreFactory
Constants ¶
This section is empty.
Variables ¶
var EmptyChunk = NewChunk([]byte{})
Functions ¶
func Deserialize ¶
Deserialize reads off of |reader| until EOF, sending chunks to |cs|. If |rateLimit| is non-nill, concurrency will be limited to the available capacity of the channel.
func DeserializeToChan ¶
DeserializeToChan reads off of |reader| until EOF, sending chunks to chunkChan in the order they are read.
func RegisterLevelDBFlags ¶
Types ¶
type BackpressureError ¶
BackpressureError is a slice of hash.Hash that indicates some chunks could not be Put(). Caller is free to try to Put them again later.
func (BackpressureError) AsHashes ¶
func (b BackpressureError) AsHashes() hash.HashSlice
func (BackpressureError) Error ¶
func (b BackpressureError) Error() string
type Chunk ¶
type Chunk struct {
// contains filtered or unexported fields
}
Chunk is a unit of stored data in noms
func NewChunk ¶
NewChunk creates a new Chunk backed by data. This means that the returned Chunk has ownership of this slice of memory.
func NewChunkWithHash ¶
NewChunkWithHash creates a new chunk with a known hash. The hash is not re-calculated or verified. This should obviously only be used in cases where the caller already knows the specified hash is correct.
type ChunkSink ¶
type ChunkSink interface { // Put writes c into the ChunkSink, blocking until the operation is complete. Put(c Chunk) // PutMany tries to write chunks into the sink. It will block as it handles as many as possible, then return a BackpressureError containing the rest (if any). PutMany(chunks []Chunk) BackpressureError io.Closer }
ChunkSink is a place to put chunks.
type ChunkSource ¶
type ChunkSource interface { // Get the Chunk for the value of the hash in the store. If the hash is absent from the store nil is returned. Get(h hash.Hash) Chunk // Returns true iff the value at the address |h| is contained in the source Has(h hash.Hash) bool // Returns the NomsVersion with which this ChunkSource is compatible. Version() string }
ChunkSource is a place to get chunks from.
type ChunkStore ¶
type ChunkStore interface { ChunkSource ChunkSink RootTracker }
ChunkStore is the core storage abstraction in noms. We can put data anyplace we have a ChunkStore implementation for.
type ChunkWriter ¶
type ChunkWriter struct {
// contains filtered or unexported fields
}
ChunkWriter wraps an io.WriteCloser, additionally providing the ability to grab the resulting Chunk for all data written through the interface. Calling Chunk() or Close() on an instance disallows further writing.
func NewChunkWriter ¶
func NewChunkWriter() *ChunkWriter
func (*ChunkWriter) Chunk ¶
func (w *ChunkWriter) Chunk() Chunk
Chunk() closes the writer and returns the resulting Chunk.
func (*ChunkWriter) Close ¶
func (w *ChunkWriter) Close() error
Close() closes computes the hash and Puts it into the ChunkSink Note: The Write() method never returns an error. Instead, like other noms interfaces, errors are reported via panic.
type DynamoStore ¶
type DynamoStore struct {
// contains filtered or unexported fields
}
DynamoStore implements ChunkStore by storing data to DynamoDB and, if needed, S3. It assumes the existence of a DynamoDB table whose primary partition key is in Binary format and named `ref`.
func NewDynamoStore ¶
func NewDynamoStore(table, namespace string, config *aws.Config, showStats bool) *DynamoStore
NewDynamoStore returns a new DynamoStore instance pointed at a DynamoDB table in the given region. All keys used to access items are prefixed with the given namespace. Uses credential from the AWS config parameter.
func (*DynamoStore) Close ¶
func (s *DynamoStore) Close() error
func (*DynamoStore) Put ¶
func (s *DynamoStore) Put(c Chunk)
func (*DynamoStore) PutMany ¶
func (s *DynamoStore) PutMany(chunks []Chunk) (e BackpressureError)
func (*DynamoStore) Root ¶
func (s *DynamoStore) Root() hash.Hash
func (*DynamoStore) UpdateRoot ¶
func (s *DynamoStore) UpdateRoot(current, last hash.Hash) bool
func (*DynamoStore) Version ¶
func (s *DynamoStore) Version() string
type DynamoStoreFlags ¶
type DynamoStoreFlags struct {
// contains filtered or unexported fields
}
func DynamoFlags ¶
func DynamoFlags(prefix string) DynamoStoreFlags
func (DynamoStoreFlags) CreateFactory ¶
func (f DynamoStoreFlags) CreateFactory() (factree Factory)
func (DynamoStoreFlags) CreateStore ¶
func (f DynamoStoreFlags) CreateStore(ns string) ChunkStore
func (DynamoStoreFlags) Shutter ¶
func (f DynamoStoreFlags) Shutter()
type Factory ¶
type Factory interface { CreateStore(ns string) ChunkStore // Shutter shuts down the factory. Subsequent calls to CreateStore() will fail. Shutter() }
Factory allows the creation of namespaced ChunkStore instances. The details of how namespaces are separated is left up to the particular implementation of Factory and ChunkStore.
func NewLevelDBStoreFactory ¶
func NewMemoryStoreFactory ¶
func NewMemoryStoreFactory() Factory
type GetRequest ¶
type GetRequest struct {
// contains filtered or unexported fields
}
func NewGetRequest ¶
func NewGetRequest(r hash.Hash, ch chan Chunk) GetRequest
func (GetRequest) Hash ¶
func (g GetRequest) Hash() hash.Hash
func (GetRequest) Outstanding ¶
func (g GetRequest) Outstanding() OutstandingRequest
type HasRequest ¶
type HasRequest struct {
// contains filtered or unexported fields
}
func NewHasRequest ¶
func NewHasRequest(r hash.Hash, ch chan bool) HasRequest
func (HasRequest) Hash ¶
func (h HasRequest) Hash() hash.Hash
func (HasRequest) Outstanding ¶
func (h HasRequest) Outstanding() OutstandingRequest
type LevelDBStore ¶
type LevelDBStore struct {
// contains filtered or unexported fields
}
func NewLevelDBStore ¶
func NewLevelDBStore(dir, ns string, maxFileHandles int, dumpStats bool) *LevelDBStore
func NewLevelDBStoreUseFlags ¶
func NewLevelDBStoreUseFlags(dir, ns string) *LevelDBStore
func (*LevelDBStore) Close ¶
func (l *LevelDBStore) Close() error
func (*LevelDBStore) Put ¶
func (l *LevelDBStore) Put(c Chunk)
func (*LevelDBStore) PutMany ¶
func (l *LevelDBStore) PutMany(chunks []Chunk) (e BackpressureError)
func (*LevelDBStore) Root ¶
func (l *LevelDBStore) Root() hash.Hash
func (*LevelDBStore) UpdateRoot ¶
func (l *LevelDBStore) UpdateRoot(current, last hash.Hash) bool
func (*LevelDBStore) Version ¶
func (l *LevelDBStore) Version() string
type LevelDBStoreFactory ¶
type LevelDBStoreFactory struct {
// contains filtered or unexported fields
}
func (*LevelDBStoreFactory) CreateStore ¶
func (f *LevelDBStoreFactory) CreateStore(ns string) ChunkStore
func (*LevelDBStoreFactory) Shutter ¶
func (f *LevelDBStoreFactory) Shutter()
type LevelDBStoreFlags ¶
type LevelDBStoreFlags struct {
// contains filtered or unexported fields
}
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
An in-memory implementation of store.ChunkStore. Useful mainly for tests.
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) Close ¶
func (ms *MemoryStore) Close() error
func (*MemoryStore) Len ¶
func (ms *MemoryStore) Len() int
func (*MemoryStore) Put ¶
func (ms *MemoryStore) Put(c Chunk)
func (*MemoryStore) PutMany ¶
func (ms *MemoryStore) PutMany(chunks []Chunk) (e BackpressureError)
func (*MemoryStore) UpdateRoot ¶
func (*MemoryStore) Version ¶
func (ms *MemoryStore) Version() string
type MemoryStoreFactory ¶
type MemoryStoreFactory struct {
// contains filtered or unexported fields
}
func (*MemoryStoreFactory) CreateStore ¶
func (f *MemoryStoreFactory) CreateStore(ns string) ChunkStore
func (*MemoryStoreFactory) Shutter ¶
func (f *MemoryStoreFactory) Shutter()
type OutstandingGet ¶
type OutstandingGet chan Chunk
func (OutstandingGet) Fail ¶
func (r OutstandingGet) Fail()
func (OutstandingGet) Satisfy ¶
func (r OutstandingGet) Satisfy(c Chunk)
type OutstandingHas ¶
type OutstandingHas chan bool
func (OutstandingHas) Fail ¶
func (h OutstandingHas) Fail()
func (OutstandingHas) Satisfy ¶
func (h OutstandingHas) Satisfy(c Chunk)
type OutstandingRequest ¶
type OutstandingRequest interface { Satisfy(c Chunk) Fail() }
type ReadBatch ¶
type ReadBatch map[hash.Hash][]OutstandingRequest
ReadBatch represents a set of queued Get/Has requests, each of which are blocking on a receive channel for a response.
type ReadRequest ¶
type ReadRequest interface { Hash() hash.Hash Outstanding() OutstandingRequest }
type ReadThroughStore ¶
ReadThroughStore is a store that consists of two other stores. A caching and a backing store. All reads check the caching store first and if the h is present there the caching store is used. If not present the backing store is used and the value gets cached in the caching store. All writes go directly to the backing store.
func NewReadThroughStore ¶
func NewReadThroughStore(cachingStore ChunkStore, backingStore ChunkStore) ReadThroughStore
func (ReadThroughStore) Put ¶
func (rts ReadThroughStore) Put(c Chunk)
func (ReadThroughStore) PutMany ¶
func (rts ReadThroughStore) PutMany(chunks []Chunk) BackpressureError
func (ReadThroughStore) Root ¶
func (rts ReadThroughStore) Root() hash.Hash
func (ReadThroughStore) UpdateRoot ¶
func (rts ReadThroughStore) UpdateRoot(current, last hash.Hash) bool
func (ReadThroughStore) Version ¶
func (rts ReadThroughStore) Version() string
type RootTracker ¶
RootTracker allows querying and management of the root of an entire tree of references. The "root" is the single mutable variable in a ChunkStore. It can store any hash, but it is typically used by higher layers (such as Database) to store a hash to a value that represents the current state and entire history of a database.
type TestStore ¶
type TestStore struct { MemoryStore Reads int Hases int Writes int }
func NewTestStore ¶
func NewTestStore() *TestStore
func (*TestStore) PutMany ¶
func (s *TestStore) PutMany(chunks []Chunk) (e BackpressureError)
func (*TestStore) UpdateRoot ¶
type TestStoreFactory ¶
TestStoreFactory is public, and exposes Stores to ensure that test code can directly query instances vended by this factory.
func NewTestStoreFactory ¶
func NewTestStoreFactory() *TestStoreFactory
func (*TestStoreFactory) CreateStore ¶
func (f *TestStoreFactory) CreateStore(ns string) ChunkStore
func (*TestStoreFactory) Shutter ¶
func (f *TestStoreFactory) Shutter()