manageserver

package
v0.0.0-...-e27f3f3 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2019 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ElectionTickTime  int    = 10      // ElectionTickTime 选举超时
	HeartbeatTickTime int    = 5       // HeartbeatTickTime 心跳超时
	MaxSizePerMsg     uint64 = 4194304 // MaxSizePerMsg 每包最大值

)

Variables

View Source
var DefaultCenterName = "DefaultCenter"
View Source
var DefaultRackName = "DefaultRack"
View Source
var (
	MaxVolumeID = "max_volume_id"
)

Functions

func FileExist

func FileExist(name string) bool

FileExist checking file

Types

type DataCenter

type DataCenter struct {
	DataRack map[string]*DataRack `json:"Racks"`
	// contains filtered or unexported fields
}

func NewDataCenter

func NewDataCenter() *DataCenter

type DataNode

type DataNode struct {
	sync.RWMutex
	VolumeInfos map[util.VIDType]*volume.VolumeInfo

	Ip        string `json:"-"`
	Port      int    `json:"-"`
	PublicUrl string `json:"-"`
	// contains filtered or unexported fields
}

func NewDataNode

func NewDataNode(id string) *DataNode

func (*DataNode) AddVolume

func (dn *DataNode) AddVolume(v *volume.VolumeInfo)

func (*DataNode) Url

func (dn *DataNode) Url() string

type DataRack

type DataRack struct {
	DataNode map[string]*DataNode `json:"DataNodes"`
	// contains filtered or unexported fields
}

func NewRack

func NewRack() *DataRack

type IDC

type IDC struct {
	DataCenters map[string]*DataCenter `json:"DataCenters"`
	// contains filtered or unexported fields
}

type ManageServer

type ManageServer struct {
	MetaFolder              *string
	VolumeSizeLimitMB       *uint
	Cluster                 *string
	Advertise               *string
	MaxCPU                  *int
	Router                  *mux.Router
	RNode                   *RaftNode
	IDCMtx                  sync.RWMutex
	IDC                     IDC
	DefaultReplicaPlacement *string
}

ManageServer 管理节点结构

func NewManageServer

func NewManageServer() *ManageServer

func (*ManageServer) AllocateVolume

func (s *ManageServer) AllocateVolume(dn *DataNode, vid util.VIDType, option *volume.GrowOption) error

func (*ManageServer) ClusterStatusHandler

func (s *ManageServer) ClusterStatusHandler(w http.ResponseWriter, r *http.Request)

ClusterStatusHandler cluster status

func (*ManageServer) DirStatusHandler

func (s *ManageServer) DirStatusHandler(w http.ResponseWriter, r *http.Request)

DirStatusHandler dir status

func (*ManageServer) GrowVolume

func (s *ManageServer) GrowVolume(option *volume.GrowOption) (int, error)

func (*ManageServer) RegistRouter

func (s *ManageServer) RegistRouter()

RegistRouter 注册ROUTER

func (*ManageServer) SendHeartbeat

func (s *ManageServer) SendHeartbeat(stream pb.Seaweed_SendHeartbeatServer) error

SendHeartbeat 处理心跳入口

func (*ManageServer) StartServer

func (s *ManageServer) StartServer() bool

StartServer start a rpc and http service

func (*ManageServer) StatusHandler

func (s *ManageServer) StatusHandler(w http.ResponseWriter, r *http.Request)

StatusHandler Server status

func (*ManageServer) VolGrowHandler

func (s *ManageServer) VolGrowHandler(w http.ResponseWriter, r *http.Request)

type Member

type Member struct {
	ID   uint64
	Urls string
}

type RaftNode

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

RaftNode A key-value stream backed by raft

func (*RaftNode) IsIDRemoved

func (rc *RaftNode) IsIDRemoved(id uint64) bool

IsIDRemoved removed

func (*RaftNode) Lookup

func (s *RaftNode) Lookup(key string) (string, bool)

func (*RaftNode) NewMembers

func (rc *RaftNode) NewMembers(advertise, cluster string) error

func (*RaftNode) Process

func (rc *RaftNode) Process(ctx context.Context, m raftpb.Message) error

Process Raft node process

func (*RaftNode) Propose

func (s *RaftNode) Propose(k string, v string)

func (*RaftNode) ReadCommitC

func (rc *RaftNode) ReadCommitC() <-chan *string

ReadCommitC Read commitC

func (*RaftNode) ReadErrorC

func (rc *RaftNode) ReadErrorC() <-chan error

ReadErrorC Read ErrorC

func (*RaftNode) ReadStatus

func (rc *RaftNode) ReadStatus() (stat util.ClusterStatusResult)

ReadStatus Read node status

func (*RaftNode) ReportSnapshot

func (rc *RaftNode) ReportSnapshot(id uint64, status raft.SnapshotStatus)

ReportSnapshot Report Snapshot

func (*RaftNode) ReportUnreachable

func (rc *RaftNode) ReportUnreachable(id uint64)

ReportUnreachable Report Unreachable

func (*RaftNode) WriteProposeC

func (rc *RaftNode) WriteProposeC() chan<- string

WriteProposeC Write Propose

func (*RaftNode) WriteSnapshotter

func (rc *RaftNode) WriteSnapshotter() chan<- *snap.Snapshotter

WriteProposeC Write Propose

Jump to

Keyboard shortcuts

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