master

package
v0.0.0-...-61472b1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_VOLUME_MAX_FREE_SIZE uint64 = 10 * (1 << 30)

Variables

View Source
var (
	OsUid = uint32(os.Getuid())
	OsGid = uint32(os.Getgid())
)
View Source
var MaxHeartbeatDuration = time.Second * 10 //如果超过这个时间间隔仍然没有心跳认定失联

Functions

func CreateVolume

func CreateVolume(host string, port int, vid uint64) error

func Delete

func Delete(host string, port int, vid uint64, fid uint64) error

Types

type Entry

type Entry struct {
	FilePath    string
	FileSize    uint64
	Vid         uint64
	Nid         uint64
	Uid         uint32
	Gid         uint32
	Mode        uint32
	Ctime       time.Time //8 bytes
	Mtime       time.Time //8 bytes
	IsDirectory bool
}

type HbaseStore

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

func NewHbaseStore

func NewHbaseStore(config *config.Config) (store *HbaseStore, err error)

func (*HbaseStore) Close

func (store *HbaseStore) Close() error

func (*HbaseStore) Delete

func (store *HbaseStore) Delete(filePath string) error

func (*HbaseStore) Get

func (store *HbaseStore) Get(filePath string) (vid uint64, fid uint64, err error)

func (*HbaseStore) GetEntries

func (store *HbaseStore) GetEntries(filePath string) (Entries []*Entry, err error)

func (*HbaseStore) Set

func (store *HbaseStore) Set(filePath string, vid uint64, fid uint64) error

type Master

type Master struct {
	MasterServer *http.ServeMux
	MasterHost   string
	MasterPort   int

	StorageStatusList []*StorageStatus

	// key: volume id  value: volume status List
	VolumeStatusListMap map[uint64][]*VolumeStatus
	MapMutex            sync.RWMutex
	Metadata            metadata

	//只要现在的Volume少于MaxVolumeNum,就可以一直增加新的Volume
	MaxVolumeNum int

	Cache *MetaCache
}

func NewMaster

func NewMaster(config *config.Config) (*Master, error)

func (*Master) Close

func (m *Master) Close()

func (*Master) Start

func (m *Master) Start()

type MetaCache

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

type MetaID

type MetaID struct {
	VID uint64
	NID uint64
}

type MetadataCassandra

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

func NewCassandraMetaStore

func NewCassandraMetaStore(config *config.Config) (c *MetadataCassandra, err error)

func (*MetadataCassandra) Close

func (c *MetadataCassandra) Close() error

func (*MetadataCassandra) Delete

func (c *MetadataCassandra) Delete(filePath string) error

func (*MetadataCassandra) Get

func (c *MetadataCassandra) Get(filePath string) (vid, nid uint64, err error)

func (*MetadataCassandra) GetEntries

func (c *MetadataCassandra) GetEntries(filePath string) (Entries []*Entry, err error)

func (*MetadataCassandra) Set

func (c *MetadataCassandra) Set(filePath string, vid, nid uint64) error

type MetadataClickHouse

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

func NewClickHouseMetaStore

func NewClickHouseMetaStore(config *config.Config) (c *MetadataClickHouse, err error)

func (*MetadataClickHouse) Close

func (c *MetadataClickHouse) Close() error

func (*MetadataClickHouse) Delete

func (c *MetadataClickHouse) Delete(filePath string) error

func (*MetadataClickHouse) Get

func (c *MetadataClickHouse) Get(filePath string) (vid, nid uint64, err error)

func (*MetadataClickHouse) GetEntries

func (c *MetadataClickHouse) GetEntries(filePath string) (Entries []*Entry, err error)

func (*MetadataClickHouse) Set

func (c *MetadataClickHouse) Set(filePath string, vid, nid uint64) error

type MetadataLevelDB

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

func NewLevelDBMetaStore

func NewLevelDBMetaStore(config *config.Config) (m *MetadataLevelDB, err error)

func (*MetadataLevelDB) Close

func (m *MetadataLevelDB) Close() error

func (*MetadataLevelDB) Delete

func (m *MetadataLevelDB) Delete(filePath string) error

func (*MetadataLevelDB) Get

func (m *MetadataLevelDB) Get(filePath string) (vid, nid uint64, err error)

func (*MetadataLevelDB) GetEntries

func (m *MetadataLevelDB) GetEntries(filePath string) (Entries []*Entry, err error)

func (*MetadataLevelDB) Set

func (m *MetadataLevelDB) Set(filePath string, vid, nid uint64) error

type MetadataRedis2

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

func NewRedis2Store

func NewRedis2Store(config *config.Config) (*MetadataRedis2, error)

func (*MetadataRedis2) Close

func (m *MetadataRedis2) Close() error

func (*MetadataRedis2) Delete

func (m *MetadataRedis2) Delete(filePath string) error

func (*MetadataRedis2) Get

func (m *MetadataRedis2) Get(filePath string) (vid, nid uint64, err error)

func (*MetadataRedis2) GetEntries

func (m *MetadataRedis2) GetEntries(filePath string) (Entries []*Entry, err error)

func (*MetadataRedis2) Set

func (m *MetadataRedis2) Set(filePath string, vid, nid uint64) error

type Size

type Size interface {
	Size() int64
}

type StorageStatus

type StorageStatus struct {
	ApiHost string
	ApiPort int

	DiskSize        uint64
	DiskUsed        uint64
	DiskFree        uint64
	CanCreateVolume bool

	VolumeMaxSize uint64

	LastHeartbeat time.Time `json:"-"`

	VStatusList []*VolumeStatus
}

func (*StorageStatus) CreateVolume

func (ss *StorageStatus) CreateVolume(volumeId uint64) error

func (*StorageStatus) IsAlive

func (ss *StorageStatus) IsAlive() bool

type VolumeStatus

type VolumeStatus struct {
	VolumeId          uint64
	VolumeSize        uint64
	VolumeMaxFreeSize uint64

	Writable bool

	StoreStatus *StorageStatus `json:"-"`
}

func (*VolumeStatus) Delete

func (vs *VolumeStatus) Delete(fid uint64) error

func (*VolumeStatus) GetEntryUrl

func (vs *VolumeStatus) GetEntryUrl(fid uint64) string

func (*VolumeStatus) GetFileUrl

func (vs *VolumeStatus) GetFileUrl(fid uint64) string

func (*VolumeStatus) HasEnoughSpace

func (vs *VolumeStatus) HasEnoughSpace() bool

func (*VolumeStatus) IsWritable

func (vs *VolumeStatus) IsWritable(size uint64) bool

func (*VolumeStatus) UploadFile

func (vs *VolumeStatus) UploadFile(fid uint64, data *[]byte, fileName string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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