Module: Woods::Storage::GraphStore::Interface

Included in:
Memory
Defined in:
lib/woods/storage/graph_store.rb

Overview

Interface that all graph store adapters must implement.

Instance Method Summary collapse

Instance Method Details

#affected_by(changed_files, max_depth: nil) ⇒ Array<String>

Find all units transitively affected by changes to the given files.

Parameters:

  • changed_files (Array<String>)

    List of changed file paths

  • max_depth (Integer, nil) (defaults to: nil)

    Maximum traversal depth (nil for unlimited)

Returns:

  • (Array<String>)

    List of affected unit identifiers

Raises:

  • (NotImplementedError)

    if not implemented by adapter



44
45
46
# File 'lib/woods/storage/graph_store.rb', line 44

def affected_by(changed_files, max_depth: nil)
  raise NotImplementedError
end

#by_type(type) ⇒ Array<String>

Get all units of a specific type.

Parameters:

  • type (Symbol)

    Unit type (:model, :controller, etc.)

Returns:

  • (Array<String>)

    List of unit identifiers

Raises:

  • (NotImplementedError)

    if not implemented by adapter



53
54
55
# File 'lib/woods/storage/graph_store.rb', line 53

def by_type(type)
  raise NotImplementedError
end

#dependencies_of(identifier) ⇒ Array<String>

Get direct dependencies of a unit.

Parameters:

  • identifier (String)

    Unit identifier

Returns:

  • (Array<String>)

    List of dependency identifiers

Raises:

  • (NotImplementedError)

    if not implemented by adapter



25
26
27
# File 'lib/woods/storage/graph_store.rb', line 25

def dependencies_of(identifier)
  raise NotImplementedError
end

#dependents_of(identifier) ⇒ Array<String>

Get direct dependents of a unit (reverse dependencies).

Parameters:

  • identifier (String)

    Unit identifier

Returns:

  • (Array<String>)

    List of dependent identifiers

Raises:

  • (NotImplementedError)

    if not implemented by adapter



34
35
36
# File 'lib/woods/storage/graph_store.rb', line 34

def dependents_of(identifier)
  raise NotImplementedError
end

#durable?Boolean

Returns true iff this store is the authoritative write target for graph edges and survives process restart.

Adapter authors must override this — the default raises so a write-through cache or a partially-persistent adapter can’t be misclassified as ephemeral by omission. Boot-time rehydration from dependency_graph.json is only valid when this returns false; durable backends own their own persistence and must be populated by the extraction/embed write path.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)

    if the adapter doesn’t declare its durability



79
80
81
# File 'lib/woods/storage/graph_store.rb', line 79

def durable?
  raise NotImplementedError
end

#pagerank(damping: 0.85, iterations: 20) ⇒ Hash<String, Float>

Compute PageRank importance scores for all units.

Parameters:

  • damping (Float) (defaults to: 0.85)

    Damping factor (default: 0.85)

  • iterations (Integer) (defaults to: 20)

    Number of iterations (default: 20)

Returns:

  • (Hash<String, Float>)

    Identifier => PageRank score

Raises:

  • (NotImplementedError)

    if not implemented by adapter



63
64
65
# File 'lib/woods/storage/graph_store.rb', line 63

def pagerank(damping: 0.85, iterations: 20)
  raise NotImplementedError
end