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 MsgCloseDeployment
- type MsgCreateDeployment
- type MsgUpdateDeployment
- 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") // ErrInvalidDeployment = is the error when deployment does not pass validation ErrInvalidDeployment = sdkerrors.Register(ModuleName, 11, "Invalid deployment") )
var DeploymentStateMap = map[string]DeploymentState{ "active": DeploymentActive, "closed": DeploymentClosed, }
DeploymentStateMap is used to decode deployment state flag value
var (
ErrGroupNotOpen = errors.New("group not open")
)
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 occurred
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 + 1 // DeploymentClosed is used when state of deployment is closed DeploymentClosed )
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 []sdk.Attribute `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 + 1 // GroupOrdered is used when state of group is ordered GroupOrdered // GroupMatched is used when state of group is matched GroupMatched // GroupInsufficientFunds is used when group has insufficient funds GroupInsufficientFunds // GroupClosed is used when state of group is closed GroupClosed )
type MsgCloseDeployment ¶ added in v0.6.5
type MsgCloseDeployment struct {
ID DeploymentID
}
MsgCloseDeployment defines an SDK message for closing deployment
func (MsgCloseDeployment) GetSignBytes ¶ added in v0.6.5
func (msg MsgCloseDeployment) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgCloseDeployment) GetSigners ¶ added in v0.6.5
func (msg MsgCloseDeployment) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgCloseDeployment) Route ¶ added in v0.6.5
func (msg MsgCloseDeployment) Route() string
Route implements the sdk.Msg interface
func (MsgCloseDeployment) Type ¶ added in v0.6.5
func (msg MsgCloseDeployment) Type() string
Type implements the sdk.Msg interface
func (MsgCloseDeployment) ValidateBasic ¶ added in v0.6.5
func (msg MsgCloseDeployment) ValidateBasic() error
ValidateBasic does basic validation with deployment details
type MsgCreateDeployment ¶ added in v0.6.5
type MsgCreateDeployment struct { Owner sdk.AccAddress `json:"owner"` // Sequence uint64 `json:"sequence"` // Version []byte `json:"version"` Groups []GroupSpec `json:"groups"` }
MsgCreateDeployment defines an SDK message for creating deployment
func (MsgCreateDeployment) GetSignBytes ¶ added in v0.6.5
func (msg MsgCreateDeployment) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgCreateDeployment) GetSigners ¶ added in v0.6.5
func (msg MsgCreateDeployment) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgCreateDeployment) Route ¶ added in v0.6.5
func (msg MsgCreateDeployment) Route() string
Route implements the sdk.Msg interface
func (MsgCreateDeployment) Type ¶ added in v0.6.5
func (msg MsgCreateDeployment) Type() string
Type implements the sdk.Msg interface
func (MsgCreateDeployment) ValidateBasic ¶ added in v0.6.5
func (msg MsgCreateDeployment) ValidateBasic() error
ValidateBasic does basic validation like check owner and groups length
type MsgUpdateDeployment ¶ added in v0.6.5
type MsgUpdateDeployment struct { ID DeploymentID Version sdk.AccAddress }
MsgUpdateDeployment defines an SDK message for updating deployment
func (MsgUpdateDeployment) GetSignBytes ¶ added in v0.6.5
func (msg MsgUpdateDeployment) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgUpdateDeployment) GetSigners ¶ added in v0.6.5
func (msg MsgUpdateDeployment) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgUpdateDeployment) Route ¶ added in v0.6.5
func (msg MsgUpdateDeployment) Route() string
Route implements the sdk.Msg interface
func (MsgUpdateDeployment) Type ¶ added in v0.6.5
func (msg MsgUpdateDeployment) Type() string
Type implements the sdk.Msg interface
func (MsgUpdateDeployment) ValidateBasic ¶ added in v0.6.5
func (msg MsgUpdateDeployment) ValidateBasic() error
ValidateBasic does basic validation
type Resource ¶
type Resource struct { Unit types.Unit `json:"unit"` Count uint32 `json:"count"` Price sdk.Coin `json:"price"` }
Resource stores unit, count and price of each resource