metadata

package
v0.0.0-...-8846729 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 15 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithMetadataApiClientFactory

func WithMetadataApiClientFactory(f func(name string) (traits.MetadataApiClient, error)) router.Option

WithMetadataApiClientFactory instructs the router to create a new client the first time Get is called for that name.

func WithMetadataInfoClientFactory

func WithMetadataInfoClientFactory(f func(name string) (traits.MetadataInfoClient, error)) router.Option

WithMetadataInfoClientFactory instructs the router to create a new client the first time Get is called for that name.

Types

type ApiRouter

ApiRouter is a traits.MetadataApiServer that allows routing named requests to specific traits.MetadataApiClient

func NewApiRouter

func NewApiRouter(opts ...router.Option) *ApiRouter

func (*ApiRouter) Add

func (r *ApiRouter) Add(name string, client any) any

Add extends Router.Add to panic if client is not of type traits.MetadataApiClient.

func (*ApiRouter) AddMetadataApiClient

func (r *ApiRouter) AddMetadataApiClient(name string, client traits.MetadataApiClient) traits.MetadataApiClient

func (*ApiRouter) GetMetadata

func (r *ApiRouter) GetMetadata(ctx context.Context, request *traits.GetMetadataRequest) (*traits.Metadata, error)

func (*ApiRouter) GetMetadataApiClient

func (r *ApiRouter) GetMetadataApiClient(name string) (traits.MetadataApiClient, error)

func (*ApiRouter) HoldsType

func (r *ApiRouter) HoldsType(client any) bool

func (*ApiRouter) PullMetadata

func (*ApiRouter) Register

func (r *ApiRouter) Register(server grpc.ServiceRegistrar)

func (*ApiRouter) RemoveMetadataApiClient

func (r *ApiRouter) RemoveMetadataApiClient(name string) traits.MetadataApiClient

type ApiWrapper

type ApiWrapper struct {
	traits.MetadataApiClient
	// contains filtered or unexported fields
}

func WrapApi

func WrapApi(server traits.MetadataApiServer) *ApiWrapper

WrapApi adapts a traits.MetadataApiServer and presents it as a traits.MetadataApiClient

func (*ApiWrapper) Unwrap

func (w *ApiWrapper) Unwrap() any

Unwrap implements wrap.Unwrapper and returns the underlying server instance as an unknown type.

func (*ApiWrapper) UnwrapServer

func (w *ApiWrapper) UnwrapServer() traits.MetadataApiServer

UnwrapServer returns the underlying server instance.

func (*ApiWrapper) UnwrapService

func (w *ApiWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)

type Collection

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

func NewCollection

func NewCollection(opts ...resource.Option) *Collection

func (*Collection) DeleteMetadata

func (m *Collection) DeleteMetadata(name string, opts ...resource.WriteOption) (*traits.Metadata, error)

func (*Collection) GetMetadata

func (m *Collection) GetMetadata(name string, opts ...resource.ReadOption) (*traits.Metadata, error)

func (*Collection) ListMetadata

func (m *Collection) ListMetadata(opts ...resource.ReadOption) []*traits.Metadata

func (*Collection) MergeMetadata

func (m *Collection) MergeMetadata(name string, metadata *traits.Metadata, opts ...resource.WriteOption) (*traits.Metadata, error)

MergeMetadata writes any present fields in metadata to the existing data. Traits that exist in the given metadata are merged with existing traits, so that each trait appears only once and the 'more' maps are merged.

func (*Collection) PullAllMetadata

func (m *Collection) PullAllMetadata(ctx context.Context, opts ...resource.ReadOption) <-chan CollectionChange

func (*Collection) PullMetadata

func (m *Collection) PullMetadata(ctx context.Context, name string, opts ...resource.ReadOption) <-chan *traits.PullMetadataResponse_Change

func (*Collection) UpdateMetadata

func (m *Collection) UpdateMetadata(name string, metadata *traits.Metadata, opts ...resource.WriteOption) (*traits.Metadata, error)

func (*Collection) UpdateTraitMetadata

func (m *Collection) UpdateTraitMetadata(name string, traitMetadata *traits.TraitMetadata, opts ...resource.WriteOption) (*traits.Metadata, error)

type CollectionChange

