Exemplo n.º 1
0
        public void createPartition(string partition_id)
        {
            String master_id = PartitionMapping.getPartitionMaster(partition_id);
            bool   is_master = master_id.Equals(server_id);

            Partition p = new Partition(partition_id, is_master);

            partitions.Add(p);
        }
Exemplo n.º 2
0
        private void write(string partition_id, string object_id, string value)
        {
            WriteReply reply;

            if (debug_console)
            {
                Console.WriteLine("Get Partition Master from Partition Named: " + partition_id);
            }
            string partition_master_server_id = PartitionMapping.getPartitionMaster(partition_id);

            if (debug_console)
            {
                Console.WriteLine("Partition Master Server ID: " + partition_master_server_id);
            }
            reattachServer(partition_master_server_id);

            var object_key = new DataStoreKeyDto
            {
                PartitionId = partition_id,
                ObjectId    = object_id
            };

            var object_value = new DataStoreValueDto
            {
                Val = value
            };

            Console.WriteLine(">>> Write request...");

            try
            {
                reply = client.Write(new WriteRequest {
                    ObjectKey = object_key, Object = object_value
                });
                Console.WriteLine("Write result: " + reply);
            }
            catch
            {
                handle_crashed_server(attached_server_id);
                return;
            }
        }
Exemplo n.º 3
0
 public string getMasterID()
 {
     return(PartitionMapping.getPartitionMaster(this.id));
 }