class GrpcKit::Session::StreamStatus

Constants

CLOSE
HALF_CLOSE_LOCAL
HALF_CLOSE_REMOTE
OPEN

Public Class Methods

new() click to toggle source
# File lib/grpc_kit/session/stream_status.rb, line 11
def initialize
  @status = OPEN
end

Public Instance Methods

close() click to toggle source

@return [void]

# File lib/grpc_kit/session/stream_status.rb, line 42
def close
  @status = CLOSE
end
close?() click to toggle source

@return [Boolean]

# File lib/grpc_kit/session/stream_status.rb, line 57
def close?
  @status == CLOSE
end
close_local() click to toggle source

@return [void]

# File lib/grpc_kit/session/stream_status.rb, line 16
def close_local
  if @status == OPEN
    @status = HALF_CLOSE_LOCAL
  elsif @status == HALF_CLOSE_REMOTE
    @status = CLOSE
  elsif @status == HALF_CLOSE_LOCAL
  # nothing
  else
    raise 'stream is already closed'
  end
end
close_local?() click to toggle source

@return [Boolean]

# File lib/grpc_kit/session/stream_status.rb, line 47
def close_local?
  (@status == HALF_CLOSE_LOCAL) || close?
end
close_remote() click to toggle source

@return [void]

# File lib/grpc_kit/session/stream_status.rb, line 29
def close_remote
  if @status == OPEN
    @status = HALF_CLOSE_REMOTE
  elsif @status == HALF_CLOSE_LOCAL
    @status = CLOSE
  elsif @status == HALF_CLOSE_REMOTE
  # nothing
  else
    raise 'stream is already closed'
  end
end
close_remote?() click to toggle source

@return [Boolean]

# File lib/grpc_kit/session/stream_status.rb, line 52
def close_remote?
  (@status == HALF_CLOSE_REMOTE) || close?
end