-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmdctx.go
55 lines (47 loc) · 1.61 KB
/
cmdctx.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package veracity
import (
"context"
"github.com/datatrails/go-datatrails-common/cbor"
"github.com/datatrails/go-datatrails-common/logger"
"github.com/datatrails/go-datatrails-merklelog/massifs"
)
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)
GetMassif(
ctx context.Context, tenantIdentity string, massifIndex uint64, opts ...massifs.ReaderOption,
) (massifs.MassifContext, error)
}
// CmdCtx holds shared config and config derived state for all commands
type CmdCtx struct {
log logger.Logger
// storer *azblob.Storer
//reader azblob.Reader
massifReader MassifReader
readerURL string
cborCodec cbor.CBORCodec
rootReader massifs.SignedRootReader
massif massifs.MassifContext
massifHeight uint8
bugs map[string]bool
}
// Clone returns a copy of the CmdCtx with only those members that are safe to share copied.
// Those are:
// - log - the result of cfgLogging
//
// All other members need to be initialzed by the caller if they are required in
// a specific go routine context.
func (c *CmdCtx) Clone() *CmdCtx {
return &CmdCtx{log: c.log}
}