qns.entity.node package
Submodules
qns.entity.node.app module
- class qns.entity.node.app.Application[source]
Bases:
object
Application can be deployed on the quantum nodes.
- add_handler(handler, EventTypeList: List = [], ByList: List = [])[source]
Add a handler function to the dispather.
- Parameters
handler – The handler to process the event. It is an object method whose function signature is the same to
handle
function.EventTypeList – a list of Event Class Type. An empty list meaning to match all events.
ByList – a list of Entities, QNodes or Applications, that generates this event. An empty list meaning to match all entities.
- handle(node, event: qns.simulator.event.Event) Optional[bool] [source]
process the event on the node.
- install(node, simulator: qns.simulator.simulator.Simulator)[source]
install initial events for this QNode
qns.entity.node.node module
- class qns.entity.node.node.QNode(name: Optional[str] = None, apps: Optional[List[qns.entity.node.app.Application]] = None)[source]
Bases:
qns.entity.entity.Entity
QNode is a quantum node in the quantum network
- add_apps(app: qns.entity.node.app.Application)[source]
Insert an Application into the app list.
- Parameters
app (Application) – the inserting application.
- add_cchannel(cchannel)[source]
Add a classic channel in this QNode
- Parameters
cchannel (ClassicChannel) – the classic channel
- add_memory(memory)[source]
Add a quantum memory in this QNode
- Parameters
memory (Memory) – the quantum memory
- add_network(network)[source]
add a network object to this node
- Parameters
network (qns.network.network.Network) – the network object
- add_operator(operator)[source]
Add a quantum operator in this node
- Parameters
operator (QuantumOperator) – the quantum operator
- add_qchannel(qchannel)[source]
Add a quantum channel in this QNode
- Parameters
qchannel (QuantumChannel) – the quantum channel
- add_request(request)[source]
add a request to this node
- Parameters
request (Request) – the inserting request
- get_apps(app_type)[source]
Get an Application that is app_type
- Parameters
app_type – the class of app_type
- get_cchannel(dst: qns.entity.node.node.QNode)[source]
Get the classic channel that connects to the dst
- Parameters
dst (QNode) – the destination
- get_qchannel(dst: qns.entity.node.node.QNode)[source]
Get the quantum channel that connects to the dst
- Parameters
dst (QNode) – the destination
- handle(event: qns.simulator.event.Event) None [source]
This function will handle an Event. This event will be passed to every applications in apps list in order.
- Parameters
event (Event) – the event that happens on this QNode
- install(simulator: qns.simulator.simulator.Simulator) None [source]
install
is called beforesimulator
runs to initialize or set initial events- Parameters
simulator (qns.simulator.simulator.Simulator) – the simulator
Module contents
- class qns.entity.node.Application[source]
Bases:
object
Application can be deployed on the quantum nodes.
- add_handler(handler, EventTypeList: List = [], ByList: List = [])[source]
Add a handler function to the dispather.
- Parameters
handler – The handler to process the event. It is an object method whose function signature is the same to
handle
function.EventTypeList – a list of Event Class Type. An empty list meaning to match all events.
ByList – a list of Entities, QNodes or Applications, that generates this event. An empty list meaning to match all entities.
- handle(node, event: qns.simulator.event.Event) Optional[bool] [source]
process the event on the node.
- install(node, simulator: qns.simulator.simulator.Simulator)[source]
install initial events for this QNode
- class qns.entity.node.QNode(name: Optional[str] = None, apps: Optional[List[qns.entity.node.app.Application]] = None)[source]
Bases:
qns.entity.entity.Entity
QNode is a quantum node in the quantum network
- add_apps(app: qns.entity.node.app.Application)[source]
Insert an Application into the app list.
- Parameters
app (Application) – the inserting application.
- add_cchannel(cchannel)[source]
Add a classic channel in this QNode
- Parameters
cchannel (ClassicChannel) – the classic channel
- add_memory(memory)[source]
Add a quantum memory in this QNode
- Parameters
memory (Memory) – the quantum memory
- add_network(network)[source]
add a network object to this node
- Parameters
network (qns.network.network.Network) – the network object
- add_operator(operator)[source]
Add a quantum operator in this node
- Parameters
operator (QuantumOperator) – the quantum operator
- add_qchannel(qchannel)[source]
Add a quantum channel in this QNode
- Parameters
qchannel (QuantumChannel) – the quantum channel
- add_request(request)[source]
add a request to this node
- Parameters
request (Request) – the inserting request
- get_apps(app_type)[source]
Get an Application that is app_type
- Parameters
app_type – the class of app_type
- get_cchannel(dst: qns.entity.node.node.QNode)[source]
Get the classic channel that connects to the dst
- Parameters
dst (QNode) – the destination
- get_qchannel(dst: qns.entity.node.node.QNode)[source]
Get the quantum channel that connects to the dst
- Parameters
dst (QNode) – the destination
- handle(event: qns.simulator.event.Event) None [source]
This function will handle an Event. This event will be passed to every applications in apps list in order.
- Parameters
event (Event) – the event that happens on this QNode
- install(simulator: qns.simulator.simulator.Simulator) None [source]
install
is called beforesimulator
runs to initialize or set initial events- Parameters
simulator (qns.simulator.simulator.Simulator) – the simulator