-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b103628
commit 9f546cf
Showing
57 changed files
with
1,327 additions
and
24 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
# persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
# Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
module Gruf | ||
VERSION: ::String | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
# persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
# Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
module Gruf | ||
module Cli | ||
class Executor | ||
def initialize: (?(Hash | ::ARGV) args, ?server: ::Gruf::Server? server, ?services: Array? services, ?hook_executor: ::Gruf::Hooks::Executor? hook_executor, ?logger: ::Logger? logger) -> void | ||
def run: () -> void | ||
|
||
private | ||
|
||
def setup!: () -> void | ||
def parse_options: () -> ::Slop::Result | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
# persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
# Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
module Gruf | ||
class Client < ::SimpleDelegator | ||
attr_reader base_klass: ::Class | ||
attr_reader service_klass: ::Class | ||
attr_reader opts: ::Hash[::Symbol, ::Object] | ||
|
||
def initialize: (service: ::Module service, ?options: ::Hash[::Symbol, ::Object] options, ?client_options: ::Hash[::Symbol, ::Object] client_options) -> void | ||
def call: (::Symbol request_method, ?::Hash[::Symbol, ::Object] params, ?::Hash[::Symbol, ::Object] metadata, ?::Hash[::Symbol, ::Object] opts) { () -> ::Object } -> ::Gruf::Response | ||
def timeout: () -> ( Integer | Float | Numeric | ::GRPC::Core::TimeSpec | nil ) | ||
|
||
private | ||
|
||
def streaming_request?: (Symbol request_method) -> bool | ||
def execute: (::Symbol call_sig, ?Object req, ?Hash[::Symbol, ::Object] metadata, ?::Hash[::Symbol, ::Object] opts) { () -> Object } -> ::Array[::Gruf::Timer::Result, ::GRPC::ActiveCall::Operation] | ||
def rpc_desc: (::Symbol request_method) -> ::GRPC::RpcDesc | ||
def request_object: (::Symbol request_method, ?::Hash[::Symbol, ::Object] params) -> ( ::Class | nil ) | ||
def call_signature: (::Symbol request_method) -> ( ::Symbol | nil ) | ||
def build_metadata: (?::Hash[::Symbol, ::Object] metadata) -> ::Hash[::Symbol, ::Object] | ||
def build_ssl_credentials: () -> ( Symbol | GRPC::Core::ChannelCredentials) | ||
def error_deserializer_class: () -> ::Class | ||
def parse_timeout: (untyped timeout) -> ( ::Float | ::Numeric | ::Integer | ::GRPC::Core::TimeSpec ) | ||
end | ||
end |
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,82 @@ | ||
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
# persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
# Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
module Gruf | ||
class Client < ::SimpleDelegator | ||
class Error < ::StandardError | ||
attr_reader error: Object | ||
def initialize: (Object error) -> void | ||
end | ||
|
||
module Errors | ||
class Base < Gruf::Client::Error | ||
end | ||
|
||
class Error < Base | ||
end | ||
|
||
class Validation < Base | ||
end | ||
|
||
class Ok < Base | ||
end | ||
|
||
class InvalidArgument < Validation | ||
end | ||
|
||
class NotFound < Validation | ||
end | ||
|
||
class AlreadyExists < Validation | ||
end | ||
|
||
class OutOfRange < Validation | ||
end | ||
|
||
class Cancelled < Error | ||
end | ||
|
||
class DataLoss < Error | ||
end | ||
|
||
class DeadlineExceeded < Error | ||
end | ||
|
||
class FailedPrecondition < Error | ||
end | ||
|
||
class Internal < Error | ||
end | ||
|
||
class PermissionDenied < Error | ||
end | ||
|
||
class ResourceExhausted < Error | ||
end | ||
|
||
class Unauthenticated < Error | ||
end | ||
|
||
class Unavailable < Error | ||
end | ||
|
||
class Unimplemented < Error | ||
end | ||
|
||
class Unknown < Error | ||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
# persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
# Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
module Gruf | ||
class Client < ::SimpleDelegator | ||
class ErrorFactory | ||
def initialize: (?default_class: ::Class? default_class, ?deserializer_class: ::Class? deserializer_class, ?metadata_key: (Symbol | String)? metadata_key) -> void | ||
def from_exception: (::Exception exception) -> ( ::Gruf::Client::Errors::Base | SignalException | Exception ) | ||
|
||
private | ||
|
||
def deserialize: (::Gruf::Client::Errors::Base exception) -> String | ||
def determine_class: (::Exception exception) -> ::Class | ||
def default_serializer: () -> ::Gruf::Serializers::Errors::Base | ||
end | ||
end | ||
end |
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,32 @@ | ||
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
# persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
# Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
module Gruf | ||
module Configuration | ||
VALID_CONFIG_KEYS: ::Hash[::Symbol, ::Object] | ||
|
||
def self.extended: (::Gruf::Configuration base) -> void | ||
|
||
def configure: () { () -> ::Gruf::Configuration } -> ::Gruf::Configuration | ||
|
||
def options: () -> ::Hash | ||
|
||
def reset: () -> ::Hash | ||
|
||
private | ||
|
||
def environment: () -> ::String | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2017-present, BigCommerce Pty. Ltd. All rights reserved | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit | ||
# persons to whom the Software is furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | ||
# Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | ||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
module Gruf | ||
module Controllers | ||
class Base | ||
attr_reader request: ::Gruf::Controller::Request | ||
attr_reader error: ::Gruf::Error | ||
attr_reader self.bound_service: ::GRPC::GenericService | ||
|
||
def initialize: (method_key: ::Symbol method_key, service: ::GRPC::GenericService service, rpc_desc: ::GRPC::RpcDesc rpc_desc, active_call: ::GRPC::ActiveCall active_call, message: ::Object message) -> void | ||
def self.bind: (::GRPC::GenericService service) -> void | ||
def process_action: (::Symbol method_key) { () -> ::Object } -> ::Object | ||
def call: (::Symbol method_key) { () -> ::Object } -> ::Object | ||
end | ||
end | ||
end |
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.