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
require 'socket' | |
HOST = 'localost' | |
N1 = 2 | |
N2 = 10 | |
MSG = "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest\n" | |
def run | |
@stop = false |
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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | |
gem "benchmark-memory" |
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
class FIFO | |
def initialize(from_encoding, encoding) | |
@from_encoding = from_encoding | |
@encoding = encoding | |
@need_enc = from_encoding != encoding | |
@buffer = ''.force_encoding(from_encoding) | |
@eol = "\n".encode(from_encoding).freeze | |
end | |
attr_reader :from_encoding, :encoding, :buffer |
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
require 'socket' | |
class Server | |
def call | |
File.unlink('socket1') | |
File.unlink('socket2') | |
server1 = UNIXServer.new('socket1') | |
server2 = UNIXServer.new('socket2') | |
v = Queue.new |
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
require 'logger' | |
require 'grpc' | |
require 'grpc/health/checker' | |
module RubyLogger | |
def logger | |
Logger.new(STDOUT, level: :debug) | |
end | |
end | |
GRPC.extend(RubyLogger) |
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
require 'logger' | |
require 'grpc' | |
require 'grpc/health/checker' | |
module RubyLogger | |
def logger | |
Logger.new(STDOUT, level: :debug) | |
end | |
end | |
GRPC.extend(RubyLogger) |
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
$ bundle exec rspec | |
/Users/ganmacs/src/github.com/grpc/grpc/src/ruby/spec/channel_credentials_spec.rb:19: warning: already initialized constant CallCredentials | |
/Users/ganmacs/src/github.com/grpc/grpc/src/ruby/spec/call_credentials_spec.rb:18: warning: previous definition of CallCredentials was here | |
/Users/ganmacs/src/github.com/grpc/grpc/src/ruby/spec/generic/rpc_server_spec.rb:161: warning: already initialized constant RpcServer | |
/Users/ganmacs/src/github.com/grpc/grpc/src/ruby/spec/client_auth_spec.rb:81: warning: previous definition of RpcServer was here | |
/Users/ganmacs/src/github.com/grpc/grpc/src/ruby/spec/generic/rpc_server_spec.rb:162: warning: already initialized constant StatusCodes | |
/Users/ganmacs/src/github.com/grpc/grpc/src/ruby/spec/error_sanity_spec.rb:17: warning: previous definition of StatusCodes was here | |
/opt/brew/bin/grpc_ruby_plugin | |
/opt/brew/bin/protoc | |
/opt/brew/bin/grpc_ruby_plugin |
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
require 'logger' | |
require 'grpc' | |
require_relative 'helloworld_services_pb' | |
module RubyLogger | |
def logger | |
Logger.new(STDOUT, level: :debug) | |
end | |
end | |
GRPC.extend(RubyLogger) |
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
$ be ruby client.rb | |
D, [2018-08-28T16:08:20.263617 #48268] DEBUG -- : calling 127.0.0.1:8000:/grpc.health.v1.Health/Check | |
D, [2018-08-28T16:08:20.264355 #48268] DEBUG -- : Failing with status #<struct Struct::Status code=4, details="Deadline Exceeded", metadata={}> | |
#<GRPC::DeadlineExceeded: 4:Deadline Exceeded> | |
D, [2018-08-28T16:08:20.264596 #48268] DEBUG -- : calling 127.0.0.1:8000:/grpc.health.v1.Health/Check | |
D, [2018-08-28T16:08:20.265544 #48268] DEBUG -- : Failing with status #<struct Struct::Status code=4, details="Deadline Exceeded", metadata={}> | |
#<GRPC::DeadlineExceeded: 4:Deadline Exceeded> | |
D, [2018-08-28T16:08:20.265779 #48268] DEBUG -- : calling 127.0.0.1:8000:/grpc.health.v1.Health/Check | |
D, [2018-08-28T16:08:20.266243 #48268] DEBUG -- : Failing with status #<struct Struct::Status code=4, details="Deadline Exceeded", metadata={}> | |
#<GRPC::DeadlineEx |
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
require 'partiarelic/grpc/partiarelic_services_pb.rb' | |
stub = Partiarelic::V1::App::Stub.new('127.0.0.1:3000', :this_channel_is_insecure) | |
p stub.manual_start(Partiarelic::V1::ManualStartRequest.new) |
NewerOlder