types

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PermOwnerRead   = "owner_read"
	PermOwnerWrite  = "owner_write"
	PermOwnerExec   = "owner_exec"
	PermGroupRead   = "group_read"
	PermGroupWrite  = "group_write"
	PermGroupExec   = "group_exec"
	PermOthersRead  = "others_read"
	PermOthersWrite = "others_write"
	PermOthersExec  = "others_exec"
	PermSetUid      = "set_uid"
	PermSetGid      = "set_gid"
	PermSticky      = "sticky"
)
View Source
const (
	ScheduledTaskInitial   = "initial"
	ScheduledTaskWait      = "wait"
	ScheduledTaskExecuting = "executing"
	ScheduledTaskFinish    = "finish"
)
View Source
const (
	/*
		system-wide kind
	*/
	GroupKind       = "group"
	SmartGroupKind  = "smtgroup"
	MirrorGroupKind = "mirrorgroup"

	/*
		text based file kind
	*/
	TextKind = "text"

	/*
		format doc kind
	*/
	FmtDocKind = "fmtdoc"

	/*
		media file kind
	*/
	ImageKind = "image"
	VideoKind = "video"
	AudioKind = "audio"

	/*
		web based file kind
	*/
	WebArchiveKind = "web"

	/*
		workflow kind
	*/
	WorkflowKind = "workflow"
	JobKind      = "job"

	/*
		time management system object kind
	*/
	TodoActionItemKind = "tdaction"
	TodoProjectKind    = "tdproject"
	TodoGroupKind      = "tdgroup"

	/*
		ungrouped files
	*/
	RawKind     = "raw"
	FIFOKind    = "fifo"
	SocketKind  = "socket"
	SymLinkKind = "symlink"
	BlkDevKind  = "blk"
	CharDevKind = "chr"
)
View Source
const (
	VersionKey         = "nanafs.version"
	KindKey            = "nanafs.kind"
	LabelPluginNameKey = "nanafs.plugin.name"
)
View Source
const (
	RuleOpEqual     = "equal"
	RuleOpBeginWith = "prefix"
	RuleOpPattern   = "pattern"
	RuleOpBefore    = "before"
	RuleOpAfter     = "after"
	RuleOpIn        = "in"
)
View Source
const (
	RuleLogicAll = "all"
	RuleLogicAny = "any"
)

Variables

View Source
var (
	ErrNotFound    = errors.New("no record")
	ErrNameTooLong = errors.New("name too long")
	ErrIsExist     = errors.New("record existed")
	ErrNotEmpty    = errors.New("group not empty")
	ErrNoGroup     = errors.New("not group")
	ErrIsGroup     = errors.New("this object is a group")
	ErrNoAccess    = errors.New("no access")
	ErrNoPerm      = errors.New("no permission")
	ErrOutOfFS     = errors.New("out of nanafs control")
	ErrUnsupported = errors.New("unsupported operation")
)

Functions

func IsGroup

func IsGroup(k Kind) bool

func IsObjectFiltered

func IsObjectFiltered(obj *Object, filter Filter) bool

Types

type Access

type Access struct {
	Permissions []Permission `json:"permissions,omitempty"`
	UID         int64        `json:"uid"`
	GID         int64        `json:"gid"`
}

func (*Access) AddPerm

func (a *Access) AddPerm(p Permission)

func (*Access) HasPerm

func (a *Access) HasPerm(p Permission) bool

func (*Access) RemovePerm

func (a *Access) RemovePerm(p Permission)

type Annotation

type Annotation struct {
	Annotations []AnnotationItem `json:"annotations,omitempty"`
	Details     string           `json:"details,omitempty"`
}

func (*Annotation) Add

func (a *Annotation) Add(newA *AnnotationItem)

func (*Annotation) Get

func (a *Annotation) Get(key string) *AnnotationItem

func (*Annotation) Remove

func (a *Annotation) Remove(key string)

type AnnotationItem

type AnnotationItem struct {
	Key     string `json:"key"`
	Content string `json:"content"`
	Encode  bool   `json:"encode"`
}

