Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewResolverServer ¶
func NewResolverServer(resolver Resolver[object.Namespace]) tag_pb.ResolverServer
NewResolverServer creates a gRPC server that is capable of resolving tags to an object.
func NewUpdaterServer ¶
NewUpdaterServer creates a gRPC server that is capable of creating or updating existing tags contained in the tag store.
Types ¶
type Key ¶
Key of tags stored in Tag Store.
Keys contain a hash. The method for computing the hash is specific to the use case. Even though the protocol does not place restrictions on the size of the hash, this implementation only supports hashes that are 256 bits in size (e.g., SHA-256).
In order to prevent collisions between different use cases, keys also contain an signature public key. The value of the tag needs to be signed using the corresponding private key. This permits consumers of tags to verify the tag's value. Even though the protocol does not place restrictions on which algorithm is used, this implementation requires keys to be of type Ed25519.
func NewKeyFromProto ¶
NewKeyFromProto creates a tag key based on its equivalent Protobuf message.
func (Key) VerifySignature ¶
func (k Key) VerifySignature(value Value, signature *[ed25519.SignatureSize]byte) (SignedValue, error)
VerifySignature verifies that a signature corresponds to a given tag key and value. Upon success, it upgrades the provided value to a signed value.
type Resolver ¶
type Resolver[TNamespace any] interface { ResolveTag(ctx context.Context, namespace TNamespace, key Key, minimumTimestamp *time.Time) (value SignedValue, complete bool, err error) }
Resolver of tags.
type ResolverForTesting ¶
ResolverForTesting is an instantiated version of Resolver, which may be used to generate mocks for tests.
type SignedValue ¶
type SignedValue struct {
Value Value
Signature [ed25519.SignatureSize]byte
}
SignedValue contains the value of a tag and its signature. Instances of SignedValue should only be created in contexts where the signature of the tag has been validated.
func NewSignedValueFromProto ¶
func NewSignedValueFromProto(m *tag_pb.SignedValue, referenceFormat object.ReferenceFormat, key Key) (SignedValue, error)
NewSignedValueFromProto creates a signed value from a Protobuf message. It also validates the value's signature.
func ResolveCompleteTag ¶
func ResolveCompleteTag[TNamespace any]( ctx context.Context, resolver Resolver[TNamespace], namespace TNamespace, key Key, minimumTimestamp *time.Time, ) (SignedValue, error)
ResolveCompleteTag resolves a tag, and only returns the tag's value if the graph it references is complete.
func (*SignedValue) Equal ¶
func (sv *SignedValue) Equal(other SignedValue) bool
Equal returns whether two signed tag values are equal, namely if they refer to the same object, were created at the same time, and have the same signature.
func (*SignedValue) ToProto ¶
func (sv *SignedValue) ToProto() *tag_pb.SignedValue
ToProto converts the signed value from the native type to a Protobuf message.
type Store ¶
type Store[TNamespace any, TLease any] interface { Resolver[TNamespace] Updater[TNamespace, TLease] }
Store for tags, which is both accessible for reading (resolving) and writing (updating).
type Updater ¶
type Updater[TNamespace any, TLease any] interface { UpdateTag(ctx context.Context, namespace TNamespace, key Key, value SignedValue, lease TLease) error }
Updater of tags in storage. Tags can be used to assign a stable identifier to an object.
type UpdaterForTesting ¶
UpdaterForTesting is an instantiated version of Updater, which may be used for generating mocks to be used by tests.
type Value ¶
type Value struct {
Reference object.LocalReference
Timestamp time.Time
}
Value of a tag. Tags can refer to a single root object, and they also keep track of a timestamp at which the tag's value was created. The timestamp is used to support overwriting tags reliably, as it may be used to determine which value is the newest.
func NewValueFromProto ¶
NewValueFromProto converts the value of a tag stored in a Protobuf message to a native type.
func (*Value) Equal ¶
Equal returns whether two tag values are equal, namely if they refer to the same object and were created at the same point in time.
func (*Value) Sign ¶
func (v *Value) Sign(privateKey ed25519.PrivateKey, keyHash [sha256.Size]byte) (SignedValue, error)
Sign the value of a tag. This allows consumers to validate that the value actually corresponds to a given key.