storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MalleableTestDB

type MalleableTestDB struct {
	AddCertFunc      func(int64, *SubmittedCert) error
	GetUnseenFunc    func(int64) ([]SubmittedCert, error)
	GetRandSeenFunc  func(logID int64) (*SubmittedCert, error)
	MarkCertSeenFunc func(int, time.Time) error
	GetIndexFunc     func(int64) (int64, error)
	UpdateIndexFunc  func(int64, int64) error
}

MalleableTestDB is a mock database client used for testing. It is exported so it can be used in other packages when we don't want to use an actual database for tests.

func (*MalleableTestDB) AddCert

func (s *MalleableTestDB) AddCert(logID int64, cert *SubmittedCert) error

func (*MalleableTestDB) GetIndex

func (s *MalleableTestDB) GetIndex(logID int64) (int64, error)

func (*MalleableTestDB) GetRandSeen

func (s *MalleableTestDB) GetRandSeen(logID int64) (*SubmittedCert, error)

func (*MalleableTestDB) GetUnseen

func (s *MalleableTestDB) GetUnseen(logID int64) ([]SubmittedCert, error)

func (*MalleableTestDB) MarkCertSeen

func (s *MalleableTestDB) MarkCertSeen(id int, seen time.Time) error

func (*MalleableTestDB) UpdateIndex

func (s *MalleableTestDB) UpdateIndex(logID int64, index int64) error

type Storage

type Storage interface {
	AddCert(logID int64, cert *SubmittedCert) error
	GetUnseen(logID int64) ([]SubmittedCert, error)
	GetRandSeen(logID int64) (*SubmittedCert, error)
	MarkCertSeen(id int, seen time.Time) error
	GetIndex(logID int64) (int64, error)
	UpdateIndex(logID int64, index int64) error
}

Storage provides methods for interacting with a database

func New

func New(uri string) (Storage, error)

New initializes a impl struct

type SubmittedCert

type SubmittedCert struct {
	ID        int
	Cert      []byte
	SCT       []byte
	Timestamp uint64
}

SubmittedCert is a convience struct used to hold information relating to a submitted certificate

Jump to

Keyboard shortcuts

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