MCPcopy Create free account

hub / github.com/RussellLuo/slidingwindow / functions

Functions67 in github.com/RussellLuo/slidingwindow

↓ 16 callersMethodAdd
Add adds delta to the count of the window represented by start, and returns the new count.
synchronizer.go:12
↓ 8 callersFunctiontriggerSync
(t time.Time)
slidingwindow_test.go:220
↓ 3 callersMethodAllow
Allow is shorthand for AllowN(time.Now(), 1).
slidingwindow.go:89
↓ 3 callersMethodAllowN
AllowN reports whether n events may happen at time now.
slidingwindow.go:94
↓ 3 callersMethodCount
Count returns the accumulated count.
slidingwindow.go:14
↓ 3 callersMethodGet
Get returns the count of the window represented by start.
synchronizer.go:15
↓ 3 callersFunctionNewLimiter
NewLimiter creates a new limiter, and returns a function to stop the possible sync behaviour within the current window.
slidingwindow.go:46
↓ 3 callersFunctionNewLocalWindow
()
window.go:18
↓ 3 callersMethodReset
Reset sets the state of the window with the given settings.
slidingwindow.go:20
↓ 3 callersMethodSync
Sync sends a synchronization request.
window.go:71
↓ 2 callersMethodAddCount
AddCount increments the accumulated count by n.
slidingwindow.go:17
↓ 2 callersMethodBegin
(now time.Time)
synchronizer.go:41
↓ 2 callersMethodEnd
()
synchronizer.go:46
↓ 2 callersMethodIsTimeUp
IsTimeUp returns whether it's time to sync data to the central datastore.
synchronizer.go:33
↓ 2 callersMethodLimit
Limit returns the maximum events permitted to happen during one window size.
slidingwindow.go:75
↓ 2 callersMethodStart
Start returns the start boundary.
slidingwindow.go:11
↓ 2 callersMethodfullKey
(key string, start int64)
slidingwindow_test.go:104
↓ 2 callersMethodfullKey
(key string, start int64)
example_syncwindow_test.go:23
↓ 2 callersMethodfullKey
(key string, start int64)
testutil/main.go:47
↓ 2 callersFunctionnewSyncHelper
(store Datastore, syncInterval time.Duration)
synchronizer.go:28
↓ 2 callersFunctiontestSyncWindow
(t *testing.T, blockingSync bool, cases []caseArg)
slidingwindow_test.go:125
↓ 1 callersMethodInProgress
()
synchronizer.go:37
↓ 1 callersFunctionNewBlockingSynchronizer
(store Datastore, syncInterval time.Duration)
synchronizer.go:80
↓ 1 callersFunctionNewNonblockingSynchronizer
(store Datastore, syncInterval time.Duration)
synchronizer.go:120
↓ 1 callersFunctionNewRedisDatastore
(client redis.Cmdable, ttl time.Duration)
example_syncwindow_test.go:19
↓ 1 callersFunctionNewRedisDatastore
(client redis.Cmdable, ttl time.Duration)
testutil/main.go:43
↓ 1 callersFunctionNewSyncWindow
NewSyncWindow creates an instance of SyncWindow with the given synchronizer.
window.go:88
↓ 1 callersMethodSetLimit
SetLimit sets a new Limit for the limiter.
slidingwindow.go:82
↓ 1 callersMethodStart
Start starts the synchronization goroutine, if any.
window.go:65
↓ 1 callersMethodSync
Sync tries to exchange data between the window and the central datastore at time now, to keep the window's count up-to-date.
slidingwindow.go:24
↓ 1 callersMethodadvance
advance updates the current/previous windows resulting from the passage of time.
slidingwindow.go:116
↓ 1 callersFunctionnewLimiters
()
testutil/main.go:117
↓ 1 callersFunctionnewMemDatastore
()
slidingwindow_test.go:98
↓ 1 callersFunctionparseFlags
()
testutil/main.go:81
↓ 1 callersMethodsyncLoop
syncLoop is a worker that receives a sync request and generates the corresponding sync response.
synchronizer.go:141
MethodAdd
(key string, start, delta int64)
slidingwindow_test.go:108
MethodAdd
(key string, start, value int64)
example_syncwindow_test.go:27
MethodAdd
(key string, start, value int64)
testutil/main.go:51
MethodAddCount
(n int64)
window.go:30
MethodAddCount
(n int64)
window.go:98
MethodCount
()
window.go:26
FunctionExample_localWindow
()
example_localwindow_test.go:10
FunctionExample_syncWindow
()
example_syncwindow_test.go:51
MethodGet
(key string, start int64)
slidingwindow_test.go:117
MethodGet
(key string, start int64)
example_syncwindow_test.go:38
MethodGet
(key string, start int64)
testutil/main.go:62
MethodReset
(s time.Time, c int64)
window.go:34
MethodReset
(s time.Time, c int64)
window.go:103
MethodSize
Size returns the time duration of one window size. Note that the size is defined to be read-only, if you need to change the size, create a new limiter
slidingwindow.go:70
MethodStart
()
synchronizer.go:86
MethodStart
()
synchronizer.go:130
MethodStart
()
window.go:22
MethodStop
()
synchronizer.go:88
MethodStop
()
synchronizer.go:134
MethodStop
Stop stops the synchronization goroutine, if any, and waits for it to exit.
window.go:68
MethodSync
(req SyncRequest)
synchronizer.go:50
MethodSync
Sync sends the window's count to the central datastore, and then update the window's count according to the response from the datastore.
synchronizer.go:92
MethodSync
Sync tries to send the window's count to the central datastore, or to update the window's count according to the response from the latest synchronizat
synchronizer.go:168
MethodSync
(now time.Time)
window.go:39
MethodSync
(now time.Time)
window.go:136
FunctionTestLimiter_Blocking_SyncWindow_AllowN
(t *testing.T)
slidingwindow_test.go:226
FunctionTestLimiter_LocalWindow_AllowN
(t *testing.T)
slidingwindow_test.go:58
FunctionTestLimiter_LocalWindow_SetLimit
(t *testing.T)
slidingwindow_test.go:40
FunctionTestLimiter_Nonblocking_SyncWindow_AllowN
(t *testing.T)
slidingwindow_test.go:250
MethodhandleSyncResponse
(resp SyncResponse)
window.go:123
Functionmain
()
testutil/main.go:139
MethodmakeSyncRequest
()
window.go:114