storage

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: 19 Imported by: 0

Documentation

Index

Constants

View Source
const HeartBeatInterval time.Duration = time.Second * 5

per 5 secs the store server send a heartbeat http request to master

Variables

View Source
var MaxDiskUsedPercent uint = 90

Functions

func FileKey

func FileKey(vid, nid uint64) string

func NeedleKey

func NeedleKey(vid, nid uint64) string

Types

type NeedleCache

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

func (*NeedleCache) DelNeedle

func (n *NeedleCache) DelNeedle(vid, nid uint64) (err error)

DelMeta del meta from cache.

func (*NeedleCache) GetNeedle

func (n *NeedleCache) GetNeedle(vid, nid uint64) (needle *volume.Needle, err error)

func (*NeedleCache) SetNeedle

func (n *NeedleCache) SetNeedle(vid, nid uint64, needle *volume.Needle) (err error)

type Size

type Size interface {
	Size() int64
}

type Store

type Store struct {
	Volumes    map[uint64]*volume.Volume
	NeedleLock sync.RWMutex

	StoreDir string //Store对应的目录,该目录下存放着各个Volume File

	//get/upload/delete file
	ApiServer *http.ServeMux
	ApiHost   string
	ApiPort   int

	// each store server connects to a master server
	MasterHost string
	MasterPort int

	Directory *volume.LeveldbDirectory
	Cache     *NeedleCache
}

one store contains several volumes

func NewStore

func NewStore(config *config.Config) (*Store, error)

func (*Store) AddVolume

func (s *Store) AddVolume(w http.ResponseWriter, r *http.Request)

func (*Store) Close

func (store *Store) Close()

func (*Store) Del

func (s *Store) Del(w http.ResponseWriter, r *http.Request)

func (*Store) Get

func (s *Store) Get(w http.ResponseWriter, r *http.Request)

func (*Store) HeartBeat

func (store *Store) HeartBeat()

func (*Store) Put

func (s *Store) Put(w http.ResponseWriter, r *http.Request)

func (*Store) Start

func (store *Store) Start()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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