tangra logo
   
[ class tree: tangra_lib ] [ index: tangra_lib ] [ all elements ]
 

Class: Threads_Manager

Source Location: /web_site/threads_manager.class.php

Class Threads_Manager

Class Overview

Threads Manager

Threads concept is enhancement over sessions. Sites that implements threads management can detect when new instance of browser is opened and user is working with two or more browsers simultaneously. Threads manager function is to detect such "forks" and to split dataspace for the treads so each tread to have separate dataspace. This class is not ment to be used directly by the users - quite the opposite - it is ment to be 100% transparent. User have to use Web_Site/Web_Page get_tvm methods in order to get TVM.

Located in /web_site/threads_manager.class.php [line 50]

Tangra_Class
   |
   --Threads_Manager
Author(s):
API Tags:
See:  Thread_Vars_Manager

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Tangra_Class

Tangra_Class::get_class_name()
Alias of get_class(). Exist because of historical reasons.
Tangra_Class::__set()
Overides PHP built-in method and just throws exception if called. Purpose - to "forbid" autosetting of nonexisting class properties.

[ Top ]
Property Summary
integer   $current_thread_index   Index of current thread
string   $current_url_var   Current URL variable (thread "id")
integer   $snapshots_lifetime   Lifetime for snapshots in seconds
mixed   $threads   Array that contain all existing threads
array   $threads_snapshots   Snapshots of threads
string   $url_rewrite_var_name   name that will be used for the variable that will hold thread "id"
array   $url_var_to_thread_links   Array that contain map url vars to thread index

[ Top ]
Method Summary
Threads_Manager   __construct()   Constructor
integer   add_new_thread()   Adds new thread
integer   add_snapshot()   Adds snapshot for thread specified by $thread_num
void   collect_garbage()   Colects garbage snapshots
void   create_new_thread()   Creates new thread
integer   generate_new_random()   Generates random number
integer   get_current_thread_index()   Returns current thread index
Vars_Manager   &get_current_thread_vm()   Returns reference to current thread Vars_Manager
unknown   get_current_url_var()   Returns current URL variable value
string   get_new_url_var()   Generates new value for URL rewrite variable
array   get_snapshot()   Returns snapshot of thread
string   get_url_rewrite_var()   Returns value of passed URL rewrite variable
unknown   get_url_rewrite_var_name()   Returns URL variable name
unknown   get_usage_stat()   Returns statistic about usage of threads and snapshots.
boolean   is_url_rewrite_var_passed()   Checks if URL variable is passed in POST or GET
void   new_pass()   Prepares ovject for new process
void   process()   Processes current context and manages threads
void   save_snapshot()   Saves snapshot ot current thread

[ Top ]
Properties
integer   $current_thread_index [line 78]

Index of current thread

API Tags:
Internal:  
Access:  private


[ Top ]
string   $current_url_var [line 85]

Current URL variable (thread "id")

API Tags:
Internal:  
Access:  private


[ Top ]
integer   $snapshots_lifetime [line 100]

Lifetime for snapshots in seconds

API Tags:
Access:  private


[ Top ]
mixed   $threads = array() [line 64]

Array that contain all existing threads

API Tags:
Internal:  
Access:  private


[ Top ]
array   $threads_snapshots = array() [line 93]

Snapshots of threads

API Tags:
Internal:  
Access:  private


[ Top ]
string   $url_rewrite_var_name [line 57]

name that will be used for the variable that will hold thread "id"

API Tags:
Internal:  
Access:  private


[ Top ]
array   $url_var_to_thread_links = array() [line 71]

Array that contain map url vars to thread index

API Tags:
Internal:  
Access:  private


[ Top ]
Methods
Constructor __construct  [line 109]

  Threads_Manager __construct( unknown_type $url_rewrite_var_name, [unknown_type $snapshots_lifetime = 600]  )

Constructor

Parameters:
unknown_type   $url_rewrite_var_name:  Name for the URL variable that will be used to track threads
unknown_type   $snapshots_lifetime:  Number of seconds after which snapshot will be seen as garbage and eventually unset


[ Top ]
add_new_thread  [line 308]

  integer add_new_thread( )

Adds new thread


API Tags:
Return:  Index of the new thread
Internal:  
Access:  private


[ Top ]
add_snapshot  [line 197]

  integer add_snapshot( integer $thread_num  )

Adds snapshot for thread specified by $thread_num

Parameters:
integer   $thread_num:  thread index

API Tags:
Return:  Snapshot index
Internal:  
Access:  private


[ Top ]
collect_garbage  [line 347]

  void collect_garbage( )

Colects garbage snapshots


API Tags:
Internal:  
Access:  private


[ Top ]
create_new_thread  [line 159]

  void create_new_thread( )

Creates new thread


API Tags:
Internal:  
Access:  private


[ Top ]
generate_new_random  [line 322]

  integer generate_new_random( )

Generates random number


API Tags:
Internal:  
Access:  private


[ Top ]
get_current_thread_index  [line 235]

  integer get_current_thread_index( )

Returns current thread index


API Tags:
Access:  public


[ Top ]
get_current_thread_vm  [line 265]

  Vars_Manager &get_current_thread_vm( )

Returns reference to current thread Vars_Manager


API Tags:
Access:  public


[ Top ]
get_current_url_var  [line 245]

  unknown get_current_url_var( )

Returns current URL variable value


API Tags:
Access:  public


[ Top ]
get_new_url_var  [line 334]

  string get_new_url_var( )

Generates new value for URL rewrite variable


API Tags:
Internal:  
Access:  private


[ Top ]
get_snapshot  [line 219]

  array get_snapshot( integer $thread_num, unknown_type $snapshot_num  )

Returns snapshot of thread

Parameters:
integer   $thread_num:  thread index
unknown_type   $snapshot_num:  Snapshot index

API Tags:
Internal:  
Access:  private


[ Top ]
get_url_rewrite_var  [line 290]

  string get_url_rewrite_var( Web_Context $context  )

Returns value of passed URL rewrite variable

Parameters:
Web_Context   $context: 

API Tags:
Internal:  
Access:  private


[ Top ]
get_url_rewrite_var_name  [line 255]

  unknown get_url_rewrite_var_name( )

Returns URL variable name


API Tags:
Access:  public


[ Top ]
get_usage_stat  [line 365]

  unknown get_usage_stat( )

Returns statistic about usage of threads and snapshots.


API Tags:
Access:  public


[ Top ]
is_url_rewrite_var_passed  [line 277]

  boolean is_url_rewrite_var_passed( Web_Context $context  )

Checks if URL variable is passed in POST or GET

Parameters:
Web_Context   $context: 

API Tags:
Internal:  
Access:  private


[ Top ]
new_pass  [line 184]

  void new_pass( )

Prepares ovject for new process


API Tags:
Internal:  
Access:  private


[ Top ]
process  [line 120]

  void process( Web_Context $context  )

Processes current context and manages threads

Parameters:
Web_Context   $context: 

API Tags:
Access:  public


[ Top ]
save_snapshot  [line 168]

  void save_snapshot( )

Saves snapshot ot current thread


API Tags:
Access:  public


[ Top ]