Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TypeMap sync.Map
TypeMap stores mapping between type strings and entry constructors entries are written once at process initialization and read for each transaction, so we use sync.Map which is optimized for this case
Functions ¶
func DecodeEntry ¶ added in v0.2.0
func DecodeEntry(input, output interface{}) error
DecodeEntry maps the (abstract) input structure into the specific entry implementation class; while doing so, it detects the case where we need to convert from string to []byte and does the base64 decoding required to make that happen
Types ¶
type EntryFactory ¶ added in v0.2.0
type EntryFactory func() EntryImpl
EntryFactory describes a factory function that can generate structs for a specific versioned type
type EntryImpl ¶
type EntryImpl interface {
APIVersion() string // the supported versions for this implementation
IndexKeys() []string // the keys that should be added to the external index for this entry
Canonicalize(ctx context.Context) ([]byte, error) // generate the canonical entry to be put into the tlog
FetchExternalEntities(ctx context.Context) error // gather all external content required to process the entry
HasExternalEntities() bool // indicates whether there is a need fetch any additional external content required to process the entry
Unmarshal(e models.ProposedEntry) error // unmarshal the abstract entry into the specific struct for this versioned type
Validate() error // performs any cross-field validation that is not expressed in the OpenAPI spec
Attestation() (string, []byte)
}
EntryImpl specifies the behavior of a versioned type
type RekorType ¶ added in v0.2.0
type RekorType struct {
Kind string // this is the unique string that identifies the type
VersionMap VersionEntryFactoryMap // this maps the supported versions to implementation
}
RekorType is the base struct that is embedded in all type implementations
func (*RekorType) VersionedUnmarshal ¶ added in v0.2.0
VersionedUnmarshal extracts the correct implementing factory function from the type's version map, creates an entry of that versioned type and then calls that versioned type's unmarshal method
type SemVerEntryFactoryMap ¶ added in v0.2.0
SemVerEntryFactoryMap implements a map that allows implementations to specify their supported versions using semver-compliant strings
func (*SemVerEntryFactoryMap) Count ¶ added in v0.2.0
func (s *SemVerEntryFactoryMap) Count() int
func (*SemVerEntryFactoryMap) GetEntryFactory ¶ added in v0.2.0
func (s *SemVerEntryFactoryMap) GetEntryFactory(version string) (EntryFactory, error)
func (*SemVerEntryFactoryMap) SetEntryFactory ¶ added in v0.2.0
func (s *SemVerEntryFactoryMap) SetEntryFactory(constraint string, ef EntryFactory) error
type TypeImpl ¶
type TypeImpl interface {
UnmarshalEntry(pe models.ProposedEntry) (EntryImpl, error)
}
TypeImpl is implemented by all types to support the polymorphic conversion of abstract proposed entry to a working implementation for the versioned type requested, if supported
type VersionEntryFactoryMap ¶ added in v0.2.0
type VersionEntryFactoryMap interface {
GetEntryFactory(string) (EntryFactory, error) // return the entry factory for the specified version
SetEntryFactory(string, EntryFactory) error // set the entry factory for the specified version
Count() int // return the count of entry factories currently in the map
}
VersionEntryFactoryMap defines a map-like interface to find the correct implementation for a version string This could be a simple map[string]EntryFactory, or something more elegant (e.g. semver)
func NewSemVerEntryFactoryMap ¶ added in v0.2.0
func NewSemVerEntryFactoryMap() VersionEntryFactoryMap