source

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package source defines the contracts and helpers used to implement ibdm data sources. Sources expose event streams, sync processes, webhooks setup and optional shutdown semantics through shared interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClosableSource

type ClosableSource interface {
	// Close releases resources, respecting the provided timeout.
	Close(ctx context.Context, timeout time.Duration) (err error)
}

ClosableSource supports graceful shutdown.

type Data

type Data struct {
	// Type describes the kind of entity (e.g., "repository", "issue").
	Type string
	// Operation indicates whether the entity must be upserted or deleted.
	Operation DataOperation
	// Values holds the raw payload. For delete operations, it must contain enough data to reconstruct the identifier.
	Values map[string]any
	// Time indicates the timestamp of the event that generated this data.
	Time time.Time
}

Data groups the type, operation, and values emitted by a source.

func (*Data) Timestamp

func (d *Data) Timestamp() string

type DataOperation

type DataOperation int
const (
	// DataOperationUpsert represents an upsert (insert or update) operation.
	DataOperationUpsert DataOperation = iota
	// DataOperationDelete represents a delete operation.
	DataOperationDelete
)

func (DataOperation) String

func (i DataOperation) String() string

type EventSource

type EventSource interface {
	// StartEventStream begins streaming updates, writing to results or returning an error.
	// typesToStream lists the expected data types.
	StartEventStream(ctx context.Context, typesToStream map[string]Extra, results chan<- Data) (err error)
}

EventSource streams data updates as they arrive.

type Extra

type Extra map[string]any

Extra represents additional configuration for a source data type.

type SyncableSource

type SyncableSource interface {
	// StartSyncProcess kicks off a sync run, pushing data into results or returning an error.
	// typesToSync lists the data types to fetch.
	StartSyncProcess(ctx context.Context, typesToSync map[string]Extra, results chan<- Data) (err error)
}

SyncableSource exposes a pull-based synchronization flow.

type Webhook

type Webhook struct {
	Method  string
	Path    string
	Handler WebhookHandler
}

type WebhookHandler

type WebhookHandler func(ctx context.Context, headers http.Header, body []byte) error

type WebhookSource

type WebhookSource interface {
	// GetWebhook sets up webhooks for the specified data types, sending updates to results or returning an error.
	// typesToStream lists the expected data types.
	GetWebhook(ctx context.Context, typesToStream map[string]Extra, results chan<- Data) (webhook Webhook, err error)
}

Directories

Path Synopsis
Package azure contains Azure-specific implementations of source-related functionality.
Package azure contains Azure-specific implementations of source-related functionality.
Package azuredevops contains Azure DevOps specific implementations of source-related functionality.
Package azuredevops contains Azure DevOps specific implementations of source-related functionality.
Package bitbucket implements a Mia-Platform IBDM source for Bitbucket Cloud.
Package bitbucket implements a Mia-Platform IBDM source for Bitbucket Cloud.
Package console provides a source implementation to integrate with Mia Platform Console webhooks.
Package console provides a source implementation to integrate with Mia Platform Console webhooks.
service
Package service provides the Console source service implementation.
Package service provides the Console source service implementation.
Package fake exposes in-memory source implementations for tests.
Package fake exposes in-memory source implementations for tests.
Package gcp provides a source implementation to integrate with Google Cloud Platform services.
Package gcp provides a source implementation to integrate with Google Cloud Platform services.
Package github provides a source implementation that integrates with GitHub via its REST API and inbound webhooks.
Package github provides a source implementation that integrates with GitHub via its REST API and inbound webhooks.
Package gitlab provides a source implementation to integrate with GitLab via the REST API (sync) and webhooks (real-time pipeline events).
Package gitlab provides a source implementation to integrate with GitLab via the REST API (sync) and webhooks (real-time pipeline events).
Package nexus provides a source implementation that integrates with Sonatype Nexus Repository Manager via its REST API.
Package nexus provides a source implementation that integrates with Sonatype Nexus Repository Manager via its REST API.
Package sysdig provides a source implementation to integrate with Sysdig Secure.
Package sysdig provides a source implementation to integrate with Sysdig Secure.

Jump to

Keyboard shortcuts

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