Request App

class sequence.app.request_app.RequestApp(node: QuantumRouter)

Code for the request application.

This application will create a request for entanglement. If the request is accepted, the network will start to serve the request at the start time of the request and end at the end time of the request. Otherwise, the app do nothing. The information about the request is defined in the arguments of the start function.

node

Node that code is attached to.

Type:

QuantumRouter

responder

name of the responder node

Type:

str

start_t

the start time of request (ps)

Type:

int

end_t

the end time of request (ps)

Type:

int

memo_size

the size of memory used for the request

Type:

int

fidelity

the target fidelity of the entanglement

Type:

float

reservation_result

if network approves the request

Type:

bool

memory_counter

number of successfully received memories

Type:

int

path

the path of flow denoted by a list of node names

Type:

list[str]

memo_to_reserve

mapping of memory index to corresponding reservation.

Type:

dict[int, Reservation]

name

the name of the app

Type:

str

add_memo_reservation_map(index: int, reservation: Reservation) None

Maps memory index to the corresponding reservation.

Parameters:
  • index (int) – Memory index

  • reservation (Reservation) – Reservation that index should map to.

get_memory(info: MemoryInfo) None

Method to receive entangled memories.

Will check if the received memory is qualified. If it’s a qualified memory, the application sets memory to RAW state and release back to resource manager. The counter of entanglement memories, ‘memory_counter’, is added. Otherwise, the application does not modify the state of memory and release back to the resource manager.

Parameters:

info (MemoryInfo) – info on the qualified entangled memory.

get_other_reservation(reservation: Reservation) None

Method to add the approved reservation that is requested by other nodes. The responder will call this method

Parameters:

reservation (Reservation) – reservation that uses the node of an application as the responder

Side Effects:

Will add calls to add_memo_reservation_map and remove_memo_reservation_map methods.

get_reservation_result(reservation: Reservation, result: bool) None

Method to receive reservation result from network manager.

The initiator will call this method once received a response from the responder.

Parameters:
  • reservation (Reservation) – reservation that has been completed.

  • result (bool) – result of the request (approved/rejected).

Side Effects:

May schedule a start/retry event based on reservation result.

remove_memo_reservation_map(index: int) None

Function to remove mapping from self.memo_to_reservation.

When a reservation ends, it should be removed from mapping by this method.

Parameters:

index (int) – The memory index to remove.

schedule_reservation(reservation: Reservation) None
Calling the add_memo_reservation_map and remove_memo_reservation_map methods at the

reservation’s start_time and end_time for all timecards (memory) involved in the reservation.

Parameters:

reservation (Reservation) – reservation to schedule

start(responder: str, start_t: int, end_t: int, memo_size: int, fidelity: float)

Method to start the application.

This method will use arguments to create a request and send to the network.

Side Effects:

Will create request for network manager on node.