| 100 | } |
| 101 | |
| 102 | type counterInt64 struct { |
| 103 | baseSharedVariable |
| 104 | registry *sharedStateRegistry |
| 105 | key string |
| 106 | value atomic.Int64 |
| 107 | updateMu sync.Mutex |
| 108 | valueCallbacks []func(int64) |
| 109 | ignoreRollbackOf int64 |
| 110 | largeRollbackCallbacks []func(localVal, newVal int64) |
| 111 | callbackMu sync.RWMutex |
| 112 | // bgPushInProgress dedupes best-effort remote reconciliation/push operations. |
| 113 | // It MUST NOT be held while waiting on updateMu; remote sync should never block request flow. |
| 114 | bgPushInProgress sync.Mutex |
| 115 | // bgPushRequested indicates a newer value should be pushed after the current push attempt. |
| 116 | // This avoids dropping updates when scheduleBackgroundPushCurrent() is called while a push is in progress. |
| 117 | bgPushRequested atomic.Bool |
| 118 | } |
| 119 | |
| 120 | func (c *counterInt64) GetValue() int64 { |
| 121 | return c.value.Load() |
nothing calls this directly
no outgoing calls
no test coverage detected