##############################################################################
# NOTICE: This File has been generated by scripts/pyslurm_bindgen.py, which
# uses the autopxd2 tool in order to generate Cython compatible definitions
# from the slurmdb.h C-Header file. Basically, this can be seen as a modified
# version of the original header, with the following changes:
#
# * have the correct cython syntax for type definitions, e.g. "typedef struct
# <name>" is converted to "ctypedef struct <name>"
# * C-Macros are listed with their appropriate uint type
# * Any definitions that cannot be translated are not included in this file
#
# Generated on 2026-02-12T20:29:47.283339
#
# The Original Copyright notice from slurmdb.h has been included
# below:
#
##############################################################################
#  slurmdb.h - Interface codes and functions for slurm
##############################################################################
#  Copyright (C) 2010 Lawrence Livermore National Security.
#  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
#  Written by Danny Auble da@llnl.gov, et. al.
#  CODE-OCEC-09-009. All rights reserved.
#
# Slurm is licensed under the GNU GPLv2. For the full text of Slurm's License,
# please see here: pyslurm/slurm/SLURM_LICENSE
#
# Please, as mentioned above, also have a look at Slurm's DISCLAIMER under
# pyslurm/slurm/SLURM_DISCLAIMER
##############################################################################
#
# Copyright (C) 2023 PySlurm Developers (Modifications as described above)
#
# This file is part of PySlurm
#
# PySlurm is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PySlurm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with PySlurm; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

cdef extern from "slurm/slurmdb.h":

    uint8_t QOS_COND_FLAG_WITH_DELETED
    uint32_t SLURMDB_RES_FLAG_BASE
    uint32_t SLURMDB_RES_FLAG_NOTSET
    uint32_t SLURMDB_RES_FLAG_ADD
    uint32_t SLURMDB_RES_FLAG_REMOVE
    uint8_t SLURMDB_RES_FLAG_ABSOLUTE
    uint32_t FEDERATION_FLAG_BASE
    uint32_t FEDERATION_FLAG_NOTSET
    uint32_t FEDERATION_FLAG_ADD
    uint32_t FEDERATION_FLAG_REMOVE
    uint8_t CLUSTER_FED_STATE_BASE
    uint16_t CLUSTER_FED_STATE_FLAGS
    uint8_t CLUSTER_FED_STATE_DRAIN
    uint8_t CLUSTER_FED_STATE_REMOVE
    uint8_t SLURMDB_JOB_FLAG_NONE
    uint8_t SLURMDB_JOB_CLEAR_SCHED
    uint8_t SLURMDB_JOB_FLAG_NOTSET
    uint8_t SLURMDB_JOB_FLAG_SUBMIT
    uint8_t SLURMDB_JOB_FLAG_SCHED
    uint8_t SLURMDB_JOB_FLAG_BACKFILL
    uint8_t SLURMDB_JOB_FLAG_START_R
    uint8_t SLURMDB_JOB_FLAG_ALTERED
    uint8_t JOBCOND_FLAG_DUP
    uint8_t JOBCOND_FLAG_NO_STEP
    uint8_t JOBCOND_FLAG_NO_TRUNC
    uint8_t JOBCOND_FLAG_RUNAWAY
    uint8_t JOBCOND_FLAG_WHOLE_HETJOB
    uint8_t JOBCOND_FLAG_NO_WHOLE_HETJOB
    uint8_t JOBCOND_FLAG_NO_WAIT
    uint8_t JOBCOND_FLAG_NO_DEFAULT_USAGE
    uint16_t JOBCOND_FLAG_SCRIPT
    uint16_t JOBCOND_FLAG_ENV
    uint16_t SLURMDB_PURGE_BASE
    uint32_t SLURMDB_PURGE_FLAGS
    uint32_t SLURMDB_PURGE_HOURS
    uint32_t SLURMDB_PURGE_DAYS
    uint32_t SLURMDB_PURGE_MONTHS
    uint32_t SLURMDB_PURGE_ARCHIVE
    uint32_t SLURMDB_FS_USE_PARENT
    uint16_t SLURMDB_CLASSIFIED_FLAG
    uint8_t SLURMDB_CLASS_BASE
    uint8_t ASSOC_COND_FLAG_WITH_DELETED
    uint8_t ASSOC_COND_FLAG_WITH_USAGE
    uint8_t ASSOC_COND_FLAG_ONLY_DEFS
    uint8_t ASSOC_COND_FLAG_RAW_QOS
    uint8_t ASSOC_COND_FLAG_SUB_ACCTS
    uint8_t ASSOC_COND_FLAG_WOPI
    uint8_t ASSOC_COND_FLAG_WOPL
    uint8_t ASSOC_COND_FLAG_QOS_USAGE
    uint16_t ASSOC_COND_FLAG_WITH_NG_USAGE
    uint8_t SLURMDB_EVENT_COND_OPEN
    uint8_t DB_CONN_FLAG_CLUSTER_DEL
    uint8_t DB_CONN_FLAG_ROLLBACK
    uint8_t DB_CONN_FLAG_FEDUPDATE
    uint8_t COORD_SET_INDIRECT
    uint8_t COORD_SET_DIRECT
    uint8_t COORD_SET_BY_ACCT

