Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

undocumented parameters in libcouchbase_store

6 replies [Last post]
  • Login or register to post comments
Wed, 05/16/2012 - 15:34
ari
Offline
Joined: 05/16/2012
Groups: None

Hello,

I can't find any documentation that covers several of the parameters to libcouchbase_store. I've digged through the header files, but there are still some things that are unclear. Specifically:

  1. What are the possible flags?
  2. What's the exp time in? Seconds from the epoch? Date in ISO format?
  3. What is cas used for?

The full definition from couchbase.h is this:

LIBCOUCHBASE_API
libcouchbase_error_t libcouchbase_store(libcouchbase_t instance,
                                        const void *command_cookie,
                                        libcouchbase_storage_t operation,
                                        const void *key, libcouchbase_size_t nkey,
                                        const void *bytes, libcouchbase_size_t nbytes,
                                        libcouchbase_uint32_t flags, libcouchbase_time_t exp,
                                        libcouchbase_cas_t cas);

Thanks!

Top
  • Login or register to post comments
Mon, 05/21/2012 - 01:56
avsej
avsej's picture
Offline
Joined: 06/15/2011
Groups: None

Fixed already: https://github.com/couchbase/libcouchbase/blob/master/include/libcouchba...

Thanks

__________________

Find me on FreeNode IRC in #libcouchbase channel

Top
  • Login or register to post comments
Mon, 05/21/2012 - 18:08
sjpark9
Offline
Joined: 03/01/2012
Groups: None

@param flags the user-defined flag section for the item (doesn't have any meaning to Couchbase server)

does this mean flag can be used as some kind of "index" or "hash" for the key/value?

Top
  • Login or register to post comments
Tue, 05/22/2012 - 00:37
avsej
avsej's picture
Offline
Joined: 06/15/2011
Groups: None

Yes, but keep in mind that some clients (like php, ruby, perl which are based on libcouchbase, or .net and java) use some bits of flags to mark the key type. For example ruby client uses 3 low bits.

__________________

Find me on FreeNode IRC in #libcouchbase channel

Top
  • Login or register to post comments
Tue, 05/22/2012 - 08:07
ari
Offline
Joined: 05/16/2012
Groups: None

Are the different clients compatible in their use of the flag section, or do they differ? Is the behavior something that we can rely on, or might it change in different version of clients, or between languages? I can think of many uses for it, but I don't want to worry that adding a new language client will clobber the data I already put in there.

Top
  • Login or register to post comments
Tue, 05/22/2012 - 08:14
avsej
avsej's picture
Offline
Joined: 06/15/2011
Groups: None

Historically those flags came from memcached clients, therefore different clients are defining their own rules. Moreover some clients doesn't expose them to the user (like php client). What I've done for ruby client is to allow to fetch value without applying flag-sensitive transformations. For example if python client will set JSON value and arrange its own flag set to claim format, then the ruby client could ignore any flags and apply the JSON decoder.

doc = JSON.load(connection.get("foo", :format => :plain))

The code above share some knowledge about current application domain and the data in it. At least having this API will help to resolve flag-related issues in polyglot systems (from ruby side). Libcouchbase in this sense is pure library and doesn't touch the flags at all.

__________________

Find me on FreeNode IRC in #libcouchbase channel

Top
  • Login or register to post comments
Sat, 06/09/2012 - 08:12
endseeker
Offline
Joined: 06/08/2012
Groups: None

what about the cas parameter? I can't find any ways to get a cas value for a key?

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker