conn

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 7 Imported by: 0

README

Package conn

conn and its subpackages conn/http and conn/storage provide all calls needed for the ARN service.

This package is a little non-standard. Normally when I make a conn package it encapsulates all the calls to a service.

In this case, conn uses the models.Notification.SendEvent() method to send events to the ARN service. This allows us to let the specific model's notifications package handle changes to the event data as required if the data size gets too large. This is a consequence of ARN being backed by Kusto which cannot handle large batches of data without going to blob storage.

conn/http is a wrapper around azcore.Client which is a wrapper around http.Client. This simply encapsulates the client endpoing and request specifics for the ARN service.

conn/storage is a wrapper around azblob. This encapsulates the specifics of the ARN blob storage container.

Documentation

Overview

Package conn provides the top level package for all connection types to the ARN service.

Index

Constants

This section is empty.

Variables

View Source
var PromisePool = sync.Pool{
	New: func() any {
		return make(chan error, 1)
	},
}

PromisePool is a pool of promises to use for notifications.

Functions

This section is empty.

Types

type Option

type Option func(*Service) error

func WithLogger

func WithLogger(log *slog.Logger) Option

WithLogger sets the logger on the client. By default it uses slog.Default().

type Service

type Service struct {
	// contains filtered or unexported fields
}

Reset provides a REST connection to the ARN service.

func New

func New(httpClient *http.Client, store *storage.Client, clientErrs chan error, options ...Option) (*Service, error)

New creates a new connection to the ARN service.

func (*Service) Close

func (r *Service) Close() error

Close closes the connection to the ARN service.

func (*Service) Send

func (s *Service) Send(notify models.Notifications)

Send sends a notification to the ARN service. This will block if the internal channel is full. notify.DataCount() must indicate no more than 1000 items. Not thread safe.

Directories

Path Synopsis
Package http provides a client for interacting with the ARN receiver API using an azcore.Client.
Package http provides a client for interacting with the ARN receiver API using an azcore.Client.
Package maxvals holds maximum values for message attributes send via the conn package.
Package maxvals holds maximum values for message attributes send via the conn package.
Package storage provides a client around Azure Blob Storage for sending data that will be used by the ARN service.
Package storage provides a client around Azure Blob Storage for sending data that will be used by the ARN service.

Jump to

Keyboard shortcuts

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