Documentation
¶
Overview ¶
Package persistentcache is a generated GoMock package.
Package persistentcache is a generated GoMock package.
Index ¶
- Constants
- type Build
- type CPU
- type CPUTimes
- type Disk
- type Host
- type HostManager
- type Memory
- type MockHostManager
- func (m *MockHostManager) Delete(arg0 context.Context, arg1 string)
- func (m *MockHostManager) EXPECT() *MockHostManagerMockRecorder
- func (m *MockHostManager) Load(arg0 context.Context, arg1 string) (*Host, bool)
- func (m *MockHostManager) LoadAll(arg0 context.Context) ([]*Host, error)
- func (m *MockHostManager) Store(arg0 context.Context, arg1 *Host)
- type MockHostManagerMockRecorder
- type MockTaskManager
- func (m *MockTaskManager) Delete(arg0 context.Context, arg1 string)
- func (m *MockTaskManager) EXPECT() *MockTaskManagerMockRecorder
- func (m *MockTaskManager) Load(arg0 context.Context, arg1 string) (*Task, bool)
- func (m *MockTaskManager) LoadAll(arg0 context.Context) ([]*Task, error)
- func (m *MockTaskManager) Store(arg0 context.Context, arg1 *Task) error
- type MockTaskManagerMockRecorder
- type Network
- type Task
- type TaskManager
Constants ¶
const ( // Task has been created but did not start uploading. TaskStatePending = "Pending" // Task is uploading resources for p2p cluster. TaskStateUploading = "Uploading" // Task has been uploaded successfully. TaskStateSucceeded = "Succeeded" // Task has been uploaded failed. TaskStateFailed = "Failed" )
const ( // Task is uploading. TaskEventUpload = "Upload" // Task uploaded successfully. TaskEventUploadSucceeded = "UploadSucceeded" // Task uploaded failed. TaskEventUploadFailed = "UploadFailed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Build ¶
type Build struct { // Git version. GitVersion string `csv:"gitVersion"` // Git commit. GitCommit string `csv:"gitCommit"` // Golang version. GoVersion string `csv:"goVersion"` // Build platform. Platform string `csv:"platform"` }
Build contains content for build.
type CPU ¶
type CPU struct { // Number of logical cores in the system. LogicalCount uint32 `csv:"logicalCount"` // Number of physical cores in the system. PhysicalCount uint32 `csv:"physicalCount"` // Percent calculates the percentage of cpu used. Percent float64 `csv:"percent"` // Calculates the percentage of cpu used by process. ProcessPercent float64 `csv:"processPercent"` // Times contains the amounts of time the CPU has spent performing different kinds of work. Times CPUTimes `csv:"times"` }
CPU contains content for cpu.
type CPUTimes ¶
type CPUTimes struct { // CPU time of user. User float64 `csv:"user"` // CPU time of system. System float64 `csv:"system"` // CPU time of idle. Idle float64 `csv:"idle"` // CPU time of nice. Nice float64 `csv:"nice"` // CPU time of iowait. Iowait float64 `csv:"iowait"` // CPU time of irq. Irq float64 `csv:"irq"` // CPU time of softirq. Softirq float64 `csv:"softirq"` // CPU time of steal. Steal float64 `csv:"steal"` // CPU time of guest. Guest float64 `csv:"guest"` // CPU time of guest nice. GuestNice float64 `csv:"guestNice"` }
CPUTimes contains content for cpu times.
type Disk ¶
type Disk struct { // Total amount of disk on the data path of dragonfly. Total uint64 `csv:"total"` // Free amount of disk on the data path of dragonfly. Free uint64 `csv:"free"` // Used amount of disk on the data path of dragonfly. Used uint64 `csv:"used"` // Used percent of disk on the data path of dragonfly directory. UsedPercent float64 `csv:"usedPercent"` // Total amount of indoes on the data path of dragonfly directory. InodesTotal uint64 `csv:"inodesTotal"` // Used amount of indoes on the data path of dragonfly directory. InodesUsed uint64 `csv:"inodesUsed"` // Free amount of indoes on the data path of dragonfly directory. InodesFree uint64 `csv:"inodesFree"` // Used percent of indoes on the data path of dragonfly directory. InodesUsedPercent float64 `csv:"inodesUsedPercent"` }
Disk contains content for disk.
type Host ¶
type Host struct { // ID is host id. ID string // Type is host type. Type types.HostType // Hostname is host name. Hostname string // IP is host ip. IP string // Port is grpc service port. Port int32 // DownloadPort is piece downloading port. DownloadPort int32 // shared with other peers. DisableShared bool // Host OS. OS string // Host platform. Platform string // Host platform family. PlatformFamily string // Host platform version. PlatformVersion string // Host kernel version. KernelVersion string // CPU Stat. CPU CPU // Memory Stat. Memory Memory // Network Stat. Network Network // Dist Stat. Disk Disk // Build information. Build Build // AnnounceInterval is the interval between host announces to scheduler. AnnounceInterval time.Duration // ConcurrentUploadLimit is concurrent upload limit count. ConcurrentUploadLimit int32 // ConcurrentUploadCount is concurrent upload count. ConcurrentUploadCount int32 // UploadCount is total upload count. UploadCount int64 // UploadFailedCount is upload failed count. UploadFailedCount int64 // CreatedAt is host create time. CreatedAt time.Time // UpdatedAt is host update time. UpdatedAt time.Time // Host log. Log *logger.SugaredLoggerOnWith }
Host contains content for host.
func NewHost ¶
func NewHost( id, hostname, ip, os, platform, platformFamily, platformVersion, kernelVersion string, port, downloadPort, concurrentUploadLimit, concurrentUploadCount int32, UploadCount, UploadFailedCount int64, disableShared bool, typ types.HostType, cpu CPU, memory Memory, network Network, disk Disk, build Build, announceInterval time.Duration, createdAt, updatedAt time.Time, log *logger.SugaredLoggerOnWith, ) *Host
New host instance.
type HostManager ¶
type HostManager interface { // Load returns host for a key. Load(context.Context, string) (*Host, bool) // Store sets host. Store(context.Context, *Host) // Delete deletes host for a key. Delete(context.Context, string) // LoadAll returns all hosts. LoadAll(context.Context) ([]*Host, error) }
HostManager is the interface used for host manager.
type Memory ¶
type Memory struct { // Total amount of RAM on this system. Total uint64 `csv:"total"` // RAM available for programs to allocate. Available uint64 `csv:"available"` // RAM used by programs. Used uint64 `csv:"used"` // Percentage of RAM used by programs. UsedPercent float64 `csv:"usedPercent"` // Calculates the percentage of memory used by process. ProcessUsedPercent float64 `csv:"processUsedPercent"` // This is the kernel's notion of free memory. Free uint64 `csv:"free"` }
Memory contains content for memory.
type MockHostManager ¶
type MockHostManager struct {
// contains filtered or unexported fields
}
MockHostManager is a mock of HostManager interface.
func NewMockHostManager ¶
func NewMockHostManager(ctrl *gomock.Controller) *MockHostManager
NewMockHostManager creates a new mock instance.
func (*MockHostManager) Delete ¶
func (m *MockHostManager) Delete(arg0 context.Context, arg1 string)
Delete mocks base method.
func (*MockHostManager) EXPECT ¶
func (m *MockHostManager) EXPECT() *MockHostManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockHostManagerMockRecorder ¶
type MockHostManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockHostManagerMockRecorder is the mock recorder for MockHostManager.
func (*MockHostManagerMockRecorder) Delete ¶
func (mr *MockHostManagerMockRecorder) Delete(arg0, arg1 any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockHostManagerMockRecorder) Load ¶
func (mr *MockHostManagerMockRecorder) Load(arg0, arg1 any) *gomock.Call
Load indicates an expected call of Load.
type MockTaskManager ¶
type MockTaskManager struct {
// contains filtered or unexported fields
}
MockTaskManager is a mock of TaskManager interface.
func NewMockTaskManager ¶
func NewMockTaskManager(ctrl *gomock.Controller) *MockTaskManager
NewMockTaskManager creates a new mock instance.
func (*MockTaskManager) Delete ¶
func (m *MockTaskManager) Delete(arg0 context.Context, arg1 string)
Delete mocks base method.
func (*MockTaskManager) EXPECT ¶
func (m *MockTaskManager) EXPECT() *MockTaskManagerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockTaskManagerMockRecorder ¶
type MockTaskManagerMockRecorder struct {
// contains filtered or unexported fields
}
MockTaskManagerMockRecorder is the mock recorder for MockTaskManager.
func (*MockTaskManagerMockRecorder) Delete ¶
func (mr *MockTaskManagerMockRecorder) Delete(arg0, arg1 any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockTaskManagerMockRecorder) Load ¶
func (mr *MockTaskManagerMockRecorder) Load(arg0, arg1 any) *gomock.Call
Load indicates an expected call of Load.
type Network ¶
type Network struct { // Return count of tcp connections opened and status is ESTABLISHED. TCPConnectionCount uint32 `csv:"tcpConnectionCount"` // Return count of upload tcp connections opened and status is ESTABLISHED. UploadTCPConnectionCount uint32 `csv:"uploadTCPConnectionCount"` // Location path(area|country|province|city|...). Location string `csv:"location"` // IDC where the peer host is located IDC string `csv:"idc"` // Download rate of the host, unit is byte/s. DownloadRate uint64 `csv:"downloadRate"` // Download rate limit of the host, unit is byte/s. DownloadRateLimit uint64 `csv:"downloadRateLimit"` // Upload rate of the host, unit is byte/s. UploadRate uint64 `csv:"uploadRate"` // Upload rate limit of the host, unit is byte/s. UploadRateLimit uint64 `csv:"uploadRateLimit"` }
Network contains content for network.
type Task ¶
type Task struct { // ID is task id. ID string // Replica count of the persistent cache task. The persistent cache task will // not be deleted when dfdamon runs garbage collection. It only be deleted // when the task is deleted by the user. PersistentReplicaCount uint64 // Replica count of the cache task. If cache task is not persistent, // the persistent cache task will be deleted when dfdaemon runs garbage collection. ReplicaCount uint64 // Digest of the persistent cache task content, for example md5:xxx or sha256:yyy. Digest *digest.Digest // Tag is used to distinguish different persistent cache tasks. Tag string // Application of persistent cache task. Application string // Persistet cache task piece length. PieceLength int32 // ContentLength is persistent cache task total content length. ContentLength int64 // TotalPieceCount is total piece count. TotalPieceCount int32 // Persistent cache task state machine. FSM *fsm.FSM // TTL is persistent cache task time to live. TTL time.Duration // CreatedAt is persistent cache task create time. CreatedAt time.Time // UpdatedAt is persistent cache task update time. UpdatedAt time.Time // Persistent cache task log. Log *logger.SugaredLoggerOnWith }
Task contains content for persistent cache task.
func NewTask ¶
func NewTask(id, tag, application, state string, persistentReplicaCount uint64, replicaCount uint64, pieceLength int32, contentLength int64, totalPieceCount int32, digest *digest.Digest, ttl time.Duration, createdAt, updatedAt time.Time, log *logger.SugaredLoggerOnWith) *Task
New persistent cache task instance.
type TaskManager ¶
type TaskManager interface { // Load returns persistent cache task for a key. Load(context.Context, string) (*Task, bool) // Store sets persistent cache task. Store(context.Context, *Task) error // Delete deletes persistent cache task for a key. Delete(context.Context, string) // LoadAll returns all persistent cache tasks. LoadAll(context.Context) ([]*Task, error) }
TaskManager is the interface used for persistent cache task manager.