api

package
v0.0.0-...-7c8058c Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 5 Imported by: 3

Documentation

Overview

*

  • MIT License *
  • Copyright (c) 2018 - 2020 CNES *
  • Permission is hereby granted, free of charge, to any person obtaining a copy
  • of this software and associated documentation files (the "Software"), to deal
  • in the Software without restriction, including without limitation the rights
  • to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  • copies of the Software, and to permit persons to whom the Software is
  • furnished to do so, subject to the following conditions: *
  • The above copyright notice and this permission notice shall be included in all
  • copies or substantial portions of the Software. *
  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  • IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  • FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  • AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  • LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  • OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  • SOFTWARE.

*

  • MIT License *
  • Copyright (c) 2020 CNES *
  • Permission is hereby granted, free of charge, to any person obtaining a copy
  • of this software and associated documentation files (the "Software"), to deal
  • in the Software without restriction, including without limitation the rights
  • to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  • copies of the Software, and to permit persons to whom the Software is
  • furnished to do so, subject to the following conditions: *
  • The above copyright notice and this permission notice shall be included in all
  • copies or substantial portions of the Software. *
  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  • IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  • FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  • AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  • LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  • OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  • SOFTWARE.

*

  • MIT License *
  • Copyright (c) 2017 - 2020 CNES *
  • Permission is hereby granted, free of charge, to any person obtaining a copy
  • of this software and associated documentation files (the "Software"), to deal
  • in the Software without restriction, including without limitation the rights
  • to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  • copies of the Software, and to permit persons to whom the Software is
  • furnished to do so, subject to the following conditions: *
  • The above copyright notice and this permission notice shall be included in all
  • copies or substantial portions of the Software. *
  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  • IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  • FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  • AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  • LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  • OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  • SOFTWARE.

*

  • MIT License *
  • Copyright (c) 2017 - 2020 CNES *
  • Permission is hereby granted, free of charge, to any person obtaining a copy
  • of this software and associated documentation files (the "Software"), to deal
  • in the Software without restriction, including without limitation the rights
  • to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  • copies of the Software, and to permit persons to whom the Software is
  • furnished to do so, subject to the following conditions: *
  • The above copyright notice and this permission notice shall be included in all
  • copies or substantial portions of the Software. *
  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  • IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  • FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  • AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  • LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  • OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  • SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrokerTransaction

type BrokerTransaction interface {
	Transaction
	AckRegister(body Body, isError bool) error
	AckDeregister(body Body, isError bool) error
}

type ClientContext

type ClientContext struct {
	Ctx *Context
	Uri *URI

	AuthenticationId Blob
	EncodingId       UOctet
	QoSLevel         QoSLevel
	Priority         UInteger
	Domain           IdentifierList
	NetworkZone      Identifier
	Session          SessionType
	SessionName      Identifier
	// contains filtered or unexported fields
}

func NewClientContext

func NewClientContext(ctx *Context, service string) (*ClientContext, error)

func (*ClientContext) Close

func (cctx *ClientContext) Close() error

func (*ClientContext) NewInvokeOperation

func (cctx *ClientContext) NewInvokeOperation(urito *URI, area UShort, areaVersion UOctet, service UShort, operation UShort) InvokeOperation

func (*ClientContext) NewProgressOperation

func (cctx *ClientContext) NewProgressOperation(urito *URI, area UShort, areaVersion UOctet, service UShort, operation UShort) ProgressOperation

func (*ClientContext) NewPublisherOperation

func (cctx *ClientContext) NewPublisherOperation(urito *URI, area UShort, areaVersion UOctet, service UShort, operation UShort) PublisherOperation

func (*ClientContext) NewRequestOperation

func (cctx *ClientContext) NewRequestOperation(urito *URI, area UShort, areaVersion UOctet, service UShort, operation UShort) RequestOperation

func (*ClientContext) NewSendOperation

func (cctx *ClientContext) NewSendOperation(urito *URI, area UShort, areaVersion UOctet, service UShort, operation UShort) SendOperation

func (*ClientContext) NewSubmitOperation

func (cctx *ClientContext) NewSubmitOperation(urito *URI, area UShort, areaVersion UOctet, service UShort, operation UShort) SubmitOperation

