callback

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

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"`
}

This 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

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

func NewCallbackApi

func NewCallbackApi(gitlabUrl, nodeUUID, secretFilePath string, client *http.Client) (CallbackApi, error)

func (CallbackApi) SendFailure

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

func (CallbackApi) SendSuccess

func (c CallbackApi) SendSuccess(ctx context.Context, callbackParams CallbackParams, indexDir string, repoID uint32)

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