v1

package
v0.0.2-rc7 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	AttributeNameRegexpStringWildcard = `^([a-zA-Z][\w\/\.\-]{1,126}[\w\*]?)$`
	AttributeNameRegexpString         = `^([a-zA-Z][\w\/\.\-]{1,126})$`
)

Variables

View Source
var (
	ErrAttributesDuplicateKeys = cerrors.Register(moduleName, errAttributesDuplicateKeys, "attributes cannot have duplicate keys")
	ErrInvalidAttributeKey     = cerrors.Register(moduleName, errInvalidAttributeKey, "attribute key does not match regexp")
)
View Source
var (
	ErrInvalidLengthAttribute        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAttribute          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAttribute = fmt.Errorf("proto: unexpected end of group")
)

Functions

func AttributesAnyOf

func AttributesAnyOf(a, b Attributes) bool

func AttributesSubsetOf

func AttributesSubsetOf(a, b Attributes) bool

AttributesSubsetOf check if a is subset of b nolint: gofmt For example there are two yaml files being converted into these attributes example 1: a is subset of b --- // a attributes:

region:
  - us-east-1

--- b attributes:

region:
  - us-east-1
  - us-east-2

example 2: a is not subset of b attributes:

region:
  - us-east-1

--- b attributes:

region:
  - us-east-2
  - us-east-3

example 3: a is subset of b attributes:

region:
  - us-east-2
  - us-east-3

--- b attributes:

region:
  - us-east-2

Types

type Attribute

type Attribute struct {
	// Key of the attribute (e.g., "region", "cpu_architecture", etc.).
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty" yaml:"key"`
	// Value of the attribute (e.g., "us-west", "x86_64", etc.).
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty" yaml:"value"`
}

Attribute represents an arbitrary attribute key-value pair.

func NewStringAttribute

func NewStringAttribute(key, val string) Attribute

func (*Attribute) Descriptor

func (*Attribute) Descriptor() ([]byte, []int)

func (*Attribute) Equal

func (m *Attribute) Equal(rhs *Attribute) bool

func (*Attribute) Marshal

func (m *Attribute) Marshal() (dAtA []byte, err error)

func (*Attribute) MarshalTo

func (m *Attribute) MarshalTo(dAtA []byte) (int, error)

func (*Attribute) MarshalToSizedBuffer

func (m *Attribute) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Attribute) ProtoMessage

func (*Attribute) ProtoMessage()

func (*Attribute) Reset

func (m *Attribute) Reset()

func (*Attribute) Size

func (m *Attribute) Size() (n int)

func (*Attribute) String

func (m *Attribute) String() string

func (Attribute) SubsetOf

func (m Attribute) SubsetOf(rhs Attribute) bool

func (*Attribute) Unmarshal

func (m *Attribute) Unmarshal(dAtA []byte) error

func (*Attribute) XXX_DiscardUnknown

func (m *Attribute) XXX_DiscardUnknown()

func (*Attribute) XXX_Marshal

func (m *Attribute) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Attribute) XXX_Merge

func (m *Attribute) XXX_Merge(src proto.Message)

func (*Attribute) XXX_Size

func (m *Attribute) XXX_Size() int

func (*Attribute) XXX_Unmarshal

func (m *Attribute) XXX_Unmarshal(b []byte) error

type AttributeValue

type AttributeValue interface {
	AsBool() (bool, bool)
	AsString() (string, bool)
}

type Attributes

type Attributes []Attribute

Attributes purpose of using this type in favor of Cosmos's sdk.Attribute is ability to later extend it with operators to support querying on things like cpu/memory/storage attributes At this moment type though is same as sdk.Attributes but all akash libraries were turned to use a new one

func (Attributes) AnyIN

func (attr Attributes) AnyIN(group AttributesGroup) bool

func (Attributes) AnyOf

func (attr Attributes) AnyOf(b Attributes) bool

func (Attributes) Dup

func (attr Attributes) Dup() Attributes

func (Attributes) Find

func (attr Attributes) Find(glob string) AttributeValue

func (Attributes) GetCapabilitiesGroup

func (attr Attributes) GetCapabilitiesGroup(prefix string) AttributesGroup

GetCapabilitiesGroup

example capabilities/storage/1/persistent: true capabilities/storage/1/class: io1 capabilities/storage/2/persistent: false

nolint: gofmt returns

  • - persistent: true class: nvme
  • - persistent: false

func (Attributes) GetCapabilitiesMap

func (attr Attributes) GetCapabilitiesMap(prefix string) AttributesGroup

func (Attributes) IN

func (attr Attributes) IN(group AttributesGroup) bool

IN check if given attributes are in attributes group AttributesGroup for storage

  • persistent: true class: beta1
  • persistent: true class: beta2

that

  • persistent: true class: beta1

