33 bb->
cpu_count = sysconf( _SC_NPROCESSORS_ONLN );
146 memcpy( ret, &ke,
sizeof(
struct Key_entry ) );
192 if( existing_ks != NULL )
206 for( i = 0 ; i < sensivities_count ; i++ )
233 if( existing_ks == NULL )
290 printf(
"Cannot resubmit a data entry without a null refcount\n");
308 return ( ke == NULL )?0:1;
334 return ( ke == NULL )?0:1;
362 return (de == NULL)?0:1;
int knowledge_system_test_func(void *pks, uint64_t key, void *arg)
knowledge_system_test_func
void MALP_blackboard_init(struct MALP_blackboard *bb, uint32_t workers_count, void *context)
MALP_blackboard initialisation.
int MALP_Blackboard_submit_data_entry(struct MALP_blackboard *bb, struct Data_entry *de)
MALP_Blackboard_submit_data_entry.
#define KS_COLL_AVOID
Number of KS cells (Number of elements)
static void Hash_Table_use_lock(struct Hash_Table *ht)
Indicates that the hashtable must use a lock for operations (get/push)
struct Knowledge_system_job Knowledge_system_submit_data_entry(struct Knowledge_system *ks, struct Data_entry *de)
Knowledge_system_submit_data_entry.
void MALP_Blackboard_delete_ks(struct MALP_blackboard *bb, uint64_t type)
MALP_Blackboard_delete_ks.
void __MALP_Blackboard_delete_ks(void *pke, void *pks)
The Knowledge_system structure.
void MALP_Blackboard_submit_to_ke_ks(struct MALP_blackboard *bb, struct Key_entry *ke, struct Data_entry *de)
void Key_entry_push_ks(struct Key_entry *ke, struct Knowledge_system *ks)
associates a Knowledge_system to a key entry
struct Hash_Table ks_table
The Knowledge system cell structure Structure containing an internal hash table and table of knowledg...
struct Hash_Table de_name_table
struct Key_entry * MALP_Blackboard_push_unique_ke(struct MALP_blackboard *bb, uint64_t key)
void free_key_ent(void *pke)
void Key_entry_pop_ks(struct Key_entry *ke, struct Knowledge_system *ks)
Removes an association between a Knowledge_system and its key.
void * Hash_Table_push(struct Hash_Table *ht, void *payload, uint64_t key)
adds an element to a hashtable
short been_resubmitted
1 if it has been re-submitted
int MALP_Blackboard_ks_present(struct MALP_blackboard *bb, uint64_t type)
test if a knowledge system is available in a MALP_Blackboard Test if a knowledge system of a specific...
uint64_t key
the key identifier
int MALP_Spinlock_unlock(MALP_Spinlock *mutex)
Unlocks the given MALP_Spinlock.
void MALP_blackboard_release(struct MALP_blackboard *bb)
MALP_blackboard release.
struct representing a job that does the actual data processing (created by Knowledge_system) ...
void Key_entry_init(struct Key_entry *ke, uint64_t key)
Init a key entry with given key.
void(* default_handler)(struct MALP_blackboard *, uint64_t KS_id, struct Data_entry **, uint32_t, void *arg)
void Key_entry_walk(struct Key_entry *ke, int(*handler)(struct Knowledge_system *, void *), void *arg)
Call a handler on every Ks of a key entry.
The MALP_blackboard structure.
struct Hash_Table key_table
struct Knowledge_system * MALP_Blackboard_new_ks(struct MALP_blackboard *bb, uint64_t type, uint64_t *sensivities, uint32_t sensivities_count, void(*process)(struct MALP_blackboard *bb, struct Data_entry **de, uint32_t entry_count, void *arg), void *arg)
Create a new Knowledge system while associating a key (used as an id and a type) and a handler (proce...
void(* process)(struct MALP_blackboard *bb, struct Data_entry **de, uint32_t entry_count, void *arg)
uint64_t key
the key, identifying the type of data
void MALP_blackboard_wait(struct MALP_blackboard *bb)
MALP_blackboard_wait Function to call the wait function for the Pbb workers of a MALP blackboard...
void Hash_Table_init(struct Hash_Table *ht, size_t sizeof_payload, uint64_t table_size, uint8_t coll_avoid)
Hash_Table initialization.
int MALP_Blackboard_submit_data(struct MALP_blackboard *bb, uint64_t key, void *payload, size_t payload_size)
MALP_Blackboard_submit_data.
void Hash_Table_walkthrought_2p(struct Hash_Table *ht, void *second_arg, void(*action)(void *, void *))
Executes a function on every stored elements.
void * Hash_Table_get(struct Hash_Table *ht, uint64_t key, void *extra_arg, int(*test_func)(void *, uint64_t, void *))
retrieves an element from the hashtable
int MALP_Blackboard_resubmit_data_entry(struct MALP_blackboard *bb, struct Data_entry *de)
MALP_Blackboard_resubmit_data_entry.
static void MALP_Blackboard_add_pending(struct MALP_blackboard *bb)
Increments the number of pending data block counter.
static uint64_t Data_entry_get_ref_count(struct Data_entry *de)
Getter on the ref_count of a Data_entry.
The Name_cell structure Structure containing an internal hash table and table of cell names...
void MALP_Blackboard_compute_de_refcount(struct Key_entry *ke, struct Data_entry *de)
void Hash_Table_release(struct Hash_Table *ht, void(*free_f)(void *))
Hash_Table release.
int MALP_Spinlock_lock(MALP_Spinlock *mutex)
Locks the given MALP_Spinlock.
struct Data_entry * Data_entry_init(uint64_t key, void *payload, size_t size)
Creates a new Data_entry.
int ke_submit_handler(struct Knowledge_system *ks, void *pbbsb)
int empty_key_entry_test_func(void *pke, uint64_t key, void *arg)
empty_key_entry_test_func
void Pbb_workers_wait(struct Pbb_workers *wk)
Waits until all workers are done.
void Knowledge_system_release(struct Knowledge_system *ks)
Knowledge_system release.
int key_entry_test_func(void *pke, uint64_t key, void *arg)
key_entry_test_func
int empty_knowledge_system_test_func(void *pks, uint64_t key, void *arg)
empty_knowledge_system_test_func
struct Key_entry * MALP_Blackboard_get_ke(struct MALP_blackboard *bb, uint64_t key)
struct Knowledge_system * MALP_Blackboard_push_ks(struct MALP_blackboard *bb, struct Knowledge_system *ks)
Struct defining a piece of data that can exist on the blackboard.
The Key_cell structure Structure containing an internal hash table and table of key entries ( Key ent...
void Pbb_workers_submit(struct Pbb_workers *wk, struct Knowledge_system_job *ksj)
sumbits a job on workers
#define KEY_COLL_AVOID
Number of column keys (Number of elements)
void Key_entry_release(struct Key_entry *ke)
Clears a key entry.
uint8_t freed
set to one when the entry is released, 0 otherwise
static void Data_entry_inc_ref_count(struct Data_entry *de, uint64_t val)
Increments the ref_count of a Data_entry by a given value.
struct Pbb_workers workers
#define NAME_COLL_AVOID
Number of column names (Number of elements)
void Pbb_workers_init(struct Pbb_workers *wk, struct MALP_blackboard *bb, uint32_t wk_count)
Initializes workers.
void Knowledge_system_init(struct Knowledge_system *ks, uint64_t type, uint64_t *sensivity_keys, uint32_t sensivity_count, void(*process)(struct MALP_blackboard *bb, struct Data_entry **de, uint32_t entry_count, void *arg), void *arg)
Initializes a Knowledge_system.
void Pbb_workers_release(struct Pbb_workers *wk)
releases workers
struct Data_entry * de
the data entry
volatile uint64_t pending_datas
int Key_entry_get_count(struct Key_entry *ke)
Get the number of Ks in this entry.
struct MALP_blackboard * bb
the blackboard
void MALP_Trace_crc64_init()
This initializes the CRC64 internals.