pluginapi

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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResWorkflowKeyPrefix   = "org.basenana.workflow/"
	ResEntryIdKey          = "org.basenana.workflow/entry_id"
	ResEntryPathKey        = "org.basenana.workflow/entry_path"
	ResEntryURIKey         = "org.basenana.workflow/entry_uri"
	ResEntryDocumentsKey   = "org.basenana.workflow/entry_documents"
	ResEntryDocSummaryKey  = "org.basenana.workflow/entry_summary"
	ResEntryDocKeyWordsKey = "org.basenana.workflow/entry_keywords"
	ResEntryDocIngestKey   = "org.basenana.workflow/entry_ingest"
	ResEntryActionKey      = "org.basenana.workflow/entry_action"
	ResCollectManifests    = "org.basenana.workflow/collect_manifests"
	ResPluginName          = "org.basenana.workflow/plugin_name"
	ResPluginVersion       = "org.basenana.workflow/plugin_version"
	ResPluginType          = "org.basenana.workflow/plugin_type"
	ResPluginAction        = "org.basenana.workflow/plugin_action"
)
View Source
const (
	CachedDataFile = ".data.plugin.json"
)

Variables

This section is empty.

Functions

func ResultFilePath

func ResultFilePath(basePath string) string

Types

type CachedData

type CachedData struct {
	Items     []cachedItem `json:"items"`
	CreatedAt time.Time    `json:"created_at"`
	UpdatedAt time.Time    `json:"updated_at"`
	// contains filtered or unexported fields
}

CachedData is the cached data stored in the source plugin directory, which supports sharing cached data across different workflows.

func InitCacheData

func InitCacheData() *CachedData

func OpenCacheData

func OpenCacheData(reader io.Reader) (*CachedData, error)

func (*CachedData) ListItems

func (d *CachedData) ListItems(group string) (result []string)

func (*CachedData) NeedReCache

func (d *CachedData) NeedReCache() bool

func (*CachedData) Reader

func (d *CachedData) Reader() (io.Reader, error)

func (*CachedData) SetItem

func (d *CachedData) SetItem(group, cachedKey, itemVal string)

type CollectManifest

type CollectManifest struct {
	BaseEntry int64
	NewFiles  []Entry
}

type Entry

type Entry struct {
	Name       string
	Kind       types.Kind
	Size       int64
	IsGroup    bool
	Parameters map[string]string
}

type EntryAttr

type EntryAttr struct {
	Name string
	Kind types.Kind
}

type File

type File interface {
	WriteAt(ctx context.Context, data []byte, off int64) (int64, error)
	ReadAt(ctx context.Context, dest []byte, off int64) (int64, error)
	Fsync(ctx context.Context) error
	Trunc(ctx context.Context) error
	Close(ctx context.Context) error
}

type Request

type Request struct {
	Action           string
	WorkPath         string
	EntryId          int64
	ParentEntryId    int64
	EntryPath        string
	EntryURI         string
	Namespace        string
	CacheData        *CachedData
	Parameter        map[string]any
	ContextResults   Results
	ParentProperties map[string]string
}

func NewRequest

func NewRequest() *Request

type Response

type Response struct {
	IsSucceed bool
	Message   string
	Results   map[string]any
}

func NewFailedResponse

func NewFailedResponse(msg string) *Response

func NewResponse

func NewResponse() *Response

func NewResponseWithResult

func NewResponseWithResult(result map[string]any) *Response

type Results

type Results interface {
	Set(key string, val any) error
	SetAll(data map[string]any) error
	IsSet(key string) bool
	Load(key string, val any) error
}

func NewFileBasedResults

func NewFileBasedResults(filePath string) (Results, error)

func NewMemBasedResults

func NewMemBasedResults() Results

Jump to

Keyboard shortcuts

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