service-localfs-meta

command module
v0.0.0-...-6fbc55f Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2016 License: AGPL-3.0 Imports: 20 Imported by: 0

README

service.localstore.meta

Microservice responsible for local storage metadata

It contains:

  • a gRPC server
  • a gRPC client

Server

To install the server do

go get -u github.com/clawio/service.localstore.meta

Then, define the following enviromental variables accordingly to your needs

export CLAWIO_LOCALSTORE_DATADIR=/tmp
export CLAWIO_LOCALSTORE_TMPDIR=/tmp
export CLAWIO_LOCALSTORE_PORT=57001

Run it

$ service.localstore.meta
2015/10/25 22:52:49 Service CLAWIO_LOCALSTORE started
2015/10/25 22:52:49 CLAWIO_LOCALSTORE_DATADIR=/tmp
2015/10/25 22:52:49 CLAWIO_LOCALSTORE_TMPDIR=/tmp
2015/10/25 22:52:49 CLAWIO_LOCALSTORE_PORT=57001

Client

The following snippet is used to create a folder.

package main

import (
	"github.com/clawio/service.localstore.meta/lib"
	pb "github.com/clawio/service.localstore.meta/proto"
	"golang.org/x/net/context"
	"google.golang.org/grpc"
	"log"
)

func main() {
	p := &lib.NewClientParams{}
	p.Addr = "localhost:57001"
	p.Opts = []grpc.DialOption{grpc.WithInsecure()}

	client, err := lib.NewClient(p)
	if err != nil {
		log.Fatal(err)
	}

	idt := &pb.Identity{}
	idt.Pid = "hugo"
	idt.Idp = "localhost"
	idt.DisplayName = "Hugo González Labrador"

	mkdirReq := &pb.MkdirReq{}
	mkdirReq.Idt = idt
	mkdirReq.Path = "somefolder"

	ctx := context.Background()

	_, err = client.Mkdir(ctx, mkdirReq)
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("Folder %s created", mkdirReq.Path)
}
```

Check the documentation and find more examples inside the client tests.



Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
proto
metadata
Package metadata is a generated protocol buffer package.
Package metadata is a generated protocol buffer package.
propagator
Package propagator is a generated protocol buffer package.
Package propagator is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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