DecomposeKey() public method

public DecomposeKey ( long key ) : long
key long
return long
Ejemplo n.º 1
0
        public void Test_SetupSchemaForCustomStartegy()
        {
            var ctx = CedarAppStore.Instance.GetContextOf("IGD");
            var strtgy = new RegionalStartegy();
            ctx.ShardStrategy = new RegionalStartegy();
            var uuid = ctx.SetupSchema(new ShardStartegyData() { StrategyType = Strategy.Regional,Region = "Prakash"});

            var worker = new IdWorker(1004);
            var uniqueId = worker.DecomposeKey(uuid);

            Assert.AreEqual(1004 == uniqueId, true, "shard id is not as expected");
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Update the total count for a shard
 /// </summary>
 /// <param name="uuid"></param>
 public void UpdateShard(long uuid)
 {
     var worker = new IdWorker(uuid);
     var uniqueId = worker.DecomposeKey(uuid);
     new DataFactory().GetdataReader(FetchMode.Sql).UpdateShardCount(uniqueId);
     _app.Shards = new DataFactory().GetdataReader(FetchMode.Sql).GetAllShardByAppname(_app.ApplicationName);
 }