On Tue, 23 Feb 2010 12:30:52 -0600 Ted Zlatanov <t...@lifelogs.com> wrote: 

TZ> Can a Cassandra node be made read-only (as far as clients know)?

I realized I have another use case for read-only access besides backups:

On our network we have Cassandra readers, writers, and analyzers
(read+write).  The writers and analyzers can run anywhere.  The readers
can run anywhere too.  I don't want the readers to have write access but
they should be able to read all keyspaces.

I think the best way to solve this is with an IAuthenticator change to
distinguish between full permissions and read-only permissions.  Then
the Thrift API has to be modified to check for write access in only some
functions:

insert
batch_insert
remove
batch_mutate

I can make the necessary changes to the Avro API as well.

The work will require a change to login() to make it return an enum:

enum AuthorizedAccessLevel {
    NONE = 0,
    READ = 16,
    WRITE = 32,
}

AuthorizedAccessLevel login(1: required string keyspace, 2:required 
AuthenticationRequest auth_request) throws (1:AuthenticationException authnx, 
2:AuthorizationException authzx),

...and that's pretty much it.  Since login() used to be void, the change
is painless and will basically be a change of the loginDone ThreadLocal
in CassandraServer from Boolean to AuthorizedAccessLevel.

I left room between the enums in case we need future expansion,
e.g. "insert-only" for collectors that can't remove() or
batch_mutate().

Does this seem reasonable?

Thanks
Ted

Reply via email to