Clean up docs

This commit is contained in:
Viktor Lofgren 2024-02-22 19:37:59 +01:00
parent 4740156cfa
commit 8d4ef982d0
3 changed files with 30 additions and 23 deletions

View File

@ -28,11 +28,22 @@ services:
```java
// Register one or more services
registry.registerService(ApiSchema.GRPC,
ServiceId.Test,
nodeId,
instanceUUID, //must be unique to the runtime
"127.0.0.1"); // bind-address
serviceRegistry.registerService(
ServiceKey.forRest(serviceId, nodeId),
instanceUuid, // unique
externalAddress); // 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)
```
@ -40,9 +51,7 @@ Then, the caller must announce their instance. Before this is done,
the service is not discoverable.
```java
registry.announceInstance(ServiceId.Test,
nodeId,
instanceUUID);
registry.announceInstance(instanceUUID);
```
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:
```java
Set<InstanceAddress<?>> endpoints = registry.getEndpoints(ApiSchema.GRPC, ServiceId.Test, nodeId);
for (var endpoint : endpoints) {
System.out.println(endpoint.getHost() + ":" + endpoint.getPort());
}
Set<InstanceAddress> endpoints = registry.getEndpoints(serviceKey);
```
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()`.
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
* [ServiceRegistryIf](src/main/java/nu/marginalia/service/discovery/ServiceRegistryIf.java)

View File

@ -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.
## Main Classes
## Central Classes
* [QueryService](src/main/java/nu/marginalia/query/QueryService.java) - The REST service implementation
* [QueryGRPCService](src/main/java/nu/marginalia/query/QueryGRPCService.java) - The GRPC service implementation
This module is almost entirely boilerplate, except the [QueryBasicInterface](src/main/java/nu/marginalia/query/QueryBasicInterface.java)
class, which offers a REST API for querying the index.
## See Also
* [api/query-api](../../api/query-api)
* [features-qs/query-parser](../../features-qs/query-parser)
* [features-index/index-query](../../features-index/index-query)
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.

View File

@ -65,8 +65,6 @@ include 'code:features-crawl:crawl-blocklist'
include 'code:features-crawl:link-parser'
include 'code:features-crawl:content-type'
include 'code:api:index-api'
include 'code:api:process-mqapi'
include 'code:api:executor-api'