shareddata

package module
v0.0.0-...-d7b0689 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientCallback

type ClientCallback interface {
	OnSearch(id SearchId, query string) bool
	OnSearchResult(id SearchId, result string, contact common.Contact)
	OnInvited(sharedDataId SharedDataId, me string, contact common.Contact) bool
	OnInviteAccepted(sharedData SharedData, contact common.Contact)
	OnSharedDataAvailable(sharedData SharedData)
}

type SearchId

type SearchId string

func NewSearchId

func NewSearchId(id string) SearchId

func (SearchId) String

func (s SearchId) String() string

type SharedData

type SharedData interface {
	IsProxy() bool
	GetCreator() common.Contact
	GetId() SharedDataId
	Create(key string, value interface{}, owner string, visibility string)
	CreateArray(key string, value []interface{}, owner string, visibility string)
	CreateMap(key string, value interface{}, owner string, visibility string)
	Get(key string) interface{}
	Set(key string, value interface{})
	SetMap(key string, mapKey string, value interface{})
	Append(key string, value interface{})
	GetOwner(key string) string
	SetMe(string)
	GetMe() string
	IsMe(string) bool
	OnDataChangeCB(func(key string))
	ChangeDataOwner(key string, owner string)
	GetData() map[string]data
}

func NewSharedData

func NewSharedData(creator common.Contact, id SharedDataId) SharedData

type SharedDataId

type SharedDataId string

type SharedDataManager

type SharedDataManager interface {
	GetMe() common.Contact
	Serve(s SharedData) SharedData
	JoinShare(s SharedData)
	LeaveShare(s SharedData)
	Invite(s SharedData, recipient common.Contact, as string) bool
	OnSharedDataRequestHttp(writer http.ResponseWriter, req *http.Request)
	OnSharedDataRequest(uri string, body []byte) ([]byte, int)
}

func NewSharedDataManager

func NewSharedDataManager(ctx common.CallCtx, myself common.Myself, cb ClientCallback, clientCache client.GrapevineClientCache) SharedDataManager

type SharedDataProxy

type SharedDataProxy interface {
	SharedData
	GetOrigin() SharedData
	AddInvitee(recipient common.Contact, as string)
	SendStateTo(recipient common.Contact)
}

func NewSharedDataProxy

func NewSharedDataProxy(origin SharedData, sdm *sharedDataManager) SharedDataProxy

type TestClientCallback

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

func NewTestClientCb

func NewTestClientCb(name string) *TestClientCallback

func (*TestClientCallback) OnInviteAccepted

func (cb *TestClientCallback) OnInviteAccepted(sharedData SharedData, contact common.Contact)

func (*TestClientCallback) OnInvited

func (cb *TestClientCallback) OnInvited(sharedDataId SharedDataId, me string, contact common.Contact) bool

func (*TestClientCallback) OnSearch

func (cb *TestClientCallback) OnSearch(id SearchId, query string) bool

func (*TestClientCallback) OnSearchResult

func (cb *TestClientCallback) OnSearchResult(id SearchId, result string, contact common.Contact)

func (*TestClientCallback) OnSharedDataAvailable

func (cb *TestClientCallback) OnSharedDataAvailable(sharedData SharedData)

type ValueHolder

type ValueHolder struct {
	Value interface{}
}

Jump to

Keyboard shortcuts

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