type ChangeParentAttr

type ChangeParentAttr struct {
	Uid      int64
	Gid      int64
	Replace  bool
	Exchange bool
}

type ChangeParentOption

type ChangeParentOption struct{}

type ChunkSeg

type ChunkSeg struct {
	ID       int64
	ChunkID  int64
	ObjectID int64
	Off      int64
	Len      int64
	State    int16
}

type DestroyObjectAttr

type DestroyObjectAttr struct {
	Uid int64
	Gid int64
}

type Event

type Event struct {
	Id              string    `json:"id"`
	Type            string    `json:"type"`
	Source          string    `json:"source"`
	SpecVersion     string    `json:"specversion"`
	Time            time.Time `json:"time"`
	RefID           int64     `json:"nanafsrefid"`
	RefType         string    `json:"nanafsreftype"`
	DataContentType string    `json:"datacontenttype"`
	Data            EventData `json:"data"`
}

type EventData

type EventData struct {
	*Metadata
}

type ExtendData

type ExtendData struct {
	Properties  Properties `json:"properties"`
	Symlink     string     `json:"symlink,omitempty"`
	GroupFilter *Rule      `json:"group_filter,omitempty"`
	PlugScope   *PlugScope `json:"plug_scope,omitempty"`
}

type Filter

type Filter struct {
	ID        int64
	Name      string
	ParentID  int64
	RefID     int64
	Kind      Kind
	Namespace string
	Label     LabelMatch
}

type Kind

type Kind string

Kind of Object

type Label

type Label struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type LabelMatch

type LabelMatch struct {
	Include []Label  `json:"include"`
	Exclude []string `json:"exclude"`
}

type Labels

type Labels struct {
	Labels []Label `json:"labels,omitempty"`
}

func (Labels) Get

func (l Labels) Get(key string) *Label

type Metadata

type Metadata struct {
	ID         int64     `json:"id"`
	Name       string    `json:"name"`
	Aliases    string    `json:"aliases,omitempty"`
	ParentID   int64     `json:"parent_id"`
	RefID      int64     `json:"ref_id,omitempty"`
	RefCount   int       `json:"ref_count,omitempty"`
	Kind       Kind      `json:"kind"`
	Hash       string    `json:"hash"`
	Size       int64     `json:"size"`
	Inode      uint64    `json:"inode"`
	Dev        int64     `json:"dev"`
	Namespace  string    `json:"namespace,omitempty"`
	Storage    string    `json:"storage"`
	CreatedAt  time.Time `json:"created_at"`
	ChangedAt  time.Time `json:"changed_at"`
	ModifiedAt time.Time `json:"modified_at"`
	AccessAt   time.Time `json:"access_at"`
	Access     Access    `json:"access"`
}

func NewMetadata

func NewMetadata(name string, kind Kind) Metadata

type Notification

type Notification struct {
	ID      string
	Title   string
	Message string
	Type    string
	Source  string
	Action  string
	Status  string
	Time    time.Time
}

type Object

type Object struct {
	Metadata
	*ExtendData
	*Labels

	ExtendDataChanged bool `json:"-"`
	LabelsChanged     bool `json:"-"`

	L sync.Mutex `json:"-"`
}

func InitNewObject

func InitNewObject(parent *Metadata, attr ObjectAttr) (*Object, error)

func (*Object) IsGroup

func (o *Object) IsGroup() bool

func (*Object) IsSmartGroup

func (o *Object) IsSmartGroup() bool

func (*Object) SetExtendData

func (o *Object) SetExtendData(ex ExtendData)

func (*Object) SetLabels

func (o *Object) SetLabels(labels Labels)

type ObjectAttr

type ObjectAttr struct {
	Name   string
	Dev    int64
	Kind   Kind
	Access Access
}

type ObjectMapper

type ObjectMapper struct {
	Key       string
	Value     interface{}
	Operation string
}

func WorkflowFilterObjectMapper

func WorkflowFilterObjectMapper(f WorkflowFilter) []ObjectMapper

type OpenAttr

