Documentation ¶
Overview ¶
Package store is a generated GoMock package.
Index ¶
- func HashContents(contents []byte) model.Hash
- type DocumentStore
- type MockDocumentStore
- func (m *MockDocumentStore) Add(document model.Document) (model.Hash, error)
- func (m *MockDocumentStore) ContentsSize() int
- func (m *MockDocumentStore) EXPECT() *MockDocumentStoreMockRecorder
- func (m *MockDocumentStore) FindByContentsHash(hash model.Hash) ([]model.DocumentDescriptor, error)
- func (m *MockDocumentStore) Get(hash model.Hash) (*model.DocumentDescriptor, error)
- func (m *MockDocumentStore) GetAll() ([]model.DocumentDescriptor, error)
- func (m *MockDocumentStore) GetByConsistencyHash(hash model.Hash) (*model.DocumentDescriptor, error)
- func (m *MockDocumentStore) LastConsistencyHash() model.Hash
- func (m *MockDocumentStore) ReadContents(hash model.Hash) (io.ReadCloser, error)
- func (m *MockDocumentStore) Size() int
- func (m *MockDocumentStore) WriteContents(hash model.Hash, contents io.Reader) error
- type MockDocumentStoreMockRecorder
- func (mr *MockDocumentStoreMockRecorder) Add(document interface{}) *gomock.Call
- func (mr *MockDocumentStoreMockRecorder) ContentsSize() *gomock.Call
- func (mr *MockDocumentStoreMockRecorder) FindByContentsHash(hash interface{}) *gomock.Call
- func (mr *MockDocumentStoreMockRecorder) Get(hash interface{}) *gomock.Call
- func (mr *MockDocumentStoreMockRecorder) GetAll() *gomock.Call
- func (mr *MockDocumentStoreMockRecorder) GetByConsistencyHash(hash interface{}) *gomock.Call
- func (mr *MockDocumentStoreMockRecorder) LastConsistencyHash() *gomock.Call
- func (mr *MockDocumentStoreMockRecorder) ReadContents(hash interface{}) *gomock.Call
- func (mr *MockDocumentStoreMockRecorder) Size() *gomock.Call
- func (mr *MockDocumentStoreMockRecorder) WriteContents(hash, contents interface{}) *gomock.Call
- type NoopCloser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashContents ¶ added in v0.16.0
Types ¶
type DocumentStore ¶
type DocumentStore interface { // Get retrieves a document from the store given its hash. If it doesn't exist, nil is returned (no error). Get(hash model.Hash) (*model.DocumentDescriptor, error) // GetByConsistencyHash retrieves a document from the store given its consistency hash. If it doesn't exist, nil is returned (no error). GetByConsistencyHash(hash model.Hash) (*model.DocumentDescriptor, error) // FindByContentsHash searches for documents which contents match the given SHA-1 hash. FindByContentsHash(hash model.Hash) ([]model.DocumentDescriptor, error) // Add adds a document, returning the last consistency hash. Add(document model.Document) (model.Hash, error) // GetAll retrieves all documents. GetAll() ([]model.DocumentDescriptor, error) // WriteContents writes contents for the specified document, identified by the given hash. // If the document does not exist, an error is returned. If the document already has contents, it is overwritten. WriteContents(hash model.Hash, contents io.Reader) error // ReadContents reads the contents for the specified document, identified by the given hash. If the document doesn't exist, an error is returned. // If the document has no contents, nil is returned. ReadContents(hash model.Hash) (io.ReadCloser, error) // LastConsistencyHash retrieves the last consistency hash from the store (the consistency hash of the last document in the chain). If there are no documents in the store, an empty hash is returned. LastConsistencyHash() model.Hash // ContentsSize retrieves size of all stored contents in bytes. ContentsSize() int // Size retrieves the number of documents in the store. Size() int }
DocumentStore is used to store and retrieve chained documents.
func CreateDocumentStore ¶
func CreateDocumentStore(connectionString string) (DocumentStore, error)
CreateDocumentStore creates a new DocumentStore given the connection string. The conenction string should be understood by the underlying implementation (currently sqlite3).
type MockDocumentStore ¶
type MockDocumentStore struct {
// contains filtered or unexported fields
}
MockDocumentStore is a mock of DocumentStore interface
func NewMockDocumentStore ¶
func NewMockDocumentStore(ctrl *gomock.Controller) *MockDocumentStore
NewMockDocumentStore creates a new mock instance
func (*MockDocumentStore) ContentsSize ¶
func (m *MockDocumentStore) ContentsSize() int
ContentsSize mocks base method
func (*MockDocumentStore) EXPECT ¶
func (m *MockDocumentStore) EXPECT() *MockDocumentStoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockDocumentStore) FindByContentsHash ¶ added in v0.16.0
func (m *MockDocumentStore) FindByContentsHash(hash model.Hash) ([]model.DocumentDescriptor, error)
FindByContentsHash mocks base method
func (*MockDocumentStore) Get ¶
func (m *MockDocumentStore) Get(hash model.Hash) (*model.DocumentDescriptor, error)
Get mocks base method
func (*MockDocumentStore) GetAll ¶
func (m *MockDocumentStore) GetAll() ([]model.DocumentDescriptor, error)
GetAll mocks base method
func (*MockDocumentStore) GetByConsistencyHash ¶
func (m *MockDocumentStore) GetByConsistencyHash(hash model.Hash) (*model.DocumentDescriptor, error)
GetByConsistencyHash mocks base method
func (*MockDocumentStore) LastConsistencyHash ¶
func (m *MockDocumentStore) LastConsistencyHash() model.Hash
LastConsistencyHash mocks base method
func (*MockDocumentStore) ReadContents ¶
func (m *MockDocumentStore) ReadContents(hash model.Hash) (io.ReadCloser, error)
ReadContents mocks base method
func (*MockDocumentStore) WriteContents ¶
WriteContents mocks base method
type MockDocumentStoreMockRecorder ¶
type MockDocumentStoreMockRecorder struct {
// contains filtered or unexported fields
}
MockDocumentStoreMockRecorder is the mock recorder for MockDocumentStore
func (*MockDocumentStoreMockRecorder) Add ¶
func (mr *MockDocumentStoreMockRecorder) Add(document interface{}) *gomock.Call
Add indicates an expected call of Add
func (*MockDocumentStoreMockRecorder) ContentsSize ¶
func (mr *MockDocumentStoreMockRecorder) ContentsSize() *gomock.Call
ContentsSize indicates an expected call of ContentsSize
func (*MockDocumentStoreMockRecorder) FindByContentsHash ¶ added in v0.16.0
func (mr *MockDocumentStoreMockRecorder) FindByContentsHash(hash interface{}) *gomock.Call
FindByContentsHash indicates an expected call of FindByContentsHash
func (*MockDocumentStoreMockRecorder) Get ¶
func (mr *MockDocumentStoreMockRecorder) Get(hash interface{}) *gomock.Call
Get indicates an expected call of Get
func (*MockDocumentStoreMockRecorder) GetAll ¶
func (mr *MockDocumentStoreMockRecorder) GetAll() *gomock.Call
GetAll indicates an expected call of GetAll
func (*MockDocumentStoreMockRecorder) GetByConsistencyHash ¶
func (mr *MockDocumentStoreMockRecorder) GetByConsistencyHash(hash interface{}) *gomock.Call
GetByConsistencyHash indicates an expected call of GetByConsistencyHash
func (*MockDocumentStoreMockRecorder) LastConsistencyHash ¶
func (mr *MockDocumentStoreMockRecorder) LastConsistencyHash() *gomock.Call
LastConsistencyHash indicates an expected call of LastConsistencyHash
func (*MockDocumentStoreMockRecorder) ReadContents ¶
func (mr *MockDocumentStoreMockRecorder) ReadContents(hash interface{}) *gomock.Call
ReadContents indicates an expected call of ReadContents
func (*MockDocumentStoreMockRecorder) Size ¶
func (mr *MockDocumentStoreMockRecorder) Size() *gomock.Call
Size indicates an expected call of Size
func (*MockDocumentStoreMockRecorder) WriteContents ¶
func (mr *MockDocumentStoreMockRecorder) WriteContents(hash, contents interface{}) *gomock.Call
WriteContents indicates an expected call of WriteContents
type NoopCloser ¶
NoopCloser implements io.ReadCloser with a No-Operation, intended for returning byte slices.
func (NoopCloser) Close ¶
func (NoopCloser) Close() error