contract

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package contract contains the Negotiation type and all related code.

Index

Constants

This section is empty.

Variables

View Source
var States = statesContainer{
	INITIAL: State{
		// contains filtered or unexported fields
	},
	REQUESTED: State{
		// contains filtered or unexported fields
	},
	OFFERED: State{
		// contains filtered or unexported fields
	},
	AGREED: State{
		// contains filtered or unexported fields
	},
	ACCEPTED: State{
		// contains filtered or unexported fields
	},
	VERIFIED: State{
		// contains filtered or unexported fields
	},
	FINALIZED: State{
		// contains filtered or unexported fields
	},
	TERMINATED: State{
		// contains filtered or unexported fields
	},
}

Functions

func ExhaustiveStates

func ExhaustiveStates(f func(State))

func GenerateStorageKey

func GenerateStorageKey(id uuid.UUID, role constants.DataspaceRole) []byte

GenerateStorageKey generates a key for a contract negotiation.

Types

type Negotiation

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

Negotiation represents a contract negotiation.

func FromBytes

func FromBytes(b []byte) (*Negotiation, error)

func New

func New(
	providerPID, consumerPID uuid.UUID,
	state State,
	offer odrl.Offer,
	callback, self *url.URL,
	role constants.DataspaceRole,
) *Negotiation

func (*Negotiation) GetAgreement

func (cn *Negotiation) GetAgreement() *odrl.Agreement

func (*Negotiation) GetCallback

func (cn *Negotiation) GetCallback() *url.URL

func (*Negotiation) GetConsumerPID

func (cn *Negotiation) GetConsumerPID() uuid.UUID

func (*Negotiation) GetContract

func (cn *Negotiation) GetContract() *Negotiation

func (*Negotiation) GetContractNegotiation

func (cn *Negotiation) GetContractNegotiation() shared.ContractNegotiation

GetContractNegotiation returns a ContractNegotiation message.

func (*Negotiation) GetOffer

func (cn *Negotiation) GetOffer() odrl.Offer

func (*Negotiation) GetProviderPID

func (cn *Negotiation) GetProviderPID() uuid.UUID

Negotiation getters.

func (*Negotiation) GetRole

func (cn *Negotiation) GetRole() constants.DataspaceRole

func (*Negotiation) GetSelf

func (cn *Negotiation) GetSelf() *url.URL

func (*Negotiation) GetState

func (cn *Negotiation) GetState() State

func (*Negotiation) Initial

func (cn *Negotiation) Initial() bool

func (*Negotiation) Modified

func (cn *Negotiation) Modified() bool

func (*Negotiation) ReadOnly

func (cn *Negotiation) ReadOnly() bool

Properties that decisions are based on.

func (*Negotiation) SetAgreement

func (cn *Negotiation) SetAgreement(a *odrl.Agreement)

func (*Negotiation) SetCallback

func (cn *Negotiation) SetCallback(u string) error

SetCallback sets the remote callback root.

func (*Negotiation) SetConsumerPID

func (cn *Negotiation) SetConsumerPID(u uuid.UUID)

func (*Negotiation) SetInitial

func (cn *Negotiation) SetInitial()

func (*Negotiation) SetProviderPID

func (cn *Negotiation) SetProviderPID(u uuid.UUID)

Negotiation setters, these will panic when the negotiation is RO.

func (*Negotiation) SetReadOnly

func (cn *Negotiation) SetReadOnly()

Property setters.

func (*Negotiation) SetState

func (cn *Negotiation) SetState(state State) error

func (*Negotiation) StorageKey

func (cn *Negotiation) StorageKey() []byte

func (*Negotiation) ToBytes

func (cn *Negotiation) ToBytes() ([]byte, error)

ToBytes returns a binary representation of the negotiation, one that is compatible with the FromBytes function.

func (*Negotiation) UnsetInitial

func (cn *Negotiation) UnsetInitial()

type State

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

func ParseState

func ParseState(a any) (State, error)

func (*State) GobDecode

func (p *State) GobDecode(b []byte) error

func (State) GobEncode

func (p State) GobEncode() ([]byte, error)

func (State) IsValid

func (p State) IsValid() bool

func (State) MarshalJSON

func (p State) MarshalJSON() ([]byte, error)

func (*State) Scan

func (p *State) Scan(value any) error

func (State) String

func (i State) String() string

func (*State) UnmarshalJSON

func (p *State) UnmarshalJSON(b []byte) error

func (State) Value

func (p State) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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