Documentation
¶
Overview ¶
Package engine implements the local synchronization pipeline, content hashing, echo loop suppression, and deduplication policies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeHash ¶
ComputeHash computes the SHA-256 cryptographic digest of data and returns it formatted as a lowercase hexadecimal string.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine coordinates clipboard change detection, policy filtering, echo loop suppression, and inbound clipboard application.
func (*Engine) ApplyInbound ¶
ApplyInbound applies an item received from a remote peer to the local OS clipboard. It records hash as LastReceived BEFORE invoking clipboard.Write, guaranteeing that when the local clipboard watcher fires in response to this write, it is recognized as a self-echo and suppressed.
func (*Engine) Outbound ¶
func (e *Engine) Outbound() <-chan OutboundEvent
Outbound returns the channel emitting validated clipboard events.
func (*Engine) ProcessItem ¶
ProcessItem evaluates and dispatches an outbound item (e.g. from local clipboard or the optional screenshot directory watcher).
func (*Engine) ProcessLocalChange ¶
func (e *Engine) ProcessLocalChange()
ProcessLocalChange executes the outbound evaluation pipeline for a local clipboard modification.
type OutboundEvent ¶
OutboundEvent represents a validated, non-echo, non-duplicate clipboard item ready for dispatch to remote peers.
type SyncState ¶
type SyncState struct {
// contains filtered or unexported fields
}
SyncState provides thread-safe in-memory tracking of content hashes to enable echo loop elimination and local copy deduplication.
func NewSyncState ¶
func NewSyncState() *SyncState
NewSyncState constructs an empty, initialized SyncState.
func (*SyncState) CurrentLocalHash ¶
CurrentLocalHash returns the SHA-256 hash of the currently active local clipboard content.
func (*SyncState) IsLastReceived ¶
IsLastReceived returns true if hash matches the item most recently applied from a peer. If true, the local clipboard change is a self-echo and must be dropped.
func (*SyncState) IsLastSent ¶
IsLastSent returns true if hash matches the item most recently dispatched outbound. If true, the user simply copied the same item again, so it can be safely deduplicated.
func (*SyncState) SetCurrentLocal ¶
SetCurrentLocal records the SHA-256 hash of the currently active local clipboard content.
func (*SyncState) SetLastReceived ¶
SetLastReceived records the SHA-256 hash of an item received from a remote peer. This must be called BEFORE applying the item to the local operating system clipboard.
func (*SyncState) SetLastSent ¶
SetLastSent records the SHA-256 hash of an item dispatched outbound.