Documentation ¶
Index ¶
Constants ¶
View Source
const MaxAttachedNodes = 2
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connectivity ¶
type Connectivity uint8
const ( Unknown Connectivity = iota Offline Connectivity = 1 /* Not connected */ Online Connectivity = 2 /* Connected */ )
func ParseConnectivityState ¶
func ParseConnectivityState(s string) Connectivity
func (*Connectivity) Scan ¶
func (c *Connectivity) Scan(value interface{}) error
func (Connectivity) String ¶
func (c Connectivity) String() string
type Node ¶
type Node struct { Id string `` /* 133-byte string literal not displayed */ Name string `gorm:"type:string"` Status NodeStatus `gorm:"not null"` Type string `gorm:"type:string;not null"` OrgId uuid.UUID `gorm:"type:uuid;not null"` ParentNodeId *string `gorm:"type:string;expression:lower(id),where:deleted_at is null;size:23:default:null;"` Attached []*Node `gorm:"foreignKey:ParentNodeId"` Site Site CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` }
type NodeRepo ¶
type NodeRepo interface { Add(*Node, func(*Node, *gorm.DB) error) error Get(ukama.NodeID) (*Node, error) GetForOrg(uuid.UUID) ([]Node, error) GetAll() ([]Node, error) Delete(ukama.NodeID, func(ukama.NodeID, *gorm.DB) error) error Update(*Node, func(*Node, *gorm.DB) error) error AttachNodes(nodeId ukama.NodeID, attachedNodeId []string) error DetachNode(detachNodeId ukama.NodeID) error GetNodeCount() (int64, int64, int64, error) }
func NewNodeRepo ¶
type NodeState ¶
type NodeState uint8
const ( Undefined NodeState = iota Onboarded NodeState = 1 /* First time when node connctes */ Configured NodeState = 2 /* After initial configuration */ Active NodeState = 3 /* Up and transmitting */ Maintenance NodeState = 4 /* Upgardes / Downgrades */ Faulty NodeState = 5 /* Fault reported by node */ )
func ParseNodeState ¶
type NodeStatus ¶
type NodeStatus struct { gorm.Model NodeId string `gorm:"uniqueIndex:nodestatus_idx,expression:lower(node_id),where:deleted_at is null"` Conn Connectivity `gorm:"type:uint;not null"` State NodeState `gorm:"type:uint;not null"` }
func (*NodeStatus) BeforeSave ¶
func (n *NodeStatus) BeforeSave(tx *gorm.DB) (err error)
type NodeStatusRepo ¶
type NodeStatusRepo interface { Update(*NodeStatus) error Get(ukama.NodeID) (*NodeStatus, error) Delete(ukama.NodeID) error GetAll() ([]NodeStatus, error) GetNodeCount() (onlineNodeCount, offlineNodeCount int64, err error) }
func NewNodeStatusRepo ¶
func NewNodeStatusRepo(db sql.Db) NodeStatusRepo
type Site ¶
type SiteRepo ¶
type SiteRepo interface { GetNodes(uuid.UUID) ([]Node, error) GetByNetwork(uuid.UUID) ([]Node, error) AddNode(*Site, func(*Site, *gorm.DB) error) error RemoveNode(ukama.NodeID) (*Site, error) GetFreeNodes() ([]Node, error) GetFreeNodesForOrg(uuid.UUID) ([]Node, error) IsAllocated(ukama.NodeID) (bool, *Site) }
func NewSiteRepo ¶
Click to show internal directories.
Click to hide internal directories.