Module: Kreuzcrawl::CrawlEvent

Extended by:
T::Helpers, T::Sig
Included in:
CrawlEventComplete, CrawlEventError, CrawlEventPage
Defined in:
lib/kreuzcrawl/native.rb

Overview

An event emitted during a streaming crawl operation.

Not available on ‘wasm32` targets — streaming requires native concurrency primitives (tokio channels, `JoinSet`) that are not supported on wasm32.

Delivered to bindings via alef’s streaming-adapter pattern. The ‘crawl_stream` / `batch_crawl_stream` binding wrappers in `bindings.rs` expose this as the per-language streaming idiom (Python `AsyncIterator`, Ruby `Enumerator`, PHP `Generator`, Elixir `Stream.unfold`, etc.).

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



140
141
142
143
144
145
146
147
148
# File 'lib/kreuzcrawl/native.rb', line 140

def self.from_hash(hash)
  discriminator = hash[:type] || hash["type"]
  case discriminator
  when "page" then CrawlEventPage.from_hash(hash)
  when "error" then CrawlEventError.from_hash(hash)
  when "complete" then CrawlEventComplete.from_hash(hash)
  else raise "Unknown discriminator: #{discriminator}"
  end
end