Documentation
¶
Index ¶
- Constants
- Variables
- func AddCommands(app *cli.App) *cli.App
- func Bug(cmd *CmdCtx, id string) bool
- func EventListFromData(data []byte) ([]json.RawMessage, error)
- func IsSupportedBug(id string) bool
- func NewApp() *cli.App
- func NewAttribute(value any) (*attribute.Attribute, error)
- func NewDiagCmd() *cli.Command
- func NewEventDiagCmd() *cli.Command
- func NewEventsVerifyCmd() *cli.Command
- func NewLogTailCmd() *cli.Command
- func NewLogWatcherCmd() *cli.Command
- func NewMassifsCmd() *cli.Command
- func NewNodeCmd() *cli.Command
- func NewNodeScanCmd() *cli.Command
- func NewProveCmd() *cli.Command
- func NewTimestamp(id uint64, epoch uint8) (*timestamppb.Timestamp, error)
- func NewWatchConfig(cCtx *cli.Context, cmd *CmdCtx) (watcher.WatchConfig, error)
- func PeakStack(massifHeight uint8, mmrSize uint64) []uint64
- func SetTimestamp(id uint64, ts *timestamppb.Timestamp, epoch uint8) error
- type CmdCtx
- type LogTailActivity
- type MassifTail
- type SealTail
- type TailConfig
- type VerifiableEvent
Constants ¶
const ( AzureBlobURLFmt = "https://%s.blob.core.windows.net" AzuriteStorageAccount = "devstoreaccount1" DefaultContainer = "merklelogs" )
const ( // LeafTypePlain is used for committing to plain values. LeafTypePlain = uint8(0) PublicAssetsPrefix = "publicassets/" ProtectedAssetsPrefix = "assets/" )
Variables ¶
var ( // recovers timestamp_committed from merklelog_entry.commit.idtimestamp prior to hashing Bug9308 = "9308" Bugs = []string{ Bug9308, } )
var ( ErrVerifyInclusionFailed = errors.New("the entry is not in the log") ErrUncommittedEvents = errors.New("one or more events did not have record of their inclusion in the log") )
Functions ¶
func EventListFromData ¶ added in v0.0.3
func EventListFromData(data []byte) ([]json.RawMessage, error)
EventListFromData normalises a json encoded event or *list* of events, by always returning a list of json encoded events.
Each item is a single json encoded event. The data must be json and it must have a map at the top level. The data can be the result of getting single event or a list of events from the datatrails events api or a list of events from the datatrails events api:
{ events: [{event-0}, {event-1}, ..., {event-n}] }
Or just {event}
func IsSupportedBug ¶
func NewDiagCmd ¶
NewDiagCmd prints diagnostic information about the massif blob containg a specific mmrIndex
func NewEventDiagCmd ¶
NewEventDiagCmd provides diagnostic support for event verification
func NewEventsVerifyCmd ¶ added in v0.0.3
NewEventsVerifyCmd verifies inclusion of a DataTrails event in the tenants Merkle Log
func NewLogTailCmd ¶
func NewLogWatcherCmd ¶
NewLogWatcherCmd watches for changes on any log
func NewMassifsCmd ¶
NewMassifsCmd prints out pre-calculated tables for navigating massif blobs with maximum convenience
func NewNodeScanCmd ¶
NewNodeScan implements a sub command which linearly scans for a node in a blob This is a debugging tool
func NewProveCmd ¶
NewProveCmd (will) generate a proof and node path for the argument node
func NewTimestamp ¶
func NewTimestamp(id uint64, epoch uint8) (*timestamppb.Timestamp, error)
func NewWatchConfig ¶
NewWatchConfig derives a configuration from the options set on the command line context
func PeakStack ¶
PeakStack returns the stack of mmrIndices corresponding to the stack of ancestor nodes required for mmrSize. Note that the trick here is to realise that passing a massifIndex+1 in place of mmrSize, treating each massif as a leaf node in a much smaller tree, gets the (much shorter) peak stack of nodes required from earlier massifs. And this is stack of nodes carried forward in each massif blob to make them self contained. (The mmrblobs package has a slightly different variant of this that returns a map)
func SetTimestamp ¶
func SetTimestamp(id uint64, ts *timestamppb.Timestamp, epoch uint8) error
Types ¶
type CmdCtx ¶
type CmdCtx struct {
// contains filtered or unexported fields
}
CmdCtx holds shared config and config derived state for all commands
type LogTailActivity ¶
type LogTailActivity struct {
watcher.LogTail
LogSize uint64
LastIDEpoch uint8
LastIDTimestamp uint64
LogActivity time.Time
TagActivity time.Time
}
LogTailActivity can represent either the seal or the massif that has most recently been updated for the log.
type MassifTail ¶
type MassifTail struct {
LogTailActivity
FirstIndex uint64
}
MassifTail contains the massif specific tail information
func TailMassif ¶
func TailMassif( ctx context.Context, massifReader massifs.MassifReader, tenantIdentity string, ) (MassifTail, error)
TailMassif returns the active massif for the tenant
func (MassifTail) String ¶
func (lt MassifTail) String() string
String returns a printable. loggable pretty rendering of the tail
type SealTail ¶
type SealTail struct {
LogTailActivity
Count uint64
Signed cose.CoseSign1Message
State massifs.MMRState
}
SealTail contains the seal specific tail information
type TailConfig ¶
type TailConfig struct {
// Interval defines the wait period between repeated tail checks if many
// checks have been asked for.
Interval time.Duration
// TenantIdentity identifies the log of interest
TenantIdentity string
}
func NewTailConfig ¶
func NewTailConfig(cCtx *cli.Context, cmd *CmdCtx) (TailConfig, error)
NewTailConfig derives a configuration from the supplied comand line options context
type VerifiableEvent ¶ added in v0.0.3
type VerifiableEvent struct {
Json []byte
V3Event simplehash.V3Event
JsonOrig []byte
V3EventOrig simplehash.V3Event
LogEntry *assets.MerkleLogEntry
}
func NewVerifiableEvent ¶ added in v0.0.3
func NewVerifiableEvent(eventJson []byte) (VerifiableEvent, error)
func ReadVerifiableEventsFromFile ¶ added in v0.0.3
func ReadVerifiableEventsFromFile(fileName string) ([]VerifiableEvent, error)
ReadVerifiableEventsFromFile reads datatrails events from a file and returns a normalized list of raw binary items.
See EventListFromData for the content expectations (must be a list of events or single event from datatrails api)
func VerifiableEventsFromData ¶ added in v0.0.3
func VerifiableEventsFromData(data []byte) ([]VerifiableEvent, error)