Zlib::GzipWriter
is a class for writing gzipped files. GzipWriter
should be used with an instance of IO
, or IO-like, object.
Following two example generate the same result.
Zlib::GzipWriter.open('hoge.gz') do |gz| gz.write 'jugemu jugemu gokou no surikire...' end File.open('hoge.gz', 'w') do |f| gz = Zlib::GzipWriter.new(f) gz.write 'jugemu jugemu gokou no surikire...' gz.close end
To make like gzip(1) does, run following:
orig = 'hoge.txt' Zlib::GzipWriter.open('hoge.gz') do |gz| gz.mtime = File.mtime(orig) gz.orig_name = orig gz.write IO.binread(orig) end
NOTE: Due to the limitation of Ruby’s finalizer, you must explicitly close GzipWriter
objects by Zlib::GzipWriter#close
etc. Otherwise, GzipWriter
will be not able to write the gzip footer and will generate a broken gzip file.
exception to wait for writing by EAGAIN. see IO.select
.
exception to wait for writing by EWOULDBLOCK. see IO.select
.
exception to wait for writing by EINPROGRESS. see IO.select
.
Note: Don’t use this class directly. This is an internal class.
Timer id conversion keeps objects alive for a certain amount of time after their last access. The default time period is 600 seconds and can be changed upon initialization.
To use TimerIdConv:
DRb.install_id_conv TimerIdConv.new 60 # one minute
A custom InputMethod class used by XMP
for evaluating string io.
HTTPGenericRequest
is the parent of the Net::HTTPRequest
class. Do not use this directly; use a subclass of Net::HTTPRequest
.
Mixes in the Net::HTTPHeader
module to provide easier access to HTTP headers.
Response class for Non-Authoritative Information
responses (status code 203).
The Non-Authoritative Information
response indicates that the server is a transforming proxy (such as a Web accelerator) that received a 200 OK response from its origin, and is returning a modified version of the origin’s response. See 203 Non-Authoritative Information.
Response class for Found
responses (status code 302).
The Found
response indicates that the client should look at (browse to) another URL. See 302 Found.
Response class for Unauthorized
responses (status code 401).
Authentication is required, but either was not provided or failed. See 401 Unauthorized.
Response class for Variant Also Negotiates
responses (status code 506).
Transparent content negotiation for the request results in a circular reference. See 506 Variant Also Negotiates.
WriteTimeout
, a subclass of Timeout::Error
, is raised if a chunk of the response cannot be written within the write_timeout. Not raised on Windows.
The writer adapter class
Rinda
error base class
A RingServer
allows a Rinda::TupleSpace
to be located via UDP broadcasts. Default service location uses the following steps:
A RingServer
begins listening on the network broadcast UDP address.
A RingFinger
sends a UDP packet containing the DRb
URI
where it will listen for a reply.
The RingServer
receives the UDP packet and connects back to the provided DRb
URI
with the DRb
service.
A RingServer
requires a TupleSpace:
ts = Rinda::TupleSpace.new rs = Rinda::RingServer.new
RingServer
can also listen on multicast addresses for announcements. This allows multiple RingServers to run on the same host. To use network broadcast and multicast:
ts = Rinda::TupleSpace.new rs = Rinda::RingServer.new ts, %w[Socket::INADDR_ANY, 239.0.0.1 ff02::1]
RingFinger
is used by RingServer
clients to discover the RingServer’s TupleSpace
. Typically, all a client needs to do is call RingFinger.primary
to retrieve the remote TupleSpace
, which it can then begin using.
To find the first available remote TupleSpace:
Rinda::RingFinger.primary
To create a RingFinger
that broadcasts to a custom list:
rf = Rinda::RingFinger.new ['localhost', '192.0.2.1'] rf.primary
Rinda::RingFinger
also understands multicast addresses and sets them up properly. This allows you to run multiple RingServers on the same host:
rf = Rinda::RingFinger.new ['239.0.0.1'] rf.primary
You can set the hop count (or TTL) for multicast searches using multicast_hops
.
If you use IPv6 multicast you may need to set both an address and the outbound interface index:
rf = Rinda::RingFinger.new ['ff02::1'] rf.multicast_interface = 1 rf.primary
At this time there is no easy way to get an interface index by name.
RingProvider
uses a RingServer
advertised TupleSpace
as a name service. TupleSpace
clients can register themselves with the remote TupleSpace
and look up other provided services via the remote TupleSpace
.
Services are registered with a tuple of the format [:name, klass, DRbObject
, description].
An error that indicates we weren’t able to fetch some data from a source
Represents an error communicating via HTTP.