aboutsummaryrefslogtreecommitdiff
path: root/src/vendor/github.com/alexedwards/stack/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/vendor/github.com/alexedwards/stack/context.go')
-rw-r--r--src/vendor/github.com/alexedwards/stack/context.go55
1 files changed, 0 insertions, 55 deletions
diff --git a/src/vendor/github.com/alexedwards/stack/context.go b/src/vendor/github.com/alexedwards/stack/context.go
deleted file mode 100644
index 07afe21..0000000
--- a/src/vendor/github.com/alexedwards/stack/context.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package stack
-
-import (
- "sync"
-)
-
-type Context struct {
- mu sync.RWMutex
- m map[string]interface{}
-}
-
-func NewContext() *Context {
- m := make(map[string]interface{})
- return &Context{m: m}
-}
-
-func (c *Context) Get(key string) interface{} {
- if !c.Exists(key) {
- return nil
- }
- c.mu.RLock()
- defer c.mu.RUnlock()
- return c.m[key]
-}
-
-func (c *Context) Put(key string, val interface{}) *Context {
- c.mu.Lock()
- defer c.mu.Unlock()
- c.m[key] = val
- return c
-}
-
-func (c *Context) Delete(key string) *Context {
- c.mu.Lock()
- defer c.mu.Unlock()
- delete(c.m, key)
- return c
-}
-
-func (c *Context) Exists(key string) bool {
- c.mu.RLock()
- defer c.mu.RUnlock()
- _, ok := c.m[key]
- return ok
-}
-
-func (c *Context) copy() *Context {
- nc := NewContext()
- c.mu.RLock()
- defer c.mu.RUnlock()
- for k, v := range c.m {
- nc.m[k] = v
- }
- return nc
-}