-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (34 loc) · 971 Bytes
/
main.go
File metadata and controls
41 lines (34 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"context"
"log"
"net"
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
"github.com/sharding-db/milvus-mini/pkg"
"github.com/sharding-db/milvus-mini/pkg/allocator"
"github.com/sharding-db/milvus-mini/pkg/metas"
"google.golang.org/grpc"
)
func main() {
// create listiner
lis, err := net.Listen("tcp", ":19530")
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
// create grpc server
s := grpc.NewServer()
ctx := context.Background()
log.Println("init meta table")
rootPath := "./tmp/milvus-mini"
metatable, err := metas.NewLocalDiskWithMemoryCacheMeta(ctx, rootPath)
if err != nil {
log.Fatalf("failed to create meta table: %v", err)
}
miniMilvus := pkg.NewMilvusMini(new(allocator.LocalTsAllocator), metatable)
milvuspb.RegisterMilvusServiceServer(s, miniMilvus)
log.Println("start server on 19530")
// and start...
if err := s.Serve(lis); err != nil {
log.Fatalf("failed to serve: %v", err)
}
}