Documentation
¶
Overview ¶
Package memorymanager implements the storage client memory management methods
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryManager ¶
type MemoryManager struct {
// contains filtered or unexported fields
}
MemoryManager manages the memory requested by the user, blocking any process which needs memory but memory available is not enough once finished using the memory, those memory need to be returned
func New ¶
func New(limit uint64, stopChan <-chan struct{}) *MemoryManager
New create and initialize new memory manager object used to acquire memory. If the amount of memory required is not available, the process will be blocked until memory became available
func (*MemoryManager) MemoryAvailable ¶
func (mm *MemoryManager) MemoryAvailable() uint64
MemoryAvailable returns current memory available
func (*MemoryManager) MemoryLimit ¶
func (mm *MemoryManager) MemoryLimit() uint64
MemoryLimit returns max memory allowed
func (*MemoryManager) Request ¶
func (mm *MemoryManager) Request(amount uint64, priority bool) bool
Request will try to get memory requested, return true if succeed if failed, the storageClient process will be blocked until the memory can be allocated
func (*MemoryManager) Return ¶
func (mm *MemoryManager) Return(amount uint64)
Return will return memory requested and processing memory requests in the waitlist
func (*MemoryManager) SetMemoryLimit ¶
func (mm *MemoryManager) SetMemoryLimit(amount uint64) string
SetMemoryLimit allows user to expand or shrink the current memory limit