Documentation
¶
Index ¶
- type DaemonConnectionStruct
- func (d *DaemonConnectionStruct) BuildPayload(p *payload.JobPayload, metadata any) (err error)
- func (d *DaemonConnectionStruct) Create(req payload.JobDetailMetadata) error
- func (d *DaemonConnectionStruct) FindJob(query payload.JobSearchMetadata) (payload.JobResponse, error)
- func (d *DaemonConnectionStruct) GetPayload(target any) error
- func (d *DaemonConnectionStruct) List(req payload.JobSearchMetadata) ([]payload.JobResponse, error)
- func (d *DaemonConnectionStruct) ListCount(req payload.JobSearchMetadata) (int, error)
- func (d *DaemonConnectionStruct) SendPayload(target any) error
- func (d *DaemonConnectionStruct) Status(id string) (payload.JobResponse, error)
- func (d *DaemonConnectionStruct) Stop(jobNameOrId string) (payload.JobResponse, error)
- func (d *DaemonConnectionStruct) TailJobLogWithContext(ctx context.Context, jobIDOrName string, follow bool, ...) error
- func (d *DaemonConnectionStruct) TestConnection() error
- func (d *DaemonConnectionStruct) Wait(id string) (job payload.JobResponse, err error)
- type DaemonNotRunningError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DaemonConnectionStruct ¶
type DaemonConnectionStruct struct {
Connection net.Conn
config.BobbitClientConfig
}
DaemonConnectionStruct holds the network connection and configuration for a Bobbit daemon client.
func New ¶
func New(c config.BobbitClientConfig) *DaemonConnectionStruct
New creates and returns a new DaemonConnectionStruct initialized with the provided BobbitConfig.
func (*DaemonConnectionStruct) BuildPayload ¶
func (d *DaemonConnectionStruct) BuildPayload(p *payload.JobPayload, metadata any) (err error)
BuildPayload establishes a connection to the daemon's Unix socket and marshals the provided metadata into the JobPayload. It returns an error if the connection fails or metadata marshalling fails.
func (*DaemonConnectionStruct) Create ¶ added in v0.5.0
func (d *DaemonConnectionStruct) Create(req payload.JobDetailMetadata) error
Create submits a new job execution request to the daemon. Takes JobDetailMetadata containing command, name, and other options.
func (*DaemonConnectionStruct) FindJob ¶ added in v0.5.0
func (d *DaemonConnectionStruct) FindJob(query payload.JobSearchMetadata) (payload.JobResponse, error)
FindJob attempts to locate a single job matching the provided query parameters. This uses REQUEST_STATUS under the hood, similar to Status but with a full metadata struct.
func (*DaemonConnectionStruct) GetPayload ¶
func (d *DaemonConnectionStruct) GetPayload(target any) error
GetPayload decodes the response from the daemon connection into the provided target object. It returns an error if decoding fails.
func (*DaemonConnectionStruct) List ¶ added in v0.5.0
func (d *DaemonConnectionStruct) List(req payload.JobSearchMetadata) ([]payload.JobResponse, error)
List retrieves a list of jobs based on the provided search criteria.
func (*DaemonConnectionStruct) ListCount ¶ added in v0.5.0
func (d *DaemonConnectionStruct) ListCount(req payload.JobSearchMetadata) (int, error)
ListCount returns the number of jobs matching the activeOnly criteria.
func (*DaemonConnectionStruct) SendPayload ¶
func (d *DaemonConnectionStruct) SendPayload(target any) error
SendPayload encodes and sends the given target object over the established daemon connection. It returns an error if encoding or writing fails.
func (*DaemonConnectionStruct) Status ¶ added in v0.5.0
func (d *DaemonConnectionStruct) Status(id string) (payload.JobResponse, error)
Status retrieves the detailed status of a specific job by its ID. Returns the JobResponse containing job details or an error if the request fails.
func (*DaemonConnectionStruct) Stop ¶ added in v0.5.0
func (d *DaemonConnectionStruct) Stop(jobNameOrId string) (payload.JobResponse, error)
Stop sends a request to stop a running job by its name or ID. Returns the JobResponse of the stopped job or an error if the request fails.
func (*DaemonConnectionStruct) TailJobLogWithContext ¶ added in v0.5.0
func (d *DaemonConnectionStruct) TailJobLogWithContext(ctx context.Context, jobIDOrName string, follow bool, onLine func(string) error) error
TailJobLogWithContext streams a job's log file in real-time with context support. It takes a context for cancellation, job ID or search string, and a callback function. The callback receives the log line as a string. If the callback returns an error, streaming stops. Returns an error if the request fails, job is not found, or context is cancelled.
func (*DaemonConnectionStruct) TestConnection ¶ added in v0.5.0
func (d *DaemonConnectionStruct) TestConnection() error
TestConnection verifies if the daemon is reachable and responding. It sends a simple vibe check payload and returns nil if successful.
func (*DaemonConnectionStruct) Wait ¶ added in v0.5.0
func (d *DaemonConnectionStruct) Wait(id string) (job payload.JobResponse, err error)
Wait blocks until the specified job has finished execution. Returns the final JobResponse or an error if the wait fails.
type DaemonNotRunningError ¶
type DaemonNotRunningError struct {
NetError error
Config config.BobbitConfig
}
func (*DaemonNotRunningError) Error ¶
func (d *DaemonNotRunningError) Error() string