controller

package
v0.0.0-...-1826292 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

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.

* 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

View Source
const (
	NODE_PUBLISH_INTERVAL = 30 * time.Second
	NODE_RECORD_LIFETIME  = 90 * time.Second
)
View Source
const ACCOUNT = "cat"
View Source
const ACCOUNT_LIFETIME = 600 * time.Second
View Source
const ACCOUNT_STATE_RESOURCE_LIFETIME = 180 * time.Second
View Source
const (
	ContainerLabelPodUUID = "pod-uuid"
)
View Source
const NODE_ID = "012345678901234567890123456789ab"
View Source
const (
	TEST_NID = ""
)

Variables

This section is empty.

Functions

func NewAccountControllerTest

func NewAccountControllerTest() suite.TestingSuite

func NewNodeControllerTest

func NewNodeControllerTest() suite.TestingSuite

func NewPodControllerTest

func NewPodControllerTest() suite.TestingSuite

Types

type AccountController

type AccountController interface {
	DealLocalResource(raw []byte) (bool, error)

	GetAccountName() string
	GetPodState() (map[string]core.AccountPodState, error)
	GetNodeState() (map[string]core.AccountNodeState, error)
	UpdatePodAndNodeState(account string, pods map[string]core.AccountPodState, nodeID string, nodeState *core.AccountNodeState) error
}

func NewAccountController

func NewAccountController(account, localNid string, accountKvs kvs.AccountKvs) AccountController

type ApplicationDigest

type ApplicationDigest struct {
	Name          string `json:"name"`
	Uuid          string `json:"uuid"`
	RunningNodeID string `json:"runningNodeID"`
	Owner         string `json:"owner"`
	State         string `json:"state"`
}

type ApplicationFilter

type ApplicationFilter interface {
	SetAccount(account string)
	SetFilter(filter string)
	SetSamplePrefix(prefix string)
	IsAllowed(pod *coreAPI.Pod) bool
}

func NewApplicationFilter

func NewApplicationFilter() ApplicationFilter

type ContainerController

type ContainerController interface {
	GetContainerInfos() []*ContainerInfo
	Reconcile(ctx context.Context, podUuid string) error
}

func NewContainerController

func NewContainerController(localNid string, cri cri.CRI, appFilter ApplicationFilter, podKvs kvs.PodKvs, recordKVS kvs.RecordKvs, apiCoreDriverManager *coreAPI.Manager) ContainerController

type ContainerInfo

type ContainerInfo struct {
	PodUUID   string
	Owner     string
	SandboxID string
}

type EventHandler

type EventHandler interface {
	OnConnect(nodeName string, nodeType core.NodeType) error
}

type NodeController

type NodeController interface {
	GetNid() string
	GetNodeState() *coreAPI.AccountNodeState
	ReceivePublishingNode(state NodeState) error
	SetPosition(position *coreAPI.Vector3) error
	GetPosition() *coreAPI.Vector3
	SetPublicity(r float64) error
	ListNode() ([]NodeState, error)
}

func NewNodeController

func NewNodeController(ctx context.Context, col colonio.Colonio, messaging driver.MessagingDriver, account, nodeName string, nodeType coreAPI.NodeType) NodeController

type NodeRecord

type NodeRecord struct {
	// contains filtered or unexported fields
}

type NodeState

type NodeState struct {
	Name     string           `json:"name"`
	ID       string           `json:"id"`
	Account  string           `json:"account"`
	NodeType coreAPI.NodeType `json:"nodeType"`
	Position *coreAPI.Vector3 `json:"position,omitempty"`
}

type PodController

type PodController interface {
	DealLocalResource(raw []byte) (bool, error)

	Create(name, owner, creatorNode string, spec *core.PodSpec) (*ApplicationDigest, error)
	GetPodData(uuid string) (*core.Pod, error)
	GetContainerStateMessage(pod *core.Pod) string
	Migrate(uuid string, targetNodeID string) error
	Delete(uuid string) error
	Cleanup(uuid string) error
}

func NewPodController

func NewPodController(podKvs kvs.PodKvs, messaging driver.MessagingDriver, localNid string) PodController

type SystemController

type SystemController interface {
	Start(ctx context.Context) error
	Connect(url, account, token, nodeName, nodeType string) error
	Disconnect() error

	GetAccount() string
	GetNode() string
}

func NewSystemController

func NewSystemController(col colonio.Colonio, evh EventHandler, frontendDriver driver.FrontendDriver) SystemController

Directories

Path Synopsis
* 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.
* 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.

Jump to

Keyboard shortcuts

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