pegasus-go-client

module
v0.0.0-...-ba0e684 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2022 License: Apache-2.0

README

pegasus-go-client

codecov

Go Report Card

PkgGoDev

This is the official go client for Apache Pegasus.

Requirement

Go1.12+.

Logging

By default pegasus-go-client logs to "./pegasus.log" on where your application runs. You can customize the logging rules as follows:

    // customize where the pegasus-go-client's logs reside.
    pegalog.SetLogger(pegalog.NewLogrusLogger(&pegalog.LogrusConfig{
        // rotation rules
        MaxSize:    500, // megabytes
        MaxAge:     5,   // days
        MaxBackups: 100,
        // log files location
        Filename:   "/home/work/myapp/log/pegasus.log",
    }))

To print the logs on screen:

pegalog.SetLogger(pegalog.StderrLogger)

We highly recommend you to enable client logging for debugging purpose. If you want support for other log destinations or log formats, please submit an issue for that.

Example

    import (
        "context"

        "github.com/XiaoMi/pegasus-go-client/pegasus"
    )

    cfg := Config{
        MetaServers: []string{"0.0.0.0:34601", "0.0.0.0:34602", "0.0.0.0:34603"},
    }

    client := NewClient(cfg)
    defer client.Close()

    tb, err := client.OpenTable(context.Background(), "temp")
    err = tb.Set(context.Background(), []byte("h1"), []byte("s1"), []byte("v1"))

For more examples please refer to example/.

TroubleShooting

Before using pegasus-go-client, it's recommended to configure GOBACKTRACE so as to generate coredump while program unexpectedly corrupts.

ulimit -c unlimited
export GOBACTRACE=crash

Directories

Path Synopsis
idl
cmd
integration
op
rpc
Code generated by "generator -i=admin.csv > admin_rpc_types.go"; DO NOT EDIT.
Code generated by "generator -i=admin.csv > admin_rpc_types.go"; DO NOT EDIT.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL