DecomposeKey() public method

public DecomposeKey ( long key ) : long
key long
return long
示例#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");
        }
示例#2
0
文件: AppContext.cs 项目: Vadi/Cedar
 /// <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);
 }