system

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

(C) Copyright 2019 Intel Corporation.

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.

GOVERNMENT LICENSE RIGHTS-OPEN SOURCE SOFTWARE The Government's rights to use, modify, reproduce, release, perform, display, or disclose this software are subject to the terms of the Apache License as provided in Contract No. 8F-30005. Any reproduction of computer software, computer software documentation, or portions thereof marked with this legend must also reproduce the markings.

Index

Constants

This section is empty.

Variables

View Source
var (
	FaultMemberExists = systemFault(
		code.SystemMemberExists,
		"system member with given rank already exists",
		"update system member instead of adding",
	)
	FaultMemberMissing = systemFault(
		code.SystemMemberMissing,
		"system member with given rank doesn't exists",
		"",
	)
)

Functions

This section is empty.

Types

type Member

type Member struct {
	Rank uint32
	UUID string
	Addr net.Addr
	// contains filtered or unexported fields
}

Member refers to a data-plane instance that is a member of this DAOS system running on host with the control-plane listening at "Addr".

func NewMember

func NewMember(rank uint32, uuid string, addr net.Addr, state MemberState) *Member

NewMember returns a reference to a new member struct.

func (*Member) MarshalJSON

func (sm *Member) MarshalJSON() ([]byte, error)

func (*Member) SetState

func (sm *Member) SetState(s MemberState)

SetState sets member state.

func (*Member) State

func (sm *Member) State() MemberState

State retrieves member state.

func (*Member) String

func (sm *Member) String() string

func (*Member) UnmarshalJSON

func (sm *Member) UnmarshalJSON(data []byte) error

type MemberResult

type MemberResult struct {
	Rank    uint32
	Action  string
	Errored bool
	Msg     string
	State   MemberState
}

MemberResult refers to the result of an action on a Member identified its string representation "address/rank".

func NewMemberResult

func NewMemberResult(rank uint32, action string, err error, state MemberState) *MemberResult

NewMemberResult returns a reference to a new member result struct.

func (*MemberResult) MarshalJSON

func (mr *MemberResult) MarshalJSON() ([]byte, error)

func (*MemberResult) UnmarshalJSON

func (mr *MemberResult) UnmarshalJSON(data []byte) error

type MemberResults

type MemberResults []*MemberResult

MemberResults is a type alias for a slice of member result references.

func (MemberResults) HasErrors

func (smr MemberResults) HasErrors() bool

HasErrors returns true if any of the member results errored.

type MemberState

type MemberState int

MemberState represents the activity state of DAOS system members.

const (
	MemberStateUnknown MemberState = iota
	MemberStateStarted
	MemberStateStopping     // prep-shutdown successfully run
	MemberStateStopped      // process cleanly stopped
	MemberStateEvicted      // rank has been evicted from DAOS system
	MemberStateErrored      // process stopped with errors
	MemberStateUnresponsive // e.g. zombie process
)

func (MemberState) String

func (ms MemberState) String() string

type Members

type Members []*Member

Members is a type alias for a slice of member references

type Membership

type Membership struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Membership tracks details of system members.

func NewMembership

func NewMembership(log logging.Logger) *Membership

NewMembership returns a reference to a new DAOS system membership.

func (*Membership) Add

func (m *Membership) Add(member *Member) (int, error)

Add adds member to membership, returns member count.

func (*Membership) AddOrUpdate

func (m *Membership) AddOrUpdate(member *Member) (bool, *MemberState)

AddOrUpdate adds member to membership or updates member state if member already exists in membership. Returns flag for whether member was created and the previous state if updated.

func (*Membership) Get

func (m *Membership) Get(rank uint32) (*Member, error)

Get retrieves member reference from membership based on Rank.

func (*Membership) HostRanks added in v0.9.1

func (m *Membership) HostRanks() map[string][]uint32

HostRanks returns mapping of control addresses to ranks managed by harness at that address.

func (*Membership) Members

func (m *Membership) Members(excludedStates ...MemberState) (ms Members)

Members returns slice of references to all system members filtering members with excluded states. Results ordered by member rank.

func (*Membership) Ranks

func (m *Membership) Ranks() (ranks []uint32)

Ranks returns slice of ordered member ranks.

func (*Membership) Remove

func (m *Membership) Remove(rank uint32)

Remove removes member from membership, idempotent.

func (*Membership) SetMemberState

func (m *Membership) SetMemberState(rank uint32, state MemberState) error

SetMemberState updates existing member state in membership.

func (*Membership) UpdateMemberStates

func (m *Membership) UpdateMemberStates(results MemberResults) error

UpdateMemberStates updates member's state according to result state.

TODO: store error message in membership

Jump to

Keyboard shortcuts

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