types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MountPointStatusMounted   = "mounted"
	MountPointStatusUnmounted = "unmounted"
	MountPointStatusLost      = "lost"
	MountPointStatusError     = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auths

type Auths map[string]string

type Config

type Config struct {
	BaseDir string `yaml:"-"`
	Path    string `yaml:"-"`

	OpenBoltTimeout time.Duration `yaml:"openBoltTimeout"`

	Fs *FilesystemConfig `yaml:"fs"`

	Auths Auths `yaml:"auths"`
}

func LoadConfig

func LoadConfig() (*Config, error)

type Entry

type Entry struct {
	Path string
	Name string

	IsDir bool

	IsSymLink bool
	LinkName  string

	Size int64

	WebUrl string
}

type FilesystemConfig

type FilesystemConfig struct {
	AllowOthers  bool          `yaml:"allowOthers"`
	EntryTimeout time.Duration `yaml:"entryTimeout"`

	Debug bool `yaml:"debug"`
}

type FilesystemMounter

type FilesystemMounter interface {
	Mount(mp *MountPoint) error
}

type MountPoint

type MountPoint struct {
	Repo *Repository `json:"repo"`

	Path string `json:"path"`

	LogPath string `json:"logPath"`

	CreateTime int64 `json:"createTime"`
}

func NewMountPoint

func NewMountPoint(repo *Repository, path, logDir string) (*MountPoint, error)

func (*MountPoint) Display

func (mp *MountPoint) Display() *MountPointDisplay

func (*MountPoint) GetStatus

func (mp *MountPoint) GetStatus() (MountPointStatus, string)

func (*MountPoint) Mount

func (mp *MountPoint) Mount(fsMounter FilesystemMounter) error

func (*MountPoint) Unmount

func (mp *MountPoint) Unmount() error

func (*MountPoint) Validate

func (mp *MountPoint) Validate() error

type MountPointDisplay

type MountPointDisplay struct {
	MountPoint

	Status MountPointStatus `json:"status,omitempty"`

	ErrorMessage string `json:"errMsg,omitempty"`
}

type MountPointMetadata

type MountPointMetadata interface {
	Put(mp *MountPoint) error
	Get(repo *Repository) (*MountPoint, error)
	List() ([]*MountPoint, error)
	Remove(mp *MountPoint) error
	Close() error
}

type MountPointStatus

type MountPointStatus string

func (MountPointStatus) Color

func (s MountPointStatus) Color() string

type Provider

type Provider interface {
	Check(ctx context.Context) error

	ReadDir(ctx context.Context, path string) ([]*Entry, error)
	ReadFile(ctx context.Context, path string) ([]byte, error)
}

type Repository

type Repository struct {
	Domain string `json:"domain"`

	Owner string `json:"owner"`
	Name  string `json:"name"`

	Ref string `json:"ref"`
}

func ParseRepository

func ParseRepository(url string) (*Repository, error)

func (*Repository) IsGithub

func (r *Repository) IsGithub() bool

func (*Repository) Path

func (r *Repository) Path() string

func (*Repository) String

func (r *Repository) String() string

func (*Repository) Validate

func (r *Repository) Validate() error

Jump to

Keyboard shortcuts

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