diff options
Diffstat (limited to 'deps/nghttp3/lib/nghttp3_tnode.h')
-rw-r--r-- | deps/nghttp3/lib/nghttp3_tnode.h | 82 |
1 files changed, 6 insertions, 76 deletions
diff --git a/deps/nghttp3/lib/nghttp3_tnode.h b/deps/nghttp3/lib/nghttp3_tnode.h index 8e1e5d5bdf9..bf861ed0409 100644 --- a/deps/nghttp3/lib/nghttp3_tnode.h +++ b/deps/nghttp3/lib/nghttp3_tnode.h @@ -33,17 +33,11 @@ #include "nghttp3_pq.h" -#define NGHTTP3_DEFAULT_WEIGHT 16 -#define NGHTTP3_MAX_WEIGHT 256 -#define NGHTTP3_TNODE_MAX_CYCLE_GAP ((1llu << 24) * 256 + 255) +#define NGHTTP3_TNODE_MAX_CYCLE_GAP (1llu << 24) typedef enum { NGHTTP3_NODE_ID_TYPE_STREAM = 0x00, NGHTTP3_NODE_ID_TYPE_PUSH = 0x01, - NGHTTP3_NODE_ID_TYPE_PLACEHOLDER = 0x02, - NGHTTP3_NODE_ID_TYPE_ROOT = 0x03, - /* NGHTTP3_NODE_ID_TYPE_UT is defined for unit test */ - NGHTTP3_NODE_ID_TYPE_UT = 0xff, } nghttp3_node_id_type; typedef struct { @@ -61,95 +55,31 @@ typedef struct nghttp3_tnode nghttp3_tnode; struct nghttp3_tnode { nghttp3_pq_entry pe; - nghttp3_pq pq; - nghttp3_tnode *parent; - nghttp3_tnode *first_child; - nghttp3_tnode *next_sibling; size_t num_children; nghttp3_node_id nid; uint64_t seq; uint64_t cycle; - uint32_t pending_penalty; - uint32_t weight; - /* active is defined for unit test and is nonzero if this node is - active. */ - int active; + /* pri is a stream priority produced by nghttp3_pri_to_uint8. */ + uint8_t pri; }; void nghttp3_tnode_init(nghttp3_tnode *tnode, const nghttp3_node_id *nid, - uint64_t seq, uint32_t weight, nghttp3_tnode *parent, - const nghttp3_mem *mem); + uint64_t seq, uint8_t pri); void nghttp3_tnode_free(nghttp3_tnode *tnode); -/* - * nghttp3_tnode_is_active returns nonzero if |tnode| is active. Only - * NGHTTP3_NODE_ID_TYPE_STREAM and NGHTTP3_NODE_ID_TYPE_PUSH (and - * NGHTTP3_NODE_ID_TYPE_UT for unit test) can become active. - */ -int nghttp3_tnode_is_active(nghttp3_tnode *tnode); - -void nghttp3_tnode_unschedule(nghttp3_tnode *tnode); - -/* - * nghttp3_tnode_unschedule_detach works like - * nghttp3_tnode_unschedule, but it removes |tnode| even if tnode->pq - * is not empty. - */ -void nghttp3_tnode_unschedule_detach(nghttp3_tnode *tnode); +void nghttp3_tnode_unschedule(nghttp3_tnode *tnode, nghttp3_pq *pq); /* * nghttp3_tnode_schedule schedules |tnode| using |nwrite| as penalty. * If |tnode| has already been scheduled, it is rescheduled by the * amount of |nwrite|. */ -int nghttp3_tnode_schedule(nghttp3_tnode *tnode, size_t nwrite); +int nghttp3_tnode_schedule(nghttp3_tnode *tnode, nghttp3_pq *pq, size_t nwrite); /* * nghttp3_tnode_is_scheduled returns nonzero if |tnode| is scheduled. */ int nghttp3_tnode_is_scheduled(nghttp3_tnode *tnode); -/* - * nghttp3_tnode_get_next returns node which has highest priority. - * This function returns NULL if there is no node. - */ -nghttp3_tnode *nghttp3_tnode_get_next(nghttp3_tnode *node); - -/* - * nghttp3_tnode_insert inserts |tnode| as a first child of |parent|. - * |tnode| might have its descendants. - */ -void nghttp3_tnode_insert(nghttp3_tnode *tnode, nghttp3_tnode *parent); - -/* - * nghttp3_tnode_insert_exclusive inserts |tnode| to |parent| as a - * distinct child. The existing direct children of |parent| become - * the children of |tnode|. - */ -int nghttp3_tnode_insert_exclusive(nghttp3_tnode *tnode, nghttp3_tnode *parent); - -/* - * nghttp3_tnode_remove removes |tnode| along with its subtree from - * its parent. - */ -void nghttp3_tnode_remove(nghttp3_tnode *tnode); - -/* - * nghttp3_tnode_squash removes |tnode| from its parent. The weight - * of |tnode| is distributed to the direct descendants of |tnode|. - * They are inserted to the former parent of |tnode|. - */ -int nghttp3_tnode_squash(nghttp3_tnode *tnode); - -/* - * nghttp3_tnode_find_ascendant returns an ascendant of |tnode| whose - * node ID is |nid|. If no such node exists, this function returns - * NULL. - */ -nghttp3_tnode *nghttp3_tnode_find_ascendant(nghttp3_tnode *tnode, - const nghttp3_node_id *nid); - -int nghttp3_tnode_has_active_descendant(nghttp3_tnode *tnode); - #endif /* NGHTTP3_TNODE_H */ |