mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
21e7d7e209
6 changed files with 89 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
default.etcd/
|
||||
*.test
|
||||
vendor
|
||||
|
|
|
|||
8
.travis.yml
Normal file
8
.travis.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
language: go
|
||||
go:
|
||||
- 1.7.x
|
||||
- master
|
||||
script: make test
|
||||
notifications:
|
||||
slack:
|
||||
secure: k0m8IqQIjb8L5b1plR9+w4hGo5iWlGtrR9nxvPsHL7gShwez74dpHCmFUCjR/uJoZa5Xq6849IWmiBB71ZHE/wNVN60HpMeui9VKkYvUDVpgBuqoIo969ySPDyQo4jNsk0wRRv/dG5/wXo7ArY8qOp5UDjdVuEf4nEbDlBtKjo0A2W8qXBTdZ5EJ3VeP5nrtrT7knuWxXgeUyVmLkpnUaLgkY7icvH6evqkftfcb56n3l5ulKtlQkI/ij2XCUK+5xtNB9m0e1QbiqIFS7sjwlSly/GCstPVnTEp4oHNHE7LtS6TJ8lgRV90Qy6LPtROjbSdfVjhJ5cYKus8DdddSfcsm2qgHCHQThyYtVAfOXaFPYPb50WXEu3HOckHk1tYChfkdxwEGdn/cN8/xxa7Khd7T/+SaS1B4CPxOFp0ie+rD4lF6IhApmpr/UwtiW6srHcPB04lF5mioYWmyS2eyGKTzSZR82nifg5KYUgBL1FjywQDYb8t9QaAn/6svu08k4H29TBnYpOQWREb38pYmEnMtRqiRmbfQL6IyV8405TJkl/PZmIElX6IQGjf53M1KoFdCUuTL1we6rh8gen5zRVUwmM6BJxkVt4NJ2wGkrXg/HD3feYCMrv+DY3lfDN7tADx90lPb+ukmanB8oSIQHLuLCJ2XcFixEC3QSvVlnH0=
|
||||
49
Makefile
49
Makefile
|
|
@ -1,10 +1,47 @@
|
|||
.PHONY: vendor
|
||||
.PHONY: glide vendor-update docker pilosa pilosactl crossbuild install
|
||||
|
||||
default:
|
||||
GLIDE := $(shell command -v glide 2>/dev/null)
|
||||
VERSION := $(shell git describe --tags)
|
||||
IDENTIFIER := $(VERSION)-$(GOOS)-$(GOARCH)
|
||||
CLONE_URL=github.com/pilosa/pilosa
|
||||
BUILD_TIME=`date -u +%FT%T%z`
|
||||
LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.BuildTime=$(BUILD_TIME)"
|
||||
|
||||
vendor:
|
||||
godep save ./...
|
||||
cp -r $(GOPATH)/src/github.com/gogo/protobuf/proto/testdata vendor/github.com/gogo/protobuf/proto/testdata
|
||||
default: test pilosa pilosactl
|
||||
|
||||
docker:
|
||||
$(GOPATH)/bin:
|
||||
mkdir $(GOPATH)/bin
|
||||
|
||||
glide: $(GOPATH)/bin
|
||||
ifndef GLIDE
|
||||
curl https://glide.sh/get | sh
|
||||
endif
|
||||
|
||||
vendor: glide glide.yaml
|
||||
glide install
|
||||
|
||||
glide.lock: glide glide.yaml
|
||||
glide update
|
||||
|
||||
vendor-update: glide.lock
|
||||
|
||||
test: vendor
|
||||
go test $(shell cd $(GOPATH)/src/$(CLONE_URL); go list ./... | grep -v vendor)
|
||||
|
||||
pilosa: vendor
|
||||
go build $(LDFLAGS) $(FLAGS) $(CLONE_URL)/cmd/pilosa
|
||||
|
||||
pilosactl: vendor
|
||||
go build $(LDFLAGS) $(FLAGS) $(CLONE_URL)/cmd/pilosactl
|
||||
|
||||
crossbuild: vendor
|
||||
mkdir -p build/pilosa-$(IDENTIFIER)
|
||||
make pilosa FLAGS="-o build/pilosa-$(IDENTIFIER)/pilosa"
|
||||
make pilosactl FLAGS="-o build/pilosa-$(IDENTIFIER)/pilosactl"
|
||||
|
||||
install: vendor
|
||||
go install $(LDFLAGS) $(FLAGS) $(CLONE_URL)/cmd/pilosa
|
||||
go install $(LDFLAGS) $(FLAGS) $(CLONE_URL)/cmd/pilosactl
|
||||
|
||||
docker: vendor
|
||||
docker build -t pilosa:latest .
|
||||
|
|
|
|||
|
|
@ -17,13 +17,19 @@ import (
|
|||
"github.com/pilosa/pilosa"
|
||||
)
|
||||
|
||||
// Version holds the version information passed in at compile time.
|
||||
var Version string
|
||||
// Version and BuildTime hold the version/build time information passed in at compile time.
|
||||
var (
|
||||
Version string
|
||||
BuildTime string
|
||||
)
|
||||
|
||||
func init() {
|
||||
if Version == "" {
|
||||
Version = "v0.0.0"
|
||||
}
|
||||
if BuildTime == "" {
|
||||
BuildTime = "not recorded"
|
||||
}
|
||||
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
}
|
||||
|
|
@ -36,7 +42,7 @@ const (
|
|||
func main() {
|
||||
m := NewMain()
|
||||
m.Server.Handler.Version = Version
|
||||
fmt.Fprintf(m.Stderr, "Pilosa %s\n", Version)
|
||||
fmt.Fprintf(m.Stderr, "Pilosa %s, build time %s\n", Version, BuildTime)
|
||||
|
||||
// Parse command line arguments.
|
||||
if err := m.ParseFlags(os.Args[1:]); err != nil {
|
||||
|
|
|
|||
|
|
@ -42,11 +42,24 @@ var (
|
|||
|
||||
// ErrPathRequired is returned when executing a command without a required path.
|
||||
ErrPathRequired = errors.New("path required")
|
||||
Version string
|
||||
BuildTime string
|
||||
)
|
||||
|
||||
func init() {
|
||||
if Version == "" {
|
||||
Version = "v0.0.0"
|
||||
}
|
||||
if BuildTime == "" {
|
||||
BuildTime = "not recorded"
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
m := NewMain()
|
||||
|
||||
fmt.Fprintf(m.Stderr, "Pilosactl %s, build time %s\n", Version, BuildTime)
|
||||
|
||||
// Parse command line arguments.
|
||||
if err := m.ParseFlags(os.Args[1:]); err == flag.ErrHelp {
|
||||
os.Exit(2)
|
||||
|
|
|
|||
|
|
@ -128,15 +128,22 @@ func (cmd *ImportCommand) Run(ctx context.Context) error {
|
|||
func (cmd *ImportCommand) importPath(ctx context.Context, path string) error {
|
||||
a := make([]pilosa.Bit, 0, cmd.BufferSize)
|
||||
|
||||
// Open file for reading.
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
var r *csv.Reader
|
||||
|
||||
if path != "-" {
|
||||
// Open file for reading.
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
// Read rows as bits.
|
||||
r = csv.NewReader(f)
|
||||
} else {
|
||||
r = csv.NewReader(cmd.Stdin)
|
||||
}
|
||||
|
||||
// Read rows as bits.
|
||||
r := csv.NewReader(f)
|
||||
r.FieldsPerRecord = -1
|
||||
rnum := 0
|
||||
for {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue