예제 #1
0
        private void processRemoteQueryRequest(QueryRequest request)
        {
            //todo: process queries by responding with values from Node staitc methods
            //each query's Field string should have the name of the Backend.QueryType enum
            QueryType    qt     = request.QueryType;
            string       reason = "";
            ResponseType rt     = ResponseType.Yes;

            switch (qt)
            {
            case QueryType.BackupSpace:
                reason = Node.GetBackupSpace().ToString();
                break;

            case QueryType.FreeSpace:
                reason = Node.GetFreeSpace().ToString();
                break;

            case QueryType.Hostname:
                reason = Node.GetHostName();
                break;

            case QueryType.IPAddress:
                reason = Node.GetInternetAddress();
                break;

            case QueryType.MACAddress:
                reason = Node.GetMAC();
                break;

            case QueryType.NonBackupSpace:
                reason = Node.GetNonBackupSpace().ToString();
                break;

            case QueryType.TotalSpace:
                reason = Node.GetTotalSize().ToString();
                break;

            default:
                rt = ResponseType.NotImplemented;
                break;
            }
            sendMessage(tcpClient, new NetworkResponse(rt, reason, this.guid, request.SequenceNumber));
        }
예제 #2
0
        //Get disk space of drive C on the local node used for nonbackup data
        public static long GetNonBackupSpace()
        {
            long nonBackupData = Node.GetTotalSize() - GetDirectorySize(GetBackupDirectory()) - Node.GetFreeSpace();

            return(nonBackupData);
        }
예제 #3
0
 //Get update message
 public string GetHeartbeat()
 {
     heartbeat = string.Concat(Node.GetUniqueID() + "/" + Node.GetHostName() + "/" + Node.GetInternetAddress() + "/" + Node.GetMAC()
                               + "/" + Node.GetMaxBackupSpace() + "/" + Node.GetBackupSpace() + "/" + Node.GetNonBackupSpace() + "/" + Node.GetFreeSpace()
                               + "/" + Node.GetTotalSize());
     return(heartbeat);
 }