From 01fdceb88316609fc73efcb1166d014a7ee1f2c1 Mon Sep 17 00:00:00 2001 From: "Juan B. Rodriguez" Date: Wed, 19 Dec 2018 08:04:02 -0500 Subject: [PATCH 1/2] Replace go-micro with gRPC Ref #52 --- .vscode/settings.json | 4 +- README.md | 11 +- server/Makefile | 7 +- server/agent.go | 141 +++++++++++--- server/agent/handler.go | 95 --------- server/go.mod | 1 + server/go.sum | 20 ++ server/mediaagent/agent.pb.go | 235 +++++++++++++++++++++++ server/{proto => mediaagent}/agent.proto | 7 + server/proto/agent.pb.go | 122 ------------ server/services/core.go | 33 ++-- server/services/dal.go | 5 +- server/services/scanner.go | 39 ++-- 13 files changed, 437 insertions(+), 283 deletions(-) delete mode 100644 server/agent/handler.go create mode 100644 server/mediaagent/agent.pb.go rename server/{proto => mediaagent}/agent.proto (70%) delete mode 100644 server/proto/agent.pb.go diff --git a/.vscode/settings.json b/.vscode/settings.json index 76c47c7..83f429e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,3 @@ { - "go.toolsEnvVars": { - "GO111MODULE": "on" - } + "go.docsTool": "gogetdoc" } diff --git a/README.md b/README.md index d53f131..877931f 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,22 @@ Movies View - [vuejs](https://vuejs.org/) - [tachyons-sass](https://github.com/tachyons-css/tachyons-sass) -- 4th Iteration [(code)](https://github.com/jbrodriguez/mediagui/)
+- 4th Iteration [(code)](https://github.com/jbrodriguez/mediagui/tree/4.2.0/)
To learn: + - [vue-cli](https://cli.vuejs.org/) - [vuex modules](https://vuex.vuejs.org/guide/modules.html) +- 5th Iteration [(code)](https://github.com/jbrodriguez/mediagui/)
+ To learn: + - [gRPC](https://gprc.io/) + ## Summary +### 5th Iteration + +gRPC is easier to work with than go-micro (+consul). + ### 4th Iteration @vue-cli 3.x is an awesome tool. diff --git a/server/Makefile b/server/Makefile index ff27ffd..5798c61 100644 --- a/server/Makefile +++ b/server/Makefile @@ -29,7 +29,7 @@ clean: go clean protobuf: - protoc -I=./src/proto --go_out=./src/proto ./src/proto/agent.proto + protoc -I mediaagent/ mediaagent/agent.proto --go_out=plugins=grpc:mediaagent # run formatting tool and build build: dependencies clean @@ -40,9 +40,12 @@ buildx: dependencies clean go build fmt env GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$(mb_version)-$(mb_count).$(mb_hash)" -v -o ${PROG} -agent: dependencies clean +agentx: dependencies clean env GOOS=linux GOARCH=amd64 go build -tags agent -ldflags "-X main.Version=$(mb_version)-$(mb_count).$(mb_hash)" -v -o agentx agent.go +agent: dependencies clean + go build -tags agent -ldflags "-X main.Version=$(mb_version)-$(mb_count).$(mb_hash)" -v -o agentx agent.go + release: dependencies clean go build fmt go build -ldflags "-X main.Version=$(mb_version)-$(mb_count).$(mb_hash)" -v -o ${PROG} diff --git a/server/agent.go b/server/agent.go index 2431e04..b91ec9d 100644 --- a/server/agent.go +++ b/server/agent.go @@ -3,45 +3,138 @@ package main import ( + "context" + "flag" + "fmt" "log" + "net" "os" + "path/filepath" + "strings" - "github.com/micro/go-micro/cmd" - "github.com/micro/go-micro/server" + "google.golang.org/grpc" - "mediagui/agent" + pb "mediagui/mediaagent" ) +// var Version string // Version - plugin version -var Version string +var ( + Version string + port = flag.Int("port", 7624, "The server port") +) -func main() { - log.Printf("Started agent v%s", Version) +type mediaAgentServer struct { + host string +} + +// Scan - +func (m *mediaAgentServer) Scan(_ context.Context, req *pb.ScanReq) (*pb.ScanRsp, error) { + log.Printf("Received Agent.Scan request: %v\n", req) + + rep := &pb.ScanRsp{ + Filenames: make([]string, 0), + } + + for _, folder := range req.Folders { + list := m.walk(folder, req.Mask) + // if err != nil { + // mlog.Warning("Unable to scan folder (%s): %s", folder, err) + // } + + // files = append(files, list...) + rep.Filenames = append(rep.Filenames, list...) + } + + // for _, f := range files { + // rsp.Filenames = append(rsp.Filenames, f) + // } + + log.Printf("Sent back %d files\n", len(rep.Filenames)) + + return rep, nil +} + +func (m *mediaAgentServer) walk(folder, mask string) []string { + if folder[len(folder)-1] != '/' { + folder = folder + "/" + } + + var files []string + + filepath.Walk(folder, func(path string, f os.FileInfo, err error) error { + if err != nil { + log.Printf("Agent.Scan.walk: %s (%s) - [%+v]\n", err, path, f) + } + + if f.IsDir() { + return nil + } + + if !strings.Contains(mask, strings.ToLower(filepath.Ext(path))) { + // mlog.Info("[%s] excluding %s", filepath.Ext(path), path) + return nil + } + + // log.Infof("file=%s", path) + + files = append(files, m.host+":"+path) - // optionally setup command line usage - cmd.Init() + return nil + }) + return files +} + +// Exists - +func (m *mediaAgentServer) Exists(_ context.Context, req *pb.ExistsReq) (*pb.ExistsRsp, error) { + log.Printf("Received Agent.Exists request: %d items", len(req.Items)) + + rep := &pb.ExistsRsp{ + Items: make([]*pb.Item, 0), + } + + for _, item := range req.Items { + exists := true + + if _, err := os.Stat(item.Location); err != nil { + exists = !os.IsNotExist(err) + } + + if !exists { + log.Printf("Location %s doesn't exist\n", item.Location) + rep.Items = append(rep.Items, item) + } + } + + return rep, nil +} + +func newServer() *mediaAgentServer { host, err := os.Hostname() if err != nil { log.Fatalf("Unable to obtain hostname: %s", err) } - // Initialise Server - server.Init( - server.Name("io.jbrodriguez.mediagui.agent."+host), - server.Address("0.0.0.0:0"), - ) - - // Register Handlers - server.Handle( - server.NewHandler( - &agent.Agent{Host: host}, - ), - ) - - // Run server - if err := server.Run(); err != nil { - log.Printf("%s", err) + return &mediaAgentServer{host: host} +} + +func main() { + flag.Parse() + + address := fmt.Sprintf("0.0.0.0:%d", *port) + + lis, err := net.Listen("tcp", address) + if err != nil { + log.Fatalf("failed to listen: %v", err) } + log.Printf("Started MediaAgent v%s listening on %s", Version, address) + + var opts []grpc.ServerOption + grpcServer := grpc.NewServer(opts...) + + pb.RegisterMediaAgentServer(grpcServer, newServer()) + + grpcServer.Serve(lis) } diff --git a/server/agent/handler.go b/server/agent/handler.go deleted file mode 100644 index 0d5fa45..0000000 --- a/server/agent/handler.go +++ /dev/null @@ -1,95 +0,0 @@ -package agent - -import ( - "log" - "os" - "path/filepath" - "strings" - - "golang.org/x/net/context" - - "mediagui/proto" -) - -// Agent - -type Agent struct { - Host string -} - -// Scan - -func (s *Agent) Scan(_ context.Context, req *agent.ScanReq, rsp *agent.ScanRsp) error { - log.Printf("Received Agent.Scan request: %v\n", req) - - // var files []string - - for _, folder := range req.Folders { - list := s.walk(folder, req.Mask) - // if err != nil { - // mlog.Warning("Unable to scan folder (%s): %s", folder, err) - // } - - // files = append(files, list...) - rsp.Filenames = append(rsp.Filenames, list...) - } - - // for _, f := range files { - // rsp.Filenames = append(rsp.Filenames, f) - // } - - log.Printf("Sent back %d files\n", len(rsp.Filenames)) - - return nil -} - -func (s *Agent) walk(folder, mask string) []string { - if folder[len(folder)-1] != '/' { - folder = folder + "/" - } - - var files []string - - filepath.Walk(folder, func(path string, f os.FileInfo, err error) error { - if err != nil { - log.Printf("Agent.Scan.walk: %s (%s) - [%+v]\n", err, path, f) - } - - if f.IsDir() { - return nil - } - - if !strings.Contains(mask, strings.ToLower(filepath.Ext(path))) { - // mlog.Info("[%s] excluding %s", filepath.Ext(path), path) - return nil - } - - // log.Infof("file=%s", path) - - files = append(files, s.Host+":"+path) - - return nil - }) - - return files -} - -// Exists - -func (s *Agent) Exists(_ context.Context, req *agent.ExistsReq, rsp *agent.ExistsRsp) error { - log.Printf("Received Agent.Exists request: %d items", len(req.Items)) - - rsp.Items = make([]*agent.Item, 0) - - for _, item := range req.Items { - exists := true - - if _, err := os.Stat(item.Location); err != nil { - exists = !os.IsNotExist(err) - } - - if !exists { - log.Printf("Location %s doesn't exist\n", item.Location) - rsp.Items = append(rsp.Items, item) - } - } - - return nil -} diff --git a/server/go.mod b/server/go.mod index 8487053..1df58bb 100644 --- a/server/go.mod +++ b/server/go.mod @@ -37,4 +37,5 @@ require ( golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941 // indirect golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1 golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba // indirect + google.golang.org/grpc v1.17.0 ) diff --git a/server/go.sum b/server/go.sum index 936ada0..5d48c40 100644 --- a/server/go.sum +++ b/server/go.sum @@ -1,7 +1,12 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/go-log/log v0.1.0 h1:wudGTNsiGzrD5ZjgIkVZ517ugi2XRe9Q/xRCzwEO4/U= github.com/go-log/log v0.1.0/go.mod h1:4mBwpdRMFLiuXZDCwU2lKQFsoSCo72j3HqBK9d81N2M= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= @@ -24,6 +29,7 @@ github.com/jbrodriguez/pubsub v0.0.0-20170412143127-17eb44fbbab7 h1:cmVsZIyMyb6b github.com/jbrodriguez/pubsub v0.0.0-20170412143127-17eb44fbbab7/go.mod h1:ML8/lItWxF5tBxYDd+I6lEyLTOJzU92VR+7L/P/H18c= github.com/jmcvetta/napping v3.2.0+incompatible h1:shS22lJu18MtyRV7IqWenMmrRXCjADcUcxONAnp5zxY= github.com/jmcvetta/napping v3.2.0+incompatible/go.mod h1:dlR6SvwNgFr2ASHFGDIO2fhkZM2rU/9B6NB6xUciyv4= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/labstack/echo v3.2.1+incompatible h1:J2M7YArHx4gi8p/3fDw8tX19SXhBCoRpviyAZSN3I88= github.com/labstack/echo v3.2.1+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= github.com/labstack/gommon v0.2.7 h1:2qOPq/twXDrQ6ooBGrn3mrmVOC+biLlatwgIu8lbzRM= @@ -68,7 +74,21 @@ github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4 h1:gKMu1Bf6QI github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4/go.mod h1:50wTf68f99/Zt14pr046Tgt3Lp2vLyFZKzbFXTOabXw= golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941 h1:qBTHLajHecfu+xzRI9PqVDcqx7SdHj9d4B+EzSn3tAc= golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1 h1:Y/KGZSOdz/2r0WJ9Mkmz6NJBusp0kiNx1Cn82lzJQ6w= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba h1:nZJIJPGow0Kf9bU9QTc1U6OXbs/7Hu4e+cNv+hxH+Zc= golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/server/mediaagent/agent.pb.go b/server/mediaagent/agent.pb.go new file mode 100644 index 0000000..e9d4623 --- /dev/null +++ b/server/mediaagent/agent.pb.go @@ -0,0 +1,235 @@ +// Code generated by protoc-gen-go. +// source: agent.proto +// DO NOT EDIT! + +/* +Package mediaagent is a generated protocol buffer package. + +It is generated from these files: + agent.proto + +It has these top-level messages: + ScanReq + ScanRsp + Item + ExistsReq + ExistsRsp +*/ +package mediaagent + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package + +type ScanReq struct { + Folders []string `protobuf:"bytes,1,rep,name=folders" json:"folders,omitempty"` + Mask string `protobuf:"bytes,2,opt,name=mask" json:"mask,omitempty"` +} + +func (m *ScanReq) Reset() { *m = ScanReq{} } +func (m *ScanReq) String() string { return proto.CompactTextString(m) } +func (*ScanReq) ProtoMessage() {} +func (*ScanReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type ScanRsp struct { + Filenames []string `protobuf:"bytes,1,rep,name=filenames" json:"filenames,omitempty"` +} + +func (m *ScanRsp) Reset() { *m = ScanRsp{} } +func (m *ScanRsp) String() string { return proto.CompactTextString(m) } +func (*ScanRsp) ProtoMessage() {} +func (*ScanRsp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +type Item struct { + Id uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Location string `protobuf:"bytes,2,opt,name=location" json:"location,omitempty"` + Title string `protobuf:"bytes,3,opt,name=title" json:"title,omitempty"` +} + +func (m *Item) Reset() { *m = Item{} } +func (m *Item) String() string { return proto.CompactTextString(m) } +func (*Item) ProtoMessage() {} +func (*Item) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +type ExistsReq struct { + Items []*Item `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` +} + +func (m *ExistsReq) Reset() { *m = ExistsReq{} } +func (m *ExistsReq) String() string { return proto.CompactTextString(m) } +func (*ExistsReq) ProtoMessage() {} +func (*ExistsReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *ExistsReq) GetItems() []*Item { + if m != nil { + return m.Items + } + return nil +} + +type ExistsRsp struct { + Items []*Item `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` +} + +func (m *ExistsRsp) Reset() { *m = ExistsRsp{} } +func (m *ExistsRsp) String() string { return proto.CompactTextString(m) } +func (*ExistsRsp) ProtoMessage() {} +func (*ExistsRsp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *ExistsRsp) GetItems() []*Item { + if m != nil { + return m.Items + } + return nil +} + +func init() { + proto.RegisterType((*ScanReq)(nil), "mediaagent.ScanReq") + proto.RegisterType((*ScanRsp)(nil), "mediaagent.ScanRsp") + proto.RegisterType((*Item)(nil), "mediaagent.Item") + proto.RegisterType((*ExistsReq)(nil), "mediaagent.ExistsReq") + proto.RegisterType((*ExistsRsp)(nil), "mediaagent.ExistsRsp") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion3 + +// Client API for MediaAgent service + +type MediaAgentClient interface { + Scan(ctx context.Context, in *ScanReq, opts ...grpc.CallOption) (*ScanRsp, error) + Exists(ctx context.Context, in *ExistsReq, opts ...grpc.CallOption) (*ExistsRsp, error) +} + +type mediaAgentClient struct { + cc *grpc.ClientConn +} + +func NewMediaAgentClient(cc *grpc.ClientConn) MediaAgentClient { + return &mediaAgentClient{cc} +} + +func (c *mediaAgentClient) Scan(ctx context.Context, in *ScanReq, opts ...grpc.CallOption) (*ScanRsp, error) { + out := new(ScanRsp) + err := grpc.Invoke(ctx, "/mediaagent.MediaAgent/Scan", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *mediaAgentClient) Exists(ctx context.Context, in *ExistsReq, opts ...grpc.CallOption) (*ExistsRsp, error) { + out := new(ExistsRsp) + err := grpc.Invoke(ctx, "/mediaagent.MediaAgent/Exists", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for MediaAgent service + +type MediaAgentServer interface { + Scan(context.Context, *ScanReq) (*ScanRsp, error) + Exists(context.Context, *ExistsReq) (*ExistsRsp, error) +} + +func RegisterMediaAgentServer(s *grpc.Server, srv MediaAgentServer) { + s.RegisterService(&_MediaAgent_serviceDesc, srv) +} + +func _MediaAgent_Scan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ScanReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MediaAgentServer).Scan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mediaagent.MediaAgent/Scan", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MediaAgentServer).Scan(ctx, req.(*ScanReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _MediaAgent_Exists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExistsReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MediaAgentServer).Exists(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mediaagent.MediaAgent/Exists", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MediaAgentServer).Exists(ctx, req.(*ExistsReq)) + } + return interceptor(ctx, in, info, handler) +} + +var _MediaAgent_serviceDesc = grpc.ServiceDesc{ + ServiceName: "mediaagent.MediaAgent", + HandlerType: (*MediaAgentServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Scan", + Handler: _MediaAgent_Scan_Handler, + }, + { + MethodName: "Exists", + Handler: _MediaAgent_Exists_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: fileDescriptor0, +} + +func init() { proto.RegisterFile("agent.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 256 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x31, 0x4f, 0xc3, 0x30, + 0x10, 0x85, 0x49, 0x9a, 0xb6, 0xe4, 0x2a, 0x21, 0x74, 0x80, 0x64, 0x45, 0x0c, 0x91, 0x07, 0xc8, + 0x94, 0x21, 0x1d, 0x60, 0x65, 0x40, 0x82, 0x81, 0xc5, 0xfc, 0x02, 0xd3, 0x5c, 0x91, 0x45, 0x1c, + 0x87, 0xfa, 0x06, 0xc4, 0xaf, 0x47, 0x4e, 0xd2, 0x36, 0x12, 0x0c, 0x6c, 0xbe, 0xf7, 0xee, 0xf3, + 0xbb, 0xb3, 0x61, 0xa5, 0xdf, 0xa9, 0xe5, 0xb2, 0xdb, 0x39, 0x76, 0x08, 0x96, 0x6a, 0xa3, 0x7b, + 0x45, 0xde, 0xc1, 0xf2, 0x75, 0xa3, 0x5b, 0x45, 0x9f, 0x28, 0x60, 0xb9, 0x75, 0x4d, 0x4d, 0x3b, + 0x2f, 0xa2, 0x7c, 0x56, 0xa4, 0x6a, 0x5f, 0x22, 0x42, 0x62, 0xb5, 0xff, 0x10, 0x71, 0x1e, 0x15, + 0xa9, 0xea, 0xcf, 0xf2, 0x76, 0x04, 0x7d, 0x87, 0xd7, 0x90, 0x6e, 0x4d, 0x43, 0xad, 0xb6, 0xb4, + 0x47, 0x8f, 0x82, 0x7c, 0x82, 0xe4, 0x99, 0xc9, 0xe2, 0x19, 0xc4, 0xa6, 0x16, 0x51, 0x1e, 0x15, + 0x89, 0x8a, 0x4d, 0x8d, 0x19, 0x9c, 0x36, 0x6e, 0xa3, 0xd9, 0xb8, 0x76, 0xbc, 0xf8, 0x50, 0xe3, + 0x25, 0xcc, 0xd9, 0x70, 0x43, 0x62, 0xd6, 0x1b, 0x43, 0x21, 0xd7, 0x90, 0x3e, 0x7e, 0x19, 0xcf, + 0x3e, 0x4c, 0x7b, 0x03, 0x73, 0xc3, 0x64, 0x87, 0xc0, 0x55, 0x75, 0x5e, 0x1e, 0x97, 0x2a, 0x43, + 0x9e, 0x1a, 0xec, 0x09, 0xe4, 0xbb, 0xff, 0x42, 0xd5, 0x37, 0xc0, 0x4b, 0x70, 0x1e, 0x82, 0x83, + 0x15, 0x24, 0x61, 0x55, 0xbc, 0x98, 0xb6, 0x8f, 0xaf, 0x96, 0xfd, 0x16, 0x7d, 0x27, 0x4f, 0xf0, + 0x1e, 0x16, 0x43, 0x2c, 0x5e, 0x4d, 0x1b, 0x0e, 0xf3, 0x67, 0x7f, 0xc9, 0x81, 0x7c, 0x5b, 0xf4, + 0x9f, 0xb4, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x03, 0xf0, 0xcc, 0x00, 0xb3, 0x01, 0x00, 0x00, +} diff --git a/server/proto/agent.proto b/server/mediaagent/agent.proto similarity index 70% rename from server/proto/agent.proto rename to server/mediaagent/agent.proto index f954519..85d759a 100644 --- a/server/proto/agent.proto +++ b/server/mediaagent/agent.proto @@ -1,5 +1,12 @@ syntax = "proto3"; +package mediaagent; + +service MediaAgent { + rpc Scan(ScanReq) returns (ScanRsp) {} + rpc Exists(ExistsReq) returns (ExistsRsp) {} +} + message ScanReq { repeated string folders = 1; string mask = 2; diff --git a/server/proto/agent.pb.go b/server/proto/agent.pb.go deleted file mode 100644 index 4fbf678..0000000 --- a/server/proto/agent.pb.go +++ /dev/null @@ -1,122 +0,0 @@ -// Code generated by protoc-gen-go. -// source: agent.proto -// DO NOT EDIT! - -/* -Package agent is a generated protocol buffer package. - -It is generated from these files: - agent.proto - -It has these top-level messages: - ScanReq - ScanRsp - Item - ExistsReq - ExistsRsp -*/ -package agent - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type ScanReq struct { - Folders []string `protobuf:"bytes,1,rep,name=folders" json:"folders,omitempty"` - Mask string `protobuf:"bytes,2,opt,name=mask" json:"mask,omitempty"` -} - -func (m *ScanReq) Reset() { *m = ScanReq{} } -func (m *ScanReq) String() string { return proto.CompactTextString(m) } -func (*ScanReq) ProtoMessage() {} -func (*ScanReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -type ScanRsp struct { - Filenames []string `protobuf:"bytes,1,rep,name=filenames" json:"filenames,omitempty"` -} - -func (m *ScanRsp) Reset() { *m = ScanRsp{} } -func (m *ScanRsp) String() string { return proto.CompactTextString(m) } -func (*ScanRsp) ProtoMessage() {} -func (*ScanRsp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -type Item struct { - Id uint64 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` - Location string `protobuf:"bytes,2,opt,name=location" json:"location,omitempty"` - Title string `protobuf:"bytes,3,opt,name=title" json:"title,omitempty"` -} - -func (m *Item) Reset() { *m = Item{} } -func (m *Item) String() string { return proto.CompactTextString(m) } -func (*Item) ProtoMessage() {} -func (*Item) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -type ExistsReq struct { - Items []*Item `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` -} - -func (m *ExistsReq) Reset() { *m = ExistsReq{} } -func (m *ExistsReq) String() string { return proto.CompactTextString(m) } -func (*ExistsReq) ProtoMessage() {} -func (*ExistsReq) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *ExistsReq) GetItems() []*Item { - if m != nil { - return m.Items - } - return nil -} - -type ExistsRsp struct { - Items []*Item `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` -} - -func (m *ExistsRsp) Reset() { *m = ExistsRsp{} } -func (m *ExistsRsp) String() string { return proto.CompactTextString(m) } -func (*ExistsRsp) ProtoMessage() {} -func (*ExistsRsp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *ExistsRsp) GetItems() []*Item { - if m != nil { - return m.Items - } - return nil -} - -func init() { - proto.RegisterType((*ScanReq)(nil), "ScanReq") - proto.RegisterType((*ScanRsp)(nil), "ScanRsp") - proto.RegisterType((*Item)(nil), "Item") - proto.RegisterType((*ExistsReq)(nil), "ExistsReq") - proto.RegisterType((*ExistsRsp)(nil), "ExistsRsp") -} - -func init() { proto.RegisterFile("agent.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 201 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x3b, 0x4e, 0xc6, 0x30, - 0x10, 0x84, 0xe5, 0xfc, 0x09, 0xc1, 0x1b, 0x89, 0xc2, 0xa2, 0xb0, 0x80, 0x22, 0x72, 0x83, 0xab, - 0x14, 0x50, 0x70, 0x02, 0x24, 0x68, 0xcd, 0x09, 0x4c, 0xb2, 0x41, 0x16, 0x7e, 0x84, 0x78, 0x0b, - 0x8e, 0x8f, 0xf2, 0x02, 0xaa, 0xbf, 0xf3, 0x37, 0x9e, 0xd9, 0x59, 0x2d, 0x34, 0xf6, 0x03, 0x23, - 0x75, 0xd3, 0x9c, 0x28, 0xa9, 0x27, 0xa8, 0xdf, 0x7a, 0x1b, 0x0d, 0x7e, 0x09, 0x09, 0xf5, 0x98, - 0xfc, 0x80, 0x73, 0x96, 0xac, 0x3d, 0x69, 0x6e, 0x0e, 0x14, 0x02, 0xca, 0x60, 0xf3, 0xa7, 0x2c, - 0x5a, 0xa6, 0xb9, 0x59, 0xdf, 0xea, 0x7e, 0x0f, 0xe6, 0x49, 0xdc, 0x01, 0x1f, 0x9d, 0xc7, 0x68, - 0x03, 0x1e, 0xd1, 0x3f, 0x41, 0xbd, 0x40, 0xf9, 0x4a, 0x18, 0xc4, 0x15, 0x14, 0x6e, 0x90, 0xac, - 0x65, 0xba, 0x34, 0x85, 0x1b, 0xc4, 0x0d, 0x5c, 0xfa, 0xd4, 0x5b, 0x72, 0x29, 0xee, 0x83, 0x7f, - 0x59, 0x5c, 0x43, 0x45, 0x8e, 0x3c, 0xca, 0xd3, 0xfa, 0xb1, 0x81, 0xd2, 0xc0, 0x9f, 0xbf, 0x5d, - 0xa6, 0xbc, 0x6c, 0x7b, 0x0b, 0x95, 0x23, 0x0c, 0x5b, 0x61, 0xf3, 0x50, 0x75, 0x4b, 0x89, 0xd9, - 0xb4, 0x7f, 0xce, 0x3c, 0x9d, 0x75, 0xbe, 0x5f, 0xac, 0x67, 0x78, 0xfc, 0x09, 0x00, 0x00, 0xff, - 0xff, 0xe4, 0xf0, 0x95, 0x4c, 0x15, 0x01, 0x00, 0x00, -} diff --git a/server/services/core.go b/server/services/core.go index c88cc9d..c5a9f83 100644 --- a/server/services/core.go +++ b/server/services/core.go @@ -13,12 +13,12 @@ import ( "github.com/jbrodriguez/actor" "github.com/jbrodriguez/mlog" "github.com/jbrodriguez/pubsub" - "github.com/micro/go-micro/client" + "google.golang.org/grpc" "mediagui/dto" "mediagui/lib" + pb "mediagui/mediaagent" "mediagui/model" - "mediagui/proto" ) const cNotAvailable = "n/a" @@ -227,10 +227,10 @@ func (c *Core) pruneMovies(_ *pubsub.Message) { list := reply.(*model.MoviesDTO) if c.settings.UnraidMode { - hostItems := make(map[string][]*agent.Item) + hostItems := make(map[string][]*pb.Item) for _, host := range c.settings.UnraidHosts { - hostItems[host] = make([]*agent.Item, 0) + hostItems[host] = make([]*pb.Item, 0) } for _, item := range list.Items { @@ -246,21 +246,26 @@ func (c *Core) pruneMovies(_ *pubsub.Message) { host := item.Location[:index] location := item.Location[index+1:] - hostItems[host] = append(hostItems[host], &agent.Item{Id: item.ID, Location: location, Title: item.Title}) + hostItems[host] = append(hostItems[host], &pb.Item{Id: item.ID, Location: location, Title: item.Title}) } + opts := []grpc.DialOption{grpc.WithInsecure()} + for _, host := range c.settings.UnraidHosts { - req := client.NewRequest("io.jbrodriguez.mediagui.agent."+host, "Agent.Exists", &agent.ExistsReq{ - Items: hostItems[host], - }) + address := fmt.Sprintf("%s.apertoire.org:7624", host) + + conn, err := grpc.Dial(address, opts...) + if err != nil { + mlog.Warning("Unable to connect to host (%s): %s", address, err) + continue + } + defer conn.Close() - rsp := &agent.ExistsRsp{} + client := pb.NewMediaAgentClient(conn) - if err := client.Call(context.Background(), req, rsp); err != nil { - mlog.Warning("Unable to connect to service (%s): %s", "io.jbrodriguez.mediagui.agent."+host, err) - // lib.Notify(s.bus, "import:progress", "Unable to connect to host "+host) - // lib.Notify(s.bus, "import:end", "Import process finished") - // return + rsp, err := client.Exists(context.Background(), &pb.ExistsReq{Items: hostItems[host]}) + if err != nil { + mlog.Warning("Unable to check exist (%s): %s", address, err) continue } diff --git a/server/services/dal.go b/server/services/dal.go index d097c97..9125113 100644 --- a/server/services/dal.go +++ b/server/services/dal.go @@ -15,8 +15,9 @@ import ( _ "github.com/mattn/go-sqlite3" // sqlite3 doesn't need to be named "mediagui/lib" + pb "mediagui/mediaagent" "mediagui/model" - "mediagui/proto" + // "mediagui/proto" ) // const DATETIME_LAYOUT = "2006-01-02T15:04:05-07:00" @@ -636,7 +637,7 @@ func (d *Dal) updateMovie(msg *pubsub.Message) { } func (d *Dal) deleteMovie(msg *pubsub.Message) { - movie := msg.Payload.(*agent.Item) + movie := msg.Payload.(*pb.Item) // d.count = 0 diff --git a/server/services/scanner.go b/server/services/scanner.go index b94907b..7fbf80e 100644 --- a/server/services/scanner.go +++ b/server/services/scanner.go @@ -2,20 +2,20 @@ package services import ( "context" + "fmt" "os" "path/filepath" "regexp" "strings" - "time" "github.com/jbrodriguez/actor" "github.com/jbrodriguez/mlog" "github.com/jbrodriguez/pubsub" - "github.com/micro/go-micro/client" + "google.golang.org/grpc" "mediagui/lib" + pb "mediagui/mediaagent" "mediagui/model" - "mediagui/proto" ) // Scanner - @@ -118,26 +118,25 @@ func (s *Scanner) scanMovies(_ *pubsub.Message) { // "wopr:/mnt/user/films/blurip/10 Things I Hate About You (1999)/movie.mkv", // } - // mlog.Info("started analysis") - // s.analyze(filenames) - // mlog.Info("finished analysis") + opts := []grpc.DialOption{grpc.WithInsecure()} for _, host := range s.settings.UnraidHosts { - // Create new request to service go.micro.srv.example, method Example.Call - req := client.NewRequest("io.jbrodriguez.mediagui.agent."+host, "Agent.Scan", &agent.ScanReq{ - // Folders: s.settings.MediaFolders, - Folders: s.settings.MediaFolders, - Mask: s.includedMask, - }) - - rsp := &agent.ScanRsp{} - - // Call service - if err := client.Call(context.Background(), req, rsp, client.WithRequestTimeout(time.Duration(5)*time.Minute)); err != nil { - mlog.Warning("Unable to connect to service (%s): %s", "io.jbrodriguez.mediagui.agent."+host, err) + address := fmt.Sprintf("%s.apertoire.org:7624", host) + + conn, err := grpc.Dial(address, opts...) + if err != nil { + mlog.Warning("Unable to connect to host (%s): %s", address, err) lib.Notify(s.bus, "import:progress", "Unable to connect to host "+host) - // lib.Notify(s.bus, "import:end", "Import process finished") - // return + continue + } + defer conn.Close() + + client := pb.NewMediaAgentClient(conn) + + rsp, err := client.Scan(context.Background(), &pb.ScanReq{Folders: s.settings.MediaFolders, Mask: s.includedMask}) + if err != nil { + mlog.Warning("Unable to scan (%s): %s", address, err) + lib.Notify(s.bus, "import:progress", "Unable to scan host "+host) continue } From 34f5c4ff8b8b05ad7243d672c0fe66b6418f2142 Mon Sep 17 00:00:00 2001 From: "Juan B. Rodriguez" Date: Wed, 19 Dec 2018 08:08:06 -0500 Subject: [PATCH 2/2] Cleanup go mod Ref #52 --- server/go.mod | 23 ++++++----------------- server/go.sum | 52 ++++++++++++++++----------------------------------- 2 files changed, 22 insertions(+), 53 deletions(-) diff --git a/server/go.mod b/server/go.mod index 1df58bb..4338104 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,41 +1,30 @@ module mediagui require ( + github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect - github.com/go-log/log v0.1.0 // indirect github.com/golang/protobuf v1.2.0 - github.com/hashicorp/consul v1.3.0 // indirect - github.com/hashicorp/go-cleanhttp v0.5.0 // indirect - github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 // indirect - github.com/hashicorp/serf v0.8.1 // indirect github.com/jbrodriguez/actor v0.0.0-20170412170624-fa646545c8f3 github.com/jbrodriguez/go-tmdb v0.0.0-20151103115148-c1c9b4a6a2a8 github.com/jbrodriguez/mlog v0.0.0-20180805173533-cbd5ae8e9c53 github.com/jbrodriguez/pubsub v0.0.0-20170412143127-17eb44fbbab7 github.com/jmcvetta/napping v3.2.0+incompatible // indirect + github.com/jmcvetta/randutil v0.0.0-20150817122601-2bb1b664bcff // indirect + github.com/kr/pretty v0.1.0 // indirect github.com/labstack/echo v3.2.1+incompatible github.com/labstack/gommon v0.2.7 // indirect github.com/mattn/go-colorable v0.0.9 // indirect github.com/mattn/go-isatty v0.0.4 // indirect github.com/mattn/go-sqlite3 v1.9.0 - github.com/micro/cli v0.0.0-20180830071301-8b9d33ec2f19 // indirect - github.com/micro/go-log v0.0.0-20170512141327-cbfa9447f9b6 // indirect - github.com/micro/go-micro v0.12.0 - github.com/micro/go-rcache v0.0.0-20180418165751-a581a57b5133 // indirect - github.com/micro/mdns v0.0.0-20160929165650-cdf30746f9f7 // indirect - github.com/micro/util v0.0.0-20180417104657-4b7ed83e8520 // indirect - github.com/miekg/dns v1.0.13 // indirect - github.com/mitchellh/go-homedir v1.0.0 // indirect - github.com/mitchellh/hashstructure v1.0.0 // indirect - github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/namsral/flag v1.7.4-pre github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 - github.com/pborman/uuid v1.2.0 // indirect - github.com/pkg/errors v0.8.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/testify v1.2.2 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4 // indirect golang.org/x/crypto v0.0.0-20181009213950-7c1a557ab941 // indirect golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1 golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba // indirect google.golang.org/grpc v1.17.0 + gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect ) diff --git a/server/go.sum b/server/go.sum index 5d48c40..074d133 100644 --- a/server/go.sum +++ b/server/go.sum @@ -1,24 +1,14 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/go-log/log v0.1.0 h1:wudGTNsiGzrD5ZjgIkVZ517ugi2XRe9Q/xRCzwEO4/U= -github.com/go-log/log v0.1.0/go.mod h1:4mBwpdRMFLiuXZDCwU2lKQFsoSCo72j3HqBK9d81N2M= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/consul v1.3.0 h1:0ihJs1J8ejURfAbwhwv+USnf4oyqfAddv/3xXXv4ltg= -github.com/hashicorp/consul v1.3.0/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI= -github.com/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig= -github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90 h1:9HVkPxOpo+yO93Ah4yrO67d/qh0fbLLWbKqhYjyHq9A= -github.com/hashicorp/go-rootcerts v0.0.0-20160503143440-6bb64b370b90/go.mod h1:o4zcYY1e0GEZI6eSEr+43QDYmuGglw1qSO6qdHUHCgg= -github.com/hashicorp/serf v0.8.1 h1:mYs6SMzu72+90OcPa5wr3nfznA4Dw9UyR791ZFNOIf4= -github.com/hashicorp/serf v0.8.1/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE= github.com/jbrodriguez/actor v0.0.0-20170412170624-fa646545c8f3 h1:Y1SWefldwWHchVF3eryTUfhvr5NFcuSrKJGMiz6bWP0= github.com/jbrodriguez/actor v0.0.0-20170412170624-fa646545c8f3/go.mod h1:Xx6OnHYvZS48XWp1Si8B8iMEArba77JvwVc0m8jQ5gE= github.com/jbrodriguez/go-tmdb v0.0.0-20151103115148-c1c9b4a6a2a8 h1:VXXvmfc7aG6+/SdXheY3r8822Bp95TvIYcaZfNcqF44= @@ -29,7 +19,14 @@ github.com/jbrodriguez/pubsub v0.0.0-20170412143127-17eb44fbbab7 h1:cmVsZIyMyb6b github.com/jbrodriguez/pubsub v0.0.0-20170412143127-17eb44fbbab7/go.mod h1:ML8/lItWxF5tBxYDd+I6lEyLTOJzU92VR+7L/P/H18c= github.com/jmcvetta/napping v3.2.0+incompatible h1:shS22lJu18MtyRV7IqWenMmrRXCjADcUcxONAnp5zxY= github.com/jmcvetta/napping v3.2.0+incompatible/go.mod h1:dlR6SvwNgFr2ASHFGDIO2fhkZM2rU/9B6NB6xUciyv4= +github.com/jmcvetta/randutil v0.0.0-20150817122601-2bb1b664bcff h1:6NvhExg4omUC9NfA+l4Oq3ibNNeJUdiAF3iBVB0PlDk= +github.com/jmcvetta/randutil v0.0.0-20150817122601-2bb1b664bcff/go.mod h1:ddfPX8Z28YMjiqoaJhNBzWHapTHXejnB5cDCUWDwriw= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/labstack/echo v3.2.1+incompatible h1:J2M7YArHx4gi8p/3fDw8tX19SXhBCoRpviyAZSN3I88= github.com/labstack/echo v3.2.1+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= github.com/labstack/gommon v0.2.7 h1:2qOPq/twXDrQ6ooBGrn3mrmVOC+biLlatwgIu8lbzRM= @@ -40,34 +37,14 @@ github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-sqlite3 v1.9.0 h1:pDRiWfl+++eC2FEFRy6jXmQlvp4Yh3z1MJKg4UeYM/4= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/micro/cli v0.0.0-20180830071301-8b9d33ec2f19 h1:yYBEdLtvpHSezqBvUkGHJynuhgAek5Uew5P3RG7teQw= -github.com/micro/cli v0.0.0-20180830071301-8b9d33ec2f19/go.mod h1:x9x6qy+tXv17jzYWQup462+j3SIUgDa6vVTzU4IXy/w= -github.com/micro/go-log v0.0.0-20170512141327-cbfa9447f9b6 h1:Nz+rX1q6rJLAQcLBB6maXYUmSvcdzJR2OArDKCDkco4= -github.com/micro/go-log v0.0.0-20170512141327-cbfa9447f9b6/go.mod h1:QikSuviYcIE8V0CY4e0RRqVs3Oh8EuzX+qCEOnh9Qh8= -github.com/micro/go-micro v0.12.0 h1:+o71C0D7dUtPd7+XOfnIRd21sXD7tXJ+RfgD1Dd38K4= -github.com/micro/go-micro v0.12.0/go.mod h1:3z3lfMkNU9Sr1L/CxL++8pVJmQapRo0N6kNjwYDtOVs= -github.com/micro/go-rcache v0.0.0-20180418165751-a581a57b5133 h1:hA0jzfRMat31ugTTK3BQfxGSuh7zD4Or/lEo/4edJiE= -github.com/micro/go-rcache v0.0.0-20180418165751-a581a57b5133/go.mod h1:CBzgfnsCYHcyLg1qeTShF0iDErQmcLmSt+SdwjLkckI= -github.com/micro/mdns v0.0.0-20160929165650-cdf30746f9f7 h1:DbCL1cj4e6CW1R+e+BMr39LG7Fg3g1kIla09CPKwgu0= -github.com/micro/mdns v0.0.0-20160929165650-cdf30746f9f7/go.mod h1:SQG6o/94RinohLuB5noHSevg2Iqg2wXLDUn4lj2LWWo= -github.com/micro/util v0.0.0-20180417104657-4b7ed83e8520 h1:UgysDrM51CTeMHo/KOasDrWvrE0K15xjnR/qLeuPRFg= -github.com/micro/util v0.0.0-20180417104657-4b7ed83e8520/go.mod h1:vxd7TGn28ynEMF4szG3PHTzgo3bx3FpfON9xpFsGc+g= -github.com/miekg/dns v1.0.13 h1:Y72t3Ody/fSEkLQOC49kG0ALF7b8ax2TouzPFgIT40E= -github.com/miekg/dns v1.0.13/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/hashstructure v1.0.0 h1:ZkRJX1CyOoTkar7p/mLS5TZU4nJ1Rn/F8u9dGS02Q3Y= -github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/namsral/flag v1.7.4-pre h1:b2ScHhoCUkbsq0d2C15Mv+VU8bl8hAXV8arnWiOHNZs= github.com/namsral/flag v1.7.4-pre/go.mod h1:OXldTctbM6SWH1K899kPZcf65KxJiD7MsceFUpB5yDo= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= -github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4 h1:gKMu1Bf6QINDnvyZuTaACm9ofY+PRh+5vFz4oxBZeF8= @@ -79,6 +56,7 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1 h1:Y/KGZSOdz/2r0WJ9Mkmz6NJBusp0kiNx1Cn82lzJQ6w= golang.org/x/net v0.0.0-20181011144130-49bb7cea24b1/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181011152604-fa43e7bc11ba h1:nZJIJPGow0Kf9bU9QTc1U6OXbs/7Hu4e+cNv+hxH+Zc= @@ -91,4 +69,6 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=