fake

package
v0.0.0-...-9be813a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package fake holds fake implementations of various services for tests.

Index

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) List

func (a *DomainStorage) List(ctx context.Context, deleted bool) ([]*domain.Domain, error)

List returns a list of active domains

func (*DomainStorage) Read

func (a *DomainStorage) Read(ctx context.Context, ID string, showDeleted bool) (*domain.Domain, error)

Read returns existing domains.

func (*DomainStorage) SetDelete

func (a *DomainStorage) SetDelete(ctx context.Context, ID string, isDeleted bool) error

SetDelete deletes or undeletes a domain.

func (*DomainStorage) Write

func (a *DomainStorage) Write(ctx context.Context, d *domain.Domain) error

Write adds a new domain.

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.

func (*KeySets) Get

func (k *KeySets) Get(ctx context.Context, instance int64, domainID, appID string) (*tpb.KeySet, error)

Get returns the requested keyset.

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

GetConsistencyProof returns an empty proof.

func (*LogServer) GetEntryAndProof

GetEntryAndProof is not implemented.

func (*LogServer) GetInclusionProof

GetInclusionProof returns an empty proof.

func (*LogServer) GetInclusionProofByHash

GetInclusionProofByHash is not implemented.

func (*LogServer) GetLatestSignedLogRoot

GetLatestSignedLogRoot returns the current tree size.

func (*LogServer) GetLeavesByHash

GetLeavesByHash is not implemented.

func (*LogServer) GetLeavesByIndex

GetLeavesByIndex is not implemented.

func (*LogServer) GetSequencedLeafCount

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

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

GetLeaves just returns the indexes requested. No leaf data, no inclusion proofs.

func (*MapServer) GetLeavesByRevision

GetLeavesByRevision just returns the indexes requested. No leaf data, no inclusion proofs.

func (*MapServer) GetSignedMapRoot

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

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL