Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ContentChallenge ¶
ContentChallenge holds a proof-of-content challenge produced by a blobstore. A client can satisfy the request by producing a ContentChallengeResponse containing the same request id and a hash of RangeLength bytes of the content starting at RangeStart.
type ContentChallengeError ¶
type ContentChallengeError struct {
Req ContentChallenge
}
ContentChallengeError holds a proof-of-content challenge produced by a blobstore.
func (*ContentChallengeError) Error ¶
func (e *ContentChallengeError) Error() string
type ContentChallengeResponse ¶
ContentChallengeResponse holds a response to a ContentChallenge.
func NewContentChallengeResponse ¶
func NewContentChallengeResponse(chal *ContentChallenge, r io.ReadSeeker) (*ContentChallengeResponse, error)
NewContentChallengeResponse can be used by a client to respond to a content challenge. The returned value should be passed to BlobStorage.Put when the client retries the request.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store stores data blobs in mongodb, de-duplicating by blob hash.
func New ¶
New returns a new blob store that writes to the given database, prefixing its collections with the given prefix.
func (*Store) Open ¶
func (s *Store) Open(name string) (ReadSeekCloser, int64, error)
Open opens the entry with the given name.
func (*Store) Put ¶
func (s *Store) Put(r io.Reader, name string, size int64, hash string, proof *ContentChallengeResponse) (*ContentChallenge, error)
Put tries to stream the content from the given reader into blob storage, with the provided name. The content should have the given size and hash. If the content is already in the store, a ContentChallengeError is returned containing a challenge that must be satisfied by a client to prove that they have access to the content. If the proof has already been acquired, it should be passed in as the proof argument.
func (*Store) PutUnchallenged ¶
PutUnchallenged stream the content from the given reader into blob storage, with the provided name. The content should have the given size and hash. In this case a challenge is never returned and a proof is not required.