crossref

package
v1.26.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: BSD-3-Clause Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkBuilder added in v1.18.1

type BulkBuilder struct {
	byteops.ReadWriter
	// contains filtered or unexported fields
}

BulkBuilder is a low-alloc tool to build many beacon strings (as []byte). It is optimized to allocate just once as opposed to once per ID. This makes it considerably faster when generating 100s of thousand of beacons strings. The main intended use case for this is building propValuePairs in ref-filters.

The BulkBuilder makes some estimations for how much memory will be necessary based on expected input params. If those requirements get exceeded, it will still be safe to use, but will fallback to allocating dynamically.

func NewBulkBuilderWithEstimates added in v1.18.1

func NewBulkBuilderWithEstimates(expectedCount int, exampleClassName string,
	overheadRatio float64,
) *BulkBuilder

func (*BulkBuilder) ClassAndID added in v1.18.1

func (bb *BulkBuilder) ClassAndID(className string,
	id strfmt.UUID,
) []byte

func (*BulkBuilder) LegacyIDOnly added in v1.18.1

func (bb *BulkBuilder) LegacyIDOnly(id strfmt.UUID) []byte

type Ref

type Ref struct {
	Local    bool        `json:"local"`
	PeerName string      `json:"peerName"`
	TargetID strfmt.UUID `json:"targetID"`
	Class    string      `json:"className"`
}

Ref is an abstraction of the cross-refs which are specified in a URI format in the API. When this type is used it is safe to assume that a Ref is semantically valid. This guarantee would not be possible on the URI format, as the URI can be well-formed, but not contain the data we expect in it. Do not use directly, such as crossref.Ref{}, as you won't have any guarantees in this case. Always use one of the parsing options or New()

func New

func New(peerName string, class string, target strfmt.UUID) *Ref

New is a safe way to generate a Reference, as all required arguments must be set in the constructor fn

func NewLocalhost

func NewLocalhost(class string, target strfmt.UUID) *Ref

func Parse

func Parse(uriString string) (*Ref, error)

Parse is a safe way to generate a Ref, as it will error if any of the input parameters are not as expected.

func ParseSingleRef

func ParseSingleRef(singleRef *models.SingleRef) (*Ref, error)

ParseSingleRef is a safe way to generate a Ref from a models.SingleRef, a helper construct that represents the API structure. It will error if any of the input parameters are not as expected.

func (*Ref) SingleRef

func (r *Ref) SingleRef() *models.SingleRef

SingleRef converts the parsed Ref back into the API helper construct containing a stringified representation (URI format) of the Ref

func (*Ref) String

func (r *Ref) String() string

type RefSource

type RefSource struct {
	Local    bool                `json:"local"`
	PeerName string              `json:"peerName"`
	Property schema.PropertyName `json:"property"`
	Class    schema.ClassName    `json:"class"`
	TargetID strfmt.UUID         `json:"targetID"`
}

RefSource is an abstraction of the source of a cross-ref. The opposite would be Ref which represents the target instead. A RefSource is specified in a URI format in the API. When this type is used it is safe to assume that a Ref is semantically valid. This guarantee would not be possible on the URI format, as the URI can be well-formed, but not contain the data we expect in it. Do not use directly, such as crossref.RefSource{}, as you won't have any guarantees in this case. Always use one of the parsing options or New()

func NewSource

func NewSource(className schema.ClassName,
	property schema.PropertyName, id strfmt.UUID,
) *RefSource

func ParseSource

func ParseSource(uriString string) (*RefSource, error)

ParseSource is a safe way to generate a RefSource, as it will error if any of the input parameters are not as expected.

func (*RefSource) String

func (r *RefSource) String() string

Jump to

Keyboard shortcuts

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