Beispiel #1
0
def kill():
    """
    Create kill message.

    Returns:
        str: Kill message.
    """
    return __message('kill')
Beispiel #2
0
def ask_storage_state():
    """
    Create ask_storage_state message.

    Returns:
        str: Ask_storage_state message.
    """
    return __message('ask_storage_state')
Beispiel #3
0
def file_sent(name):
    """
    Create file_sent message.

    Args:
        name (str): The file name.

    Returns:
        str: File_sent message.
    """
    return __message('file_sent', name=name)
Beispiel #4
0
def storage_state(blocks):
    """
    Create disk_state message.

    Args:
        blocks (list of dict): List of blocks information.
        client (str): The client.

    Returns:
        str: Storage_state message.
    """
    return __message('storage_state', blocks=blocks)
Beispiel #5
0
def disk_state(total, free):
    """
    Create disk_state message.

    Args:
        total (int): Total bytes in the disk.
        free (int): Free bytes in the disk.

    Returns:
        str: Disk_state message.
    """
    return __message('disk_state', total=total, free=free)
Beispiel #6
0
def delete_block(name='*', block_type='*', number='*'):
    """
    Create delete_block message.

    Args:
        name (str): The name of the file.
        block_type (str, optional): The block type.
        number (str, optional): The block number.

    Returns:
        str: Delete_block message.
    """
    return __message('delete_block',
                     block_type=block_type,
                     name=name,
                     number=number)
Beispiel #7
0
def send_block(block_type, name, number, content):
    """
    Create send_block message.

    Args:
        block_type (str): The block type.
        name (str): The name of the file.
        number (str, optional): The block number.
        content (str): The block content.

    Returns:
        str: Send_block message.
    """
    return __message('send_block',
                     block_type=block_type,
                     name=name,
                     number=number,
                     content=content)
Beispiel #8
0
def block(block_type, name, number, content):
    """
    Create block message.

    Args:
        block_type (str): The block type.
        name (str): The file name.
        number (int): The block number.
        content (str): The block content.

    Returns:
        str: Block message.
    """
    return __message('block',
                     block_type=block_type,
                     name=name,
                     number=number,
                     content=content)