Skip to content
Closed

V1 #63

Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
23b7a08
wip: update
raksiv Feb 14, 2024
625b191
wip resources namespace.
tjholm Feb 14, 2024
7357406
wip topics
jyecusch Feb 14, 2024
a270b37
wip: secrets
raksiv Feb 14, 2024
b8f71f2
wip: workers and schedule workers
HomelessDinosaur Feb 15, 2024
2b0b6c7
working schedule implementation
HomelessDinosaur Feb 16, 2024
d0b3ac0
wip: update proto and implement other workers
HomelessDinosaur Feb 16, 2024
c98749c
add kv stores, update topics, secrets, storage, and queues. Update tests
HomelessDinosaur Feb 19, 2024
b4999c2
add kv store tests
HomelessDinosaur Feb 19, 2024
4b46828
add worker graceful exiting
HomelessDinosaur Feb 27, 2024
5cc3e83
stop attempting response to registration request
HomelessDinosaur Feb 28, 2024
df0bb8e
add license files
HomelessDinosaur Feb 28, 2024
d44609d
update websocket tests
HomelessDinosaur Feb 28, 2024
bb24115
wip improve testing
HomelessDinosaur Mar 19, 2024
7f3c732
update proto, tests, and API interface
HomelessDinosaur Apr 24, 2024
4f3f6b4
wip: issues with api.route("/test");
raksiv Mar 12, 2024
33e1331
add middlewares when creating api route
HomelessDinosaur Mar 13, 2024
a114a1a
minor fix to route.all
raksiv Mar 13, 2024
8c4b8d7
Fix/routes (#64)
raksiv Jul 11, 2024
a2a03ed
add sql support
HomelessDinosaur Feb 27, 2025
9dc3246
add batch resources
HomelessDinosaur Mar 5, 2025
c7cce17
add generic to batch jobs
HomelessDinosaur Mar 6, 2025
f6901c5
remove API overloads with params to reduce typing issues
HomelessDinosaur Mar 7, 2025
b1c5b47
fix the order that middleware is executed.
raksiv Mar 10, 2025
c055263
fix route.all by assigning correct HttpMethods
raksiv Mar 10, 2025
5258030
remove wrapper clients
HomelessDinosaur Mar 31, 2025
a0a81ad
format fix and update workflow files
HomelessDinosaur Apr 2, 2025
8208b5c
update tests
HomelessDinosaur Apr 2, 2025
69fd9f0
add to string and test cases, as well as job worker tests
HomelessDinosaur Apr 2, 2025
c916c7f
add missing license headers
HomelessDinosaur Apr 2, 2025
da5d71c
format
HomelessDinosaur Apr 2, 2025
f56f12c
remove synchronous code for API routes and resource calls
HomelessDinosaur Apr 7, 2025
c3d75c3
remove onmessage, onconnect, and ondisconnect from websocket
HomelessDinosaur Apr 8, 2025
bcfc507
remove all synchronous tests
HomelessDinosaur Apr 9, 2025
885b9f7
stop versioning proto files
HomelessDinosaur Apr 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,5 @@ ASALocalRun/
**/obj/
**/bin/
.idea
.vs
.vs
dotCover.*
35 changes: 23 additions & 12 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
.PHONY: test

# the version of of https://github.com/nitrictech/nitric to use in base client generation.
NITRIC_VERSION := 0.33.0
NITRIC_VERSION := 1.17.0

generate: clean download build

test:
dotnet test tests/Nitric.Sdk.Test
@dotnet test test/Nitric.Sdk.Test

build:
dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj
@dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj
@mv src/Nitric.Sdk/Proto/nitric/proto/* src/Nitric.Sdk/Proto/
@rm -rf nitric
@rm -rf src/Nitric.Sdk/Proto/nitric

clean:
rm -rf src/Nitric.Sdk/bin
rm -rf src/Nitric.Sdk/obj
rm -rf src/Nitric.Sdk/Proto
@rm -rf src/Nitric.Sdk/bin
@rm -rf src/Nitric.Sdk/obj
@rm -rf src/Nitric.Sdk/Proto

download:
curl -L https://github.com/nitrictech/nitric/releases/download/v${NITRIC_VERSION}/contracts.tgz -o contracts.tgz
tar xvzf contracts.tgz
rm contracts.tgz
@curl -L https://github.com/nitrictech/nitric/releases/download/v${NITRIC_VERSION}/proto.tgz -o nitric.tgz
@tar xvzf nitric.tgz
@rm nitric.tgz

pack: clean download
dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj -c Release
mkdir -p __out
dotnet pack -c Release -o __out
@dotnet build src/Nitric.Sdk/Nitric.Sdk.csproj -c Release
@mkdir -p __out
@dotnet pack -c Release -o __out

coverage:
@echo "Using dotcover tool... Install using: 'dotnet tool install --global JetBrains.dotCover.GlobalTool'"
@rm -f coverage.xml dotCover.Output.html
@dotnet dotcover test --dcReportType=HTML --dcFilters="+:Nitric.Sdk;-:type=Nitric.Proto.*"
@open dotCover.Output.html
120 changes: 120 additions & 0 deletions nitric/proto/apis/v1/apis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
syntax = "proto3";
package nitric.proto.apis.v1;

// protoc plugin options for code generation
option go_package = "github.com/nitrictech/nitric/core/pkg/proto/apis/v1;apispb";
option java_package = "io.nitric.proto.apis.v1";
option java_multiple_files = true;
option java_outer_classname = "ApisService";
option php_namespace = "Nitric\\Proto\\Apis\\V1";
option csharp_namespace = "Nitric.Proto.Apis.v1";

// Service for API routing and handlers
service Api {
// Serve a route on an API
rpc Serve(stream ClientMessage) returns (stream ServerMessage);

// Retrieve details about an API
rpc ApiDetails(ApiDetailsRequest) returns (ApiDetailsResponse);
}

message ApiDetailsRequest {
string api_name = 1;
}

message ApiDetailsResponse {
string url = 1;
}

// ClientMessage sent by the service to the nitric server
message ClientMessage {
// globally unique ID of the request/response pair
string id = 1;

oneof content {
// Register an API route handler
RegistrationRequest registration_request = 2;

// Response to an HTTP request
HttpResponse http_response = 3;
}
}

message HeaderValue {
repeated string value = 1;
}

message QueryValue {
repeated string value = 1;
}

message HttpRequest {
// The request method
string method = 1;

// The path of the request
string path = 2;

// HTTP request headers
map<string, HeaderValue> headers = 3;

// HTTP Query params
map<string, QueryValue> query_params = 4;

// HTTP Path parameters
map<string, string> path_params = 5;

// HTTP Request body
bytes body = 6;
}

// HttpResponseMessage
message HttpResponse {
// The HTTP response status code
int32 status = 1;

// HTTP response headers
map<string, HeaderValue> headers = 2;

// HTTP response body
bytes body = 3;
}

// ServerMessage sent by the nitric server to the service
message ServerMessage {
// globally unique ID of the request/response pair
string id = 1;

oneof content {
// Response to an API serve request
RegistrationResponse registration_response = 2;

// HTTP request to be routed to the service (handler)
HttpRequest http_request = 3;
}
}

message RegistrationResponse {
}

message ApiWorkerScopes {
repeated string scopes = 1;
}

message ApiWorkerOptions {
// Apply security definitions to this operation
// This will be mapped to named ApiSecurityDefinitionResource(s)
map<string, ApiWorkerScopes> security = 1;
// explicitly disable security for this endpoint
// We need to do this as the default value of a repeated field
// is always empty so there is no way of knowing if security is explicitly
// disabled
bool security_disabled = 2;
}

message RegistrationRequest {
string api = 1;
string path = 2;
repeated string methods = 3;
ApiWorkerOptions options = 4;
}
96 changes: 96 additions & 0 deletions nitric/proto/batch/v1/batch.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
syntax = "proto3";
package nitric.proto.batch.v1;

import "google/protobuf/struct.proto";

// protoc plugin options for code generation
option go_package = "github.com/nitrictech/nitric/core/pkg/proto/batch/v1;batchpb";
option java_package = "io.nitric.proto.batch.v1";
option java_multiple_files = true;
option java_outer_classname = "BatchService";
option php_namespace = "Nitric\\Proto\\Batch\\V1";
option csharp_namespace = "Nitric.Proto.Batch.v1";

// Service for processing jobs
service Job {
rpc HandleJob(stream ClientMessage) returns (stream ServerMessage);
}

// Service for submitting jobs to be processed
service Batch {
rpc SubmitJob(JobSubmitRequest) returns (JobSubmitResponse);
}

message ClientMessage {
// globally unique ID of the request/response pair
string id = 1;

oneof content {
// Register a handler for a job
RegistrationRequest registration_request = 2;

// Handle a job submission
JobResponse job_response = 3;
}
}

message JobRequest {
string job_name = 1;

JobData data = 2;
}

message JobData {
oneof data {
google.protobuf.Struct struct = 1;
}
}

message JobResponse {
// Mark if the job was successfully processed
bool success = 1;
}

message RegistrationRequest {
string job_name = 1;

// Register with default requirements
JobResourceRequirements requirements = 2;
}

message RegistrationResponse {
}

message JobResourceRequirements {
// The number of CPUs to allocate for the job
float cpus = 1;
// The amount of memory to allocate for the job
int64 memory = 2;
// The number of GPUs to allocate for the job
int64 gpus = 3;
}

// ServerMessage is the message sent from the nitric server to the service
message ServerMessage {
// globally unique ID of the request/response pair
string id = 1;

oneof content {
//
RegistrationResponse registration_response = 2;

// Request to a job handler
JobRequest job_request = 3;
}
}

message JobSubmitRequest {
// The name of the job that should handle the data
string job_name = 1;

// The data to be processed by the job
JobData data = 2;
}

message JobSubmitResponse {
}
Loading
Loading