type OpenAttr struct {
	Read   bool
	Write  bool
	Create bool
	Trunc  bool
	Direct bool
}

type Permission

type Permission string

type PlugScope

type PlugScope struct {
	PluginName string            `json:"plugin_name"`
	Version    string            `json:"version"`
	PluginType PluginType        `json:"plugin_type"`
	Parameters map[string]string `json:"parameters"`
}

type PluginSpec

type PluginSpec struct {
	Name       string            `json:"name"`
	Version    string            `json:"version"`
	Type       PluginType        `json:"type"`
	Path       string            `json:"path,omitempty"`
	Parameters map[string]string `json:"parameters"`
}

PluginSpec is Plugin Config File to load a Plugin

type PluginType

type PluginType string
const (
	TypeSource  PluginType = "source"
	TypeProcess PluginType = "process"
	TypeMirror  PluginType = "mirror"
)

type Properties

type Properties struct {
	Fields map[string]string `json:"fields,omitempty"`
}

type Rule

type Rule struct {
	Filters  RuleFilter `json:"filters"`
	Selector LabelMatch `json:"selector"`
}

type RuleFilter

type RuleFilter struct {
	Logic   RuleFilterLogic `json:"logic,omitempty"`
	Filters []RuleFilter    `json:"filters,omitempty"`

	Operation RuleOperation `json:"operation,omitempty"`
	Column    string        `json:"column,omitempty"`
	Value     string        `json:"value,omitempty"`
}

type RuleFilterLogic

type RuleFilterLogic string

type RuleOperation

type RuleOperation string

type ScheduledTask

type ScheduledTask struct {
	ID      int64
	TaskID  string
	Status  string
	RefType string
	RefID   int64
	Result  string

	CreatedTime    time.Time
	ExecutionTime  time.Time
	ExpirationTime time.Time
	Event          Event
}

type ScheduledTaskFilter

type ScheduledTaskFilter struct {
	RefType string
	RefID   int64
	Status  []string
}

type SystemInfo

type SystemInfo struct {
	FilesystemID  string `json:"filesystem_id"`
	MaxSegmentID  int64  `json:"max_segment_id"`
	ObjectCount   int64  `json:"object_count"`
	FileSizeTotal int64  `json:"file_size_total"`
}

type WorkflowFilter

type WorkflowFilter struct {
	ID        string
	Synced    bool
	UpdatedAt *time.Time
}

type WorkflowJob

type WorkflowJob struct {
	Id            string            `json:"id"`
	Workflow      string            `json:"workflow"`
	TriggerReason string            `json:"trigger_reason"`
	Target        WorkflowTarget    `json:"target"`
	Steps         []WorkflowJobStep `json:"steps"`
	Status        string            `json:"status"`
	Message       string            `json:"message"`
	StartAt       time.Time         `json:"start_at"`
	FinishAt      time.Time         `json:"finish_at"`
	CreatedAt     time.Time         `json:"created_at"`
	UpdatedAt     time.Time         `json:"updated_at"`
}

type WorkflowJobStep

type WorkflowJobStep struct {
	StepName string    `json:"step_name"`
	Message  string    `json:"message"`
	Status   string    `json:"status"`
	Plugin   PlugScope `json:"plugin"`
}

type WorkflowSpec

type WorkflowSpec struct {
	Id              string             `json:"id"`
	Name            string             `json:"name"`
	Rule            Rule               `json:"rule,omitempty"`
	Steps           []WorkflowStepSpec `json:"steps,omitempty"`
	Enable          bool               `json:"enable"`
	CreatedAt       time.Time          `json:"created_at"`
	UpdatedAt       time.Time          `json:"updated_at"`
	LastTriggeredAt time.Time          `json:"last_triggered_at"`
}

type WorkflowStepSpec

type WorkflowStepSpec struct {
	Name   string    `json:"name"`
	Plugin PlugScope `json:"plugin"`
}

type WorkflowTarget

type WorkflowTarget struct {
	EntryID *int64 `json:"entry_id,omitempty"`
	Rule    *Rule  `json:"rule,omitempty"`
}

Jump to

Keyboard shortcuts

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