natz

package
v1.1.1921 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NatsConfig string

NatsConfig holds the current nats configuration for SHAR.

Functions

func WithEmbargo added in v1.1.1687

func WithEmbargo(embargo int) *publishEmbargoOption

WithEmbargo allows the specification of an embargo time on a workflow state message

func WithHeaders added in v1.1.1687

func WithHeaders(headers map[string]string) *publishHeadersOption

WithHeaders allows the addition of extra headers to a workflow state message

Types

type MockPublishOpt added in v1.1.1687

type MockPublishOpt struct {
	mock.Mock
}

MockPublishOpt is an autogenerated mock type for the PublishOpt type

func NewMockPublishOpt added in v1.1.1687

func NewMockPublishOpt(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockPublishOpt

NewMockPublishOpt creates a new instance of MockPublishOpt. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockPublishOpt) Apply added in v1.1.1687

func (_m *MockPublishOpt) Apply(n *PublishOptions)

Apply provides a mock function with given fields: n

func (*MockPublishOpt) EXPECT added in v1.1.1687

type MockPublishOpt_Apply_Call added in v1.1.1687

type MockPublishOpt_Apply_Call struct {
	*mock.Call
}

MockPublishOpt_Apply_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Apply'

func (*MockPublishOpt_Apply_Call) Return added in v1.1.1687

func (*MockPublishOpt_Apply_Call) Run added in v1.1.1687

func (*MockPublishOpt_Apply_Call) RunAndReturn added in v1.1.1687

type MockPublishOpt_Expecter added in v1.1.1687

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

func (*MockPublishOpt_Expecter) Apply added in v1.1.1687

func (_e *MockPublishOpt_Expecter) Apply(n interface{}) *MockPublishOpt_Apply_Call

Apply is a helper method to define mock.On call

  • n *PublishOptions

type NamespaceKvs

type NamespaceKvs struct {
	WfExecution       jetstream.KeyValue
	WfProcessInstance jetstream.KeyValue
	WfUserTasks       jetstream.KeyValue
	WfTaskSpec        jetstream.KeyValue
	WfTaskSpecVer     jetstream.KeyValue
	Wf                jetstream.KeyValue
	WfVersion         jetstream.KeyValue
	WfTelemetry       jetstream.KeyValue
	Job               jetstream.KeyValue
	OwnerName         jetstream.KeyValue
	OwnerID           jetstream.KeyValue
	WfClientTask      jetstream.KeyValue
	WfGateway         jetstream.KeyValue
	//REM: WfHistory         jetstream.KeyValue
	WfLock          jetstream.KeyValue
	WfMsgTypes      jetstream.KeyValue
	WfProcess       jetstream.KeyValue
	WfMessages      jetstream.KeyValue
	WfClients       jetstream.KeyValue
	WfFatalError    jetstream.KeyValue
	WfUserTaskState jetstream.KeyValue
}

NamespaceKvs defines all the key value stores shar needs to operate

type NatsConnConfiguration

type NatsConnConfiguration struct {
	Conn            *nats.Conn
	TxConn          *nats.Conn
	StorageType     jetstream.StorageType
	JetStreamDomain string
}

NatsConnConfiguration represents the configuration for a NATS connection.

- Conn: The NATS connection. - TxConn: The transactional NATS connection. - StorageType: The storage type for JetStream.

type NatsService

type NatsService struct {
	Js   jetstream.JetStream
	TxJS jetstream.JetStream
	Conn common.NatsConn

	StorageType jetstream.StorageType

	Rwmx sync.RWMutex
	// contains filtered or unexported fields
}

NatsService contains items enabling nats related communications e.g. publish, nats object manipulation via jetstream and namespaced KV access.

func NewNatsService

func NewNatsService(nc *NatsConnConfiguration) (*NatsService, error)

NewNatsService constructs a new NatsService

func (*NatsService) KvsFor

func (s *NatsService) KvsFor(ctx context.Context, ns string) (*NamespaceKvs, error)

KvsFor retrieves the shar KVs for a given namespace. If they do not exist for a namespace, it will initialise them and store them in a map for future lookup.

func (*NatsService) PublishMsg added in v1.1.1687

func (ns *NatsService) PublishMsg(ctx context.Context, subject string, sharMsg proto.Message) error

PublishMsg publishes a workflow message.

func (*NatsService) PublishWorkflowState added in v1.1.1687

func (ns *NatsService) PublishWorkflowState(ctx context.Context, stateName string, state *model.WorkflowState, opts ...PublishOpt) error

PublishWorkflowState publishes a SHAR state object to a given subject

type PublishOpt added in v1.1.1687

type PublishOpt interface {
	Apply(n *PublishOptions)
}

PublishOpt represents an option that can be used when publishing a workflow state

type PublishOptions added in v1.1.1687

type PublishOptions struct {
	Embargo int
	ID      string
	// contains filtered or unexported fields
}

PublishOptions represents all options that are changeable when publishing workflow state

Jump to

Keyboard shortcuts

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