-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix: Async stream production isn't viable with standard sync serve…
…r implementation (#51) * Forgot to terminate the object grant instance * Convert to the flow producer server because the other nonsense wasn't working
- Loading branch information
1 parent
8ab7498
commit 2f72941
Showing
11 changed files
with
109 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
server/src/main/kotlin/tech/figure/objectstore/gateway/configuration/BeanQualifiers.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
.../src/main/kotlin/tech/figure/objectstore/gateway/server/ObjectStoreGatewayStreamServer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package tech.figure.objectstore.gateway.server | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import org.lognet.springboot.grpc.GRpcService | ||
import tech.figure.objectstore.gateway.GatewayGrpcKt | ||
import tech.figure.objectstore.gateway.GatewayOuterClass.BatchGrantObjectPermissionsRequest | ||
import tech.figure.objectstore.gateway.GatewayOuterClass.BatchGrantObjectPermissionsRequest.GrantTargetCase | ||
import tech.figure.objectstore.gateway.GatewayOuterClass.GrantObjectPermissionsResponse | ||
import tech.figure.objectstore.gateway.address | ||
import tech.figure.objectstore.gateway.exception.InvalidInputException | ||
import tech.figure.objectstore.gateway.server.interceptor.JwtServerInterceptor | ||
import tech.figure.objectstore.gateway.service.ObjectService | ||
|
||
@GRpcService(interceptors = [JwtServerInterceptor::class]) | ||
class ObjectStoreGatewayStreamServer(private val objectService: ObjectService) : GatewayGrpcKt.GatewayCoroutineImplBase() { | ||
override fun batchGrantObjectPermissions(request: BatchGrantObjectPermissionsRequest): Flow<GrantObjectPermissionsResponse> { | ||
val (granteeAddress, targetHashes) = when (request.grantTargetCase) { | ||
GrantTargetCase.ALL_HASHES -> request.allHashes.granteeAddress to null | ||
GrantTargetCase.SPECIFIED_HASHES -> request.specifiedHashes.let { it.granteeAddress to it.targetHashesList } | ||
else -> throw InvalidInputException("A grant target must be supplied") | ||
} | ||
return objectService.batchGrantAccess( | ||
granteeAddress = granteeAddress, | ||
granterAddress = address(), | ||
targetHashes = targetHashes, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.