chore: update the module path in grpc proto file
Some checks failed
Go Tests / Run Tests (1.24.2) (push) Failing after 15m4s
Some checks failed
Go Tests / Run Tests (1.24.2) (push) Failing after 15m4s
This commit is contained in:
parent
86194e5daa
commit
7f825cae46
@ -16,7 +16,7 @@ This package provides a Go client for connecting to a Kevo database server. The
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go get github.com/jeremytregunna/kevo
|
go get github.com/KevoDB/kevo
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
@ -29,48 +29,48 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/jeremytregunna/kevo/pkg/client"
|
"github.com/KevoDB/kevo/pkg/client"
|
||||||
_ "github.com/jeremytregunna/kevo/pkg/grpc/transport" // Register gRPC transport
|
_ "github.com/KevoDB/kevo/pkg/grpc/transport" // Register gRPC transport
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Create a client with default options
|
// Create a client with default options
|
||||||
options := client.DefaultClientOptions()
|
options := client.DefaultClientOptions()
|
||||||
options.Endpoint = "localhost:50051"
|
options.Endpoint = "localhost:50051"
|
||||||
|
|
||||||
c, err := client.NewClient(options)
|
c, err := client.NewClient(options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to create client: %v", err)
|
log.Fatalf("Failed to create client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to the server
|
// Connect to the server
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
if err := c.Connect(ctx); err != nil {
|
if err := c.Connect(ctx); err != nil {
|
||||||
log.Fatalf("Failed to connect: %v", err)
|
log.Fatalf("Failed to connect: %v", err)
|
||||||
}
|
}
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
// Basic key-value operations
|
// Basic key-value operations
|
||||||
key := []byte("hello")
|
key := []byte("hello")
|
||||||
value := []byte("world")
|
value := []byte("world")
|
||||||
|
|
||||||
// Store a value
|
// Store a value
|
||||||
if _, err := c.Put(ctx, key, value, true); err != nil {
|
if _, err := c.Put(ctx, key, value, true); err != nil {
|
||||||
log.Fatalf("Put failed: %v", err)
|
log.Fatalf("Put failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve a value
|
// Retrieve a value
|
||||||
val, found, err := c.Get(ctx, key)
|
val, found, err := c.Get(ctx, key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Get failed: %v", err)
|
log.Fatalf("Get failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if found {
|
if found {
|
||||||
fmt.Printf("Value: %s\n", val)
|
fmt.Printf("Value: %s\n", val)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Key not found")
|
fmt.Println("Key not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a value
|
// Delete a value
|
||||||
if _, err := c.Delete(ctx, key, true); err != nil {
|
if _, err := c.Delete(ctx, key, true); err != nil {
|
||||||
log.Fatalf("Delete failed: %v", err)
|
log.Fatalf("Delete failed: %v", err)
|
||||||
@ -90,20 +90,20 @@ options := client.ClientOptions{
|
|||||||
RequestTimeout: 10 * time.Second,
|
RequestTimeout: 10 * time.Second,
|
||||||
TransportType: "grpc",
|
TransportType: "grpc",
|
||||||
PoolSize: 5,
|
PoolSize: 5,
|
||||||
|
|
||||||
// Security options
|
// Security options
|
||||||
TLSEnabled: true,
|
TLSEnabled: true,
|
||||||
CertFile: "/path/to/cert.pem",
|
CertFile: "/path/to/cert.pem",
|
||||||
KeyFile: "/path/to/key.pem",
|
KeyFile: "/path/to/key.pem",
|
||||||
CAFile: "/path/to/ca.pem",
|
CAFile: "/path/to/ca.pem",
|
||||||
|
|
||||||
// Retry options
|
// Retry options
|
||||||
MaxRetries: 3,
|
MaxRetries: 3,
|
||||||
InitialBackoff: 100 * time.Millisecond,
|
InitialBackoff: 100 * time.Millisecond,
|
||||||
MaxBackoff: 2 * time.Second,
|
MaxBackoff: 2 * time.Second,
|
||||||
BackoffFactor: 1.5,
|
BackoffFactor: 1.5,
|
||||||
RetryJitter: 0.2,
|
RetryJitter: 0.2,
|
||||||
|
|
||||||
// Performance options
|
// Performance options
|
||||||
Compression: client.CompressionGzip,
|
Compression: client.CompressionGzip,
|
||||||
MaxMessageSize: 16 * 1024 * 1024, // 16MB
|
MaxMessageSize: 16 * 1024 * 1024, // 16MB
|
||||||
@ -223,4 +223,4 @@ success, err := client.Compact(ctx, false) // force=false
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Compaction failed: %v", err)
|
log.Fatalf("Compaction failed: %v", err)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -2,35 +2,35 @@ syntax = "proto3";
|
|||||||
|
|
||||||
package kevo;
|
package kevo;
|
||||||
|
|
||||||
option go_package = "github.com/jeremytregunna/kevo/pkg/grpc/proto;proto";
|
option go_package = "github.com/KevoDB/kevo/pkg/grpc/proto;proto";
|
||||||
|
|
||||||
service KevoService {
|
service KevoService {
|
||||||
// Key-Value Operations
|
// Key-Value Operations
|
||||||
rpc Get(GetRequest) returns (GetResponse);
|
rpc Get(GetRequest) returns (GetResponse);
|
||||||
rpc Put(PutRequest) returns (PutResponse);
|
rpc Put(PutRequest) returns (PutResponse);
|
||||||
rpc Delete(DeleteRequest) returns (DeleteResponse);
|
rpc Delete(DeleteRequest) returns (DeleteResponse);
|
||||||
|
|
||||||
// Batch Operations
|
// Batch Operations
|
||||||
rpc BatchWrite(BatchWriteRequest) returns (BatchWriteResponse);
|
rpc BatchWrite(BatchWriteRequest) returns (BatchWriteResponse);
|
||||||
|
|
||||||
// Iterator Operations
|
// Iterator Operations
|
||||||
rpc Scan(ScanRequest) returns (stream ScanResponse);
|
rpc Scan(ScanRequest) returns (stream ScanResponse);
|
||||||
|
|
||||||
// Transaction Operations
|
// Transaction Operations
|
||||||
rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse);
|
rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse);
|
||||||
rpc CommitTransaction(CommitTransactionRequest) returns (CommitTransactionResponse);
|
rpc CommitTransaction(CommitTransactionRequest) returns (CommitTransactionResponse);
|
||||||
rpc RollbackTransaction(RollbackTransactionRequest) returns (RollbackTransactionResponse);
|
rpc RollbackTransaction(RollbackTransactionRequest) returns (RollbackTransactionResponse);
|
||||||
|
|
||||||
// Transaction Operations within an active transaction
|
// Transaction Operations within an active transaction
|
||||||
rpc TxGet(TxGetRequest) returns (TxGetResponse);
|
rpc TxGet(TxGetRequest) returns (TxGetResponse);
|
||||||
rpc TxPut(TxPutRequest) returns (TxPutResponse);
|
rpc TxPut(TxPutRequest) returns (TxPutResponse);
|
||||||
rpc TxDelete(TxDeleteRequest) returns (TxDeleteResponse);
|
rpc TxDelete(TxDeleteRequest) returns (TxDeleteResponse);
|
||||||
rpc TxScan(TxScanRequest) returns (stream TxScanResponse);
|
rpc TxScan(TxScanRequest) returns (stream TxScanResponse);
|
||||||
|
|
||||||
// Administrative Operations
|
// Administrative Operations
|
||||||
rpc GetStats(GetStatsRequest) returns (GetStatsResponse);
|
rpc GetStats(GetStatsRequest) returns (GetStatsResponse);
|
||||||
rpc Compact(CompactRequest) returns (CompactResponse);
|
rpc Compact(CompactRequest) returns (CompactResponse);
|
||||||
|
|
||||||
// Replication and Topology Operations
|
// Replication and Topology Operations
|
||||||
rpc GetNodeInfo(GetNodeInfoRequest) returns (GetNodeInfoResponse);
|
rpc GetNodeInfo(GetNodeInfoRequest) returns (GetNodeInfoResponse);
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ message GetStatsResponse {
|
|||||||
int32 sstable_count = 4;
|
int32 sstable_count = 4;
|
||||||
double write_amplification = 5;
|
double write_amplification = 5;
|
||||||
double read_amplification = 6;
|
double read_amplification = 6;
|
||||||
|
|
||||||
// Operation counts
|
// Operation counts
|
||||||
map<string, uint64> operation_counts = 7;
|
map<string, uint64> operation_counts = 7;
|
||||||
// Latency statistics
|
// Latency statistics
|
||||||
@ -214,7 +214,7 @@ message CompactResponse {
|
|||||||
bool success = 1;
|
bool success = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Node information and topology
|
// Node information and topology
|
||||||
message GetNodeInfoRequest {
|
message GetNodeInfoRequest {
|
||||||
// No parameters needed for now
|
// No parameters needed for now
|
||||||
}
|
}
|
||||||
@ -227,11 +227,11 @@ message GetNodeInfoResponse {
|
|||||||
REPLICA = 2;
|
REPLICA = 2;
|
||||||
}
|
}
|
||||||
NodeRole node_role = 1;
|
NodeRole node_role = 1;
|
||||||
|
|
||||||
// Connection information
|
// Connection information
|
||||||
string primary_address = 2; // Empty if standalone
|
string primary_address = 2; // Empty if standalone
|
||||||
repeated ReplicaInfo replicas = 3; // Empty if standalone
|
repeated ReplicaInfo replicas = 3; // Empty if standalone
|
||||||
|
|
||||||
// Node status
|
// Node status
|
||||||
uint64 last_sequence = 4; // Last applied sequence number
|
uint64 last_sequence = 4; // Last applied sequence number
|
||||||
bool read_only = 5; // Whether the node is in read-only mode
|
bool read_only = 5; // Whether the node is in read-only mode
|
||||||
@ -243,4 +243,4 @@ message ReplicaInfo {
|
|||||||
bool available = 3; // Whether the replica is available
|
bool available = 3; // Whether the replica is available
|
||||||
string region = 4; // Optional region information
|
string region = 4; // Optional region information
|
||||||
map<string, string> meta = 5; // Additional metadata
|
map<string, string> meta = 5; // Additional metadata
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user