func (*ClientContext) NewSubscriberOperation

func (cctx *ClientContext) NewSubscriberOperation(urito *URI, area UShort, areaVersion UOctet, service UShort, operation UShort) SubscriberOperation

func (*ClientContext) OnClose

func (cctx *ClientContext) OnClose() error

Closes operations and handlers.

func (*ClientContext) OnMessage

func (cctx *ClientContext) OnMessage(msg *Message)

TODO (AF): Take in account operations and handlers!!

func (*ClientContext) RegisterBrokerHandler

func (cctx *ClientContext) RegisterBrokerHandler(area UShort, areaVersion UOctet, service UShort, operation UShort, handler ProviderHandler) error

func (*ClientContext) RegisterInvokeHandler

func (cctx *ClientContext) RegisterInvokeHandler(area UShort, areaVersion UOctet, service UShort, operation UShort, handler ProviderHandler) error

Register an handler for Invoke interaction

func (*ClientContext) RegisterProgressHandler

func (cctx *ClientContext) RegisterProgressHandler(area UShort, areaVersion UOctet, service UShort, operation UShort, handler ProviderHandler) error

Register an handler for progress interaction

func (*ClientContext) RegisterRequestHandler

func (cctx *ClientContext) RegisterRequestHandler(area UShort, areaVersion UOctet, service UShort, operation UShort, handler ProviderHandler) error

Register an handler for Request interaction

func (*ClientContext) RegisterSendHandler

func (cctx *ClientContext) RegisterSendHandler(area UShort, areaVersion UOctet, service UShort, operation UShort, handler ProviderHandler) error

Register an handler for Send interaction

func (*ClientContext) RegisterSubmitHandler

func (cctx *ClientContext) RegisterSubmitHandler(area UShort, areaVersion UOctet, service UShort, operation UShort, handler ProviderHandler) error

Register an handler for Submit interaction

func (*ClientContext) SetAuthenticationId

func (cctx *ClientContext) SetAuthenticationId(AuthenticationId Blob) *ClientContext

func (*ClientContext) SetConcurrency

func (cctx *ClientContext) SetConcurrency(multi bool) *ClientContext

Be careful concurrency is needed to allow the use of ClientContext in a nested way. However concurrency should be then handled in provider.

func (*ClientContext) SetDomain

func (cctx *ClientContext) SetDomain(Domain IdentifierList) *ClientContext

func (*ClientContext) SetEncodingId

func (cctx *ClientContext) SetEncodingId(EncodingId UOctet) *ClientContext

func (*ClientContext) SetNetworkZone

func (cctx *ClientContext) SetNetworkZone(NetworkZone Identifier) *ClientContext

func (*ClientContext) SetPriority

func (cctx *ClientContext) SetPriority(Priority UInteger) *ClientContext

func (*ClientContext) SetQoSLevel

func (cctx *ClientContext) SetQoSLevel(QoSLevel QoSLevel) *ClientContext

func (*ClientContext) SetSession

func (cctx *ClientContext) SetSession(Session SessionType) *ClientContext

func (*ClientContext) SetSessionName

func (cctx *ClientContext) SetSessionName(SessionName Identifier) *ClientContext

func (*ClientContext) TransactionId

func (cctx *ClientContext) TransactionId() ULong

type InvokeOperation

type InvokeOperation interface {
	Operation
	Invoke(body Body) (*Message, error)
	GetResponse() (*Message, error)
}

type InvokeOperationX

type InvokeOperationX struct {
	OperationX
	// contains filtered or unexported fields
}

func (*InvokeOperationX) GetResponse

func (op *InvokeOperationX) GetResponse() (*Message, error)

Returns the response.

func (*InvokeOperationX) Invoke

func (op *InvokeOperationX) Invoke(body Body) (*Message, error)

type InvokeTransaction

type InvokeTransaction interface {
	Transaction
	Ack(body Body, isError bool) error
	Reply(body Body, isError bool) error
}

type InvokeTransactionX

type InvokeTransactionX struct {
	TransactionX
}

func (*InvokeTransactionX) Ack

