Backup Rewind Function

The Backup Rewind function on the CloudBox allows users to retrieve past passings data stored in backup files. This feature is essential for recovering or replaying timing data to connected TCP clients and, if the CloudBox is bound to the Cloud, the data is also sent to the Cloud’s Passing Ingestion service. This ensures that any retrieved passings are available both locally and in the Cloud for further analysis or reporting.

In this article, we will explain how to use the Backup Rewind function through both the CloudBox user interface and via a TCP-connected client.

Overview of the Rewind Function

The Rewind function enables users to replay historical passings data stored in backup files by specifying a time range. These passings are sent to connected TCP clients as if they were received in real-time. Additionally, if the CloudBox is connected to the Cloud Service, all passings retrieved through the rewind process are forwarded to the Passing Ingestion service in the Cloud.

Using the Rewind Function from the CloudBox Interface

  1. Access the Backup Interface:

    • Navigate to the Backup Interface from the CloudBox dashboard.

    • You will see a section dedicated to managing backups, including the Rewind function.

  2. Specify the Time Range:

    • In the Start Timestamp and End Timestamp fields, enter the time range for the data you want to retrieve.

    • The timestamp format is:

      YYYY-MM-DD HH:mm:ss
  3. Initiating the Rewind:

    • Once you’ve set the time range, click Rewind to start the process.

    • If no timestamps are provided, the CloudBox will retrieve all available data from the backup files.

  4. Rewind Results:

    • The system will stream the passings data from the specified time range to all connected TCP clients. If the CloudBox is bound to the Cloud, the retrieved passings will also be sent to the Cloud Passing Ingestion service for synchronization.

Using the Rewind Function via a TCP-Connected Client

You can also initiate the Rewind function programmatically through a TCP socket connection, allowing for remote data retrieval and automated operations.

  1. TCP Command for Rewind:

    • The command to initiate a rewind is as follows:

      REWIND(startTimestamp, endTimestamp)
    • As with the interface, the startTimestamp and endTimestamp fields define the time range of the data you want to retrieve, and the format is:

      YYYY-MM-DD HH:mm:ss
    • If both values are set to null, the CloudBox will return all available data from the backup files.

  2. Example TCP Command: To retrieve passings data from 2024-09-18 09:00:00 to 2024-09-18 10:00:00, the TCP command would be:

    REWIND(2024-09-18 09:00:00, 2024-09-18 10:00:00)
  3. Receiving the Data:

    • The passings data is streamed to the TCP client as if it were happening in real-time.

    • If the CloudBox is connected to the Cloud, these passings will also be sent to the Cloud Passing Ingestion service.

  4. Handling Large Data Requests:

    • If no time range is specified, the system will attempt to retrieve all data stored in backups. This could be a large volume of information, depending on the backup file size. To avoid potential delays, it’s recommended to specify a time range when using the rewind function.

Rewind and the Cloud Passing Ingestion Service

When the CloudBox is bound to the Cloud Service, all passings retrieved through the rewind process are automatically transmitted to the Passing Ingestion Service. This ensures that any replayed or retrieved data is synchronized with the Cloud, even if it was not originally transmitted during the live timing session.

This feature provides an additional layer of data reliability, allowing for post-event synchronization with the Cloud and ensuring that all passings, whether captured in real time or retrieved from backups, are available in the Cloud for analysis and reporting.

Considerations for Using the Rewind Function

  • TCP Clients: The rewind function only sends data to connected TCP clients. Ensure that clients are actively connected before initiating the rewind process.

  • Cloud Synchronization: If the CloudBox is connected to the Cloud Service, all retrieved passings are forwarded to the Cloud’s Passing Ingestion service.

  • Time Range Specification: Specifying a time range can help limit the amount of data retrieved and improve performance. Retrieving all available data may take longer if backups have not been cleaned regularly.

  • Backup Cleanup: Periodically deleting old backup files can improve the efficiency of the rewind function, especially when retrieving large amounts of data.

Example Code: Using Rewind via TCP Client in Python, C#, and Node.js

Here’s how to use the Rewind function programmatically via a TCP-connected client in Python, C#, and Node.js.


Python Example:

import socket

# Define CloudBox IP and port
cloudbox_ip = '192.168.1.10'
port = 8080

# Create TCP socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Connect to CloudBox
client.connect((cloudbox_ip, port))

# Send REWIND command for a specific time range
rewind_command = 'REWIND;2024-09-18 09:00:00;2024-09-18 10:00:00\n'
client.sendall(rewind_command.encode())

# Receive data
while True:
    data = client.recv(1024)
    if not data:
        break
    print(data.decode('utf-8'))

# Close connection
client.close()

C# Example:

using System;
using System.Net.Sockets;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        // Define CloudBox IP and port
        string cloudboxIp = "192.168.1.10";
        int port = 8080;

        // Create TCP client
        TcpClient client = new TcpClient(cloudboxIp, port);

        // Send REWIND command
        string rewindCommand = "REWIND;2024-09-18 09:00:00;2024-09-18 10:00:00\n";
        byte[] data = Encoding.ASCII.GetBytes(rewindCommand);
        NetworkStream stream = client.GetStream();
        stream.Write(data, 0, data.Length);

        // Receive data
        byte[] buffer = new byte[1024];
        int bytesRead;

        while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0)
        {
            Console.WriteLine(Encoding.ASCII.GetString(buffer, 0, bytesRead));
        }

        // Close connection
        stream.Close();
        client.Close();
    }
}

Node.js Example:

const net = require('net');

// Define CloudBox IP and port
const cloudboxIp = '192.168.1.10';
const port = 8080;

// Create TCP client
const client = new net.Socket();

client.connect(port, cloudboxIp, () => {
    console.log('Connected to CloudBox');

    // Send REWIND command
    const rewindCommand = 'REWIND;2024-09-18 09:00:00;2024-09-18 10:00:00\n';
    client.write(rewindCommand);
});

// Receive data
client.on('data', (data) => {
    console.log('Received: ' + data);
});

// Close connection when done
client.on('close', () => {
    console.log('Connection closed');
});

In this example, the script connects to the CloudBox at IP 192.168.1.10 and requests passings data between 2024-09-18 09:00:00 and 2024-09-18 10:00:00. If the CloudBox is connected to the Cloud, all retrieved passings will also be sent to the Cloud.

Summary

The Backup Rewind function on the CloudBox is a powerful tool for replaying and retrieving passings data from a specified time range. This function can be used both via the CloudBox web interface and through a TCP-connected client. When the CloudBox is bound to the Cloud, all passings retrieved during the rewind process are also sent to the Passing Ingestion service, ensuring full synchronization between local and cloud data. Regular backup cleaning and careful use of the rewind function will ensure that data is retrieved efficiently and reliably.

Last updated