Ejemplo n.º 1
0
 //---------------------------------------------------------------------
 public void subscribeExists(string path, zkOpeHandler handler = null, Dictionary <string, object> param = null)
 {
     if (path != null && path != "" && !_existsListener.ContainsKey(path))
     {
         EbLog.Note("Subscribed Exists changes for:" + path);
         zkHandlerParam hp = new zkHandlerParam();
         hp.handler = handler;
         hp.param   = param;
         _existsListener.Add(path, hp);
         aexists(path, true, handler, param);
     }
 }
Ejemplo n.º 2
0
 //---------------------------------------------------------------------
 public void subscribeChildChanges(string path, zkOpeHandler handler = null, Dictionary <string, object> param = null)
 {
     if (path != null && path != "" && !_childListener.ContainsKey(path))
     {
         zkHandlerParam hp = new zkHandlerParam();
         hp.handler = handler;
         hp.param   = param;
         _childListener.Add(path, hp);
         awatchForChilds(path, handler, param);
         EbLog.Note("Subscribed child changes for:" + path);
     }
 }
Ejemplo n.º 3
0
        //---------------------------------------------------------------------
        public int awriteData(string path, string data, zkOpeHandler handler = null, Dictionary <string, object> param = null)
        {
            int id = 0;

            if (handler != null)
            {
                id = zookeeper.generateId();
                zkHandlerParam hp = new zkHandlerParam();
                hp.handler = handler;
                hp.param   = param;
                _handlerDic.TryAdd(id, hp);
            }
            return(mConnection.awriteData(path, data, _setCompletion, id));
        }
Ejemplo n.º 4
0
        //---------------------------------------------------------------------
        public int aexists(string path, bool watch, zkOpeHandler handler = null, Dictionary <string, object> param = null)
        {
            int id = 0;

            if (handler != null)
            {
                id = zookeeper.generateId();
                zkHandlerParam hp = new zkHandlerParam();
                hp.handler = handler;
                hp.param   = param;
                _handlerDic.TryAdd(id, hp);
            }
            return(mConnection.aexists(path, watch, _existsCompletion, id));
        }
Ejemplo n.º 5
0
        //---------------------------------------------------------------------
        public int acreate(string path, string data, int mode, zkOpeHandler handler = null, Dictionary <string, object> param = null)
        {
            if (path == null || data == null)
            {
                EbLog.Error("path must not be null.");
                return(-1);
            }
            EbLog.Note("acreate node :" + path);
            int id = 0;

            if (handler != null)
            {
                id = zookeeper.generateId();
                zkHandlerParam hp = new zkHandlerParam();
                hp.handler = handler;
                hp.param   = param;
                _handlerDic.TryAdd(id, hp);
            }
            return(mConnection.acreate(path, data, mode, _createCompletion, id));
        }
Ejemplo n.º 6
0
 //---------------------------------------------------------------------
 public int awatchForChilds(string path, zkOpeHandler handler = null, Dictionary <string, object> param = null)
 {
     //exists(path, true);
     return(agetChildren(path, true, handler, param));
 }