Documentation ¶
Index ¶
- Constants
- func NewMapQuery(filter *store.MapFilter) ([]byte, error)
- func NewSegmentQuery(filter *store.SegmentFilter) ([]byte, error)
- type BulkDocuments
- type Config
- type CouchFindResponse
- type CouchNotReadyError
- type CouchResponseStatus
- type CouchStore
- func (c *CouchStore) AddEvidence(ctx context.Context, linkHash *types.Bytes32, evidence *cs.Evidence) error
- func (c *CouchStore) AddStoreEventChannel(eventChan chan *store.Event)
- func (c *CouchStore) CreateLink(ctx context.Context, link *cs.Link) (*types.Bytes32, error)
- func (c *CouchStore) DeleteValue(ctx context.Context, key []byte) ([]byte, error)
- func (c *CouchStore) FindSegments(ctx context.Context, filter *store.SegmentFilter) (cs.SegmentSlice, error)
- func (c *CouchStore) GetEvidences(ctx context.Context, linkHash *types.Bytes32) (*cs.Evidences, error)
- func (c *CouchStore) GetInfo(ctx context.Context) (interface{}, error)
- func (c *CouchStore) GetMapIDs(ctx context.Context, filter *store.MapFilter) ([]string, error)
- func (c *CouchStore) GetSegment(ctx context.Context, linkHash *types.Bytes32) (*cs.Segment, error)
- func (c *CouchStore) GetValue(ctx context.Context, key []byte) ([]byte, error)
- func (c *CouchStore) NewBatch(ctx context.Context) (store.Batch, error)
- func (c *CouchStore) SetValue(ctx context.Context, key, value []byte) error
- type Document
- type Info
- type LinkHashIn
- type LinkQuery
- type LinkSelector
- type MapIdsIn
- type MapQuery
- type MapSelector
- type PrevLinkHash
- type TagsAll
Constants ¶
const ( // Name is the name set in the store's information. Name = "CouchDB" // Description is the description set in the store's information. Description = "Indigo's CouchDB Store" )
Variables ¶
This section is empty.
Functions ¶
func NewMapQuery ¶
NewMapQuery generates json data used to filter queries using couchdb _find api.
func NewSegmentQuery ¶
func NewSegmentQuery(filter *store.SegmentFilter) ([]byte, error)
NewSegmentQuery generates json data used to filter queries using couchdb _find api.
Types ¶
type BulkDocuments ¶
type BulkDocuments struct { Documents []*Document `json:"docs"` Atomic bool `json:"all_or_nothing,omitempty"` }
BulkDocuments is used to bulk save documents to couchdb.
type Config ¶
type Config struct { // Address is CouchDB api end point. Address string // A version string that will be set in the store's information. Version string // A git commit hash that will be set in the store's information. Commit string }
Config contains configuration options for the store.
type CouchFindResponse ¶
type CouchFindResponse struct {
Docs []*Document `json:"docs"`
}
CouchFindResponse is couchdb response type when posting to /db/_find
type CouchNotReadyError ¶
type CouchNotReadyError struct {
// contains filtered or unexported fields
}
CouchNotReadyError is returned when couchdb is not ready.
func (*CouchNotReadyError) Error ¶
func (e *CouchNotReadyError) Error() string
Error implements error interface.
type CouchResponseStatus ¶
type CouchResponseStatus struct { Ok bool StatusCode int Error string `json:"error;omitempty"` Reason string `json:"reason;omitempty"` }
CouchResponseStatus contains couch specific response when querying the API.
type CouchStore ¶
type CouchStore struct {
// contains filtered or unexported fields
}
CouchStore is the type that implements github.com/stratumn/go-indigocore/store.Adapter.
func (*CouchStore) AddEvidence ¶
func (c *CouchStore) AddEvidence(ctx context.Context, linkHash *types.Bytes32, evidence *cs.Evidence) error
AddEvidence implements github.com/stratumn/go-indigocore/store.EvidenceWriter.AddEvidence.
func (*CouchStore) AddStoreEventChannel ¶
func (c *CouchStore) AddStoreEventChannel(eventChan chan *store.Event)
AddStoreEventChannel implements github.com/stratumn/go-indigocore/store.Adapter.AddStoreEventChannel
func (*CouchStore) CreateLink ¶
CreateLink implements github.com/stratumn/go-indigocore/store.LinkWriter.CreateLink.
func (*CouchStore) DeleteValue ¶
DeleteValue implements github.com/stratumn/go-indigocore/store.Adapter.DeleteValue.
func (*CouchStore) FindSegments ¶
func (c *CouchStore) FindSegments(ctx context.Context, filter *store.SegmentFilter) (cs.SegmentSlice, error)
FindSegments implements github.com/stratumn/go-indigocore/store.Adapter.FindSegments.
func (*CouchStore) GetEvidences ¶
func (c *CouchStore) GetEvidences(ctx context.Context, linkHash *types.Bytes32) (*cs.Evidences, error)
GetEvidences implements github.com/stratumn/go-indigocore/store.EvidenceReader.GetEvidences.
func (*CouchStore) GetInfo ¶
func (c *CouchStore) GetInfo(ctx context.Context) (interface{}, error)
GetInfo implements github.com/stratumn/go-indigocore/store.Adapter.GetInfo.
func (*CouchStore) GetMapIDs ¶
GetMapIDs implements github.com/stratumn/go-indigocore/store.Adapter.GetMapIDs.
func (*CouchStore) GetSegment ¶
GetSegment implements github.com/stratumn/go-indigocore/store.Adapter.GetSegment.
func (*CouchStore) GetValue ¶
GetValue implements github.com/stratumn/go-indigocore/store.Adapter.GetValue.
type Document ¶
type Document struct { ID string `json:"_id,omitempty"` Revision string `json:"_rev,omitempty"` ObjectType string `json:"docType,omitempty"` // The following fields are used when querying couchdb for link documents. Link *cs.Link `json:"link,omitempty"` // The following fields are used when querying couchdb for evidences documents. Evidences *cs.Evidences `json:"evidences,omitempty"` // The following fields are used when querying couchdb for map documents Process string `json:"process,omitempty"` // The following fields are used when querying couchdb for values stored via key/value. Value []byte `json:"value,omitempty"` }
Document is the type used in couchdb
type Info ¶
type Info struct { Name string `json:"name"` Description string `json:"description"` Version string `json:"version"` Commit string `json:"commit"` }
Info is the info returned by GetInfo.
type LinkHashIn ¶
type LinkHashIn struct {
LinkHashes []string `json:"$in,omitempty"`
}
LinkHashIn specifies the list of link hashes to search for
type LinkQuery ¶
type LinkQuery struct { Selector LinkSelector `json:"selector,omitempty"` Limit int `json:"limit,omitempty"` Skip int `json:"skip,omitempty"` }
LinkQuery used in CouchDB rich queries
type LinkSelector ¶
type LinkSelector struct { ObjectType string `json:"docType"` PrevLinkHash *PrevLinkHash `json:"link.meta.prevLinkHash,omitempty"` Process string `json:"link.meta.process,omitempty"` MapIds *MapIdsIn `json:"link.meta.mapId,omitempty"` Tags *TagsAll `json:"link.meta.tags,omitempty"` LinkHash *LinkHashIn `json:"_id,omitempty"` }
LinkSelector used in LinkQuery
type MapIdsIn ¶
type MapIdsIn struct {
MapIds []string `json:"$in,omitempty"`
}
MapIdsIn specifies that segment mapId should be in specified list
type MapQuery ¶
type MapQuery struct { Selector MapSelector `json:"selector,omitempty"` Limit int `json:"limit,omitempty"` Skip int `json:"skip,omitempty"` }
MapQuery used in CouchDB rich queries
type MapSelector ¶
type MapSelector struct { ObjectType string `json:"docType"` Process string `json:"process,omitempty"` }
MapSelector used in MapQuery
type PrevLinkHash ¶
PrevLinkHash is used to specify PrevLinkHash in selector.