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"); }
/// <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); }