Documentation ¶
Index ¶
- Variables
- type FileLocker
- type IndexLocker
- func (i *IndexLocker) Add(id string, name string) *LockInfo
- func (i *IndexLocker) Error(id string, name string, err error)
- func (i *IndexLocker) Get(id string, name string) *LockInfo
- func (i *IndexLocker) GetAll() map[string]map[string]*LockInfo
- func (i *IndexLocker) Remove(id string, name string)
- func (i *IndexLocker) RemoveOld(hours int)
- type LockInfo
- type NodeLock
- type NodeLocker
- func (l *NodeLocker) Add(id string)
- func (l *NodeLocker) GetAll() (nodes []*NodeLock)
- func (l *NodeLocker) GetLocked() (nodes []*NodeLock)
- func (l *NodeLocker) LockNode(id string) (err error)
- func (l *NodeLocker) Remove(id string)
- func (l *NodeLocker) RemoveOld(hours int)
- func (l *NodeLocker) UnlockNode(id string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NodeLockMgr = NewNodeLocker() FileLockMgr = NewFileLocker() IndexLockMgr = NewIndexLocker() )
Functions ¶
This section is empty.
Types ¶
type FileLocker ¶
func NewFileLocker ¶
func NewFileLocker() *FileLocker
FileLocker prevents a node file from being downloaded while locked
func (*FileLocker) Add ¶
func (f *FileLocker) Add(id string) *LockInfo
func (*FileLocker) Error ¶
func (f *FileLocker) Error(id string, err error)
func (*FileLocker) Get ¶
func (f *FileLocker) Get(id string) *LockInfo
func (*FileLocker) GetAll ¶
func (f *FileLocker) GetAll() map[string]*LockInfo
func (*FileLocker) Remove ¶
func (f *FileLocker) Remove(id string)
func (*FileLocker) RemoveOld ¶
func (f *FileLocker) RemoveOld(hours int)
type IndexLocker ¶
func NewIndexLocker ¶
func NewIndexLocker() *IndexLocker
IndexLocker prevents a node file from being downloaded using the locked index
func (*IndexLocker) Remove ¶
func (i *IndexLocker) Remove(id string, name string)
func (*IndexLocker) RemoveOld ¶
func (i *IndexLocker) RemoveOld(hours int)
type LockInfo ¶
type LockInfo struct { CreatedOn time.Time `bson:"-" json:"created_on"` Error string `bson:"-" json:"error"` }
func NewLockInfo ¶
func NewLockInfo() *LockInfo
type NodeLock ¶
type NodeLock struct { Id string `bson:"-" json:"id"` IsLocked bool `bson:"-" json:"locked"` Updated time.Time `bson:"-" json:"updated_on"` // contains filtered or unexported fields }
func NewNodeLock ¶
type NodeLocker ¶
func NewNodeLocker ¶
func NewNodeLocker() *NodeLocker
NodeLocker prevents a process from loading node from mongo while another process is update the same node
func (*NodeLocker) Add ¶
func (l *NodeLocker) Add(id string)
func (*NodeLocker) GetAll ¶
func (l *NodeLocker) GetAll() (nodes []*NodeLock)
func (*NodeLocker) GetLocked ¶
func (l *NodeLocker) GetLocked() (nodes []*NodeLock)
func (*NodeLocker) LockNode ¶
func (l *NodeLocker) LockNode(id string) (err error)
func (*NodeLocker) Remove ¶
func (l *NodeLocker) Remove(id string)
func (*NodeLocker) RemoveOld ¶
func (l *NodeLocker) RemoveOld(hours int)
func (*NodeLocker) UnlockNode ¶
func (l *NodeLocker) UnlockNode(id string)
Click to show internal directories.
Click to hide internal directories.