Documentation ¶
Overview ¶
Package ingest implements the IndyKite Ingest Service API Client.
Index ¶
- type Client
- func (c *Client) BatchDeleteNodeProperties(ctx context.Context, nodeProperties []*ingestpb.DeleteData_NodePropertyMatch, ...) (*ingestpb.BatchDeleteNodePropertiesResponse, error)
- func (c *Client) BatchDeleteNodes(ctx context.Context, nodes []*ingestpb.NodeMatch, opts ...grpc.CallOption) (*ingestpb.BatchDeleteNodesResponse, error)
- func (c *Client) BatchDeleteRelationshipProperties(ctx context.Context, ...) (*ingestpb.BatchDeleteRelationshipPropertiesResponse, error)
- func (c *Client) BatchDeleteRelationships(ctx context.Context, relationships []*ingestpb.Relationship, ...) (*ingestpb.BatchDeleteRelationshipsResponse, error)
- func (c *Client) BatchUpsertNodes(ctx context.Context, nodes []*knowledgeobjects.Node, opts ...grpc.CallOption) (*ingestpb.BatchUpsertNodesResponse, error)
- func (c *Client) BatchUpsertRelationships(ctx context.Context, relationships []*ingestpb.Relationship, ...) (*ingestpb.BatchUpsertRelationshipsResponse, error)
- func (c *Client) Close() error
- func (c *Client) CloseStream() error
- func (c *Client) IngestRecord(ctx context.Context, record *ingestpb.Record, opts ...grpc.CallOption) (*ingestpb.IngestRecordResponse, error)
- func (c *Client) OpenStreamClient(ctx context.Context) error
- func (c *Client) ReceiveResponse() (*ingestpb.StreamRecordsResponse, error)
- func (c *Client) SendRecord(record *ingestpb.Record) error
- func (c *Client) StreamRecords(records []*ingestpb.Record) ([]*ingestpb.StreamRecordsResponse, error)
- type RetryClient
- type RetryPolicy
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient creates a new Ingest API gRPC Client.
Example (Default) ¶
This example demonstrates how to create a new Ingest Client.
package main import ( "context" "log" "github.com/indykite/indykite-sdk-go/ingest" ) func main() { client, err := ingest.NewClient(context.Background()) if err != nil { log.Fatalf("failed to create client %v", err) } _ = client.Close() }
Output:
Example (Options) ¶
This example demonstrates how to create a new Ingest Client.
package main import ( "context" "log" api "github.com/indykite/indykite-sdk-go/grpc" "github.com/indykite/indykite-sdk-go/ingest" ) func main() { client, err := ingest.NewClient(context.Background(), api.WithCredentialsJSON([]byte(`{}`))) if err != nil { log.Fatalf("failed to create client %v", err) } _ = client.Close() }
Output:
func NewTestClient ¶
func NewTestClient(client ingestpb.IngestAPIClient) (*Client, error)
NewTestClient creates a new Ingest gRPC Client.
func (*Client) BatchDeleteNodeProperties ¶ added in v0.26.0
func (c *Client) BatchDeleteNodeProperties( ctx context.Context, nodeProperties []*ingestpb.DeleteData_NodePropertyMatch, opts ...grpc.CallOption, ) (*ingestpb.BatchDeleteNodePropertiesResponse, error)
func (*Client) BatchDeleteNodes ¶ added in v0.26.0
func (c *Client) BatchDeleteNodes( ctx context.Context, nodes []*ingestpb.NodeMatch, opts ...grpc.CallOption, ) (*ingestpb.BatchDeleteNodesResponse, error)
func (*Client) BatchDeleteRelationshipProperties ¶ added in v0.26.0
func (c *Client) BatchDeleteRelationshipProperties( ctx context.Context, relationshipProperties []*ingestpb.DeleteData_RelationshipPropertyMatch, opts ...grpc.CallOption, ) (*ingestpb.BatchDeleteRelationshipPropertiesResponse, error)
func (*Client) BatchDeleteRelationships ¶ added in v0.26.0
func (c *Client) BatchDeleteRelationships( ctx context.Context, relationships []*ingestpb.Relationship, opts ...grpc.CallOption, ) (*ingestpb.BatchDeleteRelationshipsResponse, error)
func (*Client) BatchUpsertNodes ¶ added in v0.26.0
func (c *Client) BatchUpsertNodes( ctx context.Context, nodes []*knowledgeobjects.Node, opts ...grpc.CallOption, ) (*ingestpb.BatchUpsertNodesResponse, error)
func (*Client) BatchUpsertRelationships ¶ added in v0.26.0
func (c *Client) BatchUpsertRelationships( ctx context.Context, relationships []*ingestpb.Relationship, opts ...grpc.CallOption, ) (*ingestpb.BatchUpsertRelationshipsResponse, error)
func (*Client) Close ¶
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) CloseStream ¶ added in v0.13.0
CloseStream closes the gRPC stream.
func (*Client) IngestRecord ¶ added in v0.13.0
func (c *Client) IngestRecord( ctx context.Context, record *ingestpb.Record, opts ...grpc.CallOption, ) (*ingestpb.IngestRecordResponse, error)
Example ¶
This example demonstrates how to use the Ingest Client to ingest a single record.
client, err := ingest.NewClient(context.Background()) if err != nil { log.Fatalf("failed to create client %v", err) } defer func() { _ = client.Close() }() response, err := client.IngestRecord(context.Background(), record1) if err != nil { log.Fatalf("failed to invoke operation on IndyKite Client %v", err) } json := protojson.MarshalOptions{ Multiline: true, } fmt.Println(json.Format(response))
Output:
func (*Client) OpenStreamClient ¶ added in v0.13.0
OpenStreamClient opens a stream, ready to ingest records.
func (*Client) ReceiveResponse ¶ added in v0.13.0
func (c *Client) ReceiveResponse() (*ingestpb.StreamRecordsResponse, error)
ReceiveResponse returns the next response available on the stream.
func (*Client) SendRecord ¶ added in v0.13.0
SendRecord sends a record on the opened stream.
func (*Client) StreamRecords ¶
func (c *Client) StreamRecords(records []*ingestpb.Record) ( []*ingestpb.StreamRecordsResponse, error)
StreamRecords is a helper that takes a slice of records and handles opening the stream, sending the records, getting the responses, and closing the stream.
Example ¶
This example demonstrates how to use the Ingest Client to stream multiple records.
client, err := ingest.NewClient(context.Background()) if err != nil { log.Fatalf("failed to create client %v", err) } defer func() { _ = client.Close() }() ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) defer cancel() err = client.OpenStreamClient(ctx) if err != nil { log.Fatalf("failed to open stream %v", err) } for _, record := range []*ingestpb.Record{record1, record2} { err = client.SendRecord(record) if err != nil { log.Fatalf("failed to send record on stream %v", err) } } for { resp, err := client.ReceiveResponse() if err != nil { if err.Error() == "EOF" { break } log.Fatalf("failed to receive responses %v", err) } json := protojson.MarshalOptions{ Multiline: true, } fmt.Println(json.Format(resp)) }
Output:
type RetryClient ¶ added in v0.17.0
type RetryClient struct { *Client // contains filtered or unexported fields }
func NewRetryClient ¶ added in v0.17.0
func NewRetryClient(ctx context.Context, retryPolicy *RetryPolicy, opts ...api.ClientOption) (*RetryClient, error)
NewRetryClient creates a new Ingest API gRPC Client with retry functionality.
func NewTestRetryClient ¶ added in v0.17.0
func NewTestRetryClient(client ingestpb.IngestAPIClient, retryPolicy *RetryPolicy) (*RetryClient, error)
NewTestRetryClient creates a new test Ingest API gRPC Client with retry functionality.
func (*RetryClient) OpenStreamClient ¶ added in v0.17.0
func (c *RetryClient) OpenStreamClient(ctx context.Context) error
OpenStreamClient opens a stream, ready to ingest records.
func (*RetryClient) ReceiveResponse ¶ added in v0.17.0
func (c *RetryClient) ReceiveResponse() (*ingestpb.StreamRecordsResponse, error)
ReceiveResponse returns the next response available on the stream. If an error is returned (stream is closed), the method will wait for a server reconnect or fail.
func (*RetryClient) SendRecord ¶ added in v0.17.0
func (c *RetryClient) SendRecord(record *ingestpb.Record) error
SendRecord sends a record on the opened stream and retries if it fails.