Skip to content

Commit 7e0647b

Browse files
author
void
committed
Add ARCHITECTURE.md
1 parent 17012a2 commit 7e0647b

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

ARCHITECTURE.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
methods/*
2+
These files define all methods callable under
3+
web3.db.*
4+
web3.eth.*
5+
web3.net.*
6+
web3.personal.*
7+
web3.shh.*
8+
9+
Methods and properties are first defined as a dictionary
10+
and then are converted to real functions and attached to the
11+
respective objects. This will make it easier to mirror the
12+
next migrations of the web3.js library. Both types are defined
13+
in method.py and property.py respectively.
14+
15+
RequestManager
16+
Is supplied with one Provider at initialisation which
17+
can be replaced by calling setProvider(). It uses Jsonrpc
18+
to convert the methods into raw payloads and to validate
19+
responses attained with receive().
20+
21+
Has three other methods:
22+
23+
- send(data, timeout=None)
24+
If timeout is None, send blocks until the result is
25+
available, which it then returns.
26+
27+
If the timeout is 0, send returns immediately, only
28+
returning the id of the request, which can be used
29+
to poll with receive() later.
30+
31+
If the timeout is greater than 0, it blocks until
32+
either the result is available or the timeout is
33+
reached, at which point a ValueError is thrown.
34+
35+
send() makes use of the other two functions:
36+
37+
- forward(data)
38+
Forwards the data to the provider and returns the
39+
request id.
40+
41+
- receive(requestid, timeout=0)
42+
Implements the timeout functionality described in send.
43+
If timeout is 0, it returns None if the response was
44+
not available.
45+
46+
Provider
47+
On initialisation, is started in a separate thread.
48+
Continuously fetches incoming requests from a queue
49+
and appends the responses to another queue. Providers
50+
only receives and returns "raw" requests, JSON validation
51+
and decoding happens in the Request Manager.
52+
53+
As of now there are two implementations:
54+
- RPCProvider
55+
- IPCProvider

0 commit comments

Comments
 (0)