syntax = "proto3";

package nidx;

import "nidx_protos/nodereader.proto";
import "nidx_protos/nodewriter.proto";

service NidxApi {
  rpc GetShard(nodereader.GetShardRequest) returns (noderesources.Shard) {}

  rpc NewShard(nodewriter.NewShardRequest) returns (noderesources.ShardCreated) {}
  rpc DeleteShard(noderesources.ShardId) returns (noderesources.ShardId) {}
  rpc ListShards(noderesources.EmptyQuery) returns (noderesources.ShardIds) {}

  rpc AddVectorSet(nodewriter.NewVectorSetRequest) returns (nodewriter.OpStatus) {}
  rpc RemoveVectorSet(noderesources.VectorSetID) returns (nodewriter.OpStatus) {}
  rpc ListVectorSets(noderesources.ShardId) returns (noderesources.VectorSetList) {}
}

service NidxSearcher {
  rpc Search(nodereader.SearchRequest) returns (nodereader.SearchResponse) {}
  rpc GraphSearch(nodereader.GraphSearchRequest) returns (nodereader.GraphSearchResponse) {}
  rpc Suggest(nodereader.SuggestRequest) returns (nodereader.SuggestResponse) {}

  // Streams
  rpc Paragraphs(nodereader.StreamRequest) returns (stream nodereader.ParagraphItem) {}
  rpc Documents(nodereader.StreamRequest) returns (stream nodereader.DocumentItem) {}
}

service NidxIndexer {
  rpc Index(nodewriter.IndexMessage) returns (nodewriter.OpStatus) {}
}

// This is a subset from writer.proto, with the things we need for notifications
message Notification {
    string uuid = 3;
    string kbid = 4;
    int64 seqid = 5;
    enum Action {
        COMMIT = 0;
        ABORT = 1;
        INDEXED = 2;
    }
    Action action = 6;
}