func (tx *InvokeTransactionX) Ack(body Body, isError bool) error

func (*InvokeTransactionX) Reply

func (tx *InvokeTransactionX) Reply(body Body, isError bool) error

type MalError

type MalError struct {
	Code      mal.UInteger
	ExtraInfo mal.Element
}

* This structure represents an error as it can be returned by an operation according to the CCSDS MAL specification. * It includes a code, represented by a UInteger, and extra information, represented by an abstract Element. * The MalError structure also conforms to the error interface of the standard errors go package. * A MalError may then be returned when an error is expected. * * The MalError structure is generally not used in the malgo api functions, as the concrete type of the Element * in the extra information is specific to service operations, and cannot be known by generic mal functions.

func NewMalError

func NewMalError(code mal.UInteger, extraInfo ...mal.Element) *MalError

func (*MalError) Error

func (e *MalError) Error() string

type Operation

type Operation interface {
	// Get current TransactionId
	GetTid() ULong
	// Returns a new Body ready to encode
	NewBody() Body
	// Interrupt the operation during a blocking processing.
	Interrupt()
	// Reset the operation in order to reuse it
	Reset() error
	// Close the operation
	Close() error
}

type OperationHandler

type OperationHandler interface {
	// contains filtered or unexported methods
}

type OperationX

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

func (*OperationX) Close

func (op *OperationX) Close() error

Closes the operation. Be careful a closed operation cannot be used anymore.

func (*OperationX) GetTid

func (op *OperationX) GetTid() ULong

func (*OperationX) Interrupt

func (op *OperationX) Interrupt()

Interrupts the operation.

func (*OperationX) NewBody

func (op *OperationX) NewBody() Body

func (*OperationX) Reset

func (op *OperationX) Reset() error

Resets the operation for a new use, a new TransactionId is allocated. Be careful, the operation must be in a FINAL state

type ProgressOperation

type ProgressOperation interface {
	Operation
	Progress(body Body) (*Message, error)
	GetUpdate() (*Message, error)
	GetResponse() (*Message, error)
}

type ProgressOperationX

type ProgressOperationX struct {
	OperationX
	// contains filtered or unexported fields
}

func (*ProgressOperationX) GetResponse

func (op *ProgressOperationX) GetResponse() (*Message, error)

Returns the response.

func (*ProgressOperationX) GetUpdate

func (op *ProgressOperationX) GetUpdate() (*Message, error)

Returns next update or nil if there is no more update.

func (*ProgressOperationX) Progress

func (op *ProgressOperationX) Progress(body Body) (*Message, error)

type ProgressTransaction

type ProgressTransaction interface {
	Transaction
	Ack(body Body, isError bool) error
	Update(body Body, isError bool) error
	Reply(body Body, isError bool) error
}

type ProgressTransactionX

type ProgressTransactionX struct {
	TransactionX
}

func (*ProgressTransactionX) Ack

func (tx *ProgressTransactionX) Ack(body Body, isError bool) error

func (*ProgressTransactionX) Reply

func (tx *ProgressTransactionX) Reply(body Body, isError bool) error

func (*ProgressTransactionX) Update

func (tx *ProgressTransactionX) Update(body Body, isError bool) error

type ProviderHandler

type ProviderHandler func(*Message, Transaction) error

Defines a generic handler interface for providers

type PublisherOperation

type PublisherOperation interface {
	Operation
	Register(body Body) (*Message, error)
	Publish(body Body) error
	GetPublishError() (*Message, error)
	Deregister(body Body) (*Message, error)
}

type PublisherOperationX

type PublisherOperationX struct {
	OperationX
}

func (*PublisherOperationX) Deregister

func (op *PublisherOperationX) Deregister(body Body) (*Message, error)

func (*PublisherOperationX) GetPublishError

func (op *PublisherOperationX) GetPublishError() (*Message, error)

func (*PublisherOperationX) Publish

func (op *PublisherOperationX) Publish(body Body) error

func (*PublisherOperationX) Register

func (op *PublisherOperationX) Register(body Body) (*Message, error)

type PublisherTransaction

