Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Server\Spi; |
| 6 | |
| 7 | use DateTimeImmutable; |
| 8 | use LambdaTwelve\OneRecord\Api\Subscription; |
| 9 | use LambdaTwelve\OneRecord\Api\TopicType; |
| 10 | use LambdaTwelve\OneRecord\Rdf\Iri; |
| 11 | |
| 12 | /** |
| 13 | * Both sides of publish/subscribe. As publisher: the accepted subscription |
| 14 | * requests that make partners subscribers of this server's objects. As |
| 15 | * subscriber: the subscriptions this host wants to offer when a partner asks |
| 16 | * GET /subscriptions?topicType&topic. |
| 17 | */ |
| 18 | interface SubscriptionStore |
| 19 | { |
| 20 | /** |
| 21 | * Accepted, unexpired subscriptions covering an object, with the action |
| 22 | * request each came from (notifications reference it in isTriggeredBy). |
| 23 | * |
| 24 | * @param list<string> $types class IRIs of the object |
| 25 | * @return list<array{subscription: Subscription, request: Iri}> |
| 26 | */ |
| 27 | public function subscribersOf(Iri $logisticsObject, array $types, DateTimeImmutable $now): array; |
| 28 | |
| 29 | /** |
| 30 | * What this host answers when asked for its subscription information. |
| 31 | * |
| 32 | * @return list<Subscription> |
| 33 | */ |
| 34 | public function offered(TopicType $topicType, string $topic): array; |
| 35 | |
| 36 | /** |
| 37 | * Registers a subscription this host wants, to be answered by offered(). |
| 38 | */ |
| 39 | public function offer(Subscription $subscription): void; |
| 40 | |
| 41 | /** |
| 42 | * Removes an offer with the same subscriber, topic type and topic. |
| 43 | */ |
| 44 | public function withdraw(Subscription $subscription): void; |
| 45 | } |