[asterisk-scf-dev] Changes regarding state replicator keys

Brent Eagles beagles at digium.com
Tue Dec 14 07:53:07 CST 2010


On Mon, Dec 13, 2010 at 01:39:06PM -0600, David M. Lee wrote:
> On Dec 13, 2010, at 12:01 PM, Mark Michelson wrote:
> 
> > 1) Instead of using a templated type for the key, use std::string. 
> > std::string has a .c_str() method that will give a const char * to the 
> > actual string content, and std::string has a size() method for reporting 
> > the size of the string.
> 
> +1.  If you have some class you want to use for your identifier, you
> just need to make sure that you can convert that class to std::string.
> 
> Conversions from std::string to the id class are probably an
> anti-pattern, since you're then using the identity column for more
> than just identity.  You can easily put such information in the value
> that's being stored, so that's not too limiting.


I had to think about this one a little bit because I didn't quite get
David's point. It did finally dawn on me that we were talking
specifically about replication, not general database type stuff.  *If*
we were building some mechanism for storing arbitrary data, then it
would make sense to have some versatility with respect to the key type.
However, this is specific to replication so it is not that big of a deal
to restrict the key type to strings.

On a related note, does memcached restrict key length? 

<snip>

I also agree with David on the other two possibilities, so I'm just
going to snip those out.


Cheers,

Brent



More information about the asterisk-scf-dev mailing list