type PublisherTransaction interface {
	BrokerTransaction
	// PublishError to return error on Publish.
	PublishError(body Body) error
}

type PublisherTransactionX

type PublisherTransactionX struct {
	TransactionX
}

func (*PublisherTransactionX) AckDeregister

func (tx *PublisherTransactionX) AckDeregister(body Body, isError bool) error

func (*PublisherTransactionX) AckRegister

func (tx *PublisherTransactionX) AckRegister(body Body, isError bool) error

func (*PublisherTransactionX) PublishError

func (tx *PublisherTransactionX) PublishError(body Body) error

TODO (AF): Get fields from original Register

type RequestOperation

type RequestOperation interface {
	Operation
	Request(body Body) (*Message, error)
}

type RequestOperationX

type RequestOperationX struct {
	OperationX
}

func (*RequestOperationX) Request

func (op *RequestOperationX) Request(body Body) (*Message, error)

type RequestTransaction

type RequestTransaction interface {
	Transaction
	Reply(body Body, isError bool) error
}

type RequestTransactionX

type RequestTransactionX struct {
	TransactionX
}

func (*RequestTransactionX) Reply

func (tx *RequestTransactionX) Reply(body Body, isError bool) error

type SendOperation

type SendOperation interface {
	Operation
	Send(body Body) error
}

type SendOperationX

type SendOperationX struct {
	OperationX
}

func (*SendOperationX) Send

func (op *SendOperationX) Send(body Body) error

type SendTransaction

type SendTransaction interface {
	Transaction
}

type SendTransactionX

type SendTransactionX struct {
	TransactionX
}

type SubmitOperation

type SubmitOperation interface {
	Operation
	Submit(body Body) (*Message, error)
}

type SubmitOperationX

type SubmitOperationX struct {
	OperationX
}

func (*SubmitOperationX) Submit

func (op *SubmitOperationX) Submit(body Body) (*Message, error)

type SubmitTransaction

type SubmitTransaction interface {
	Transaction
	Ack(body Body, isError bool) error
}

type SubmitTransactionX

type SubmitTransactionX struct {
	TransactionX
}

func (*SubmitTransactionX) Ack

func (tx *SubmitTransactionX) Ack(body Body, isError bool) error

type SubscriberOperation

type SubscriberOperation interface {
	Operation
	Register(body Body) (*Message, error)
	GetNotify() (*Message, error)
	Deregister(body Body) (*Message, error)
}

type SubscriberOperationX

type SubscriberOperationX struct {
	OperationX
}

func (*SubscriberOperationX) Deregister

func (op *SubscriberOperationX) Deregister(body Body) (*Message, error)

func (*SubscriberOperationX) GetNotify

func (op *SubscriberOperationX) GetNotify() (*Message, error)

Returns next notify.

func (*SubscriberOperationX) Register

func (op *SubscriberOperationX) Register(body Body) (*Message, error)

type SubscriberTransaction

type SubscriberTransaction interface {
	BrokerTransaction
	Notify(body Body, isError bool) error
}

type SubscriberTransactionX

type SubscriberTransactionX struct {
	TransactionX
}

func (*SubscriberTransactionX) AckDeregister

func (tx *SubscriberTransactionX) AckDeregister(body Body, isError bool) error

func (*SubscriberTransactionX) AckRegister

func (tx *SubscriberTransactionX) AckRegister(body Body, isError bool) error

func (*SubscriberTransactionX) Notify

func (tx *SubscriberTransactionX) Notify(body Body, isError bool) error

type Transaction

type Transaction interface {

	// Returns a new Body ready to encode
	NewBody() Body
	// contains filtered or unexported methods
}

Defines a generic root Transaction interface (context of an incoming interaction)

type TransactionX

type TransactionX struct {
	AuthenticationId Blob
	EncodingId       UOctet
	QoSLevel         QoSLevel
	Priority         UInteger
	Domain           IdentifierList
	NetworkZone      Identifier
	Session          SessionType
	SessionName      Identifier
	// contains filtered or unexported fields
}

Defines a generic root Transaction structure

func (*TransactionX) NewBody

func (tx *TransactionX) NewBody() Body

Jump to

Keyboard shortcuts

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