callback

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package callback provides functionality for sending operation status callbacks to GitLab. It implements mechanisms for reporting success or failure of operations (particularly indexing) back to GitLab via internal API calls. The package handles constructing appropriate payloads, including repository statistics when needed, and manages the HTTP communication with configurable timeouts and authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalPayload

type AdditionalPayload struct {
	RepoStats *disk_stats.RepoStats `json:"repo_stats,omitempty"`
}

AdditionalPayload might get new fields in the future when there will be new callback actions. Right now we add only RepoStats for the index action

type CallbackAPI added in v0.15.0

type CallbackAPI struct {
	GitlabURL string
	NodeUUID  string
	Secret    []byte
	Client    *http.Client
}

func NewCallbackAPI added in v0.15.0

func NewCallbackAPI(gitlabURL, nodeUUID string, secret []byte, client *http.Client) (CallbackAPI, error)

func (CallbackAPI) SendFailure added in v0.15.0

func (c CallbackAPI) SendFailure(ctx context.Context, callbackParams CallbackParams, indexDir string, repoID uint64, failureReason error)

func (CallbackAPI) SendSuccess added in v0.15.0

func (c CallbackAPI) SendSuccess(ctx context.Context, callbackParams CallbackParams, indexDir string, repoID uint64)

type CallbackBody

type CallbackBody struct {
	Name              string             `json:"name"`
	Success           bool               `json:"success"`
	Payload           any                `json:"payload"`
	AdditionalPayload *AdditionalPayload `json:"additional_payload,omitempty"`
	Error             string             `json:"error,omitempty"`
}

type CallbackFunc

type CallbackFunc struct {
	OnSuccess func(CallbackParams)
	OnFailure func(CallbackParams, error)
}

type CallbackParams

type CallbackParams struct {
	Name         string `json:"name"`
	RailsPayload any    `json:"payload"`
}

Jump to

Keyboard shortcuts

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