UNPKG

5.83 kBPlain TextView Raw
1---------------------------------
2Abstracting beanpole:
3---------------------------------
4
5Plugins *MUST NOT* know if whether a computer is networked. That job is delegated for *one* particular module: glue.core. If a client connects to a server, and contains a hook which acts like a plugin, the backend should treat it exactly as it would with a another networked server, or even internally. Glue.core would handle the handshake / authentication.
6
7Likewise, connected servers using brazen must not handle communication with other servers differently than internally.
8
9
10For security sake, each channel must provide metadata identifying whether it's private, protected, or public. Channels default to private if it's absent.
11
12 - Public channels are available to call without authentication
13 - Protected channels are available to call only by other crusted servers / clients
14 - Private channels can only be handled within the application.
15
16All metadata is handled by the parser / router.
17
18
19---------------------------------
20Routing:
21---------------------------------
22
23The routing mechanism should parse syntactic sugar to identify how a particular channel is handled. Each channel must be separated by backslashes to allow for parameters. This is primarily for future implementation where beanpole might support HTTP requests.
24
25'[type] [meta]* [channel_name]* [channel/:param] [additional]*'
26
27- type: the type of channel - push, pull, ???
28- meta: information attached to channel help glue.core, and other handlers.
29- channel_name: the name of the channel. Private use from channel. Useful if channel needs to change, like a variable name.
30- channel: the physical channel separated/by/backslashes
31- additional: additional parameters specific to the channel type.
32
33on push application/ready: function(data){}
34
35'push private -pull application/ready'
36
37on private pull of application ready passing through application exists:
38
39'pull private application/exists -> application/ready': function(pull){ }
40
41
42Calling back:
43
44There needs to be a way for modules handling a particular request to identify where it's coming from.
45
46---------------------------------
47Types of channels:
48---------------------------------
49
50- pull - (getting) channels which respond to a particular request which maybe pushed out at a later time. This is from the source that makes the "push" with the same name.
51- push - (setting) channels which are pushed out are used after a particular change has occurred. This is one to many.
52
53Why I chose for push/pull to be different handlers with the same name:
54
55Inspiration was actually taken back in the day when I was developing in Actionscript (I know, stfu). Bindable metadata was a slick way of getting a particular property from an object, and then sticking to it for any changes. For beanpole, "pull" would be the action of getting the current value of a particular "pod" (object), and "push" is the method of sticking to it.
56
57Problems:
58
59How do we distinguish single pulls from multiple pulls? For instance, for multiple pulls, I may want to "pull" stats from all the servers, but for a single pull, I may want to register a particular queue, and *only* send it to one instance.
60
61Possible solutions:
62
63on('pull multi…')
64
65proxy.pull('multi…')
66
67is a different channel handing than
68
69on('pull…')
70proxy.pull('…')
71
72So technically, if I register
73
74proxy.on('pull get.name', …')
75proxy.on('pull multi get.name')
76
77there wouldn't be any complaining, since I can call only one, or the other. Where the first one can be the *only* one, and the second one can have multiple. SO
78
79proxy.pull('get.name')
80
81would be the first one, and
82
83proxy.pull('multi get.name')
84
85would be the second one.
86
87
88Multiple pulls also need to return to the requestor how many items are handling the request. This probably needs to take on a response, ondata, and end approach similar to node.js's streaming api
89
90Streaming:
91
92Without adding too much shit to the architecture, there may come a time where content is streamed to the particular requestor. This could be highly beneficial for programs which send files back and forth. Something which beanpole isn't necessarily equipped for at the moment. So, without changing the architecture, perhaps providing a method for supporting such a feature. For example:
93
94This could be used:
95
96proxy.pull('get.file','text.txt', {
97 data: function(buffer)
98 {
99 },
100 end: function()
101 {
102 }
103});
104
105or this could be used:
106
107proxy.pull('get.file','text.txt',function(body)
108{
109});
110
111
112But what about pulling from multiple sources?
113
114proxy.pull('multi get.file', 'text.txt', function(source) //callback multiple times
115{
116 source.on('data…
117});
118
119
120Hmmmm…
121
122
123--------------------------------
124Network Topology
125--------------------------------
126
127The architecture, mainly glue.core must have the ability to manage connected servers. Many of which should only communicate to particular applications. For instance: Currently there are two applications on spice.io which register queue's to the queue app . Each application has a slave which handles the cue, but the queue must know which slaves to send to. So:
128
129- Each app must have an identifier shared amongst other apps it needs to communicate with (_appId)
130- Since queues are protected, the handshake to between the queue app and the requester must be authenticated.
131- The queue must receive the app id, and know what apps to send to via registered channels.
132
133What if there are dozens of slaves running across a cluster of servers?
134
135there *must* be a way for glue.core to use a load-balancing mechanism to send individual pulls to servers: round robin, least connected, etc. Stats from servers to see which is less busy?
136
137What if there are multiple singleton pulls registered to glue.core?
138
139Duh, fucking round-robin that shit when a pull-request is made.
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155