mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
Clean up docs
This commit is contained in:
parent
4740156cfa
commit
8d4ef982d0
@ -28,11 +28,22 @@ services:
|
|||||||
|
|
||||||
```java
|
```java
|
||||||
// Register one or more services
|
// Register one or more services
|
||||||
registry.registerService(ApiSchema.GRPC,
|
serviceRegistry.registerService(
|
||||||
ServiceId.Test,
|
ServiceKey.forRest(serviceId, nodeId),
|
||||||
nodeId,
|
instanceUuid, // unique
|
||||||
instanceUUID, //must be unique to the runtime
|
externalAddress); // bind-address
|
||||||
"127.0.0.1"); // bind-address
|
|
||||||
|
// Non-partitioned GRPC service
|
||||||
|
serviceRegistry.registerService(
|
||||||
|
ServiceKey.forServiceDescriptor(descriptor, ServicePartition.any()),
|
||||||
|
instanceUuid,
|
||||||
|
externalAddress);
|
||||||
|
|
||||||
|
// Partitioned GRPC service
|
||||||
|
serviceRegistry.registerService(
|
||||||
|
ServiceKey.forServiceDescriptor(descriptor, ServicePartition.partition(5)),
|
||||||
|
instanceUuid,
|
||||||
|
externalAddress);
|
||||||
// (+ any other services)
|
// (+ any other services)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -40,9 +51,7 @@ Then, the caller must announce their instance. Before this is done,
|
|||||||
the service is not discoverable.
|
the service is not discoverable.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
registry.announceInstance(ServiceId.Test,
|
registry.announceInstance(instanceUUID);
|
||||||
nodeId,
|
|
||||||
instanceUUID);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
All of this is done automatically by the `Service` base class
|
All of this is done automatically by the `Service` base class
|
||||||
@ -51,16 +60,19 @@ in the [service](../service/) module.
|
|||||||
To discover a service, the caller can query the registry:
|
To discover a service, the caller can query the registry:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
Set<InstanceAddress<?>> endpoints = registry.getEndpoints(ApiSchema.GRPC, ServiceId.Test, nodeId);
|
Set<InstanceAddress> endpoints = registry.getEndpoints(serviceKey);
|
||||||
|
|
||||||
for (var endpoint : endpoints) {
|
|
||||||
System.out.println(endpoint.getHost() + ":" + endpoint.getPort());
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
It's also possible to subscribe to changes in the registry, so that
|
It's also possible to subscribe to changes in the registry, so that
|
||||||
the caller can be notified when a service comes or goes, with `registry.registerMonitor()`.
|
the caller can be notified when a service comes or goes, with `registry.registerMonitor()`.
|
||||||
|
|
||||||
|
However the `GrpcChannelPoolFactory` is a more convenient way to access the services,
|
||||||
|
it will let the caller create a pool of channels to the services, and manage their
|
||||||
|
lifecycle, listen to lifecycle notifications and so on.
|
||||||
|
|
||||||
|
The ChannelPools exist in two flavors, one for partitioned services, and one for non-partitioned services.
|
||||||
|
|
||||||
|
|
||||||
### Central Classes
|
### Central Classes
|
||||||
|
|
||||||
* [ServiceRegistryIf](src/main/java/nu/marginalia/service/discovery/ServiceRegistryIf.java)
|
* [ServiceRegistryIf](src/main/java/nu/marginalia/service/discovery/ServiceRegistryIf.java)
|
||||||
|
@ -13,13 +13,10 @@ specific stuff. This mode of operations is available through a `barebones` inst
|
|||||||
|
|
||||||
The web interface also offers a JSON API for machine-based queries.
|
The web interface also offers a JSON API for machine-based queries.
|
||||||
|
|
||||||
## Main Classes
|
## Central Classes
|
||||||
|
|
||||||
* [QueryService](src/main/java/nu/marginalia/query/QueryService.java) - The REST service implementation
|
This module is almost entirely boilerplate, except the [QueryBasicInterface](src/main/java/nu/marginalia/query/QueryBasicInterface.java)
|
||||||
* [QueryGRPCService](src/main/java/nu/marginalia/query/QueryGRPCService.java) - The GRPC service implementation
|
class, which offers a REST API for querying the index.
|
||||||
|
|
||||||
## See Also
|
Much of the guts of the query service are in the [query-service](../../functions/search-query)
|
||||||
|
module; which offers query parsing and an interface to the index service partitions.
|
||||||
* [api/query-api](../../api/query-api)
|
|
||||||
* [features-qs/query-parser](../../features-qs/query-parser)
|
|
||||||
* [features-index/index-query](../../features-index/index-query)
|
|
||||||
|
@ -65,8 +65,6 @@ include 'code:features-crawl:crawl-blocklist'
|
|||||||
include 'code:features-crawl:link-parser'
|
include 'code:features-crawl:link-parser'
|
||||||
include 'code:features-crawl:content-type'
|
include 'code:features-crawl:content-type'
|
||||||
|
|
||||||
|
|
||||||
include 'code:api:index-api'
|
|
||||||
include 'code:api:process-mqapi'
|
include 'code:api:process-mqapi'
|
||||||
include 'code:api:executor-api'
|
include 'code:api:executor-api'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user