Esempio n. 1
0
 public ShardAssignment(IMessage clusterMessage) : base()
 {
     if (clusterMessage.Name == "GetShardAssignment")
     {
         var respBytes = clusterMessage.ToByteArrayAsync().Result;
         var respSA    = new Ekati.Protocol.Grpc.ShardAssignment();
         respSA.MergeFrom(respBytes);
         InitFrom(respSA);
     }
 }
Esempio n. 2
0
        public void InitFrom(Ekati.Protocol.Grpc.ShardAssignment other)
        {
            Leaders = other.Leaders.ToArray();

            Followers = new string[other.Followers.Count][];
            for (int i = 0; i < other.Followers.Count; i++)
            {
                Followers[i] = other.Followers[i].Follower.ToArray();
            }
        }
Esempio n. 3
0
        public static Ekati.Protocol.Grpc.ShardAssignment ToGrpcShardAssignment(ShardAssignment sa)
        {
            var respSA = new Ekati.Protocol.Grpc.ShardAssignment();

            respSA.Leaders.AddRange(sa.Leaders);
            for (int i = 0; i < sa.Followers.GetLength(0); i++)
            {
                var fo = new Followers();
                fo.Follower.AddRange(sa.Followers[i]);
                respSA.Followers.Add(fo);
            }

            return(respSA);
        }
Esempio n. 4
0
 public ShardAssignment(Ekati.Protocol.Grpc.ShardAssignment other)
 {
     InitFrom(other);
 }