Register() public method

This is a RpcDhtProxy rpc call entry, which can be called using "RpcDhtProxy.Register" Register the entry to Entry. If the key,value pair does not exist in _entries, it creates the pair in the list. Otherwise, it updates the ttl. After inserting the entry, this module try to register the key, value pair to neighbor node.
public Register ( MemBlock key, MemBlock value, int ttl ) : bool
key MemBlock dht entry key to insert
value MemBlock dht entry value to insert
ttl int dht entry ttl to insert
return bool
Example #1
0
    /// <summary>Uses the Dht for the bootstrap problem.</summary>
    /// <param name="node">The node needing remote tas.</param>
    /// <param name="dht">The dht for the shared overlay.</param>
    /// <param name="dht_proxy">A dht proxy for the shared overlay.</param>
    public DhtDiscovery(StructuredNode node, IDht dht, string shared_namespace,
        RpcDhtProxy dht_proxy) :
      base(node)
    {
      _dht = dht;
      _dht_proxy = dht_proxy;
      _node = node;
      _shared_namespace = shared_namespace;
      string skey = "PrivateOverlay:" + node.Realm;
      byte[] bkey = Encoding.UTF8.GetBytes(skey);
      _p2p_address = node.Address.ToMemBlock();
      _private_dht_key = MemBlock.Reference(bkey);

      _ongoing = 0;
      _steady_state = 0;
      _dht_proxy.Register(_private_dht_key, _p2p_address, PUT_DELAY_S);
    }
Example #2
0
        /// <summary>Uses the Dht for the bootstrap problem.</summary>
        /// <param name="node">The node needing remote tas.</param>
        /// <param name="dht">The dht for the shared overlay.</param>
        /// <param name="dht_proxy">A dht proxy for the shared overlay.</param>
        public DhtDiscovery(StructuredNode node, IDht dht, string shared_namespace,
                            RpcDhtProxy dht_proxy) :
            base(node)
        {
            _dht              = dht;
            _dht_proxy        = dht_proxy;
            _node             = node;
            _shared_namespace = shared_namespace;
            string skey = "PrivateOverlay:" + node.Realm;

            byte[] bkey = Encoding.UTF8.GetBytes(skey);
            _p2p_address     = node.Address.ToMemBlock();
            _private_dht_key = MemBlock.Reference(bkey);

            _ongoing      = 0;
            _steady_state = 0;
            _dht_proxy.Register(_private_dht_key, _p2p_address, PUT_DELAY_S);
        }