Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidMacAddress = errors.New("invalid mac address") ErrGeneratingNodeToken = errors.New("error generating new node token") )
View Source
var ( ErrInvalidEmail = errors.New("invalid email format") ErrShortPassword = errors.New("password length is short") )
View Source
var ErrGeneratingID = errors.New("generating id failed")
ErrGeneratingID indicates error in generating UUID
Functions ¶
This section is empty.
Types ¶
type Hasher ¶
type Hasher interface { // Hash generates the hashed string from plain-text. Hash(string) (string, error) // Compare compares plain-text version to the hashed one. An error should // indicate failed comparison. Compare(string, string) error }
Hasher specifies an API for generating hashes of an arbitrary textual content.
type Node ¶
type Node struct { ID string `json:"id"` Addr string `json:"addr"` Name string `json:"name"` Type int `json:"type"` Status int `json:"status"` Latitude string `json:"lat"` Longitude string `json:"long"` Token string `json:"token"` CreatedAt int64 `json:"created_at"` MasterNodeID string `json:"master_node_id"` ChildNodes []Node `json:"child_nodes"` }
Node represent the edge node deployed in the igrid network
type NodeStatus ¶
type NodeStatus int
const ( Revoked NodeStatus = iota + 1 AllowedOffline AllowedOnline )
func (NodeStatus) String ¶
func (ns NodeStatus) String() string
type RegionOfOp ¶
type Repository ¶
type Repository interface { AddUser(ctx context.Context, user User) error ListUsers(ctx context.Context) ([]User, error) DeleteUser(ctx context.Context, email string) error GetUser(ctx context.Context, email string) (User, error) EditUser(ctx context.Context, email string, user User) (User, error) ListUsersByGroup(ctx context.Context, group UserGroup) ([]User, error) ListUsersByRegion(ctx context.Context, region string) ([]User, error) AddNode(ctx context.Context, user Node) error ListNodes(ctx context.Context) ([]Node, error) DeleteNode(ctx context.Context, email string) error GetNode(ctx context.Context, email string) (Node, error) EditNode(ctx context.Context, email string, user Node) (Node, error) ListNodesByType(ctx context.Context, nodeType int) ([]Node, error) ListNodesByRegion(ctx context.Context, region string) ([]Node, error) RemoveRegion(ctx context.Context, region string) error AddRegion(ctx context.Context, region RegionOfOp) error ListRegions(ctx context.Context) ([]RegionOfOp, error) EditRegion(ctx context.Context, id string, op RegionOfOp) (RegionOfOp, error) }
type Service ¶
type Service interface { Version(ctx context.Context) (string, error) AddUser(ctx context.Context, user User) error ListUsers(ctx context.Context) ([]User, error) DeleteUser(ctx context.Context, email string) error GetUser(ctx context.Context, email string) (User, error) EditUser(ctx context.Context, email string, user User) (User, error) ListUsersByGroup(ctx context.Context, group UserGroup) ([]User, error) ListUsersByRegion(ctx context.Context, region string) ([]User, error) AddNode(ctx context.Context, user Node) error ListNodes(ctx context.Context) ([]Node, error) DeleteNode(ctx context.Context, email string) error GetNode(ctx context.Context, email string) (Node, error) EditNode(ctx context.Context, email string, user Node) (Node, error) ListNodesByType(ctx context.Context, nodeType int) ([]Node, error) ListNodesByRegion(ctx context.Context, region string) ([]Node, error) RemoveRegion(ctx context.Context, region string) error AddRegion(ctx context.Context, region RegionOfOp) error ListRegions(ctx context.Context) ([]RegionOfOp, error) EditRegion(ctx context.Context, id string, op RegionOfOp) (RegionOfOp, error) }
Service describes the service.
func NewService ¶
func NewService(repository Repository, hasher Hasher, provider UUIDProvider, logger logger.Logger) Service
type UUIDProvider ¶
UUIDProvider specifies an API for generating unique identifiers.
type User ¶
type User struct { ID string `json:"id,omitempty"` //id or user token | uuid Name string `json:"name"` //fullname Email string `json:"email"` //email Group int `json:"group"` //user group Password string `json:"password,omitempty"` //password of user RegionOfOp string `json:"region_of_operation,omitempty"` //operating region in case of multi cloud Created string `json:"created,omitempty"` //when was this user added }
func CreateUser ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.