Documentation ¶
Index ¶
- Constants
- func GenerateLeaseID() (string, error)
- func GenerateTrapdoor() (string, error)
- func ProvToMaps(prov any) ([]map[string]any, error)
- func WaitForConfirmation(ledger model.Ledger, ns notification.Service, interval, timeout time.Duration, ...) (int64, error)
- type Builder
- type BuilderOption
- func AsCleartext() BuilderOption
- func SetHeads(headName ...string) BuilderOption
- func WithAsset(assetID string) BuilderOption
- func WithContentType(contentType string) BuilderOption
- func WithCreator(creator *model.DID) BuilderOption
- func WithDIDMethod(didMethod string) BuilderOption
- func WithParent(parentRecordID, parentLockerID, blobCopyMode string, detachments []string, ...) BuilderOption
- func WithTimestamp(ts time.Time) BuilderOption
- func WithVault(vaultName string) BuilderOption
- type DataSetImpl
- func (d *DataSetImpl) BlockNumber() int64
- func (d *DataSetImpl) DecodeMetaResource(obj any) error
- func (d *DataSetImpl) DecodeResource(id string, obj any) error
- func (d *DataSetImpl) ID() string
- func (d *DataSetImpl) Impression() *model.Impression
- func (d *DataSetImpl) Lease() *model.Lease
- func (d *DataSetImpl) LockerID() string
- func (d *DataSetImpl) MetaResource() (io.ReadCloser, error)
- func (d *DataSetImpl) ParticipantID() string
- func (d *DataSetImpl) Record() *model.Record
- func (d *DataSetImpl) Resource(id string) (io.ReadCloser, error)
- func (d *DataSetImpl) Resources() []string
- type LeaseBuilder
- func (b *LeaseBuilder) AddMetaResource(meta any, opts ...BuilderOption) (string, error)
- func (b *LeaseBuilder) AddProvenance(id string, provenance any, override bool) error
- func (b *LeaseBuilder) AddResource(r io.Reader, opts ...BuilderOption) (string, error)
- func (b *LeaseBuilder) AddShareProvenance(sender *model.DID, recipientID string) error
- func (b *LeaseBuilder) Build(expiryTime time.Time) (*model.Lease, error)
- func (b *LeaseBuilder) Cancel() error
- func (b *LeaseBuilder) CreatorID() string
- func (b *LeaseBuilder) ImportResource(res *model.StoredResource) error
- func (b *LeaseBuilder) SetHeads(headName ...string) error
- func (b *LeaseBuilder) Submit(expiryTime time.Time) RecordFuture
- type LeaseBuilderBackend
- type LoadOption
- type LoadOptions
- type RecordFuture
Constants ¶
View Source
const ( CopyModeNone = "none" CopyModeShallow = "shallow" CopyModeDeep = "deep" )
Variables ¶
This section is empty.
Functions ¶
func GenerateLeaseID ¶
func GenerateTrapdoor ¶
Types ¶
type Builder ¶
type Builder interface { // CreatorID returns the creator's identity ID (DID). CreatorID() string // AddResource attaches a new resource/blob to the dataset and returns // its content-addressable asset ID. AddResource(r io.Reader, opts ...BuilderOption) (string, error) // ImportResource imports an existing resource. ImportResource(res *model.StoredResource) error // AddMetaResource adds a meta resource to the dataset and returns // its content-addressable asset ID. AddMetaResource(meta any, opts ...BuilderOption) (string, error) // AddProvenance adds a provenance definition to the resource with the given ID. AddProvenance(id string, provenance any, override bool) error // SetHeads instructs the builder to set the dataset as a head with the given // names when it's submitted to the ledger. SetHeads(headName ...string) error // Submit submits the dataset to the MetaLocker ledger. Submit(expiryTime time.Time) RecordFuture // Cancel cancels the dataset creation. NOT IMPLEMENTED YET. Cancel() error }
Builder enables interactive construction of a dataset, to be submitted to MetaLocker ledger. Once all the required operations are completed, call Submit to send the dataset definition to the ledger.
type BuilderOption ¶
type BuilderOption func(opts *builderOptions) error
BuilderOption is for defining optional parameters for Builder
func AsCleartext ¶
func AsCleartext() BuilderOption
func SetHeads ¶
func SetHeads(headName ...string) BuilderOption
func WithAsset ¶
func WithAsset(assetID string) BuilderOption
func WithContentType ¶
func WithContentType(contentType string) BuilderOption
func WithCreator ¶
func WithCreator(creator *model.DID) BuilderOption
func WithDIDMethod ¶
func WithDIDMethod(didMethod string) BuilderOption
func WithParent ¶
func WithParent(parentRecordID, parentLockerID, blobCopyMode string, detachments []string, detachResource bool) BuilderOption
func WithTimestamp ¶
func WithTimestamp(ts time.Time) BuilderOption
func WithVault ¶
func WithVault(vaultName string) BuilderOption
type DataSetImpl ¶
type DataSetImpl struct {
// contains filtered or unexported fields
}
func NewDataSetImpl ¶
func NewDataSetImpl(r *model.Record, lease *model.Lease, blockNumber int64, lockerID, participantID string, blobManager model.BlobManager) *DataSetImpl
func NewRevokedDataSetImpl ¶
func NewRevokedDataSetImpl(r *model.Record, blockNumber int64, lockerID, participantID string) *DataSetImpl
func (*DataSetImpl) BlockNumber ¶
func (d *DataSetImpl) BlockNumber() int64
func (*DataSetImpl) DecodeMetaResource ¶
func (d *DataSetImpl) DecodeMetaResource(obj any) error
func (*DataSetImpl) DecodeResource ¶
func (d *DataSetImpl) DecodeResource(id string, obj any) error
func (*DataSetImpl) ID ¶
func (d *DataSetImpl) ID() string
func (*DataSetImpl) Impression ¶
func (d *DataSetImpl) Impression() *model.Impression
func (*DataSetImpl) Lease ¶
func (d *DataSetImpl) Lease() *model.Lease
func (*DataSetImpl) LockerID ¶
func (d *DataSetImpl) LockerID() string
func (*DataSetImpl) MetaResource ¶
func (d *DataSetImpl) MetaResource() (io.ReadCloser, error)
func (*DataSetImpl) ParticipantID ¶
func (d *DataSetImpl) ParticipantID() string
func (*DataSetImpl) Record ¶
func (d *DataSetImpl) Record() *model.Record
func (*DataSetImpl) Resource ¶
func (d *DataSetImpl) Resource(id string) (io.ReadCloser, error)
func (*DataSetImpl) Resources ¶
func (d *DataSetImpl) Resources() []string
type LeaseBuilder ¶
type LeaseBuilder struct {
// contains filtered or unexported fields
}
func NewLeaseBuilder ¶
func NewLeaseBuilder(c LeaseBuilderBackend, blobManager model.BlobManager, locker *model.Locker, creator *model.DID, opts ...BuilderOption) (*LeaseBuilder, error)
func NewLeaseBuilderForSharing ¶
func NewLeaseBuilderForSharing(source model.DataSet, c LeaseBuilderBackend, blobManager model.BlobManager, blobCopyMode string, creator, sender *model.DID, recipientID, vaultName string, timeStamp *time.Time) (*LeaseBuilder, error)
func (*LeaseBuilder) AddMetaResource ¶
func (b *LeaseBuilder) AddMetaResource(meta any, opts ...BuilderOption) (string, error)
func (*LeaseBuilder) AddProvenance ¶
func (b *LeaseBuilder) AddProvenance(id string, provenance any, override bool) error
func (*LeaseBuilder) AddResource ¶
func (b *LeaseBuilder) AddResource(r io.Reader, opts ...BuilderOption) (string, error)
func (*LeaseBuilder) AddShareProvenance ¶
func (b *LeaseBuilder) AddShareProvenance(sender *model.DID, recipientID string) error
func (*LeaseBuilder) Cancel ¶
func (b *LeaseBuilder) Cancel() error
func (*LeaseBuilder) CreatorID ¶
func (b *LeaseBuilder) CreatorID() string
func (*LeaseBuilder) ImportResource ¶
func (b *LeaseBuilder) ImportResource(res *model.StoredResource) error
func (*LeaseBuilder) SetHeads ¶
func (b *LeaseBuilder) SetHeads(headName ...string) error
func (*LeaseBuilder) Submit ¶
func (b *LeaseBuilder) Submit(expiryTime time.Time) RecordFuture
type LeaseBuilderBackend ¶
type LeaseBuilderBackend interface { Load(id string, opts ...LoadOption) (model.DataSet, error) Submit(lease *model.Lease, cleartext bool, lockerID string, sender *model.LockerParticipant, headName ...string) RecordFuture }
type LoadOption ¶
type LoadOption func(opts *LoadOptions) error
LoadOption is for defining optional parameters for loading datasets
func FromLocker ¶
func FromLocker(id string) LoadOption
func WithLoadOptions ¶
func WithLoadOptions(options LoadOptions) LoadOption
type LoadOptions ¶
type LoadOptions struct {
LockerID string
}
type RecordFuture ¶
type RecordFuture interface { // Wait is a blocking operation that waits for the record to appear on the ledger // for up to the specified timeout value. Wait(timeout time.Duration) error // ID returns the ID of the ledger record. ID() string // Lease returns the lease of the submitted record (if applicable). Lease() *model.Lease // DataSet returns a fully featured model.DataSet for the submitted record. // This function will return nil if either the future state is !ready // or the submission returned an error. DataSet() model.DataSet // Heads returns a map Head ID ==> Head Record ID for operations that // create asset heads. Heads() map[string]string // IsReady returns true when the Wait function is guaranteed to not block IsReady() bool // WaitList returns a list of IDs of all ledger records produced // by the given submission. WaitList() []string // Error returns a non-nil value if the submission failed. It may not return // the actual error until the future is in 'ready' state. Error() error }
RecordFuture represents the result of an asynchronous ledger record submission.
func RecordFutureWithError ¶
func RecordFutureWithError(err error) RecordFuture
func RecordFutureWithResult ¶
func RecordFutureWithResult(ledger model.Ledger, ns notification.Service, recordID string, dataset *DataSetImpl, heads map[string]string, waitList []string) RecordFuture
Click to show internal directories.
Click to hide internal directories.