syntax = "proto3";
package vectordb;
// Option for proper file generation
option go_package = "github.com/your-username/vectordb-proto/vectordb";
option java_multiple_files = true;
option java_package = "com.vectordb";
option java_outer_classname = "VectorDBProto";
// === Service Definitions ===
service VectorDBService {
// Server information
rpc GetServerInfo(Empty) returns (ServerInfo);
// Collection Management
rpc CreateCollection(CreateCollectionRequest) returns (StatusResponse);
rpc ListCollections(Empty) returns (ListCollectionsResponse);
rpc DeleteCollection(CollectionRequest) returns (StatusResponse);
// Simple Indexing
rpc IndexFiles(IndexFilesRequest) returns (IndexResponse);
rpc QueryCollection(QueryRequest) returns (QueryResponse);
rpc ClearCollection(CollectionRequest) returns (StatusResponse);
// Repository Management
rpc AddRepository(AddRepositoryRequest) returns (StatusResponse);
rpc ListRepositories(Empty) returns (ListRepositoriesResponse);
rpc UseRepository(RepositoryRequest) returns (StatusResponse);
rpc RemoveRepository(RemoveRepositoryRequest) returns (StatusResponse);
rpc SyncRepository(SyncRepositoryRequest) returns (StatusResponse);
rpc UseBranch(UseBranchRequest) returns (StatusResponse);
}
// === Message Definitions ===
// Common messages
message Empty {}
message ServerInfo {
string version = 1;
string build_date = 2;
bool is_healthy = 3;
ModelInfo model_info = 4;
}
message ModelInfo {
string model_path = 1;
string tokenizer_path = 2;
int32 vector_dimension = 3;
string model_type = 4;
}
message StatusResponse {
bool success = 1;
string message = 2;
}
// Collection management messages
message CreateCollectionRequest {
string name = 1;
int32 vector_size = 2;
string distance = 3; // "cosine", "euclidean", "dot"
}
message CollectionRequest {
string name = 1;
}
message ListCollectionsResponse {
repeated string collections = 1;
}
// Simple indexing messages
message IndexFilesRequest {
repeated string paths = 1;
repeated string extensions = 2; // Optional file extensions to filter
string collection_name = 3;
}
message IndexResponse {
bool success = 1;
string message = 2;
int32 indexed_files = 3;
int32 indexed_chunks = 4;
}
// Query messages
message QueryRequest {
string query_text = 1;
string collection_name = 2;
int32 limit = 3;
optional string language = 4;
optional string element_type = 5;
}
message SearchResult {
string file_path = 1;
int32 start_line = 2;
int32 end_line = 3;
string language = 4;
string element_type = 5;
string content = 6;
float score = 7;
optional string branch = 8;
optional string commit_hash = 9;
}
message QueryResponse {
repeated SearchResult results = 1;
int32 total_results = 2;
float query_time_ms = 3;
}
// Repository management messages
message AddRepositoryRequest {
string url = 1;
optional string local_path = 2;
optional string name = 3;
optional string branch = 4;
optional string remote = 5;
optional string ssh_key_path = 6;
optional string ssh_passphrase = 7;
}
message RepositoryInfo {
string name = 1;
string url = 2;
string local_path = 3;
string default_branch = 4;
string active_branch = 5;
repeated string tracked_branches = 6;
repeated string indexed_languages = 7;
bool is_active = 8;
}
message ListRepositoriesResponse {
repeated RepositoryInfo repositories = 1;
optional string active_repository = 2;
}
message RepositoryRequest {
string name = 1;
}
message RemoveRepositoryRequest {
string name = 1;
bool skip_confirmation = 2;
}
message SyncRepositoryRequest {
optional string name = 1;
repeated string extensions = 2;
bool force = 3;
}
message UseBranchRequest {
string branch_name = 1;
optional string repository_name = 2;
}