Documentation
¶
Index ¶
- Constants
- Variables
- func AddCommands(app *cli.App, ikwid bool) *cli.App
- func Bug(cmd *CmdCtx, id string) bool
- func CompareECDSAPublicKeys(key1, key2 *ecdsa.PublicKey) bool
- func CtxGetOneTenantOption(cCtx cliContextString) string
- func CtxGetTenantOptions(cCtx cliContextString) []string
- func DecodeECDSAPublicPEM(data []byte) (*ecdsa.PublicKey, error)
- func DecodeECDSAPublicString(data string) (*ecdsa.PublicKey, error)
- func EnsureTenantPrefix(tenant string) string
- func IsSupportedBug(id string) bool
- func NewApp(version string, ikwid bool) *cli.App
- func NewAttribute(value any) (*attribute.Attribute, error)
- func NewDiagCmd() *cli.Command
- func NewDirLister() massifs.DirLister
- func NewEventDiagCmd() *cli.Command
- func NewFileOpener() massifs.Opener
- func NewFileWriteOpener() massifs.WriteAppendOpener
- func NewFindMMREntriesCmd() *cli.Command
- func NewFindTrieEntriesCmd() *cli.Command
- func NewLogTailCmd() *cli.Command
- func NewLogWatcherCmd() *cli.Command
- func NewMassifsCmd() *cli.Command
- func NewNodeCmd() *cli.Command
- func NewNodeScanCmd() *cli.Command
- func NewPrefetchingSealReader(ctx context.Context, sealGetter massifs.SealGetter, tenantIdentity string, ...) (*prefetchingSealReader, error)
- func NewProveCmd() *cli.Command
- func NewReceiptCmd() *cli.Command
- func NewReplicateLogsCmd() *cli.Command
- func NewStdinOpener() massifs.Opener
- func NewTimestamp(id uint64, epoch uint8) (*timestamppb.Timestamp, error)
- func NewVerifyIncludedCmd() *cli.Command
- func PeakStack(massifHeight uint8, mmrIndex uint64) []uint64
- func SetTimestamp(id uint64, ts *timestamppb.Timestamp, epoch uint8) error
- func WatchForChanges(ctx context.Context, cfg WatchConfig, reader azblob.Reader, ...) error
- type CmdCtx
- type FileWriteAppendOpener
- type LogTailActivity
- type MassifGetter
- type MassifReader
- type MassifTail
- type OsDirLister
- type Progresser
- type ReadOpener
- type SealTail
- type StdinOpener
- type TailConfig
- type TenantActivity
- type TenantMassif
- type VerifiedContextReader
- type VerifiedReplica
- type WatchConfig
- type Watcher
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/" // To create smooth UX for basic or first-time users, we default to the verifiabledata proxy // on production. This gives us compact runes to verify inclusion of a List Events response. DefaultRemoteMassifURL = "https://app.datatrails.ai/verifiabledata" )
Variables ¶
var ( // recovers timestamp_committed from merklelog_entry.commit.idtimestamp prior to hashing Bug9308 = "9308" Bugs = []string{ Bug9308, } )
var ( ErrChangesFlagIsExclusive = errors.New("use --changes Or --massif and --tenant, not both") ErrNewReplicaNotEmpty = errors.New("the local directory for a new replica already exists") ErrSealNotFound = errors.New("seal not found") ErrSealVerifyFailed = errors.New("the seal signature verification failed") ErrFailedCheckingConsistencyProof = errors.New("failed to check a consistency proof") ErrFailedToCreateReplicaDir = errors.New("failed to create a directory needed for local replication") ErrRequiredOption = errors.New("a required option was not provided") ErrRemoteLogTruncated = errors.New("the local replica indicates the remote log has been truncated") ErrRemoteLogInconsistentRootState = errors.New("the local replica root state disagrees with the remote") ErrInconsistentUseOfPrefetchedSeal = errors.New("prefetching signed root reader used inconsistently") )
var ( ErrInvalidBlockNotPublicKey = errors.New("the data does not have the PEM armour indicating it is a public key") // ErrInvalidPublicKeyString = errors.New("failed to decode the key bytes from a string") ErrKeyBytesParseFailed = errors.New("the pem block could not be parsed as a public key") ErrInvalidKeyNotECDSAPublic = errors.New("parsed public key is not the expected ecdsa type") )
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") )
var (
ErrNoChanges = errors.New("no changes found")
)
var (
ErrNoLogTenant = fmt.Errorf("error, cannot find log tenant, please provide either %v or %v", logIDFlagName, logTenantFlagName)
)
Functions ¶
func CompareECDSAPublicKeys ¶ added in v0.1.0
func CtxGetOneTenantOption ¶ added in v0.1.0
func CtxGetOneTenantOption(cCtx cliContextString) string
func CtxGetTenantOptions ¶ added in v0.1.0
func CtxGetTenantOptions(cCtx cliContextString) []string
func DecodeECDSAPublicPEM ¶ added in v0.1.0
DecodeECDSAPublicPEM decodes a public pem format ecdsa key This is the format that the merklelog signing key is distributed in
func DecodeECDSAPublicString ¶ added in v0.1.0
DecodeECDSAPublicString decodes a public pem format ecdsa key This is the format that the merklelog signing key is distributed in, but with the key material presented as a single, base64 encoded, string. This is typically more convenient for command line and environment vars
func EnsureTenantPrefix ¶ added in v0.1.0
EnsureTenantPrefix ensures a string is prefixed with 'tenant/' Note the expected input is a uuid string or a tenant/uuid string
func IsSupportedBug ¶
func NewDiagCmd ¶
NewDiagCmd prints diagnostic information about the massif blob containg a specific mmrIndex
func NewDirLister ¶ added in v0.1.0
func NewEventDiagCmd ¶
NewEventDiagCmd provides diagnostic support for event verification
func NewFileOpener ¶ added in v0.1.0
func NewFileWriteOpener ¶ added in v0.1.0
func NewFileWriteOpener() massifs.WriteAppendOpener
func NewFindMMREntriesCmd ¶ added in v0.2.2
NewFindMMREntriesCmd finds the mmr entries associated with a given app entries in the tenants Merkle Log.
func NewFindTrieEntriesCmd ¶ added in v0.2.2
NewFindTrieEntriesCmd finds the trie entries associated with a given trie key 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 NewPrefetchingSealReader ¶ added in v0.2.6
func NewProveCmd ¶
NewProveCmd (will) generate a proof and node path for the argument node
func NewReceiptCmd ¶ added in v0.2.0
func NewReplicateLogsCmd ¶ added in v0.1.0
NewReplicateLogsCmd updates a local replica of a remote log, verifying the mutual consistency of the two before making any changes.
func NewStdinOpener ¶ added in v0.1.0
func NewTimestamp ¶
func NewTimestamp(id uint64, epoch uint8) (*timestamppb.Timestamp, error)
func NewVerifyIncludedCmd ¶ added in v0.1.0
NewVerifyIncludedCmd verifies inclusion of a DataTrails event in the tenants Merkle Log
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
func WatchForChanges ¶ added in v0.0.6
func WatchForChanges( ctx context.Context, cfg WatchConfig, reader azblob.Reader, reporter watchReporter, ) error
WatchForChanges watches for tenant log chances according to the provided config
Types ¶
type CmdCtx ¶
type CmdCtx struct {
// contains filtered or unexported fields
}
CmdCtx holds shared config and config derived state for all commands
type FileWriteAppendOpener ¶ added in v0.1.0
type FileWriteAppendOpener struct{}
FileWriteAppendOpener is an interface for opening a file for writing The Open implementation must open for *append*, and must create the file if it does not exist. The Create implementation must truncate the file if it exists, and create it if it does not.
func (*FileWriteAppendOpener) Create ¶ added in v0.2.1
func (*FileWriteAppendOpener) Create(name string) (io.WriteCloser, error)
Create ensures the named file exists, is empty and is writable If the named file already exists it is truncated
func (*FileWriteAppendOpener) Open ¶ added in v0.1.0
func (*FileWriteAppendOpener) Open(name string) (io.WriteCloser, error)
Open ensures the named file exists and is writable. Writes are appended to any existing content.
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 MassifGetter ¶ added in v0.2.2
type MassifGetter interface {
GetMassif(
ctx context.Context, tenantIdentity string, massifIndex uint64, opts ...massifs.ReaderOption,
) (massifs.MassifContext, error)
}
MassifGetter gets a specific massif based on the massifIndex given for a tenant log
type MassifReader ¶ added in v0.0.4
type MassifReader interface {
GetVerifiedContext(
ctx context.Context, tenantIdentity string, massifIndex uint64,
opts ...massifs.ReaderOption,
) (*massifs.VerifiedContext, error)
GetFirstMassif(
ctx context.Context, tenantIdentity string, opts ...massifs.ReaderOption,
) (massifs.MassifContext, error)
GetHeadMassif(
ctx context.Context, tenantIdentity string, opts ...massifs.ReaderOption,
) (massifs.MassifContext, error)
GetLazyContext(
ctx context.Context, tenantIdentity string, which massifs.LogicalBlob, opts ...massifs.ReaderOption,
) (massifs.LogBlobContext, uint64, error)
MassifGetter
}
type MassifTail ¶
type MassifTail struct {
LogTailActivity
FirstIndex uint64
}
MassifTail contains the massif specific tail information
func TailMassif ¶
func TailMassif( ctx context.Context, massifReader 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 OsDirLister ¶ added in v0.0.4
type OsDirLister struct{}
Utilities to remove the os dependencies from the MassifReader
type Progresser ¶ added in v0.1.1
type Progresser interface {
Completed()
}
func NewNoopProgress ¶ added in v0.1.1
func NewNoopProgress() Progresser
func NewStagedProgress ¶ added in v0.1.1
func NewStagedProgress(prefix string, count int) Progresser
type ReadOpener ¶ added in v0.1.0
type ReadOpener struct{}
func (*ReadOpener) Open ¶ added in v0.1.0
func (*ReadOpener) Open(name string) (io.ReadCloser, error)
type SealTail ¶
type SealTail struct {
LogTailActivity
Count uint64
Signed cose.CoseSign1Message
State massifs.MMRState
}
SealTail contains the seal specific tail information
type StdinOpener ¶ added in v0.0.4
type StdinOpener struct {
// contains filtered or unexported fields
}
func (*StdinOpener) Open ¶ added in v0.0.4
func (o *StdinOpener) Open(string) (io.ReadCloser, error)
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 TenantActivity ¶ added in v0.0.6
type TenantActivity struct {
// Massif is the massif index of the most recently appended massif
Massif int `json:"massifindex"`
// Tenant is the tenant identity of the most recently changed log
Tenant string `json:"tenant"`
// IDCommitted is the idtimestamp for the most recent entry observed in the log
IDCommitted string `json:"idcommitted"`
// IDConfirmed is the idtimestamp for the most recent entry to be sealed.
IDConfirmed string `json:"idconfirmed"`
LastModified string `json:"lastmodified"`
// MassifURL is the remote path to the most recently changed massif
MassifURL string `json:"massif"`
// SealURL is the remote path to the most recently changed seal
SealURL string `json:"seal"`
}
TenantActivity represents the per tenant output of the watch command
type TenantMassif ¶ added in v0.1.0
type TenantMassif struct {
// Massif is the massif index of the most recently appended massif
Massif int `json:"massifindex"`
// Tenant is the tenant identity of the most recently changed log
Tenant string `json:"tenant"`
}
TenantMassif identifies a combination of tenant and massif Typically it is used to convey that the massif is the most recently changed for that tenant. Note: it is a strict subset of the fields in TenantActivity, maintained seperately due to json marshalling
func TenantMassifsFromData ¶ added in v0.1.0
func TenantMassifsFromData(data []byte) ([]TenantMassif, error)
type VerifiedContextReader ¶ added in v0.1.0
type VerifiedContextReader interface {
massifs.VerifiedContextReader
}
type VerifiedReplica ¶ added in v0.1.0
type VerifiedReplica struct {
// contains filtered or unexported fields
}
func NewVerifiedReplica ¶ added in v0.1.0
func NewVerifiedReplica( cCtx *cli.Context, cmd *CmdCtx, ) (*VerifiedReplica, error)
func (*VerifiedReplica) ReplicateVerifiedUpdates ¶ added in v0.1.0
func (v *VerifiedReplica) ReplicateVerifiedUpdates( ctx context.Context, tenantIdentity string, startMassif, endMassif uint32) error
ReplicateVerifiedUpdates confirms that any additions to the remote log are consistent with the local replica Only the most recent local massif and seal need be retained for verification purposes. If independent, off line, verification of inclusion is desired, retain as much of the log as is interesting.
type WatchConfig ¶ added in v0.0.6
type WatchConfig struct {
watcher.WatchConfig
WatchTenants map[string]bool
WatchCount int
ReaderURL string
Latest bool
}
func NewWatchConfig ¶
func NewWatchConfig(cCtx cliContext, cmd *CmdCtx) (WatchConfig, error)
NewWatchConfig derives a configuration from the options set on the command line context
type Watcher ¶ added in v0.0.6
func (*Watcher) FirstFilter ¶ added in v0.2.1
FirstFilter accounts for the --latest flag but otherwise falls through to the base implementation
func (*Watcher) NextFilter ¶ added in v0.2.1
NextFilter accounts for the --latest flag but otherwise falls through to the base implementation
Source Files
¶
- app.go
- cfgbugs.go
- cfglogging.go
- cfgmassif.go
- cfgreader.go
- cfgrootreader.go
- cfgtenants.go
- cmdctx.go
- const.go
- diag.go
- ediag.go
- findmmrentries.go
- findtrieentries.go
- jsonidtimestamp.go
- jsonprincipals.go
- localreader.go
- localwriter.go
- logtail.go
- massifs.go
- node.go
- nodescan.go
- progress.go
- prove.go
- readtenantactivity.go
- receipt.go
- replicatelogs.go
- sealerpubkey.go
- timestamp.go
- v3hash.go
- v3toeventresponse.go
- verifyincluded.go
- watch.go