normaldb

package
v0.0.0-...-303e327 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiskInfoVersionNormal = iota + 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskInfoRecord

type DiskInfoRecord struct {
	Version      uint8            `json:"-"`
	DiskID       proto.DiskID     `json:"disk_id"`
	ClusterID    proto.ClusterID  `json:"cluster_id"`
	Idc          string           `json:"idc"`
	Rack         string           `json:"rack"`
	Host         string           `json:"host"`
	Path         string           `json:"path"`
	Status       proto.DiskStatus `json:"status"`
	Readonly     bool             `json:"readonly"`
	MaxChunkCnt  int64            `json:"max_chunk_cnt"`
	FreeChunkCnt int64            `json:"free_chunk_cnt"`
	UsedChunkCnt int64            `json:"used_chunk_cnt"`
	CreateAt     time.Time        `json:"create_time"`
	LastUpdateAt time.Time        `json:"last_update_time"`
	Size         int64            `json:"size"`
	Used         int64            `json:"used"`
	Free         int64            `json:"free"`
}

type DiskTable

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

func OpenDiskTable

func OpenDiskTable(db kvstore.KVStore, ensureIndex bool) (*DiskTable, error)

func (*DiskTable) AddDisk

func (d *DiskTable) AddDisk(info *DiskInfoRecord) error

func (*DiskTable) DeleteDisk

func (d *DiskTable) DeleteDisk(diskID proto.DiskID) error

func (*DiskTable) GetAllDisks

func (d *DiskTable) GetAllDisks() ([]*DiskInfoRecord, error)

return all disk info in memory

func (*DiskTable) GetDisk

func (d *DiskTable) GetDisk(diskID proto.DiskID) (info *DiskInfoRecord, err error)

func (*DiskTable) ListDisk

func (d *DiskTable) ListDisk(opt *clustermgr.ListOptionArgs) ([]*DiskInfoRecord, error)

func (*DiskTable) UpdateDisk

func (d *DiskTable) UpdateDisk(diskID proto.DiskID, info *DiskInfoRecord) error

func (*DiskTable) UpdateDiskStatus

func (d *DiskTable) UpdateDiskStatus(diskID proto.DiskID, status proto.DiskStatus) error

update disk status should remove old index and insert new index

type DroppedDiskTable

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

func OpenDroppedDiskTable

func OpenDroppedDiskTable(db kvstore.KVStore) (*DroppedDiskTable, error)

func (*DroppedDiskTable) AddDroppingDisk

func (d *DroppedDiskTable) AddDroppingDisk(diskId proto.DiskID) error

AddDroppingDisk add a dropping disk

func (*DroppedDiskTable) DroppedDisk

func (d *DroppedDiskTable) DroppedDisk(diskId proto.DiskID) error

DroppedDisk finish dropping in a disk

func (*DroppedDiskTable) GetAllDroppingDisk

func (d *DroppedDiskTable) GetAllDroppingDisk() ([]proto.DiskID, error)

GetAllDroppingDisk return all drop disk in memory

func (*DroppedDiskTable) IsDroppingDisk

func (d *DroppedDiskTable) IsDroppingDisk(diskId proto.DiskID) (exist bool, err error)

GetDroppingDisk find a dropping disk if exist

type NormalDB

type NormalDB struct {
	kvstore.KVStore
}

func OpenNormalDB

func OpenNormalDB(path string, isSync bool, dbOpts ...kvstore.DbOptions) (*NormalDB, error)

func (*NormalDB) Close

func (n *NormalDB) Close() error

func (*NormalDB) GetAllCfNames

func (n *NormalDB) GetAllCfNames() []string

type ScopeTable

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

func OpenScopeTable

func OpenScopeTable(db kvstore.KVStore) (*ScopeTable, error)

func (*ScopeTable) Get

func (s *ScopeTable) Get(name string) (uint64, error)

func (*ScopeTable) Load

func (s *ScopeTable) Load() (map[string]uint64, error)

func (*ScopeTable) Put

func (s *ScopeTable) Put(name string, commit uint64) error

type ServiceTable

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

func OpenServiceTable

func OpenServiceTable(db *NormalDB) *ServiceTable

func (*ServiceTable) Delete

func (s *ServiceTable) Delete(sname, host string) (err error)

func (*ServiceTable) Get

func (s *ServiceTable) Get(sname string) ([][]byte, error)

func (*ServiceTable) Put

func (s *ServiceTable) Put(sname, host string, data []byte) (err error)

func (*ServiceTable) Range

func (s *ServiceTable) Range(f func(key, val []byte) bool) error

Jump to

Keyboard shortcuts

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