Documentation
¶
Overview ¶
Package fake holds fake implementations of various services for tests.
Index ¶
- func NewFakeTrillianLogVerifier() client.LogVerifier
- func NewFakeVerifyingLogClient() client.VerifyingLogClient
- type DomainStorage
- func (a *DomainStorage) List(ctx context.Context, deleted bool) ([]*domain.Domain, error)
- func (a *DomainStorage) Read(ctx context.Context, ID string, showDeleted bool) (*domain.Domain, error)
- func (a *DomainStorage) SetDelete(ctx context.Context, ID string, isDeleted bool) error
- func (a *DomainStorage) Write(ctx context.Context, d *domain.Domain) error
- type KeySets
- type LogServer
- func (l *LogServer) GetConsistencyProof(ctx context.Context, in *tpb.GetConsistencyProofRequest, ...) (*tpb.GetConsistencyProofResponse, error)
- func (l *LogServer) GetEntryAndProof(ctx context.Context, in *tpb.GetEntryAndProofRequest, opts ...grpc.CallOption) (*tpb.GetEntryAndProofResponse, error)
- func (l *LogServer) GetInclusionProof(ctx context.Context, in *tpb.GetInclusionProofRequest, opts ...grpc.CallOption) (*tpb.GetInclusionProofResponse, error)
- func (l *LogServer) GetInclusionProofByHash(ctx context.Context, in *tpb.GetInclusionProofByHashRequest, ...) (*tpb.GetInclusionProofByHashResponse, error)
- func (l *LogServer) GetLatestSignedLogRoot(ctx context.Context, in *tpb.GetLatestSignedLogRootRequest, ...) (*tpb.GetLatestSignedLogRootResponse, error)
- func (l *LogServer) GetLeavesByHash(ctx context.Context, in *tpb.GetLeavesByHashRequest, opts ...grpc.CallOption) (*tpb.GetLeavesByHashResponse, error)
- func (l *LogServer) GetLeavesByIndex(ctx context.Context, in *tpb.GetLeavesByIndexRequest, opts ...grpc.CallOption) (*tpb.GetLeavesByIndexResponse, error)
- func (l *LogServer) GetSequencedLeafCount(ctx context.Context, in *tpb.GetSequencedLeafCountRequest, ...) (*tpb.GetSequencedLeafCountResponse, error)
- func (l *LogServer) QueueLeaf(ctx context.Context, in *tpb.QueueLeafRequest, opts ...grpc.CallOption) (*tpb.QueueLeafResponse, error)
- func (l *LogServer) QueueLeaves(ctx context.Context, in *tpb.QueueLeavesRequest, opts ...grpc.CallOption) (*tpb.QueueLeavesResponse, error)
- type MapServer
- func (m *MapServer) GetLeaves(ctx context.Context, in *tpb.GetMapLeavesRequest, opts ...grpc.CallOption) (*tpb.GetMapLeavesResponse, error)
- func (m *MapServer) GetLeavesByRevision(ctx context.Context, in *tpb.GetMapLeavesByRevisionRequest, ...) (*tpb.GetMapLeavesResponse, error)
- func (m *MapServer) GetSignedMapRoot(ctx context.Context, in *tpb.GetSignedMapRootRequest, opts ...grpc.CallOption) (*tpb.GetSignedMapRootResponse, error)
- func (m *MapServer) GetSignedMapRootByRevision(ctx context.Context, in *tpb.GetSignedMapRootByRevisionRequest, ...) (*tpb.GetSignedMapRootResponse, error)
- func (m *MapServer) SetLeaves(ctx context.Context, in *tpb.SetMapLeavesRequest, opts ...grpc.CallOption) (*tpb.SetMapLeavesResponse, error)
- type MonitorStorage
- type MutationStorage
- func (m *MutationStorage) ReadBatch(context.Context, int64, int64, int32) (int64, []*mutator.QueueMessage, error)
- func (m *MutationStorage) ReadPage(_ context.Context, mapID, start, end int64, pageSize int32) (int64, []*pb.Entry, error)
- func (m *MutationStorage) Write(_ context.Context, mapID int64, mutation *pb.EntryUpdate) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFakeTrillianLogVerifier ¶
func NewFakeTrillianLogVerifier() client.LogVerifier
NewFakeTrillianLogVerifier returns a verifier that passes all checks.
func NewFakeVerifyingLogClient ¶
func NewFakeVerifyingLogClient() client.VerifyingLogClient
NewFakeVerifyingLogClient returns a client that mimicks a trillian log.
Types ¶
type DomainStorage ¶
type DomainStorage struct {
// contains filtered or unexported fields
}
DomainStorage implements domain.Storage
func NewDomainStorage ¶
func NewDomainStorage() *DomainStorage
NewDomainStorage returns a fake dominstorage.Storage
func (*DomainStorage) Read ¶
func (a *DomainStorage) Read(ctx context.Context, ID string, showDeleted bool) (*domain.Domain, error)
Read returns existing domains.
type KeySets ¶
type KeySets struct {
// contains filtered or unexported fields
}
KeySets implements storage.UserManagerTable in memory.
func NewKeySets ¶
func NewKeySets() *KeySets
NewKeySets produces a fake implementation of storage.UserManagerTable.
type LogServer ¶
type LogServer struct {
// contains filtered or unexported fields
}
LogServer only stores tree size.
func NewTrillianLogClient ¶
func NewTrillianLogClient() *LogServer
NewTrillianLogClient returns a fake trillian log client.
func (*LogServer) GetConsistencyProof ¶
func (l *LogServer) GetConsistencyProof(ctx context.Context, in *tpb.GetConsistencyProofRequest, opts ...grpc.CallOption) (*tpb.GetConsistencyProofResponse, error)
GetConsistencyProof returns an empty proof.
func (*LogServer) GetEntryAndProof ¶
func (l *LogServer) GetEntryAndProof(ctx context.Context, in *tpb.GetEntryAndProofRequest, opts ...grpc.CallOption) (*tpb.GetEntryAndProofResponse, error)
GetEntryAndProof is not implemented.
func (*LogServer) GetInclusionProof ¶
func (l *LogServer) GetInclusionProof(ctx context.Context, in *tpb.GetInclusionProofRequest, opts ...grpc.CallOption) (*tpb.GetInclusionProofResponse, error)
GetInclusionProof returns an empty proof.
func (*LogServer) GetInclusionProofByHash ¶
func (l *LogServer) GetInclusionProofByHash(ctx context.Context, in *tpb.GetInclusionProofByHashRequest, opts ...grpc.CallOption) (*tpb.GetInclusionProofByHashResponse, error)
GetInclusionProofByHash is not implemented.
func (*LogServer) GetLatestSignedLogRoot ¶
func (l *LogServer) GetLatestSignedLogRoot(ctx context.Context, in *tpb.GetLatestSignedLogRootRequest, opts ...grpc.CallOption) (*tpb.GetLatestSignedLogRootResponse, error)
GetLatestSignedLogRoot returns the current tree size.
func (*LogServer) GetLeavesByHash ¶
func (l *LogServer) GetLeavesByHash(ctx context.Context, in *tpb.GetLeavesByHashRequest, opts ...grpc.CallOption) (*tpb.GetLeavesByHashResponse, error)
GetLeavesByHash is not implemented.
func (*LogServer) GetLeavesByIndex ¶
func (l *LogServer) GetLeavesByIndex(ctx context.Context, in *tpb.GetLeavesByIndexRequest, opts ...grpc.CallOption) (*tpb.GetLeavesByIndexResponse, error)
GetLeavesByIndex is not implemented.
func (*LogServer) GetSequencedLeafCount ¶
func (l *LogServer) GetSequencedLeafCount(ctx context.Context, in *tpb.GetSequencedLeafCountRequest, opts ...grpc.CallOption) (*tpb.GetSequencedLeafCountResponse, error)
GetSequencedLeafCount is not implemented.
func (*LogServer) QueueLeaf ¶
func (l *LogServer) QueueLeaf(ctx context.Context, in *tpb.QueueLeafRequest, opts ...grpc.CallOption) (*tpb.QueueLeafResponse, error)
QueueLeaf increments the size of the tree.
func (*LogServer) QueueLeaves ¶
func (l *LogServer) QueueLeaves(ctx context.Context, in *tpb.QueueLeavesRequest, opts ...grpc.CallOption) (*tpb.QueueLeavesResponse, error)
QueueLeaves is not implemented.
type MapServer ¶
type MapServer struct {
// contains filtered or unexported fields
}
MapServer only stores tpb.MapperMetadata in roots. It does not store leaves compute inclusion proofs, or sign roots. This client is not threadsafe.
func NewTrillianMapClient ¶
func NewTrillianMapClient() *MapServer
NewTrillianMapClient returns a fake tpb.TrillianMapClient
func (*MapServer) GetLeaves ¶
func (m *MapServer) GetLeaves(ctx context.Context, in *tpb.GetMapLeavesRequest, opts ...grpc.CallOption) (*tpb.GetMapLeavesResponse, error)
GetLeaves just returns the indexes requested. No leaf data, no inclusion proofs.
func (*MapServer) GetLeavesByRevision ¶
func (m *MapServer) GetLeavesByRevision(ctx context.Context, in *tpb.GetMapLeavesByRevisionRequest, opts ...grpc.CallOption) (*tpb.GetMapLeavesResponse, error)
GetLeavesByRevision just returns the indexes requested. No leaf data, no inclusion proofs.
func (*MapServer) GetSignedMapRoot ¶
func (m *MapServer) GetSignedMapRoot(ctx context.Context, in *tpb.GetSignedMapRootRequest, opts ...grpc.CallOption) (*tpb.GetSignedMapRootResponse, error)
GetSignedMapRoot returns the current map root.
func (*MapServer) GetSignedMapRootByRevision ¶
func (m *MapServer) GetSignedMapRootByRevision(ctx context.Context, in *tpb.GetSignedMapRootByRevisionRequest, opts ...grpc.CallOption) (*tpb.GetSignedMapRootResponse, error)
GetSignedMapRootByRevision returns the saved map root.
func (*MapServer) SetLeaves ¶
func (m *MapServer) SetLeaves(ctx context.Context, in *tpb.SetMapLeavesRequest, opts ...grpc.CallOption) (*tpb.SetMapLeavesResponse, error)
SetLeaves is not thread safe. It will store the root metadata.
type MonitorStorage ¶
type MonitorStorage struct {
// contains filtered or unexported fields
}
MonitorStorage is an in-memory store for the monitoring results.
func NewMonitorStorage ¶
func NewMonitorStorage() *MonitorStorage
NewMonitorStorage returns an in-memory implementation of monitorstorage.Interface.
func (*MonitorStorage) Get ¶
func (s *MonitorStorage) Get(epoch int64) (*monitorstorage.Result, error)
Get returns the Result for the given epoch. It returns ErrNotFound if the epoch does not exist.
func (*MonitorStorage) LatestEpoch ¶
func (s *MonitorStorage) LatestEpoch() int64
LatestEpoch is a convenience method to retrieve the latest stored epoch.
func (*MonitorStorage) Set ¶
func (s *MonitorStorage) Set(epoch int64, r *monitorstorage.Result) error
Set stores the given data as a MonitoringResult which can be retrieved by Get.
type MutationStorage ¶
type MutationStorage struct {
// contains filtered or unexported fields
}
MutationStorage implements mutator.Mutation
func NewMutationStorage ¶
func NewMutationStorage() *MutationStorage
NewMutationStorage returns a fake mutator.Mutation
func (*MutationStorage) ReadBatch ¶
func (m *MutationStorage) ReadBatch(context.Context, int64, int64, int32) (int64, []*mutator.QueueMessage, error)
ReadBatch is unimplemented
func (*MutationStorage) ReadPage ¶
func (m *MutationStorage) ReadPage(_ context.Context, mapID, start, end int64, pageSize int32) (int64, []*pb.Entry, error)
ReadPage paginates through the list of mutations
func (*MutationStorage) Write ¶
func (m *MutationStorage) Write(_ context.Context, mapID int64, mutation *pb.EntryUpdate) (int64, error)
Write stores a mutation