db

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalModusDbEngine *modusgraph.Engine

Functions

func CloseModusDb added in v0.17.0

func CloseModusDb(ctx context.Context)

func GetTx

func GetTx(ctx context.Context) (pgx.Tx, error)

func InitModusDb added in v0.17.0

func InitModusDb(ctx context.Context)

func Initialize

func Initialize(ctx context.Context)

func Stop

func Stop(ctx context.Context)

func UpdateAgentStatus added in v0.18.0

func UpdateAgentStatus(ctx context.Context, id string, status string) error

func WithTx

func WithTx(ctx context.Context, fn func(pgx.Tx) error) error

func WriteAgentState added in v0.18.0

func WriteAgentState(ctx context.Context, state AgentState) error

func WriteInferenceHistory

func WriteInferenceHistory(ctx context.Context, model *manifest.ModelInfo, input, output any, start, end time.Time)

func WriteInferenceHistoryToDB

func WriteInferenceHistoryToDB(ctx context.Context, batch []inferenceHistory)

func WritePluginInfo

func WritePluginInfo(ctx context.Context, plugin *plugins.Plugin)

Types

type AgentState added in v0.18.0

type AgentState struct {
	Gid       uint64 `json:"gid,omitempty"`
	Id        string `json:"id" db:"constraint=unique"`
	Name      string `json:"name"`
	Status    string `json:"status"`
	Data      string `json:"data,omitempty"`
	UpdatedAt string `json:"updated"`
}

func GetAgentState added in v0.18.0

func GetAgentState(ctx context.Context, id string) (*AgentState, error)

func QueryActiveAgents added in v0.18.0

func QueryActiveAgents(ctx context.Context) ([]AgentState, error)

type Inference added in v0.17.0

type Inference struct {
	Gid        uint64 `json:"gid,omitempty"`
	Id         string `json:"id,omitempty" db:"constraint=unique"`
	ModelHash  string `json:"model_hash,omitempty"`
	Input      string `json:"input,omitempty"`
	Output     string `json:"output,omitempty"`
	StartedAt  string `json:"started_at,omitempty"`
	DurationMs int64  `json:"duration_ms,omitempty"`
	Function   string `json:"function,omitempty"`
	Plugin     Plugin `json:"plugin"`
}

func QueryInferences added in v0.17.0

func QueryInferences(ctx context.Context) ([]Inference, error)

type Plugin added in v0.17.0

type Plugin struct {
	Gid        uint64 `json:"gid,omitempty"`
	Id         string `json:"id,omitempty" db:"constraint=unique"`
	Name       string `json:"name,omitempty"`
	Version    string `json:"version,omitempty"`
	Language   string `json:"language,omitempty"`
	SdkVersion string `json:"sdk_version,omitempty"`
	BuildId    string `json:"build_id,omitempty"`
	BuildTime  string `json:"build_time,omitempty"`
	GitRepo    string `json:"git_repo,omitempty"`
	GitCommit  string `json:"git_commit,omitempty"`
}

func QueryPlugins added in v0.17.0

func QueryPlugins(ctx context.Context) ([]Plugin, error)

Jump to

Keyboard shortcuts

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