Hi Laurens,

> I don't understand this part. It sounds like an authentication problem, no?

It's an authentication problem, yes, but the authentication is a very simple 
one—that the remote should initiate the start of the process with a handshake. 
That way, the local user's program knows under who to file the incoming data. 
It's less of an authentication and more of preventing the remote from dumping 
to the local user unrequested text.

> Some more information about your system would be useful. Are posts 
> append-only? Would it make sense to have a given serialization of them? If 
> so, a hash chain would allow you to sync with just one hash value. A 
> consensus protocol might help you figure out what that serialization is.

I seem to have been implicitly assuming more knowledge in my system than I have 
given, I apologise. To give a general overview, I am building a peer–to–peer 
network that is vaguely similar to reddit.com, but one that runs based on 
peer–to–peer exchanges rather than relying on a central server. My system sends 
posts across the wire from one computer to another, and all the sorting and 
other logic happens on the ends. The wire is rather dumb—I'm trying to follow 
the end to end principle as much as I can. 

The users handshake each other (by sending their node ids), exchange post 
fingerprints (of posts they have in their machines), request posts of 
fingerprints new to them, download posts from the remote, and then close the 
connection. This is the archetypal connection in my system. Posts are 
immutable, they cannot be deleted or edited, only pruned after six months, 
which is also enforced at endpoints. It should be rather simple to implement 
this with Twisted, barring some NAT Traversal pains, but that can be solved. 

The posts are JSON text. I do want to have a public–key implementation on top 
of this with a reliable ECC algorithm, but that's for future versions. For now, 
I am concerned with just getting it to work. 

Does this give you enough information? I am curious about the best or the most 
natural way to implement in it Twisted. I have been trying to work with Twisted 
on and off since March as ,y project progressed, but even after finishing the 
second edition Twisted book, I am still unable to fully wrap my head around it, 
hence these questions. 

Should I be using AMP? Am I doing something dumb?

Also, when I finally "get" Twisted, I'll be making a series of blog posts 
called "Twisted for Dumb People [Like Me]". Such a wonderful piece of code, it 
doesn't deserve the brick wall of a learning curve it currently has.

Thanks!

Best,
Burak






On Aug 20, 2013, at 3:06 PM, Laurens Van Houtven <_...@lvh.io> wrote:

> Hi Burak,
> 
> On Tue, Aug 20, 2013 at 12:21 PM, Burak Nehbit <bu...@nehbit.net> wrote:
> Hi there,
> 
> I was meaning to ask you all about the 'proper' way to use AMP in regards to 
> two–way communication. The problem I am facing is quite simple, I am building 
> a simple peer–to–peer network in which the user:
> 
> a) When sent a handshake, returns a handshake,
> b) When asked for fingerprints of posts in the local, returns it, and then 
> asks for the same thing,
> and finally, c) If any of the fingerprints do not match posts, request those 
> posts with the fingerprint.
> 
> The only non–symmetric step I have in my protocol is the last one.
> 
> My question is, should I send my responses over the same AMP command as a 
> response to the command requested, or should I just return an ACK (a boolean 
> value of true, to confirm receipt) and then initiate a separate AMP request 
> from local to the same remote?
> 
> Keep in mind that AMP commands are always ack'ed without you needing to 
> specify any kind of value, unless you set requiresResponse = False on the 
> Command class.
> 
> That would mean I would need to handle my open–connections pool by myself, to 
> prevent posts from a non–initiated machine being accepted into the local 
> machine, but I do need to implement that anyway due to the complexity of my 
> business rules.
> 
> I don't understand this part. It sounds like an authentication problem, no?
>  
> At that point, it seems that I am (Am I?) just using AMP as a remote method 
> header I don't strictly need, and I could just use LineReceiver—all my data 
> is text—to do my bidding.
> 
> It's usually correct that you can do things with LineReceiver, but it's also 
> usually true that AMP is doing stuff for you ;)
> 
> Some more information about your system would be useful. Are posts 
> append-only? Would it make sense to have a given serialization of them? If 
> so, a hash chain would allow you to sync with just one hash value. A 
> consensus protocol might help you figure out what that serialization is.
> 
> cheers
> lvh
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to