settings

package
v0.0.0-...-143e6d5 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestGet  = RequestRawGet
	RequestSet  = RequestRawSet
	RequestList = RequestRawList

	EventChanged = EventSettingsChanged
)
View Source
const (
	ServiceName        = "dev.avyos.settings"
	ServiceID   uint32 = 96
)
View Source
const (
	RequestRawGet  uint16 = 0x0201
	RequestRawSet  uint16 = 0x0202
	RequestRawList uint16 = 0x0203
)
View Source
const (
	EventSettingsChanged uint16 = 0x0301
)

Variables

This section is empty.

Functions

func DecodeGetResponse

func DecodeGetResponse(data []byte) (string, error)

func DecodeKey

func DecodeKey(data []byte) (string, error)

func DecodeSetRequest

func DecodeSetRequest(data []byte) (string, string, error)

func EncodeChangedEvent

func EncodeChangedEvent(key, value string) []byte

func EncodeEntryList

func EncodeEntryList(entries []Entry) []byte

func EncodeGetResponse

func EncodeGetResponse(value string) []byte

func EncodeKey

func EncodeKey(key string) ([]byte, error)

func EncodeSetRequest

func EncodeSetRequest(key, value string) ([]byte, error)

Types

type ChangedEvent

type ChangedEvent struct {
	Key   string
	Value string
}

func DecodeChangedEvent

func DecodeChangedEvent(data []byte) (ChangedEvent, error)

func (ChangedEvent) MarshalBinary

func (v ChangedEvent) MarshalBinary() []byte

func (*ChangedEvent) UnmarshalBinary

func (v *ChangedEvent) UnmarshalBinary(data []byte) error

type Client

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

func Connect

func Connect() (*Client, error)

func NewClient

func NewClient(socketPath string) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Get

func (c *Client) Get(key string) (string, error)

func (*Client) List

func (c *Client) List(prefix string) ([]Entry, error)

func (*Client) OnBranchChanged

func (c *Client) OnBranchChanged(prefix string, fn func(ChangedEvent))

func (*Client) OnChanged

func (c *Client) OnChanged(fn func(ChangedEvent))

func (*Client) OnDisconnect

func (c *Client) OnDisconnect(fn func())

func (*Client) OnSettingsChanged

func (c *Client) OnSettingsChanged(fn func(sender uint32, ev ChangedEvent))

func (*Client) Raw

func (c *Client) Raw() *sutra.Client

func (*Client) RawGet

func (c *Client) RawGet(req KeyRequest) (GetResponse, error)

func (*Client) RawList

func (c *Client) RawList(req ListRequest) (EntryList, error)

func (*Client) RawSet

func (c *Client) RawSet(req SetRequest) (Empty, error)

func (*Client) Set

func (c *Client) Set(key, value string) error

func (*Client) SetTimeout

func (c *Client) SetTimeout(timeout time.Duration)

type Empty

type Empty struct {
}

func (Empty) MarshalBinary

func (v Empty) MarshalBinary() []byte

func (*Empty) UnmarshalBinary

func (v *Empty) UnmarshalBinary(data []byte) error

type Entry

type Entry struct {
	Key   string
	Value string
}

func DecodeEntryList

func DecodeEntryList(data []byte) ([]Entry, error)

func (Entry) MarshalBinary

func (v Entry) MarshalBinary() []byte

func (*Entry) UnmarshalBinary

func (v *Entry) UnmarshalBinary(data []byte) error

type EntryList

type EntryList struct {
	Items []Entry
}

func (EntryList) MarshalBinary

func (v EntryList) MarshalBinary() []byte

func (*EntryList) UnmarshalBinary

func (v *EntryList) UnmarshalBinary(data []byte) error

type GetResponse

type GetResponse struct {
	Value string
}

func (GetResponse) MarshalBinary

func (v GetResponse) MarshalBinary() []byte

func (*GetResponse) UnmarshalBinary

func (v *GetResponse) UnmarshalBinary(data []byte) error

type KeyRequest

type KeyRequest struct {
	Key string
}

func (KeyRequest) MarshalBinary

func (v KeyRequest) MarshalBinary() []byte

func (*KeyRequest) UnmarshalBinary

func (v *KeyRequest) UnmarshalBinary(data []byte) error

type ListRequest

type ListRequest struct {
	Prefix string
}

func (ListRequest) MarshalBinary

func (v ListRequest) MarshalBinary() []byte

func (*ListRequest) UnmarshalBinary

func (v *ListRequest) UnmarshalBinary(data []byte) error

type SetRequest

type SetRequest struct {
	Key   string
	Value string
}

func (SetRequest) MarshalBinary

func (v SetRequest) MarshalBinary() []byte

func (*SetRequest) UnmarshalBinary

func (v *SetRequest) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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