Versions in this module Expand all Collapse all v5 v5.0.1 Jul 28, 2026 Changes in this version + const CacheStatusError + const CacheStatusReady + const CacheStatusStale + const FlushOperationDrainQueuedLogs + const FlushOperationPersistLowPriority + const FlushOperationResendQueuedSends + const InvalidationReasonAppVersionChange + const InvalidationReasonLocaleChange + const InvalidationReasonLogout + const InvalidationReasonMutationAck + const InvalidationReasonRouteThreadNormalize + const InvalidationReasonServerVersionMismatch + const InvalidationReasonSessionRevoked + const InvalidationReasonWorkspaceSwitch + const OutboxStatusAcked + const OutboxStatusFailed + const OutboxStatusQueued + const OutboxStatusSending + func BuildCacheRecordEnvelopeJSON(parseRecord CacheRecordEnvelope) ([]byte, error) + func BuildFreshnessWindow(parseFetchedAt time.Time, parseStaleAfter time.Duration, ...) (string, string, string) + func BuildOutboxRecordEnvelopeJSON(parseRecord OutboxRecordEnvelope) ([]byte, error) + func BuildScopeKey(parseScope ScopeKey) string + func BuildScopePrefixForAccountSwitch(parseScope ScopeKey) string + func BuildScopePrefixForLocaleSwitch(parseScope ScopeKey) string + func BuildScopePrefixForLogout(parseScope ScopeKey) string + func BuildScopePrefixForWorkspaceSwitch(parseScope ScopeKey) string + func BuildScopedResourceKey(parseScopeKey string, parseResourceKey string) string + func EnforceLocalSecrecyForCacheRecord(parseRecord CacheRecordEnvelope) error + func EnforceLocalSecrecyForOutboxRecord(parseRecord OutboxRecordEnvelope) error + func EnforceSecurityDecision(parseDecision SecurityDecision) error + type AckReconcileInput struct + AckKey string + AuthoritativeRecord CacheRecordEnvelope + OperationKey string + OptimisticScopedResources []string + QueueKey string + ResourceKey string + ScopeKey string + type AckReconcileResult struct + IsCacheUpdated bool + QueueRemovedCount int + func ApplyAckReconcile(parseCtx context.Context, parseStorage Storage, parseInput AckReconcileInput) (AckReconcileResult, error) + type BrowserStorage struct + func BuildBrowserStorage() (*BrowserStorage, error) + func (parseStorage *BrowserStorage) Delete(parseCtx context.Context, parseScopedResourceKey string) error + func (parseStorage *BrowserStorage) DeleteByPrefix(parseCtx context.Context, parseScopePrefix string) (int, error) + func (parseStorage *BrowserStorage) Get(parseCtx context.Context, parseScopedResourceKey string) (CacheRecordEnvelope, bool, error) + func (parseStorage *BrowserStorage) List(parseCtx context.Context, parseScopePrefix string) ([]CacheRecordEnvelope, error) + func (parseStorage *BrowserStorage) Set(parseCtx context.Context, parseRecord CacheRecordEnvelope) error + func (parseStorage *BrowserStorage) UpdateQueueAtomic(parseCtx context.Context, parseQueueKey string, ...) ([]OutboxRecordEnvelope, error) + type CachePolicy struct + CanBackgroundRefresh bool + Class PolicyClass + ExpiresAfter time.Duration + ShouldDisplayOnlyWhenStale bool + ShouldRefetchBeforeMutation bool + StaleAfter time.Duration + func BuildCachePolicy(parseClass PolicyClass, parseStaleAfter time.Duration, ...) CachePolicy + func NormalizeCachePolicy(parsePolicy CachePolicy) CachePolicy + func ResolveCachePolicyDefaults(parseClass PolicyClass) CachePolicy + type CacheRecordEnvelope struct + ETagOrHash string + Error string + ExpiresAt string + FetchedAt string + Payload []byte + ResourceKey string + ScopeKey string + StaleAt string + Status string + Version string + func BuildCacheRecordEnvelope(parseScopeKey string, parseResourceKey string, parseVersion string, ...) CacheRecordEnvelope + func NormalizeCacheRecordEnvelope(parseRecord CacheRecordEnvelope) CacheRecordEnvelope + func ParseCacheRecordEnvelopeJSON(parseRaw []byte) (CacheRecordEnvelope, error) + type CachedResourceView struct + Freshness FreshnessState + IsCached bool + IsFound bool + IsStale bool + Record CacheRecordEnvelope + RefreshTriggered bool + type ConnectivityCoordinator struct + func BuildConnectivityCoordinator(parseInitialState ConnectivityState) *ConnectivityCoordinator + func (parseCoordinator *ConnectivityCoordinator) ApplyAppActiveState(isParseAppActive bool) ConnectivityState + func (parseCoordinator *ConnectivityCoordinator) ApplyOnlineState(isParseOnline bool) ConnectivityState + func (parseCoordinator *ConnectivityCoordinator) ApplyState(parseNextState ConnectivityState) ConnectivityState + func (parseCoordinator *ConnectivityCoordinator) ApplyTunnelState(isParseTunnelReady bool) ConnectivityState + func (parseCoordinator *ConnectivityCoordinator) DeleteHook(parseHookKey string) + func (parseCoordinator *ConnectivityCoordinator) GetState() ConnectivityState + func (parseCoordinator *ConnectivityCoordinator) SetHook(parseHookKey string, parseHook ConnectivityHook) + func (parseCoordinator *ConnectivityCoordinator) ShouldFlushOutbox() bool + func (parseCoordinator *ConnectivityCoordinator) ShouldRunBackgroundRefresh() bool + type ConnectivityHook func(ConnectivityState) + type ConnectivityState struct + IsAppActive bool + IsOnline bool + IsTunnelReady bool + UpdatedAt string + type FlushOperation string + type FreshnessState string + const FreshnessExpired + const FreshnessFresh + const FreshnessMissing + const FreshnessStale + func ResolveFreshnessState(parseRecord CacheRecordEnvelope, parseNow time.Time) FreshnessState + type InMemoryObservabilitySink struct + func BuildInMemoryObservabilitySink() *InMemoryObservabilitySink + func (parseSink *InMemoryObservabilitySink) Emit(parseCtx context.Context, parseEvent ObservabilityEvent) + func (parseSink *InMemoryObservabilitySink) List() []ObservabilityEvent + type InvalidationEngine struct + func BuildInvalidationEngine(parseStorage Storage, parseInvalidator *Invalidator) *InvalidationEngine + func (parseEngine *InvalidationEngine) ApplyInvalidation(parseCtx context.Context, parseEvent InvalidationEvent) (int, error) + type InvalidationEvent struct + Reason string + ResourcePrefix string + ScopePrefix string + TriggeredAt string + type InvalidationHook func(InvalidationEvent) + type Invalidator struct + func BuildInvalidator() *Invalidator + func (parseInvalidator *Invalidator) ApplyInvalidation(parseEvent InvalidationEvent) + func (parseInvalidator *Invalidator) DeleteHook(parseHookKey string) + func (parseInvalidator *Invalidator) SetHook(parseHookKey string, parseHook InvalidationHook) + type MemoryStorage struct + func BuildMemoryStorage() *MemoryStorage + func (parseStorage *MemoryStorage) Delete(parseCtx context.Context, parseScopedResourceKey string) error + func (parseStorage *MemoryStorage) DeleteByPrefix(parseCtx context.Context, parseScopePrefix string) (int, error) + func (parseStorage *MemoryStorage) Get(parseCtx context.Context, parseScopedResourceKey string) (CacheRecordEnvelope, bool, error) + func (parseStorage *MemoryStorage) List(parseCtx context.Context, parseScopePrefix string) ([]CacheRecordEnvelope, error) + func (parseStorage *MemoryStorage) Set(parseCtx context.Context, parseRecord CacheRecordEnvelope) error + func (parseStorage *MemoryStorage) UpdateQueueAtomic(parseCtx context.Context, parseQueueKey string, ...) ([]OutboxRecordEnvelope, error) + type ObservabilityEmitter struct + func BuildObservabilityEmitter(parseSink ObservabilitySink) *ObservabilityEmitter + func (parseEmitter *ObservabilityEmitter) Emit(parseCtx context.Context, parseEvent ObservabilityEvent) + type ObservabilityEvent struct + AttemptCount int + EmittedAt string + ErrorCode string + EventType ObservabilityEventType + IsStale bool + QueueKey string + Reason string + ResourceKey string + ScopeKey string + type ObservabilityEventType string + const ObservabilityEventCacheHit + const ObservabilityEventCacheMiss + const ObservabilityEventCacheStaleReturn + const ObservabilityEventEviction + const ObservabilityEventQueueAck + const ObservabilityEventQueueDrop + const ObservabilityEventQueueEnqueue + const ObservabilityEventRefreshFailure + const ObservabilityEventRefreshStart + type ObservabilitySink interface + Emit func(context.Context, ObservabilityEvent) + type OutboxRecordEnvelope struct + AckKey string + AttemptCount int + CreatedAt string + LastAttemptAt string + LastError string + NextRetryAt string + OperationKey string + Payload []byte + QueueKey string + ResourceKey string + Status string + func BuildOutboxRecordEnvelope(parseQueueKey string, parseResourceKey string, parseOperationKey string, ...) OutboxRecordEnvelope + func NormalizeOutboxRecordEnvelope(parseRecord OutboxRecordEnvelope) OutboxRecordEnvelope + func ParseOutboxRecordEnvelopeJSON(parseRaw []byte) (OutboxRecordEnvelope, error) + type OutboxRetryPolicy struct + InitialDelay time.Duration + JitterRatio float64 + MaxAttempts int + MaxDelay time.Duration + func BuildOutboxRetryPolicyDefaults() OutboxRetryPolicy + func NormalizeOutboxRetryPolicy(parsePolicy OutboxRetryPolicy) OutboxRetryPolicy + type OwnershipActor string + const OwnershipActorMainThread + const OwnershipActorWorker + type OwnershipDecision struct + Actor OwnershipActor + Reason string + func ResolveOwnershipDecision(parseTask OwnershipTask) OwnershipDecision + type OwnershipTask string + const OwnershipTaskHotRead + const OwnershipTaskInvalidationSweep + const OwnershipTaskOptimisticState + const OwnershipTaskQueuedLogFlush + const OwnershipTaskRetryScheduling + const OwnershipTaskTTLScan + const OwnershipTaskUnsentResend + type PolicyClass string + const PolicyClassQueued + const PolicyClassSession + const PolicyClassStatic + const PolicyClassVolatile + type PolicyReadDecision struct + CanReturnCached bool + IsStale bool + ShouldRefetchBeforeMutation bool + ShouldRefreshInBackground bool + func ResolvePolicyReadDecision(parsePolicy CachePolicy, parseState FreshnessState) PolicyReadDecision + type QueuedMutationView struct + IsPending bool + NextRetryAt string + PendingCount int + QueueKey string + type RetryDecision struct + IsTerminal bool + NextRecord OutboxRecordEnvelope + ShouldRetry bool + func ResolveOutboxRetryDecision(parseRecord OutboxRecordEnvelope, parseNow time.Time, ...) RetryDecision + type SWRCoordinator struct + func BuildSWRCoordinator() *SWRCoordinator + func (parseCoordinator *SWRCoordinator) StartRefresh(parseScopeKey string, parseResourceKey string) (func(), bool) + type SWRReadResult struct + Freshness FreshnessState + IsCached bool + IsFound bool + IsStale bool + Record CacheRecordEnvelope + RefreshTriggered bool + func ReadWithSWR(parseCtx context.Context, parseStorage Storage, ...) (SWRReadResult, error) + type ScopeKey struct + AppVersion string + Locale string + RouteKey string + SessionID string + ThreadKey string + UserID string + Workspace string + type SecurityDecision struct + IsAllowed bool + IsDisplayOnly bool + IsQueueWriteAllowed bool + MustUseServerAuthorizationGate bool + Reason string + func ResolveSecurityDecision(parseResourceKey string, parseIntent SecurityIntent, parseRules []SecurityRule) SecurityDecision + type SecurityIntent string + const SecurityIntentCacheWrite + const SecurityIntentDisplayRead + const SecurityIntentQueueWrite + type SecurityRule struct + IsDisplayOnly bool + IsQueueWriteAllowed bool + MustUseServerAuthorizationGate bool + ResourcePrefix string + func BuildDefaultSecurityRules() []SecurityRule + type SnapshotStore struct + func BuildSnapshotStore() *SnapshotStore + func (parseStore *SnapshotStore) ApplyFromStorage(parseCtx context.Context, parseStorage Storage, parseScopePrefix string) error + func (parseStore *SnapshotStore) DeleteSync(parseScopeKey string, parseResourceKey string) + func (parseStore *SnapshotStore) GetSync(parseScopeKey string, parseResourceKey string) (CacheRecordEnvelope, bool) + func (parseStore *SnapshotStore) ListSync(parseScopePrefix string) []CacheRecordEnvelope + func (parseStore *SnapshotStore) SetSync(parseRecord CacheRecordEnvelope) + type Storage interface + Delete func(parseCtx context.Context, parseScopedResourceKey string) error + DeleteByPrefix func(parseCtx context.Context, parseScopePrefix string) (int, error) + Get func(parseCtx context.Context, parseScopedResourceKey string) (CacheRecordEnvelope, bool, error) + List func(parseCtx context.Context, parseScopePrefix string) ([]CacheRecordEnvelope, error) + Set func(parseCtx context.Context, parseRecord CacheRecordEnvelope) error + UpdateQueueAtomic func(parseCtx context.Context, parseQueueKey string, ...) ([]OutboxRecordEnvelope, error) + type UIAPI struct + func BuildUIAPI(parseStorage Storage, parseCoordinator *SWRCoordinator, ...) *UIAPI + func BuildUIAPIWithSnapshot(parseStorage Storage, parseSnapshot *SnapshotStore, ...) *UIAPI + func (parseAPI *UIAPI) ApplyOptimisticPatch(parseCtx context.Context, parseScopeKey string, parseResourceKey string, ...) error + func (parseAPI *UIAPI) InvalidateResources(parseCtx context.Context, parseReason string, parseScopePrefix string, ...) (int, error) + func (parseAPI *UIAPI) ReadCachedResource(parseCtx context.Context, parseScopeKey string, parseResourceKey string, ...) (CachedResourceView, error) + func (parseAPI *UIAPI) ReadQueuedMutationState(parseCtx context.Context, parseQueueKey string) (QueuedMutationView, error) + func (parseAPI *UIAPI) RefreshResource(parseCtx context.Context, parseScopeKey string, parseResourceKey string, ...) error + func (parseAPI *UIAPI) SetSnapshotStore(parseSnapshot *SnapshotStore) + type WorkerBatchRule struct + MaxDeltasPerBatch int + type WorkerBatcher struct + func BuildWorkerBatcher(parseRule WorkerBatchRule) *WorkerBatcher + func (parseBatcher *WorkerBatcher) ApplyDelta(parseDelta WorkerDelta) + func (parseBatcher *WorkerBatcher) GetBatches() []WorkerMessageBatch + type WorkerDelta struct + DeltaType WorkerDeltaType + OperationKey string + QueueKey string + Reason string + ResourceKey string + ScopeKey string + UpdatedAt string + type WorkerDeltaType string + const WorkerDeltaBackgroundWrite + const WorkerDeltaInvalidationScan + const WorkerDeltaQueueFlush + type WorkerEvent struct + ErrorCode string + EventType WorkerEventType + OperationKey string + QueueKey string + Reason string + ResourceKey string + ScopeKey string + UpdatedAt string + type WorkerEventBus struct + func BuildWorkerEventBus() *WorkerEventBus + func (parseBus *WorkerEventBus) Publish(parseCtx context.Context, parseEvent WorkerEvent) + func (parseBus *WorkerEventBus) Subscribe(parseHandlerKey string, parseHandler WorkerEventHandler) + func (parseBus *WorkerEventBus) Unsubscribe(parseHandlerKey string) + type WorkerEventContract interface + Publish func(context.Context, WorkerEvent) + Subscribe func(string, WorkerEventHandler) + Unsubscribe func(string) + type WorkerEventHandler func(context.Context, WorkerEvent) + type WorkerEventType string + const WorkerEventAcked + const WorkerEventEvicted + const WorkerEventFailed + const WorkerEventRefreshing + const WorkerEventRetryScheduled + const WorkerEventStale + const WorkerEventUpdated + type WorkerFlushContract interface + Ack func(context.Context, []string) error + DequeueBatch func(context.Context, int) ([]WorkerFlushTask, error) + Enqueue func(context.Context, WorkerFlushTask) error + type WorkerFlushQueue struct + func BuildWorkerFlushQueue() *WorkerFlushQueue + func (parseQueue *WorkerFlushQueue) Ack(parseCtx context.Context, parseTaskKeys []string) error + func (parseQueue *WorkerFlushQueue) DequeueBatch(parseCtx context.Context, parseMaxTasks int) ([]WorkerFlushTask, error) + func (parseQueue *WorkerFlushQueue) Enqueue(parseCtx context.Context, parseTask WorkerFlushTask) error + type WorkerFlushTask struct + CreatedAt string + Operation FlushOperation + Payload []byte + QueueKey string + ScopeKey string + TaskKey string + func BuildWorkerFlushTask(parseTaskKey string, parseOperation FlushOperation, parseScopeKey string, ...) WorkerFlushTask + type WorkerMessageBatch struct + BatchType WorkerDeltaType + BatchedAt string + Deltas []WorkerDelta + QueueKey string + ScopeKey string + type WorkerSnapshotReconcileInput struct + AckKey string + AckOperationKey string + AckQueueKey string + Event WorkerEvent + InvalidatedScopedRecords []string + Record CacheRecordEnvelope + type WorkerSnapshotReconcileResult struct + DeletedCount int + IsApplied bool + IsDuplicate bool + IsOutOfOrder bool + IsRecordUpdated bool + QueueRemovedCount int + type WorkerSnapshotReconciler struct + func BuildWorkerSnapshotReconciler(parseStorage Storage, parseSnapshot *SnapshotStore) *WorkerSnapshotReconciler + func (parseReconciler *WorkerSnapshotReconciler) ApplyEvent(parseCtx context.Context, parseInput WorkerSnapshotReconcileInput) (WorkerSnapshotReconcileResult, error) Other modules containing this package github.com/monstercameron/GoWebComponents/v4