Compare commits

..

1 Commits

Author SHA1 Message Date
cce1a01369 feat(postgres): enable postgres support 2024-06-21 13:16:50 +02:00
13 changed files with 195 additions and 896 deletions

View File

@ -1,41 +0,0 @@
name: Gitea Build Check
run-name: ${{ gitea.actor }} is testing the build
on:
push:
branches:
- main
- V2
pull_request:
branches: [ "main" ]
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup Go environment
uses: https://github.com/actions/setup-go@v5
with:
# The Go version to download (if necessary) and use. Supports semver spec and ranges.
go-version: 1.22.0 # optional
# Path to the go.mod file.
go-version-file: ./go.mod # optional
# Set this option to true if you want the action to always check for the latest available version that satisfies the version spec
check-latest: true # optional
# Used to specify whether caching is needed. Set to true, if you'd like to enable caching.
cache: true # optional
- name: Execute Go Test files with coverage report
run: go test -v ./... -json -coverprofile="coverage.out" | tee "test-report.out"
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ vars.SONAR_HOST_URL }}
with:
args: >
-Dsonar.projectKey=Anthrove---plug-sdk
-Dsonar.exclusions=pkg/grpc/*

2
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "third_party/grpc-proto"]
path = third_party/grpc-proto
url = https://git.dragse.it/anthrove/grpc-proto.git
branch = release/v3.2.0
branch = release/v2.0.0

View File

@ -1,49 +1,53 @@
# 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 database connection, and set a task execution function.
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:
```bash
go get git.dragse.it/anthrove/plug-sdk/v2
go get git.dragse.it/anthrove/plug-sdk
```
## Usage
Below is a basic example of how to use the SDK:
````go
import "git.dragse.it/anthrove/plug-sdk/v2/pkg/plug"
package main
// Define what Source this Plug is used for
source := models.Source{
DisplayName: "e621",
Domain: "e621.net",
Icon: "e621.net/icon.png",
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)
}
}
// Create a new Plug instance
p := plug.NewPlug(ctx, "localhost", "50051", source)
// Set the OtterSpace database
p.WithOtterSpace(database)
// Set the task execution function
p.TaskExecutionFunction(func(ctx context.Context, database database.OtterSpace, sourceUsername string, anthroveUser models.User, deepScrape bool, apiKey string, cancelFunction func()) error {
// Your task execution logic here
})
// Set the send message execution function
p.SendMessageExecution(func(ctx context.Context, userSourceID string, message string) error {
// Your message sending logic here
})
// Start the server
err := p.Listen()
if err != nil {
log.Fatalf("Failed to start server: %v", err)
func taskExecution(ctx context.Context, graph graph.OtterSpace, sourceUsername string, anthroveUser models.AnthroveUser, deepScrape bool, cancelFunction func()) error {
// SOME EXECUTION MAGIC
}
````

23
go.mod
View File

@ -1,32 +1,21 @@
module git.dragse.it/anthrove/plug-sdk/v2
module git.dragse.it/anthrove/plug-sdk
go 1.22.0
require (
git.dragse.it/anthrove/otter-space-sdk/v2 v2.1.0
github.com/golang/protobuf v1.5.4
git.dragse.it/anthrove/otter-space-sdk v1.5.1-0.20240620204503-84aee5c2dda5
github.com/matoous/go-nanoid/v2 v2.1.0
google.golang.org/grpc v1.61.1
google.golang.org/protobuf v1.34.2
google.golang.org/protobuf v1.33.0
)
require (
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.5.5 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/rubenv/sql-migrate v1.6.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/neo4j/neo4j-go-driver/v5 v5.17.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
golang.org/x/crypto v0.22.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
gorm.io/driver/postgres v1.5.9 // indirect
gorm.io/gorm v1.25.10 // indirect
)

159
go.sum
View File

@ -1,163 +1,52 @@
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
git.dragse.it/anthrove/otter-space-sdk/v2 v2.1.0 h1:n3vePctwrBWDRccztsWYaBXejoEtno5ADT/c284hSFQ=
git.dragse.it/anthrove/otter-space-sdk/v2 v2.1.0/go.mod h1:kyN5WtWd0AjWipXGZnxaBz4bv3rT7Eyw0HmfkCB27AU=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8=
github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/containerd/containerd v1.7.15 h1:afEHXdil9iAm03BmhjzKyXnnEBtjaLJefdU7DV0IFes=
github.com/containerd/containerd v1.7.15/go.mod h1:ISzRRTMF8EXNpJlTzyr2XMhN+j9K302C21/+cr3kUnY=
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E=
github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc=
git.dragse.it/anthrove/otter-space-sdk v1.0.0 h1:sJ5d8yMFAosP9+315PxZc5yzYUdzAJEEyxoKDmc8YoE=
git.dragse.it/anthrove/otter-space-sdk v1.0.0/go.mod h1:QI2W7gm1GflcAeipEoyLZ3hj86DlIgwT9Lisc4c99Vs=
git.dragse.it/anthrove/otter-space-sdk v1.5.1-0.20240620204503-84aee5c2dda5 h1:xAJTbLW4imPFh2E1aEZo5+hQk0DKqK95iicIicWfDKM=
git.dragse.it/anthrove/otter-space-sdk v1.5.1-0.20240620204503-84aee5c2dda5/go.mod h1:28gC8KJzILQOztRCo/qvUOqdiTCyeMc2xgSgEfGr8m8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/docker v25.0.5+incompatible h1:UmQydMduGkrD5nQde1mecF/YnSbTOaPeFIeP5C4W+DE=
github.com/docker/docker v25.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs=
github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.5.5 h1:amBjrZVmksIdNjxGW/IiIMzxMKZFelXbUoPNb+8sjQw=
github.com/jackc/pgx/v5 v5.5.5/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4=
github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/matoous/go-nanoid/v2 v2.1.0 h1:P64+dmq21hhWdtvZfEAofnvJULaRR1Yib0+PnU669bE=
github.com/matoous/go-nanoid v1.5.0/go.mod h1:zyD2a71IubI24efhpvkJz+ZwfwagzgSO6UNiFsZKN7U=
github.com/matoous/go-nanoid/v2 v2.0.0 h1:d19kur2QuLeHmJBkvYkFdhFBzLoo1XVm2GgTpL+9Tj0=
github.com/matoous/go-nanoid/v2 v2.0.0/go.mod h1:FtS4aGPVfEkxKxhdWPAspZpZSh1cOjtM7Ej/So3hR0g=
github.com/matoous/go-nanoid/v2 v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM=
github.com/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI=
github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc=
github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo=
github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg=
github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU=
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug=
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/neo4j/neo4j-go-driver/v5 v5.17.0 h1:Bdqg1Y8Hd3uLYToXtBjysDYXTdMiP7zeUNUEwfbJkSo=
github.com/neo4j/neo4j-go-driver/v5 v5.17.0/go.mod h1:Vff8OwT7QpLm7L2yYr85XNWe9Rbqlbeb9asNXJTHO4k=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/poy/onpar v1.1.2 h1:QaNrNiZx0+Nar5dLgTVp5mXkyoVFIbepjyEoGSnhbAY=
github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjzg=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rubenv/sql-migrate v1.6.1 h1:bo6/sjsan9HaXAsNxYP/jCEDUGibHp8JmOBw7NTGRos=
github.com/rubenv/sql-migrate v1.6.1/go.mod h1:tPzespupJS0jacLfhbwto/UjSX+8h2FdWB7ar+QlHa0=
github.com/shirou/gopsutil/v3 v3.23.12 h1:z90NtUkp3bMtmICZKpC4+WaknU1eXtp5vtbQ11DgpE4=
github.com/shirou/gopsutil/v3 v3.23.12/go.mod h1:1FrWgea594Jp7qmjHUUPlJDTPgcsb9mGnXDxavtikzM=
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/testcontainers/testcontainers-go v0.31.0 h1:W0VwIhcEVhRflwL9as3dhY6jXjVCA27AkmbnZ+UTh3U=
github.com/testcontainers/testcontainers-go v0.31.0/go.mod h1:D2lAoA0zUFiSY+eAflqK5mcUx/A5hrrORaEQrd0SefI=
github.com/testcontainers/testcontainers-go/modules/postgres v0.31.0 h1:isAwFS3KNKRbJMbWv+wolWqOFUECmjYZ+sIRZCIBc/E=
github.com/testcontainers/testcontainers-go/modules/postgres v0.31.0/go.mod h1:ZNYY8vumNCEG9YI59A9d6/YaMY49uwRhmeU563EzFGw=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw=
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA=
google.golang.org/grpc v1.61.1 h1:kLAiWrZs7YeDM6MumDe7m3y4aM6wacLzM1Y/wiLP9XY=
google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/postgres v1.5.9 h1:DkegyItji119OlcaLjqN11kHoUgZ/j13E0jkJZgD6A8=
gorm.io/driver/postgres v1.5.9/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkweRGI=
gorm.io/gorm v1.25.10 h1:dQpO+33KalOA+aFYGlK+EfxcI5MbO7EP2yYygwh9h+s=
gorm.io/gorm v1.25.10/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=

View File

@ -1,15 +1,15 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.12.4
// protoc-gen-go v1.32.0
// protoc v3.19.6
// source: plug.proto
package gRPC
import (
timestamp "github.com/golang/protobuf/ptypes/timestamp"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
@ -78,8 +78,8 @@ type PingRequest struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Optional message field, can be removed if not needed
Timestamp *timestamp.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Optional message field, can be removed if not needed
Timestamp *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
}
func (x *PingRequest) Reset() {
@ -121,7 +121,7 @@ func (x *PingRequest) GetMessage() string {
return ""
}
func (x *PingRequest) GetTimestamp() *timestamp.Timestamp {
func (x *PingRequest) GetTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.Timestamp
}
@ -133,8 +133,8 @@ type PongResponse struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Optional message field, can be removed if not needed
Timestamp *timestamp.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // Optional message field, can be removed if not needed
Timestamp *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
}
func (x *PongResponse) Reset() {
@ -176,7 +176,7 @@ func (x *PongResponse) GetMessage() string {
return ""
}
func (x *PongResponse) GetTimestamp() *timestamp.Timestamp {
func (x *PongResponse) GetTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.Timestamp
}
@ -293,8 +293,6 @@ type PlugTaskCreation struct {
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
UserSourceName string `protobuf:"bytes,2,opt,name=user_source_name,json=userSourceName,proto3" json:"user_source_name,omitempty"`
DeepScrape bool `protobuf:"varint,3,opt,name=deep_scrape,json=deepScrape,proto3" json:"deep_scrape,omitempty"`
ApiKey string `protobuf:"bytes,4,opt,name=api_key,json=apiKey,proto3" json:"api_key,omitempty"`
UserSourceId string `protobuf:"bytes,5,opt,name=user_source_id,json=userSourceId,proto3" json:"user_source_id,omitempty"`
}
func (x *PlugTaskCreation) Reset() {
@ -350,311 +348,6 @@ func (x *PlugTaskCreation) GetDeepScrape() bool {
return false
}
func (x *PlugTaskCreation) GetApiKey() string {
if x != nil {
return x.ApiKey
}
return ""
}
func (x *PlugTaskCreation) GetUserSourceId() string {
if x != nil {
return x.UserSourceId
}
return ""
}
type SendMessageRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserSourceId string `protobuf:"bytes,1,opt,name=user_source_id,json=userSourceId,proto3" json:"user_source_id,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
UserSourceName string `protobuf:"bytes,3,opt,name=user_source_name,json=userSourceName,proto3" json:"user_source_name,omitempty"`
}
func (x *SendMessageRequest) Reset() {
*x = SendMessageRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_plug_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SendMessageRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendMessageRequest) ProtoMessage() {}
func (x *SendMessageRequest) ProtoReflect() protoreflect.Message {
mi := &file_plug_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SendMessageRequest.ProtoReflect.Descriptor instead.
func (*SendMessageRequest) Descriptor() ([]byte, []int) {
return file_plug_proto_rawDescGZIP(), []int{5}
}
func (x *SendMessageRequest) GetUserSourceId() string {
if x != nil {
return x.UserSourceId
}
return ""
}
func (x *SendMessageRequest) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *SendMessageRequest) GetUserSourceName() string {
if x != nil {
return x.UserSourceName
}
return ""
}
type SendMessageResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
}
func (x *SendMessageResponse) Reset() {
*x = SendMessageResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_plug_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SendMessageResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SendMessageResponse) ProtoMessage() {}
func (x *SendMessageResponse) ProtoReflect() protoreflect.Message {
mi := &file_plug_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SendMessageResponse.ProtoReflect.Descriptor instead.
func (*SendMessageResponse) Descriptor() ([]byte, []int) {
return file_plug_proto_rawDescGZIP(), []int{6}
}
func (x *SendMessageResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
type GetMessagesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserSourceId string `protobuf:"bytes,1,opt,name=user_source_id,json=userSourceId,proto3" json:"user_source_id,omitempty"`
UserSourceName string `protobuf:"bytes,2,opt,name=user_source_name,json=userSourceName,proto3" json:"user_source_name,omitempty"`
}
func (x *GetMessagesRequest) Reset() {
*x = GetMessagesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_plug_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetMessagesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMessagesRequest) ProtoMessage() {}
func (x *GetMessagesRequest) ProtoReflect() protoreflect.Message {
mi := &file_plug_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMessagesRequest.ProtoReflect.Descriptor instead.
func (*GetMessagesRequest) Descriptor() ([]byte, []int) {
return file_plug_proto_rawDescGZIP(), []int{7}
}
func (x *GetMessagesRequest) GetUserSourceId() string {
if x != nil {
return x.UserSourceId
}
return ""
}
func (x *GetMessagesRequest) GetUserSourceName() string {
if x != nil {
return x.UserSourceName
}
return ""
}
type GetMessagesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
}
func (x *GetMessagesResponse) Reset() {
*x = GetMessagesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_plug_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetMessagesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMessagesResponse) ProtoMessage() {}
func (x *GetMessagesResponse) ProtoReflect() protoreflect.Message {
mi := &file_plug_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMessagesResponse.ProtoReflect.Descriptor instead.
func (*GetMessagesResponse) Descriptor() ([]byte, []int) {
return file_plug_proto_rawDescGZIP(), []int{8}
}
func (x *GetMessagesResponse) GetMessages() []*Message {
if x != nil {
return x.Messages
}
return nil
}
type Message struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
FromUserSourceId string `protobuf:"bytes,1,opt,name=from_user_source_id,json=fromUserSourceId,proto3" json:"from_user_source_id,omitempty"`
FromUserSourceName string `protobuf:"bytes,2,opt,name=from_user_source_name,json=fromUserSourceName,proto3" json:"from_user_source_name,omitempty"`
CreatedAt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
Body string `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"`
}
func (x *Message) Reset() {
*x = Message{}
if protoimpl.UnsafeEnabled {
mi := &file_plug_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Message) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Message) ProtoMessage() {}
func (x *Message) ProtoReflect() protoreflect.Message {
mi := &file_plug_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Message.ProtoReflect.Descriptor instead.
func (*Message) Descriptor() ([]byte, []int) {
return file_plug_proto_rawDescGZIP(), []int{9}
}
func (x *Message) GetFromUserSourceId() string {
if x != nil {
return x.FromUserSourceId
}
return ""
}
func (x *Message) GetFromUserSourceName() string {
if x != nil {
return x.FromUserSourceName
}
return ""
}
func (x *Message) GetCreatedAt() *timestamp.Timestamp {
if x != nil {
return x.CreatedAt
}
return nil
}
func (x *Message) GetBody() string {
if x != nil {
return x.Body
}
return ""
}
func (x *Message) GetTitle() string {
if x != nil {
return x.Title
}
return ""
}
var File_plug_proto protoreflect.FileDescriptor
var file_plug_proto_rawDesc = []byte{
@ -681,80 +374,34 @@ var file_plug_proto_rawDesc = []byte{
0x61, 0x74, 0x65, 0x52, 0x09, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x23,
0x0a, 0x08, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61,
0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73,
0x6b, 0x49, 0x64, 0x22, 0xb5, 0x01, 0x0a, 0x10, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b,
0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
0x64, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x75, 0x73, 0x65,
0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x64,
0x65, 0x65, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x61, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,
0x52, 0x0a, 0x64, 0x65, 0x65, 0x70, 0x53, 0x63, 0x72, 0x61, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07,
0x61, 0x70, 0x69, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61,
0x70, 0x69, 0x4b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f,
0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x75,
0x73, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x22, 0x7e, 0x0a, 0x12, 0x53,
0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72, 0x53,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
0x65, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x75, 0x73, 0x65,
0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x2f, 0x0a, 0x13, 0x53,
0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x64, 0x0a, 0x12,
0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x75, 0x73, 0x65, 0x72,
0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72,
0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61,
0x6d, 0x65, 0x22, 0x3b, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x08, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22,
0xd0, 0x01, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2d, 0x0a, 0x13, 0x66,
0x72, 0x6f, 0x6d, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6d, 0x55, 0x73,
0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x15, 0x66, 0x72,
0x6f, 0x6d, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x66, 0x72, 0x6f, 0x6d, 0x55,
0x73, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x39, 0x0a,
0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63,
0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79,
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x14, 0x0a, 0x05,
0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74,
0x6c, 0x65, 0x2a, 0x43, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74,
0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00,
0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a,
0x07, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54,
0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x03, 0x32, 0xb1, 0x02, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67,
0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x2f, 0x0a, 0x09, 0x54, 0x61, 0x73,
0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x11, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73,
0x6b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, 0x67,
0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x0a, 0x54, 0x61,
0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54,
0x61, 0x73, 0x6b, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x61, 0x6e, 0x63,
0x65, 0x6c, 0x12, 0x09, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x0f, 0x2e,
0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23,
0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x0c, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x50, 0x6f, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x12, 0x13, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a,
0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73,
0x12, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61,
0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x33, 0x5a, 0x31, 0x67,
0x69, 0x74, 0x2e, 0x64, 0x72, 0x61, 0x67, 0x73, 0x65, 0x2e, 0x69, 0x74, 0x2f, 0x61, 0x6e, 0x74,
0x68, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x2d, 0x5b, 0x52, 0x45, 0x50, 0x4c,
0x41, 0x43, 0x45, 0x5f, 0x4d, 0x45, 0x5d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x52, 0x50, 0x43,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6b, 0x49, 0x64, 0x22, 0x76, 0x0a, 0x10, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x43,
0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
0x12, 0x28, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x75, 0x73, 0x65, 0x72,
0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x65,
0x65, 0x70, 0x5f, 0x73, 0x63, 0x72, 0x61, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52,
0x0a, 0x64, 0x65, 0x65, 0x70, 0x53, 0x63, 0x72, 0x61, 0x70, 0x65, 0x2a, 0x43, 0x0a, 0x0d, 0x50,
0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07,
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x41,
0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e,
0x47, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x54, 0x4f, 0x50, 0x50, 0x45, 0x44, 0x10, 0x03,
0x32, 0xb9, 0x01, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74,
0x6f, 0x72, 0x12, 0x2f, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12,
0x11, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x12, 0x09, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x0f, 0x2e, 0x50,
0x6c, 0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a,
0x0a, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x09, 0x2e, 0x50, 0x6c,
0x75, 0x67, 0x54, 0x61, 0x73, 0x6b, 0x1a, 0x0f, 0x2e, 0x50, 0x6c, 0x75, 0x67, 0x54, 0x61, 0x73,
0x6b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x23, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12,
0x0c, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e,
0x50, 0x6f, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x33, 0x5a, 0x31,
0x67, 0x69, 0x74, 0x2e, 0x64, 0x72, 0x61, 0x67, 0x73, 0x65, 0x2e, 0x69, 0x74, 0x2f, 0x61, 0x6e,
0x74, 0x68, 0x72, 0x6f, 0x76, 0x65, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x2d, 0x5b, 0x52, 0x45, 0x50,
0x4c, 0x41, 0x43, 0x45, 0x5f, 0x4d, 0x45, 0x5d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x52, 0x50,
0x43, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -770,44 +417,33 @@ func file_plug_proto_rawDescGZIP() []byte {
}
var file_plug_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_plug_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_plug_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_plug_proto_goTypes = []interface{}{
(PlugTaskState)(0), // 0: PlugTaskState
(*PingRequest)(nil), // 1: PingRequest
(*PongResponse)(nil), // 2: PongResponse
(*PlugTaskStatus)(nil), // 3: PlugTaskStatus
(*PlugTask)(nil), // 4: PlugTask
(*PlugTaskCreation)(nil), // 5: PlugTaskCreation
(*SendMessageRequest)(nil), // 6: SendMessageRequest
(*SendMessageResponse)(nil), // 7: SendMessageResponse
(*GetMessagesRequest)(nil), // 8: GetMessagesRequest
(*GetMessagesResponse)(nil), // 9: GetMessagesResponse
(*Message)(nil), // 10: Message
(*timestamp.Timestamp)(nil), // 11: google.protobuf.Timestamp
(PlugTaskState)(0), // 0: PlugTaskState
(*PingRequest)(nil), // 1: PingRequest
(*PongResponse)(nil), // 2: PongResponse
(*PlugTaskStatus)(nil), // 3: PlugTaskStatus
(*PlugTask)(nil), // 4: PlugTask
(*PlugTaskCreation)(nil), // 5: PlugTaskCreation
(*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp
}
var file_plug_proto_depIdxs = []int32{
11, // 0: PingRequest.timestamp:type_name -> google.protobuf.Timestamp
11, // 1: PongResponse.timestamp:type_name -> google.protobuf.Timestamp
0, // 2: PlugTaskStatus.task_state:type_name -> PlugTaskState
10, // 3: GetMessagesResponse.messages:type_name -> Message
11, // 4: Message.created_at:type_name -> google.protobuf.Timestamp
5, // 5: PlugConnector.TaskStart:input_type -> PlugTaskCreation
4, // 6: PlugConnector.TaskStatus:input_type -> PlugTask
4, // 7: PlugConnector.TaskCancel:input_type -> PlugTask
1, // 8: PlugConnector.Ping:input_type -> PingRequest
6, // 9: PlugConnector.SendMessage:input_type -> SendMessageRequest
8, // 10: PlugConnector.GetUserMessages:input_type -> GetMessagesRequest
3, // 11: PlugConnector.TaskStart:output_type -> PlugTaskStatus
3, // 12: PlugConnector.TaskStatus:output_type -> PlugTaskStatus
3, // 13: PlugConnector.TaskCancel:output_type -> PlugTaskStatus
2, // 14: PlugConnector.Ping:output_type -> PongResponse
7, // 15: PlugConnector.SendMessage:output_type -> SendMessageResponse
9, // 16: PlugConnector.GetUserMessages:output_type -> GetMessagesResponse
11, // [11:17] is the sub-list for method output_type
5, // [5:11] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
6, // 0: PingRequest.timestamp:type_name -> google.protobuf.Timestamp
6, // 1: PongResponse.timestamp:type_name -> google.protobuf.Timestamp
0, // 2: PlugTaskStatus.task_state:type_name -> PlugTaskState
5, // 3: PlugConnector.TaskStart:input_type -> PlugTaskCreation
4, // 4: PlugConnector.TaskStatus:input_type -> PlugTask
4, // 5: PlugConnector.TaskCancel:input_type -> PlugTask
1, // 6: PlugConnector.Ping:input_type -> PingRequest
3, // 7: PlugConnector.TaskStart:output_type -> PlugTaskStatus
3, // 8: PlugConnector.TaskStatus:output_type -> PlugTaskStatus
3, // 9: PlugConnector.TaskCancel:output_type -> PlugTaskStatus
2, // 10: PlugConnector.Ping:output_type -> PongResponse
7, // [7:11] is the sub-list for method output_type
3, // [3:7] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_plug_proto_init() }
@ -876,66 +512,6 @@ func file_plug_proto_init() {
return nil
}
}
file_plug_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SendMessageRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_plug_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SendMessageResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_plug_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetMessagesRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_plug_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetMessagesResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_plug_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Message); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -943,7 +519,7 @@ func file_plug_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_plug_proto_rawDesc,
NumEnums: 1,
NumMessages: 10,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.12.4
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.19.6
// source: plug.proto
package gRPC
@ -18,6 +18,13 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
PlugConnector_TaskStart_FullMethodName = "/PlugConnector/TaskStart"
PlugConnector_TaskStatus_FullMethodName = "/PlugConnector/TaskStatus"
PlugConnector_TaskCancel_FullMethodName = "/PlugConnector/TaskCancel"
PlugConnector_Ping_FullMethodName = "/PlugConnector/Ping"
)
// PlugConnectorClient is the client API for PlugConnector service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
@ -26,8 +33,6 @@ type PlugConnectorClient interface {
TaskStatus(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error)
TaskCancel(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error)
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error)
SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error)
GetUserMessages(ctx context.Context, in *GetMessagesRequest, opts ...grpc.CallOption) (*GetMessagesResponse, error)
}
type plugConnectorClient struct {
@ -40,7 +45,7 @@ func NewPlugConnectorClient(cc grpc.ClientConnInterface) PlugConnectorClient {
func (c *plugConnectorClient) TaskStart(ctx context.Context, in *PlugTaskCreation, opts ...grpc.CallOption) (*PlugTaskStatus, error) {
out := new(PlugTaskStatus)
err := c.cc.Invoke(ctx, "/PlugConnector/TaskStart", in, out, opts...)
err := c.cc.Invoke(ctx, PlugConnector_TaskStart_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -49,7 +54,7 @@ func (c *plugConnectorClient) TaskStart(ctx context.Context, in *PlugTaskCreatio
func (c *plugConnectorClient) TaskStatus(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error) {
out := new(PlugTaskStatus)
err := c.cc.Invoke(ctx, "/PlugConnector/TaskStatus", in, out, opts...)
err := c.cc.Invoke(ctx, PlugConnector_TaskStatus_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -58,7 +63,7 @@ func (c *plugConnectorClient) TaskStatus(ctx context.Context, in *PlugTask, opts
func (c *plugConnectorClient) TaskCancel(ctx context.Context, in *PlugTask, opts ...grpc.CallOption) (*PlugTaskStatus, error) {
out := new(PlugTaskStatus)
err := c.cc.Invoke(ctx, "/PlugConnector/TaskCancel", in, out, opts...)
err := c.cc.Invoke(ctx, PlugConnector_TaskCancel_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -67,25 +72,7 @@ func (c *plugConnectorClient) TaskCancel(ctx context.Context, in *PlugTask, opts
func (c *plugConnectorClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error) {
out := new(PongResponse)
err := c.cc.Invoke(ctx, "/PlugConnector/Ping", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *plugConnectorClient) SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error) {
out := new(SendMessageResponse)
err := c.cc.Invoke(ctx, "/PlugConnector/SendMessage", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *plugConnectorClient) GetUserMessages(ctx context.Context, in *GetMessagesRequest, opts ...grpc.CallOption) (*GetMessagesResponse, error) {
out := new(GetMessagesResponse)
err := c.cc.Invoke(ctx, "/PlugConnector/GetUserMessages", in, out, opts...)
err := c.cc.Invoke(ctx, PlugConnector_Ping_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -100,8 +87,6 @@ type PlugConnectorServer interface {
TaskStatus(context.Context, *PlugTask) (*PlugTaskStatus, error)
TaskCancel(context.Context, *PlugTask) (*PlugTaskStatus, error)
Ping(context.Context, *PingRequest) (*PongResponse, error)
SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error)
GetUserMessages(context.Context, *GetMessagesRequest) (*GetMessagesResponse, error)
mustEmbedUnimplementedPlugConnectorServer()
}
@ -121,12 +106,6 @@ func (UnimplementedPlugConnectorServer) TaskCancel(context.Context, *PlugTask) (
func (UnimplementedPlugConnectorServer) Ping(context.Context, *PingRequest) (*PongResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedPlugConnectorServer) SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SendMessage not implemented")
}
func (UnimplementedPlugConnectorServer) GetUserMessages(context.Context, *GetMessagesRequest) (*GetMessagesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserMessages not implemented")
}
func (UnimplementedPlugConnectorServer) mustEmbedUnimplementedPlugConnectorServer() {}
// UnsafePlugConnectorServer may be embedded to opt out of forward compatibility for this service.
@ -150,7 +129,7 @@ func _PlugConnector_TaskStart_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/PlugConnector/TaskStart",
FullMethod: PlugConnector_TaskStart_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PlugConnectorServer).TaskStart(ctx, req.(*PlugTaskCreation))
@ -168,7 +147,7 @@ func _PlugConnector_TaskStatus_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/PlugConnector/TaskStatus",
FullMethod: PlugConnector_TaskStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PlugConnectorServer).TaskStatus(ctx, req.(*PlugTask))
@ -186,7 +165,7 @@ func _PlugConnector_TaskCancel_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/PlugConnector/TaskCancel",
FullMethod: PlugConnector_TaskCancel_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PlugConnectorServer).TaskCancel(ctx, req.(*PlugTask))
@ -204,7 +183,7 @@ func _PlugConnector_Ping_Handler(srv interface{}, ctx context.Context, dec func(
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/PlugConnector/Ping",
FullMethod: PlugConnector_Ping_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PlugConnectorServer).Ping(ctx, req.(*PingRequest))
@ -212,42 +191,6 @@ func _PlugConnector_Ping_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler)
}
func _PlugConnector_SendMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SendMessageRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PlugConnectorServer).SendMessage(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/PlugConnector/SendMessage",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PlugConnectorServer).SendMessage(ctx, req.(*SendMessageRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PlugConnector_GetUserMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMessagesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(PlugConnectorServer).GetUserMessages(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/PlugConnector/GetUserMessages",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(PlugConnectorServer).GetUserMessages(ctx, req.(*GetMessagesRequest))
}
return interceptor(ctx, in, info, handler)
}
// PlugConnector_ServiceDesc is the grpc.ServiceDesc for PlugConnector service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -271,14 +214,6 @@ var PlugConnector_ServiceDesc = grpc.ServiceDesc{
MethodName: "Ping",
Handler: _PlugConnector_Ping_Handler,
},
{
MethodName: "SendMessage",
Handler: _PlugConnector_SendMessage_Handler,
},
{
MethodName: "GetUserMessages",
Handler: _PlugConnector_GetUserMessages_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "plug.proto",

View File

@ -2,19 +2,37 @@ package otter
import (
"context"
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/database"
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/models"
"git.dragse.it/anthrove/otter-space-sdk/pkg/database"
)
func ConnectToDatabase(ctx context.Context, config models.DatabaseConfig) (database.OtterSpace, error) {
var otterSpace database.OtterSpace
func ConnectToGraphDatabase(ctx context.Context, endpoint string, username string, password string, debug bool) (database.OtterSpace, error) {
var graphConnection database.OtterSpace
var err error
otterSpace = database.NewPostgresqlConnection()
err = otterSpace.Connect(ctx, config)
graphConnection = database.NewGraphConnection(debug)
err = graphConnection.Connect(ctx, endpoint, username, password, "", 0, "", "")
if err != nil {
return nil, err
}
return otterSpace, err
return graphConnection, err
}
func ConnectToPostgresDatabase(ctx context.Context, endpoint string, username string, password string, databaseName string, port int, ssl bool, timezone string, debug bool) (database.OtterSpace, error) {
var graphConnection database.OtterSpace
var err error
var sslString string
graphConnection = database.NewPostgresqlConnection(debug)
if ssl {
sslString = "disable"
} else {
sslString = "require"
}
err = graphConnection.Connect(ctx, endpoint, username, password, databaseName, port, sslString, timezone)
if err != nil {
return nil, err
}
return graphConnection, err
}

View File

@ -2,13 +2,13 @@ package plug
import (
"context"
"git.dragse.it/anthrove/otter-space-sdk/pkg/database"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models/graphModels"
"google.golang.org/protobuf/types/known/timestamppb"
"log"
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/database"
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/models"
"google.golang.org/protobuf/types/known/timestamppb"
gRPC "git.dragse.it/anthrove/plug-sdk/v2/pkg/grpc"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models"
gRPC "git.dragse.it/anthrove/plug-sdk/pkg/grpc"
gonanoid "github.com/matoous/go-nanoid/v2"
)
@ -17,22 +17,18 @@ type server struct {
ctx map[string]context.CancelFunc
database database.OtterSpace
taskExecutionFunction TaskExecution
sendMessageExecution SendMessageExecution
getMessageExecution GetMessageExecution
}
func NewGrpcServer(database database.OtterSpace, taskExecutionFunction TaskExecution, sendMessageExecution SendMessageExecution, getMessageExecution GetMessageExecution) gRPC.PlugConnectorServer {
func NewGrpcServer(database database.OtterSpace, taskExecutionFunction TaskExecution) gRPC.PlugConnectorServer {
return &server{
ctx: make(map[string]context.CancelFunc),
database: database,
taskExecutionFunction: taskExecutionFunction,
sendMessageExecution: sendMessageExecution,
getMessageExecution: getMessageExecution,
}
}
func (s *server) TaskStart(ctx context.Context, creation *gRPC.PlugTaskCreation) (*gRPC.PlugTaskStatus, error) {
var anthroveUser models.User
var anthroveUser graphModels.AnthroveUser
var plugTaskState gRPC.PlugTaskStatus
var err error
@ -44,7 +40,7 @@ func (s *server) TaskStart(ctx context.Context, creation *gRPC.PlugTaskCreation)
plugTaskState.TaskId = id
plugTaskState.TaskState = gRPC.PlugTaskState_RUNNING
anthroveUser.ID = models.AnthroveUserID(creation.UserId)
anthroveUser.UserID = models.AnthroveUserID(creation.UserId)
// gRPC closes the context after the call ended. So the whole scrapping stopped without waiting
// by using this method we assign a new context to each new request we get.
@ -54,7 +50,7 @@ func (s *server) TaskStart(ctx context.Context, creation *gRPC.PlugTaskCreation)
go func() {
// FIXME: better implement this methode, works for now but needs refactoring
err := s.taskExecutionFunction(ctx, s.database, creation.UserSourceName, anthroveUser, creation.DeepScrape, creation.ApiKey, func() {
err := s.taskExecutionFunction(ctx, s.database, creation.UserSourceName, anthroveUser, creation.DeepScrape, func() {
s.removeTask(id)
})
if err != nil {
@ -106,35 +102,3 @@ func (s *server) Ping(_ context.Context, request *gRPC.PingRequest) (*gRPC.PongR
}
return &response, nil
}
func (s *server) SendMessage(ctx context.Context, request *gRPC.SendMessageRequest) (*gRPC.SendMessageResponse, error) {
messageResponse := gRPC.SendMessageResponse{Success: true}
err := s.sendMessageExecution(ctx, request.UserSourceId, request.UserSourceName, request.Message)
if err != nil {
return nil, err
}
return &messageResponse, nil
}
func (s *server) GetUserMessages(ctx context.Context, request *gRPC.GetMessagesRequest) (*gRPC.GetMessagesResponse, error) {
messageResponse := gRPC.GetMessagesResponse{}
messages, err := s.getMessageExecution(ctx, request.UserSourceId, request.UserSourceName)
if err != nil {
return nil, err
}
for _, message := range messages {
messageResponse.Messages = append(messageResponse.Messages, &gRPC.Message{
FromUserSourceId: request.UserSourceId,
FromUserSourceName: request.UserSourceName,
CreatedAt: message.CreatedAt,
Body: message.Body,
Title: message.Title,
})
}
return &messageResponse, nil
}

View File

@ -2,69 +2,44 @@ package plug
import (
"context"
"errors"
"fmt"
"log"
"git.dragse.it/anthrove/otter-space-sdk/pkg/database"
"git.dragse.it/anthrove/otter-space-sdk/pkg/models/graphModels"
"net"
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/database"
otterError "git.dragse.it/anthrove/otter-space-sdk/v2/pkg/error"
"git.dragse.it/anthrove/otter-space-sdk/v2/pkg/models"
"github.com/golang/protobuf/ptypes/timestamp"
pb "git.dragse.it/anthrove/plug-sdk/v2/pkg/grpc"
pb "git.dragse.it/anthrove/plug-sdk/pkg/grpc"
"google.golang.org/grpc"
)
type Message struct {
Title string
Body string
CreatedAt *timestamp.Timestamp
}
type TaskExecution func(ctx context.Context, graph database.OtterSpace, sourceUsername string, anthroveUser graphModels.AnthroveUser, deepScrape bool, cancelFunction func()) error
type TaskExecution func(ctx context.Context, database database.OtterSpace, userSourceUsername string, anthroveUser models.User, deepScrape bool, apiKey string, cancelFunction func()) error
type SendMessageExecution func(ctx context.Context, userSourceID string, userSourceUsername string, message string) error
type GetMessageExecution func(ctx context.Context, userSourceID string, userSourceUsername string) ([]Message, error)
type Plug struct {
type Server struct {
address string
port string
ctx context.Context
database database.OtterSpace
taskExecutionFunction TaskExecution
sendMessageExecution SendMessageExecution
getMessageExecution GetMessageExecution
source models.Source
}
func NewPlug(ctx context.Context, address string, port string, source models.Source) Plug {
return Plug{
func NewServer(ctx context.Context, address string, port string) Server {
return Server{
ctx: ctx,
address: address,
port: port,
source: source,
}
}
func (p *Plug) Listen() error {
func (s *Server) Listen() error {
var err error
log.Printf("initilazing source!")
err = p.database.CreateSource(p.ctx, &p.source)
if err != nil {
if !errors.Is(err, &otterError.NoDataWritten{}) {
log.Panic(err)
}
}
lis, err := net.Listen("tcp", fmt.Sprintf("%s:%s", p.address, p.port))
lis, err := net.Listen("tcp", fmt.Sprintf("%s:%s", s.address, s.port))
if err != nil {
return err
}
grpcServer := grpc.NewServer()
pb.RegisterPlugConnectorServer(grpcServer, NewGrpcServer(p.database, p.taskExecutionFunction, p.sendMessageExecution, p.getMessageExecution))
pb.RegisterPlugConnectorServer(grpcServer, NewGrpcServer(s.database, s.taskExecutionFunction))
err = grpcServer.Serve(lis)
if err != nil {
@ -74,18 +49,10 @@ func (p *Plug) Listen() error {
return nil
}
func (p *Plug) WithOtterSpace(graph database.OtterSpace) {
p.database = graph
func (s *Server) WithGraphConnection(graph database.OtterSpace) {
s.database = graph
}
func (p *Plug) TaskExecutionFunction(function TaskExecution) {
p.taskExecutionFunction = function
}
func (p *Plug) SendMessageExecution(function SendMessageExecution) {
p.sendMessageExecution = function
}
func (p *Plug) GetMessageExecution(function GetMessageExecution) {
p.getMessageExecution = function
func (s *Server) TaskExecutionFunction(function TaskExecution) {
s.taskExecutionFunction = function
}

View File

@ -7,9 +7,9 @@ To generate the gRPC files you need to do the following:
1. You need to install the [gRPC Compiler](https://grpc.io/docs/protoc-installation/)
2. Install the Golang Plugin for the compiler
````bash
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
``````
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
````
## Generate:
1. Download the Git submodules (if you didn't clone this repo with ``git clone --recurse-submodules``)
```bash

View File

@ -1,7 +1,5 @@
#!/bin/bash
export PATH="$PATH:$(go env GOPATH)/bin"
mkdir -p "pkg/grpc"
protoc \

@ -1 +1 @@
Subproject commit aa0ecfea7138f529f71fc7a13f7f887c0dcabcb2
Subproject commit f65839620ceccdbf5fe2bbc0769a8d5fecab348c