weaver

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: CC0-1.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionIWeaverGetConfig = binder.FirstCallTransaction + 0
	TransactionIWeaverRead      = binder.FirstCallTransaction + 1
	TransactionIWeaverWrite     = binder.FirstCallTransaction + 2
)
View Source
const (
	MethodIWeaverGetConfig = "getConfig"
	MethodIWeaverRead      = "read"
	MethodIWeaverWrite     = "write"
)
View Source
const (
	IWeaverStatusFailed       int32 = 1
	IWeaverStatusIncorrectKey int32 = 2
	IWeaverStatusThrottle     int32 = 3
)
View Source
const DescriptorIWeaver = "android.hardware.weaver.IWeaver"

Variables

This section is empty.

Functions

This section is empty.

Types

type IWeaver

type IWeaver interface {
	AsBinder() binder.IBinder
	GetConfig(ctx context.Context) (WeaverConfig, error)
	Read(ctx context.Context, slotId int32, key []byte) (WeaverReadResponse, error)
	Write(ctx context.Context, slotId int32, key []byte, value []byte) error
}

func NewWeaverStub

func NewWeaverStub(
	impl IWeaverServer,
) IWeaver

NewWeaverStub creates a server-side IWeaver wrapping the given server implementation. The returned value satisfies IWeaver and can be passed to proxy methods; its AsBinder() returns a *binder.StubBinder that is auto-registered with the binder driver on first use.

type IWeaverServer

type IWeaverServer interface {
	GetConfig(ctx context.Context) (WeaverConfig, error)
	Read(ctx context.Context, slotId int32, key []byte) (WeaverReadResponse, error)
	Write(ctx context.Context, slotId int32, key []byte, value []byte) error
}

IWeaverServer is the server-side interface that user implementations provide to NewWeaverStub. It contains only the business methods, without AsBinder (which is provided by the stub itself).

type WeaverConfig

type WeaverConfig struct {
	Slots     int32
	KeySize   int32
	ValueSize int32
}

func (*WeaverConfig) MarshalParcel

func (s *WeaverConfig) MarshalParcel(
	p *parcel.Parcel,
) error

func (*WeaverConfig) UnmarshalParcel

func (s *WeaverConfig) UnmarshalParcel(
	p *parcel.Parcel,
) error

type WeaverProxy

type WeaverProxy struct {
	Remote binder.IBinder
}

func NewWeaverProxy

func NewWeaverProxy(
	remote binder.IBinder,
) *WeaverProxy

func (*WeaverProxy) AsBinder

func (p *WeaverProxy) AsBinder() binder.IBinder

func (*WeaverProxy) GetConfig

func (p *WeaverProxy) GetConfig(
	ctx context.Context,
) (WeaverConfig, error)

func (*WeaverProxy) Read

func (p *WeaverProxy) Read(
	ctx context.Context,
	slotId int32,
	key []byte,
) (WeaverReadResponse, error)

func (*WeaverProxy) Write

func (p *WeaverProxy) Write(
	ctx context.Context,
	slotId int32,
	key []byte,
	value []byte,
) error

type WeaverReadResponse

type WeaverReadResponse struct {
	Timeout int64
	Value   []byte
	Status  WeaverReadStatus
}

func (*WeaverReadResponse) MarshalParcel

func (s *WeaverReadResponse) MarshalParcel(
	p *parcel.Parcel,
) error

func (*WeaverReadResponse) UnmarshalParcel

func (s *WeaverReadResponse) UnmarshalParcel(
	p *parcel.Parcel,
) error

type WeaverReadStatus

type WeaverReadStatus int32
const (
	WeaverReadStatusOK           WeaverReadStatus = 0
	WeaverReadStatusFAILED       WeaverReadStatus = 1
	WeaverReadStatusIncorrectKey WeaverReadStatus = 2
	WeaverReadStatusTHROTTLE     WeaverReadStatus = 3
)

type WeaverStub

type WeaverStub struct {
	Impl      IWeaver
	Transport binder.VersionAwareTransport
}

WeaverStub dispatches incoming binder transactions to a typed IWeaver implementation.

func (*WeaverStub) Descriptor

func (s *WeaverStub) Descriptor() string

func (*WeaverStub) OnTransaction

func (s *WeaverStub) OnTransaction(
	ctx context.Context,
	code binder.TransactionCode,
	_data *parcel.Parcel,
) (*parcel.Parcel, error)

Jump to

Keyboard shortcuts

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