adapter

package
v0.0.0-...-befd928 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectoryAdapter string = "DIRECTORY_ADAPTER"
	DirectoryApiUrl  string = "DIRECTORY_API_URL"
)
View Source
const COMP = "api_directory"

Variables

View Source
var DEFAULT_BROKER_MODE common.BrokerMode
View Source
var MOCK_PEER_URL = common.GetEnvWithDeprecated("MOCK_PEER_URL", "MOCK_CLIENT_URL", "http://localhost:19083/iso18626")

Functions

func CompareSuppliers

func CompareSuppliers(a, b SupplierOrdering) int

func GetBrokerMode

func GetBrokerMode(vendor dirapi.EntryVendor) common.BrokerMode

func GetVendorFromUrl

func GetVendorFromUrl(url string) dirapi.EntryVendor

Types

type ApiDirectory

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

func (*ApiDirectory) FilterAndSort

func (a *ApiDirectory) FilterAndSort(ctx common.ExtendedContext, entries []Supplier, requesterData dirapi.Entry, serviceInfo *iso18626.ServiceInfo, billingInfo *iso18626.BillingInfo) ([]Supplier, RotaInfo)

func (*ApiDirectory) Lookup

type DirectoryEntry

type DirectoryEntry struct {
	Symbols       []string
	BranchSymbols []string
	Name          string
	URL           string
	Vendor        dirapi.EntryVendor
	BrokerMode    common.BrokerMode
	CustomData    dirapi.Entry
}

type DirectoryLookupAdapter

type DirectoryLookupAdapter interface {
	Lookup(ctx common.ExtendedContext, params DirectoryLookupParams) ([]DirectoryEntry, string, error)
	FilterAndSort(ctx common.ExtendedContext, entries []Supplier, requesterData dirapi.Entry, serviceInfo *iso18626.ServiceInfo, billingInfo *iso18626.BillingInfo) ([]Supplier, RotaInfo)
}

func CreateApiDirectory

func CreateApiDirectory(client *http.Client, urls []string) DirectoryLookupAdapter

func CreateDirectoryLookupAdapter

func CreateDirectoryLookupAdapter(cfg map[string]string) (DirectoryLookupAdapter, error)

type DirectoryLookupParams

type DirectoryLookupParams struct {
	Symbols []string
	Tenant  string
}

type MockDirectoryLookupAdapter

type MockDirectoryLookupAdapter struct {
}

func (*MockDirectoryLookupAdapter) FilterAndSort

func (m *MockDirectoryLookupAdapter) FilterAndSort(ctx common.ExtendedContext, entries []Supplier, requesterData dirapi.Entry, serviceInfo *iso18626.ServiceInfo, billingInfo *iso18626.BillingInfo) ([]Supplier, RotaInfo)

func (*MockDirectoryLookupAdapter) Lookup

type Network

type Network struct {
	Name       string `json:"name"`
	Priority   int    `json:"priority"`
	Reciprocal *bool  `json:"reciprocal,omitempty"`
}

type NetworkMatch

type NetworkMatch struct {
	Name     string `json:"name"`
	Priority int    `json:"priority"`
	Match    bool   `json:"match"`
}

type Request

type Request struct {
	Level string `json:"level"`
	Type  string `json:"type"`
	Cost  string `json:"cost"`
}

type Requester

type Requester struct {
	Networks []string `json:"networks"`
}

type RotaInfo

type RotaInfo struct {
	Request   Request         `json:"request"`
	Requester Requester       `json:"requester"`
	Suppliers []SupplierMatch `json:"suppliers"`
}

type Supplier

type Supplier struct {
	LocalIdentifier    string
	PeerId             string
	CustomData         dirapi.Entry
	Symbol             string
	Priority           int
	Cost               float64
	Local              bool
	Ratio              float32
	SupplierStatus     pgtype.Text
	Location           string
	ShelvingLocation   string
	ItemLoanPolicy     string
	LocationPreference int
	ShelvingPreference int
}

func (Supplier) GetCost

func (s Supplier) GetCost() float64

func (Supplier) GetLocationPreference

func (s Supplier) GetLocationPreference() int

func (Supplier) GetPriority

func (s Supplier) GetPriority() int

func (Supplier) GetRatio

func (s Supplier) GetRatio() float32

func (Supplier) GetShelvingPreference

func (s Supplier) GetShelvingPreference() int

func (Supplier) GetSymbol

func (s Supplier) GetSymbol() string

func (Supplier) IsLocal

func (s Supplier) IsLocal() bool

type SupplierMatch

type SupplierMatch struct {
	Match              bool           `json:"match"`
	Networks           []NetworkMatch `json:"networks"`
	Tiers              []TierMatch    `json:"tiers"`
	Symbol             string         `json:"symbol"`
	Priority           int            `json:"priority"`
	Cost               string         `json:"cost"`
	Local              bool           `json:"local"`
	Ratio              float32        `json:"ratio"`
	Location           string         `json:"location,omitempty"`
	ShelvingLocation   string         `json:"shelvingLocation,omitempty"`
	ItemLoanPolicy     string         `json:"itemLoanPolicy,omitempty"`
	LocationPreference int            `json:"locationPreference"`
	ShelvingPreference int            `json:"shelvingPreference"`
}

func (SupplierMatch) GetCost

func (s SupplierMatch) GetCost() float64

func (SupplierMatch) GetLocationPreference

func (s SupplierMatch) GetLocationPreference() int

func (SupplierMatch) GetPriority

func (s SupplierMatch) GetPriority() int

func (SupplierMatch) GetRatio

func (s SupplierMatch) GetRatio() float32

func (SupplierMatch) GetShelvingPreference

func (s SupplierMatch) GetShelvingPreference() int

func (SupplierMatch) GetSymbol

func (s SupplierMatch) GetSymbol() string

func (SupplierMatch) IsLocal

func (s SupplierMatch) IsLocal() bool

type SupplierOrdering

type SupplierOrdering interface {
	GetSymbol() string
	GetPriority() int
	GetCost() float64
	GetLocationPreference() int
	GetShelvingPreference() int
	GetRatio() float32
	IsLocal() bool
}

type Tier

type Tier struct {
	Name  string  `json:"name"`
	Cost  float64 `json:"cost"`
	Level string  `json:"level"`
	Type  string  `json:"type"`
}

type TierMatch

type TierMatch struct {
	Name  string `json:"name"`
	Level string `json:"level"`
	Type  string `json:"type"`
	Cost  string `json:"cost"`
	Match bool   `json:"match"`
}

Jump to

Keyboard shortcuts

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