Created
June 21, 2018 06:46
-
-
Save hauxe/236aaf7d48fffd03ce6d945297482c75 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// GateKeeper defines gate keeper for resource | |
type GateKeeper struct { | |
ctx context.Context | |
cancel context.CancelFunc | |
mux sync.Mutex | |
queue chan PrioritizedEntity | |
} | |
// New new gate keeper | |
func New(queuedElements int) *GateKeeper { | |
return &GateKeeper{ | |
queue: make(chan PrioritizedEntity, queuedElements), | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment