Class: Farce::Local::Vector
- Inherits:
-
Abstract::Vector
- Object
- Abstract::Collection
- Abstract::Vector
- Farce::Local::Vector
- Includes:
- Shareable::Tracked
- Defined in:
- lib/farce/local/vector.rb
Overview
A shareable vector with independent mutable storage in each scope.
Instance Attribute Summary
Attributes included from Scoped
Instance Method Summary collapse
-
#initialize(source = nil, compare_by_identity: false, scope: :ractor) ⇒ Vector
constructor
Valid scopes are: *
:ractor- The value is shared by all threads within the same Ractor.
Methods included from Shareable
Methods inherited from Abstract::Vector
#&, #*, #+, #-, #<<, #[], #[]=, #append, #as_extended_json, #as_json, #assoc, #at, #bsearch, #bsearch_index, #bson_type, #chunk, #chunk_while, #clear, #compact, #compact_blank, #compare_and_set, #compare_by_identity?, #concat, #deconstruct, #deep_dup, #difference, #dig, #drop, #drop_while, #each, #each_cons, #each_index, #each_slice, #entries, #excluding, #fetch, #fetch_values, #fifth, #filter_map, #first, #flat_map, #forty_two, #fourth, #from, #get, #grep, #grep_v, #group_by, #in_groups, #in_groups_of, #in_order_of, #include?, #including, #index, #inquiry, #intersect?, #intersection, #last, #map, #max, #max_by, #maximum, #min, #min_by, #minimum, #minmax, #minmax_by, #pack, #partition, #pick, #pluck, #pop, #push, #rassoc, #reject, #reverse, #reverse_each, #rfind, #rindex, #rotate, #sample, #second, #second_to_last, #select, #shareable_values?, #shuffle, #size, #slice, #slice_after, #slice_before, #slice_when, #sort, #sort_by, #split, #store, #store_if_absent, #swap, #take, #take_while, #third, #third_to_last, #to, #to_a, #to_bson, #to_bson_normalized_value, #to_cbor, #to_fs, #to_h, #to_json, #to_msgpack, #to_param, #to_query, #to_sentence, #to_xml, #union, #uniq, #update, #upsert, #values_at, #wait_until, #wait_until_changed, #wait_until_match, #wait_until_non_nil, #wait_until_value, #wait_while, #wait_while_match, #wait_while_value, #zip, #|
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
Constructor Details
#initialize(source = nil, compare_by_identity: false, scope: :ractor) ⇒ Vector
Valid scopes are:
:ractor- The value is shared by all threads within the same Ractor.:thread_group- The value is shared by all threads within the same thread group.:thread- The value is shared by all fibers within the same thread.:fiber_storage- The value is shared by all fibers using the same storage. Unless explicitly specified, storage is inherited from the parent fiber for blocking fibers, but not for non-blocking fibers (such as those created by Scheduler#schedule).:fiber- Each fiber has its own independent value.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/farce/local/vector.rb', line 15 class Vector < Abstract::Vector include Shareable::Tracked include Scoped::Tracked protected def internal_vector = scoped_value def build_derived_vector(values) self.class.new(values, compare_by_identity: compare_by_identity?, scope:) end private def new_scoped_value(...) = Internal::UnsharedVector.new(...) end |