Versions in this module Expand all Collapse all v0 v0.1.0 Jan 22, 2025 Changes in this version + const SignatureTypeEd25519 + const SignatureTypeSr25519 + var ErrWorkloadNotFound = fmt.Errorf("workload not found") + func IsSharable(typ WorkloadType) bool + func IsValidName(n Name) error + func MustMarshal(data WorkloadData) json.RawMessage + func RegisterSharableType(t WorkloadType, d WorkloadData) + func RegisterType(t WorkloadType, d WorkloadData) + type Capacity struct + CRU uint64 + HRU Unit + IPV4U uint64 + MRU Unit + SRU Unit + func (c *Capacity) Add(o *Capacity) + func (c *Capacity) Zero() bool + type Deployment struct + ContractID uint64 + Description string + Expiration Timestamp + Metadata string + SignatureRequirement SignatureRequirement + TwinID uint32 + Version uint32 + Workloads []Workload + func (d *Deployment) ByType(typ ...WorkloadType) []*WorkloadWithID + func (d *Deployment) Challenge(w io.Writer) error + func (d *Deployment) ChallengeHash() ([]byte, error) + func (d *Deployment) Get(name Name) (*WorkloadWithID, error) + func (d *Deployment) GetShareables() []*WorkloadWithID + func (d *Deployment) GetType(name Name, typ WorkloadType) (*WorkloadWithID, error) + func (d *Deployment) IsActive() bool + func (d *Deployment) SetError(err error) + func (d *Deployment) Sign(twin uint32, sk Signer) error + func (d *Deployment) Upgrade(n *Deployment) ([]UpgradeOp, error) + func (d *Deployment) Valid() error + func (d *Deployment) Verify(getter KeyGetter) error + type DeploymentID string + func (i DeploymentID) Parts() (twin, deployment uint32, err error) + func (i DeploymentID) ToPath() string + type Ed25519VerifyingKey []byte + func (k Ed25519VerifyingKey) Verify(msg []byte, sig []byte) bool + type IPNet struct + func MustParseIPNet(txt string) IPNet + func NewIPNet(n net.IPNet) IPNet + func ParseIPNet(txt string) (r IPNet, err error) + func (i *IPNet) Nil() bool + func (i *IPNet) UnmarshalText(text []byte) error + func (i IPNet) MarshalJSON() ([]byte, error) + func (i IPNet) MarshalText() ([]byte, error) + func (i IPNet) String() string + type JobOperation int + const OpAdd + const OpRemove + const OpUpdate + func (o JobOperation) String() string + type KeyGetter interface + GetKey func(twin uint32) ([]byte, error) + type Name string + func (n Name) IsEmpty() bool + func (n Name) String() string + type Result struct + Created Timestamp + Data json.RawMessage + Error string + State ResultState + func (r *Result) Bytes() ([]byte, error) + func (r *Result) IsNil() bool + func (r *Result) Unmarshal(v interface{}) error + func (r *Result) Valid() error + type ResultState string + const StateDeleted + const StateError + const StateInit + const StateOk + const StatePaused + const StateUnChanged + func (s ResultState) IsAny(state ...ResultState) bool + func (s ResultState) IsOkay() bool + type Signature struct + Signature string + SignatureType string + TwinID uint32 + type SignatureRequest struct + Required bool + TwinID uint32 + Weight uint + func (r *SignatureRequest) Challenge(w io.Writer) error + type SignatureRequirement struct + Requests []SignatureRequest + SignatureStyle SignatureStyle + Signatures []Signature + WeightRequired uint + func (r *SignatureRequirement) Challenge(w io.Writer) error + type SignatureStyle string + const SignatureStyleDefault + const SignatureStylePolka + type Signer interface + Sign func(msg []byte) ([]byte, error) + Type func() string + type Sr25519VerifyingKey []byte + func (k Sr25519VerifyingKey) Verify(msg []byte, sig []byte) bool + type Timestamp int64 + func Now() Timestamp + func (t *Timestamp) Time() time.Time + func (t *Timestamp) UnmarshalJSON(data []byte) error + type Unit uint64 + const Gigabyte + const Kilobyte + const Megabyte + const Terabyte + func Max(u, v Unit) Unit + func Min(u, v Unit) Unit + type UpgradeOp struct + Op JobOperation + WlID *WorkloadWithID + type Verifier interface + Verify func(msg []byte, sig []byte) bool + type Workload struct + Data json.RawMessage + Description string + Metadata string + Name Name + Result Result + Type WorkloadType + Version uint32 + func (w *Workload) Capacity() (Capacity, error) + func (w *Workload) Challenge(i io.Writer) error + func (w *Workload) IsResult(state ResultState) bool + func (w *Workload) Valid(getter WorkloadGetter) error + func (w *Workload) WorkloadData() (WorkloadData, error) + func (w Workload) WithResults(result Result) Workload + type WorkloadData interface + Capacity func() (Capacity, error) + Challenge func(io.Writer) error + Valid func(getter WorkloadGetter) error + type WorkloadGetter interface + ByType func(typ ...WorkloadType) []*WorkloadWithID + Get func(name Name) (*WorkloadWithID, error) + type WorkloadID string + func NewUncheckedWorkloadID(twin uint32, deployment uint64, name Name) WorkloadID + func NewWorkloadID(twin uint32, deployment uint64, name Name) (WorkloadID, error) + func (i WorkloadID) Parts() (twin uint32, deployment uint64, name Name, err error) + func (i WorkloadID) String() string + func (i WorkloadID) ToPath() string + func (i WorkloadID) Unique(n string) string + type WorkloadType string + func Types() []WorkloadType + func (t WorkloadType) String() string + func (t WorkloadType) Valid() error + type WorkloadWithID struct + ID WorkloadID