protocol

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version                = "v2"
	InitKodoMountCmdName   = "init_kodo_mount"
	InitKodoFsMountCmdName = "init_kodofs_mount"
	KodoUmountCmdName      = "umount_kodo"
	RequestDataCmdName     = "request_data"
	ResponseDataCmdName    = "response_data"
	TerminateCmdName       = "terminate"
)
View Source
const (
	// KodoFS executable name
	KodoFSCmd = "/usr/local/bin/kodofs"
	// Rclone executable name
	RcloneCmd = "/usr/local/bin/rclone"

	ContextKeyConfigFilePath contextKey = "config_file_path"
	ContextKeyUserAgent      contextKey = "user_agent"
	ContextKeyLogFilePath    contextKey = "log_file_path"
	ContextKeyCacheDirPath   contextKey = "cache_dir_path"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd interface {
	Command()
}

Cmd is the interface that wraps the Command method.

type ExecutableCmd

type ExecutableCmd interface {
	Cmd
	ExecCommand(context.Context) *exec.Cmd
}

ExecutableCmd is the interface that wraps the ExecCommand method.

type InitKodoFSMountCmd

type InitKodoFSMountCmd struct {
	VolumeId        string `json:"volume_id"`
	GatewayID       string `json:"gateway_id"`
	MountPath       string `json:"mount_path"`
	SubDir          string `json:"sub_dir"`
	MayRunOnSystemd bool   `json:"may_run_on_systemd"`
}

func (*InitKodoFSMountCmd) Command

func (*InitKodoFSMountCmd) Command()

func (*InitKodoFSMountCmd) ExecCommand

func (c *InitKodoFSMountCmd) ExecCommand(ctx context.Context) *exec.Cmd

type InitKodoMountCmd

type InitKodoMountCmd struct {
	VolumeId              string  `json:"volume_id"`
	MountPath             string  `json:"mount_path"`
	SubDir                string  `json:"sub_dir"`
	AccessKey             string  `json:"access_key"`
	SecretKey             string  `json:"secret_key"`
	BucketId              string  `json:"bucket_id"`
	S3Region              string  `json:"s3_region"`
	S3Endpoint            string  `json:"s3_endpoint"`
	S3ForcePathStyle      bool    `json:"s3_force_path_style"`
	StorageClass          string  `json:"storage_class"`
	VfsCacheMode          string  `json:"vfs_cache_mode,omitempty"`
	DirCacheDuration      string  `json:"dir_cache_duration,omitempty"`
	BufferSize            *uint64 `json:"buffer_size,omitempty"`
	VfsCacheMaxAge        string  `json:"vfs_cache_max_age,omitempty"`
	VfsCachePollInterval  string  `json:"vfs_cache_poll_interval,omitempty"`
	VfsWriteBack          string  `json:"vfs_write_back,omitempty"`
	VfsCacheMaxSize       *uint64 `json:"vfs_cache_max_size,omitempty"`
	VfsReadAhead          *uint64 `json:"vfs_read_ahead,omitempty"`
	VfsFastFingerPrint    bool    `json:"vfs_fast_finger_print,omitempty"`
	VfsReadChunkSize      *uint64 `json:"vfs_read_chunk_size,omitempty"`
	VfsReadChunkSizeLimit *uint64 `json:"vfs_read_chunk_size_limit,omitempty"`
	NoCheckSum            bool    `json:"no_cache_sum,omitempty"`
	NoModTime             bool    `json:"no_mod_time,omitempty"`
	NoSeek                bool    `json:"no_seek,omitempty"`
	ReadOnly              bool    `json:"read_only,omitempty"`
	VfsReadWait           string  `json:"vfs_read_wait,omitempty"`
	VfsWriteWait          string  `json:"vfs_write_wait,omitempty"`
	Transfers             *uint64 `json:"transfers,omitempty"`
	VfsDiskSpaceTotalSize *uint64 `json:"vfs_disk_space_total_size,omitempty"`
	UploadCutoff          *uint64 `json:"upload_cutoff,omitempty"`
	UploadChunkSize       *uint64 `json:"upload_chunk_size,omitempty"`
	UploadConcurrency     *uint64 `json:"upload_concurrency,omitempty"`
	WriteBackCache        bool    `json:"write_back_cache,omitempty"`
	DebugHttp             bool    `json:"debug_http,omitempty"`
	DebugFuse             bool    `json:"debug_fuse,omitempty"`
	MayRunOnSystemd       bool    `json:"may_run_on_systemd"`
}

func (*InitKodoMountCmd) Command

func (*InitKodoMountCmd) Command()

func (*InitKodoMountCmd) ExecCommand

func (c *InitKodoMountCmd) ExecCommand(ctx context.Context) *exec.Cmd

ExecCommand 实际上Kodo的挂载是基于rclone的,这里的ExecCommand是将配置转换为rclone的命令行参数并执行

type KodoUmountCmd

type KodoUmountCmd struct {
	VolumeId  string `json:"volume_id"`
	MountPath string `json:"mount_path"`
}

func (*KodoUmountCmd) Command

func (*KodoUmountCmd) Command()

type Request

type Request struct {
	Version string          `json:"version"`
	Cmd     string          `json:"cmd"`
	Payload json.RawMessage `json:"payload"`
}

type RequestDataCmd

type RequestDataCmd struct {
	Data string `json:"data"`
}

func (*RequestDataCmd) Command

func (*RequestDataCmd) Command()

type ResponseDataCmd

type ResponseDataCmd struct {
	IsError bool   `json:"is_error"`
	Data    string `json:"data"`
}

func (*ResponseDataCmd) Command

func (*ResponseDataCmd) Command()

type TerminateCmd

type TerminateCmd struct {
	Code int `json:"code"`
}

func (*TerminateCmd) Command

func (*TerminateCmd) Command()

Jump to

Keyboard shortcuts

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