clib

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeUntracked                 = -999 + iota // -999
	CodeRepoPathInvalid                         // -998  repo path error, could cause from path not exists, or removed by others, or repo path permission denied
	CodeClibRequestInvalid                      // -997  clib request invalid, need to fix
	CodeClibResponseInvalid                     // -996  clib response invalid, need to fix
	CodeSignHashEmpty                           // -995  args Hash can not empty
	CodeOpenPathError                           // -994  repo path open failed, due to a invalid user permission or repo path was occupied by other process or other error
	CodePrivateKeyError                         // -993  private key error, could caused by repo path issues, or need to fix
	CodeConfigInvalid                           // -992  config file in repo is config.toml, check the specified message to fix
	CodeConfigStoragePathInvalid                // -991  storage path in config.toml is invalid, check the specified message to fix
	CodeConfigLocalDiskLoadError                // -990  load config from local disk error, need to fix
	CodeConfigFilePermissionError               // -989  config file have incorrect permission, make sure it's owned by user or belong to a group that user belong to
	CodeDownloadFileFailed                      // -988  file download failed. please check the specified message to fix
	CodeNewEdgeAPIErr                           // -987  new edge api error, please make sure daemon start
	CodeEdgeRestartFailed                       // -986  restart edge api failed, please check the specified message to fix, or restart app manually
	CodeEdgeNetworkErr                          // -985  edge network error, check if the network reachable or you can reach hub node
	CodeWebServerErr                            // -984  start web server error, check if config is right
	CodeFreeUpDiskInProgress                    // -983  Free up disk in progress, due to unavailable disk space
	CodeReqDiskFreeErr                          // -982  Request disk free error, due to scheduler error
	CodeStateFreeUpDiskErr                      // -981  State free up disk error, due to scheduler error

	CodeDaemonAlreadyStart    // -980  daemon already start
	CodeDaemonIsStarting      // -979  daemon starting
	CodeDaemonStartFailed     // -978  daemon start failed
	CodeDaemonAlreadyStoppped // -977  daemon is stopped
	CodeDaemonStopFailed      // -976  daemon stop failed
	CodeDaemonLogSetError     // - 975  daemon log set error

	CodeSuccess    = 0
	CodeDefaultErr = -1
)

clib error define

Variables

This section is empty.

Functions

This section is empty.

Types

type CLib

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

func NewCLib

func NewCLib(daemonStart daemonStartFunc) *CLib

func (*CLib) JSONCall

func (clib *CLib) JSONCall(jsonStr string) *JSONCallResult

type DaemonSwitch

type DaemonSwitch struct {
	StopChan chan bool
	IsStop   bool
	IsOnline bool
	ErrMsg   string // client immdiate error notice
}

type DownloadCancelReq

type DownloadCancelReq struct {
	FilePath string `json:"file_path"`
}

type DownloadFileReq

type DownloadFileReq struct {
	CID          string `json:"cid"`
	DownloadPath string `json:"download_path"`
	LocatorURL   string `json:"locator_url"`
}

type DownloadProgressReq

type DownloadProgressReq struct {
	FilePath string `json:"file_path"`
}

type DownloadProgressResult

type DownloadProgressResult struct {
	FilePath  string `json:"file_path"`
	Status    string `json:"status"`
	TotalSize int64  `json:"total_size"`
	DoneSize  int64  `json:"done_size"`
}

type Downloader

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

type FreeUpDiskReq added in v0.1.19

type FreeUpDiskReq struct {
	Size float64 `json:"size"`
}

type FreeUpDiskResp added in v0.1.19

type FreeUpDiskResp struct{}

type JSONCallArgs

type JSONCallArgs struct {
	Method     string `json:"method"`
	JSONParams string `json:"jsonParams"`
}

type JSONCallResult

type JSONCallResult struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data string `json:"data"`
}

type MergeConfigReq

type MergeConfigReq struct {
	RepoPath string `json:"repoPath"`
	Config   string `json:"config"`
}

type Progress

type Progress struct {
	TotalSize int64
	DoneSize  func() int64
}

type ProgressReader

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

func (*ProgressReader) Read

func (pr *ProgressReader) Read(p []byte) (n int, err error)

type ReadConfigReq

type ReadConfigReq struct {
	RepoPath string `json:"repoPath"`
}

type SignReq

type SignReq struct {
	RepoPath string `json:"repoPath"`
	Hash     string `json:"hash"`
}

type SignResult

type SignResult struct {
	Signature string `json:"signature"`
}

type StartDaemonReq

type StartDaemonReq struct {
	RepoPath   string `json:"repoPath"`
	LogPath    string `json:"logPath"`
	LocatorURL string `json:"locatorURL"`
	LogRotate  bool   `json:"logRotate"`
}

type StateResult

type StateResult struct {
	Runing bool   `json:"running"`
	Online bool   `json:"online"`
	ErrMsg string `json:"errMsg"`
}

Jump to

Keyboard shortcuts

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