Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Kosuke Morimoto <ksk@vdaas.org>
  • Loading branch information
kmrmt committed Aug 20, 2024
1 parent e4526c3 commit 50d6a8c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/agent/core/ngt/handler/grpc/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,23 @@ func (s *server) IndexStatisticsDetail(
},
}, nil
}

func (s *server) IndexProperty(
ctx context.Context, _ *payload.Empty,
) (res *payload.Info_Index_PropertyDetail, err error) {
_, span := trace.StartSpan(ctx, apiName+".IndexStatisticsDetail")
defer func() {
if span != nil {
span.End()

Check warning on line 250 in pkg/agent/core/ngt/handler/grpc/index.go

View check run for this annotation

Codecov / codecov/patch

pkg/agent/core/ngt/handler/grpc/index.go#L250

Added line #L250 was not covered by tests
}
}()
prop, err := s.ngt.IndexProperty()
if err != nil {
return nil, err

Check warning on line 255 in pkg/agent/core/ngt/handler/grpc/index.go

View check run for this annotation

Codecov / codecov/patch

pkg/agent/core/ngt/handler/grpc/index.go#L255

Added line #L255 was not covered by tests
}
return &payload.Info_Index_PropertyDetail{
Details: map[string]*payload.Info_Index_Property{
s.name: prop,
},
}, nil
}
44 changes: 44 additions & 0 deletions pkg/agent/core/ngt/service/ngt.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ type NGT interface {
BrokenIndexCount() uint64
IndexStatistics() (*payload.Info_Index_Statistics, error)
IsStatisticsEnabled() bool
IndexProperty() (*payload.Info_Index_Property, error)
Close(ctx context.Context) error
}

Expand Down Expand Up @@ -2044,6 +2045,49 @@ func (n *ngt) IsStatisticsEnabled() bool {
return n.enableStatistics
}

func (n *ngt) IndexProperty() (*payload.Info_Index_Property, error) {
p, err := n.core.GetProperty()
if err != nil {
return nil, err

Check warning on line 2051 in pkg/agent/core/ngt/service/ngt.go

View check run for this annotation

Codecov / codecov/patch

pkg/agent/core/ngt/service/ngt.go#L2048-L2051

Added lines #L2048 - L2051 were not covered by tests
}
return &payload.Info_Index_Property{
Dimension: p.Dimension,
ThreadPoolSize: p.ThreadPoolSize,
ObjectType: p.ObjectType.String(),
DistanceType: p.DistanceType.String(),
IndexType: p.IndexType.String(),
DatabaseType: p.DatabaseType.String(),
ObjectAlignment: p.ObjectAlignment.String(),
PathAdjustmentInterval: p.PathAdjustmentInterval,
GraphSharedMemorySize: p.GraphSharedMemorySize,
TreeSharedMemorySize: p.TreeSharedMemorySize,
ObjectSharedMemorySize: p.ObjectSharedMemorySize,
PrefetchOffset: p.PrefetchOffset,
PrefetchSize: p.PrefetchSize,
AccuracyTable: p.AccuracyTable,
SearchType: p.SearchType,
MaxMagnitude: p.MaxMagnitude,
NOfNeighborsForInsertionOrder: p.NOfNeighborsForInsertionOrder,
EpsilonForInsertionOrder: p.EpsilonForInsertionOrder,
RefinementObjectType: p.RefinementObjectType.String(),
TruncationThreshold: p.TruncationThreshold,
EdgeSizeForCreation: p.EdgeSizeForCreation,
EdgeSizeForSearch: p.EdgeSizeForSearch,
EdgeSizeLimitForCreation: p.EdgeSizeLimitForCreation,
InsertionRadiusCoefficient: p.InsertionRadiusCoefficient,
SeedSize: p.SeedSize,
SeedType: p.SeedType.String(),
TruncationThreadPoolSize: p.TruncationThreadPoolSize,
BatchSizeForCreation: p.BatchSizeForCreation,
GraphType: p.GraphType.String(),
DynamicEdgeSizeBase: p.DynamicEdgeSizeBase,
DynamicEdgeSizeRate: p.DynamicEdgeSizeRate,
BuildTimeLimit: p.BuildTimeLimit,
OutgoingEdge: p.OutgoingEdge,
IncomingEdge: p.IncomingEdge,
}, nil

Check warning on line 2088 in pkg/agent/core/ngt/service/ngt.go

View check run for this annotation

Codecov / codecov/patch

pkg/agent/core/ngt/service/ngt.go#L2053-L2088

Added lines #L2053 - L2088 were not covered by tests
}

func (n *ngt) toSearchResponse(
sr []algorithm.SearchResult,
) (res *payload.Search_Response, err error) {
Expand Down

0 comments on commit 50d6a8c

Please sign in to comment.