cdef extern from "slurm/slurmdb.h":

    ctypedef enum slurmdb_admin_level_t:
        SLURMDB_ADMIN_NOTSET
        SLURMDB_ADMIN_NONE
        SLURMDB_ADMIN_OPERATOR
        SLURMDB_ADMIN_SUPER_USER

    ctypedef enum slurmdb_classification_type_t:
        SLURMDB_CLASS_NONE
        SLURMDB_CLASS_CAPABILITY
        SLURMDB_CLASS_CAPACITY
        SLURMDB_CLASS_CAPAPACITY

    ctypedef enum slurmdb_event_type_t:
        SLURMDB_EVENT_ALL
        SLURMDB_EVENT_CLUSTER
        SLURMDB_EVENT_NODE

    ctypedef enum slurmdb_problem_type_t:
        SLURMDB_PROBLEM_NOT_SET
        SLURMDB_PROBLEM_ACCT_NO_ASSOC
        SLURMDB_PROBLEM_ACCT_NO_USERS
        SLURMDB_PROBLEM_USER_NO_ASSOC
        SLURMDB_PROBLEM_USER_NO_UID

    ctypedef enum slurmdb_report_sort_t:
        SLURMDB_REPORT_SORT_TIME
        SLURMDB_REPORT_SORT_NAME

    ctypedef enum slurmdb_report_time_format_t:
        SLURMDB_REPORT_TIME_SECS
        SLURMDB_REPORT_TIME_MINS
        SLURMDB_REPORT_TIME_HOURS
        SLURMDB_REPORT_TIME_PERCENT
        SLURMDB_REPORT_TIME_SECS_PER
        SLURMDB_REPORT_TIME_MINS_PER
        SLURMDB_REPORT_TIME_HOURS_PER

    ctypedef enum slurmdb_resource_type_t:
        SLURMDB_RESOURCE_NOTSET
        SLURMDB_RESOURCE_LICENSE

    ctypedef enum slurmdb_update_type_t:
        SLURMDB_UPDATE_NOTSET
        SLURMDB_ADD_USER
        SLURMDB_ADD_ASSOC
        SLURMDB_ADD_COORD
        SLURMDB_MODIFY_USER
        SLURMDB_MODIFY_ASSOC
        SLURMDB_REMOVE_USER
        SLURMDB_REMOVE_ASSOC
        SLURMDB_REMOVE_COORD
        SLURMDB_ADD_QOS
        SLURMDB_REMOVE_QOS
        SLURMDB_MODIFY_QOS
        SLURMDB_ADD_WCKEY
        SLURMDB_REMOVE_WCKEY
        SLURMDB_MODIFY_WCKEY
        SLURMDB_ADD_CLUSTER
        SLURMDB_REMOVE_CLUSTER
        SLURMDB_REMOVE_ASSOC_USAGE
        SLURMDB_ADD_RES
        SLURMDB_REMOVE_RES
        SLURMDB_MODIFY_RES
        SLURMDB_UPDATE_QOS_USAGE
        SLURMDB_ADD_TRES
        SLURMDB_UPDATE_FEDS

    ctypedef enum slurmdb_qos_flags_t:
        QOS_FLAG_NONE
        QOS_FLAG_PART_MIN_NODE
        QOS_FLAG_PART_MAX_NODE
        QOS_FLAG_PART_TIME_LIMIT
        QOS_FLAG_ENFORCE_USAGE_THRES
        QOS_FLAG_NO_RESERVE
        QOS_FLAG_REQ_RESV
        QOS_FLAG_DENY_LIMIT
        QOS_FLAG_OVER_PART_QOS
        QOS_FLAG_NO_DECAY
        QOS_FLAG_USAGE_FACTOR_SAFE
        QOS_FLAG_RELATIVE
        QOS_FLAG_RELATIVE_SET
        QOS_FLAG_PART_QOS
        QOS_FLAG_DELETED
        QOS_FLAG_BASE
        QOS_FLAG_NOTSET
        QOS_FLAG_ADD
        QOS_FLAG_REMOVE

    cdef enum cluster_fed_states:
        CLUSTER_FED_STATE_NA
        CLUSTER_FED_STATE_ACTIVE
        CLUSTER_FED_STATE_INACTIVE

    ctypedef enum slurmdb_cluster_flags_t:
        CLUSTER_FLAG_NONE
        CLUSTER_FLAG_REGISTER
        CLUSTER_FLAG_DELETED
        CLUSTER_FLAG_MULTSD
        CLUSTER_FLAG_FED
        CLUSTER_FLAG_EXT

    ctypedef enum slurmdb_assoc_flags_t:
        ASSOC_FLAG_NONE
        ASSOC_FLAG_DELETED
        ASSOC_FLAG_NO_UPDATE
        ASSOC_FLAG_EXACT
        ASSOC_FLAG_USER_COORD_NO
        ASSOC_FLAG_BASE
        ASSOC_FLAG_USER_COORD
        ASSOC_FLAG_BLOCK_ADD

    ctypedef struct slurmdb_tres_rec_t:
        uint64_t alloc_secs
        uint32_t rec_count
        uint64_t count
        uint32_t id
        char modifier
        char* name
        char* type

    ctypedef struct slurmdb_assoc_cond_t:
        list_t* acct_list
        list_t* cluster_list
        list_t* def_qos_id_list
        uint32_t flags
        list_t* format_list
        list_t* id_list
        list_t* parent_acct_list
        list_t* partition_list
        list_t* qos_list
        time_t usage_end
        time_t usage_start
        list_t* user_list

    ctypedef struct slurmdb_job_cond_t:
        list_t* acct_list
        list_t* associd_list
        list_t* cluster_list
        list_t* constraint_list
        uint32_t cpus_max
        uint32_t cpus_min
        uint32_t db_flags
        int32_t exitcode
        uint32_t flags
        list_t* format_list
        list_t* groupid_list
        list_t* jobname_list
        uint32_t nodes_max
        uint32_t nodes_min
        list_t* partition_list
        list_t* qos_list
        list_t* reason_list
        list_t* resv_list
        list_t* resvid_list
        list_t* state_list
        list_t* step_list
        uint32_t timelimit_max
        uint32_t timelimit_min
        time_t usage_end
        time_t usage_start
        char* used_nodes
        list_t* userid_list
        list_t* wckey_list

    ctypedef struct slurmdb_stats_t:
        double act_cpufreq
        uint64_t consumed_energy
        char* tres_usage_in_ave
        char* tres_usage_in_max
        char* tres_usage_in_max_nodeid
        char* tres_usage_in_max_taskid
        char* tres_usage_in_min
        char* tres_usage_in_min_nodeid
        char* tres_usage_in_min_taskid
        char* tres_usage_in_tot
        char* tres_usage_out_ave
        char* tres_usage_out_max
        char* tres_usage_out_max_nodeid
        char* tres_usage_out_max_taskid
        char* tres_usage_out_min
        char* tres_usage_out_min_nodeid
        char* tres_usage_out_min_taskid
        char* tres_usage_out_tot

    ctypedef enum slurmdb_acct_flags_t:
        SLURMDB_ACCT_FLAG_NONE
        SLURMDB_ACCT_FLAG_DELETED
        SLURMDB_ACCT_FLAG_WASSOC
        SLURMDB_ACCT_FLAG_WCOORD
        SLURMDB_ACCT_FLAG_USER_COORD_NO
        SLURMDB_ACCT_FLAG_BASE
        SLURMDB_ACCT_FLAG_USER_COORD

    ctypedef struct slurmdb_account_cond_t:
        slurmdb_assoc_cond_t* assoc_cond
        list_t* description_list
        slurmdb_acct_flags_t flags
        list_t* organization_list

    ctypedef struct slurmdb_account_rec_t:
        list_t* assoc_list
        list_t* coordinators
        char* description
        slurmdb_acct_flags_t flags
        char* name
        char* organization

    ctypedef struct slurmdb_accounting_rec_t:
        uint64_t alloc_secs
        uint32_t id
        uint32_t id_alt
        time_t period_start
        slurmdb_tres_rec_t tres_rec

    ctypedef struct slurmdb_archive_cond_t:
        char* archive_dir
        char* archive_script
        slurmdb_job_cond_t* job_cond
        uint32_t purge_event
        uint32_t purge_job
        uint32_t purge_resv
        uint32_t purge_step
        uint32_t purge_suspend
        uint32_t purge_txn
        uint32_t purge_usage

    ctypedef struct slurmdb_archive_rec_t:
        char* archive_file
        char* insert

    ctypedef struct slurmdb_tres_cond_t:
        uint64_t count
        list_t* format_list
        list_t* id_list
        list_t* name_list
        list_t* type_list
        uint16_t with_deleted

    ctypedef slurmdb_assoc_usage slurmdb_assoc_usage_t

    ctypedef slurmdb_bf_usage slurmdb_bf_usage_t

    ctypedef slurmdb_user_rec slurmdb_user_rec_t

    cdef struct slurmdb_assoc_rec:
        list_t* accounting_list
        char* acct
        slurmdb_assoc_rec* assoc_next
        slurmdb_assoc_rec* assoc_next_id
        slurmdb_bf_usage_t* bf_usage
        char* cluster
        char* comment
        uint32_t def_qos_id
        slurmdb_assoc_flags_t flags
        uint32_t grp_jobs
        uint32_t grp_jobs_accrue
        uint32_t grp_submit_jobs
        char* grp_tres
        uint64_t* grp_tres_ctld
        char* grp_tres_mins
        uint64_t* grp_tres_mins_ctld
        char* grp_tres_run_mins
        uint64_t* grp_tres_run_mins_ctld
        uint32_t grp_wall
        uint32_t id
        uint16_t is_def
        slurmdb_assoc_usage_t* leaf_usage
        char* lineage
        uint32_t max_jobs
        uint32_t max_jobs_accrue
        uint32_t max_submit_jobs
        char* max_tres_mins_pj
        uint64_t* max_tres_mins_ctld
        char* max_tres_run_mins
        uint64_t* max_tres_run_mins_ctld
        char* max_tres_pj
        uint64_t* max_tres_ctld
        char* max_tres_pn
        uint64_t* max_tres_pn_ctld
        uint32_t max_wall_pj
        uint32_t min_prio_thresh
        char* parent_acct
        uint32_t parent_id
        char* partition
        uint32_t priority
        list_t* qos_list
        uint32_t shares_raw
        uint32_t uid
        slurmdb_assoc_usage_t* usage
        char* user
        slurmdb_user_rec_t* user_rec

    ctypedef slurmdb_assoc_rec slurmdb_assoc_rec_t

    ctypedef struct slurmdb_add_assoc_cond_t:
        list_t* acct_list
        slurmdb_assoc_rec_t assoc
        list_t* cluster_list
        char* default_acct
        list_t* partition_list
        list_t* user_list
        list_t* wckey_list

    cdef struct slurmdb_assoc_usage:
        uint32_t accrue_cnt
        list_t* children_list
        bitstr_t* grp_node_bitmap
        uint16_t* grp_node_job_cnt
        uint64_t* grp_used_tres
        uint64_t* grp_used_tres_run_secs
        double grp_used_wall
        double fs_factor
        uint32_t level_shares
        slurmdb_assoc_rec_t* parent_assoc_ptr
        double priority_norm
        slurmdb_assoc_rec_t* fs_assoc_ptr
        double shares_norm
        uint32_t tres_cnt
        long double usage_efctv
        long double usage_norm
        long double usage_raw
        long double* usage_tres_raw
        uint32_t used_jobs
        uint32_t used_submit_jobs
        long double level_fs
        bitstr_t* valid_qos

    cdef struct slurmdb_bf_usage:
        uint64_t count
        time_t last_sched

    ctypedef struct slurmdb_cluster_cond_t:
        uint16_t classification
        list_t* cluster_list
        list_t* federation_list
        slurmdb_cluster_flags_t flags
        list_t* format_list
        list_t* rpc_version_list
        time_t usage_end
        time_t usage_start
        uint16_t with_deleted
        uint16_t with_usage

    ctypedef struct slurmdb_cluster_fed_t:
        list_t* feature_list
        uint32_t id
        char* name
        void* recv
        void* send
        uint32_t state
        bool sync_recvd
        bool sync_sent

    cdef struct slurmdb_cluster_rec:
        list_t* accounting_list
        uint16_t classification
        time_t comm_fail_time
        slurm_addr_t control_addr
        char* control_host
        uint32_t control_port
        uint16_t dimensions
        int* dim_size
        uint16_t id
        slurmdb_cluster_fed_t fed
        slurmdb_cluster_flags_t flags
        pthread_mutex_t lock
        char* name
        char* nodes
        slurmdb_assoc_rec_t* root_assoc
        uint16_t rpc_version
        list_t* send_rpc
        char* tres_str

    ctypedef struct slurmdb_cluster_accounting_rec_t:
        uint64_t alloc_secs
        uint64_t down_secs
        uint64_t idle_secs
        uint64_t over_secs
        uint64_t pdown_secs
        time_t period_start
        uint64_t plan_secs
        slurmdb_tres_rec_t tres_rec

    ctypedef struct slurmdb_clus_res_rec_t:
        char* cluster
        uint32_t allowed

    ctypedef struct slurmdb_coord_rec_t:
        char* name
        uint16_t direct

    ctypedef struct slurmdb_event_cond_t:
        list_t* cluster_list
        uint32_t cond_flags
        uint32_t cpus_max
        uint32_t cpus_min
        uint16_t event_type
        list_t* format_list
        char* node_list
        time_t period_end
        time_t period_start
        list_t* reason_list
        list_t* reason_uid_list
        list_t* state_list

    ctypedef struct slurmdb_event_rec_t:
        char* cluster
        char* cluster_nodes
        uint16_t event_type
        char* node_name
        time_t period_end
        time_t period_start
        char* reason
        uint32_t reason_uid
        uint32_t state
        char* tres_str

    ctypedef struct slurmdb_federation_cond_t:
        list_t* cluster_list
        list_t* federation_list
        list_t* format_list
        uint16_t with_deleted

    ctypedef struct slurmdb_federation_rec_t:
        char* name
        uint32_t flags
        list_t* cluster_list

    ctypedef struct slurmdb_instance_cond_t:
        list_t* cluster_list
        list_t* extra_list
        list_t* format_list
        list_t* instance_id_list
        list_t* instance_type_list
        char* node_list
        time_t time_end
        time_t time_start

    ctypedef struct slurmdb_instance_rec_t:
        char* cluster
        char* extra
        char* instance_id
        char* instance_type
        char* node_name
        time_t time_end
        time_t time_start

    ctypedef struct slurmdb_job_rec_t:
        char* account
        char* admin_comment
        uint32_t alloc_nodes
        uint32_t array_job_id
        uint32_t array_max_tasks
        uint32_t array_task_id
        char* array_task_str
        uint32_t associd
        char* blockid
        char* cluster
        char* constraints
        char* container
        uint64_t db_index
        uint32_t derived_ec
        char* derived_es
        uint32_t elapsed
        time_t eligible
        time_t end
        char* env
        uint32_t exitcode
        char* extra
        char* failed_node
        uint32_t flags
        void* first_step_ptr
        uint32_t gid
        uint32_t het_job_id
        uint32_t het_job_offset
        uint32_t jobid
        char* jobname
        char* lineage
        char* licenses
        char* mcs_label
        char* nodes
        char* partition
        uint32_t priority
        uint32_t qosid
        char* qos_req
        uint32_t req_cpus
        uint64_t req_mem
        uint32_t requid
        uint16_t restart_cnt
        uint32_t resvid
        char* resv_name
        char* resv_req
        char* script
        uint16_t segment_size
        uint32_t show_full
        time_t start
        uint32_t state
        uint32_t state_reason_prev
        list_t* steps
        char* std_err
        char* std_in
        char* std_out
        time_t submit
        char* submit_line
        uint32_t suspended
        char* system_comment
        uint64_t sys_cpu_sec
        uint64_t sys_cpu_usec
        uint32_t timelimit
        uint64_t tot_cpu_sec
        uint64_t tot_cpu_usec
        char* tres_alloc_str
        char* tres_req_str
        uint32_t uid
        char* used_gres
        char* user
        uint64_t user_cpu_sec
        uint64_t user_cpu_usec
        char* wckey
        uint32_t wckeyid
        char* work_dir

    ctypedef struct slurmdb_qos_usage_t:
        uint32_t accrue_cnt
        list_t* acct_limit_list
        list_t* job_list
        bitstr_t* grp_node_bitmap
        uint16_t* grp_node_job_cnt
        uint32_t grp_used_jobs
        uint32_t grp_used_submit_jobs
        uint64_t* grp_used_tres
        uint64_t* grp_used_tres_run_secs
        double grp_used_wall
        double norm_priority
        uint32_t tres_cnt
        long double usage_raw
        long double* usage_tres_raw
        list_t* user_limit_list

    ctypedef struct slurmdb_qos_rec_t:
        time_t blocked_until
        char* description
        uint32_t id
        slurmdb_qos_flags_t flags
        uint32_t grace_time
        uint32_t grp_jobs_accrue
        uint32_t grp_jobs
        uint32_t grp_submit_jobs
        char* grp_tres
        uint64_t* grp_tres_ctld
        char* grp_tres_mins
        uint64_t* grp_tres_mins_ctld
        char* grp_tres_run_mins
        uint64_t* grp_tres_run_mins_ctld
        uint32_t grp_wall
        double limit_factor
        uint32_t max_jobs_pa
        uint32_t max_jobs_pu
        uint32_t max_jobs_accrue_pa
        uint32_t max_jobs_accrue_pu
        uint32_t max_submit_jobs_pa
        uint32_t max_submit_jobs_pu
        char* max_tres_mins_pj
        uint64_t* max_tres_mins_pj_ctld
        char* max_tres_pa
        uint64_t* max_tres_pa_ctld
        char* max_tres_pj
        uint64_t* max_tres_pj_ctld
        char* max_tres_pn
        uint64_t* max_tres_pn_ctld
        char* max_tres_pu
        uint64_t* max_tres_pu_ctld
        char* max_tres_run_mins_pa
        uint64_t* max_tres_run_mins_pa_ctld
        char* max_tres_run_mins_pu
        uint64_t* max_tres_run_mins_pu_ctld
        uint32_t max_wall_pj
        uint32_t min_prio_thresh
        char* min_tres_pj
        uint64_t* min_tres_pj_ctld
        char* name
        bitstr_t* preempt_bitstr
        list_t* preempt_list
        uint16_t preempt_mode
        uint32_t preempt_exempt_time
        uint32_t priority
        uint64_t* relative_tres_cnt
        slurmdb_qos_usage_t* usage
        double usage_factor
        double usage_thres

    ctypedef struct slurmdb_qos_cond_t:
        list_t* description_list
        uint16_t flags
        list_t* id_list
        list_t* format_list
        list_t* name_list
        uint16_t preempt_mode

    ctypedef struct slurmdb_reservation_cond_t:
        list_t* cluster_list
        uint64_t flags
        list_t* format_list
        list_t* id_list
        list_t* name_list
        char* nodes
        time_t time_end
        time_t time_start
        uint16_t with_usage

    ctypedef struct slurmdb_reservation_rec_t:
        char* assocs
        char* cluster
        char* comment
        uint64_t flags
        uint32_t id
        char* name
        char* nodes
        char* node_inx
        time_t time_end
        time_t time_force
        time_t time_start
        time_t time_start_prev
        char* tres_str
        double unused_wall
        list_t* tres_list

    ctypedef struct slurmdb_step_rec_t:
        char* container
        char* cwd
        uint32_t elapsed
        time_t end
        int32_t exitcode
        slurmdb_job_rec_t* job_ptr
        uint32_t nnodes
        char* nodes
        uint32_t ntasks
        char* pid_str
        uint32_t req_cpufreq_min
        uint32_t req_cpufreq_max
        uint32_t req_cpufreq_gov
        uint32_t requid
        time_t start
        uint32_t state
        slurmdb_stats_t stats
        slurm_step_id_t step_id
        char* stepname
        char* std_err
        char* std_in
        char* std_out
        char* submit_line
        uint32_t suspended
        uint64_t sys_cpu_sec
        uint32_t sys_cpu_usec
        uint32_t task_dist
        uint32_t timelimit
        uint64_t tot_cpu_sec
        uint32_t tot_cpu_usec
        char* tres_alloc_str
        uint64_t user_cpu_sec
        uint32_t user_cpu_usec

    ctypedef struct slurmdb_res_cond_t:
        list_t* allowed_list
        list_t* cluster_list
        list_t* description_list
        uint32_t flags
        list_t* format_list
        list_t* id_list
        list_t* manager_list
        list_t* name_list
        list_t* server_list
        list_t* type_list
        uint16_t with_deleted
        uint16_t with_clusters

    ctypedef struct slurmdb_res_rec_t:
        uint32_t allocated
        uint32_t last_consumed
        list_t* clus_res_list
        slurmdb_clus_res_rec_t* clus_res_rec
        uint32_t count
        char* description
        uint32_t flags
        uint32_t id
        time_t last_update
        char* manager
        char* name
        char* server
        uint32_t type

    ctypedef struct slurmdb_txn_cond_t:
        list_t* acct_list
        list_t* action_list
        list_t* actor_list
        list_t* cluster_list
        list_t* format_list
        list_t* id_list
        list_t* info_list
        list_t* name_list
        time_t time_end
        time_t time_start
        list_t* user_list
        uint16_t with_assoc_info

    ctypedef struct slurmdb_txn_rec_t:
        char* accts
        uint16_t action
        char* actor_name
        char* clusters
        uint32_t id
        char* set_info
        time_t timestamp
        char* users
        char* where_query

    ctypedef struct slurmdb_used_limits_t:
        uint32_t accrue_cnt
        char* acct
        uint32_t jobs
        uint32_t submit_jobs
        uint64_t* tres
        uint64_t* tres_run_secs
        bitstr_t* node_bitmap
        uint16_t* node_job_cnt
        uint32_t uid

    ctypedef struct slurmdb_user_cond_t:
        uint16_t admin_level
        slurmdb_assoc_cond_t* assoc_cond
        list_t* def_acct_list
        list_t* def_wckey_list
        uint16_t with_assocs
        uint16_t with_coords
        uint16_t with_deleted
        uint16_t with_wckeys
        uint16_t without_defaults

    cdef enum:
        SLURMDB_USER_FLAG_NONE
        SLURMDB_USER_FLAG_DELETED

    cdef struct slurmdb_user_rec:
        uint16_t admin_level
        list_t* assoc_list
        slurmdb_bf_usage_t* bf_usage
        list_t* coord_accts
        uint32_t def_qos_id
        char* default_acct
        char* default_wckey
        uint32_t flags
        char* name
        char* old_name
        uint32_t uid
        list_t* wckey_list

    ctypedef struct slurmdb_update_object_t:
        list_t* objects
        uint16_t type

    ctypedef struct slurmdb_wckey_cond_t:
        list_t* cluster_list
        list_t* format_list
        list_t* id_list
        list_t* name_list
        uint16_t only_defs
        time_t usage_end
        time_t usage_start
        list_t* user_list
        uint16_t with_usage
        uint16_t with_deleted

    cdef enum:
        SLURMDB_WCKEY_FLAG_NONE
        SLURMDB_WCKEY_FLAG_DELETED

    ctypedef struct slurmdb_wckey_rec_t:
        list_t* accounting_list
        char* cluster
        uint32_t flags
        uint32_t id
        uint16_t is_def
        char* name
        uint32_t uid
        char* user

    ctypedef struct slurmdb_print_tree_t:
        char* name
        char* print_name
        char* spaces
        uint16_t user

    ctypedef struct slurmdb_hierarchical_rec_t:
        slurmdb_assoc_rec_t* assoc
        char* key
        char* sort_name
        list_t* children

    ctypedef struct slurmdb_report_assoc_rec_t:
        char* acct
        char* cluster
        uint32_t id
        uint32_t id_alt
        char* parent_acct
        list_t* tres_list
        char* user

    ctypedef struct slurmdb_report_user_rec_t:
        char* acct
        list_t* acct_list
        list_t* assoc_list
        char* name
        char* partition
        list_t* tres_list
        uid_t uid

    ctypedef struct slurmdb_report_cluster_rec_t:
        list_t* accounting_list
        list_t* assoc_list
        char* name
        list_t* tres_list
        list_t* user_list

    ctypedef struct slurmdb_report_job_grouping_t:
        uint32_t count
        list_t* jobs
        uint32_t min_size
        uint32_t max_size
        list_t* tres_list

    ctypedef struct slurmdb_report_acct_grouping_t:
        char* acct
        uint32_t count
        list_t* groups
        char* lineage
        list_t* tres_list

    ctypedef struct slurmdb_report_cluster_grouping_t:
        list_t* acct_list
        char* cluster
        uint32_t count
        list_t* tres_list

    cdef enum:
        DBD_ROLLUP_HOUR
        DBD_ROLLUP_DAY
        DBD_ROLLUP_MONTH
        DBD_ROLLUP_COUNT

    ctypedef struct slurmdb_rollup_stats_t:
        char* cluster_name
        uint16_t count[4]
        time_t timestamp[4]
        uint64_t time_last[4]
        uint64_t time_max[4]
        uint64_t time_total[4]

    ctypedef struct slurmdb_rpc_obj_t:
        uint32_t cnt
        uint32_t id
        uint64_t time
        uint64_t time_ave

    ctypedef struct slurmdb_stats_rec_t:
        slurmdb_rollup_stats_t* dbd_rollup_stats
        list_t* rollup_stats
        list_t* rpc_list
        time_t time_start
        list_t* user_list

    slurmdb_cluster_rec_t* working_cluster_rec

    int slurmdb_accounts_add(void* db_conn, list_t* acct_list)

    char* slurmdb_accounts_add_cond(void* db_conn, slurmdb_add_assoc_cond_t* add_assoc, slurmdb_account_rec_t* acct)

    list_t* slurmdb_accounts_get(void* db_conn, slurmdb_account_cond_t* acct_cond)

    list_t* slurmdb_accounts_modify(void* db_conn, slurmdb_account_cond_t* acct_cond, slurmdb_account_rec_t* acct)

    list_t* slurmdb_accounts_remove(void* db_conn, slurmdb_account_cond_t* acct_cond)

    int slurmdb_archive(void* db_conn, slurmdb_archive_cond_t* arch_cond)

    int slurmdb_archive_load(void* db_conn, slurmdb_archive_rec_t* arch_rec)

    int slurmdb_associations_add(void* db_conn, list_t* assoc_list)

    list_t* slurmdb_associations_get(void* db_conn, slurmdb_assoc_cond_t* assoc_cond)

    list_t* slurmdb_associations_modify(void* db_conn, slurmdb_assoc_cond_t* assoc_cond, slurmdb_assoc_rec_t* assoc)

    list_t* slurmdb_associations_remove(void* db_conn, slurmdb_assoc_cond_t* assoc_cond)

    int slurmdb_clusters_add(void* db_conn, list_t* cluster_list)

    list_t* slurmdb_clusters_get(void* db_conn, slurmdb_cluster_cond_t* cluster_cond)

    list_t* slurmdb_clusters_modify(void* db_conn, slurmdb_cluster_cond_t* cluster_cond, slurmdb_cluster_rec_t* cluster)

    list_t* slurmdb_clusters_remove(void* db_conn, slurmdb_cluster_cond_t* cluster_cond)

    list_t* slurmdb_report_cluster_account_by_user(void* db_conn, slurmdb_assoc_cond_t* assoc_cond)

    list_t* slurmdb_report_cluster_user_by_account(void* db_conn, slurmdb_assoc_cond_t* assoc_cond)

    list_t* slurmdb_report_cluster_wckey_by_user(void* db_conn, slurmdb_wckey_cond_t* wckey_cond)

    list_t* slurmdb_report_cluster_user_by_wckey(void* db_conn, slurmdb_wckey_cond_t* wckey_cond)

    list_t* slurmdb_report_job_sizes_grouped_by_account(void* db_conn, slurmdb_job_cond_t* job_cond, list_t* grouping_list, bool flat_view, bool acct_as_parent)

    list_t* slurmdb_report_job_sizes_grouped_by_wckey(void* db_conn, slurmdb_job_cond_t* job_cond, list_t* grouping_list)

    list_t* slurmdb_report_job_sizes_grouped_by_account_then_wckey(void* db_conn, slurmdb_job_cond_t* job_cond, list_t* grouping_list, bool flat_view, bool acct_as_parent)

    list_t* slurmdb_report_user_top_usage(void* db_conn, slurmdb_user_cond_t* user_cond, bool group_accounts)

    void* slurmdb_connection_get(uint16_t* persist_conn_flags)

    int slurmdb_connection_close(void** db_conn)

    int slurmdb_connection_commit(void* db_conn, bool commit)

    int slurmdb_coord_add(void* db_conn, list_t* acct_list, slurmdb_user_cond_t* user_cond)

    list_t* slurmdb_coord_remove(void* db_conn, list_t* acct_list, slurmdb_user_cond_t* user_cond)

    int slurmdb_federations_add(void* db_conn, list_t* federation_list)

    list_t* slurmdb_federations_modify(void* db_conn, slurmdb_federation_cond_t* fed_cond, slurmdb_federation_rec_t* fed)

    list_t* slurmdb_federations_remove(void* db_conn, slurmdb_federation_cond_t* fed_cond)

    list_t* slurmdb_federations_get(void* db_conn, slurmdb_federation_cond_t* fed_cond)

    list_t* slurmdb_job_modify(void* db_conn, slurmdb_job_cond_t* job_cond, slurmdb_job_rec_t* job)

    list_t* slurmdb_jobs_get(void* db_conn, slurmdb_job_cond_t* job_cond)

    int slurmdb_jobs_fix_runaway(void* db_conn, list_t* jobs)

    int slurmdb_jobcomp_init()

    int slurmdb_jobcomp_fini()

    list_t* slurmdb_jobcomp_jobs_get(slurmdb_job_cond_t* job_cond)

    int slurmdb_reconfig(void* db_conn)

    int slurmdb_shutdown(void* db_conn)

    int slurmdb_clear_stats(void* db_conn)

    int slurmdb_get_stats(void* db_conn, slurmdb_stats_rec_t** stats_pptr)

    list_t* slurmdb_config_get(void* db_conn)

    list_t* slurmdb_events_get(void* db_conn, slurmdb_event_cond_t* event_cond)

    list_t* slurmdb_instances_get(void* db_conn, slurmdb_instance_cond_t* instance_cond)

    list_t* slurmdb_problems_get(void* db_conn, slurmdb_assoc_cond_t* assoc_cond)

    list_t* slurmdb_reservations_get(void* db_conn, slurmdb_reservation_cond_t* resv_cond)

    list_t* slurmdb_txn_get(void* db_conn, slurmdb_txn_cond_t* txn_cond)

    list_t* slurmdb_get_info_cluster(char* cluster_names)

    int slurmdb_get_first_avail_cluster(job_desc_msg_t* req, char* cluster_names, slurmdb_cluster_rec_t** cluster_rec)

    int slurmdb_get_first_het_job_cluster(list_t* job_req_list, char* cluster_names, slurmdb_cluster_rec_t** cluster_rec)

    void slurmdb_destroy_assoc_usage(void* object)

    void slurmdb_destroy_bf_usage(void* object)

    void slurmdb_destroy_bf_usage_members(void* object)

    void slurmdb_destroy_qos_usage(void* object)

    void slurmdb_free_user_rec_members(slurmdb_user_rec_t* slurmdb_user)

    void slurmdb_destroy_user_rec(void* object)

    void slurmdb_destroy_account_rec(void* object)

    void slurmdb_destroy_coord_rec(void* object)

    void slurmdb_destroy_clus_res_rec(void* object)

    void slurmdb_destroy_cluster_accounting_rec(void* object)

    void slurmdb_destroy_cluster_rec(void* object)

    void slurmdb_destroy_federation_rec(void* object)

    void slurmdb_destroy_accounting_rec(void* object)

    void slurmdb_free_assoc_mgr_state_msg(void* object)

    void slurmdb_free_assoc_rec_members(slurmdb_assoc_rec_t* assoc)

    void slurmdb_destroy_assoc_rec(void* object)

    void slurmdb_destroy_event_rec(void* object)

    void slurmdb_destroy_instance_rec(void* object)

    void slurmdb_destroy_job_rec(void* object)

    void slurmdb_free_qos_rec_members(slurmdb_qos_rec_t* qos)

    void slurmdb_destroy_qos_rec(void* object)

    void slurmdb_destroy_reservation_rec(void* object)

    void slurmdb_destroy_step_rec(void* object)

    void slurmdb_destroy_res_rec(void* object)

    void slurmdb_destroy_txn_rec(void* object)

    void slurmdb_destroy_wckey_rec(void* object)

    void slurmdb_destroy_archive_rec(void* object)

    void slurmdb_destroy_tres_rec_noalloc(void* object)

    void slurmdb_destroy_tres_rec(void* object)

    void slurmdb_destroy_report_assoc_rec(void* object)

    void slurmdb_destroy_report_user_rec(void* object)

    void slurmdb_destroy_report_cluster_rec(void* object)

    void slurmdb_destroy_user_cond(void* object)

    void slurmdb_destroy_account_cond(void* object)

    void slurmdb_destroy_cluster_cond(void* object)

    void slurmdb_destroy_federation_cond(void* object)

    void slurmdb_destroy_tres_cond(void* object)

    void slurmdb_destroy_assoc_cond(void* object)

    void slurmdb_destroy_event_cond(void* object)

    void slurmdb_destroy_instance_cond(void* object)

    void slurmdb_destroy_job_cond(void* object)

    void slurmdb_destroy_job_cond_members(slurmdb_job_cond_t* job_cond)

    void slurmdb_destroy_qos_cond(void* object)

    void slurmdb_destroy_reservation_cond(void* object)

    void slurmdb_destroy_res_cond(void* object)

    void slurmdb_destroy_txn_cond(void* object)

    void slurmdb_destroy_wckey_cond(void* object)

    void slurmdb_destroy_archive_cond(void* object)

    void slurmdb_free_add_assoc_cond_members(slurmdb_add_assoc_cond_t* add_assoc)

    void slurmdb_destroy_add_assoc_cond(void* object)

    void slurmdb_destroy_update_object(void* object)

    void slurmdb_destroy_used_limits(void* object)

    void slurmdb_destroy_print_tree(void* object)

    void slurmdb_destroy_hierarchical_rec(void* object)

    void slurmdb_destroy_report_job_grouping(void* object)

    void slurmdb_destroy_report_acct_grouping(void* object)

    void slurmdb_destroy_report_cluster_grouping(void* object)

    void slurmdb_destroy_rpc_obj(void* object)

    void slurmdb_destroy_rollup_stats(void* object)

    void slurmdb_free_stats_rec_members(void* object)

    void slurmdb_destroy_stats_rec(void* object)

    void slurmdb_free_slurmdb_stats_members(slurmdb_stats_t* stats)

    void slurmdb_destroy_slurmdb_stats(slurmdb_stats_t* stats)

    void slurmdb_init_assoc_rec(slurmdb_assoc_rec_t* assoc, bool free_it)

    void slurmdb_init_clus_res_rec(slurmdb_clus_res_rec_t* clus_res, bool free_it)

    void slurmdb_init_cluster_rec(slurmdb_cluster_rec_t* cluster, bool free_it)

    void slurmdb_init_federation_rec(slurmdb_federation_rec_t* federation, bool free_it)

    void slurmdb_init_instance_rec(slurmdb_instance_rec_t* instance)

    void slurmdb_init_qos_rec(slurmdb_qos_rec_t* qos, bool free_it, uint32_t init_val)

    void slurmdb_init_res_rec(slurmdb_res_rec_t* res, bool free_it)

    void slurmdb_init_wckey_rec(slurmdb_wckey_rec_t* wckey, bool free_it)

    void slurmdb_init_add_assoc_cond(slurmdb_add_assoc_cond_t* add_assoc, bool free_it)

    void slurmdb_init_tres_cond(slurmdb_tres_cond_t* tres, bool free_it)

    void slurmdb_init_cluster_cond(slurmdb_cluster_cond_t* cluster, bool free_it)

    void slurmdb_init_federation_cond(slurmdb_federation_cond_t* federation, bool free_it)

    void slurmdb_init_res_cond(slurmdb_res_cond_t* cluster, bool free_it)

    int slurmdb_ping(char* rem_host)

    slurmdbd_ping_t* slurmdb_ping_all()

    list_t* slurmdb_get_hierarchical_sorted_assoc_list(list_t* assoc_list)

    list_t* slurmdb_get_acct_hierarchical_rec_list(list_t* assoc_list)

    char* slurmdb_tree_name_get(char* name, char* parent, list_t* tree_list)

    int slurmdb_res_add(void* db_conn, list_t* res_list)

    list_t* slurmdb_res_get(void* db_conn, slurmdb_res_cond_t* res_cond)

    list_t* slurmdb_res_modify(void* db_conn, slurmdb_res_cond_t* res_cond, slurmdb_res_rec_t* res)

    list_t* slurmdb_res_remove(void* db_conn, slurmdb_res_cond_t* res_cond)

    int slurmdb_qos_add(void* db_conn, list_t* qos_list)

    list_t* slurmdb_qos_get(void* db_conn, slurmdb_qos_cond_t* qos_cond)

    list_t* slurmdb_qos_modify(void* db_conn, slurmdb_qos_cond_t* qos_cond, slurmdb_qos_rec_t* qos)

    list_t* slurmdb_qos_remove(void* db_conn, slurmdb_qos_cond_t* qos_cond)

    int slurmdb_tres_add(void* db_conn, list_t* tres_list)

    list_t* slurmdb_tres_get(void* db_conn, slurmdb_tres_cond_t* tres_cond)

    int slurmdb_usage_get(void* db_conn, void* in_, int type, time_t start, time_t end)

    int slurmdb_usage_roll(void* db_conn, time_t sent_start, time_t sent_end, uint16_t archive_data, list_t** rollup_stats_list_in)

    int slurmdb_users_add(void* db_conn, list_t* user_list)

    char* slurmdb_users_add_cond(void* db_conn, slurmdb_add_assoc_cond_t* add_assoc, slurmdb_user_rec_t* user)

    list_t* slurmdb_users_add_conn(void* db_conn, slurmdb_user_rec_t* user, slurmdb_assoc_cond_t* assoc_cond, slurmdb_assoc_rec_t* assoc)

    list_t* slurmdb_users_get(void* db_conn, slurmdb_user_cond_t* user_cond)

    list_t* slurmdb_users_modify(void* db_conn, slurmdb_user_cond_t* user_cond, slurmdb_user_rec_t* user)

    list_t* slurmdb_users_remove(void* db_conn, slurmdb_user_cond_t* user_cond)

    int slurmdb_wckeys_add(void* db_conn, list_t* wckey_list)

    list_t* slurmdb_wckeys_get(void* db_conn, slurmdb_wckey_cond_t* wckey_cond)

    list_t* slurmdb_wckeys_modify(void* db_conn, slurmdb_wckey_cond_t* wckey_cond, slurmdb_wckey_rec_t* wckey)

    list_t* slurmdb_wckeys_remove(void* db_conn, slurmdb_wckey_cond_t* wckey_cond)

    char* slurmdb_expand_job_stdio_fields(char* path, slurmdb_job_rec_t* job)

    char* slurmdb_expand_step_stdio_fields(char* path, slurmdb_step_rec_t* step)
