Ejemplo n.º 1
0
        public static Protocol.Segment GetSegment(this Internal.Segment segment)
        {
            var builder = new Protocol.Segment.Builder
            {
                Index              = segment.Index,
                BackupsList        = { segment.Backups.Select(x => x.GetNodeEndpoint()) },
                PendingBackupsList = { segment.PendingBackups.Select(x => x.GetNodeEndpoint()) }
            };

            if (segment.AssignedEndpoint != null)
            {
                builder.AssignedEndpoint = new Protocol.NodeEndpoint.Builder
                {
                    Async = segment.AssignedEndpoint.Async.ToString(),
                    Sync  = segment.AssignedEndpoint.Sync.ToString()
                }.Build();
            }
            if (segment.InProcessOfMovingToEndpoint != null)
            {
                builder.InProcessOfMovingToEndpoint = new Protocol.NodeEndpoint.Builder
                {
                    Async = segment.InProcessOfMovingToEndpoint.Async.ToString(),
                    Sync  = segment.InProcessOfMovingToEndpoint.Sync.ToString(),
                }.Build();
            }
            return(builder.Build());
        }
Ejemplo n.º 2
0
 public static Protocol.Segment GetSegment(this Internal.Segment segment)
 {
     var builder = new Protocol.Segment.Builder
     {
         Index = segment.Index,
         BackupsList = { segment.Backups.Select(x => x.GetNodeEndpoint()) },
         PendingBackupsList = { segment.PendingBackups.Select(x => x.GetNodeEndpoint()) }
     };
     if (segment.AssignedEndpoint != null)
     {
         builder.AssignedEndpoint = new Protocol.NodeEndpoint.Builder
         {
             Async = segment.AssignedEndpoint.Async.ToString(),
             Sync = segment.AssignedEndpoint.Sync.ToString()
         }.Build();
     }
     if (segment.InProcessOfMovingToEndpoint != null)
     {
         builder.InProcessOfMovingToEndpoint = new Protocol.NodeEndpoint.Builder
         {
             Async = segment.InProcessOfMovingToEndpoint.Async.ToString(),
             Sync = segment.InProcessOfMovingToEndpoint.Sync.ToString(),
         }.Build();
     }
     return builder.Build();
 }