resources

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: Apache-2.0 Imports: 19 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const PublishToCloud schema.BitMask = 1 << 7

Variables

This section is empty.

Functions

func CreateResponseBadRequest

func CreateResponseBadRequest(ctx context.Context, err error) (*pool.Message, error)

func CreateResponseContent

func CreateResponseContent(ctx context.Context, data interface{}, code codes.Code) (*pool.Message, error)

func CreateResponseMethodNotAllowed

func CreateResponseMethodNotAllowed(ctx context.Context, token message.Token) *pool.Message

func GetETag

func GetETag() uint64

func MergeCBORStructs

func MergeCBORStructs(a ...interface{}) interface{}

func ToUUID

func ToUUID(id string) uuid.UUID

func Unique

func Unique(strSlice []string) []string

Types

type CreateSubscriptionFunc

type CreateSubscriptionFunc func(req *net.Request, handler func(msg *pool.Message, err error)) (cancel func(), err error)

type GetHandlerFunc

type GetHandlerFunc func(req *net.Request) (*pool.Message, error)

type PostHandlerFunc

type PostHandlerFunc func(req *net.Request) (*pool.Message, error)

type Resource

type Resource struct {
	Href               string
	ResourceTypes      []string
	ResourceInterfaces []string
	PolicyBitMask      schema.BitMask
	// contains filtered or unexported fields
}

func NewResource

func NewResource(href string, getHandler GetHandlerFunc, postHandler PostHandlerFunc, resourceTypes, resourceInterfaces []string) *Resource

func (*Resource) Close

func (r *Resource) Close()

Close closes resource and cancel all subscriptions

func (*Resource) ETag

func (r *Resource) ETag() []byte

func (*Resource) GetHref

func (r *Resource) GetHref() string

func (*Resource) GetPolicyBitMask

func (r *Resource) GetPolicyBitMask() schema.BitMask

func (*Resource) GetResourceInterfaces

func (r *Resource) GetResourceInterfaces() []string

func (*Resource) GetResourceTypes

func (r *Resource) GetResourceTypes() []string

func (*Resource) HandleRequest

func (r *Resource) HandleRequest(req *net.Request) (*pool.Message, error)

func (*Resource) SetObserveHandler

func (r *Resource) SetObserveHandler(createSubscription CreateSubscriptionFunc)

func (*Resource) UpdateETag

func (r *Resource) UpdateETag()

Directories

Path Synopsis
secure

Jump to

Keyboard shortcuts

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