void aggregator_feed_items_load( vector <map <string,string> > &items, int fid, int limit ) { map <string, string> item; if(DB_TYPE==1) { REDIS_RES * result; result = redis_pager_fields( redis_arg("SORT aggregator_item:fid:%d BY aggregator_item:*->timestamp DESC BY # DESC", fid), "GET aggregator_item:*->", "#iid,fid,title,link,author,description,timestamp,guid", limit); while( redis_fetch_fields( result, item ) ) { items.push_back( item ); } } if(DB_TYPE==2) { string sql = "SELECT * FROM aggregator_item WHERE fid = "+ str(fid) + " ORDER BY timestamp DESC, iid DESC"; MYSQL_RES * result = pager_query(sql, limit); while ( db_fetch(result, item) ) { items.push_back( item ); } } return; }
uintptr_t memory_frame_allocate (struct activity *activity) { pager_query (); uintptr_t f = zalloc (PAGESIZE); if (! f) { /* Check if there are any pages on the available list. */ /* XXX: We avoid objects that require special treatment. Realize this special treatment. */ struct object_desc *desc = available_list_head (&available); while (desc) { if (desc->type != vg_cap_activity_control && desc->type != vg_cap_thread) /* We will detach DESC from AVAILALBE in memory_object_destroy. */ break; desc = available_list_next (desc); } if (desc) { assert (desc->live); assert (desc->eviction_candidate); assert (desc->activity); assert (object_type ((struct vg_object *) desc->activity) == vg_cap_activity_control); assert (! desc->dirty || desc->policy.discardable); assert (! desc->mapped); debug (5, "Reusing OID " VG_OID_FMT " (%s)", VG_OID_PRINTF (desc->oid), vg_cap_type_string (desc->type)); struct vg_object *object = object_desc_to_object (desc); struct vg_folio *folio = objects_folio (activity, object); int offset = objects_folio_offset (object); bool discarded = desc->dirty; if (discarded) { assert (desc->policy.discardable); ACTIVITY_STATS (desc->activity)->discarded ++; } vg_oid_t oid = desc->oid; memory_object_destroy (activity, object); /* DESC is no longer valid. */ assert (! object_find_soft (activity, oid, VG_OBJECT_POLICY_DEFAULT)); if (discarded) /* Note that we discarded the page. */ { folio_object_content_set (folio, offset, false); folio_object_discarded_set (folio, offset, true); } f = (uintptr_t) object; memset ((void *) f, 0, PAGESIZE); } } if (! f) panic ("Out of memory"); pager_min_alloc_before_next_collect --; return f; }