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(linkHash *types.Bytes32, evidence *cs.Evidence) error
- func (c *CouchStore) AddStoreEventChannel(eventChan chan *store.Event)
- func (c *CouchStore) CreateLink(link *cs.Link) (*types.Bytes32, error)
- func (c *CouchStore) DeleteValue(key []byte) ([]byte, error)
- func (c *CouchStore) FindSegments(filter *store.SegmentFilter) (cs.SegmentSlice, error)
- func (c *CouchStore) GetEvidences(linkHash *types.Bytes32) (*cs.Evidences, error)
- func (c *CouchStore) GetInfo() (interface{}, error)
- func (c *CouchStore) GetMapIDs(filter *store.MapFilter) ([]string, error)
- func (c *CouchStore) GetSegment(linkHash *types.Bytes32) (*cs.Segment, error)
- func (c *CouchStore) GetValue(key []byte) ([]byte, error)
- func (c *CouchStore) NewBatch() (store.Batch, error)
- func (c *CouchStore) SetValue(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/sdk/store.Adapter.
func (*CouchStore) AddEvidence ¶
AddEvidence implements github.com/stratumn/sdk/store.EvidenceWriter.AddEvidence.
func (*CouchStore) AddStoreEventChannel ¶
func (c *CouchStore) AddStoreEventChannel(eventChan chan *store.Event)
AddStoreEventChannel implements github.com/stratumn/sdk/store.Adapter.AddStoreEventChannel
func (*CouchStore) CreateLink ¶
CreateLink implements github.com/stratumn/sdk/store.LinkWriter.CreateLink.
func (*CouchStore) DeleteValue ¶
func (c *CouchStore) DeleteValue(key []byte) ([]byte, error)
DeleteValue implements github.com/stratumn/sdk/store.Adapter.DeleteValue.
func (*CouchStore) FindSegments ¶
func (c *CouchStore) FindSegments(filter *store.SegmentFilter) (cs.SegmentSlice, error)
FindSegments implements github.com/stratumn/sdk/store.Adapter.FindSegments.
func (*CouchStore) GetEvidences ¶
GetEvidences implements github.com/stratumn/sdk/store.EvidenceReader.GetEvidences.
func (*CouchStore) GetInfo ¶
func (c *CouchStore) GetInfo() (interface{}, error)
GetInfo implements github.com/stratumn/sdk/store.Adapter.GetInfo.
func (*CouchStore) GetMapIDs ¶
func (c *CouchStore) GetMapIDs(filter *store.MapFilter) ([]string, error)
GetMapIDs implements github.com/stratumn/sdk/store.Adapter.GetMapIDs.
func (*CouchStore) GetSegment ¶
GetSegment implements github.com/stratumn/sdk/store.Adapter.GetSegment.
func (*CouchStore) GetValue ¶
func (c *CouchStore) GetValue(key []byte) ([]byte, error)
GetValue implements github.com/stratumn/sdk/store.Adapter.GetValue.
func (*CouchStore) NewBatch ¶
func (c *CouchStore) NewBatch() (store.Batch, error)
NewBatch implements github.com/stratumn/sdk/store.Adapter.NewBatch.
func (*CouchStore) SetValue ¶
func (c *CouchStore) SetValue(key, value []byte) error
SetValue implements github.com/stratumn/sdk/store.KeyValueStore.SetValue.
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 ¶
type PrevLinkHash struct {
Exists *bool `json:"$exists,omitempty"`
Equals string `json:"$eq,omitempty"`
}
PrevLinkHash is used to specify PrevLinkHash in selector.