aea.connections.stub.connection

This module contains the stub connection.

lock_file

@contextmanager
lock_file(file_descriptor: IO[bytes])

Lock file in context manager.

Arguments:

  • file_descriptor: file descriptio of file to lock.

write_envelope

write_envelope(envelope: Envelope, file_pointer: IO[bytes]) -> None

Write envelope to file.

write_with_lock

write_with_lock(file_pointer: IO[bytes], data: Union[bytes]) -> None

Write bytes to file protected with file lock.

StubConnection Objects

class StubConnection(Connection)

__init__

 | __init__(**kwargs)

Initialize a stub connection.

read_envelopes

 | async read_envelopes() -> None

Read envelopes from inptut file, decode and put into in_queue.

receive

 | async receive(*args, **kwargs) -> Optional["Envelope"]

Receive an envelope.

connect

 | async connect() -> None

Set up the connection.

disconnect

 | async disconnect() -> None

Disconnect from the channel.

In this type of connection there's no channel to disconnect.

send

 | async send(envelope: Envelope) -> None

Send messages.

Returns:

None