Skip to content

Commit

Permalink
180.dockter.1 (#188)
Browse files Browse the repository at this point in the history
* #180 Prepare for versioned release

* #180 Fix Examples

* #180 Removed deprecated functions
  • Loading branch information
docktermj authored Sep 25, 2023
1 parent 75332c4 commit f1c68d5
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 893 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

-

## [0.5.0] - 2023-09-25

### Changed in 0.5.0

- Supports SenzingAPI 3.8.0
- Deprecated functions have been removed

## [0.4.15] - 2023-09-01

### Changed in 0.4.15
Expand Down
259 changes: 0 additions & 259 deletions g2diagnosticserver/g2diagnosticserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package g2diagnosticserver
import (
"context"
"fmt"
"strconv"
"sync"
"time"

Expand Down Expand Up @@ -92,22 +91,6 @@ func (server *G2DiagnosticServer) CheckDBPerf(ctx context.Context, request *g2pb
return &response, err
}

func (server *G2DiagnosticServer) CloseEntityListBySize(ctx context.Context, request *g2pb.CloseEntityListBySizeRequest) (*g2pb.CloseEntityListBySizeResponse, error) {
var err error = nil
if server.isTrace {
entryTime := time.Now()
server.traceEntry(5, request)
defer func() { server.traceExit(6, request, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
entityListBySizeHandleInt, err := strconv.ParseUint(request.GetEntityListBySizeHandle(), 10, 64)
if err == nil {
err = g2diagnostic.CloseEntityListBySize(ctx, uintptr(entityListBySizeHandleInt))
}
response := g2pb.CloseEntityListBySizeResponse{}
return &response, err
}

func (server *G2DiagnosticServer) Destroy(ctx context.Context, request *g2pb.DestroyRequest) (*g2pb.DestroyResponse, error) {
var err error = nil
if server.isTrace {
Expand All @@ -123,41 +106,6 @@ func (server *G2DiagnosticServer) Destroy(ctx context.Context, request *g2pb.Des
return &response, err
}

func (server *G2DiagnosticServer) FetchNextEntityBySize(ctx context.Context, request *g2pb.FetchNextEntityBySizeRequest) (*g2pb.FetchNextEntityBySizeResponse, error) {
var err error = nil
var result string = ""
if server.isTrace {
entryTime := time.Now()
server.traceEntry(9, request)
defer func() { server.traceExit(10, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
entityListBySizeHandleInt, err := strconv.ParseUint(request.GetEntityListBySizeHandle(), 10, 64)
if err == nil {
result, err = g2diagnostic.FetchNextEntityBySize(ctx, uintptr(entityListBySizeHandleInt))
}
response := g2pb.FetchNextEntityBySizeResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) FindEntitiesByFeatureIDs(ctx context.Context, request *g2pb.FindEntitiesByFeatureIDsRequest) (*g2pb.FindEntitiesByFeatureIDsResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(11, request)
defer func() { server.traceExit(12, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.FindEntitiesByFeatureIDs(ctx, request.GetFeatures())
response := g2pb.FindEntitiesByFeatureIDsResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetAvailableMemory(ctx context.Context, request *g2pb.GetAvailableMemoryRequest) (*g2pb.GetAvailableMemoryResponse, error) {
var err error = nil
var result int64
Expand All @@ -174,22 +122,6 @@ func (server *G2DiagnosticServer) GetAvailableMemory(ctx context.Context, reques
return &response, err
}

func (server *G2DiagnosticServer) GetDataSourceCounts(ctx context.Context, request *g2pb.GetDataSourceCountsRequest) (*g2pb.GetDataSourceCountsResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(15, request)
defer func() { server.traceExit(16, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetDataSourceCounts(ctx)
response := g2pb.GetDataSourceCountsResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetDBInfo(ctx context.Context, request *g2pb.GetDBInfoRequest) (*g2pb.GetDBInfoResponse, error) {
var err error = nil
var result string
Expand All @@ -206,102 +138,6 @@ func (server *G2DiagnosticServer) GetDBInfo(ctx context.Context, request *g2pb.G
return &response, err
}

func (server *G2DiagnosticServer) GetEntityDetails(ctx context.Context, request *g2pb.GetEntityDetailsRequest) (*g2pb.GetEntityDetailsResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(19, request)
defer func() { server.traceExit(20, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetEntityDetails(ctx, request.GetEntityID(), int(request.GetIncludeInternalFeatures()))
response := g2pb.GetEntityDetailsResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetEntityListBySize(ctx context.Context, request *g2pb.GetEntityListBySizeRequest) (*g2pb.GetEntityListBySizeResponse, error) {
var err error = nil
var result uintptr
if server.isTrace {
entryTime := time.Now()
server.traceEntry(21, request)
defer func() { server.traceExit(22, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetEntityListBySize(ctx, int(request.GetEntitySize()))
response := g2pb.GetEntityListBySizeResponse{
Result: fmt.Sprintf("%v", result),
}
return &response, err
}

func (server *G2DiagnosticServer) GetEntityResume(ctx context.Context, request *g2pb.GetEntityResumeRequest) (*g2pb.GetEntityResumeResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(23, request)
defer func() { server.traceExit(24, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetEntityResume(ctx, request.GetEntityID())
response := g2pb.GetEntityResumeResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetEntitySizeBreakdown(ctx context.Context, request *g2pb.GetEntitySizeBreakdownRequest) (*g2pb.GetEntitySizeBreakdownResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(25, request)
defer func() { server.traceExit(26, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetEntitySizeBreakdown(ctx, int(request.GetMinimumEntitySize()), int(request.GetIncludeInternalFeatures()))
response := g2pb.GetEntitySizeBreakdownResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetFeature(ctx context.Context, request *g2pb.GetFeatureRequest) (*g2pb.GetFeatureResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(27, request)
defer func() { server.traceExit(28, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetFeature(ctx, request.GetLibFeatID())
response := g2pb.GetFeatureResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetGenericFeatures(ctx context.Context, request *g2pb.GetGenericFeaturesRequest) (*g2pb.GetGenericFeaturesResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(29, request)
defer func() { server.traceExit(30, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetGenericFeatures(ctx, request.GetFeatureType(), int(request.GetMaximumEstimatedCount()))
response := g2pb.GetGenericFeaturesResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetLogicalCores(ctx context.Context, request *g2pb.GetLogicalCoresRequest) (*g2pb.GetLogicalCoresResponse, error) {
var err error = nil
var result int
Expand All @@ -318,22 +154,6 @@ func (server *G2DiagnosticServer) GetLogicalCores(ctx context.Context, request *
return &response, err
}

func (server *G2DiagnosticServer) GetMappingStatistics(ctx context.Context, request *g2pb.GetMappingStatisticsRequest) (*g2pb.GetMappingStatisticsResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(37, request)
defer func() { server.traceExit(38, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetMappingStatistics(ctx, int(request.GetIncludeInternalFeatures()))
response := g2pb.GetMappingStatisticsResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetObserverOrigin(ctx context.Context) string {
var err error = nil
if server.isTrace {
Expand Down Expand Up @@ -361,38 +181,6 @@ func (server *G2DiagnosticServer) GetPhysicalCores(ctx context.Context, request
return &response, err
}

func (server *G2DiagnosticServer) GetRelationshipDetails(ctx context.Context, request *g2pb.GetRelationshipDetailsRequest) (*g2pb.GetRelationshipDetailsResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(41, request)
defer func() { server.traceExit(42, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetRelationshipDetails(ctx, request.GetRelationshipID(), int(request.GetIncludeInternalFeatures()))
response := g2pb.GetRelationshipDetailsResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetResolutionStatistics(ctx context.Context, request *g2pb.GetResolutionStatisticsRequest) (*g2pb.GetResolutionStatisticsResponse, error) {
var err error = nil
var result string
if server.isTrace {
entryTime := time.Now()
server.traceEntry(43, request)
defer func() { server.traceExit(44, request, result, err, time.Since(entryTime)) }()
}
g2diagnostic := getG2diagnostic()
result, err = g2diagnostic.GetResolutionStatistics(ctx)
response := g2pb.GetResolutionStatisticsResponse{
Result: result,
}
return &response, err
}

func (server *G2DiagnosticServer) GetTotalSystemMemory(ctx context.Context, request *g2pb.GetTotalSystemMemoryRequest) (*g2pb.GetTotalSystemMemoryResponse, error) {
var err error = nil
var result int64
Expand Down Expand Up @@ -497,53 +285,6 @@ func (server *G2DiagnosticServer) SetObserverOrigin(ctx context.Context, origin
g2diagnostic.SetObserverOrigin(ctx, origin)
}

func (server *G2DiagnosticServer) StreamEntityListBySize(request *g2pb.StreamEntityListBySizeRequest, stream g2pb.G2Diagnostic_StreamEntityListBySizeServer) (err error) {
if server.isTrace {
server.traceEntry(163, request)
}
ctx := stream.Context()
entryTime := time.Now()
g2diagnostic := getG2diagnostic()

entitiesFetched := 0

//get the query handle
var queryHandle uintptr
queryHandle, err = g2diagnostic.GetEntityListBySize(ctx, int(request.GetEntitySize()))
if err != nil {
return err
}

defer func() {
err = g2diagnostic.CloseEntityListBySize(ctx, queryHandle)
if server.isTrace {
server.traceExit(165, request, entitiesFetched, err, time.Since(entryTime))
}
}()

for {
var fetchResult string
fetchResult, err = g2diagnostic.FetchNextEntityBySize(ctx, queryHandle)
if err != nil {
return err
}
if len(fetchResult) == 0 {
break
}
response := g2pb.StreamEntityListBySizeResponse{
Result: fetchResult,
}
entitiesFetched += 1
if err = stream.Send(&response); err != nil {
return err
}
server.traceEntry(164, request, fetchResult)
}

err = nil
return
}

func (server *G2DiagnosticServer) UnregisterObserver(ctx context.Context, observer observer.Observer) error {
var err error = nil
if server.isTrace {
Expand Down
Loading

0 comments on commit f1c68d5

Please sign in to comment.