<commit_before>riakpbc
=======

A Riak Protocol Buffer Client in Go.

### Notes

As of June 21, 2013 the API is deemed relatively stable.  The library should be considered to be at a 0.9 level release, with more minor changes pending.

### Basic Usage

	  type Data struct {
    	Field1 string `riak:"index" json:"field1"`
    	Field2 int    `json:"field2"`
    }

		// Initialize riakpbc against a 3 node cluster
    riak := NewClient([]string{"127.0.0.1:8087", "127.0.0.0:9089", "127.0.0.0:9090"})
    
    // Add optional coder for storing JSON data to/from structs
    // Alternative marshallers can be built from this interface
    Coder := NewCoder("json", JsonMarshaller, JsonUnmarshaller)
    riak.SetCoder(Coder)
    
    // Dial all the nodes.
    if err := riak.Dial(); err != nil {
    	log.Print(err.Error())
    }

    // Set Client ID
    _, err = riak.SetClientId("coolio")
    if err != nil {
    	log.Println(err.Error())
    }

    // Store Struct (uses coder)
    data := Data{
    	Field1: "data1",
    	Field2: "data2",
    }
    _, err := riak.StoreStruct("bucket", "data", &data)
    if err != nil {
    	log.Println(err.Error())
    }

    // Fetch Struct (uses coder)
    out := &Data{}
    if err := riak.FetchObject("bucket", "other", &out); err != nil {
    	log.Println(err.Error())
    }
    fmt.Println(out.Field1)

    // Store raw data (int, string, []byte)
    if err := riak.StoreObject("bucket", "other", "direct data"); err != nil {
    	log.Println(err.Error())
    }

    // Fetch raw data (int, string, []byte)
    obj, err := riak.FetchObject("bucket", "data")
    if err != nil {
    	log.Println(err.Error())
    }
    fmt.Println(string(obj.GetContent()[0].GetValue()))
<commit_msg>slight format fixes<commit_after>riakpbc
=======

A Riak Protocol Buffer Client in Go.

### Notes

As of June 21, 2013 the API is deemed relatively stable.  The library should be considered to be at a 0.9 level release, with more minor changes pending.

### Basic Usage

    type Data struct {
    	Field1 string `riak:"index" json:"field1"`
    	Field2 int    `json:"field2"`
    }

    // Initialize riakpbc against a 3 node cluster
    riak := NewClient([]string{"127.0.0.1:8087", "127.0.0.0:9089", "127.0.0.0:9090"})
    
    // Add optional coder for storing JSON data to/from structs
    // Alternative marshallers can be built from this interface
    Coder := NewCoder("json", JsonMarshaller, JsonUnmarshaller)
    riak.SetCoder(Coder)
    
    // Dial all the nodes.
    if err := riak.Dial(); err != nil {
    	log.Print(err.Error())
    }

    // Set Client ID
    _, err = riak.SetClientId("coolio")
    if err != nil {
    	log.Println(err.Error())
    }

    // Store Struct (uses coder)
    data := Data{
    	Field1: "data1",
    	Field2: "data2",
    }
    _, err := riak.StoreStruct("bucket", "data", &data)
    if err != nil {
    	log.Println(err.Error())
    }

    // Fetch Struct (uses coder)
    out := &Data{}
    if err := riak.FetchObject("bucket", "other", &out); err != nil {
    	log.Println(err.Error())
    }
    fmt.Println(out.Field1)

    // Store raw data (int, string, []byte)
    if err := riak.StoreObject("bucket", "other", "direct data"); err != nil {
    	log.Println(err.Error())
    }

    // Fetch raw data (int, string, []byte)
    obj, err := riak.FetchObject("bucket", "other")
    if err != nil {
    	log.Println(err.Error())
    }
    fmt.Println(string(obj.GetContent()[0].GetValue()))

{'fraction_non_alphanumeric': 0.1558891454965358, 'fraction_numerical': 0.028290993071593534, 'mean_word_length': 2.6320754716981134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5637936', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1185, 'n_words': 330}