Documentation
¶
Overview ¶
Package dbproxy provides a db.Querier implementation that transparently routes write operations to the primary Pando instance via ZMQ JSON-RPC, while serving reads from the local (possibly read-only) SQLite database.
Secondary instances use DBProxy so they never write to SQLite directly, preserving the single-writer invariant required by SQLite.
Index ¶
- Constants
- func RegisterHandlers(bus *ipc.Bus, q db.Querier)
- type DBProxy
- func (p *DBProxy) CreateFile(ctx context.Context, arg db.CreateFileParams) (db.File, error)
- func (p *DBProxy) CreateMessage(ctx context.Context, arg db.CreateMessageParams) (db.Message, error)
- func (p *DBProxy) CreateProject(ctx context.Context, arg db.CreateProjectParams) (db.Project, error)
- func (p *DBProxy) CreateSession(ctx context.Context, arg db.CreateSessionParams) (db.Session, error)
- func (p *DBProxy) DeactivateLowestSkill(ctx context.Context) error
- func (p *DBProxy) DeleteFile(ctx context.Context, id string) error
- func (p *DBProxy) DeleteMessage(ctx context.Context, id string) error
- func (p *DBProxy) DeleteProject(ctx context.Context, id string) error
- func (p *DBProxy) DeleteSession(ctx context.Context, id string) error
- func (p *DBProxy) DeleteSessionFiles(ctx context.Context, sessionID string) error
- func (p *DBProxy) DeleteSessionMessages(ctx context.Context, sessionID string) error
- func (p *DBProxy) IncrementSkillUsage(ctx context.Context, id string) error
- func (p *DBProxy) InsertPromptTemplate(ctx context.Context, arg db.InsertPromptTemplateParams) (db.PromptTemplate, error)
- func (p *DBProxy) InsertSessionScore(ctx context.Context, arg db.InsertSessionScoreParams) (db.SessionScore, error)
- func (p *DBProxy) InsertSkill(ctx context.Context, arg db.InsertSkillParams) (db.SkillLibrary, error)
- func (p *DBProxy) MarkProjectInitialized(ctx context.Context, id string) error
- func (p *DBProxy) UpdateFile(ctx context.Context, arg db.UpdateFileParams) (db.File, error)
- func (p *DBProxy) UpdateMessage(ctx context.Context, arg db.UpdateMessageParams) error
- func (p *DBProxy) UpdateProjectLastOpened(ctx context.Context, arg db.UpdateProjectLastOpenedParams) error
- func (p *DBProxy) UpdateProjectStatus(ctx context.Context, arg db.UpdateProjectStatusParams) error
- func (p *DBProxy) UpdateSession(ctx context.Context, arg db.UpdateSessionParams) (db.Session, error)
- type WriteRequest
Constants ¶
const MethodDBWrite = "db.write"
MethodDBWrite is the JSON-RPC method name for proxied write operations.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DBProxy ¶
type DBProxy struct {
db.Querier // local reads — embedded interface
// contains filtered or unexported fields
}
DBProxy implements db.Querier. Reads are served from the embedded local querier. Writes are forwarded via ZMQ JSON-RPC to the primary instance.
When client is nil the proxy behaves identically to the embedded querier (useful for the primary instance itself).
func New ¶
New creates a DBProxy backed by local for reads. Pass a non-nil client and the primary's rpcAddr to enable write proxying. Pass client=nil for primary instances (writes go directly to the local querier).
func (*DBProxy) CreateFile ¶
func (*DBProxy) CreateMessage ¶
func (*DBProxy) CreateProject ¶
func (*DBProxy) CreateSession ¶
func (*DBProxy) DeactivateLowestSkill ¶
func (*DBProxy) DeleteMessage ¶
func (*DBProxy) DeleteProject ¶
func (*DBProxy) DeleteSession ¶
func (*DBProxy) DeleteSessionFiles ¶
func (*DBProxy) DeleteSessionMessages ¶
func (*DBProxy) IncrementSkillUsage ¶
func (*DBProxy) InsertPromptTemplate ¶
func (p *DBProxy) InsertPromptTemplate(ctx context.Context, arg db.InsertPromptTemplateParams) (db.PromptTemplate, error)
func (*DBProxy) InsertSessionScore ¶
func (p *DBProxy) InsertSessionScore(ctx context.Context, arg db.InsertSessionScoreParams) (db.SessionScore, error)
func (*DBProxy) InsertSkill ¶
func (p *DBProxy) InsertSkill(ctx context.Context, arg db.InsertSkillParams) (db.SkillLibrary, error)
func (*DBProxy) MarkProjectInitialized ¶
func (*DBProxy) UpdateFile ¶
func (*DBProxy) UpdateMessage ¶
func (*DBProxy) UpdateProjectLastOpened ¶
func (*DBProxy) UpdateProjectStatus ¶
func (*DBProxy) UpdateSession ¶
type WriteRequest ¶
type WriteRequest struct {
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}
WriteRequest is the JSON-RPC params struct for a proxied write.