type CollectionChange struct {
	Name          string
	ChangeTime    time.Time
	ChangeType    types.ChangeType
	OldValue      *traits.Metadata
	NewValue      *traits.Metadata
	LastSeedValue bool
}

type CollectionServer

type CollectionServer struct {
	traits.UnimplementedMetadataApiServer
	// contains filtered or unexported fields
}

func NewCollectionServer

func NewCollectionServer(model *Collection) *CollectionServer

func (*CollectionServer) GetMetadata

func (*CollectionServer) PullMetadata

func (*CollectionServer) Unwrap

func (s *CollectionServer) Unwrap() any

type InfoRouter

InfoRouter is a traits.MetadataInfoServer that allows routing named requests to specific traits.MetadataInfoClient

func NewInfoRouter

func NewInfoRouter(opts ...router.Option) *InfoRouter

func (*InfoRouter) Add

func (r *InfoRouter) Add(name string, client any) any

Add extends Router.Add to panic if client is not of type traits.MetadataInfoClient.

func (*InfoRouter) AddMetadataInfoClient

func (r *InfoRouter) AddMetadataInfoClient(name string, client traits.MetadataInfoClient) traits.MetadataInfoClient

func (*InfoRouter) GetMetadataInfoClient

func (r *InfoRouter) GetMetadataInfoClient(name string) (traits.MetadataInfoClient, error)

func (*InfoRouter) HoldsType

func (r *InfoRouter) HoldsType(client any) bool

func (*InfoRouter) Register

func (r *InfoRouter) Register(server grpc.ServiceRegistrar)

func (*InfoRouter) RemoveMetadataInfoClient

func (r *InfoRouter) RemoveMetadataInfoClient(name string) traits.MetadataInfoClient

type InfoWrapper

type InfoWrapper struct {
	traits.MetadataInfoClient
	// contains filtered or unexported fields
}

func WrapInfo

func WrapInfo(server traits.MetadataInfoServer) *InfoWrapper

WrapInfo adapts a traits.MetadataInfoServer and presents it as a traits.MetadataInfoClient

func (*InfoWrapper) Unwrap

func (w *InfoWrapper) Unwrap() any

Unwrap implements wrap.Unwrapper and returns the underlying server instance as an unknown type.

func (*InfoWrapper) UnwrapServer

func (w *InfoWrapper) UnwrapServer() traits.MetadataInfoServer

UnwrapServer returns the underlying server instance.

func (*InfoWrapper) UnwrapService

func (w *InfoWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)

type Model

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

func NewModel

func NewModel(opts ...resource.Option) *Model

func (*Model) GetMetadata

func (m *Model) GetMetadata(opts ...resource.ReadOption) (*traits.Metadata, error)

func (*Model) MergeMetadata

func (m *Model) MergeMetadata(metadata *traits.Metadata, opts ...resource.WriteOption) (*traits.Metadata, error)

MergeMetadata writes any present fields in metadata to the existing data. Traits that exist in the given metadata are merged with existing traits, so that each trait appears only once and the 'more' maps are merged.

func (*Model) PullMetadata

func (m *Model) PullMetadata(ctx context.Context, opts ...resource.ReadOption) <-chan *traits.PullMetadataResponse_Change

func (*Model) UpdateMetadata

func (m *Model) UpdateMetadata(metadata *traits.Metadata, opts ...resource.WriteOption) (*traits.Metadata, error)

func (*Model) UpdateTraitMetadata

func (m *Model) UpdateTraitMetadata(traitMetadata *traits.TraitMetadata, opts ...resource.WriteOption) (*traits.Metadata, error)

type ModelServer

type ModelServer struct {
	traits.UnimplementedMetadataApiServer
	// contains filtered or unexported fields
}

func NewModelServer

func NewModelServer(model *Model) *ModelServer

func (*ModelServer) GetMetadata

func (s *ModelServer) GetMetadata(_ context.Context, request *traits.GetMetadataRequest) (*traits.Metadata, error)

func (*ModelServer) PullMetadata

func (*ModelServer) Register

func (s *ModelServer) Register(server grpc.ServiceRegistrar)

func (*ModelServer) Unwrap

func (s *ModelServer) Unwrap() any

Jump to

Keyboard shortcuts

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