Sha256: 10a840f2e2506f40da116e8c440f24b8ee2aa4212fed6e778b769aca434e0a8a
Contents?: true
Size: 1.55 KB
Versions: 6
Compression:
Stored size: 1.55 KB
Contents
=begin Copyright 2010-2015 Tasos Laskos <tasos.laskos@arachni-scanner.com> This file is part of the Arachni Framework project and is subject to redistribution and commercial restrictions. Please see the Arachni Framework web site for more information on licensing and terms of use. =end module Arachni class State class Framework # State information for {Arachni::RPC::Server::Framework}. # # @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com> class RPC # @return [Support::LookUp::HashSet] attr_reader :distributed_pages # @return [Set] attr_reader :distributed_elements def initialize @distributed_pages = Support::LookUp::HashSet.new( hasher: :persistent_hash ) @distributed_elements = Set.new end def statistics { distributed_pages: @distributed_pages.size, distributed_elements: @distributed_elements.size } end def dump( directory ) FileUtils.mkdir_p( directory ) %w(distributed_pages distributed_elements).each do |attribute| IO.binwrite( "#{directory}/#{attribute}", Marshal.dump( send(attribute) ) ) end end def self.load( directory ) rpc = new rpc.distributed_elements.merge Marshal.load( IO.binread( "#{directory}/distributed_elements" ) ) rpc.distributed_pages.merge Marshal.load( IO.binread( "#{directory}/distributed_pages" ) ) rpc end def clear @distributed_pages.clear @distributed_elements.clear end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems