From 11881db1146627f1012b033b5549ef6027757e98 Mon Sep 17 00:00:00 2001 From: Minoru Osuka Date: Tue, 6 Aug 2019 09:29:40 +0900 Subject: [PATCH] Change index protobuf (#97) --- cmd/blast/indexer_start.go | 10 +- cmd/blast/manager_start.go | 10 +- config/index_config.go | 66 ------------ config/index_config_test.go | 36 ------- dispatcher/server_test.go | 56 ++++++---- indexer/grpc_client.go | 13 +-- indexer/grpc_service.go | 27 +++-- indexer/index.go | 26 +++-- indexer/raft_fsm.go | 23 ++-- indexer/raft_server.go | 34 +++--- indexer/server.go | 47 +++++--- indexer/server_test.go | 174 +++++++++++++++++++----------- manager/grpc_server.go | 16 +++ manager/http_server.go | 16 +++ manager/raft_server.go | 69 ++++++++---- manager/server.go | 64 +++++++---- manager/server_test.go | 169 +++++++++++++++++++---------- protobuf/index/index.pb.go | 208 +++++++++++++++++++++++------------- protobuf/index/index.proto | 8 +- 19 files changed, 641 insertions(+), 431 deletions(-) delete mode 100644 config/index_config.go delete mode 100644 config/index_config_test.go diff --git a/cmd/blast/indexer_start.go b/cmd/blast/indexer_start.go index 0afd811..b20e689 100644 --- a/cmd/blast/indexer_start.go +++ b/cmd/blast/indexer_start.go @@ -20,7 +20,6 @@ import ( "syscall" "github.com/blevesearch/bleve/mapping" - "github.com/mosuka/blast/config" "github.com/mosuka/blast/indexer" "github.com/mosuka/blast/indexutils" "github.com/mosuka/blast/logutils" @@ -117,14 +116,7 @@ func indexerStart(c *cli.Context) error { indexMapping = mapping.NewIndexMapping() } - // create index config - indexConfig := &config.IndexConfig{ - IndexMapping: indexMapping, - IndexType: indexType, - IndexStorageType: indexStorageType, - } - - svr, err := indexer.NewServer(managerGRPCAddr, shardId, peerGRPCAddr, node, dataDir, raftStorageType, indexConfig, logger.Named(nodeId), grpcLogger.Named(nodeId), httpAccessLogger) + svr, err := indexer.NewServer(managerGRPCAddr, shardId, peerGRPCAddr, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger.Named(nodeId), grpcLogger.Named(nodeId), httpAccessLogger) if err != nil { return err } diff --git a/cmd/blast/manager_start.go b/cmd/blast/manager_start.go index ee2c93c..81385ab 100644 --- a/cmd/blast/manager_start.go +++ b/cmd/blast/manager_start.go @@ -20,7 +20,6 @@ import ( "syscall" "github.com/blevesearch/bleve/mapping" - "github.com/mosuka/blast/config" "github.com/mosuka/blast/indexutils" "github.com/mosuka/blast/logutils" "github.com/mosuka/blast/manager" @@ -115,14 +114,7 @@ func managerStart(c *cli.Context) error { indexMapping = mapping.NewIndexMapping() } - // create index config - indexConfig := &config.IndexConfig{ - IndexMapping: indexMapping, - IndexType: indexType, - IndexStorageType: indexStorageType, - } - - svr, err := manager.NewServer(peerGrpcAddr, node, dataDir, raftStorageType, indexConfig, logger.Named(nodeId), grpcLogger.Named(nodeId), httpLogger) + svr, err := manager.NewServer(peerGrpcAddr, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger.Named(nodeId), grpcLogger.Named(nodeId), httpLogger) if err != nil { return err } diff --git a/config/index_config.go b/config/index_config.go deleted file mode 100644 index 89fd4e2..0000000 --- a/config/index_config.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2019 Minoru Osuka -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package config - -import ( - "encoding/json" - - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/mapping" -) - -type IndexConfig struct { - IndexMapping *mapping.IndexMappingImpl `json:"index_mapping,omitempty"` - IndexType string `json:"index_type,omitempty"` - IndexStorageType string `json:"index_storage_type,omitempty"` -} - -func DefaultIndexConfig() *IndexConfig { - return &IndexConfig{ - IndexMapping: mapping.NewIndexMapping(), - IndexType: bleve.Config.DefaultIndexType, - IndexStorageType: bleve.Config.DefaultKVStore, - } -} - -func NewIndexConfigFromMap(src map[string]interface{}) *IndexConfig { - b, err := json.Marshal(src) - if err != nil { - return &IndexConfig{} - } - - var indexConfig *IndexConfig - err = json.Unmarshal(b, &indexConfig) - if err != nil { - return &IndexConfig{} - } - - return indexConfig -} - -func (c *IndexConfig) ToMap() map[string]interface{} { - b, err := json.Marshal(c) - if err != nil { - return map[string]interface{}{} - } - - var m map[string]interface{} - err = json.Unmarshal(b, &m) - if err != nil { - return map[string]interface{}{} - } - - return m -} diff --git a/config/index_config_test.go b/config/index_config_test.go deleted file mode 100644 index 674766c..0000000 --- a/config/index_config_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2019 Minoru Osuka -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package config - -import ( - "reflect" - "testing" - - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/mapping" -) - -func TestDefaultIndexConfig(t *testing.T) { - expConfig := &IndexConfig{ - IndexMapping: mapping.NewIndexMapping(), - IndexType: bleve.Config.DefaultIndexType, - IndexStorageType: bleve.Config.DefaultKVStore, - } - actConfig := DefaultIndexConfig() - - if !reflect.DeepEqual(expConfig, actConfig) { - t.Fatalf("expected content to see %v, saw %v", expConfig, actConfig) - } -} diff --git a/dispatcher/server_test.go b/dispatcher/server_test.go index 63922e1..5500ed2 100644 --- a/dispatcher/server_test.go +++ b/dispatcher/server_test.go @@ -22,6 +22,8 @@ import ( "testing" "time" + "github.com/mosuka/blast/indexutils" + "github.com/mosuka/blast/indexer" "github.com/mosuka/blast/logutils" "github.com/mosuka/blast/manager" @@ -56,13 +58,15 @@ func TestServer_Start(t *testing.T) { }, } - managerIndexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + managerIndexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + managerIndexType1 := "upside_down" + managerIndexStorageType1 := "boltdb" // create server - managerServer1, err := manager.NewServer(managerPeerGrpcAddress1, managerNode1, managerDataDir1, managerRaftStorageType1, managerIndexConfig1, logger, grpcLogger, httpAccessLogger) + managerServer1, err := manager.NewServer(managerPeerGrpcAddress1, managerNode1, managerDataDir1, managerRaftStorageType1, managerIndexMapping1, managerIndexType1, managerIndexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { if managerServer1 != nil { managerServer1.Stop() @@ -93,13 +97,15 @@ func TestServer_Start(t *testing.T) { }, } - managerIndexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + managerIndexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + managerIndexType2 := "upside_down" + managerIndexStorageType2 := "boltdb" // create server - managerServer2, err := manager.NewServer(managerPeerGrpcAddress2, managerNode2, managerDataDir2, managerRaftStorageType2, managerIndexConfig2, logger, grpcLogger, httpAccessLogger) + managerServer2, err := manager.NewServer(managerPeerGrpcAddress2, managerNode2, managerDataDir2, managerRaftStorageType2, managerIndexMapping2, managerIndexType2, managerIndexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { if managerServer2 != nil { managerServer2.Stop() @@ -130,13 +136,15 @@ func TestServer_Start(t *testing.T) { }, } - managerIndexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + managerIndexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + managerIndexType3 := "upside_down" + managerIndexStorageType3 := "boltdb" // create server - managerServer3, err := manager.NewServer(managerPeerGrpcAddress3, managerNode3, managerDataDir3, managerRaftStorageType3, managerIndexConfig3, logger, grpcLogger, httpAccessLogger) + managerServer3, err := manager.NewServer(managerPeerGrpcAddress3, managerNode3, managerDataDir3, managerRaftStorageType3, managerIndexMapping3, managerIndexType3, managerIndexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { if managerServer3 != nil { managerServer3.Stop() @@ -226,11 +234,13 @@ func TestServer_Start(t *testing.T) { HttpAddress: indexerHttpAddress1, }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexerIndexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } - indexerServer1, err := indexer.NewServer(indexerManagerGrpcAddress1, indexerShardId1, indexerPeerGrpcAddress1, indexerNode1, indexerDataDir1, indexerRaftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + indexerIndexType1 := "upside_down" + indexerIndexStorageType1 := "boltdb" + indexerServer1, err := indexer.NewServer(indexerManagerGrpcAddress1, indexerShardId1, indexerPeerGrpcAddress1, indexerNode1, indexerDataDir1, indexerRaftStorageType1, indexerIndexMapping1, indexerIndexType1, indexerIndexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { indexerServer1.Stop() }() @@ -264,11 +274,13 @@ func TestServer_Start(t *testing.T) { HttpAddress: indexerHttpAddress2, }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexerIndexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } - indexerServer2, err := indexer.NewServer(indexerManagerGrpcAddress2, indexerShardId2, indexerPeerGrpcAddress2, indexerNode2, indexerDataDir2, indexerRaftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + indexerIndexType2 := "upside_down" + indexerIndexStorageType2 := "boltdb" + indexerServer2, err := indexer.NewServer(indexerManagerGrpcAddress2, indexerShardId2, indexerPeerGrpcAddress2, indexerNode2, indexerDataDir2, indexerRaftStorageType2, indexerIndexMapping2, indexerIndexType2, indexerIndexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { indexerServer2.Stop() }() @@ -302,11 +314,13 @@ func TestServer_Start(t *testing.T) { HttpAddress: indexerHttpAddress3, }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexerIndexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } - indexerServer3, err := indexer.NewServer(indexerManagerGrpcAddress3, indexerShardId3, indexerPeerGrpcAddress3, indexerNode3, indexerDataDir3, indexerRaftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + indexerIndexType3 := "upside_down" + indexerIndexStorageType3 := "boltdb" + indexerServer3, err := indexer.NewServer(indexerManagerGrpcAddress3, indexerShardId3, indexerPeerGrpcAddress3, indexerNode3, indexerDataDir3, indexerRaftStorageType3, indexerIndexMapping3, indexerIndexType3, indexerIndexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { indexerServer3.Stop() }() @@ -392,11 +406,13 @@ func TestServer_Start(t *testing.T) { HttpAddress: indexerHttpAddress4, }, } - indexConfig4, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexerIndexMapping4, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } - indexerServer4, err := indexer.NewServer(indexerManagerGrpcAddress4, indexerShardId4, indexerPeerGrpcAddress4, indexerNode4, indexerDataDir4, indexerRaftStorageType4, indexConfig4, logger, grpcLogger, httpAccessLogger) + indexerIndexType4 := "upside_down" + indexerIndexStorageType4 := "boltdb" + indexerServer4, err := indexer.NewServer(indexerManagerGrpcAddress4, indexerShardId4, indexerPeerGrpcAddress4, indexerNode4, indexerDataDir4, indexerRaftStorageType4, indexerIndexMapping4, indexerIndexType4, indexerIndexStorageType4, logger, grpcLogger, httpAccessLogger) defer func() { indexerServer4.Stop() }() @@ -430,11 +446,13 @@ func TestServer_Start(t *testing.T) { HttpAddress: indexerHttpAddress5, }, } - indexConfig5, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexerIndexMapping5, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } - indexerServer5, err := indexer.NewServer(indexerManagerGrpcAddress5, indexerShardId5, indexerPeerGrpcAddress5, indexerNode5, indexerDataDir5, indexerRaftStorageType5, indexConfig5, logger, grpcLogger, httpAccessLogger) + indexerIndexType5 := "upside_down" + indexerIndexStorageType5 := "boltdb" + indexerServer5, err := indexer.NewServer(indexerManagerGrpcAddress5, indexerShardId5, indexerPeerGrpcAddress5, indexerNode5, indexerDataDir5, indexerRaftStorageType5, indexerIndexMapping5, indexerIndexType5, indexerIndexStorageType5, logger, grpcLogger, httpAccessLogger) defer func() { indexerServer5.Stop() }() @@ -468,11 +486,13 @@ func TestServer_Start(t *testing.T) { HttpAddress: indexerHttpAddress6, }, } - indexConfig6, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexerIndexMapping6, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } - indexerServer6, err := indexer.NewServer(indexerManagerGrpcAddress6, indexerShardId6, indexerPeerGrpcAddress6, indexerNode6, indexerDataDir6, indexerRaftStorageType6, indexConfig6, logger, grpcLogger, httpAccessLogger) + indexerIndexType6 := "upside_down" + indexerIndexStorageType6 := "boltdb" + indexerServer6, err := indexer.NewServer(indexerManagerGrpcAddress6, indexerShardId6, indexerPeerGrpcAddress6, indexerNode6, indexerDataDir6, indexerRaftStorageType6, indexerIndexMapping6, indexerIndexType6, indexerIndexStorageType6, logger, grpcLogger, httpAccessLogger) defer func() { indexerServer6.Stop() }() diff --git a/indexer/grpc_client.go b/indexer/grpc_client.go index e955e3b..4759e19 100644 --- a/indexer/grpc_client.go +++ b/indexer/grpc_client.go @@ -306,17 +306,20 @@ func (c *GRPCClient) GetIndexConfig(opts ...grpc.CallOption) (map[string]interfa resp, err := c.client.GetIndexConfig(c.ctx, &empty.Empty{}, opts...) if err != nil { st, _ := status.FromError(err) - return nil, errors.New(st.Message()) } - indexConfigIntr, err := protobuf.MarshalAny(resp.IndexConfig) + indexMapping, err := protobuf.MarshalAny(resp.IndexConfig.IndexMapping) if err != nil { st, _ := status.FromError(err) - return nil, errors.New(st.Message()) } - indexConfig := *indexConfigIntr.(*map[string]interface{}) + + indexConfig := map[string]interface{}{ + "index_mapping": indexMapping, + "index_type": resp.IndexConfig.IndexType, + "index_storage_type": resp.IndexConfig.IndexStorageType, + } return indexConfig, nil } @@ -325,14 +328,12 @@ func (c *GRPCClient) GetIndexStats(opts ...grpc.CallOption) (map[string]interfac resp, err := c.client.GetIndexStats(c.ctx, &empty.Empty{}, opts...) if err != nil { st, _ := status.FromError(err) - return nil, errors.New(st.Message()) } indexStatsIntr, err := protobuf.MarshalAny(resp.IndexStats) if err != nil { st, _ := status.FromError(err) - return nil, errors.New(st.Message()) } indexStats := *indexStatsIntr.(*map[string]interface{}) diff --git a/indexer/grpc_service.go b/indexer/grpc_service.go index 87b9ba3..2613c56 100644 --- a/indexer/grpc_service.go +++ b/indexer/grpc_service.go @@ -23,6 +23,8 @@ import ( "sync" "time" + "github.com/blevesearch/bleve/mapping" + "github.com/blevesearch/bleve" "github.com/golang/protobuf/ptypes/any" "github.com/golang/protobuf/ptypes/empty" @@ -922,7 +924,9 @@ func (s *GRPCService) DeleteDocument(stream index.Index_DeleteDocumentServer) er } func (s *GRPCService) GetIndexConfig(ctx context.Context, req *empty.Empty) (*index.GetIndexConfigResponse, error) { - resp := &index.GetIndexConfigResponse{} + resp := &index.GetIndexConfigResponse{ + IndexConfig: &index.IndexConfig{}, + } indexConfig, err := s.raftServer.GetIndexConfig() if err != nil { @@ -930,14 +934,23 @@ func (s *GRPCService) GetIndexConfig(ctx context.Context, req *empty.Empty) (*in return resp, status.Error(codes.Internal, err.Error()) } - indexConfigAny := &any.Any{} - err = protobuf.UnmarshalAny(indexConfig, indexConfigAny) - if err != nil { - s.logger.Error(err.Error()) - return resp, status.Error(codes.Internal, err.Error()) + if indexMapping, ok := indexConfig["index_mapping"]; ok { + indexMappingAny := &any.Any{} + err = protobuf.UnmarshalAny(indexMapping.(*mapping.IndexMappingImpl), indexMappingAny) + if err != nil { + s.logger.Error(err.Error()) + return resp, status.Error(codes.Internal, err.Error()) + } + resp.IndexConfig.IndexMapping = indexMappingAny } - resp.IndexConfig = indexConfigAny + if indexType, ok := indexConfig["index_type"]; ok { + resp.IndexConfig.IndexType = indexType.(string) + } + + if indexStorageType, ok := indexConfig["index_storage_type"]; ok { + resp.IndexConfig.IndexStorageType = indexStorageType.(string) + } return resp, nil } diff --git a/indexer/index.go b/indexer/index.go index 986c09b..accc520 100644 --- a/indexer/index.go +++ b/indexer/index.go @@ -21,8 +21,8 @@ import ( "github.com/blevesearch/bleve" "github.com/blevesearch/bleve/document" + "github.com/blevesearch/bleve/mapping" "github.com/golang/protobuf/ptypes/any" - "github.com/mosuka/blast/config" "github.com/mosuka/blast/errors" "github.com/mosuka/blast/protobuf" "github.com/mosuka/blast/protobuf/index" @@ -30,20 +30,22 @@ import ( ) type Index struct { - indexConfig *config.IndexConfig - logger *zap.Logger + indexMapping *mapping.IndexMappingImpl + indexType string + indexStorageType string + logger *zap.Logger index bleve.Index } -func NewIndex(dir string, indexConfig *config.IndexConfig, logger *zap.Logger) (*Index, error) { +func NewIndex(dir string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, logger *zap.Logger) (*Index, error) { //bleve.SetLog(logger) var index bleve.Index _, err := os.Stat(dir) if os.IsNotExist(err) { // create new index - index, err = bleve.NewUsing(dir, indexConfig.IndexMapping, indexConfig.IndexType, indexConfig.IndexStorageType, nil) + index, err = bleve.NewUsing(dir, indexMapping, indexType, indexStorageType, nil) if err != nil { logger.Error(err.Error()) return nil, err @@ -61,9 +63,11 @@ func NewIndex(dir string, indexConfig *config.IndexConfig, logger *zap.Logger) ( } return &Index{ - index: index, - indexConfig: indexConfig, - logger: logger, + index: index, + indexMapping: indexMapping, + indexType: indexType, + indexStorageType: indexStorageType, + logger: logger, }, nil } @@ -210,7 +214,11 @@ func (i *Index) BulkDelete(ids []string) (int, error) { } func (i *Index) Config() (map[string]interface{}, error) { - return i.indexConfig.ToMap(), nil + return map[string]interface{}{ + "index_mapping": i.indexMapping, + "index_type": i.indexType, + "index_storage_type": i.indexStorageType, + }, nil } func (i *Index) Stats() (map[string]interface{}, error) { diff --git a/indexer/raft_fsm.go b/indexer/raft_fsm.go index 01d047e..a12c541 100644 --- a/indexer/raft_fsm.go +++ b/indexer/raft_fsm.go @@ -21,10 +21,11 @@ import ( "io/ioutil" "sync" + "github.com/blevesearch/bleve/mapping" + "github.com/blevesearch/bleve" "github.com/golang/protobuf/proto" "github.com/hashicorp/raft" - "github.com/mosuka/blast/config" blasterrors "github.com/mosuka/blast/errors" "github.com/mosuka/blast/protobuf" "github.com/mosuka/blast/protobuf/index" @@ -32,9 +33,11 @@ import ( ) type RaftFSM struct { - path string - indexConfig *config.IndexConfig - logger *zap.Logger + path string + indexMapping *mapping.IndexMappingImpl + indexType string + indexStorageType string + logger *zap.Logger cluster *index.Cluster clusterMutex sync.RWMutex @@ -42,11 +45,13 @@ type RaftFSM struct { index *Index } -func NewRaftFSM(path string, indexConfig *config.IndexConfig, logger *zap.Logger) (*RaftFSM, error) { +func NewRaftFSM(path string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, logger *zap.Logger) (*RaftFSM, error) { return &RaftFSM{ - path: path, - indexConfig: indexConfig, - logger: logger, + path: path, + indexMapping: indexMapping, + indexType: indexType, + indexStorageType: indexStorageType, + logger: logger, }, nil } @@ -56,7 +61,7 @@ func (f *RaftFSM) Start() error { f.logger.Info("initialize index") var err error - f.index, err = NewIndex(f.path, f.indexConfig, f.logger) + f.index, err = NewIndex(f.path, f.indexMapping, f.indexType, f.indexStorageType, f.logger) if err != nil { f.logger.Error(err.Error()) return err diff --git a/indexer/raft_server.go b/indexer/raft_server.go index 60a9004..c3ccf73 100644 --- a/indexer/raft_server.go +++ b/indexer/raft_server.go @@ -24,11 +24,11 @@ import ( "time" "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/mapping" "github.com/hashicorp/raft" raftboltdb "github.com/hashicorp/raft-boltdb" raftbadgerdb "github.com/markthethomas/raft-badger" _ "github.com/mosuka/blast/builtins" - "github.com/mosuka/blast/config" blasterrors "github.com/mosuka/blast/errors" "github.com/mosuka/blast/indexutils" "github.com/mosuka/blast/protobuf/index" @@ -37,25 +37,29 @@ import ( ) type RaftServer struct { - node *index.Node - dataDir string - raftStorageType string - indexConfig *config.IndexConfig - bootstrap bool - logger *zap.Logger + node *index.Node + dataDir string + raftStorageType string + indexMapping *mapping.IndexMappingImpl + indexType string + indexStorageType string + bootstrap bool + logger *zap.Logger raft *raft.Raft fsm *RaftFSM } -func NewRaftServer(node *index.Node, dataDir string, raftStorageType string, indexConfig *config.IndexConfig, bootstrap bool, logger *zap.Logger) (*RaftServer, error) { +func NewRaftServer(node *index.Node, dataDir string, raftStorageType string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, bootstrap bool, logger *zap.Logger) (*RaftServer, error) { return &RaftServer{ - node: node, - dataDir: dataDir, - raftStorageType: raftStorageType, - indexConfig: indexConfig, - bootstrap: bootstrap, - logger: logger, + node: node, + dataDir: dataDir, + raftStorageType: raftStorageType, + indexMapping: indexMapping, + indexType: indexType, + indexStorageType: indexStorageType, + bootstrap: bootstrap, + logger: logger, }, nil } @@ -64,7 +68,7 @@ func (s *RaftServer) Start() error { fsmPath := filepath.Join(s.dataDir, "index") s.logger.Info("create finite state machine", zap.String("path", fsmPath)) - s.fsm, err = NewRaftFSM(fsmPath, s.indexConfig, s.logger) + s.fsm, err = NewRaftFSM(fsmPath, s.indexMapping, s.indexType, s.indexStorageType, s.logger) if err != nil { s.logger.Fatal(err.Error()) return err diff --git a/indexer/server.go b/indexer/server.go index 1ffa188..d6b8bc2 100644 --- a/indexer/server.go +++ b/indexer/server.go @@ -18,8 +18,11 @@ import ( "encoding/json" "fmt" + "github.com/mosuka/blast/indexutils" + + "github.com/blevesearch/bleve/mapping" + accesslog "github.com/mash/go-accesslog" - "github.com/mosuka/blast/config" "github.com/mosuka/blast/errors" "github.com/mosuka/blast/manager" "github.com/mosuka/blast/protobuf/index" @@ -33,7 +36,9 @@ type Server struct { node *index.Node dataDir string raftStorageType string - indexConfig *config.IndexConfig + indexMapping *mapping.IndexMappingImpl + indexType string + indexStorageType string logger *zap.Logger grpcLogger *zap.Logger httpLogger accesslog.Logger @@ -45,7 +50,7 @@ type Server struct { httpServer *HTTPServer } -func NewServer(managerGrpcAddress string, shardId string, peerGrpcAddress string, node *index.Node, dataDir string, raftStorageType string, indexConfig *config.IndexConfig, logger *zap.Logger, grpcLogger *zap.Logger, httpLogger accesslog.Logger) (*Server, error) { +func NewServer(managerGrpcAddress string, shardId string, peerGrpcAddress string, node *index.Node, dataDir string, raftStorageType string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, logger *zap.Logger, grpcLogger *zap.Logger, httpLogger accesslog.Logger) (*Server, error) { return &Server{ managerGrpcAddress: managerGrpcAddress, shardId: shardId, @@ -53,7 +58,9 @@ func NewServer(managerGrpcAddress string, shardId string, peerGrpcAddress string node: node, dataDir: dataDir, raftStorageType: raftStorageType, - indexConfig: indexConfig, + indexMapping: indexMapping, + indexType: indexType, + indexStorageType: indexStorageType, logger: logger, grpcLogger: grpcLogger, httpLogger: httpLogger, @@ -126,16 +133,32 @@ func (s *Server) Start() { s.logger.Fatal(err.Error()) return } - s.logger.Debug("pull index config from manager", zap.String("address", mc.GetAddress())) value, err := mc.Get("/index_config") if err != nil { s.logger.Fatal(err.Error()) return } - - if value != nil { - s.indexConfig = config.NewIndexConfigFromMap(*value.(*map[string]interface{})) + indexMappingSrc, ok := (*value.(*map[string]interface{}))["index_mapping"] + if ok { + b, err := json.Marshal(indexMappingSrc) + if err != nil { + s.logger.Fatal(err.Error()) + return + } + s.indexMapping, err = indexutils.NewIndexMappingFromBytes(b) + if err != nil { + s.logger.Fatal(err.Error()) + return + } + } + indexTypeSrc, ok := (*value.(*map[string]interface{}))["index_type"] + if ok { + s.indexType = indexTypeSrc.(string) + } + indexStorageTypeSrc, ok := (*value.(*map[string]interface{}))["index_storage_type"] + if ok { + s.indexStorageType = indexStorageTypeSrc.(string) } } else if s.peerGrpcAddress != "" { pc, err := NewGRPCClient(s.peerGrpcAddress) @@ -159,9 +182,9 @@ func (s *Server) Start() { return } - if value != nil { - s.indexConfig = config.NewIndexConfigFromMap(value) - } + s.indexMapping = value["index_mapping"].(*mapping.IndexMappingImpl) + s.indexType = value["index_type"].(string) + s.indexStorageType = value["index_storage_type"].(string) } // bootstrap node? @@ -171,7 +194,7 @@ func (s *Server) Start() { var err error // create raft server - s.raftServer, err = NewRaftServer(s.node, s.dataDir, s.raftStorageType, s.indexConfig, bootstrap, s.logger) + s.raftServer, err = NewRaftServer(s.node, s.dataDir, s.raftStorageType, s.indexMapping, s.indexType, s.indexStorageType, bootstrap, s.logger) if err != nil { s.logger.Fatal(err.Error()) return diff --git a/indexer/server_test.go b/indexer/server_test.go index b527382..0cd7957 100644 --- a/indexer/server_test.go +++ b/indexer/server_test.go @@ -24,13 +24,13 @@ import ( "testing" "time" - "github.com/mosuka/blast/strutils" - "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/mapping" "github.com/mosuka/blast/errors" "github.com/mosuka/blast/indexutils" "github.com/mosuka/blast/logutils" "github.com/mosuka/blast/protobuf/index" + "github.com/mosuka/blast/strutils" "github.com/mosuka/blast/testutils" ) @@ -64,12 +64,14 @@ func TestServer_Start(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -114,12 +116,14 @@ func TestServer_LivenessProbe(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -211,12 +215,14 @@ func TestServer_GetNode(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -294,12 +300,14 @@ func TestServer_GetCluster(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -381,12 +389,14 @@ func TestServer_GetIndexMapping(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -414,23 +424,29 @@ func TestServer_GetIndexMapping(t *testing.T) { t.Fatalf("%v", err) } - expIndexMapping := indexConfig.IndexMapping + expIndexMapping := indexMapping + + actIndexConfigMap, err := client.GetIndexConfig() if err != nil { t.Fatalf("%v", err) } - actIndexConfigMap, err := client.GetIndexConfig() + actIndexMapping := actIndexConfigMap["index_mapping"].(*mapping.IndexMappingImpl) if err != nil { t.Fatalf("%v", err) } - actIndexMapping, err := indexutils.NewIndexMappingFromMap(actIndexConfigMap["index_mapping"].(map[string]interface{})) + exp, err := json.Marshal(expIndexMapping) + if err != nil { + t.Fatalf("%v", err) + } + act, err := json.Marshal(actIndexMapping) if err != nil { t.Fatalf("%v", err) } - if !reflect.DeepEqual(expIndexMapping, actIndexMapping) { - t.Fatalf("expected content to see %v, saw %v", expIndexMapping, actIndexMapping) + if !reflect.DeepEqual(exp, act) { + t.Fatalf("expected content to see %v, saw %v", exp, act) } } @@ -464,12 +480,14 @@ func TestServer_GetIndexType(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -497,10 +515,7 @@ func TestServer_GetIndexType(t *testing.T) { t.Fatalf("%v", err) } - expIndexType := indexConfig.IndexType - if err != nil { - t.Fatalf("%v", err) - } + expIndexType := indexType actIndexConfigMap, err := client.GetIndexConfig() if err != nil { @@ -544,12 +559,14 @@ func TestServer_GetIndexStorageType(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -577,10 +594,7 @@ func TestServer_GetIndexStorageType(t *testing.T) { t.Fatalf("%v", err) } - expIndexStorageType := indexConfig.IndexStorageType - if err != nil { - t.Fatalf("%v", err) - } + expIndexStorageType := indexStorageType actIndexConfigMap, err := client.GetIndexConfig() if err != nil { @@ -624,12 +638,14 @@ func TestServer_GetIndexStats(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -713,12 +729,14 @@ func TestServer_PutDocument(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -814,12 +832,14 @@ func TestServer_GetDocument(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -930,12 +950,14 @@ func TestServer_DeleteDocument(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -1075,12 +1097,14 @@ func TestServer_Search(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" - server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(managerGrpcAddress, shardId, peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { server.Stop() }() @@ -1208,12 +1232,14 @@ func TestCluster_Start(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" - server1, err := NewServer(managerGrpcAddress1, shardId1, peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(managerGrpcAddress1, shardId1, peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { server1.Stop() }() @@ -1247,12 +1273,14 @@ func TestCluster_Start(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" - server2, err := NewServer(managerGrpcAddress2, shardId2, peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(managerGrpcAddress2, shardId2, peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { server2.Stop() }() @@ -1286,12 +1314,14 @@ func TestCluster_Start(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" - server3, err := NewServer(managerGrpcAddress3, shardId3, peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(managerGrpcAddress3, shardId3, peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { server3.Stop() }() @@ -1336,12 +1366,14 @@ func TestCluster_LivenessProbe(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" - server1, err := NewServer(managerGrpcAddress1, shardId1, peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(managerGrpcAddress1, shardId1, peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { server1.Stop() }() @@ -1375,12 +1407,14 @@ func TestCluster_LivenessProbe(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" - server2, err := NewServer(managerGrpcAddress2, shardId2, peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(managerGrpcAddress2, shardId2, peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { server2.Stop() }() @@ -1414,12 +1448,14 @@ func TestCluster_LivenessProbe(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" - server3, err := NewServer(managerGrpcAddress3, shardId3, peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(managerGrpcAddress3, shardId3, peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { server3.Stop() }() @@ -1586,12 +1622,14 @@ func TestCluster_GetNode(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" - server1, err := NewServer(managerGrpcAddress1, shardId1, peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(managerGrpcAddress1, shardId1, peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { server1.Stop() }() @@ -1625,12 +1663,14 @@ func TestCluster_GetNode(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" - server2, err := NewServer(managerGrpcAddress2, shardId2, peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(managerGrpcAddress2, shardId2, peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { server2.Stop() }() @@ -1664,12 +1704,14 @@ func TestCluster_GetNode(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" - server3, err := NewServer(managerGrpcAddress3, shardId3, peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(managerGrpcAddress3, shardId3, peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { server3.Stop() }() @@ -1792,12 +1834,14 @@ func TestCluster_GetCluster(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" - server1, err := NewServer(managerGrpcAddress1, shardId1, peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(managerGrpcAddress1, shardId1, peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { server1.Stop() }() @@ -1831,12 +1875,14 @@ func TestCluster_GetCluster(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" - server2, err := NewServer(managerGrpcAddress2, shardId2, peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(managerGrpcAddress2, shardId2, peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { server2.Stop() }() @@ -1870,12 +1916,14 @@ func TestCluster_GetCluster(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" - server3, err := NewServer(managerGrpcAddress3, shardId3, peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(managerGrpcAddress3, shardId3, peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { server3.Stop() }() diff --git a/manager/grpc_server.go b/manager/grpc_server.go index e49645b..453e240 100644 --- a/manager/grpc_server.go +++ b/manager/grpc_server.go @@ -15,6 +15,7 @@ package manager import ( + "fmt" "net" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" @@ -92,3 +93,18 @@ func (s *GRPCServer) Stop() error { return nil } + +func (s *GRPCServer) GetAddress() (string, error) { + tcpAddr, err := net.ResolveTCPAddr("tcp", s.listener.Addr().String()) + if err != nil { + return "", err + } + + v4Addr := "" + if tcpAddr.IP.To4() != nil { + v4Addr = tcpAddr.IP.To4().String() + } + port := tcpAddr.Port + + return fmt.Sprintf("%s:%d", v4Addr, port), nil +} diff --git a/manager/http_server.go b/manager/http_server.go index 33bd0fc..f64b7c6 100644 --- a/manager/http_server.go +++ b/manager/http_server.go @@ -15,6 +15,7 @@ package manager import ( + "fmt" "net" "net/http" @@ -67,3 +68,18 @@ func (s *HTTPServer) Stop() error { return nil } + +func (s *HTTPServer) GetAddress() (string, error) { + tcpAddr, err := net.ResolveTCPAddr("tcp", s.listener.Addr().String()) + if err != nil { + return "", err + } + + v4Addr := "" + if tcpAddr.IP.To4() != nil { + v4Addr = tcpAddr.IP.To4().String() + } + port := tcpAddr.Port + + return fmt.Sprintf("%s:%d", v4Addr, port), nil +} diff --git a/manager/raft_server.go b/manager/raft_server.go index 5a75f47..46bc079 100644 --- a/manager/raft_server.go +++ b/manager/raft_server.go @@ -24,11 +24,11 @@ import ( "sync" "time" + "github.com/blevesearch/bleve/mapping" "github.com/hashicorp/raft" raftboltdb "github.com/hashicorp/raft-boltdb" raftbadgerdb "github.com/markthethomas/raft-badger" _ "github.com/mosuka/blast/builtins" - "github.com/mosuka/blast/config" blasterrors "github.com/mosuka/blast/errors" "github.com/mosuka/blast/protobuf/management" "go.uber.org/zap" @@ -36,26 +36,31 @@ import ( ) type RaftServer struct { - node *management.Node - dataDir string - raftStorageType string - indexConfig *config.IndexConfig - bootstrap bool - logger *zap.Logger - - raft *raft.Raft - fsm *RaftFSM - mu sync.RWMutex + node *management.Node + dataDir string + raftStorageType string + indexMapping *mapping.IndexMappingImpl + indexType string + indexStorageType string + bootstrap bool + logger *zap.Logger + + transport *raft.NetworkTransport + raft *raft.Raft + fsm *RaftFSM + mu sync.RWMutex } -func NewRaftServer(node *management.Node, dataDir string, raftStorageType string, indexConfig *config.IndexConfig, bootstrap bool, logger *zap.Logger) (*RaftServer, error) { +func NewRaftServer(node *management.Node, dataDir string, raftStorageType string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, bootstrap bool, logger *zap.Logger) (*RaftServer, error) { return &RaftServer{ - node: node, - dataDir: dataDir, - raftStorageType: raftStorageType, - indexConfig: indexConfig, - bootstrap: bootstrap, - logger: logger, + node: node, + dataDir: dataDir, + raftStorageType: raftStorageType, + indexMapping: indexMapping, + indexType: indexType, + indexStorageType: indexStorageType, + bootstrap: bootstrap, + logger: logger, }, nil } @@ -94,7 +99,7 @@ func (s *RaftServer) Start() error { } s.logger.Info("create TCP transport", zap.String("bind_addr", s.node.BindAddress)) - transport, err := raft.NewTCPTransport(s.node.BindAddress, addr, 3, 10*time.Second, ioutil.Discard) + s.transport, err = raft.NewTCPTransport(s.node.BindAddress, addr, 3, 10*time.Second, ioutil.Discard) if err != nil { s.logger.Fatal(err.Error()) return err @@ -182,7 +187,7 @@ func (s *RaftServer) Start() error { } s.logger.Info("create Raft machine") - s.raft, err = raft.NewRaft(raftConfig, s.fsm, logStore, stableStore, snapshotStore, transport) + s.raft, err = raft.NewRaft(raftConfig, s.fsm, logStore, stableStore, snapshotStore, s.transport) if err != nil { s.logger.Fatal(err.Error()) return err @@ -194,7 +199,7 @@ func (s *RaftServer) Start() error { Servers: []raft.Server{ { ID: raftConfig.LocalID, - Address: transport.LocalAddr(), + Address: s.transport.LocalAddr(), }, }, } @@ -217,11 +222,27 @@ func (s *RaftServer) Start() error { // set index config s.logger.Info("register index config") - err := s.SetValue("index_config", s.indexConfig.ToMap()) + b, err := json.Marshal(s.indexMapping) if err != nil { s.logger.Error(err.Error()) return err } + var indexMappingMap map[string]interface{} + err = json.Unmarshal(b, &indexMappingMap) + if err != nil { + s.logger.Error(err.Error()) + return err + } + indexConfig := map[string]interface{}{ + "index_mapping": indexMappingMap, + "index_type": s.indexType, + "index_storage_type": s.indexStorageType, + } + err = s.SetValue("index_config", indexConfig) + if err != nil { + s.logger.Error(err.Error(), zap.String("key", "index_config")) + return err + } } return nil @@ -292,6 +313,10 @@ func (s *RaftServer) LeaderID(timeout time.Duration) (raft.ServerID, error) { return "", blasterrors.ErrNotFoundLeader } +func (s *RaftServer) NodeAddress() string { + return string(s.transport.LocalAddr()) +} + func (s *RaftServer) NodeID() string { return s.node.Id } diff --git a/manager/server.go b/manager/server.go index df4bba7..809d3c4 100644 --- a/manager/server.go +++ b/manager/server.go @@ -15,21 +15,23 @@ package manager import ( + "github.com/blevesearch/bleve/mapping" accesslog "github.com/mash/go-accesslog" - "github.com/mosuka/blast/config" "github.com/mosuka/blast/protobuf/management" "go.uber.org/zap" ) type Server struct { - peerGrpcAddr string - node *management.Node - dataDir string - raftStorageType string - indexConfig *config.IndexConfig - logger *zap.Logger - grpcLogger *zap.Logger - httpLogger accesslog.Logger + peerGrpcAddr string + node *management.Node + dataDir string + raftStorageType string + indexMapping *mapping.IndexMappingImpl + indexType string + indexStorageType string + logger *zap.Logger + grpcLogger *zap.Logger + httpLogger accesslog.Logger raftServer *RaftServer grpcService *GRPCService @@ -38,16 +40,18 @@ type Server struct { httpServer *HTTPServer } -func NewServer(peerGrpcAddr string, node *management.Node, dataDir string, raftStorageType string, indexConfig *config.IndexConfig, logger *zap.Logger, grpcLogger *zap.Logger, httpLogger accesslog.Logger) (*Server, error) { +func NewServer(peerGrpcAddr string, node *management.Node, dataDir string, raftStorageType string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, logger *zap.Logger, grpcLogger *zap.Logger, httpLogger accesslog.Logger) (*Server, error) { return &Server{ - peerGrpcAddr: peerGrpcAddr, - node: node, - dataDir: dataDir, - raftStorageType: raftStorageType, - indexConfig: indexConfig, - logger: logger, - grpcLogger: grpcLogger, - httpLogger: httpLogger, + peerGrpcAddr: peerGrpcAddr, + node: node, + dataDir: dataDir, + raftStorageType: raftStorageType, + indexMapping: indexMapping, + indexType: indexType, + indexStorageType: indexStorageType, + logger: logger, + grpcLogger: grpcLogger, + httpLogger: httpLogger, }, nil } @@ -59,7 +63,7 @@ func (s *Server) Start() { s.logger.Info("bootstrap", zap.Bool("bootstrap", bootstrap)) // create raft server - s.raftServer, err = NewRaftServer(s.node, s.dataDir, s.raftStorageType, s.indexConfig, bootstrap, s.logger) + s.raftServer, err = NewRaftServer(s.node, s.dataDir, s.raftStorageType, s.indexMapping, s.indexType, s.indexStorageType, bootstrap, s.logger) if err != nil { s.logger.Fatal(err.Error()) return @@ -179,3 +183,25 @@ func (s *Server) Stop() { s.logger.Error(err.Error()) } } + +func (s *Server) BindAddress() string { + return s.raftServer.NodeAddress() +} + +func (s *Server) GrpcAddress() string { + address, err := s.grpcServer.GetAddress() + if err != nil { + return "" + } + + return address +} + +func (s *Server) HttpAddress() string { + address, err := s.httpServer.GetAddress() + if err != nil { + return "" + } + + return address +} diff --git a/manager/server_test.go b/manager/server_test.go index b61bdae..855a0f1 100644 --- a/manager/server_test.go +++ b/manager/server_test.go @@ -23,6 +23,7 @@ import ( "time" blasterrors "github.com/mosuka/blast/errors" + "github.com/mosuka/blast/indexutils" "github.com/mosuka/blast/logutils" "github.com/mosuka/blast/protobuf/management" "github.com/mosuka/blast/strutils" @@ -57,13 +58,15 @@ func TestServer_Start(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" // create server - server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { if server != nil { server.Stop() @@ -108,13 +111,15 @@ func TestServer_HealthCheck(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" // create server - server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { if server != nil { server.Stop() @@ -206,13 +211,15 @@ func TestServer_GetNode(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" // create server - server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { if server != nil { server.Stop() @@ -290,13 +297,15 @@ func TestServer_GetCluster(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" // create server - server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { if server != nil { server.Stop() @@ -378,13 +387,15 @@ func TestServer_SetState(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" // create server - server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { if server != nil { server.Stop() @@ -463,13 +474,15 @@ func TestServer_GetState(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" // create server - server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { if server != nil { server.Stop() @@ -548,13 +561,15 @@ func TestServer_DeleteState(t *testing.T) { }, } - indexConfig, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType := "upside_down" + indexStorageType := "boltdb" // create server - server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexConfig, logger, grpcLogger, httpAccessLogger) + server, err := NewServer(peerGrpcAddress, node, dataDir, raftStorageType, indexMapping, indexType, indexStorageType, logger, grpcLogger, httpAccessLogger) defer func() { if server != nil { server.Stop() @@ -654,13 +669,15 @@ func TestCluster_Start(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" // create server - server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { if server1 != nil { server1.Stop() @@ -694,13 +711,15 @@ func TestCluster_Start(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" // create server - server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { if server2 != nil { server2.Stop() @@ -734,13 +753,15 @@ func TestCluster_Start(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" // create server - server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { if server3 != nil { server3.Stop() @@ -785,13 +806,15 @@ func TestCluster_HealthCheck(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" // create server - server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { if server1 != nil { server1.Stop() @@ -825,13 +848,15 @@ func TestCluster_HealthCheck(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" // create server - server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { if server2 != nil { server2.Stop() @@ -865,13 +890,15 @@ func TestCluster_HealthCheck(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" // create server - server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { if server3 != nil { server3.Stop() @@ -1038,13 +1065,15 @@ func TestCluster_GetNode(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" // create server - server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { if server1 != nil { server1.Stop() @@ -1078,13 +1107,15 @@ func TestCluster_GetNode(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" // create server - server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { if server2 != nil { server2.Stop() @@ -1118,13 +1149,15 @@ func TestCluster_GetNode(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" // create server - server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { if server3 != nil { server3.Stop() @@ -1247,13 +1280,15 @@ func TestCluster_GetCluster(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" // create server - server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { if server1 != nil { server1.Stop() @@ -1287,13 +1322,15 @@ func TestCluster_GetCluster(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" // create server - server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { if server2 != nil { server2.Stop() @@ -1327,13 +1364,15 @@ func TestCluster_GetCluster(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" // create server - server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { if server3 != nil { server3.Stop() @@ -1522,13 +1561,15 @@ func TestCluster_SetState(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" // create server - server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { if server1 != nil { server1.Stop() @@ -1562,13 +1603,15 @@ func TestCluster_SetState(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" // create server - server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { if server2 != nil { server2.Stop() @@ -1602,13 +1645,15 @@ func TestCluster_SetState(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" // create server - server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { if server3 != nil { server3.Stop() @@ -1781,13 +1826,15 @@ func TestCluster_GetState(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" // create server - server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { if server1 != nil { server1.Stop() @@ -1821,13 +1868,15 @@ func TestCluster_GetState(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" // create server - server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { if server2 != nil { server2.Stop() @@ -1861,13 +1910,15 @@ func TestCluster_GetState(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" // create server - server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { if server3 != nil { server3.Stop() @@ -2040,13 +2091,15 @@ func TestCluster_DeleteState(t *testing.T) { }, } - indexConfig1, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping1, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType1 := "upside_down" + indexStorageType1 := "boltdb" // create server - server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexConfig1, logger, grpcLogger, httpAccessLogger) + server1, err := NewServer(peerGrpcAddress1, node1, dataDir1, raftStorageType1, indexMapping1, indexType1, indexStorageType1, logger, grpcLogger, httpAccessLogger) defer func() { if server1 != nil { server1.Stop() @@ -2080,13 +2133,15 @@ func TestCluster_DeleteState(t *testing.T) { }, } - indexConfig2, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping2, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType2 := "upside_down" + indexStorageType2 := "boltdb" // create server - server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexConfig2, logger, grpcLogger, httpAccessLogger) + server2, err := NewServer(peerGrpcAddress2, node2, dataDir2, raftStorageType2, indexMapping2, indexType2, indexStorageType2, logger, grpcLogger, httpAccessLogger) defer func() { if server2 != nil { server2.Stop() @@ -2120,13 +2175,15 @@ func TestCluster_DeleteState(t *testing.T) { }, } - indexConfig3, err := testutils.TmpIndexConfig(filepath.Join(curDir, "../example/wiki_index_mapping.json"), "upside_down", "boltdb") + indexMapping3, err := indexutils.NewIndexMappingFromFile(filepath.Join(curDir, "../example/wiki_index_mapping.json")) if err != nil { t.Fatalf("%v", err) } + indexType3 := "upside_down" + indexStorageType3 := "boltdb" // create server - server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexConfig3, logger, grpcLogger, httpAccessLogger) + server3, err := NewServer(peerGrpcAddress3, node3, dataDir3, raftStorageType3, indexMapping3, indexType3, indexStorageType3, logger, grpcLogger, httpAccessLogger) defer func() { if server3 != nil { server3.Stop() diff --git a/protobuf/index/index.pb.go b/protobuf/index/index.pb.go index 8b42e8c..56cf8d5 100644 --- a/protobuf/index/index.pb.go +++ b/protobuf/index/index.pb.go @@ -912,18 +912,73 @@ func (m *SearchResponse) GetSearchResult() *any.Any { return nil } -type GetIndexConfigResponse struct { - IndexConfig *any.Any `protobuf:"bytes,1,opt,name=index_config,json=indexConfig,proto3" json:"index_config,omitempty"` +type IndexConfig struct { + IndexMapping *any.Any `protobuf:"bytes,1,opt,name=index_mapping,json=indexMapping,proto3" json:"index_mapping,omitempty"` + IndexType string `protobuf:"bytes,2,opt,name=index_type,json=indexType,proto3" json:"index_type,omitempty"` + IndexStorageType string `protobuf:"bytes,3,opt,name=index_storage_type,json=indexStorageType,proto3" json:"index_storage_type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } +func (m *IndexConfig) Reset() { *m = IndexConfig{} } +func (m *IndexConfig) String() string { return proto.CompactTextString(m) } +func (*IndexConfig) ProtoMessage() {} +func (*IndexConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_7b2daf652facb3ae, []int{18} +} + +func (m *IndexConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_IndexConfig.Unmarshal(m, b) +} +func (m *IndexConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_IndexConfig.Marshal(b, m, deterministic) +} +func (m *IndexConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_IndexConfig.Merge(m, src) +} +func (m *IndexConfig) XXX_Size() int { + return xxx_messageInfo_IndexConfig.Size(m) +} +func (m *IndexConfig) XXX_DiscardUnknown() { + xxx_messageInfo_IndexConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_IndexConfig proto.InternalMessageInfo + +func (m *IndexConfig) GetIndexMapping() *any.Any { + if m != nil { + return m.IndexMapping + } + return nil +} + +func (m *IndexConfig) GetIndexType() string { + if m != nil { + return m.IndexType + } + return "" +} + +func (m *IndexConfig) GetIndexStorageType() string { + if m != nil { + return m.IndexStorageType + } + return "" +} + +type GetIndexConfigResponse struct { + IndexConfig *IndexConfig `protobuf:"bytes,1,opt,name=index_config,json=indexConfig,proto3" json:"index_config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + func (m *GetIndexConfigResponse) Reset() { *m = GetIndexConfigResponse{} } func (m *GetIndexConfigResponse) String() string { return proto.CompactTextString(m) } func (*GetIndexConfigResponse) ProtoMessage() {} func (*GetIndexConfigResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7b2daf652facb3ae, []int{18} + return fileDescriptor_7b2daf652facb3ae, []int{19} } func (m *GetIndexConfigResponse) XXX_Unmarshal(b []byte) error { @@ -944,7 +999,7 @@ func (m *GetIndexConfigResponse) XXX_DiscardUnknown() { var xxx_messageInfo_GetIndexConfigResponse proto.InternalMessageInfo -func (m *GetIndexConfigResponse) GetIndexConfig() *any.Any { +func (m *GetIndexConfigResponse) GetIndexConfig() *IndexConfig { if m != nil { return m.IndexConfig } @@ -962,7 +1017,7 @@ func (m *GetIndexStatsResponse) Reset() { *m = GetIndexStatsResponse{} } func (m *GetIndexStatsResponse) String() string { return proto.CompactTextString(m) } func (*GetIndexStatsResponse) ProtoMessage() {} func (*GetIndexStatsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_7b2daf652facb3ae, []int{19} + return fileDescriptor_7b2daf652facb3ae, []int{20} } func (m *GetIndexStatsResponse) XXX_Unmarshal(b []byte) error { @@ -1003,7 +1058,7 @@ func (m *Document) Reset() { *m = Document{} } func (m *Document) String() string { return proto.CompactTextString(m) } func (*Document) ProtoMessage() {} func (*Document) Descriptor() ([]byte, []int) { - return fileDescriptor_7b2daf652facb3ae, []int{20} + return fileDescriptor_7b2daf652facb3ae, []int{21} } func (m *Document) XXX_Unmarshal(b []byte) error { @@ -1062,6 +1117,7 @@ func init() { proto.RegisterType((*DeleteDocumentResponse)(nil), "index.DeleteDocumentResponse") proto.RegisterType((*SearchRequest)(nil), "index.SearchRequest") proto.RegisterType((*SearchResponse)(nil), "index.SearchResponse") + proto.RegisterType((*IndexConfig)(nil), "index.IndexConfig") proto.RegisterType((*GetIndexConfigResponse)(nil), "index.GetIndexConfigResponse") proto.RegisterType((*GetIndexStatsResponse)(nil), "index.GetIndexStatsResponse") proto.RegisterType((*Document)(nil), "index.Document") @@ -1070,74 +1126,78 @@ func init() { func init() { proto.RegisterFile("protobuf/index/index.proto", fileDescriptor_7b2daf652facb3ae) } var fileDescriptor_7b2daf652facb3ae = []byte{ - // 1067 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x5d, 0x53, 0xdb, 0x46, - 0x14, 0xb5, 0x6c, 0x0b, 0x9c, 0x6b, 0x6c, 0xdc, 0x0d, 0x90, 0x44, 0x09, 0x6d, 0xd8, 0xa6, 0x8d, - 0x67, 0xda, 0xda, 0x1d, 0x32, 0x4c, 0x9a, 0xb4, 0x9d, 0x8e, 0x63, 0x29, 0xe0, 0xe0, 0x0a, 0x22, - 0x43, 0x98, 0xf4, 0x85, 0x91, 0xad, 0x05, 0x6b, 0x30, 0x92, 0x6b, 0xad, 0x99, 0xf2, 0xd8, 0xd7, - 0xfe, 0x92, 0xf6, 0xe7, 0xf4, 0xbd, 0x3f, 0xa6, 0xb3, 0x1f, 0x12, 0x92, 0xb0, 0x44, 0x67, 0xfa, - 0xc2, 0xb0, 0x77, 0xcf, 0x3d, 0x7b, 0xee, 0xdd, 0xbb, 0x47, 0x06, 0x6d, 0x3a, 0xf3, 0xa9, 0x3f, - 0x9c, 0x9f, 0xb5, 0x5d, 0xcf, 0x21, 0xbf, 0x89, 0xbf, 0x2d, 0x1e, 0x44, 0x2a, 0x5f, 0x68, 0x8f, - 0xce, 0x7d, 0xff, 0x7c, 0x42, 0xda, 0x11, 0xd2, 0xf6, 0xae, 0x05, 0x42, 0x7b, 0x9c, 0xde, 0x22, - 0x97, 0x53, 0x2a, 0x37, 0xf1, 0x1f, 0x0a, 0x6c, 0x98, 0xbe, 0x43, 0xf6, 0x88, 0x3d, 0xa1, 0xe3, - 0xee, 0x98, 0x8c, 0x2e, 0x2c, 0xf2, 0xeb, 0x9c, 0x04, 0x14, 0xbd, 0x02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, 0xc3, 0xba, 0x4e, 0x26, 0x84, 0x92, 0xbb, 0x4a, 0x6e, 0xc1, 0x46, 0x1a, 0x98, 0x4b, 0xdc, - 0x87, 0xda, 0x80, 0xd8, 0x33, 0x76, 0xd3, 0x82, 0xf0, 0x7b, 0xa8, 0x07, 0x3c, 0x70, 0x3a, 0x13, - 0x91, 0xdc, 0x26, 0xd5, 0x82, 0x78, 0x32, 0xde, 0x87, 0x7a, 0xc8, 0x26, 0x4f, 0x7d, 0x05, 0xb5, - 0x88, 0x2e, 0x98, 0x4f, 0xf2, 0xd9, 0x56, 0x42, 0x36, 0x86, 0xc4, 0xef, 0x61, 0x63, 0x97, 0x50, - 0xde, 0xa5, 0xae, 0xef, 0x9d, 0xb9, 0xe7, 0xb1, 0xc1, 0x5d, 0xe1, 0xe3, 0x74, 0x3a, 0xe2, 0xf1, - 0x5c, 0xce, 0xaa, 0x7b, 0x43, 0x80, 0x4d, 0x58, 0x0f, 0x29, 0x99, 0x6f, 0x05, 0x11, 0xe3, 0x0e, - 0x08, 0xdc, 0x29, 0x33, 0xc1, 0xfc, 0xb9, 0x00, 0x37, 0x4a, 0xc7, 0x7b, 0x50, 0x09, 0xfb, 0xfc, - 0xff, 0xe6, 0x61, 0xfb, 0xcf, 0x65, 0x50, 0xb9, 0x2e, 0x64, 0xc1, 0x6a, 0xea, 0x9b, 0x85, 0x36, - 0x73, 0xbf, 0xac, 0xda, 0xa7, 0xf9, 0x9f, 0x3a, 0x5c, 0x40, 0x3f, 0x42, 0x25, 0xb4, 0x35, 0xb4, - 0x71, 0x4b, 0x87, 0xc1, 0x3e, 0xf7, 0xda, 0x83, 0x18, 0x4b, 0xdc, 0x69, 0x70, 0x01, 0xbd, 0x81, - 0x6a, 0xcc, 0xe0, 0x50, 0xca, 0x8d, 0x63, 0xa6, 0xa7, 0x65, 0x90, 0xe3, 0x02, 0xd2, 0x61, 0x25, - 0xee, 0x76, 0x48, 0x4b, 0x92, 0xc4, 0x2d, 0x30, 0x87,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, 0xda, 0xd0, 0x9d, 0xd5, 0x67, 0xae, 0xbf, 0xb8, 0xb4, 0xea, 0x83, + 0xa9, 0xe5, 0xd3, 0x7a, 0xfc, 0x9f, 0x83, 0xc1, 0x1a, 0x5f, 0xbf, 0xf8, 0x27, 0x00, 0x00, 0xff, + 0xff, 0xbf, 0x2f, 0x50, 0x92, 0x35, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/protobuf/index/index.proto b/protobuf/index/index.proto index bf354b0..3edab24 100644 --- a/protobuf/index/index.proto +++ b/protobuf/index/index.proto @@ -144,8 +144,14 @@ message SearchResponse { google.protobuf.Any search_result = 1; } +message IndexConfig { + google.protobuf.Any index_mapping = 1; + string index_type = 2; + string index_storage_type = 3; +} + message GetIndexConfigResponse { - google.protobuf.Any index_config = 1; + IndexConfig index_config = 1; } message GetIndexStatsResponse {