types

package
v0.6.0-beta Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: Apache-2.0 Imports: 7 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 (
	LabelKeyPluginPrefix = "org.basenana.internal.plugin/"
	LabelKeyPluginKind   = LabelKeyPluginPrefix + "kind"
	LabelKeyPluginName   = LabelKeyPluginPrefix + "name"

	PropertyWebSiteName     = "org.basenana.web.site_name"
	PropertyWebSiteURL      = "org.basenana.web.site_url"
	PropertyWebPageURL      = "org.basenana.web.url"
	PropertyWebPageUpdateAt = "org.basenana.web.updated_at"
	PropertyWebPageTitle    = "org.basenana.web.title"
)
View Source
const (
	PlugScopeEntryName     = "entry.name"
	PlugScopeEntryPath     = "entry.path" // relative path
	PlugScopeWorkflowID    = "workflow.id"
	PlugScopeWorkflowJobID = "workflow.job.id"
)
View Source
const (
	ScheduledTaskInitial   = "initial"
	ScheduledTaskWait      = "wait"
	ScheduledTaskExecuting = "executing"
	ScheduledTaskFinish    = "finish"
	ScheduledTaskSucceed   = "succeed"
	ScheduledTaskFailed    = "failed"
)
View Source
const (
	NotificationInfo   = "info"
	NotificationWarn   = "warn"
	NotificationUnread = "unread"
	NotificationRead   = "read"
)
View Source
const (
	/*
		system-wide kind
	*/
	GroupKind         = "group"
	SmartGroupKind    = "smtgroup"
	ExternalGroupKind = "extgroup"

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

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

	WordDocKind  = "worddoc"
	ExcelDocKind = "exceldoc"
	PptDocKind   = "pptdoc"

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

	/*
		web based file kind
	*/
	WebArchiveKind  = "webarchive"
	WebBookmarkKind = "webbbookmark"
	HtmlKind        = "html"

	/*
		ungrouped files
	*/
	RawKind = "raw"

	FIFOKind    = "fifo"
	SocketKind  = "socket"
	SymLinkKind = "symlink"
	BlkDevKind  = "blk"
	CharDevKind = "chr"
)
View Source
const (
	NamespaceKey          = "namespace"
	DefaultNamespaceValue = "global" // TODO: using 'public'
	GlobalNamespaceValue  = "global"
)
View Source
const (
	PageKey     = "page"
	PageSizeKey = "pageSize"
)
View Source
const (
	RuleLogicAll = "all"
	RuleLogicAny = "any"
	RuleLogicNot = "not"

	RuleOpEqual     = "equal"
	RuleOpBeginWith = "prefix"
	RuleOpEndWith   = "suffix"
	RuleOpPattern   = "pattern"
	RuleOpBefore    = "before"
	RuleOpAfter     = "after"
	RuleOpIn        = "in"
)

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")
	ErrConflict    = errors.New("operation conflict")
	ErrUnsupported = errors.New("unsupported operation")
	ErrNotEnable   = errors.New("not enable")
)

Functions

func IsGroup

func IsGroup(k Kind) bool

func IsMirrored

func IsMirrored(entry *Metadata) bool

func WithNamespace

func WithNamespace(ctx context.Context, ns *Namespace) context.Context

func WithPagination

func WithPagination(ctx context.Context, page *Pagination) context.Context

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 AccessToken

type AccessToken struct {
	TokenKey       string
	SecretToken    string
	UID            int64
	GID            int64
	ClientCrt      string
	ClientKey      string
	CertExpiration time.Time
	LastSeenAt     time.Time
	Namespace      string
}

type ChangeParentAttr

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

type ChunkSeg

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

type DestroyObjectAttr

type DestroyObjectAttr struct {
	Uid int64
	Gid int64
}

type DocFilter

type DocFilter struct {
	FuzzyName      string
	ParentID       int64
	Source         string
	Marked         *bool
	Unread         *bool
	CreatedAtStart *time.Time
	CreatedAtEnd   *time.Time
	ChangedAtStart *time.Time
	ChangedAtEnd   *time.Time
}

type DocOrder

type DocOrder int
const (
	Name DocOrder = iota
	Source
	Marked
	Unread
	CreatedAt
)

func (DocOrder) String

func (d DocOrder) String() string

type Document

