sharingstate

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ViewerRole

func ViewerRole(state *sobject.SOState, peerID string) sobject.SOParticipantRole

ViewerRole returns the current viewer's effective participant role.

Types

type MailboxEntry

type MailboxEntry struct {
	ID        int64
	InviteID  string
	PeerID    string
	Status    string
	CreatedAt int64
	AccountID string
	EntityID  string
}

MailboxEntry contains mailbox metadata needed by sharing state projection.

type ParticipantInfo

type ParticipantInfo struct {
	AccountID string
	EntityID  string
	PeerIDs   []string
	Role      sobject.SOParticipantRole
	IsSelf    bool
}

ParticipantInfo is the app-facing participant presentation row.

func BuildParticipantInfo

func BuildParticipantInfo(
	soState *sobject.SOState,
	selfPeerID string,
	presentation *ParticipantPresentation,
) []*ParticipantInfo

BuildParticipantInfo groups participant rows by account or peer identity.

type ParticipantPresentation

type ParticipantPresentation struct {
	SelfAccountID string
	SelfEntityID  string
	AccountLabels map[string]string
}

ParticipantPresentation contains account labels used by sharing rows.

type SharingState

type SharingState struct {
	Participants    []*sobject.SOParticipantConfig
	Invites         []*sobject.SOInvite
	MailboxEntries  []*MailboxEntry
	ViewerRole      sobject.SOParticipantRole
	CanManage       bool
	ParticipantInfo []*ParticipantInfo
}

SharingState contains the sharing snapshot for a space.

func (*SharingState) Equal

func (s *SharingState) Equal(that *SharingState) bool

Equal reports whether two sharing snapshots contain the same projected values.

type State

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

State carries every input snapshot the sharing watch reads per emission.

func NewState

func NewState(
	soState *sobject.SOState,
	mailboxEntries []*MailboxEntry,
	presentation *ParticipantPresentation,
) *State

NewState returns a sharing watch state owner.

func (*State) BridgeSOState

func (s *State) BridgeSOState(
	ctx context.Context,
	soStateCtr ccontainer.Watchable[*sobject.SOState],
)

BridgeSOState forwards SO state container updates into the local broadcast.

func (*State) RunWatchLoop

func (s *State) RunWatchLoop(
	ctx context.Context,
	peerID string,
	send func(*SharingState) error,
) error

RunWatchLoop emits a fresh SpaceSharingState whenever any folded source changes.

func (*State) SetMailboxEntries

func (s *State) SetMailboxEntries(entries []*MailboxEntry)

SetMailboxEntries updates mailbox entries and wakes watchers.

func (*State) SetSOState

func (s *State) SetSOState(next *sobject.SOState)

SetSOState updates the shared object state snapshot and wakes watchers.

Jump to

Keyboard shortcuts

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