Documentation ¶
Overview ¶
* Copyright 2018 Yuji Ito <[email protected]> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
* Copyright 2018 Yuji Ito <[email protected]> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
* Copyright 2018 Yuji Ito <[email protected]> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
* Copyright 2018 Yuji Ito <[email protected]> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
* Copyright 2018 Yuji Ito <[email protected]> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- Variables
- func GenerateAccountUuid(name string) string
- func GeneratePodUuid() string
- func ValidateNodeId(name string) error
- func ValidatePodUuid(id string) error
- func ValidateTimestamp(timestamp string) error
- type Account
- type AccountNodeState
- type AccountPodState
- type AccountState
- type ContainerSpec
- type ContainerState
- type ContainerStateRunning
- type ContainerStateTerminated
- type ContainerStateUnknown
- type ContainerStatus
- type EnvVar
- type MarshalRequest
- type MarshalResponse
- type NodeType
- type ObjectMeta
- type OutputRequest
- type OutputResponse
- type Pod
- type PodSpec
- type PodStatus
- type ReadyRequest
- type ReadyResponse
- type Record
- type RecordData
- type RecordEntry
- type ResourceType
- type RestartPolicy
- type SchedulerSpec
- type SetupRequest
- type SetupResponse
- type TeardownRequest
- type TeardownResponse
- type Vector2
- type Vector3
Constants ¶
const ( ResourceTypeAccount = ResourceType("account") ResourceTypeNode = ResourceType("node") ResourceTypePod = ResourceType("pod") ResourceTypeRecord = ResourceType("record") )
Variables ¶
var ContainerRuntimeAccepted = []string{
"core:dev1",
}
var ContainerRuntimeRequired = []string{
"go:1.19",
"go:1.20",
}
var NODE_NAME_EXPRESSION = regexp.MustCompile("^[0-9a-f]{32}$")
node id format is equal to colonio node ids
var NodeTypeAccepted = []NodeType{ NodeTypeMobile, NodeTypeSmallDevice, NodeTypePC, NodeTypeServer, NodeTypeGrass, NodeTypeOther, }
var RestartPolicyAccepted = []RestartPolicy{ RestartPolicyDisable, RestartPolicyAlways, RestartPolicyStrictExited, RestartPolicyStrictSucceeded, RestartPolicyStrictFailed, RestartPolicyOnce, }
Functions ¶
func GenerateAccountUuid ¶
use sha256 hash as account's uuid
func GeneratePodUuid ¶
func GeneratePodUuid() string
func ValidateNodeId ¶
func ValidatePodUuid ¶
func ValidateTimestamp ¶
Types ¶
type Account ¶
type Account struct { Meta *ObjectMeta `json:"meta"` State *AccountState `json:"state"` }
type AccountNodeState ¶
type AccountPodState ¶
type AccountState ¶
type AccountState struct { // map describing pod's uuid and pod state Pods map[string]AccountPodState `json:"pods"` // map describing nid and timestamp of keepalive Nodes map[string]AccountNodeState `json:"nodes"` }
type ContainerSpec ¶
type ContainerState ¶
type ContainerState struct { Running *ContainerStateRunning `json:"running,omitempty"` Terminated *ContainerStateTerminated `json:"terminated,omitempty"` Unknown *ContainerStateUnknown `json:"unknown,omitempty"` }
type ContainerStateRunning ¶
type ContainerStateRunning struct {
StartedAt string `json:"startedAt"`
}
type ContainerStateUnknown ¶
type ContainerStatus ¶
type ContainerStatus struct { ContainerID string `json:"containerID,omitempty"` Image string `json:"image,omitempty"` LastState *ContainerStateTerminated `json:"lastState,omitempty"` State ContainerState `json:"state"` }
type MarshalRequest ¶
type MarshalRequest struct { }
type MarshalResponse ¶
type MarshalResponse struct {
Record []byte `json:"record"`
}
type ObjectMeta ¶
type ObjectMeta struct { Type ResourceType `json:"type"` Name string `json:"name"` Owner string `json:"owner"` CreatorNode string `json:"creatorNode"` Uuid string `json:"uuid"` DeletionTimestamp string `json:"deletionTimestamp"` }
func (*ObjectMeta) Validate ¶
func (meta *ObjectMeta) Validate(t ResourceType) error
type OutputRequest ¶
type OutputRequest struct {
Payload []byte `json:"payload"`
}
type OutputResponse ¶
type OutputResponse struct {
Length int `json:"length"`
}
type Pod ¶
type Pod struct { Meta *ObjectMeta `json:"meta"` Spec *PodSpec `json:"spec"` Status *PodStatus `json:"status"` }
type PodSpec ¶
type PodSpec struct { Containers []ContainerSpec `json:"containers"` TargetNode string `json:"targetNode"` Scheduler *SchedulerSpec `json:"scheduler"` EnableMigrate bool `json:"enableMigrate"` }
type PodStatus ¶
type PodStatus struct { RunningNode string `json:"runningNode"` Position *Vector3 `json:"position,omitempty"` ContainerStatuses []ContainerStatus `json:"containerStatuses"` }
type ReadyResponse ¶
type ReadyResponse struct { }
type Record ¶
type Record struct { Meta *ObjectMeta `json:"meta"` Data *RecordData `json:"data"` }
type RecordData ¶
type RecordData struct { // key: container name Entries map[string]RecordEntry `json:"entries"` }
func (*RecordData) Validate ¶
func (data *RecordData) Validate() error
type RecordEntry ¶
type ResourceType ¶
type ResourceType string
type RestartPolicy ¶
type RestartPolicy string
const ( RestartPolicyDisable RestartPolicy = "Disable" RestartPolicyAlways RestartPolicy = "Always" RestartPolicyStrictExited RestartPolicy = "StrictExited" RestartPolicyStrictSucceeded RestartPolicy = "StrictSucceeded" RestartPolicyStrictFailed RestartPolicy = "StrictFailed" RestartPolicyOnce RestartPolicy = "Once" )
type SchedulerSpec ¶
type SchedulerSpec struct {
Type string `json:"type"`
}
type SetupRequest ¶
types to pass from node manager to application
type SetupResponse ¶
type SetupResponse struct { }
type TeardownRequest ¶
type TeardownRequest struct {
IsFinalize bool `json:"isFinalizeT"`
}
type TeardownResponse ¶
type TeardownResponse struct {
Record []byte `json:"record"`
}