Sha256: dc8268504b554d2c1789fba59b1274eade94ce03b5683f0d4bdeea1b0846384a
Contents?: true
Size: 874 Bytes
Versions: 2
Compression:
Stored size: 874 Bytes
Contents
require 'fastdfs-client/storage' module Fastdfs module Client class Tracker extend Hook before(:get_storage){ @socket.connection } after(:get_storage){ @socket.close } attr_accessor :socket, :cmd, :options def initialize(host, port, options = {}) @socket = Socket.new(host, port, options[:socket]) @cmd = CMD::STORE_WITHOUT_GROUP_ONE end def get_storage header = ProtoCommon.header_bytes(@cmd, 0) @socket.write(@cmd, header) @socket.receive do |body| storage_ip = body[ProtoCommon::IPADDR].strip storage_port = body[ProtoCommon::PORT].unpack("C*").to_pack_long store_path = body[ProtoCommon::TRACKER_BODY_LEN-1].unpack("C*")[0] Storage.new(storage_ip, storage_port, store_path, options) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fastdfs-client-0.0.3 | lib/fastdfs-client/tracker.rb |
fastdfs-client-0.0.2 | lib/fastdfs-client/tracker.rb |