diff --git a/store/store.go b/store/store.go index f1291a10549..1f4da124b8f 100644 --- a/store/store.go +++ b/store/store.go @@ -41,6 +41,7 @@ func init() { type Store interface { Version() int Index() uint64 + IsKeyDir(nodePath string) bool Get(nodePath string, recursive, sorted bool) (*Event, error) Set(nodePath string, dir bool, value string, expireTime time.Time) (*Event, error) @@ -100,6 +101,17 @@ func (s *store) Index() uint64 { return s.CurrentIndex } +func (s *store) IsKeyDir(nodePath string) bool { + node, _ := s.internalGet(nodePath) + // If there is an error, then either the path does not exist or it is not + // a dir. Either way, it is not a dir, so return false + if node != nil { + return node.IsDir() + } else { + return false + } +} + // Get returns a get event. // If recursive is true, it will return all the content under the node path. // If sorted is true, it will sort the content by keys.