This repository has been archived by the owner on Jan 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from itzmeanjan/develop
More graphQL query methods & more 👇
- Loading branch information
Showing
17 changed files
with
1,799 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package data | ||
|
||
import "sync/atomic" | ||
|
||
// ActiveSubscriptions - Keeps track of how many active websocket | ||
// connections being maintained now by `ette` | ||
type ActiveSubscriptions struct { | ||
Count uint64 | ||
} | ||
|
||
// Increment - Safely increment count by `X` | ||
func (a *ActiveSubscriptions) Increment(by uint64) { | ||
atomic.AddUint64(&a.Count, by) | ||
} | ||
|
||
// Decrement - Safely decrement count by `X` | ||
func (a *ActiveSubscriptions) Decrement(by uint64) { | ||
atomic.AddUint64(&a.Count, ^uint64(by-1)) | ||
} | ||
|
||
// SendReceiveCounter - Keeps track of how many read & write ops | ||
// were performed to & from socket during life time of one single | ||
// websocket connection | ||
type SendReceiveCounter struct { | ||
Send uint64 | ||
Receive uint64 | ||
} | ||
|
||
// IncrementSend -To be invoked when new data written into socket | ||
func (s *SendReceiveCounter) IncrementSend(by uint64) { | ||
atomic.AddUint64(&s.Send, by) | ||
} | ||
|
||
// IncrementReceive - To be invoked when new data read from socket | ||
func (s *SendReceiveCounter) IncrementReceive(by uint64) { | ||
atomic.AddUint64(&s.Receive, by) | ||
} |
Oops, something went wrong.