Class: Farce::Set

Inherits:
Abstract::Set show all
Includes:
Farce::Shareable::Delegated
Defined in:
lib/farce/set.rb

Overview

A Ractor-shareable concurrent set whose elements support transfer modes. Membership uses a stable insertion-time hash and eql? snapshot. Later mutation of a local element does not change its membership key. Elements whose equality cannot be preserved by a shareable snapshot are rejected. Identity comparison supports shareable elements and the :local, :move, :make_shareable, and :shareable_copy modes. Copying a non-shareable identity element is unsupported. On runtimes without native Ractors, elements follow ordinary hash-key mutation rules.

Examples:

Track unique job identifiers

jobs = Farce::Set[:compile, :test]
jobs.add?(:publish) # => jobs
jobs.add?(:test)    # => nil

Instance Method Summary collapse

Methods included from Shareable

#initialize, #ractor_shareable?

Methods inherited from Abstract::Set

#<=>, #==, #^, #add, #add?, #as_extended_json, #as_json, #bson_type, #classify, #clear, #compact_blank, #compact_blank!, #compare_by_identity?, #deep_dup, #delete, #delete?, #delete_if, #difference, #disjoint?, #divide, #duplicable?, #each, #eql?, #excluding, #flatten, #hash, #include?, #including, #initialize, #intersect?, #intersection, #keep_if, #merge, #proper_subset?, #proper_superset?, #reject, #reject!, #select, #select!, #size, #subset?, #subtract, #superset?, #to_a, #to_bson, #to_bson_normalized_value, #to_cbor, #to_json, #to_msgpack, #to_param, #to_query, #to_set, #union, #weak?

Methods inherited from Abstract::Collection

#<<, [], #clear, #compare_by_identity?, #count, #each, #empty?, #filter, #include?, #join, #length, #member?, #reject, #select, #size, #to_a, #to_s

Methods included from Internal::Copyable

#duplicable?

Instance Method Details

#mode ⇒ Symbol

The default transfer mode for elements.

Returns:

  • (Symbol) —

    The configured transfer mode.



24
# File 'lib/farce/set.rb', line 24

def mode = @manager.mode