This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
David Janowski 9f873ef0e4
Some checks failed
Gitea Build Check / Build (push) Has been cancelled
ci: updated brach allowance
2024-07-08 15:08:23 +02:00
.gitea/workflows ci: updated brach allowance 2024-07-08 15:08:23 +02:00
pkg feat: implemented the new Message Function 2024-07-08 14:56:17 +02:00
scripts feat: updated protobuf files 2024-07-06 22:08:19 +02:00
third_party feat: updated to latest protobuf 2024-07-07 00:43:21 +02:00
.gitignore fix: added protoc files 2024-02-20 21:21:41 +01:00
.gitmodules feat: updated to latest protobuf 2024-07-07 00:42:00 +02:00
go.mod feat: updated to latest otterSpaceSDK 2024-07-07 00:26:24 +02:00
go.sum feat: updated to latest otterSpaceSDK 2024-07-07 00:26:24 +02:00
README.md docs: added basic docs 2024-02-20 21:20:33 +01:00

Anthrove Plug SDK

Anthrove Plug SDK is a Golang-based Software Development Kit (SDK) that provides a gRPC server implementation for the Anthrove system. This SDK enables users to easily set up a server, establish a graph database connection, and set a task execution function.

Installation

To install the Anthrove Plug SDK, you will need to have Go installed on your system. You can then use the go get command to fetch the SDK:

go get git.dragse.it/anthrove/plug-sdk

Usage

Below is a basic example of how to use the SDK:

package main

import (
	"context"
	"git.dragse.it/anthrove/plug-sdk/pkg/otter"
	"log"
	"net"
	"git.dragse.it/anthrove/otter-space-sdk/pkg/graph"
	"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
	"git.dragse.it/anthrove/plug-sdk/pkg/plug"
)

func main() {
	var ctx context.Context

	// Initialize a new server
	server := plug.NewServer(ctx, "localhost", "8080")

	graph := otter.ConnectToDatabase(ctx, "endpoint", "username", "password", false)

	// Set the graph database connection
	server.WithGraphConnection(graph)

	// Set the task execution function
	server.TaskExecutionFunction(taskExecution)

	// Listen for connections
	if err := server.Listen(); err != nil {
		log.Fatalf("Failed to listen: %v", err)
	}
}

func taskExecution(ctx context.Context, graph graph.OtterSpace, sourceUsername string, anthroveUser models.AnthroveUser, deepScrape bool, cancelFunction func()) error {
	// SOME EXECUTION MAGIC
}