dm_transfer Module

Transfer type module for data upload from client to server. The transfer derived type is stored on server-side only.


Uses

  • module~~dm_transfer~~UsesGraph module~dm_transfer dm_transfer module~dm_error dm_error module~dm_transfer->module~dm_error module~dm_id dm_id module~dm_transfer->module~dm_id module~dm_kind dm_kind module~dm_transfer->module~dm_kind module~dm_mime dm_mime module~dm_transfer->module~dm_mime module~dm_net dm_net module~dm_transfer->module~dm_net module~dm_node dm_node module~dm_transfer->module~dm_node module~dm_time dm_time module~dm_transfer->module~dm_time module~dm_uuid dm_uuid module~dm_transfer->module~dm_uuid module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env module~dm_node->module~dm_id module~dm_node->module~dm_kind module~dm_time->module~dm_error module~dm_time->module~dm_kind module~dm_util dm_util module~dm_time->module~dm_util unix unix module~dm_time->unix module~dm_util->module~dm_error module~dm_util->module~dm_kind

Used by

  • module~~dm_transfer~~UsedByGraph module~dm_transfer dm_transfer module~dmpack dmpack module~dmpack->module~dm_transfer proc~dm_db_insert_transfer dm_db_insert_transfer proc~dm_db_insert_transfer->module~dm_transfer proc~dm_db_select_transfer dm_db_select_transfer proc~dm_db_select_transfer->module~dm_transfer proc~dm_db_update_transfer dm_db_update_transfer proc~dm_db_update_transfer->module~dm_transfer

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: TRANSFER_ID_LEN = UUID_LEN

Transfer id length.

integer, public, parameter :: TRANSFER_TYPE_NONE = 0

No type (invalid).

integer, public, parameter :: TRANSFER_TYPE_BLOB = 1

Arbitrary binary object.

integer, public, parameter :: TRANSFER_TYPE_IMAGE = 2

Image type (image_type from dm_image).

integer, public, parameter :: TRANSFER_TYPE_LAST = 2

Never use this.

integer, public, parameter :: TRANSFER_STATE_NONE = 0

Unprepared transfer (invalid).

integer, public, parameter :: TRANSFER_STATE_CREATED = 1

Transfer is initialised.

integer, public, parameter :: TRANSFER_STATE_ACTIVE = 2

Transfer is running.

integer, public, parameter :: TRANSFER_STATE_FAILED = 3

Transfer failed.

integer, public, parameter :: TRANSFER_STATE_DONE = 4

Transfer finished.

integer, public, parameter :: TRANSFER_STATE_LAST = 4

Never use this.


Interfaces

public interface operator (==)

Returns whether transfers are equal.

  • public pure elemental function dm_transfer_equals(transfer1, transfer2) result(equals)

    Returns .true. if given transfers are equal.

    Arguments

    Type IntentOptional Attributes Name
    type(transfer_type), intent(in) :: transfer1

    The first transfer.

    type(transfer_type), intent(in) :: transfer2

    The second transfer.

    Return Value logical


Derived Types

type, public ::  transfer_type

Transfer type for data upload from client to server. The attribute type_id is the id of the transfered object, for example, an image id. The derived type is invalid by default. The attributes type, id, node_id, type_id, state, and size have to be set initially.

Components

Type Visibility Attributes Name Initial
character(len=TRANSFER_ID_LEN), public :: id = ' '

Transfer id (UUIDv4).

character(len=NODE_ID_LEN), public :: node_id = ' '

Node id.

character(len=TRANSFER_ID_LEN), public :: type_id = ' '

Transfer object id (UUIDv4).

character(len=TIME_LEN), public :: timestamp = TIME_DEFAULT

Timestamp of current state (ISO 8601).

character(len=NET_IPV6_LEN), public :: address = ' '

Client IP address (IPv4, IPv6).

integer, public :: type = TRANSFER_TYPE_NONE

Transfer type.

integer, public :: state = TRANSFER_STATE_NONE

Transfer state.

integer, public :: error = E_NONE

Error code.

integer(kind=i8), public :: size = 0_i8

File size [byte]


Functions

public function dm_transfer_create(transfer, node_id, type_id, type, size) result(rc)

Creates and prepares transfer for given object id. The function returns E_INVALID if one of the arguments is invalid. Argument node_id must be a valid id, type_id must be a valid UUIDv4, and size greater than 0.

Arguments

Type IntentOptional Attributes Name
type(transfer_type), intent(out) :: transfer

Transfer type.

character(len=*), intent(in) :: node_id

Node id.

character(len=TRANSFER_ID_LEN), intent(in) :: type_id

Object id.

integer, intent(in) :: type

Object type (TRANSFER_TYPE_*).

integer(kind=i8), intent(in) :: size

File size [byte].

Return Value integer

public pure elemental function dm_transfer_equals(transfer1, transfer2) result(equals)

Returns .true. if given transfers are equal.

Arguments

Type IntentOptional Attributes Name
type(transfer_type), intent(in) :: transfer1

The first transfer.

type(transfer_type), intent(in) :: transfer2

The second transfer.

Return Value logical

public pure elemental function dm_transfer_is_valid(transfer) result(valid)

Returns .true. if transfer type is valid.

Arguments

Type IntentOptional Attributes Name
type(transfer_type), intent(in) :: transfer

Transfer type.

Return Value logical

public pure elemental function dm_transfer_state_is_valid(state) result(valid)

Returns .true. if transfer state is valid. Type TRANSFER_STATE_NONE is invalid.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: state

Transfer state (TRANSFER_STATE_*).

Return Value logical

public pure elemental function dm_transfer_type_is_valid(type) result(valid)

Returns .true. if object type is valid. Type TRANSFER_TYPE_NONE is invalid.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: type

Object type (TRANSFER_TYPE_*).

Return Value logical


Subroutines

public subroutine dm_transfer_out(transfer, unit)

Prints transfer to standard output or given file unit.

Arguments

Type IntentOptional Attributes Name
type(transfer_type), intent(inout) :: transfer
integer, intent(in), optional :: unit

public pure elemental subroutine dm_transfer_set(transfer, id, node_id, type_id, timestamp, address, type, state, error, size)

Set transfer attributes. This routine does not validate the arguments.

Arguments

Type IntentOptional Attributes Name
type(transfer_type), intent(inout) :: transfer

Transfer type.

character(len=TRANSFER_ID_LEN), intent(in), optional :: id

Transfer id.

character(len=*), intent(in), optional :: node_id

Node id.

character(len=TRANSFER_ID_LEN), intent(in), optional :: type_id

Object id.

character(len=TIME_LEN), intent(in), optional :: timestamp

Timestamp of current transfer state.

character(len=*), intent(in), optional :: address

Client IP address.

integer, intent(in), optional :: type

Object type (TRANSFER_TYPE_*).

integer, intent(in), optional :: state

Transfer state.

integer, intent(in), optional :: error

Error code.

integer(kind=i8), intent(in), optional :: size

Object size [byte].