func (Attributes) Iterate

func (attr Attributes) Iterate(prefix string, fn func(group, key, value string))

func (Attributes) Len

func (attr Attributes) Len() int

func (Attributes) Less

func (attr Attributes) Less(i, j int) bool

func (Attributes) SubsetOf

func (attr Attributes) SubsetOf(b Attributes) bool

func (Attributes) Swap

func (attr Attributes) Swap(i, j int)

func (Attributes) Validate

func (attr Attributes) Validate() error

func (Attributes) ValidateWithRegex

func (attr Attributes) ValidateWithRegex(r *regexp.Regexp) error

type AttributesGroup

type AttributesGroup []Attributes

type PlacementRequirements

type PlacementRequirements struct {
	// SignedBy holds the list of keys that tenants expect to have signatures from.
	SignedBy SignedBy `protobuf:"bytes,1,opt,name=signed_by,json=signedBy,proto3" json:"signed_by" yaml:"signed_by"`
	// Attribute holds the list of attributes tenant expects from the provider.
	Attributes Attributes `protobuf:"bytes,2,rep,name=attributes,proto3,castrepeated=Attributes" json:"attributes" yaml:"attributes"`
}

PlacementRequirements represents the requirements for a provider placement on the network. It is used to specify the characteristics and constraints of a provider that can be used to satisfy a deployment request.

func (*PlacementRequirements) Descriptor

func (*PlacementRequirements) Descriptor() ([]byte, []int)

func (PlacementRequirements) Dup

func (*PlacementRequirements) Marshal

func (m *PlacementRequirements) Marshal() (dAtA []byte, err error)

func (*PlacementRequirements) MarshalTo

func (m *PlacementRequirements) MarshalTo(dAtA []byte) (int, error)

func (*PlacementRequirements) MarshalToSizedBuffer

func (m *PlacementRequirements) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PlacementRequirements) ProtoMessage

func (*PlacementRequirements) ProtoMessage()

func (*PlacementRequirements) Reset

func (m *PlacementRequirements) Reset()

func (*PlacementRequirements) Size

func (m *PlacementRequirements) Size() (n int)

func (*PlacementRequirements) String

func (m *PlacementRequirements) String() string

func (*PlacementRequirements) Unmarshal

func (m *PlacementRequirements) Unmarshal(dAtA []byte) error

func (*PlacementRequirements) XXX_DiscardUnknown

func (m *PlacementRequirements) XXX_DiscardUnknown()

func (*PlacementRequirements) XXX_Marshal

func (m *PlacementRequirements) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PlacementRequirements) XXX_Merge

func (m *PlacementRequirements) XXX_Merge(src proto.Message)

func (*PlacementRequirements) XXX_Size

func (m *PlacementRequirements) XXX_Size() int

func (*PlacementRequirements) XXX_Unmarshal

func (m *PlacementRequirements) XXX_Unmarshal(b []byte) error

type SignedBy

type SignedBy struct {
	// AllOf indicates all keys in this list must have signed attributes.
	AllOf []string `protobuf:"bytes,1,rep,name=all_of,json=allOf,proto3" json:"all_of" yaml:"allOf"`
	// AnyOf means that at least of of the keys from the list must have signed attributes.
	AnyOf []string `protobuf:"bytes,2,rep,name=any_of,json=anyOf,proto3" json:"any_of" yaml:"anyOf"`
}

SignedBy represents validation accounts that tenant expects signatures for provider attributes. AllOf has precedence i.e. if there is at least one entry AnyOf is ignored regardless to how many entries there.

func (*SignedBy) Descriptor

func (*SignedBy) Descriptor() ([]byte, []int)

func (*SignedBy) Marshal

func (m *SignedBy) Marshal() (dAtA []byte, err error)

func (*SignedBy) MarshalTo

func (m *SignedBy) MarshalTo(dAtA []byte) (int, error)

func (*SignedBy) MarshalToSizedBuffer

func (m *SignedBy) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SignedBy) ProtoMessage

func (*SignedBy) ProtoMessage()

func (*SignedBy) Reset

func (m *SignedBy) Reset()

func (*SignedBy) Size

func (m *SignedBy) Size() (n int)

func (*SignedBy) String

func (m *SignedBy) String() string

func (*SignedBy) Unmarshal

func (m *SignedBy) Unmarshal(dAtA []byte) error

func (*SignedBy) XXX_DiscardUnknown

func (m *SignedBy) XXX_DiscardUnknown()

func (*SignedBy) XXX_Marshal

func (m *SignedBy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignedBy) XXX_Merge

func (m *SignedBy) XXX_Merge(src proto.Message)

func (*SignedBy) XXX_Size

func (m *SignedBy) XXX_Size() int

func (*SignedBy) XXX_Unmarshal

func (m *SignedBy) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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