type Document struct {
	ID            int64     `json:"id"`
	OID           int64     `json:"oid"`
	Name          string    `json:"name"`
	Namespace     string    `json:"namespace"`
	ParentEntryID int64     `json:"parent_entry_id"`
	Source        string    `json:"source"`
	KeyWords      []string  `json:"keywords,omitempty"`
	Content       string    `json:"content,omitempty"`
	Summary       string    `json:"summary,omitempty"`
	Marked        *bool     `json:"marked,omitempty"`
	Unread        *bool     `json:"unread,omitempty"`
	Desync        *bool     `json:"desync"`
	CreatedAt     time.Time `json:"created_at"`
	ChangedAt     time.Time `json:"changed_at"`
}

type DocumentFeed

type DocumentFeed struct {
	ID         string
	Display    string
	ParentID   int64
	Keywords   string
	IndexQuery string
}

type DocumentOrder

type DocumentOrder struct {
	Order DocOrder
	Desc  bool
}

type EnOrder

type EnOrder int
const (
	EntryName EnOrder = iota
	EntryKind
	EntryIsGroup
	EntrySize
	EntryCreatedAt
	EntryModifiedAt
)

func (EnOrder) String

func (d EnOrder) String() string

type EntryAttr

type EntryAttr struct {
	Name       string
	Kind       Kind
	Access     *Access
	Dev        int64
	Properties Properties
	Labels     Labels
	ExtendData *ExtendData
}

type EntryOrder

type EntryOrder struct {
	Order EnOrder
	Desc  bool
}

type EntryUri

type EntryUri struct {
	ID        int64  `json:"id"`
	Uri       string `json:"uri"`
	Namespace string `json:"namespace"`
	Invalid   bool   `json:"invalid"`
}

type Event

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

type EventData

type EventData struct {
	ID        int64  `json:"id"`
	ParentID  int64  `json:"parent_id,omitempty"`
	Kind      Kind   `json:"kind,omitempty"`
	KindMap   int64  `json:"kind_map,omitempty"`
	IsGroup   bool   `json:"is_group,omitempty"`
	Namespace string `json:"namespace,omitempty"`
}

func NewEventDataFromDocument

func NewEventDataFromDocument(doc *Document) EventData

func NewEventDataFromEntry

func NewEventDataFromEntry(entry *Metadata) EventData

func (EventData) String

func (e EventData) String() string

type EventFilter

type EventFilter struct {
	StartSequence int64
	Limit         int
	DESC          bool
}

type ExtendData

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

type FDocument

type FDocument struct {
	Content  string
	Metadata map[string]string
}

type FLlmResult

type FLlmResult struct {
	Summary  string
	Keywords []string
	Usage    map[string]int
}

type FeedResult

type FeedResult struct {
	FeedId    string `json:"feed_id"`
	GroupName string `json:"group_name"`
	SiteUrl   string `json:"site_url"`
	SiteName  string `json:"site_name"`
	FeedUrl   string `json:"feed_url"`

	Documents []FeedResultItem `json:"documents"`
}

type FeedResultItem

type FeedResultItem struct {
	ID        string   `json:"id"`
	Title     string   `json:"title"`
	Link      string   `json:"link"`
	UpdatedAt string   `json:"updated_at"`
	Document  Document `json:"document"`
}

type Filter

type Filter struct {
	ID              int64
	Name            string
	FuzzyName       string
	ParentID        int64
	RefID           int64
	Kind            Kind
	Namespace       string
	Label           LabelMatch
	IsGroup         *bool
	CreatedAtStart  *time.Time
	CreatedAtEnd    *time.Time
	ModifiedAtStart *time.Time
	ModifiedAtEnd   *time.Time
}

type FridayAccount

type FridayAccount struct {
	ID             int64     `json:"id"`
	Namespace      string    `json:"namespace"`
	RefID          int64     `json:"ref_id"`
	RefType        string    `json:"ref_type"`
	Type           string    `json:"type"`
	CompleteTokens int       `json:"complete_tokens"`
	PromptTokens   int       `json:"prompt_tokens"`
	TotalTokens    int       `json:"total_tokens"`
	CreatedAt      time.Time `json:"created_at"`
}

type GroupEntry

type GroupEntry struct {
	Entry    *Metadata     `json:"entry"`
	Children []*GroupEntry `json:"children"`
}

type JobFilter

type JobFilter struct {
	WorkFlowID  string
	JobID       string
	Status      string
	QueueName   string
	Executor    string
	TargetEntry int64
}

type Kind

type Kind string

Kind of Entry

func FileKind

func FileKind(filename string, defaultKind Kind) Kind

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"`
	KindMap    int64     `json:"kind_map"`
	IsGroup    bool      `json:"is_group"`
	Size       int64     `json:"size"`
	Version    int64     `json:"version"`
	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 InitNewEntry

func InitNewEntry(parent *Metadata, attr EntryAttr) (*Metadata, error)

func NewMetadata

func NewMetadata(name string, kind Kind) Metadata

