Re: [Twisted-Python] Advice Request: Under what circumstances should I use AMP's Command Response field?

2013-08-20 Thread Burak Nehbit
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  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



smime.p7s
Description: S/MIME cryptographic

Re: [Twisted-Python] Twisted as a House for Sale

2013-08-20 Thread Zooko O'Whielacronx
I loved the story! Thanks.

I think the idea of a separate site for the newcomer audience has a
lot of promise. Also that site might have different (primary)
maintainers than the twistedmatrix.com site. I guess maybe one of the
values of the "front door site" is what it excludes. All the
documentation which is either incomplete or past its prime could be
kept off of the front door site.

http://iffy.github.io/twistedftw/ looks very promising!

Regards,

Zooko

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


Re: [Twisted-Python] Twisted as a House for Sale

2013-08-20 Thread Matt Haggard
On Mon, Aug 19, 2013 at 6:34 PM, Glyph  wrote:
>
> On Aug 19, 2013, at 10:38 AM, Matt Haggard  wrote:
>
> ... [a story] ...
>
>
> Very entertaining :-).
>
> My one disappointment with the narrative was that when you were lushly
> describing standing in an open field west of the white house, you neglected
> to mention that there was a mailbox there.

I missed a great opportunity. :)

> I'd be happy to see what you come up with in terms of a site specifically
> for beginners.  I think you might need to do more than one; after all, "do
> you want to make an IRC bot or a name server or an all-singing all-dancing
> website with IMAP and XMPP on the side?" is a tough counter-question to ask
> of someone who just asks "what is Twisted?".

Yes, there will need to be more than one thing (whether that means
different sites or different landing pages on the same site).

> But let's not neglect the existing site!  I can see a lot of value of having
> some alternate entry-points, but there are probably things that you'd like
> those entry-points to link to on the Twisted site proper, which may not
> exist.  If you'd like make them exist by doing some web site maintenance
> ("wiki gardening"), I'd be happy to give you the relevant credentials on
> https://twistedmatrix.com/trac/.  Patches to documentation are always
> welcome too, although (as always) we need help to get the review queue back
> to a manageable size so they can be landed in a timely manner.  Even little
> changes (like this update that I made to the Trial page a few years ago) can
> help a lot.

Agreed.  My goal is to get them into the existing house/library, not
to build and manage an entirely new one.  Really, I just want them to
have a few great experiences AND to realize that a webserver is just
_one_ kind of server.  For example, it made me giddy the first time I
got a netstring state machine working.  And everyone at work was blown
away when I replaced our existing WSGI-server with Twisted (it doesn't
drop connections anymore).

My goal is to make them giddy, then set them loose in the house.

I can also do some wiki gardening (I've noticed Tom Prince has done a
lot of great gardening).  I'm thinking I'll find weeds as I look for
pages to send people to after making them giddy.

> I'm pretty sure we can scare up some hosting resources for things if you
> want to have some kind of demo persistent Twisted services running.
> twistedmatrix.com is no longer buckling under the pressure of its users -
> why, I just ssh'd in, and the load is less than 1.0!  By our historical
> standards that's practically idle! ;-)  And we have some other machines that
> we have not had the system administration bandwidth to make effective use
> of.

Great!  I will start working on a demo.

> It's also worthwhile to periodically really review the state of things, so
> you don't fix problems that are already fixed, or at least you build on
> solutions that are already in progress.  Sometimes us old-timers who
> remember when the docs were _really_ bad and there were _big_ gaps (the
> mention of the "index" makes me think you are remembering when
>  was just a blank directory
> listing) don't always appreciate how much things have improved in the
> intervening years.

This is why I'm optimistic about Twisted.  Things _do_ improve, though
Google seems to think Twisted is still version 8.2.0 (it was to that
quirk of Google, the Indexer, that I referred in my story)

Here's what I've got already.  (I don't love it yet -- it already
feels too cluttered -- but it's a start):
http://iffy.github.io/twistedftw/

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


Re: [Twisted-Python] Advice Request: Under what circumstances should I use AMP's Command Response field?

2013-08-20 Thread Laurens Van Houtven
Hi Burak,

On Tue, Aug 20, 2013 at 12:21 PM, Burak Nehbit  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


[Twisted-Python] Advice Request: Under what circumstances should I use AMP's Command Response field?

2013-08-20 Thread Burak Nehbit
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? 

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. 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. 

Am I missing anything AMP is doing silently for me? Am I using it the correct 
way?

Thanks in advance,

Best,
Burak





On Aug 20, 2013, at 8:47 AM, Laurens Van Houtven <_...@lvh.io> wrote:

> Hi Matt,
> 
> 
> Loved the story, excited about the prospects. Just one nitpick: after one of 
> Glyph's rants on gender-neutral words, I got tripped up by Ronnie not being 
> referred to as "they" ;-)
> 
> cheers
> lvh
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python



smime.p7s
Description: S/MIME cryptographic signature
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python