Sha256: 2e89ff0f95770f69da17915764210b4489cb209235ba0ac742cfc74b012eaf0f
Contents?: true
Size: 799 Bytes
Versions: 2
Compression:
Stored size: 799 Bytes
Contents
require 'fastdfs-client/storage' module Fastdfs module Client class Tracker attr_accessor :socket, :cmd, :options def initialize(host, port, options = {}) @options = options @socket = Socket.new(host, port, @options[:socket]) @cmd = CMD::STORE_WITHOUT_GROUP_ONE end def get_storage client = ClientProxy.new(@cmd, @socket, 0) res = client.dispose 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 res[:status] ? res[:result] : res end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fastdfs-client-1.0.2 | lib/fastdfs-client/tracker.rb |
fastdfs-client-1.0.1 | lib/fastdfs-client/tracker.rb |