type Namespace

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

func GetNamespace

func GetNamespace(ctx context.Context) (ns *Namespace)

func NewNamespace

func NewNamespace(name string) *Namespace

func (*Namespace) String

func (n *Namespace) String() string

type Notification

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

type OpenAttr

type OpenAttr struct {
	EntryID int64
	Read    bool
	Write   bool
	Create  bool
	Trunc   bool
	Direct  bool

	FsWriteback bool
}

type Pagination

type Pagination struct {
	Page     int64
	PageSize int64
}

func GetPagination

func GetPagination(ctx context.Context) *Pagination

func NewPagination

func NewPagination(page, pageSize int64) *Pagination

func (*Pagination) Limit

func (p *Pagination) Limit() int

func (*Pagination) Offset

func (p *Pagination) Offset() int

type Permission

type Permission string

type PlugScope

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

type PluginSpec

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

	Adaptor  string `json:"adaptor"`
	Path     string `json:"path,omitempty"`     // goplugin
	Operator string `json:"operator,omitempty"` // goflow
}

PluginSpec is Plugin Config File to load a Plugin

type PluginType

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

type Properties

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

type PropertyItem

type PropertyItem struct {
	Value   string `json:"value"`
	Encoded bool   `json:"encoded"`
}

type ReplyChannel

type ReplyChannel struct {
	Line       string
	ResponseId int64
	Sender     string
	SendAt     time.Time
	CreatedAt  time.Time
}

type Room

type Room struct {
	ID        int64               `json:"id"`
	Namespace string              `json:"namespace"`
	Title     string              `json:"title"`
	EntryId   int64               `json:"entry_id"`
	Prompt    string              `json:"prompt"`
	History   []map[string]string `json:"history"`
	CreatedAt time.Time           `json:"created_at"`
	Messages  []*RoomMessage      `json:"messages"`
}

type RoomMessage

type RoomMessage struct {
	ID        int64     `json:"id"`
	Namespace string    `json:"namespace"`
	RoomID    int64     `json:"room_id"`
	Sender    string    `json:"sender"`
	Message   string    `json:"message"`
	SendAt    time.Time `json:"send_at"`
	CreatedAt time.Time `json:"created_at"`
}

type Rule

type Rule struct {
	Logic string `json:"logic,omitempty"`
	Rules []Rule `json:"rules,omitempty"`

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

	Labels *LabelMatch `json:"labels,omitempty"`
}

type ScheduledTask

type ScheduledTask struct {
	ID        int64
	Namespace string
	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 WorkflowEntryResult

type WorkflowEntryResult struct {
}

type WorkflowJob

type WorkflowJob struct {
	Id             string            `json:"id"`
	Namespace      string            `json:"namespace"`
	Workflow       string            `json:"workflow"`
	TriggerReason  string            `json:"trigger_reason,omitempty"`
	Target         WorkflowTarget    `json:"target"`
	Steps          []WorkflowJobStep `json:"steps"`
	Status         string            `json:"status,omitempty"`
	Message        string            `json:"message,omitempty"`
	Executor       string            `json:"executor"`
	QueueName      string            `json:"queue_name"`
	TimeoutSeconds int               `json:"timeout"`
	StartAt        time.Time         `json:"start_at"`
	FinishAt       time.Time         `json:"finish_at"`
	CreatedAt      time.Time         `json:"created_at"`
	UpdatedAt      time.Time         `json:"updated_at"`
}

func (*WorkflowJob) GetMessage

func (w *WorkflowJob) GetMessage() string

func (*WorkflowJob) GetStatus

func (w *WorkflowJob) GetStatus() string

func (*WorkflowJob) SetMessage

func (w *WorkflowJob) SetMessage(msg string)

func (*WorkflowJob) SetStatus

func (w *WorkflowJob) SetStatus(status string)

type WorkflowJobStep

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

type WorkflowSpec

type WorkflowSpec struct {
	Id              string             `json:"id"`
	Name            string             `json:"name"`
	Namespace       string             `json:"namespace"`
	Rule            Rule               `json:"rule,omitempty"`
	Cron            string             `json:"cron,omitempty"`
	Steps           []WorkflowStepSpec `json:"steps,omitempty"`
	Enable          bool               `json:"enable"`
	Executor        string             `json:"executor"`
	QueueName       string             `json:"queue_name"`
	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,omitempty"`
}

type WorkflowTarget

type WorkflowTarget struct {
	EntryID       int64 `json:"entry_id,omitempty"`
	ParentEntryID int64 `json:"parent_entry_id,omitempty"`
}

Jump to

Keyboard shortcuts

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