TTL/Lease expiry code somewhere?
Cees de Groot
cg at cdegroot.com
Thu Feb 24 23:18:06 UTC 2005
I wanted to hack another thing onto the p2p stuff, but got bogged down by
something I really hope already exists, but I cannot seem to find :)
What I'm working at is something called 'presence'. Users, files, and
whatnot can all announce themselves 'present'. This is a lease, so if you
don't regularly re-announce yourself present, your presence status will
expire. We got this going on IRC when discussing possible enhancements to
the p2p sample app (thanks Ken and Brian for testing) - you'd like to have
a list of who is available for chat - but it seems like it would work for
e.g. announcing the 'presence' of MC files as well.
Now, the lease expiry thing is a bit of code that I hope is there, because
it is more work outside the whole p2p business than I care to write :).
Basically, what is needed is that if you report an object 'present', the
object that manages local presence makes sure that when the TTL expires,
the object is removed from the presence. When an existing object is
reported present, the TTL should be reset (lease renewal). Etcetera.
The idea is that each node collects presence information (which is two
levels - for example 'CdG' would be declared present in 'ChatUsers', the
latter will probably be replaced by a UUID and an external naming scheme
but that's just some thoughts), and every X seconds swaps all changes in
presence information with all its neighbours. In this way, presence
information propagates reasonably quick without the need for individual
broadcasts to announce presence over the network.
Is there any lease management code floating around? Am I just missing a
simple algorithm to do this? I'm extremely tired at the moment, so chances
are that I'm overlooking something obvious, but any help here is
More information about the Squeak-dev