Documentation ¶
Index ¶
- Constants
- Variables
- func DeploymentIDEVAttributes(id DeploymentID) []sdk.Attribute
- func GroupIDEVAttributes(id GroupID) []sdk.Attribute
- func MustMarshalJSON(o interface{}) []byte
- func MustUnmarshalJSON(bz []byte, ptr interface{})
- func ParseEvent(ev sdkutil.Event) (interface{}, error)
- func RegisterCodec(cdc *codec.Codec)
- func UnmarshalJSON(bz []byte, ptr interface{}) error
- type Deployment
- type DeploymentFilters
- type DeploymentID
- type DeploymentState
- type EventDeploymentClose
- type EventDeploymentCreate
- type EventDeploymentUpdate
- type Group
- type GroupFilters
- type GroupID
- type GroupSpec
- type GroupState
- type MsgClose
- type MsgCreate
- type MsgUpdate
- type Resource
Constants ¶
const ( // ModuleName is the module name constant used in many places ModuleName = "deployment" // StoreKey is the store key string for deployment StoreKey = ModuleName // RouterKey is the message route for deployment RouterKey = ModuleName )
Variables ¶
var ( // ErrNameDoesNotExist is the error when name does not exist ErrNameDoesNotExist = sdkerrors.Register(ModuleName, 1, "Name does not exist") // ErrInvalidRequest is the error for invalid request ErrInvalidRequest = sdkerrors.Register(ModuleName, 2, "Invalid request") // ErrDeploymentExists is the error when already deployment exists ErrDeploymentExists = sdkerrors.Register(ModuleName, 3, "Deployment exists") // ErrDeploymentNotFound is the error when deployment not found ErrDeploymentNotFound = sdkerrors.Register(ModuleName, 4, "Deployment not found") // ErrDeploymentClosed is the error when deployment is closed ErrDeploymentClosed = sdkerrors.Register(ModuleName, 5, "Deployment closed") // ErrOwnerAcctMissing is the error for owner account missing ErrOwnerAcctMissing = sdkerrors.Register(ModuleName, 6, "Owner account missing") // ErrEmptyGroups is the error when groups are empty ErrEmptyGroups = sdkerrors.Register(ModuleName, 7, "Invalid: empty groups") // ErrInvalidDeploymentID is the error for invalid deployment id ErrInvalidDeploymentID = sdkerrors.Register(ModuleName, 8, "Invalid: deployment id") // ErrEmptyVersion is the error when version is empty ErrEmptyVersion = sdkerrors.Register(ModuleName, 9, "Invalid: empty version") // ErrInternal is the error for internal error ErrInternal = sdkerrors.Register(ModuleName, 10, "internal error") )
var DeploymentStateMap = map[string]DeploymentState{ "active": DeploymentActive, "closed": DeploymentClosed, }
DeploymentStateMap is used to decode deployment state flag value
var GroupStateMap = map[string]GroupState{ "open": GroupOpen, "ordered": GroupOrdered, "matched": GroupMatched, "insufficient": GroupInsufficientFunds, "closed": GroupClosed, }
GroupStateMap is used to decode group state flag value
Functions ¶
func DeploymentIDEVAttributes ¶
func DeploymentIDEVAttributes(id DeploymentID) []sdk.Attribute
DeploymentIDEVAttributes returns event attribues for given DeploymentID
func GroupIDEVAttributes ¶
GroupIDEVAttributes returns event attribues for given GroupID
func MustMarshalJSON ¶
func MustMarshalJSON(o interface{}) []byte
MustMarshalJSON panics if an error occurs. Besides that it behaves exactly like MarshalJSON i.e., encodes json to byte array
func MustUnmarshalJSON ¶
func MustUnmarshalJSON(bz []byte, ptr interface{})
MustUnmarshalJSON panics if an error occurs. Besides that it behaves exactly like UnmarshalJSON.
func ParseEvent ¶
ParseEvent parses event and returns details of event and error if occured
func RegisterCodec ¶
RegisterCodec register concrete types on codec
func UnmarshalJSON ¶
UnmarshalJSON decodes bytes into json
Types ¶
type Deployment ¶
type Deployment struct { DeploymentID `json:"id"` State DeploymentState `json:"state"` Version []byte `json:"version"` }
Deployment stores deploymentID, state and version details
func (Deployment) ID ¶
func (obj Deployment) ID() DeploymentID
ID method returns DeploymentID details of specific deployment
type DeploymentFilters ¶
type DeploymentFilters struct { Owner sdk.AccAddress // State flag value given StateFlagVal string // Actual state value decoded from DeploymentStateMap State DeploymentState }
DeploymentFilters defines flags for deployment list filter
type DeploymentID ¶
type DeploymentID struct { Owner sdk.AccAddress `json:"owner"` DSeq uint64 `json:"dseq"` }
DeploymentID stores owner and sequence number
func ParseEVDeploymentID ¶
func ParseEVDeploymentID(attrs []sdk.Attribute) (DeploymentID, error)
ParseEVDeploymentID returns deploymentID details for given event attributes
func (DeploymentID) Equals ¶
func (id DeploymentID) Equals(other DeploymentID) bool
Equals method compares specific deployment with provided deployment
func (DeploymentID) Validate ¶
func (id DeploymentID) Validate() error
Validate method for DeploymentID and returns nil
type DeploymentState ¶
type DeploymentState uint8
DeploymentState defines state of deployment
const ( // DeploymentActive is used when state of deployment is active DeploymentActive DeploymentState = iota // DeploymentClosed is used when state of deployment is closed DeploymentClosed DeploymentState = iota )
type EventDeploymentClose ¶
type EventDeploymentClose struct {
ID DeploymentID
}
EventDeploymentClose struct
func (EventDeploymentClose) ToSDKEvent ¶
func (ev EventDeploymentClose) ToSDKEvent() sdk.Event
ToSDKEvent method creates new sdk event for EventDeploymentClose struct
type EventDeploymentCreate ¶
type EventDeploymentCreate struct {
ID DeploymentID
}
EventDeploymentCreate struct
func (EventDeploymentCreate) ToSDKEvent ¶
func (ev EventDeploymentCreate) ToSDKEvent() sdk.Event
ToSDKEvent method creates new sdk event for EventDeploymentCreate struct
type EventDeploymentUpdate ¶
type EventDeploymentUpdate struct { ID DeploymentID Version []byte // TODO }
EventDeploymentUpdate struct
func (EventDeploymentUpdate) ToSDKEvent ¶
func (ev EventDeploymentUpdate) ToSDKEvent() sdk.Event
ToSDKEvent method creates new sdk event for EventDeploymentUpdate struct
type Group ¶
type Group struct { GroupID `json:"id"` State GroupState `json:"state"` GroupSpec `json:"spec"` }
Group stores groupID, state and other specifications
func (Group) ValidateOrderable ¶
ValidateOrderable method checks whether group opened or not
type GroupFilters ¶
type GroupFilters struct { Owner sdk.AccAddress // State flag value given StateFlagVal string // Actual state value decoded from GroupStateMap State GroupState }
GroupFilters defines flags for group list filter
type GroupID ¶
type GroupID struct { Owner sdk.AccAddress `json:"owner"` DSeq uint64 `json:"dseq"` GSeq uint32 `json:"gseq"` }
GroupID stores owner, deployment sequence number and group sequence number
func MakeGroupID ¶
func MakeGroupID(id DeploymentID, gseq uint32) GroupID
MakeGroupID returns GroupID instance with provided deployment details and group sequence number.
func ParseEVGroupID ¶
ParseEVGroupID returns GroupID details for given event attributes
func (GroupID) DeploymentID ¶
func (id GroupID) DeploymentID() DeploymentID
DeploymentID method returns DeploymentID details with specific group details
type GroupSpec ¶
type GroupSpec struct { Name string `json:"name"` Requirements []tmkv.Pair `json:"requirements"` Resources []Resource `json:"resources"` }
GroupSpec stores group specifications
func (GroupSpec) GetResources ¶
GetResources method returns resources list in group
func (GroupSpec) MatchAttributes ¶
MatchAttributes method compares provided attributes with specific group attributes
type GroupState ¶
type GroupState uint8
GroupState defines state of group
const ( // GroupOpen is used when state of group is open GroupOpen GroupState = iota // GroupOrdered is used when state of group is ordered GroupOrdered GroupState = iota // GroupMatched is used when state of group is matched GroupMatched GroupState = iota // GroupInsufficientFunds is used when group has insufficient funds GroupInsufficientFunds GroupState = iota // GroupClosed is used when state of group is closed GroupClosed GroupState = iota )
type MsgClose ¶
type MsgClose struct {
ID DeploymentID
}
MsgClose defines an SDK message for closing deployment
func (MsgClose) GetSignBytes ¶
GetSignBytes encodes the message for signing
func (MsgClose) GetSigners ¶
func (msg MsgClose) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgClose) ValidateBasic ¶
ValidateBasic does basic validation with deployment details
type MsgCreate ¶
type MsgCreate struct { Owner sdk.AccAddress `json:"owner"` // Sequence uint64 `json:"sequence"` // Version []byte `json:"version"` Groups []GroupSpec `json:"groups"` }
MsgCreate defines an SDK message for creating deployment
func (MsgCreate) GetSignBytes ¶
GetSignBytes encodes the message for signing
func (MsgCreate) GetSigners ¶
func (msg MsgCreate) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgCreate) ValidateBasic ¶
ValidateBasic does basic validation like check owner and groups length
type MsgUpdate ¶
type MsgUpdate struct { ID DeploymentID Version sdk.AccAddress }
MsgUpdate defines an SDK message for updating deployment
func (MsgUpdate) GetSignBytes ¶
GetSignBytes encodes the message for signing
func (MsgUpdate) GetSigners ¶
func (msg MsgUpdate) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgUpdate) ValidateBasic ¶
ValidateBasic does basic validation