-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Make use of new "async" RPC #36
Conversation
WalkthroughThe updates introduce asynchronous caching capabilities to the project by adding the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AsyncCache
participant AsyncRPCInterface
participant Storage
Client->>AsyncCache: setAsync(key, value, ttl)
AsyncCache->>AsyncRPCInterface: request set operation
AsyncRPCInterface->>Storage: set key-value pair
Storage-->>AsyncRPCInterface: confirmation
AsyncRPCInterface-->>AsyncCache: confirmation
AsyncCache-->>Client: operation result
Client->>AsyncCache: getAsync(key)
AsyncCache->>AsyncRPCInterface: request get operation
AsyncRPCInterface->>Storage: get key-value pair
Storage-->>AsyncRPCInterface: key-value pair
AsyncRPCInterface-->>AsyncCache: key-value pair
AsyncCache-->>Client: key-value pair
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.x #36 +/- ##
==============================================
- Coverage 100.00% 88.16% -11.84%
- Complexity 61 69 +8
==============================================
Files 6 6
Lines 149 169 +20
==============================================
Hits 149 149
- Misses 0 20 +20 ☔ View full report in Codecov by Sentry. |
Hey @rustatian, sorry I've been kinda busy as I'm currently hunting for a new apartment and my workplace is in a complete overhaul. There shouldn't be anything left to do here (and it's already in use) but lmk if there's any issues and I'll try to fix them |
Hey @L3tum 👋 Glad to hear you 👍 |
chore: Update goridge dependency
Hey @rustatian / @msmakouz , PR is fixed now and I've upped the required version for goridge to 4.2 (which is the first version that has the async changes). It could be made to work with prior versions by moving the usings I think, so lmk if it's okay with you with how it is right now or if it needs to be changed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (10)
- composer.json (1 hunks)
- src/AsyncCache.php (1 hunks)
- src/AsyncStorageInterface.php (1 hunks)
- src/Cache.php (6 hunks)
- src/Factory.php (2 hunks)
- tests/AsyncCacheTest.php (1 hunks)
- tests/FactoryTest.php (2 hunks)
- tests/Stub/AsyncFrozenDateCacheStub.php (1 hunks)
- tests/Stub/AsyncRPCConnectionStub.php (1 hunks)
- tests/TestCase.php (2 hunks)
Files not reviewed due to errors (2)
- src/AsyncCache.php (no review received)
- src/Cache.php (no review received)
Additional context used
PHPStan
tests/Stub/AsyncFrozenDateCacheStub.php
12-12: Class Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncFrozenDateCacheStub extends unknown class Spiral\RoadRunner\KeyValue\AsyncCache.
18-18: Parameter $rpc of method Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncFrozenDateCacheStub::__construct() has invalid type Spiral\Goridge\RPC\AsyncRPCInterface.
20-20: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
20-20: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncFrozenDateCacheStub::__construct() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
24-24: Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncFrozenDateCacheStub::__construct() calls parent::__construct() but Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncFrozenDateCacheStub does not extend any class.
tests/TestCase.php
11-11: Class Spiral\RoadRunner\KeyValue\Tests\TestCase extends unknown class PHPUnit\Framework\TestCase.
17-17: Method Spiral\RoadRunner\KeyValue\Tests\TestCase::rpc() has invalid return type Spiral\RoadRunner\KeyValue\Tests\Stub\RPCConnectionStub.
19-19: Instantiated class Spiral\RoadRunner\KeyValue\Tests\Stub\RPCConnectionStub not found.
26-26: Method Spiral\RoadRunner\KeyValue\Tests\TestCase::asyncRPC() has invalid return type Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncRPCConnectionStub.
28-28: Instantiated class Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncRPCConnectionStub not found.
src/Factory.php
16-16: Class Spiral\RoadRunner\KeyValue\Factory implements unknown interface Spiral\RoadRunner\KeyValue\FactoryInterface.
18-18: Class Spiral\RoadRunner\KeyValue\Factory uses unknown trait Spiral\RoadRunner\KeyValue\Serializer\SerializerAwareTrait.
21-21: Parameter $rpc of method Spiral\RoadRunner\KeyValue\Factory::__construct() has invalid type Spiral\Goridge\RPC\RPCInterface.
21-21: Property Spiral\RoadRunner\KeyValue\Factory::$rpc has unknown class Spiral\Goridge\RPC\RPCInterface as its type.
22-22: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
22-22: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Factory::__construct() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
24-24: Call to an undefined method Spiral\RoadRunner\KeyValue\Factory::setSerializer().
27-27: Method Spiral\RoadRunner\KeyValue\Factory::select() has invalid return type Spiral\RoadRunner\KeyValue\StorageInterface.
29-29: Class Spiral\Goridge\RPC\AsyncRPCInterface not found.
30-30: Call to an undefined method Spiral\RoadRunner\KeyValue\Factory::getSerializer().
30-30: Instantiated class Spiral\RoadRunner\KeyValue\AsyncCache not found.
32-32: Call to an undefined method Spiral\RoadRunner\KeyValue\Factory::getSerializer().
32-32: Instantiated class Spiral\RoadRunner\KeyValue\Cache not found.
tests/Stub/AsyncRPCConnectionStub.php
7-7: Class Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncRPCConnectionStub extends unknown class Spiral\RoadRunner\KeyValue\Tests\Stub\RPCConnectionStub.
7-7: Class Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncRPCConnectionStub implements unknown interface Spiral\Goridge\RPC\AsyncRPCInterface.
17-17: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncRPCConnectionStub::call().
41-41: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncRPCConnectionStub::call().
tests/FactoryTest.php
13-13: Class Spiral\RoadRunner\KeyValue\Tests\FactoryTest extends unknown class Spiral\RoadRunner\KeyValue\Tests\TestCase.
18-18: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
18-18: Method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::factory() has invalid return type Spiral\RoadRunner\KeyValue\FactoryInterface.
18-18: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::factory() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
20-20: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::rpc().
20-20: Instantiated class Spiral\RoadRunner\KeyValue\Factory not found.
26-26: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
26-26: Method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::asyncFactory() has invalid return type Spiral\RoadRunner\KeyValue\FactoryInterface.
26-26: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::asyncFactory() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
28-28: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::asyncRPC().
28-28: Instantiated class Spiral\RoadRunner\KeyValue\Factory not found.
33-33: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::expectNotToPerformAssertions().
39-39: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::expectNotToPerformAssertions().
50-50: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::assertSame().
60-60: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\FactoryTest::assertSame().
src/AsyncStorageInterface.php
8-8: Interface Spiral\RoadRunner\KeyValue\AsyncStorageInterface extends unknown interface Spiral\RoadRunner\KeyValue\StorageInterface.
src/AsyncCache.php
22-22: Class Spiral\RoadRunner\KeyValue\AsyncCache extends unknown class Spiral\RoadRunner\KeyValue\Cache.
22-22: Class Spiral\RoadRunner\KeyValue\AsyncCache implements unknown interface Spiral\RoadRunner\KeyValue\AsyncStorageInterface.
34-34: Parameter $rpc of method Spiral\RoadRunner\KeyValue\AsyncCache::__construct() has invalid type Spiral\Goridge\RPC\RPCInterface.
36-36: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
36-36: Parameter $serializer of method Spiral\RoadRunner\KeyValue\AsyncCache::__construct() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
38-38: Spiral\RoadRunner\KeyValue\AsyncCache::__construct() calls parent::__construct() but Spiral\RoadRunner\KeyValue\AsyncCache does not extend any class.
41-41: Access to an undefined property Spiral\RoadRunner\KeyValue\AsyncCache::$rpc.
41-41: Class Spiral\Goridge\RPC\AsyncRPCInterface not found.
71-71: Access to an undefined property Spiral\RoadRunner\KeyValue\AsyncCache::$rpc.
71-71: Class Spiral\Goridge\RPC\AsyncRPCInterface not found.
78-78: Call to an undefined method Spiral\RoadRunner\KeyValue\AsyncCache::requestKeys().
107-107: Access to an undefined property Spiral\RoadRunner\KeyValue\AsyncCache::$rpc.
107-107: Class Spiral\Goridge\RPC\AsyncRPCInterface not found.
116-116: Call to an undefined method Spiral\RoadRunner\KeyValue\AsyncCache::requestValues().
116-116: Call to an undefined method Spiral\RoadRunner\KeyValue\AsyncCache::ttlToRfc3339String().
128-128: Access to an undefined property Spiral\RoadRunner\KeyValue\AsyncCache::$rpc.
128-128: Class Spiral\Goridge\RPC\AsyncRPCInterface not found.
131-131: Class RoadRunner\KV\DTO\V1\Response not found.
132-132: Caught class Spiral\Goridge\RPC\Exception\ServiceException not found.
136-136: Access to an undefined property Spiral\RoadRunner\KeyValue\AsyncCache::$name.
136-136: Access to undefined constant Spiral\RoadRunner\KeyValue\AsyncCache::ERROR_INVALID_STORAGE.
136-136: Instantiated class Spiral\RoadRunner\KeyValue\Exception\StorageException not found.
139-139: Instantiated class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
src/Cache.php
25-25: Class Spiral\RoadRunner\KeyValue\Cache implements unknown interface Spiral\RoadRunner\KeyValue\StorageInterface.
27-27: Class Spiral\RoadRunner\KeyValue\Cache uses unknown trait Spiral\RoadRunner\KeyValue\Serializer\SerializerAwareTrait.
43-43: Property Spiral\RoadRunner\KeyValue\Cache::$rpc has unknown class Spiral\Goridge\RPC\RPCInterface as its type.
50-50: Parameter $rpc of method Spiral\RoadRunner\KeyValue\Cache::__construct() has invalid type Spiral\Goridge\RPC\RPCInterface.
52-52: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
52-52: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Cache::__construct() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
54-54: Instantiated class Spiral\Goridge\RPC\Codec\ProtobufCodec not found.
57-57: Call to an undefined method Spiral\RoadRunner\KeyValue\Cache::setSerializer().
92-92: Caught class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
95-95: Instantiated class Spiral\RoadRunner\KeyValue\Exception\NotImplementedException not found.
111-111: Parameter $response of method Spiral\RoadRunner\KeyValue\Cache::createIndex() has invalid type RoadRunner\KV\DTO\V1\Response.
130-130: Method Spiral\RoadRunner\KeyValue\Cache::call() has invalid return type RoadRunner\KV\DTO\V1\Response.
130-130: Parameter $request of method Spiral\RoadRunner\KeyValue\Cache::call() has invalid type RoadRunner\KV\DTO\V1\Request.
133-133: Class RoadRunner\KV\DTO\V1\Response not found.
134-134: Caught class Spiral\Goridge\RPC\Exception\ServiceException not found.
138-138: Instantiated class Spiral\RoadRunner\KeyValue\Exception\StorageException not found.
141-141: Instantiated class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
149-149: Method Spiral\RoadRunner\KeyValue\Cache::requestKeys() has invalid return type RoadRunner\KV\DTO\V1\Request.
155-155: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
164-164: Method Spiral\RoadRunner\KeyValue\Cache::request() has invalid return type RoadRunner\KV\DTO\V1\Request.
166-166: Instantiated class RoadRunner\KV\DTO\V1\Request not found.
210-210: Call to an undefined method Spiral\RoadRunner\KeyValue\Cache::getSerializer().
240-240: Instantiated class Spiral\RoadRunner\KeyValue\Exception\InvalidArgumentException not found.
262-262: Method Spiral\RoadRunner\KeyValue\Cache::requestValues() has invalid return type RoadRunner\KV\DTO\V1\Request.
265-265: Call to an undefined method Spiral\RoadRunner\KeyValue\Cache::getSerializer().
271-271: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
353-353: Caught class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
355-355: Instantiated class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
tests/AsyncCacheTest.php
24-24: Class Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest extends unknown class Spiral\RoadRunner\KeyValue\Tests\TestCase.
34-34: Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::setUp() calls parent::setUp() but Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest does not extend any class.
41-41: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
48-48: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
48-48: Method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::cache() has invalid return type Spiral\RoadRunner\KeyValue\AsyncCache.
48-48: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::cache() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
50-50: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::asyncRPC().
50-50: Instantiated class Spiral\RoadRunner\KeyValue\AsyncCache not found.
56-56: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testTtl() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
62-62: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
72-72: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertNotNull().
73-73: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertEquals().
98-98: Instantiated class RoadRunner\KV\DTO\V1\Response not found.
104-104: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testNoTtl() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
108-108: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertNull().
114-114: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testMultipleTtl() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
121-121: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
126-126: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
137-137: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertContains().
138-138: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertEquals().
145-145: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testMultipleTtlWithMissingTime() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
152-152: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
163-163: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertContains().
166-166: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertEquals().
173-173: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testTtlWithInvalidResponseKey() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
177-177: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
185-185: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertNull().
194-194: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
195-195: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
196-196: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
197-197: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
198-198: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
199-199: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
200-200: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
201-201: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
202-202: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
203-203: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
204-204: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
205-205: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
206-206: Parameter $c of anonymous function has invalid type Spiral\RoadRunner\KeyValue\AsyncCache.
218-218: Instantiated class Spiral\Goridge\RPC\Exception\ServiceException not found.
222-222: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
222-222: Class Spiral\RoadRunner\KeyValue\Exception\StorageException not found.
223-223: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
252-252: Instantiated class Spiral\Goridge\RPC\Exception\ServiceException not found.
256-256: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
256-256: Class Spiral\RoadRunner\KeyValue\Exception\NotImplementedException not found.
257-257: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
273-273: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testGet() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
279-279: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
283-283: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
290-290: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertNull().
299-299: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
305-305: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testGetMultiple() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
317-317: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
318-318: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
324-324: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
330-330: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testHas() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
336-336: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
340-340: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertTrue().
346-346: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testHasWhenNotExists() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
354-354: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertFalse().
360-360: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testHasWithInvalidResponse() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
366-366: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
370-370: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertFalse().
379-379: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertTrue().
384-384: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
384-384: Class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
385-385: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
389-389: Instantiated class Spiral\Goridge\RPC\Exception\ServiceException not found.
398-398: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
398-398: Class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
399-399: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
413-413: Call to an undefined static method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::valuesDataProvider().
428-428: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
432-432: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\IgbinarySerializer not found.
439-439: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\SodiumSerializer not found.
450-450: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testSet() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
453-453: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
457-457: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
468-468: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testSetAsync() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
471-471: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
475-475: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
489-489: Method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::getAssertableCacheOnSet() has invalid return type Spiral\RoadRunner\KeyValue\AsyncCache.
489-489: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::getAssertableCacheOnSet() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
492-492: Parameter $request of anonymous function has invalid type RoadRunner\KV\DTO\V1\Request.
501-501: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertArrayHasKey().
502-502: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertEquals().
505-505: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
515-515: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testMultipleSet() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
518-518: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
522-522: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
534-534: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::testMultipleSetAsync() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
537-537: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
541-541: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
562-562: Parameter $request of anonymous function has invalid type RoadRunner\KV\DTO\V1\Request.
565-565: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
586-586: Parameter $request of anonymous function has invalid type RoadRunner\KV\DTO\V1\Request.
589-589: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
607-607: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
607-607: Parameter $serializer of method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::frozenDateCache() has invalid type Spiral\RoadRunner\KeyValue\Serializer\SerializerInterface.
608-608: Method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::frozenDateCache() has invalid return type Spiral\RoadRunner\KeyValue\AsyncCache.
609-609: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::asyncRPC().
609-609: Instantiated class Spiral\RoadRunner\KeyValue\Tests\Stub\AsyncFrozenDateCacheStub not found.
625-625: Parameter $request of anonymous function has invalid type RoadRunner\KV\DTO\V1\Request.
628-628: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
650-650: Parameter $request of anonymous function has invalid type RoadRunner\KV\DTO\V1\Request.
653-653: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
671-671: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
674-674: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
674-674: Class Spiral\RoadRunner\KeyValue\Exception\InvalidArgumentException not found.
675-675: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
693-693: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::markTestSkipped().
696-696: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
696-696: Class Spiral\RoadRunner\KeyValue\Exception\InvalidArgumentException not found.
697-697: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
706-706: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
713-713: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertTrue().
719-719: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertTrue().
720-720: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertTrue().
725-725: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
725-725: Class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
729-729: Instantiated class Spiral\Goridge\RPC\Exception\ServiceException not found.
740-740: Instantiated class Spiral\Goridge\RPC\Exception\ServiceException not found.
745-745: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
745-745: Class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
752-752: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertTrue().
758-758: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertTrue().
759-759: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertTrue().
764-764: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
764-764: Class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
768-768: Instantiated class Spiral\Goridge\RPC\Exception\ServiceException not found.
779-779: Instantiated class Spiral\Goridge\RPC\Exception\ServiceException not found.
784-784: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
784-784: Class Spiral\RoadRunner\KeyValue\Exception\KeyValueException not found.
790-790: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
790-790: Class Spiral\RoadRunner\KeyValue\Exception\InvalidArgumentException not found.
791-791: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
801-801: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
801-801: Class Spiral\RoadRunner\KeyValue\Exception\InvalidArgumentException not found.
802-802: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
810-810: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
810-810: Class Spiral\RoadRunner\KeyValue\Exception\InvalidArgumentException not found.
811-811: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
816-816: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
822-822: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
822-822: Class Spiral\RoadRunner\KeyValue\Exception\InvalidArgumentException not found.
823-823: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
831-831: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
831-831: Class Spiral\RoadRunner\KeyValue\Exception\InvalidArgumentException not found.
832-832: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectExceptionMessage().
837-837: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
846-846: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
847-847: Instantiated class Spiral\RoadRunner\KeyValue\Tests\Stub\RawSerializerStub not found.
849-849: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
852-852: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::assertSame().
857-857: Call to an undefined method Spiral\RoadRunner\KeyValue\Tests\AsyncCacheTest::expectException().
857-857: Class Spiral\RoadRunner\KeyValue\Exception\SerializationException not found.
862-862: Instantiated class RoadRunner\KV\DTO\V1\Item not found.
863-863: Instantiated class Spiral\RoadRunner\KeyValue\Tests\Stub\RawSerializerStub not found.
865-865: Instantiated class Spiral\RoadRunner\KeyValue\Serializer\DefaultSerializer not found.
Additional comments not posted (20)
tests/Stub/AsyncFrozenDateCacheStub.php (2)
27-30
: The methodnow
is correctly implemented to return the frozen date.
12-25
: Ensure thatAsyncCache
is correctly defined and accessible as the parent class.Verification successful
The
AsyncCache
class is correctly defined and accessible in the codebase.
src/AsyncCache.php:class AsyncCache extends Cache implements AsyncStorageInterface
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of AsyncCache class. ast-grep --lang php --pattern $'class AsyncCache { $$$ }'Length of output: 165
Script:
#!/bin/bash # Description: Verify the existence of AsyncCache class using ripgrep. rg 'class AsyncCache' --type phpLength of output: 180
tests/TestCase.php (2)
22-29
: Verify the existence and correct implementation ofAsyncRPCConnectionStub
.Verification successful
Verify the existence and correct implementation of
AsyncRPCConnectionStub
.
The class
AsyncRPCConnectionStub
exists and is defined intests/Stub/AsyncRPCConnectionStub.php
. The methodasyncRPC
intests/TestCase.php
correctly returns an instance of this class.
- Location of
AsyncRPCConnectionStub
class:tests/Stub/AsyncRPCConnectionStub.php
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of AsyncRPCConnectionStub class. ast-grep --lang php --pattern $'class AsyncRPCConnectionStub { $$$ }'Length of output: 177
Script:
#!/bin/bash # Description: Verify the existence of AsyncRPCConnectionStub class using ripgrep. rg 'class AsyncRPCConnectionStub' --type phpLength of output: 168
Line range hint
8-17
: Verify the existence and correct implementation ofRPCConnectionStub
.Verification successful
The
RPCConnectionStub
class is correctly defined intests/Stub/RPCConnectionStub.php
and implements theRPCInterface
. The constructor and properties align with the usage in theTestCase
class.
RPCConnectionStub
class is found intests/Stub/RPCConnectionStub.php
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of RPCConnectionStub class. ast-grep --lang php --pattern $'class RPCConnectionStub { $$$ }'Length of output: 172
Script:
#!/bin/bash # Description: Verify the existence of RPCConnectionStub class using ripgrep. rg 'class RPCConnectionStub' --files-with-matchesLength of output: 84
Script:
#!/bin/bash # Description: Retrieve the implementation of RPCConnectionStub class. rg 'class RPCConnectionStub' -A 20 tests/Stub/RPCConnectionStub.phpLength of output: 581
src/Factory.php (2)
Line range hint
7-33
: Verify the existence and correct implementation ofFactoryInterface
,SerializerAwareTrait
, and related methods.Verification successful
The
FactoryInterface
andSerializerAwareTrait
are correctly defined in the codebase.
FactoryInterface
is defined insrc/FactoryInterface.php
.SerializerAwareTrait
is defined insrc/Serializer/SerializerAwareTrait.php
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of FactoryInterface and SerializerAwareTrait. ast-grep --lang php --pattern $'interface FactoryInterface { $$$ }' ast-grep --lang php --pattern $'trait SerializerAwareTrait { $$$ }'Length of output: 351
Script:
#!/bin/bash # Description: Verify the existence of FactoryInterface and SerializerAwareTrait using ripgrep. rg 'interface FactoryInterface' --files-with-matches rg 'trait SerializerAwareTrait' --files-with-matchesLength of output: 174
Script:
#!/bin/bash # Description: Display the contents of FactoryInterface and SerializerAwareTrait files to verify their definitions. cat src/FactoryInterface.php cat src/Serializer/SerializerAwareTrait.phpLength of output: 1065
29-33
: Verify the existence and correct implementation ofAsyncCache
andCache
.Verification successful
Verify the existence and correct implementation of
AsyncCache
andCache
usingrg
instead ofast-grep
.
The classes
AsyncCache
andCache
exist in the codebase and are correctly implemented.
AsyncCache
is defined insrc/AsyncCache.php
.Cache
is defined insrc/Cache.php
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of AsyncCache and Cache classes. ast-grep --lang php --pattern $'class AsyncCache { $$$ }' ast-grep --lang php --pattern $'class Cache { $$$ }'Length of output: 326
Script:
#!/bin/bash # Description: Verify the existence of AsyncCache and Cache classes using ripgrep. rg 'class AsyncCache' --type php rg 'class Cache' --type phpLength of output: 317
tests/Stub/AsyncRPCConnectionStub.php (5)
20-26
: The methodcallAsync
is correctly implemented to manage asynchronous calls and maintain a sequence of responses.
28-31
: The methodhasResponse
is correctly implemented to check if a response exists for a given sequence number.
33-36
: The methodhasResponses
is correctly implemented to filter a list of sequence numbers to find those that have responses.
38-45
: Verify the existence and correct implementation of the methodcall
inAsyncRPCConnectionStub
.
15-18
: Verify the existence and correct implementation of the methodcall
inAsyncRPCConnectionStub
.Verification successful
The
call
method is defined intests/Stub/RPCConnectionStub.php
as a public method. SinceAsyncRPCConnectionStub
extendsRPCConnectionStub
, it inherits this method. Therefore, thecallIgnoreResponse
method inAsyncRPCConnectionStub
is correctly calling the inheritedcall
method.
tests/Stub/RPCConnectionStub.php
:public function call(string $method, mixed $payload, mixed $options = null): mixed
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of the call method in AsyncRPCConnectionStub. ast-grep --lang php --pattern $'class AsyncRPCConnectionStub { $$$ call($_, $_) { $$$ } $$$ }'Length of output: 202
Script:
#!/bin/bash # Description: Verify the existence of the call method in AsyncRPCConnectionStub using ripgrep. rg --pcre2 --multiline --multiline-dotall 'class\s+AsyncRPCConnectionStub\s+{[^}]*function\s+call\s*\('Length of output: 105
Script:
#!/bin/bash # Description: Verify the existence of the call method in RPCConnectionStub and AsyncRPCInterface using ripgrep. # Search for the call method in RPCConnectionStub rg --pcre2 --multiline --multiline-dotall 'class\s+RPCConnectionStub\s+{[^}]*function\s+call\s*\(' # Search for the call method in AsyncRPCInterface rg --pcre2 --multiline --multiline-dotall 'interface\s+AsyncRPCInterface\s+{[^}]*function\s+call\s*\('Length of output: 205
Script:
#!/bin/bash # Description: Search for the definition of the call method across the entire codebase. rg --pcre2 --multiline --multiline-dotall 'function\s+call\s*\('Length of output: 270
tests/FactoryTest.php (3)
37-58
: The test methods are correctly implemented to perform various assertions using thefactory
andasyncFactory
methods.
Line range hint
11-17
: Verify the existence and correct implementation of the classFactory
.Verification successful
The
Factory
class exists and is defined insrc/Factory.php
asfinal class Factory implements FactoryInterface
.
src/Factory.php
:final class Factory implements FactoryInterface
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of Factory class. ast-grep --lang php --pattern $'class Factory { $$$ }'Length of output: 162
Script:
#!/bin/bash # Description: Verify the existence of Factory class using ripgrep. rg 'class Factory' --type phpLength of output: 152
23-29
: Verify the existence and correct implementation of the classFactory
.Verification successful
The
Factory
class exists in the codebase, specifically insrc/Factory.php
, and it implements theFactoryInterface
. This confirms that theasyncFactory
method intests/FactoryTest.php
is correctly referencing an existing class.
src/Factory.php
:final class Factory implements FactoryInterface
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence of Factory class. ast-grep --lang php --pattern $'class Factory { $$$ }'Length of output: 162
Script:
#!/bin/bash # Description: Verify the existence of Factory class using ripgrep. rg 'class Factory' --type phpLength of output: 152
composer.json (1)
51-52
: The dependency updates forspiral/roadrunner
andspiral/goridge
are correctly aligned with the PR's objectives to support async changes.src/AsyncStorageInterface.php (5)
8-15
: LGTM! ThecommitAsync
method is well-documented and correctly throws aKeyValueException
for error handling.
17-31
: LGTM! ThesetMultipleAsync
method correctly handles multiple key-value pairs with optional TTL, aligning with PSR-16 standards.
33-47
: LGTM! ThesetAsync
method is a well-implemented convenience method for setting a single key-value pair asynchronously.
49-59
: LGTM! ThedeleteAsync
method correctly implements asynchronous deletion of a single key, with appropriate error handling.
61-72
: LGTM! ThedeleteMultipleAsync
method properly handles asynchronous deletion of multiple keys, consistent with the interface's standards.
Hey @L3tum, raising the minimum version of spiral/goridge to 4.2 is normal. This is a minor version increase, and there is no problem with that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- composer.json (1 hunks)
Additional comments not posted (2)
composer.json (2)
51-51
: Update tospiral/goridge
version^4.2
aligns with the requirement for async features as per PR objectives.
51-51
: The version constraint forspiral/roadrunner
is correctly placed and allows for future compatibility with versions2023.1
and2024.1
.
This is a follow-up PR for roadrunner-php/goridge#22 implementing the new "async" RPC calls in the Cache class.
It may be an option to instead modify the Factory to return an AsyncCache class instead if it detects an async RPC interface, or something like that. Please lmk if you'd like me to change that. Once the implementation is good to go I'll add tests for it as well.EDIT: FYI I switched to the factory (similar to the other PR in Metrics) because I think this is easier to use. I've also added the corresponding tests.
For further info please read the linked PR in the goridge repo.
Same PR for the metrics repo: roadrunner-php/metrics#13
Summary by CodeRabbit
New Features
Bug Fixes
spiral/roadrunner
andspiral/goridge
.Tests
Chores
composer.json
for better alignment and compatibility.