registry

package
v0.0.0-...-ad90b1c Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DenyCapabilityInt uint32 = 1 << iota
	CreateCapabilityInt
	ReadCapabilityInt
	UpdateCapabilityInt
	DeleteCapabilityInt
	ListCapabilityInt
	SudoCapabilityInt
)

Variables

View Source
var (
	ErrFileExists            = errors.New("file already exists")
	ErrNoSuchFileOrDirectory = errors.New("no such file or directory")
	ErrReplicationImpossible = errors.New("insufficient nodes to replicate to")
)
View Source
var (
	ErrNotFound = errors.New("node is not found")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	ID          string // it's being set dynamically
	ApiAddr     string `json:"api_addr"`
	EtcdAddr    string `json:"etcd_addr"`
	StoragePath string `json:"storage_path"`
	RhosusPath  string `json:"rhosus_path"`

	Storage *storage.Storage
	Cluster cluster.Config `json:"cluster"`
}

Config is a main configuration of Registry node

type Node

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

type NodesMap

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

func NewNodesMap

func NewNodesMap(registry *Registry, nodes map[string]*transport_pb.NodeInfo) (*NodesMap, error)

func (*NodesMap) AddNode

func (m *NodesMap) AddNode(name string, info *transport_pb.NodeInfo) error

func (*NodesMap) AssignBlocks

func (m *NodesMap) AssignBlocks(nodeID string, blocks []*fs_pb.Block) ([]*transport_pb.BlockPlacementInfo, error)

func (*NodesMap) GetBlocks

func (m *NodesMap) GetBlocks(nodeID string, blocks []*transport_pb.BlockPlacementInfo) ([]*fs_pb.Block, error)

func (*NodesMap) GetNode

func (m *NodesMap) GetNode(id string) *Node

func (*NodesMap) GetNodesWithLeastBlocks

func (m *NodesMap) GetNodesWithLeastBlocks(n int) []*Node

func (*NodesMap) NodeExists

func (m *NodesMap) NodeExists(name string) bool

func (*NodesMap) RemoveNode

func (m *NodesMap) RemoveNode(id string)

RemoveNode is called only when node is gracefully shut down otherwise it is just marked as temporarily unavailable

func (*NodesMap) StartRecoveryProcess

func (m *NodesMap) StartRecoveryProcess(node *transport_pb.NodeInfo) error

func (*NodesMap) UpdateNodeInfo

func (m *NodesMap) UpdateNodeInfo(id string, info *transport_pb.NodeInfo)

func (*NodesMap) WatchNodes

func (m *NodesMap) WatchNodes()

type Registry

type Registry struct {
	Id   string
	Name string

	Config Config

	NodesMap *NodesMap
	Storage  *storage.Storage

	// Cluster is used to control over other registries
	Cluster *cluster.Cluster
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry(config Config) (*Registry, error)

func (*Registry) FileExists

func (r *Registry) FileExists(path string) (bool, error)

func (*Registry) GetFileHandler

func (r *Registry) GetFileHandler(path string, transport func(block *fs_pb.Block)) error

func (*Registry) HandleCreatePolicy

func (r *Registry) HandleCreatePolicy(req *api_pb.CreatePolicyRequest) (*api_pb.CreatePolicyResponse, error)

func (*Registry) HandleCreateToken

func (r *Registry) HandleCreateToken(req *api_pb.CreateTokenRequest) (*api_pb.CreateTokenResponse, error)

func (*Registry) HandleDeleteFile

func (r *Registry) HandleDeleteFile(rw http.ResponseWriter, req *http.Request) error

func (*Registry) HandleDeletePolicy

func (r *Registry) HandleDeletePolicy(req *api_pb.DeletePolicyRequest) (*api_pb.DeletePolicyResponse, error)

func (*Registry) HandleGetFile

func (r *Registry) HandleGetFile(rw http.ResponseWriter, req *http.Request) error

func (*Registry) HandleGetPolicy

func (r *Registry) HandleGetPolicy(req *api_pb.GetPolicyRequest) (*api_pb.GetPolicyResponse, error)

func (*Registry) HandleGetToken

func (r *Registry) HandleGetToken(req *api_pb.GetTokenRequest) (*api_pb.GetTokenResponse, error)

func (*Registry) HandleList

func (r *Registry) HandleList(rw http.ResponseWriter, req *http.Request) error

func (*Registry) HandleListPolicies

func (r *Registry) HandleListPolicies(req *api_pb.ListPoliciesRequest) (*api_pb.ListPoliciesResponse, error)

func (*Registry) HandleListTokens

func (r *Registry) HandleListTokens(req *api_pb.ListTokensRequest) (*api_pb.ListTokensResponse, error)

func (*Registry) HandleMakeDir

func (r *Registry) HandleMakeDir(req *api_pb.MakeDirRequest) (*api_pb.CommonResponse, error)

func (*Registry) HandlePutFile

func (r *Registry) HandlePutFile(rw http.ResponseWriter, req *http.Request) error

func (*Registry) HandleRemoveFileOrPath

func (r *Registry) HandleRemoveFileOrPath(req *api_pb.RemoveRequest) (*api_pb.CommonResponse, error)

func (*Registry) HandleRevokeToken

func (r *Registry) HandleRevokeToken(req *api_pb.RevokeTokenRequest) (*api_pb.RevokeTokenResponse, error)

func (*Registry) NotifyReady

func (r *Registry) NotifyReady() <-chan struct{}

func (*Registry) NotifyShutdown

func (r *Registry) NotifyShutdown() <-chan struct{}

func (*Registry) RegisterFile

func (r *Registry) RegisterFile(file *control_pb.FileInfo) error

RegisterFile registers file in registry storage and writes an entry to wal

func (*Registry) RemoveFileBlocks

func (r *Registry) RemoveFileBlocks(file *control_pb.FileInfo) (error, map[string]error)

func (*Registry) RunServiceDiscovery

func (r *Registry) RunServiceDiscovery()

func (*Registry) Shutdown

func (r *Registry) Shutdown()

func (*Registry) Start

func (r *Registry) Start()

func (*Registry) TransportAndRegisterBlocks

func (r *Registry) TransportAndRegisterBlocks(fileID string, blocks []*fs_pb.Block, replicationFactor int) error

type Transport

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

func NewTransport

func NewTransport(config TransportConfig, conns map[string]*transport_pb.TransportServiceClient) *Transport

func (*Transport) AddConn

func (t *Transport) AddConn(id string, conn *transport_pb.TransportServiceClient)

func (*Transport) NotifyShutdown

func (t *Transport) NotifyShutdown() <-chan struct{}

func (*Transport) RemoveConn

func (t *Transport) RemoveConn(id string)

func (*Transport) Shutdown

func (t *Transport) Shutdown()

type TransportConfig

type TransportConfig struct {
	WriteTimeoutMs int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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