Generated by Cython 0.29.32
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: ingress.c
+0001: ################################################################################
__pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0002: ## ___ _ ____ ____
0003: ## / _ \ _ _ ___ ___| |_| _ \| __ )
0004: ## | | | | | | |/ _ \/ __| __| | | | _ \
0005: ## | |_| | |_| | __/\__ \ |_| |_| | |_) |
0006: ## \__\_\\__,_|\___||___/\__|____/|____/
0007: ##
0008: ## Copyright (c) 2014-2019 Appsicle
0009: ## Copyright (c) 2019-2022 QuestDB
0010: ##
0011: ## Licensed under the Apache License, Version 2.0 (the "License");
0012: ## you may not use this file except in compliance with the License.
0013: ## You may obtain a copy of the License at
0014: ##
0015: ## http://www.apache.org/licenses/LICENSE-2.0
0016: ##
0017: ## Unless required by applicable law or agreed to in writing, software
0018: ## distributed under the License is distributed on an "AS IS" BASIS,
0019: ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0020: ## See the License for the specific language governing permissions and
0021: ## limitations under the License.
0022: ##
0023: ################################################################################
0024:
0025: # distutils: language=c
0026: # cython: language_level=3
0027: # cython: binding=True
0028:
0029: """
0030: API for fast data ingestion into QuestDB.
0031: """
0032:
0033: from libc.stdint cimport uint8_t, uint64_t, int64_t
0034: from cpython.datetime cimport datetime
0035: from cpython.bool cimport bool, PyBool_Check
0036: from cpython.weakref cimport PyWeakref_NewRef, PyWeakref_GetObject
0037: from cpython.object cimport PyObject
0038: from cpython.float cimport PyFloat_Check
0039: from cpython.int cimport PyInt_Check
0040: from cpython.unicode cimport PyUnicode_Check
0041:
0042: from .line_sender cimport *
0043:
0044: cdef extern from "Python.h":
0045: ctypedef uint8_t Py_UCS1 # unicodeobject.h
0046:
0047: ctypedef unsigned int uint
0048:
0049: cdef enum PyUnicode_Kind:
0050: PyUnicode_1BYTE_KIND
0051: PyUnicode_2BYTE_KIND
0052: PyUnicode_4BYTE_KIND
0053:
0054: # Note: Returning an `object` rather than `PyObject` as the function
0055: # returns a new reference rather than borrowing an existing one.
0056: object PyUnicode_FromKindAndData(
0057: int kind, const void* buffer, Py_ssize_t size)
0058:
0059: # Ditto, see comment on why not returning a `PyObject` above.
0060: str PyUnicode_FromStringAndSize(
0061: const char* u, Py_ssize_t size)
0062:
0063: # Must be called before accessing data or is compact check.
0064: int PyUnicode_READY(object o) except -1
0065:
0066: # Is UCS1 and ascii (and therefore valid UTF-8).
0067: bint PyUnicode_IS_COMPACT_ASCII(object o)
0068:
0069: # Get length.
0070: Py_ssize_t PyUnicode_GET_LENGTH(object o)
0071:
0072: # Zero-copy access to buffer.
0073: Py_UCS1* PyUnicode_1BYTE_DATA(object o)
0074:
0075: Py_ssize_t PyBytes_GET_SIZE(object o)
0076:
0077: char* PyBytes_AsString(object o)
0078:
0079:
+0080: from enum import Enum
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Enum); __Pyx_GIVEREF(__pyx_n_s_Enum); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Enum); __pyx_t_2 = __Pyx_Import(__pyx_n_s_enum, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Enum, __pyx_t_1) < 0) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0081: from typing import List, Tuple, Dict, Union, Any, Optional, Callable, Iterable
__pyx_t_2 = PyList_New(8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_List); __Pyx_GIVEREF(__pyx_n_s_List); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_List); __Pyx_INCREF(__pyx_n_s_Tuple); __Pyx_GIVEREF(__pyx_n_s_Tuple); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_Tuple); __Pyx_INCREF(__pyx_n_s_Dict); __Pyx_GIVEREF(__pyx_n_s_Dict); PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_Dict); __Pyx_INCREF(__pyx_n_s_Union); __Pyx_GIVEREF(__pyx_n_s_Union); PyList_SET_ITEM(__pyx_t_2, 3, __pyx_n_s_Union); __Pyx_INCREF(__pyx_n_s_Any); __Pyx_GIVEREF(__pyx_n_s_Any); PyList_SET_ITEM(__pyx_t_2, 4, __pyx_n_s_Any); __Pyx_INCREF(__pyx_n_s_Optional); __Pyx_GIVEREF(__pyx_n_s_Optional); PyList_SET_ITEM(__pyx_t_2, 5, __pyx_n_s_Optional); __Pyx_INCREF(__pyx_n_s_Callable); __Pyx_GIVEREF(__pyx_n_s_Callable); PyList_SET_ITEM(__pyx_t_2, 6, __pyx_n_s_Callable); __Pyx_INCREF(__pyx_n_s_Iterable); __Pyx_GIVEREF(__pyx_n_s_Iterable); PyList_SET_ITEM(__pyx_t_2, 7, __pyx_n_s_Iterable); __pyx_t_1 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_List); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Tuple); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Union); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Union, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Any); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Any, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Optional); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Callable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Callable, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Iterable); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterable, __pyx_t_2) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0082: import pathlib
__pyx_t_1 = __Pyx_Import(__pyx_n_s_pathlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pathlib, __pyx_t_1) < 0) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0083:
+0084: import sys
__pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0085:
+0086: class IngressErrorCode(Enum):
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_IngressErrorCode, __pyx_n_s_IngressErrorCode, (PyObject *) NULL, __pyx_n_s_questdb_ingress, __pyx_kp_s_Category_of_Error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* … */ __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_IngressErrorCode, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_d, __pyx_n_s_IngressErrorCode, __pyx_t_5) < 0) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0087: """Category of Error."""
+0088: CouldNotResolveAddr = line_sender_error_could_not_resolve_addr
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_could_not_resolve_addr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_CouldNotResolveAddr, __pyx_t_4) < 0) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0089: InvalidApiCall = line_sender_error_invalid_api_call
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_api_call); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_InvalidApiCall, __pyx_t_4) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0090: SocketError = line_sender_error_socket_error
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_socket_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_SocketError, __pyx_t_4) < 0) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0091: InvalidUtf8 = line_sender_error_invalid_utf8
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_utf8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_InvalidUtf8, __pyx_t_4) < 0) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0092: InvalidName = line_sender_error_invalid_name
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_InvalidName, __pyx_t_4) < 0) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0093: InvalidTimestamp = line_sender_error_invalid_timestamp
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_invalid_timestamp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_InvalidTimestamp, __pyx_t_4) < 0) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0094: AuthError = line_sender_error_auth_error
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_auth_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_AuthError, __pyx_t_4) < 0) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0095: TlsError = line_sender_error_tls_error
__pyx_t_4 = __Pyx_PyInt_From_enum__line_sender_error_code(line_sender_error_tls_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_TlsError, __pyx_t_4) < 0) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0096:
+0097: def __str__(self) -> str:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_16IngressErrorCode_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_7questdb_7ingress_16IngressErrorCode___str__[] = "Return the name of the enum."; static PyMethodDef __pyx_mdef_7questdb_7ingress_16IngressErrorCode_1__str__ = {"__str__", (PyCFunction)__pyx_pw_7questdb_7ingress_16IngressErrorCode_1__str__, METH_O, __pyx_doc_7questdb_7ingress_16IngressErrorCode___str__}; static PyObject *__pyx_pw_7questdb_7ingress_16IngressErrorCode_1__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_16IngressErrorCode___str__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_16IngressErrorCode___str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.IngressErrorCode.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); /* … */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 97, __pyx_L1_error) __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_16IngressErrorCode_1__str__, 0, __pyx_n_s_IngressErrorCode___str, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_str_2, __pyx_t_5) < 0) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_str_2, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 97, __pyx_L1_error)
0098: """Return the name of the enum."""
+0099: return self.name
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 99, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
0100:
0101:
+0102: class IngressError(Exception):
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_IngressError, __pyx_n_s_IngressError, (PyObject *) NULL, __pyx_n_s_questdb_ingress, __pyx_kp_s_An_error_whilst_using_the_Sender); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); /* … */ __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_IngressError, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_CyFunction_InitClassCell(__pyx_t_5, __pyx_t_4) < 0) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_IngressError, __pyx_t_4) < 0) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0103: """An error whilst using the ``Sender`` or constructing its ``Buffer``."""
+0104: def __init__(self, code, msg):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_12IngressError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_7questdb_7ingress_12IngressError_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_7ingress_12IngressError_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7questdb_7ingress_12IngressError_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_code = 0; PyObject *__pyx_v_msg = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_code,&__pyx_n_s_msg,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_code)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 104, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_msg)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 104, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 104, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_self = values[0]; __pyx_v_code = values[1]; __pyx_v_msg = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 104, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.IngressError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_12IngressError___init__(__pyx_self, __pyx_v_self, __pyx_v_code, __pyx_v_msg); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_12IngressError___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_code, PyObject *__pyx_v_msg) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.IngressError.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__18 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_code, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); /* … */ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_12IngressError_1__init__, 0, __pyx_n_s_IngressError___init, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_4); PyList_Append(__pyx_t_5, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_init, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 104, __pyx_L1_error)
+0105: super().__init__(msg)
__pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 105, __pyx_L1_error) } __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_msg) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_msg); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0106: self._code = code
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code_2, __pyx_v_code) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
0107:
+0108: @property
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_code, __pyx_t_4) < 0) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0109: def code(self) -> IngressErrorCode:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_12IngressError_3code(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_7questdb_7ingress_12IngressError_2code[] = "Return the error code."; static PyMethodDef __pyx_mdef_7questdb_7ingress_12IngressError_3code = {"code", (PyCFunction)__pyx_pw_7questdb_7ingress_12IngressError_3code, METH_O, __pyx_doc_7questdb_7ingress_12IngressError_2code}; static PyObject *__pyx_pw_7questdb_7ingress_12IngressError_3code(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("code (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_12IngressError_2code(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_12IngressError_2code(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("code", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.IngressError.code", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); /* … */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_6) < 0) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_12IngressError_3code, 0, __pyx_n_s_IngressError_code, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_code, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 109, __pyx_L1_error)
0110: """Return the error code."""
+0111: return self._code
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_code_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0112:
0113:
+0114: cdef inline object c_err_code_to_py(line_sender_error_code code):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_c_err_code_to_py(enum line_sender_error_code __pyx_v_code) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("c_err_code_to_py", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.c_err_code_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0115: if code == line_sender_error_could_not_resolve_addr:
switch (__pyx_v_code) { case line_sender_error_could_not_resolve_addr: /* … */ break; case line_sender_error_invalid_api_call:
+0116: return IngressErrorCode.CouldNotResolveAddr
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_CouldNotResolveAddr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+0117: elif code == line_sender_error_invalid_api_call:
break; case line_sender_error_socket_error:
+0118: return IngressErrorCode.InvalidApiCall
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+0119: elif code == line_sender_error_socket_error:
break; case line_sender_error_invalid_utf8:
+0120: return IngressErrorCode.SocketError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SocketError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+0121: elif code == line_sender_error_invalid_utf8:
break; case line_sender_error_invalid_name:
+0122: return IngressErrorCode.InvalidUtf8
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidUtf8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+0123: elif code == line_sender_error_invalid_name:
break; case line_sender_error_invalid_timestamp:
+0124: return IngressErrorCode.InvalidName
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_InvalidName); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+0125: elif code == line_sender_error_invalid_timestamp:
break; case line_sender_error_auth_error:
+0126: return IngressErrorCode.InvalidTimestamp
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_InvalidTimestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+0127: elif code == line_sender_error_auth_error:
break; case line_sender_error_tls_error:
+0128: return IngressErrorCode.AuthError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_AuthError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+0129: elif code == line_sender_error_tls_error:
break; default:
+0130: return IngressErrorCode.TlsError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_TlsError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0131: else:
+0132: raise ValueError('Internal error converting error code.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 132, __pyx_L1_error) break; } /* … */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Internal_error_converting_error); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
0133:
0134:
+0135: cdef inline object c_err_to_code_and_msg(line_sender_error* err):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_c_err_to_code_and_msg(struct line_sender_error *__pyx_v_err) { enum line_sender_error_code __pyx_v_code; size_t __pyx_v_c_len; char const *__pyx_v_c_msg; PyObject *__pyx_v_py_msg = 0; PyObject *__pyx_v_py_code = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("c_err_to_code_and_msg", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.c_err_to_code_and_msg", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_msg); __Pyx_XDECREF(__pyx_v_py_code); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0136: """Construct a ``SenderError`` from a C error, which will be freed."""
+0137: cdef line_sender_error_code code = line_sender_error_get_code(err)
__pyx_v_code = line_sender_error_get_code(__pyx_v_err);
+0138: cdef size_t c_len = 0
__pyx_v_c_len = 0;
+0139: cdef const char* c_msg = line_sender_error_msg(err, &c_len)
__pyx_v_c_msg = line_sender_error_msg(__pyx_v_err, (&__pyx_v_c_len));
0140: cdef object py_err
0141: cdef object py_msg
0142: cdef object py_code
+0143: try:
/*try:*/ {
+0144: py_code = c_err_code_to_py(code)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_code_to_py(__pyx_v_code); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_code = __pyx_t_1; __pyx_t_1 = 0;
+0145: py_msg = PyUnicode_FromStringAndSize(c_msg, <Py_ssize_t>c_len)
__pyx_t_1 = PyUnicode_FromStringAndSize(__pyx_v_c_msg, ((Py_ssize_t)__pyx_v_c_len)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_msg = __pyx_t_1; __pyx_t_1 = 0;
+0146: return (py_code, py_msg)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_py_code); __Pyx_GIVEREF(__pyx_v_py_code); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_py_code); __Pyx_INCREF(__pyx_v_py_msg); __Pyx_GIVEREF(__pyx_v_py_msg); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_py_msg); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L3_return; }
0147: finally:
+0148: line_sender_error_free(err)
/*finally:*/ { __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0)) __Pyx_ErrFetch(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); __pyx_t_2 = __pyx_lineno; __pyx_t_3 = __pyx_clineno; __pyx_t_4 = __pyx_filename; { line_sender_error_free(__pyx_v_err); } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); } __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7); __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_3; __pyx_filename = __pyx_t_4; goto __pyx_L1_error; } __pyx_L3_return: { __pyx_t_10 = __pyx_r; __pyx_r = 0; line_sender_error_free(__pyx_v_err); __pyx_r = __pyx_t_10; __pyx_t_10 = 0; goto __pyx_L0; } }
0149:
0150:
+0151: cdef inline object c_err_to_py(line_sender_error* err):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_c_err_to_py(struct line_sender_error *__pyx_v_err) { PyObject *__pyx_v_tup = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("c_err_to_py", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ingress.c_err_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tup); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0152: """Construct an ``IngressError`` from a C error, which will be freed."""
+0153: cdef object tup = c_err_to_code_and_msg(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_code_and_msg(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_tup = __pyx_t_1; __pyx_t_1 = 0;
+0154: return IngressError(tup[0], tup[1])
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_tup, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_tup, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0155:
0156:
+0157: cdef inline object c_err_to_py_fmt(line_sender_error* err, str fmt):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_c_err_to_py_fmt(struct line_sender_error *__pyx_v_err, PyObject *__pyx_v_fmt) { PyObject *__pyx_v_tup = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("c_err_to_py_fmt", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ingress.c_err_to_py_fmt", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_tup); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0158: """Construct an ``IngressError`` from a C error, which will be freed."""
+0159: cdef object tup = c_err_to_code_and_msg(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_code_and_msg(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_tup = __pyx_t_1; __pyx_t_1 = 0;
+0160: return IngressError(tup[0], fmt.format(tup[1]))
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_tup, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_tup, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyUnicode_Type_format, __pyx_v_fmt, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_5}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_5}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0161:
0162:
+0163: cdef bytes str_to_utf8(str string, line_sender_utf8* utf8_out):
static PyObject *__pyx_f_7questdb_7ingress_str_to_utf8(PyObject *__pyx_v_string, struct line_sender_utf8 *__pyx_v_utf8_out) { PyObject *__pyx_v_owner = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("str_to_utf8", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.str_to_utf8", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0164: """
0165: Init the `utf8_out` object from the `string`.
0166: If the string is held as a UCS1 and is purely ascii, then
0167: the memory is borrowed.
0168: Otherwise the string is first encoded to UTF-8 into a bytes object
0169: and such bytes object is returned to transfer ownership and extend
0170: the lifetime of the buffer pointed to by `utf8_out`.
0171: """
0172: # Note that we bypass `line_sender_utf8_init`.
+0173: cdef bytes owner = None
__Pyx_INCREF(Py_None);
__pyx_v_owner = ((PyObject*)Py_None);
+0174: PyUnicode_READY(string)
__pyx_t_1 = PyUnicode_READY(__pyx_v_string); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 174, __pyx_L1_error)
+0175: if PyUnicode_IS_COMPACT_ASCII(string):
__pyx_t_2 = (PyUnicode_IS_COMPACT_ASCII(__pyx_v_string) != 0);
if (__pyx_t_2) {
/* … */
}
+0176: utf8_out.len = <size_t>(PyUnicode_GET_LENGTH(string))
__pyx_v_utf8_out->len = ((size_t)PyUnicode_GET_LENGTH(__pyx_v_string));
+0177: utf8_out.buf = <const char*>(PyUnicode_1BYTE_DATA(string))
__pyx_v_utf8_out->buf = ((char const *)PyUnicode_1BYTE_DATA(__pyx_v_string));
+0178: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0;
0179: else:
+0180: owner = string.encode('utf-8')
/*else*/ { if (unlikely(__pyx_v_string == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode"); __PYX_ERR(0, 180, __pyx_L1_error) } __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_owner, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0;
+0181: utf8_out.len = <size_t>(PyBytes_GET_SIZE(owner))
__pyx_v_utf8_out->len = ((size_t)PyBytes_GET_SIZE(__pyx_v_owner));
+0182: utf8_out.buf = <const char*>(PyBytes_AsString(owner))
__pyx_v_utf8_out->buf = ((char const *)PyBytes_AsString(__pyx_v_owner));
+0183: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0; }
0184:
0185:
+0186: cdef bytes str_to_table_name(str string, line_sender_table_name* name_out):
static PyObject *__pyx_f_7questdb_7ingress_str_to_table_name(PyObject *__pyx_v_string, struct line_sender_table_name *__pyx_v_name_out) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_utf8; PyObject *__pyx_v_owner = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("str_to_table_name", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.str_to_table_name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0187: """
0188: Python string to borrowed C table name.
0189: Also see `str_to_utf8`.
0190: """
+0191: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0192: cdef line_sender_utf8 utf8
+0193: cdef bytes owner = str_to_utf8(string, &utf8)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_string, (&__pyx_v_utf8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0194: if not line_sender_table_name_init(name_out, utf8.len, utf8.buf, &err):
__pyx_t_2 = ((!(line_sender_table_name_init(__pyx_v_name_out, __pyx_v_utf8.len, __pyx_v_utf8.buf, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+0195: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 195, __pyx_L1_error)
+0196: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0;
0197:
0198:
+0199: cdef bytes str_to_column_name(str string, line_sender_column_name* name_out):
static PyObject *__pyx_f_7questdb_7ingress_str_to_column_name(PyObject *__pyx_v_string, struct line_sender_column_name *__pyx_v_name_out) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_utf8; PyObject *__pyx_v_owner = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("str_to_column_name", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.str_to_column_name", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0200: """
0201: Python string to borrowed C column name.
0202: Also see `str_to_utf8`.
0203: """
+0204: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0205: cdef line_sender_utf8 utf8
+0206: cdef bytes owner = str_to_utf8(string, &utf8)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_string, (&__pyx_v_utf8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0207: if not line_sender_column_name_init(name_out, utf8.len, utf8.buf, &err):
__pyx_t_2 = ((!(line_sender_column_name_init(__pyx_v_name_out, __pyx_v_utf8.len, __pyx_v_utf8.buf, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+0208: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 208, __pyx_L1_error)
+0209: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0;
0210:
0211:
+0212: cdef int64_t datetime_to_micros(datetime dt):
static int64_t __pyx_f_7questdb_7ingress_datetime_to_micros(PyDateTime_DateTime *__pyx_v_dt) { int64_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("datetime_to_micros", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("questdb.ingress.datetime_to_micros", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0213: """
0214: Convert a `datetime.datetime` to microseconds since the epoch.
0215: """
0216: return (
+0217: <int64_t>(dt.timestamp()) *
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0218: <int64_t>(1000000) +
__pyx_r = ((((int64_t)__pyx_t_4) * ((int64_t)0xF4240)) + ((int64_t)__pyx_t_5)); goto __pyx_L0;
+0219: <int64_t>(dt.microsecond))
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_microsecond); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0220:
0221:
+0222: cdef int64_t datetime_to_nanos(datetime dt):
static int64_t __pyx_f_7questdb_7ingress_datetime_to_nanos(PyDateTime_DateTime *__pyx_v_dt) { int64_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("datetime_to_nanos", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("questdb.ingress.datetime_to_nanos", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0223: """
0224: Convert a `datetime.datetime` to nanoseconds since the epoch.
0225: """
0226: return (
+0227: <int64_t>(dt.timestamp()) *
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_timestamp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_4 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0228: <int64_t>(1000000000) +
__pyx_r = ((((int64_t)__pyx_t_4) * ((int64_t)0x3B9ACA00)) + ((int64_t)__pyx_t_5)); goto __pyx_L0;
+0229: <int64_t>(dt.microsecond * 1000))
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_dt), __pyx_n_s_microsecond); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_1000); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyInt_As_int64_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0230:
0231:
+0232: cdef class TimestampMicros:
struct __pyx_obj_7questdb_7ingress_TimestampMicros { PyObject_HEAD int64_t _value; };
0233: """
0234: A timestamp in microseconds since the UNIX epoch.
0235:
0236: You may construct a ``TimestampMicros`` from an integer or a ``datetime``.
0237:
0238: .. code-block:: python
0239:
0240: # Can't be negative.
0241: TimestampMicros(1657888365426838016)
0242:
0243: # Careful with the timezeone!
0244: TimestampMicros.from_datetime(datetime.datetime.utcnow())
0245:
0246: When constructing from a ``datetime``, you should take extra care
0247: to ensure that the timezone is correct.
0248:
0249: For example, ``datetime.now()`` implies the `local` timezone which
0250: is probably not what you want.
0251:
0252: When constructing the ``datetime`` object explicity, you pass in the
0253: timezone to use.
0254:
0255: .. code-block:: python
0256:
0257: TimestampMicros.from_datetime(
0258: datetime.datetime(2000, 1, 1, tzinfo=datetime.timezone.utc))
0259:
0260: """
0261: cdef int64_t _value
0262:
+0263: def __cinit__(self, value: int):
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_15TimestampMicros_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_15TimestampMicros_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_value = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 263, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_value = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 263, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.TimestampMicros.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_15TimestampMicros___cinit__(((struct __pyx_obj_7questdb_7ingress_TimestampMicros *)__pyx_v_self), __pyx_v_value); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_15TimestampMicros___cinit__(struct __pyx_obj_7questdb_7ingress_TimestampMicros *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.TimestampMicros.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0264: if value < 0:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+0265: raise ValueError('value must positive integer.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 265, __pyx_L1_error) /* … */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_value_must_positive_integer); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 265, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2);
+0266: self._value = value
__pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_v_value); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 266, __pyx_L1_error) __pyx_v_self->_value = __pyx_t_3;
0267:
+0268: @classmethod
__pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros->tp_dict, __pyx_n_s_from_datetime, __pyx_t_2) < 0) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampMicros);
+0269: def from_datetime(cls, dt: datetime):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_3from_datetime(PyObject *__pyx_v_cls, PyObject *__pyx_v_dt); /*proto*/ static char __pyx_doc_7questdb_7ingress_15TimestampMicros_2from_datetime[] = "\n Construct a ``TimestampMicros`` from a ``datetime.datetime`` object.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_15TimestampMicros_3from_datetime = {"from_datetime", (PyCFunction)__pyx_pw_7questdb_7ingress_15TimestampMicros_3from_datetime, METH_O, __pyx_doc_7questdb_7ingress_15TimestampMicros_2from_datetime}; static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_3from_datetime(PyObject *__pyx_v_cls, PyObject *__pyx_v_dt) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime, 1, "dt", 0))) __PYX_ERR(0, 269, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_15TimestampMicros_2from_datetime(((PyTypeObject*)__pyx_v_cls), ((PyDateTime_DateTime *)__pyx_v_dt)); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_15TimestampMicros_2from_datetime(PyTypeObject *__pyx_v_cls, PyDateTime_DateTime *__pyx_v_dt) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.TimestampMicros.from_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__22 = PyTuple_Pack(2, __pyx_n_s_cls, __pyx_n_s_dt); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dt, __pyx_n_u_datetime) < 0) __PYX_ERR(0, 269, __pyx_L1_error) __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_15TimestampMicros_3from_datetime, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TimestampMicros_from_datetime, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros->tp_dict, __pyx_n_s_from_datetime, __pyx_t_1) < 0) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampMicros); /* … */ __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros, __pyx_n_s_from_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_from_datetime, 269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 269, __pyx_L1_error)
0270: """
0271: Construct a ``TimestampMicros`` from a ``datetime.datetime`` object.
0272: """
+0273: if not isinstance(dt, datetime):
__pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
if (unlikely(__pyx_t_2)) {
/* … */
}
+0274: raise TypeError('dt must be a datetime object.')
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 274, __pyx_L1_error) /* … */ __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_dt_must_be_a_datetime_object); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 274, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3);
+0275: return cls(datetime_to_micros(dt))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_f_7questdb_7ingress_datetime_to_micros(__pyx_v_dt)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_cls), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
0276:
0277: @property
+0278: def value(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_5value_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_15TimestampMicros_5value_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_15TimestampMicros_5value___get__(((struct __pyx_obj_7questdb_7ingress_TimestampMicros *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_15TimestampMicros_5value___get__(struct __pyx_obj_7questdb_7ingress_TimestampMicros *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.TimestampMicros.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0279: """Number of microseconds."""
+0280: return self._value
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0281:
0282:
+0283: cdef class TimestampNanos:
struct __pyx_obj_7questdb_7ingress_TimestampNanos { PyObject_HEAD int64_t _value; };
0284: """
0285: A timestamp in nanoseconds since the UNIX epoch.
0286:
0287: You may construct a ``TimestampNanos`` from an integer or a ``datetime``.
0288:
0289: .. code-block:: python
0290:
0291: # Can't be negative.
0292: TimestampNanos(1657888365426838016)
0293:
0294: # Careful with the timezeone!
0295: TimestampNanos.from_datetime(datetime.datetime.utcnow())
0296:
0297: When constructing from a ``datetime``, you should take extra care
0298: to ensure that the timezone is correct.
0299:
0300: For example, ``datetime.now()`` implies the `local` timezone which
0301: is probably not what you want.
0302:
0303: When constructing the ``datetime`` object explicity, you pass in the
0304: timezone to use.
0305:
0306: .. code-block:: python
0307:
0308: TimestampMicros.from_datetime(
0309: datetime.datetime(2000, 1, 1, tzinfo=datetime.timezone.utc))
0310:
0311: """
0312: cdef int64_t _value
0313:
+0314: def __cinit__(self, value: int):
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_14TimestampNanos_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_14TimestampNanos_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_value = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_value,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 314, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_value = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 314, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.TimestampNanos.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_14TimestampNanos___cinit__(((struct __pyx_obj_7questdb_7ingress_TimestampNanos *)__pyx_v_self), __pyx_v_value); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_14TimestampNanos___cinit__(struct __pyx_obj_7questdb_7ingress_TimestampNanos *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.TimestampNanos.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0315: if value < 0:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_value, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+0316: raise ValueError('value must positive integer.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 316, __pyx_L1_error)
+0317: self._value = value
__pyx_t_3 = __Pyx_PyInt_As_int64_t(__pyx_v_value); if (unlikely((__pyx_t_3 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 317, __pyx_L1_error) __pyx_v_self->_value = __pyx_t_3;
0318:
+0319: @classmethod
__pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos->tp_dict, __pyx_n_s_from_datetime, __pyx_t_2) < 0) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampNanos);
+0320: def from_datetime(cls, dt: datetime):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_3from_datetime(PyObject *__pyx_v_cls, PyObject *__pyx_v_dt); /*proto*/ static char __pyx_doc_7questdb_7ingress_14TimestampNanos_2from_datetime[] = "\n Construct a ``TimestampNanos`` from a ``datetime.datetime`` object.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_14TimestampNanos_3from_datetime = {"from_datetime", (PyCFunction)__pyx_pw_7questdb_7ingress_14TimestampNanos_3from_datetime, METH_O, __pyx_doc_7questdb_7ingress_14TimestampNanos_2from_datetime}; static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_3from_datetime(PyObject *__pyx_v_cls, PyObject *__pyx_v_dt) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime, 1, "dt", 0))) __PYX_ERR(0, 320, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_14TimestampNanos_2from_datetime(((PyTypeObject*)__pyx_v_cls), ((PyDateTime_DateTime *)__pyx_v_dt)); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_14TimestampNanos_2from_datetime(PyTypeObject *__pyx_v_cls, PyDateTime_DateTime *__pyx_v_dt) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("from_datetime", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.TimestampNanos.from_datetime", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__28 = PyTuple_Pack(2, __pyx_n_s_cls, __pyx_n_s_dt); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dt, __pyx_n_u_datetime) < 0) __PYX_ERR(0, 320, __pyx_L1_error) __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_14TimestampNanos_3from_datetime, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_TimestampNanos_from_datetime, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos->tp_dict, __pyx_n_s_from_datetime, __pyx_t_1) < 0) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampNanos); /* … */ __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos, __pyx_n_s_from_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_from_datetime, 320, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 320, __pyx_L1_error)
0321: """
0322: Construct a ``TimestampNanos`` from a ``datetime.datetime`` object.
0323: """
+0324: if not isinstance(dt, datetime):
__pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_dt), __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
if (unlikely(__pyx_t_2)) {
/* … */
}
+0325: raise TypeError('dt must be a datetime object.')
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 325, __pyx_L1_error)
+0326: return cls(datetime_to_nanos(dt))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_f_7questdb_7ingress_datetime_to_nanos(__pyx_v_dt)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_v_cls), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
0327:
0328: @property
+0329: def value(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_5value_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_14TimestampNanos_5value_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_14TimestampNanos_5value___get__(((struct __pyx_obj_7questdb_7ingress_TimestampNanos *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_14TimestampNanos_5value___get__(struct __pyx_obj_7questdb_7ingress_TimestampNanos *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.TimestampNanos.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0330: """Number of nanoseconds."""
+0331: return self._value
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0332:
0333:
+0334: cdef class Sender
struct __pyx_obj_7questdb_7ingress_Sender { PyObject_HEAD struct __pyx_vtabstruct_7questdb_7ingress_Sender *__pyx_vtab; PyObject *__weakref__; struct line_sender_opts *_opts; struct line_sender *_impl; struct __pyx_obj_7questdb_7ingress_Buffer *_buffer; int _auto_flush_enabled; Py_ssize_t _auto_flush_watermark; size_t _init_capacity; size_t _max_name_len; };
+0335: cdef class Buffer
struct __pyx_obj_7questdb_7ingress_Buffer { PyObject_HEAD struct __pyx_vtabstruct_7questdb_7ingress_Buffer *__pyx_vtab; struct line_sender_buffer *_impl; size_t _init_capacity; size_t _max_name_len; PyObject *_row_complete_sender; };
0336:
0337:
+0338: cdef int may_flush_on_row_complete(Buffer buffer, Sender sender) except -1:
static int __pyx_f_7questdb_7ingress_may_flush_on_row_complete(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_buffer, struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_sender) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("may_flush_on_row_complete", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.may_flush_on_row_complete", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0339: if sender._auto_flush_enabled:
__pyx_t_1 = (__pyx_v_sender->_auto_flush_enabled != 0); if (__pyx_t_1) { /* … */ }
+0340: if len(buffer) >= sender._auto_flush_watermark:
__pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_buffer)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 340, __pyx_L1_error) __pyx_t_1 = ((__pyx_t_2 >= __pyx_v_sender->_auto_flush_watermark) != 0); if (__pyx_t_1) { /* … */ }
+0341: sender.flush(buffer)
__pyx_t_4.__pyx_n = 1; __pyx_t_4.buffer = __pyx_v_buffer; __pyx_t_3 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_sender->__pyx_vtab)->flush(__pyx_v_sender, 0, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0342:
0343:
+0344: cdef class Buffer:
struct __pyx_vtabstruct_7questdb_7ingress_Buffer { PyObject *(*_cinit_impl)(struct __pyx_obj_7questdb_7ingress_Buffer *, size_t, size_t); PyObject *(*_to_str)(struct __pyx_obj_7questdb_7ingress_Buffer *); int (*_set_marker)(struct __pyx_obj_7questdb_7ingress_Buffer *); int (*_rewind_to_marker)(struct __pyx_obj_7questdb_7ingress_Buffer *); PyObject *(*_clear_marker)(struct __pyx_obj_7questdb_7ingress_Buffer *); int (*_table)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyObject *); int (*_symbol)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyObject *, PyObject *); int (*_column_bool)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, int); int (*_column_i64)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, int64_t); int (*_column_f64)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, double); int (*_column_str)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, PyObject *); int (*_column_ts)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, struct __pyx_obj_7questdb_7ingress_TimestampMicros *); int (*_column_dt)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, PyDateTime_DateTime *); int (*_column)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyObject *, PyObject *); int (*_may_trigger_row_complete)(struct __pyx_obj_7questdb_7ingress_Buffer *); int (*_at_ts)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct __pyx_obj_7questdb_7ingress_TimestampNanos *); int (*_at_dt)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyDateTime_DateTime *); int (*_at_now)(struct __pyx_obj_7questdb_7ingress_Buffer *); int (*_at)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyObject *); int (*_row)(struct __pyx_obj_7questdb_7ingress_Buffer *, PyObject *, struct __pyx_opt_args_7questdb_7ingress_6Buffer__row *__pyx_optional_args); }; static struct __pyx_vtabstruct_7questdb_7ingress_Buffer *__pyx_vtabptr_7questdb_7ingress_Buffer;
0345: """
0346: Construct QuestDB-flavored InfluxDB Line Protocol (ILP) messages.
0347:
0348: The :func:`Buffer.row` method is used to add a row to the buffer.
0349:
0350: You can call this many times.
0351:
0352: .. code-block:: python
0353:
0354: from questdb.ingress import Buffer
0355:
0356: buf = Buffer()
0357: buf.row(
0358: 'table_name1',
0359: symbols={'s1', 'v1', 's2', 'v2'},
0360: columns={'c1': True, 'c2': 0.5})
0361:
0362: buf.row(
0363: 'table_name2',
0364: symbols={'questdb': '❤️'},
0365: columns={'like': 100000})
0366:
0367: # Append any additional rows then, once ready, call
0368: sender.flush(buffer) # a `Sender` instance.
0369:
0370: # The sender auto-cleared the buffer, ready for reuse.
0371:
0372: buf.row(
0373: 'table_name1',
0374: symbols={'s1', 'v1', 's2', 'v2'},
0375: columns={'c1': True, 'c2': 0.5})
0376:
0377: # etc.
0378:
0379:
0380: Buffer Constructor Arguments:
0381: * ``init_capacity`` (``int``): Initial capacity of the buffer in bytes.
0382: Defaults to ``65536`` (64KiB).
0383: * ``max_name_len`` (``int``): Maximum length of a column name.
0384: Defaults to ``127`` which is the same default value as QuestDB.
0385: This should match the ``cairo.max.file.name.length`` setting of the
0386: QuestDB instance you're connecting to.
0387:
0388: .. code-block:: python
0389:
0390: # These two buffer constructions are equivalent.
0391: buf1 = Buffer()
0392: buf2 = Buffer(init_capacity=65536, max_name_len=127)
0393:
0394: To avoid having to manually set these arguments every time, you can call
0395: the sender's ``new_buffer()`` method instead.
0396:
0397: .. code-block:: python
0398:
0399: from questdb.ingress import Sender, Buffer
0400:
0401: sender = Sender(host='localhost', port=9009,
0402: init_capacity=16384, max_name_len=64)
0403: buf = sender.new_buffer()
0404: assert buf.init_capacity == 16384
0405: assert buf.max_name_len == 64
0406:
0407: """
0408: cdef line_sender_buffer* _impl
0409: cdef size_t _init_capacity
0410: cdef size_t _max_name_len
0411: cdef object _row_complete_sender
0412:
+0413: def __cinit__(self, init_capacity: int=65536, max_name_len: int=127):
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_6Buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_6Buffer_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_init_capacity = 0; PyObject *__pyx_v_max_name_len = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_init_capacity,&__pyx_n_s_max_name_len,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject *)__pyx_int_65536); values[1] = ((PyObject *)__pyx_int_127); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_init_capacity); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_name_len); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 413, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_init_capacity = values[0]; __pyx_v_max_name_len = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 413, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.Buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer___cinit__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self), __pyx_v_init_capacity, __pyx_v_max_name_len); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_6Buffer___cinit__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_init_capacity, PyObject *__pyx_v_max_name_len) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.Buffer.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0414: """
0415: Create a new buffer with the an initial capacity and max name length.
0416: :param int init_capacity: Initial capacity of the buffer in bytes.
0417: :param int max_name_len: Maximum length of a table or column name.
0418: """
+0419: self._cinit_impl(init_capacity, max_name_len)
__pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_init_capacity); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 419, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_As_size_t(__pyx_v_max_name_len); if (unlikely((__pyx_t_2 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 419, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__cinit_impl(__pyx_v_self, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 419, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0420:
+0421: cdef inline _cinit_impl(self, size_t init_capacity, size_t max_name_len):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_6Buffer__cinit_impl(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, size_t __pyx_v_init_capacity, size_t __pyx_v_max_name_len) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_cinit_impl", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0422: self._impl = line_sender_buffer_with_max_name_len(max_name_len)
__pyx_v_self->_impl = line_sender_buffer_with_max_name_len(__pyx_v_max_name_len);
+0423: line_sender_buffer_reserve(self._impl, init_capacity)
line_sender_buffer_reserve(__pyx_v_self->_impl, __pyx_v_init_capacity);
+0424: self._init_capacity = init_capacity
__pyx_v_self->_init_capacity = __pyx_v_init_capacity;
+0425: self._max_name_len = max_name_len
__pyx_v_self->_max_name_len = __pyx_v_max_name_len;
+0426: self._row_complete_sender = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_row_complete_sender); __Pyx_DECREF(__pyx_v_self->_row_complete_sender); __pyx_v_self->_row_complete_sender = Py_None;
0427:
+0428: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_7questdb_7ingress_6Buffer_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7questdb_7ingress_6Buffer_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_7questdb_7ingress_6Buffer_2__dealloc__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_7questdb_7ingress_6Buffer_2__dealloc__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
+0429: self._row_complete_sender = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_row_complete_sender); __Pyx_DECREF(__pyx_v_self->_row_complete_sender); __pyx_v_self->_row_complete_sender = Py_None;
+0430: line_sender_buffer_free(self._impl)
line_sender_buffer_free(__pyx_v_self->_impl);
0431:
0432: @property
+0433: def init_capacity(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_13init_capacity_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_13init_capacity_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_13init_capacity___get__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_13init_capacity___get__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.init_capacity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0434: """
0435: The initial capacity of the buffer when first created.
0436:
0437: This may grow over time, see ``capacity()``.
0438: """
+0439: return self._init_capacity
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_init_capacity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0440:
0441: @property
0442: def max_name_len(self) -> int:
0443: """Maximum length of a table or column name."""
0444: return self._max_name_len
0445:
0446: @property
+0447: def max_name_len(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_12max_name_len_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_12max_name_len_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_12max_name_len___get__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_12max_name_len___get__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.max_name_len.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0448: """Maximum length of a table or column name."""
+0449: return self._max_name_len
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_max_name_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0450:
+0451: def reserve(self, additional: int):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_5reserve(PyObject *__pyx_v_self, PyObject *__pyx_v_additional); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Buffer_4reserve[] = "\n Ensure the buffer has at least `additional` bytes of future capacity.\n\n :param int additional: Additional bytes to reserve.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Buffer_5reserve = {"reserve", (PyCFunction)__pyx_pw_7questdb_7ingress_6Buffer_5reserve, METH_O, __pyx_doc_7questdb_7ingress_6Buffer_4reserve}; static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_5reserve(PyObject *__pyx_v_self, PyObject *__pyx_v_additional) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reserve (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_4reserve(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self), ((PyObject *)__pyx_v_additional)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_4reserve(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_additional) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reserve", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.reserve", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__34 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_additional); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_additional, __pyx_n_u_int) < 0) __PYX_ERR(0, 451, __pyx_L1_error) __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Buffer_5reserve, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_reserve, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer->tp_dict, __pyx_n_s_reserve, __pyx_t_1) < 0) __PYX_ERR(0, 451, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Buffer); __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_reserve, 451, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 451, __pyx_L1_error)
0452: """
0453: Ensure the buffer has at least `additional` bytes of future capacity.
0454:
0455: :param int additional: Additional bytes to reserve.
0456: """
+0457: if additional < 0:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_additional, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+0458: raise ValueError('additional must be non-negative.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 458, __pyx_L1_error) /* … */ __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_additional_must_be_non_negative); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8);
+0459: line_sender_buffer_reserve(self._impl, additional)
__pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_v_additional); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 459, __pyx_L1_error) line_sender_buffer_reserve(__pyx_v_self->_impl, __pyx_t_3);
0460:
+0461: def capacity(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_7capacity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Buffer_6capacity[] = "The current buffer capacity."; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Buffer_7capacity = {"capacity", (PyCFunction)__pyx_pw_7questdb_7ingress_6Buffer_7capacity, METH_NOARGS, __pyx_doc_7questdb_7ingress_6Buffer_6capacity}; static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_7capacity(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("capacity (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_6capacity(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_6capacity(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("capacity", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.capacity", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); /* … */ __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_int) < 0) __PYX_ERR(0, 461, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Buffer_7capacity, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_capacity, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer->tp_dict, __pyx_n_s_capacity, __pyx_t_2) < 0) __PYX_ERR(0, 461, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Buffer); __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_capacity, 461, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 461, __pyx_L1_error)
0462: """The current buffer capacity."""
+0463: return line_sender_buffer_capacity(self._impl)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(line_sender_buffer_capacity(__pyx_v_self->_impl)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0464:
+0465: def clear(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_9clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Buffer_8clear[] = "\n Reset the buffer.\n\n Note that flushing a buffer will (unless otherwise specified)\n also automatically clear it.\n\n This method is designed to be called only in conjunction with\n ``sender.flush(buffer, clear=False)``.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Buffer_9clear = {"clear", (PyCFunction)__pyx_pw_7questdb_7ingress_6Buffer_9clear, METH_NOARGS, __pyx_doc_7questdb_7ingress_6Buffer_8clear}; static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_9clear(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clear (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_8clear(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_8clear(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clear", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__38); __Pyx_GIVEREF(__pyx_tuple__38); /* … */ __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Buffer_9clear, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_clear, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer->tp_dict, __pyx_n_s_clear, __pyx_t_2) < 0) __PYX_ERR(0, 465, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Buffer); __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_clear, 465, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 465, __pyx_L1_error)
0466: """
0467: Reset the buffer.
0468:
0469: Note that flushing a buffer will (unless otherwise specified)
0470: also automatically clear it.
0471:
0472: This method is designed to be called only in conjunction with
0473: ``sender.flush(buffer, clear=False)``.
0474: """
+0475: line_sender_buffer_clear(self._impl)
line_sender_buffer_clear(__pyx_v_self->_impl);
0476:
+0477: def __len__(self) -> int:
/* Python wrapper */ static Py_ssize_t __pyx_pw_7questdb_7ingress_6Buffer_11__len__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Buffer_10__len__[] = "\n The current number of bytes currently in the buffer.\n\n Equivalent (but cheaper) to ``len(str(sender))``.\n "; #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_7questdb_7ingress_6Buffer_10__len__; #endif static Py_ssize_t __pyx_pw_7questdb_7ingress_6Buffer_11__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_10__len__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_pf_7questdb_7ingress_6Buffer_10__len__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0478: """
0479: The current number of bytes currently in the buffer.
0480:
0481: Equivalent (but cheaper) to ``len(str(sender))``.
0482: """
+0483: return line_sender_buffer_size(self._impl)
__pyx_r = line_sender_buffer_size(__pyx_v_self->_impl); goto __pyx_L0;
0484:
+0485: def __str__(self) -> str:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_13__str__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Buffer_12__str__[] = "Return the constructed buffer as a string. Use for debugging."; #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_7questdb_7ingress_6Buffer_12__str__; #endif static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_13__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_12__str__(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_12__str__(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0486: """Return the constructed buffer as a string. Use for debugging."""
+0487: return self._to_str()
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__to_str(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0488:
+0489: cdef inline object _to_str(self):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_6Buffer__to_str(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { size_t __pyx_v_size; char const *__pyx_v_utf8; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_to_str", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer._to_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0490: cdef size_t size = 0
__pyx_v_size = 0;
+0491: cdef const char* utf8 = line_sender_buffer_peek(self._impl, &size)
__pyx_v_utf8 = line_sender_buffer_peek(__pyx_v_self->_impl, (&__pyx_v_size));
+0492: return PyUnicode_FromStringAndSize(utf8, <Py_ssize_t>size)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyUnicode_FromStringAndSize(__pyx_v_utf8, ((Py_ssize_t)__pyx_v_size)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0493:
+0494: cdef inline int _set_marker(self) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__set_marker(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_set_marker", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._set_marker", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0495: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0496: if not line_sender_buffer_set_marker(self._impl, &err):
__pyx_t_1 = ((!(line_sender_buffer_set_marker(__pyx_v_self->_impl, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+0497: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 497, __pyx_L1_error)
0498:
+0499: cdef inline int _rewind_to_marker(self) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__rewind_to_marker(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_rewind_to_marker", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._rewind_to_marker", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0500: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0501: if not line_sender_buffer_rewind_to_marker(self._impl, &err):
__pyx_t_1 = ((!(line_sender_buffer_rewind_to_marker(__pyx_v_self->_impl, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+0502: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 502, __pyx_L1_error)
0503:
+0504: cdef inline _clear_marker(self):
static CYTHON_INLINE PyObject *__pyx_f_7questdb_7ingress_6Buffer__clear_marker(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_clear_marker", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0505: line_sender_buffer_clear_marker(self._impl)
line_sender_buffer_clear_marker(__pyx_v_self->_impl);
0506:
+0507: cdef inline int _table(self, str table_name) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__table(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_table_name) { struct line_sender_error *__pyx_v_err; struct line_sender_table_name __pyx_v_c_table_name; CYTHON_UNUSED PyObject *__pyx_v_owner = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_table", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer._table", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0508: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0509: cdef line_sender_table_name c_table_name
+0510: cdef bytes owner = str_to_table_name(table_name, &c_table_name)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_table_name(__pyx_v_table_name, (&__pyx_v_c_table_name)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0511: if not line_sender_buffer_table(self._impl, c_table_name, &err):
__pyx_t_2 = ((!(line_sender_buffer_table(__pyx_v_self->_impl, __pyx_v_c_table_name, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+0512: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 512, __pyx_L1_error)
+0513: return 0
__pyx_r = 0; goto __pyx_L0;
0514:
+0515: cdef inline int _symbol(self, str name, str value) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__symbol(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { struct line_sender_error *__pyx_v_err; struct line_sender_column_name __pyx_v_c_name; struct line_sender_utf8 __pyx_v_c_value; CYTHON_UNUSED PyObject *__pyx_v_owner_name = 0; CYTHON_UNUSED PyObject *__pyx_v_owner_value = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_symbol", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer._symbol", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner_name); __Pyx_XDECREF(__pyx_v_owner_value); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0516: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0517: cdef line_sender_column_name c_name
0518: cdef line_sender_utf8 c_value
+0519: cdef bytes owner_name = str_to_column_name(name, &c_name)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_column_name(__pyx_v_name, (&__pyx_v_c_name)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_name = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0520: cdef bytes owner_value = str_to_utf8(value, &c_value)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_value, (&__pyx_v_c_value)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_value = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0521: if not line_sender_buffer_symbol(self._impl, c_name, c_value, &err):
__pyx_t_2 = ((!(line_sender_buffer_symbol(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_c_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+0522: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 522, __pyx_L1_error)
+0523: return 0
__pyx_r = 0; goto __pyx_L0;
0524:
+0525: cdef inline int _column_bool(
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__column_bool(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, int __pyx_v_value) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_bool", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._column_bool", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0526: self, line_sender_column_name c_name, bint value) except -1:
+0527: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0528: if not line_sender_buffer_column_bool(self._impl, c_name, value, &err):
__pyx_t_1 = ((!(line_sender_buffer_column_bool(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+0529: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 529, __pyx_L1_error)
+0530: return 0
__pyx_r = 0; goto __pyx_L0;
0531:
+0532: cdef inline int _column_i64(
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__column_i64(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, int64_t __pyx_v_value) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_i64", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._column_i64", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0533: self, line_sender_column_name c_name, int64_t value) except -1:
+0534: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0535: if not line_sender_buffer_column_i64(self._impl, c_name, value, &err):
__pyx_t_1 = ((!(line_sender_buffer_column_i64(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+0536: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 536, __pyx_L1_error)
+0537: return 0
__pyx_r = 0; goto __pyx_L0;
0538:
+0539: cdef inline int _column_f64(
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__column_f64(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, double __pyx_v_value) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_f64", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._column_f64", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0540: self, line_sender_column_name c_name, double value) except -1:
+0541: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0542: if not line_sender_buffer_column_f64(self._impl, c_name, value, &err):
__pyx_t_1 = ((!(line_sender_buffer_column_f64(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+0543: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 543, __pyx_L1_error)
+0544: return 0
__pyx_r = 0; goto __pyx_L0;
0545:
+0546: cdef inline int _column_str(
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__column_str(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, PyObject *__pyx_v_value) { struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_c_value; CYTHON_UNUSED PyObject *__pyx_v_owner_value = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_str", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer._column_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner_value); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0547: self, line_sender_column_name c_name, str value) except -1:
+0548: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0549: cdef line_sender_utf8 c_value
+0550: cdef bytes owner_value = str_to_utf8(value, &c_value)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_value, (&__pyx_v_c_value)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_value = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0551: if not line_sender_buffer_column_str(self._impl, c_name, c_value, &err):
__pyx_t_2 = ((!(line_sender_buffer_column_str(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_c_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_2)) { /* … */ }
+0552: raise c_err_to_py(err)
__pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 552, __pyx_L1_error)
+0553: return 0
__pyx_r = 0; goto __pyx_L0;
0554:
+0555: cdef inline int _column_ts(
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__column_ts(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, struct __pyx_obj_7questdb_7ingress_TimestampMicros *__pyx_v_ts) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_ts", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._column_ts", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0556: self, line_sender_column_name c_name, TimestampMicros ts) except -1:
+0557: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0558: if not line_sender_buffer_column_ts(self._impl, c_name, ts._value, &err):
__pyx_t_1 = ((!(line_sender_buffer_column_ts(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_v_ts->_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+0559: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 559, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 559, __pyx_L1_error)
+0560: return 0
__pyx_r = 0; goto __pyx_L0;
0561:
+0562: cdef inline int _column_dt(
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__column_dt(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct line_sender_column_name __pyx_v_c_name, PyDateTime_DateTime *__pyx_v_dt) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column_dt", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._column_dt", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0563: self, line_sender_column_name c_name, datetime dt) except -1:
+0564: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0565: if not line_sender_buffer_column_ts(
__pyx_t_1 = ((!(line_sender_buffer_column_ts(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_f_7questdb_7ingress_datetime_to_micros(__pyx_v_dt), (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
0566: self._impl, c_name, datetime_to_micros(dt), &err):
+0567: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 567, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 567, __pyx_L1_error)
+0568: return 0
__pyx_r = 0; goto __pyx_L0;
0569:
+0570: cdef inline int _column(self, str name, object value) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__column(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) { struct line_sender_column_name __pyx_v_c_name; CYTHON_UNUSED PyObject *__pyx_v_owner_name = 0; PyObject *__pyx_v_valid = NULL; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_column", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("questdb.ingress.Buffer._column", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_owner_name); __Pyx_XDECREF(__pyx_v_valid); __Pyx_RefNannyFinishContext(); return __pyx_r; }
0571: cdef line_sender_column_name c_name
+0572: cdef bytes owner_name = str_to_column_name(name, &c_name)
__pyx_t_1 = __pyx_f_7questdb_7ingress_str_to_column_name(__pyx_v_name, (&__pyx_v_c_name)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_name = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0573: if PyBool_Check(value):
__pyx_t_2 = (PyBool_Check(__pyx_v_value) != 0);
if (__pyx_t_2) {
/* … */
}
+0574: return self._column_bool(c_name, value)
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 574, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__column_bool(__pyx_v_self, __pyx_v_c_name, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 574, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+0575: elif PyInt_Check(value):
__pyx_t_2 = (PyInt_Check(__pyx_v_value) != 0);
if (__pyx_t_2) {
/* … */
}
+0576: return self._column_i64(c_name, value)
__pyx_t_4 = __Pyx_PyInt_As_int64_t(__pyx_v_value); if (unlikely((__pyx_t_4 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 576, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__column_i64(__pyx_v_self, __pyx_v_c_name, __pyx_t_4); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 576, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+0577: elif PyFloat_Check(value):
__pyx_t_2 = (PyFloat_Check(__pyx_v_value) != 0);
if (__pyx_t_2) {
/* … */
}
+0578: return self._column_f64(c_name, value)
__pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__column_f64(__pyx_v_self, __pyx_v_c_name, __pyx_t_5); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 578, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+0579: elif PyUnicode_Check(value):
__pyx_t_2 = (PyUnicode_Check(__pyx_v_value) != 0);
if (__pyx_t_2) {
/* … */
}
+0580: return self._column_str(c_name, value)
if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 580, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__column_str(__pyx_v_self, __pyx_v_c_name, ((PyObject*)__pyx_v_value)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 580, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+0581: elif isinstance(value, TimestampMicros):
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_7questdb_7ingress_TimestampMicros);
__pyx_t_6 = (__pyx_t_2 != 0);
if (__pyx_t_6) {
/* … */
}
+0582: return self._column_ts(c_name, value)
if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_7questdb_7ingress_TimestampMicros))))) __PYX_ERR(0, 582, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__column_ts(__pyx_v_self, __pyx_v_c_name, ((struct __pyx_obj_7questdb_7ingress_TimestampMicros *)__pyx_v_value)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 582, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+0583: elif isinstance(value, datetime):
__pyx_t_6 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_2 = (__pyx_t_6 != 0);
if (likely(__pyx_t_2)) {
/* … */
}
+0584: return self._column_dt(c_name, value)
if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_7cpython_8datetime_datetime))))) __PYX_ERR(0, 584, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__column_dt(__pyx_v_self, __pyx_v_c_name, ((PyDateTime_DateTime *)__pyx_v_value)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 584, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
0585: else:
+0586: valid = ', '.join((
/*else*/ { /* … */ __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__9, __pyx_tuple__10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_valid = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0587: 'bool',
__pyx_tuple__10 = PyTuple_Pack(6, __pyx_n_u_bool, __pyx_n_u_int, __pyx_n_u_float, __pyx_n_u_str, __pyx_n_u_TimestampMicros, __pyx_kp_u_datetime_datetime); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10);
0588: 'int',
0589: 'float',
0590: 'str',
0591: 'TimestampMicros',
0592: 'datetime.datetime'))
+0593: raise TypeError(
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 593, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 593, __pyx_L1_error) }
+0594: f'Unsupported type: {type(value)}. Must be one of: {valid}')
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = 0; __pyx_t_8 = 127; __Pyx_INCREF(__pyx_kp_u_Unsupported_type); __pyx_t_7 += 18; __Pyx_GIVEREF(__pyx_kp_u_Unsupported_type); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_Unsupported_type); __pyx_t_9 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_value)), __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8; __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9); __pyx_t_9 = 0; __Pyx_INCREF(__pyx_kp_u_Must_be_one_of); __pyx_t_7 += 18; __Pyx_GIVEREF(__pyx_kp_u_Must_be_one_of); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_Must_be_one_of); __pyx_t_9 = __Pyx_PyUnicode_Unicode(__pyx_v_valid); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_8) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_8; __pyx_t_7 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_1, 4, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 594, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0595:
+0596: cdef inline int _may_trigger_row_complete(self) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__may_trigger_row_complete(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { CYTHON_UNUSED struct line_sender_error *__pyx_v_err; PyObject *__pyx_v_sender; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_may_trigger_row_complete", 0); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Buffer._may_trigger_row_complete", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0597: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0598: cdef PyObject* sender = NULL
__pyx_v_sender = NULL;
+0599: if self._row_complete_sender != None:
__pyx_t_1 = PyObject_RichCompare(__pyx_v_self->_row_complete_sender, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 599, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 599, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+0600: sender = PyWeakref_GetObject(self._row_complete_sender)
__pyx_t_1 = __pyx_v_self->_row_complete_sender; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = PyWeakref_GetObject(__pyx_t_1); if (unlikely(__pyx_t_3 == ((PyObject *)NULL))) __PYX_ERR(0, 600, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_sender = __pyx_t_3;
+0601: if sender != NULL:
__pyx_t_2 = ((__pyx_v_sender != NULL) != 0); if (__pyx_t_2) { /* … */ }
+0602: may_flush_on_row_complete(self, <Sender><object>sender)
__pyx_t_4 = __pyx_f_7questdb_7ingress_may_flush_on_row_complete(__pyx_v_self, ((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_sender)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 602, __pyx_L1_error)
0603:
+0604: cdef inline int _at_ts(self, TimestampNanos ts) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__at_ts(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, struct __pyx_obj_7questdb_7ingress_TimestampNanos *__pyx_v_ts) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_at_ts", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._at_ts", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0605: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0606: if not line_sender_buffer_at(self._impl, ts._value, &err):
__pyx_t_1 = ((!(line_sender_buffer_at(__pyx_v_self->_impl, __pyx_v_ts->_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+0607: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 607, __pyx_L1_error)
+0608: return 0
__pyx_r = 0; goto __pyx_L0;
0609:
+0610: cdef inline int _at_dt(self, datetime dt) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__at_dt(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyDateTime_DateTime *__pyx_v_dt) { int64_t __pyx_v_value; struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_at_dt", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._at_dt", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0611: cdef int64_t value = datetime_to_nanos(dt)
__pyx_v_value = __pyx_f_7questdb_7ingress_datetime_to_nanos(__pyx_v_dt);
+0612: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0613: if not line_sender_buffer_at(self._impl, value, &err):
__pyx_t_1 = ((!(line_sender_buffer_at(__pyx_v_self->_impl, __pyx_v_value, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+0614: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 614, __pyx_L1_error)
+0615: return 0
__pyx_r = 0; goto __pyx_L0;
0616:
+0617: cdef inline int _at_now(self) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__at_now(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self) { struct line_sender_error *__pyx_v_err; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_at_now", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Buffer._at_now", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0618: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0619: if not line_sender_buffer_at_now(self._impl, &err):
__pyx_t_1 = ((!(line_sender_buffer_at_now(__pyx_v_self->_impl, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+0620: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 620, __pyx_L1_error)
+0621: return 0
__pyx_r = 0; goto __pyx_L0;
0622:
+0623: cdef inline int _at(self, object ts) except -1:
static CYTHON_INLINE int __pyx_f_7questdb_7ingress_6Buffer__at(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_ts) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_at", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ingress.Buffer._at", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0624: if ts is None:
__pyx_t_1 = (__pyx_v_ts == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+0625: return self._at_now()
__pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__at_now(__pyx_v_self); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 625, __pyx_L1_error)
__pyx_r = __pyx_t_3;
goto __pyx_L0;
+0626: elif isinstance(ts, TimestampNanos):
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_ts, __pyx_ptype_7questdb_7ingress_TimestampNanos);
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* … */
}
+0627: return self._at_ts(ts)
if (!(likely(((__pyx_v_ts) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_ts, __pyx_ptype_7questdb_7ingress_TimestampNanos))))) __PYX_ERR(0, 627, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__at_ts(__pyx_v_self, ((struct __pyx_obj_7questdb_7ingress_TimestampNanos *)__pyx_v_ts)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 627, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+0628: elif isinstance(ts, datetime):
__pyx_t_1 = __Pyx_TypeCheck(__pyx_v_ts, __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_2 = (__pyx_t_1 != 0);
if (likely(__pyx_t_2)) {
/* … */
}
+0629: return self._at_dt(ts)
if (!(likely(((__pyx_v_ts) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_ts, __pyx_ptype_7cpython_8datetime_datetime))))) __PYX_ERR(0, 629, __pyx_L1_error) __pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__at_dt(__pyx_v_self, ((PyDateTime_DateTime *)__pyx_v_ts)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 629, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
0630: else:
+0631: raise TypeError(
/*else*/ { /* … */ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __PYX_ERR(0, 631, __pyx_L1_error) }
+0632: f'Unsupported type: {type(ts)}. Must be one of: ' +
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = 127; __Pyx_INCREF(__pyx_kp_u_Unsupported_type); __pyx_t_5 += 18; __Pyx_GIVEREF(__pyx_kp_u_Unsupported_type); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_Unsupported_type); __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_ts)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 632, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6; __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_kp_u_Must_be_one_of); __pyx_t_5 += 18; __Pyx_GIVEREF(__pyx_kp_u_Must_be_one_of); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_kp_u_Must_be_one_of); __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_4, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 632, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_t_7, __pyx_kp_u_TimestampNanos_datetime_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
0633: 'TimestampNanos, datetime, None')
0634:
+0635: cdef int _row(
static int __pyx_f_7questdb_7ingress_6Buffer__row(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_table_name, struct __pyx_opt_args_7questdb_7ingress_6Buffer__row *__pyx_optional_args) { /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("questdb.ingress.Buffer._row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_name); __Pyx_XDECREF(__pyx_v_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ struct __pyx_opt_args_7questdb_7ingress_6Buffer__row { int __pyx_n; PyObject *symbols; PyObject *columns; PyObject *at; };
0636: self,
0637: str table_name,
+0638: dict symbols=None,
PyObject *__pyx_v_symbols = ((PyObject*)Py_None);
+0639: dict columns=None,
PyObject *__pyx_v_columns = ((PyObject*)Py_None);
+0640: object at=None) except -1:
PyObject *__pyx_v_at = ((PyObject *)Py_None); int __pyx_v_wrote_fields; PyObject *__pyx_v_name = NULL; PyObject *__pyx_v_value = NULL; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_row", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_symbols = __pyx_optional_args->symbols; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_columns = __pyx_optional_args->columns; if (__pyx_optional_args->__pyx_n > 2) { __pyx_v_at = __pyx_optional_args->at; } } } }
0641: """
0642: Add a row to the buffer.
0643: """
+0644: cdef bint wrote_fields = False
__pyx_v_wrote_fields = 0;
+0645: self._set_marker()
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__set_marker(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 645, __pyx_L1_error)
+0646: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_XGIVEREF(__pyx_t_4); __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4); goto __pyx_L1_error; __pyx_L8_try_end:; }
+0647: self._table(table_name)
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__table(__pyx_v_self, __pyx_v_table_name); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 647, __pyx_L3_error)
+0648: if symbols is not None:
__pyx_t_5 = (__pyx_v_symbols != ((PyObject*)Py_None)); __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { /* … */ }
+0649: for name, value in symbols.items():
__pyx_t_8 = 0; if (unlikely(__pyx_v_symbols == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 649, __pyx_L3_error) } __pyx_t_10 = __Pyx_dict_iterator(__pyx_v_symbols, 1, __pyx_n_s_items, (&__pyx_t_9), (&__pyx_t_1)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 649, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = __pyx_t_10; __pyx_t_10 = 0; while (1) { __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_9, &__pyx_t_8, &__pyx_t_10, &__pyx_t_11, NULL, __pyx_t_1); if (unlikely(__pyx_t_12 == 0)) break; if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 649, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11); __pyx_t_11 = 0;
+0650: if value is not None:
__pyx_t_6 = (__pyx_v_value != Py_None);
__pyx_t_5 = (__pyx_t_6 != 0);
if (__pyx_t_5) {
/* … */
}
}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+0651: self._symbol(name, value)
if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(0, 651, __pyx_L3_error) if (!(likely(PyUnicode_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 651, __pyx_L3_error) __pyx_t_12 = __pyx_f_7questdb_7ingress_6Buffer__symbol(__pyx_v_self, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_value)); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 651, __pyx_L3_error)
+0652: wrote_fields = True
__pyx_v_wrote_fields = 1;
+0653: if columns is not None:
__pyx_t_5 = (__pyx_v_columns != ((PyObject*)Py_None)); __pyx_t_6 = (__pyx_t_5 != 0); if (__pyx_t_6) { /* … */ }
+0654: for name, value in columns.items():
__pyx_t_9 = 0; if (unlikely(__pyx_v_columns == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 654, __pyx_L3_error) } __pyx_t_11 = __Pyx_dict_iterator(__pyx_v_columns, 1, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_1)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 654, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = __pyx_t_11; __pyx_t_11 = 0; while (1) { __pyx_t_12 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_8, &__pyx_t_9, &__pyx_t_11, &__pyx_t_10, NULL, __pyx_t_1); if (unlikely(__pyx_t_12 == 0)) break; if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 654, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GOTREF(__pyx_t_10); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_10); __pyx_t_10 = 0;
+0655: if value is not None:
__pyx_t_6 = (__pyx_v_value != Py_None);
__pyx_t_5 = (__pyx_t_6 != 0);
if (__pyx_t_5) {
/* … */
}
}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+0656: self._column(name, value)
if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_name)->tp_name), 0))) __PYX_ERR(0, 656, __pyx_L3_error) __pyx_t_12 = __pyx_f_7questdb_7ingress_6Buffer__column(__pyx_v_self, ((PyObject*)__pyx_v_name), __pyx_v_value); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 656, __pyx_L3_error)
+0657: wrote_fields = True
__pyx_v_wrote_fields = 1;
+0658: if wrote_fields:
__pyx_t_5 = (__pyx_v_wrote_fields != 0); if (__pyx_t_5) { /* … */ goto __pyx_L17; }
+0659: self._at(at)
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__at(__pyx_v_self, __pyx_v_at); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 659, __pyx_L3_error)
+0660: self._clear_marker()
__pyx_t_7 = __pyx_f_7questdb_7ingress_6Buffer__clear_marker(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 660, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
0661: else:
+0662: self._rewind_to_marker()
/*else*/ {
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__rewind_to_marker(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 662, __pyx_L3_error)
}
__pyx_L17:;
+0663: except:
/*except:*/ { __Pyx_AddTraceback("questdb.ingress.Buffer._row", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_10, &__pyx_t_11) < 0) __PYX_ERR(0, 663, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_10); __Pyx_GOTREF(__pyx_t_11);
+0664: self._rewind_to_marker()
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__rewind_to_marker(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 664, __pyx_L5_except_error)
+0665: raise
__Pyx_GIVEREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_10); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_10, __pyx_t_11); __pyx_t_7 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __PYX_ERR(0, 665, __pyx_L5_except_error) } __pyx_L5_except_error:;
+0666: if wrote_fields:
__pyx_t_5 = (__pyx_v_wrote_fields != 0); if (__pyx_t_5) { /* … */ }
+0667: self._may_trigger_row_complete()
__pyx_t_1 = __pyx_f_7questdb_7ingress_6Buffer__may_trigger_row_complete(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 667, __pyx_L1_error)
0668:
+0669: def row(
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_15row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Buffer_14row[] = "\n Add a single row (line) to the buffer.\n\n .. code-block:: python\n\n # All fields specified.\n buffer.row(\n 'table_name',\n symbols={'sym1': 'abc', 'sym2': 'def', 'sym3': None},\n columns={\n 'col1': True,\n 'col2': 123,\n 'col3': 3.14,\n 'col4': 'xyz',\n 'col5': TimestampMicros(123456789),\n 'col6': datetime(2019, 1, 1, 12, 0, 0),\n 'col7': None},\n at=TimestampNanos(123456789))\n\n # Only symbols specified. Designated timestamp assigned by the db.\n buffer.row(\n 'table_name',\n symbols={'sym1': 'abc', 'sym2': 'def'})\n\n # Float columns and timestamp specified as `datetime.datetime`.\n # Pay special attention to the timezone, which if unspecified is\n # assumed to be the local timezone (and not UTC).\n buffer.row(\n 'sensor data',\n columns={\n 'temperature': 24.5,\n 'humidity': 0.5},\n at=datetime.datetime.utcnow())\n\n\n Python strings passed as values to ``symbols`` are going to be encoded\n as the ``SYMBOL`` type in QuestDB, whilst Python strings passed as\n values to ``columns`` are going to be encoded as the ``STRING`` type.\n\n Refer to the\n `QuestDB documentation <https://questdb.io/docs/concept/symbol/>`_ to\n understand the difference between the ``SYMBOL`` and ``STRING`` types\n (TL;DR: symbols are interned strings).\n\n Column values can be specified with Python types directly and map as so:\n\n .. list-table::\n :header-rows: 1\n\n * - Python type\n - Serialized as ILP type\n * - ``bool``\n - `BOOLEAN <https://questdb.io/doc""s/reference/api/ilp/columnset-types#boolean>`_\n * - ``int``\n - `INTEGER <https://questdb.io/docs/reference/api/ilp/columnset-types#integer>`_\n * - ``float``\n - `FLOAT <https://questdb.io/docs/reference/api/ilp/columnset-types#float>`_\n * - ``str``\n - `STRING <https://questdb.io/docs/reference/api/ilp/columnset-types#string>`_\n * - ``datetime.datetime`` and ``TimestampMicros``\n - `TIMESTAMP <https://questdb.io/docs/reference/api/ilp/columnset-types#timestamp>`_\n * - ``None``\n - *Column is skipped and not serialized.*\n\n If the destination table was already created, then the columns types\n will be cast to the types of the existing columns whenever possible\n (Refer to the QuestDB documentation pages linked above).\n\n :param table_name: The name of the table to which the row belongs.\n :param symbols: A dictionary of symbol column names to ``str`` values.\n As a convenience, you can also pass a ``None`` value which will\n have the same effect as skipping the key: If the column already\n existed, it will be recorded as ``NULL``, otherwise it will not be\n created.\n :param columns: A dictionary of column names to ``bool``, ``int``,\n ``float``, ``str``, ``TimestampMicros`` or ``datetime`` values.\n As a convenience, you can also pass a ``None`` value which will\n have the same effect as skipping the key: If the column already\n existed, it will be recorded as ``NULL``, otherwise it will not be\n created.\n :param at: The timestamp of the row. If ``None``, timestamp is assigned\n by the server. If ``datetime``, the timestamp is converted to\n nanoseconds. A nanosecond unix epoch timestamp can be passed\n explicitly as a ``TimestampNanos`` object.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Buffer_15row = {"row", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_7ingress_6Buffer_15row, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Buffer_14row}; static PyObject *__pyx_pw_7questdb_7ingress_6Buffer_15row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_table_name = 0; PyObject *__pyx_v_symbols = 0; PyObject *__pyx_v_columns = 0; PyObject *__pyx_v_at = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_table_name,&__pyx_n_s_symbols,&__pyx_n_s_columns,&__pyx_n_s_at,0}; PyObject* values[4] = {0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Buffer_14row(struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_self, PyObject *__pyx_v_table_name, PyObject *__pyx_v_symbols, PyObject *__pyx_v_columns, PyObject *__pyx_v_at) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("questdb.ingress.Buffer.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__40 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_table_name, __pyx_n_s_symbols, __pyx_n_s_columns, __pyx_n_s_at); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 669, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__40); __Pyx_GIVEREF(__pyx_tuple__40); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_table_name, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 669, __pyx_L1_error) /* … */ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Buffer_15row, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Buffer_row, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer->tp_dict, __pyx_n_s_row, __pyx_t_4) < 0) __PYX_ERR(0, 669, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Buffer); __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 3, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_row, 669, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 669, __pyx_L1_error)
0670: self,
0671: table_name: str,
0672: *,
+0673: symbols: Optional[Dict[str, Optional[str]]]=None,
values[1] = ((PyObject *)Py_None); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Optional); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Optional); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, ((PyObject *)(&PyUnicode_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_symbols, __pyx_t_4) < 0) __PYX_ERR(0, 669, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0674: columns: Optional[Dict[
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Optional); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); /* … */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 674, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_columns, __pyx_t_3) < 0) __PYX_ERR(0, 669, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0675: str,
+0676: Union[None, bool, int, float, str, TimestampMicros, datetime]]
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Union); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_4bool_bool)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_4bool_bool)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)); __Pyx_INCREF(((PyObject *)(&PyInt_Type))); __Pyx_GIVEREF(((PyObject *)(&PyInt_Type))); PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)(&PyInt_Type))); __Pyx_INCREF(((PyObject *)(&PyFloat_Type))); __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type))); PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)(&PyFloat_Type))); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros)); PyTuple_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros)); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); PyTuple_SET_ITEM(__pyx_t_3, 6, ((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 676, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+0677: ]=None,
values[2] = ((PyObject *)Py_None);
+0678: at: Union[None, TimestampNanos, datetime]=None):
values[3] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_table_name)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (kw_args > 0 && likely(kw_args <= 3)) { Py_ssize_t index; for (index = 1; index < 4 && kw_args > 0; index++) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]); if (value) { values[index] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "row") < 0)) __PYX_ERR(0, 669, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_table_name = ((PyObject*)values[0]); __pyx_v_symbols = values[1]; __pyx_v_columns = values[2]; __pyx_v_at = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("row", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 669, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.Buffer.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyUnicode_Type), 1, "table_name", 1))) __PYX_ERR(0, 671, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Buffer_14row(((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_v_self), __pyx_v_table_name, __pyx_v_symbols, __pyx_v_columns, __pyx_v_at); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Union); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 678, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 678, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_6, 0, Py_None); __Pyx_INCREF(((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos)); PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos)); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 678, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_at, __pyx_t_4) < 0) __PYX_ERR(0, 669, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0679: """
0680: Add a single row (line) to the buffer.
0681:
0682: .. code-block:: python
0683:
0684: # All fields specified.
0685: buffer.row(
0686: 'table_name',
0687: symbols={'sym1': 'abc', 'sym2': 'def', 'sym3': None},
0688: columns={
0689: 'col1': True,
0690: 'col2': 123,
0691: 'col3': 3.14,
0692: 'col4': 'xyz',
0693: 'col5': TimestampMicros(123456789),
0694: 'col6': datetime(2019, 1, 1, 12, 0, 0),
0695: 'col7': None},
0696: at=TimestampNanos(123456789))
0697:
0698: # Only symbols specified. Designated timestamp assigned by the db.
0699: buffer.row(
0700: 'table_name',
0701: symbols={'sym1': 'abc', 'sym2': 'def'})
0702:
0703: # Float columns and timestamp specified as `datetime.datetime`.
0704: # Pay special attention to the timezone, which if unspecified is
0705: # assumed to be the local timezone (and not UTC).
0706: buffer.row(
0707: 'sensor data',
0708: columns={
0709: 'temperature': 24.5,
0710: 'humidity': 0.5},
0711: at=datetime.datetime.utcnow())
0712:
0713:
0714: Python strings passed as values to ``symbols`` are going to be encoded
0715: as the ``SYMBOL`` type in QuestDB, whilst Python strings passed as
0716: values to ``columns`` are going to be encoded as the ``STRING`` type.
0717:
0718: Refer to the
0719: `QuestDB documentation <https://questdb.io/docs/concept/symbol/>`_ to
0720: understand the difference between the ``SYMBOL`` and ``STRING`` types
0721: (TL;DR: symbols are interned strings).
0722:
0723: Column values can be specified with Python types directly and map as so:
0724:
0725: .. list-table::
0726: :header-rows: 1
0727:
0728: * - Python type
0729: - Serialized as ILP type
0730: * - ``bool``
0731: - `BOOLEAN <https://questdb.io/docs/reference/api/ilp/columnset-types#boolean>`_
0732: * - ``int``
0733: - `INTEGER <https://questdb.io/docs/reference/api/ilp/columnset-types#integer>`_
0734: * - ``float``
0735: - `FLOAT <https://questdb.io/docs/reference/api/ilp/columnset-types#float>`_
0736: * - ``str``
0737: - `STRING <https://questdb.io/docs/reference/api/ilp/columnset-types#string>`_
0738: * - ``datetime.datetime`` and ``TimestampMicros``
0739: - `TIMESTAMP <https://questdb.io/docs/reference/api/ilp/columnset-types#timestamp>`_
0740: * - ``None``
0741: - *Column is skipped and not serialized.*
0742:
0743: If the destination table was already created, then the columns types
0744: will be cast to the types of the existing columns whenever possible
0745: (Refer to the QuestDB documentation pages linked above).
0746:
0747: :param table_name: The name of the table to which the row belongs.
0748: :param symbols: A dictionary of symbol column names to ``str`` values.
0749: As a convenience, you can also pass a ``None`` value which will
0750: have the same effect as skipping the key: If the column already
0751: existed, it will be recorded as ``NULL``, otherwise it will not be
0752: created.
0753: :param columns: A dictionary of column names to ``bool``, ``int``,
0754: ``float``, ``str``, ``TimestampMicros`` or ``datetime`` values.
0755: As a convenience, you can also pass a ``None`` value which will
0756: have the same effect as skipping the key: If the column already
0757: existed, it will be recorded as ``NULL``, otherwise it will not be
0758: created.
0759: :param at: The timestamp of the row. If ``None``, timestamp is assigned
0760: by the server. If ``datetime``, the timestamp is converted to
0761: nanoseconds. A nanosecond unix epoch timestamp can be passed
0762: explicitly as a ``TimestampNanos`` object.
0763: """
+0764: self._row(table_name, symbols, columns, at)
if (!(likely(PyDict_CheckExact(__pyx_v_symbols))||((__pyx_v_symbols) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_symbols)->tp_name), 0))) __PYX_ERR(0, 764, __pyx_L1_error) if (!(likely(PyDict_CheckExact(__pyx_v_columns))||((__pyx_v_columns) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_columns)->tp_name), 0))) __PYX_ERR(0, 764, __pyx_L1_error) __pyx_t_2.__pyx_n = 3; __pyx_t_2.symbols = ((PyObject*)__pyx_v_symbols); __pyx_t_2.columns = ((PyObject*)__pyx_v_columns); __pyx_t_2.at = __pyx_v_at; __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Buffer *)__pyx_v_self->__pyx_vtab)->_row(__pyx_v_self, __pyx_v_table_name, &__pyx_t_2); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 764, __pyx_L1_error)
+0765: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
0766:
0767: # def tabular(
0768: # self,
0769: # table_name: str,
0770: # data: Iterable[Iterable[Union[
0771: # bool, int, float, str,
0772: # TimestampMicros, TimestampNanos, datetime]]],
0773: # *,
0774: # header: Optional[List[Optional[str]]]=None,
0775: # symbols: Union[bool, List[int]]=False,
0776: # at: Union[None, TimestampNanos, datetime]=None):
0777: # """
0778: # Add multiple rows as an iterable of iterables (e.g. list of lists) to
0779: # the buffer.
0780:
0781: # **Data and header**
0782:
0783: # The ``data`` argument specifies rows which must all be for the same
0784: # table. Column names are provided as the ``header``.
0785:
0786: # .. code-block:: python
0787:
0788: # buffer.tabular(
0789: # 'table_name',
0790: # [[True, 123, 3.14, 'xyz'],
0791: # [False, 456, 6.28, 'abc'],
0792: # [True, 789, 9.87, 'def']],
0793: # header=['col1', 'col2', 'col3', 'col4'])
0794:
0795: # **Designated Timestamp Column**
0796:
0797: # QuestDB supports a special `designated timestamp
0798: # <https://questdb.io/docs/concept/designated-timestamp/>`_ column that it
0799: # uses to sort the rows by timestamp.
0800:
0801: # If the data section contains the same number of columns as the header,
0802: # then the designated is going to be
0803: # assigned by the server, unless specified for all columns the `at`
0804: # argument as either an integer wrapped in a ``TimestampNanos`` object
0805: # representing nanoseconds since unix epoch (1970-01-01 00:00:00 UTC) or
0806: # as a ``datetime.datetime`` object.
0807:
0808: # .. code-block:: python
0809:
0810: # buffer.tabular(
0811: # 'table_name',
0812: # [[True, None, 3.14, 'xyz'],
0813: # [False, 123, 6.28, 'abc'],
0814: # [True, 456, 9.87, 'def']],
0815: # header=['col1', 'col2', 'col3', 'col4'],
0816: # at=datetime.datetime.utcnow())
0817:
0818: # # or ...
0819: # # at=TimestampNanos(1657386397157631000))
0820:
0821: # If the rows need different `designated timestamp
0822: # <https://questdb.io/docs/concept/designated-timestamp/>`_ values across
0823: # different rows, you can provide them as an additional unlabeled column.
0824: # An unlabled column is one that has its name set to ``None``.
0825:
0826: # .. code-block:: python
0827:
0828: # ts1 = datetime.datetime.utcnow()
0829: # ts2 = (
0830: # datetime.datetime.utcnow() +
0831: # datetime.timedelta(microseconds=1))
0832: # buffer.tabular(
0833: # 'table_name',
0834: # [[True, 123, ts1],
0835: # [False, 456, ts2]],
0836: # header=['col1', 'col2', None])
0837:
0838: # Like the ``at`` argument, the designated timestamp column may also be
0839: # specified as ``TimestampNanos`` objects.
0840:
0841: # .. code-block:: python
0842:
0843: # buffer.tabular(
0844: # 'table_name',
0845: # [[True, 123, TimestampNanos(1657386397157630000)],
0846: # [False, 456, TimestampNanos(1657386397157631000)]],
0847: # header=['col1', 'col2', None])
0848:
0849: # The designated timestamp column may appear anywhere positionally.
0850:
0851: # .. code-block:: python
0852:
0853: # ts1 = datetime.datetime.utcnow()
0854: # ts2 = (
0855: # datetime.datetime.utcnow() +
0856: # datetime.timedelta(microseconds=1))
0857: # buffer.tabular(
0858: # 'table_name',
0859: # [[1000, ts1, 123],
0860: # [2000, ts2, 456]],
0861: # header=['col1', None, 'col2'])
0862:
0863: # **Other timestamp columns**
0864:
0865: # Other columns may also contain timestamps. These columns can take
0866: # ``datetime.datetime`` objects or ``TimestampMicros`` (*not nanos*)
0867: # objects.
0868:
0869: # .. code-block:: python
0870:
0871: # ts1 = datetime.datetime.utcnow()
0872: # ts2 = (
0873: # datetime.datetime.utcnow() +
0874: # datetime.timedelta(microseconds=1))
0875: # buffer.tabular(
0876: # 'table_name',
0877: # [[1000, ts1, 123],
0878: # [2000, ts2, 456]],
0879: # header=['col1', 'col2', 'col3'],
0880: # at=datetime.datetime.utcnow())
0881:
0882: # **Symbol Columns**
0883:
0884: # QuestDB can represent strings via the ``STRING`` or ``SYMBOL`` types.
0885:
0886: # If all the columns of type ``str`` are to be treated as ``STRING``, then
0887: # specify ``symbols=False`` (default - see exaples above).
0888:
0889: # If all need to be treated as ``SYMBOL`` specify ``symbols=True``.
0890:
0891: # .. code-block:: python
0892:
0893: # buffer.tabular(
0894: # 'table_name',
0895: # [['abc', 123, 3.14, 'xyz'],
0896: # ['def', 456, None, 'abc'],
0897: # ['ghi', 789, 9.87, 'def']],
0898: # header=['col1', 'col2', 'col3', 'col4'],
0899: # symbols=True) # `col1` and `col4` are SYMBOL columns.
0900:
0901: # Whilst if only a select few are to be treated as ``SYMBOL``, specify a
0902: # list of column indices to the ``symbols`` arg.
0903:
0904: # .. code-block:: python
0905:
0906: # buffer.tabular(
0907: # 'table_name',
0908: # [['abc', 123, 3.14, 'xyz'],
0909: # ['def', 456, 6.28, 'abc'],
0910: # ['ghi', 789, 9.87, 'def']],
0911: # header=['col1', 'col2', 'col3', 'col4'],
0912: # symbols=[0]) # `col1` is SYMBOL; 'col4' is STRING.
0913:
0914: # Alternatively, you can specify a list of symbol column names.
0915:
0916: # .. code-block:: python
0917:
0918: # buffer.tabular(
0919: # 'table_name',
0920: # [['abc', 123, 3.14, 'xyz'],
0921: # ['def', 456, 6.28, 'abc'],
0922: # ['ghi', 789, 9.87, 'def']],
0923: # header=['col1', 'col2', 'col3', 'col4'],
0924: # symbols=['col1']) # `col1` is SYMBOL; 'col4' is STRING.
0925:
0926: # Note that column indices are 0-based and negative indices are counted
0927: # from the end.
0928: # """
0929: # raise ValueError('nyi')
0930:
0931: # def pandas(
0932: # self,
0933: # table_name: str,
0934: # data: pd.DataFrame,
0935: # *,
0936: # symbols: Union[bool, List[int]]=False,
0937: # at: Union[None, TimestampNanos, datetime]=None):
0938: # """
0939: # Add a pandas DataFrame to the buffer.
0940: # """
0941: # raise ValueError('nyi')
0942:
0943:
+0944: _FLUSH_FMT = ('{} - See https://py-questdb-client.readthedocs.io/en/'
if (PyDict_SetItem(__pyx_d, __pyx_n_s_FLUSH_FMT, __pyx_kp_u_See_https_py_questdb_client_rea) < 0) __PYX_ERR(0, 944, __pyx_L1_error)
0945: 'v1.0.2'
0946: '/troubleshooting.html#inspecting-and-debugging-errors#flush-failed')
0947:
0948:
+0949: cdef class Sender:
struct __pyx_vtabstruct_7questdb_7ingress_Sender { PyObject *(*flush)(struct __pyx_obj_7questdb_7ingress_Sender *, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_7ingress_6Sender_flush *__pyx_optional_args); PyObject *(*_close)(struct __pyx_obj_7questdb_7ingress_Sender *); PyObject *(*close)(struct __pyx_obj_7questdb_7ingress_Sender *, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_7ingress_6Sender_close *__pyx_optional_args); }; static struct __pyx_vtabstruct_7questdb_7ingress_Sender *__pyx_vtabptr_7questdb_7ingress_Sender;
0950: """
0951: A sender is a client that inserts rows into QuestDB via the ILP protocol.
0952:
0953: **Inserting two rows**
0954:
0955: In this example, data will be flushed and sent at the end of the ``with``
0956: block.
0957:
0958: .. code-block:: python
0959:
0960: with Sender('localhost', 9009) as sender:
0961: sender.row(
0962: 'weather_sensor',
0963: symbols={'id': 'toronto1'},
0964: columns={'temperature': 23.5, 'humidity': 0.49})
0965: sensor.row(
0966: 'weather_sensor',
0967: symbols={'id': 'dubai2'},
0968: columns={'temperature': 41.2, 'humidity': 0.34})
0969:
0970: The ``Sender`` object holds an internal buffer. The call to ``.row()``
0971: simply forwards all arguments to the :func:`Buffer.row` method.
0972:
0973:
0974: **Explicit flushing**
0975:
0976: An explicit call to :func:`Sender.flush` will send any pending data
0977: immediately.
0978:
0979: .. code-block:: python
0980:
0981: with Sender('localhost', 9009) as sender:
0982: sender.row(
0983: 'weather_sensor',
0984: symbols={'id': 'toronto1'},
0985: columns={'temperature': 23.5, 'humidity': 0.49})
0986: sender.flush()
0987: sender.row(
0988: 'weather_sensor',
0989: symbols={'id': 'dubai2'},
0990: columns={'temperature': 41.2, 'humidity': 0.34})
0991: sender.flush()
0992:
0993:
0994: **Auto-flushing (on by default, watermark at 63KiB)**
0995:
0996: To avoid accumulating very large buffers, the sender will flush the buffer
0997: automatically once its buffer reaches a certain byte-size watermark.
0998:
0999: You can control this behavior by setting the ``auto_flush`` argument.
1000:
1001: .. code-block:: python
1002:
1003: # Never flushes automatically.
1004: sender = Sender('localhost', 9009, auto_flush=False)
1005: sender = Sender('localhost', 9009, auto_flush=None) # Ditto.
1006: sender = Sender('localhost', 9009, auto_flush=0) # Ditto.
1007:
1008: # Flushes automatically when the buffer reaches 1KiB.
1009: sender = Sender('localhost', 9009, auto_flush=1024)
1010:
1011: # Flushes automatically after every row.
1012: sender = Sender('localhost', 9009, auto_flush=True)
1013: sender = Sender('localhost', 9009, auto_flush=1) # Ditto.
1014:
1015:
1016: **Authentication and TLS Encryption**
1017:
1018: This implementation supports authentication and TLS full-connection
1019: encryption.
1020:
1021: The ``Sender(.., auth=..)`` argument is a tuple of ``(kid, d, x, y)`` as
1022: documented on the `QuestDB ILP authentication
1023: <https://questdb.io/docs/reference/api/ilp/authenticate>`_ documentation.
1024: Authentication is optional and disabled by default.
1025:
1026: The ``Sender(.., tls=..)`` argument is one of:
1027:
1028: * ``False``: No TLS encryption (default).
1029:
1030: * ``True``: TLS encryption, accepting all common certificates as recognized
1031: by the `webpki-roots <https://crates.io/crates/webpki-roots>`_ Rust crate
1032: which in turn relies on https://mkcert.org/.
1033:
1034: * A ``str`` or ``pathlib.Path``: Path to a PEM-encoded certificate authority
1035: file. This is useful for testing with self-signed certificates.
1036:
1037: * A special ``'insecure_skip_verify'`` string: Dangerously disable all
1038: TLS certificate verification (do *NOT* use in production environments).
1039:
1040: **Positional constructor arguments for the Sender(..)**
1041:
1042: * ``host``: Hostname or IP address of the QuestDB server.
1043:
1044: * ``port``: Port number of the QuestDB server.
1045:
1046:
1047: **Keyword-only constructor arguments for the Sender(..)**
1048:
1049: * ``interface`` (``str``): Network interface to bind to.
1050: Set this if you have an accelerated network interface (e.g. Solarflare)
1051: and want to use it.
1052:
1053: * ``auth`` (``tuple``): Authentication tuple or ``None`` (default).
1054: *See above for details*.
1055:
1056: * ``tls`` (``bool``, ``pathlib.Path`` or ``str``): TLS configuration or
1057: ``False`` (default). *See above for details*.
1058:
1059: * ``read_timeout`` (``int``): How long to wait for messages from the QuestDB server
1060: during the TLS handshake or authentication process.
1061: This field is expressed in milliseconds. The default is 15 seconds.
1062:
1063: * ``init_capacity`` (``int``): Initial buffer capacity of the internal buffer.
1064: *Default: 65536 (64KiB).*
1065: *See Buffer's constructor for more details.*
1066:
1067: * ``max_name_length`` (``int``): Maximum length of a table or column name.
1068: *See Buffer's constructor for more details.*
1069:
1070: * ``auto_flush`` (``bool`` or ``int``): Whether to automatically flush the
1071: buffer when it reaches a certain byte-size watermark.
1072: *Default: 64512 (63KiB).*
1073: *See above for details.*
1074: """
1075:
1076: # We need the Buffer held by a Sender can hold a weakref to its Sender.
1077: # This avoids a circular reference that requires the GC to clean up.
1078: cdef object __weakref__
1079:
1080: cdef line_sender_opts* _opts
1081: cdef line_sender* _impl
1082: cdef Buffer _buffer
1083: cdef bint _auto_flush_enabled
1084: cdef ssize_t _auto_flush_watermark
1085: cdef size_t _init_capacity
1086: cdef size_t _max_name_len
1087:
+1088: def __cinit__(
/* Python wrapper */ static int __pyx_pw_7questdb_7ingress_6Sender_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7questdb_7ingress_6Sender_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_host = 0; PyObject *__pyx_v_port = 0; PyObject *__pyx_v_interface = 0; PyObject *__pyx_v_auth = 0; PyObject *__pyx_v_tls = 0; uint64_t __pyx_v_read_timeout; uint64_t __pyx_v_init_capacity; uint64_t __pyx_v_max_name_len; PyObject *__pyx_v_auto_flush = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_host,&__pyx_n_s_port,&__pyx_n_s_interface,&__pyx_n_s_auth,&__pyx_n_s_tls,&__pyx_n_s_read_timeout,&__pyx_n_s_init_capacity,&__pyx_n_s_max_name_len,&__pyx_n_s_auto_flush,0}; PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_7questdb_7ingress_6Sender___cinit__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, PyObject *__pyx_v_host, PyObject *__pyx_v_port, PyObject *__pyx_v_interface, PyObject *__pyx_v_auth, PyObject *__pyx_v_tls, uint64_t __pyx_v_read_timeout, uint64_t __pyx_v_init_capacity, uint64_t __pyx_v_max_name_len, PyObject *__pyx_v_auto_flush) { CYTHON_UNUSED struct line_sender_error *__pyx_v_err; struct line_sender_utf8 __pyx_v_host_utf8; CYTHON_UNUSED PyObject *__pyx_v_host_owner = 0; PyObject *__pyx_v_port_str = 0; struct line_sender_utf8 __pyx_v_port_utf8; CYTHON_UNUSED PyObject *__pyx_v_port_owner = 0; struct line_sender_utf8 __pyx_v_interface_utf8; CYTHON_UNUSED PyObject *__pyx_v_interface_owner = 0; PyObject *__pyx_v_a_key_id = 0; CYTHON_UNUSED PyObject *__pyx_v_a_key_id_owner = 0; struct line_sender_utf8 __pyx_v_a_key_id_utf8; PyObject *__pyx_v_a_priv_key = 0; CYTHON_UNUSED PyObject *__pyx_v_a_priv_key_owner = 0; struct line_sender_utf8 __pyx_v_a_priv_key_utf8; PyObject *__pyx_v_a_pub_key_x = 0; CYTHON_UNUSED PyObject *__pyx_v_a_pub_key_x_owner = 0; struct line_sender_utf8 __pyx_v_a_pub_key_x_utf8; PyObject *__pyx_v_a_pub_key_y = 0; CYTHON_UNUSED PyObject *__pyx_v_a_pub_key_y_owner = 0; struct line_sender_utf8 __pyx_v_a_pub_key_y_utf8; CYTHON_UNUSED PyObject *__pyx_v_ca_owner = 0; struct line_sender_utf8 __pyx_v_ca_utf8; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); __Pyx_INCREF(__pyx_v_tls); /* … */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("questdb.ingress.Sender.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_host_owner); __Pyx_XDECREF(__pyx_v_port_str); __Pyx_XDECREF(__pyx_v_port_owner); __Pyx_XDECREF(__pyx_v_interface_owner); __Pyx_XDECREF(__pyx_v_a_key_id); __Pyx_XDECREF(__pyx_v_a_key_id_owner); __Pyx_XDECREF(__pyx_v_a_priv_key); __Pyx_XDECREF(__pyx_v_a_priv_key_owner); __Pyx_XDECREF(__pyx_v_a_pub_key_x); __Pyx_XDECREF(__pyx_v_a_pub_key_x_owner); __Pyx_XDECREF(__pyx_v_a_pub_key_y); __Pyx_XDECREF(__pyx_v_a_pub_key_y_owner); __Pyx_XDECREF(__pyx_v_ca_owner); __Pyx_XDECREF(__pyx_v_tls); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1089: self,
1090: str host,
1091: object port,
1092: *,
+1093: str interface=None,
values[2] = ((PyObject*)Py_None);
+1094: tuple auth=None,
values[3] = ((PyObject*)Py_None);
+1095: object tls=False,
values[4] = ((PyObject *)Py_False); values[8] = ((PyObject *)__pyx_int_64512); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_port)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 1088, __pyx_L3_error) } } if (kw_args > 0 && likely(kw_args <= 7)) { Py_ssize_t index; for (index = 2; index < 9 && kw_args > 0; index++) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]); if (value) { values[index] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 1088, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_host = ((PyObject*)values[0]); __pyx_v_port = values[1]; __pyx_v_interface = ((PyObject*)values[2]); __pyx_v_auth = ((PyObject*)values[3]); __pyx_v_tls = values[4]; if (values[5]) { __pyx_v_read_timeout = __Pyx_PyInt_As_uint64_t(values[5]); if (unlikely((__pyx_v_read_timeout == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1096, __pyx_L3_error) } else { __pyx_v_read_timeout = ((uint64_t)0x3A98); } if (values[6]) { __pyx_v_init_capacity = __Pyx_PyInt_As_uint64_t(values[6]); if (unlikely((__pyx_v_init_capacity == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1097, __pyx_L3_error) } else { __pyx_v_init_capacity = ((uint64_t)0x10000); } if (values[7]) { __pyx_v_max_name_len = __Pyx_PyInt_As_uint64_t(values[7]); if (unlikely((__pyx_v_max_name_len == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1098, __pyx_L3_error) } else { __pyx_v_max_name_len = ((uint64_t)0x7F); } __pyx_v_auto_flush = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1088, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.Sender.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_host), (&PyUnicode_Type), 1, "host", 1))) __PYX_ERR(0, 1090, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interface), (&PyUnicode_Type), 1, "interface", 1))) __PYX_ERR(0, 1093, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_auth), (&PyTuple_Type), 1, "auth", 1))) __PYX_ERR(0, 1094, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender___cinit__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_host, __pyx_v_port, __pyx_v_interface, __pyx_v_auth, __pyx_v_tls, __pyx_v_read_timeout, __pyx_v_init_capacity, __pyx_v_max_name_len, __pyx_v_auto_flush);
1096: uint64_t read_timeout=15000,
1097: uint64_t init_capacity=65536, # 64KiB
1098: uint64_t max_name_len=127,
1099: object auto_flush=64512): # 63KiB
+1100: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
1101:
1102: cdef line_sender_utf8 host_utf8
1103: cdef bytes host_owner
1104:
1105: cdef str port_str
1106: cdef line_sender_utf8 port_utf8
1107: cdef bytes port_owner
1108:
1109: cdef str interface_str
1110: cdef line_sender_utf8 interface_utf8
1111: cdef bytes interface_owner
1112:
1113: cdef str a_key_id
1114: cdef bytes a_key_id_owner
1115: cdef line_sender_utf8 a_key_id_utf8
1116:
1117: cdef str a_priv_key
1118: cdef bytes a_priv_key_owner
1119: cdef line_sender_utf8 a_priv_key_utf8
1120:
1121: cdef str a_pub_key_x
1122: cdef bytes a_pub_key_x_owner
1123: cdef line_sender_utf8 a_pub_key_x_utf8
1124:
1125: cdef str a_pub_key_y
1126: cdef bytes a_pub_key_y_owner
1127: cdef line_sender_utf8 a_pub_key_y_utf8
1128:
1129: cdef bytes ca_owner
1130: cdef line_sender_utf8 ca_utf8
1131:
+1132: self._opts = NULL
__pyx_v_self->_opts = NULL;
+1133: self._impl = NULL
__pyx_v_self->_impl = NULL;
+1134: self._buffer = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_buffer); __Pyx_DECREF(((PyObject *)__pyx_v_self->_buffer)); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None);
1135:
+1136: if PyInt_Check(port):
__pyx_t_1 = (PyInt_Check(__pyx_v_port) != 0);
if (__pyx_t_1) {
/* … */
goto __pyx_L3;
}
+1137: port_str = str(port)
__pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_port); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_port_str = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+1138: elif PyUnicode_Check(port):
__pyx_t_1 = (PyUnicode_Check(__pyx_v_port) != 0);
if (likely(__pyx_t_1)) {
/* … */
goto __pyx_L3;
}
+1139: port_str = port
if (!(likely(PyUnicode_CheckExact(__pyx_v_port))||((__pyx_v_port) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_port)->tp_name), 0))) __PYX_ERR(0, 1139, __pyx_L1_error) __pyx_t_2 = __pyx_v_port; __Pyx_INCREF(__pyx_t_2); __pyx_v_port_str = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
1140: else:
+1141: raise TypeError(
/*else*/ { /* … */ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1141, __pyx_L1_error) } __pyx_L3:;
+1142: f'port must be an integer or a string, not {type(port)}')
__pyx_t_2 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_port)), __pyx_empty_unicode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyUnicode_Concat(__pyx_kp_u_port_must_be_an_integer_or_a_str, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1143:
+1144: host_owner = str_to_utf8(host, &host_utf8)
__pyx_t_2 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_host, (&__pyx_v_host_utf8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_host_owner = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+1145: port_owner = str_to_utf8(port_str, &port_utf8)
__pyx_t_2 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_port_str, (&__pyx_v_port_utf8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_port_owner = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+1146: self._opts = line_sender_opts_new_service(host_utf8, port_utf8)
__pyx_v_self->_opts = line_sender_opts_new_service(__pyx_v_host_utf8, __pyx_v_port_utf8);
1147:
+1148: if interface is not None:
__pyx_t_1 = (__pyx_v_interface != ((PyObject*)Py_None)); __pyx_t_4 = (__pyx_t_1 != 0); if (__pyx_t_4) { /* … */ }
+1149: interface_owner = str_to_utf8(interface, &interface_utf8)
__pyx_t_2 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_interface, (&__pyx_v_interface_utf8)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_interface_owner = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0;
+1150: line_sender_opts_net_interface(self._opts, interface_utf8)
line_sender_opts_net_interface(__pyx_v_self->_opts, __pyx_v_interface_utf8);
1151:
+1152: if auth is not None:
__pyx_t_4 = (__pyx_v_auth != ((PyObject*)Py_None)); __pyx_t_1 = (__pyx_t_4 != 0); if (__pyx_t_1) { /* … */ }
+1153: (a_key_id,
if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1153, __pyx_L1_error) if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 1153, __pyx_L1_error) if (!(likely(PyUnicode_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(0, 1153, __pyx_L1_error) if (!(likely(PyUnicode_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 1153, __pyx_L1_error) __pyx_v_a_key_id = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __pyx_v_a_priv_key = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; __pyx_v_a_pub_key_x = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; __pyx_v_a_pub_key_y = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
1154: a_priv_key,
1155: a_pub_key_x,
+1156: a_pub_key_y) = auth
if (likely(__pyx_v_auth != Py_None)) { PyObject* sequence = __pyx_v_auth; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 4)) { if (size > 4) __Pyx_RaiseTooManyValuesError(4); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 1153, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else { Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_5,&__pyx_t_6}; for (i=0; i < 4; i++) { PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1153, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } } #endif } else { __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1153, __pyx_L1_error) }
+1157: a_key_id_owner = str_to_utf8(a_key_id, &a_key_id_utf8)
__pyx_t_6 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_a_key_id, (&__pyx_v_a_key_id_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_key_id_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1158: a_priv_key_owner = str_to_utf8(a_priv_key, &a_priv_key_utf8)
__pyx_t_6 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_a_priv_key, (&__pyx_v_a_priv_key_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_priv_key_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1159: a_pub_key_x_owner = str_to_utf8(a_pub_key_x, &a_pub_key_x_utf8)
__pyx_t_6 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_a_pub_key_x, (&__pyx_v_a_pub_key_x_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_pub_key_x_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1160: a_pub_key_y_owner = str_to_utf8(a_pub_key_y, &a_pub_key_y_utf8)
__pyx_t_6 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_a_pub_key_y, (&__pyx_v_a_pub_key_y_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_pub_key_y_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1161: line_sender_opts_auth(
line_sender_opts_auth(__pyx_v_self->_opts, __pyx_v_a_key_id_utf8, __pyx_v_a_priv_key_utf8, __pyx_v_a_pub_key_x_utf8, __pyx_v_a_pub_key_y_utf8);
1162: self._opts,
1163: a_key_id_utf8,
1164: a_priv_key_utf8,
1165: a_pub_key_x_utf8,
1166: a_pub_key_y_utf8)
1167:
+1168: if tls:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_tls); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1168, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+1169: if tls is True:
__pyx_t_1 = (__pyx_v_tls == Py_True); __pyx_t_4 = (__pyx_t_1 != 0); if (__pyx_t_4) { /* … */ goto __pyx_L7; }
+1170: line_sender_opts_tls(self._opts)
line_sender_opts_tls(__pyx_v_self->_opts);
+1171: elif isinstance(tls, str):
__pyx_t_4 = PyUnicode_Check(__pyx_v_tls);
__pyx_t_1 = (__pyx_t_4 != 0);
if (__pyx_t_1) {
/* … */
goto __pyx_L7;
}
+1172: if tls == 'insecure_skip_verify':
__pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_tls, __pyx_n_u_insecure_skip_verify, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1172, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L8; }
+1173: line_sender_opts_tls_insecure_skip_verify(self._opts)
line_sender_opts_tls_insecure_skip_verify(__pyx_v_self->_opts);
1174: else:
+1175: ca_owner = str_to_utf8(tls, &ca_utf8)
/*else*/ { if (!(likely(PyUnicode_CheckExact(__pyx_v_tls))||((__pyx_v_tls) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_tls)->tp_name), 0))) __PYX_ERR(0, 1175, __pyx_L1_error) __pyx_t_6 = __pyx_f_7questdb_7ingress_str_to_utf8(((PyObject*)__pyx_v_tls), (&__pyx_v_ca_utf8)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_ca_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1176: line_sender_opts_tls_ca(self._opts, ca_utf8)
line_sender_opts_tls_ca(__pyx_v_self->_opts, __pyx_v_ca_utf8); } __pyx_L8:;
+1177: elif isinstance(tls, pathlib.Path):
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pathlib); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_1 = PyObject_IsInstance(__pyx_v_tls, __pyx_t_5); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1177, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = (__pyx_t_1 != 0); if (likely(__pyx_t_4)) { /* … */ goto __pyx_L7; }
+1178: tls = str(tls)
__pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_tls); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF_SET(__pyx_v_tls, __pyx_t_5); __pyx_t_5 = 0;
+1179: ca_owner = str_to_utf8(tls, &ca_utf8)
if (!(likely(PyUnicode_CheckExact(__pyx_v_tls))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_v_tls)->tp_name), 0))) __PYX_ERR(0, 1179, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_7ingress_str_to_utf8(((PyObject*)__pyx_v_tls), (&__pyx_v_ca_utf8)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_ca_owner = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0;
+1180: line_sender_opts_tls_ca(self._opts, ca_utf8)
line_sender_opts_tls_ca(__pyx_v_self->_opts, __pyx_v_ca_utf8);
1181: else:
+1182: raise TypeError(
/*else*/ { /* … */ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 1182, __pyx_L1_error) } __pyx_L7:;
+1183: 'tls must be a bool, a path or string pointing to CA file '
__pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_tls_must_be_a_bool_a_path_or_str, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+1184: f'or "insecure_skip_verify", not {type(tls)}')
__pyx_t_5 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_tls)), __pyx_empty_unicode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5);
1185:
+1186: if read_timeout is not None:
__pyx_t_5 = __Pyx_PyInt_From_uint64_t(__pyx_v_read_timeout); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1186, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = (__pyx_t_5 != Py_None); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = (__pyx_t_4 != 0); if (__pyx_t_1) { /* … */ }
+1187: line_sender_opts_read_timeout(self._opts, read_timeout)
line_sender_opts_read_timeout(__pyx_v_self->_opts, __pyx_v_read_timeout);
1188:
+1189: self._init_capacity = init_capacity
__pyx_v_self->_init_capacity = __pyx_v_init_capacity;
+1190: self._max_name_len = max_name_len
__pyx_v_self->_max_name_len = __pyx_v_max_name_len;
1191:
+1192: self._buffer = Buffer(
__pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer), __pyx_empty_tuple, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GIVEREF(__pyx_t_6); __Pyx_GOTREF(__pyx_v_self->_buffer); __Pyx_DECREF(((PyObject *)__pyx_v_self->_buffer)); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)__pyx_t_6); __pyx_t_6 = 0;
+1193: init_capacity=init_capacity,
__pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_uint64_t(__pyx_v_init_capacity); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_init_capacity, __pyx_t_6) < 0) __PYX_ERR(0, 1193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1194: max_name_len=max_name_len)
__pyx_t_6 = __Pyx_PyInt_From_uint64_t(__pyx_v_max_name_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_max_name_len, __pyx_t_6) < 0) __PYX_ERR(0, 1193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1195:
+1196: self._auto_flush_enabled = not not auto_flush
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_auto_flush); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1196, __pyx_L1_error) __pyx_v_self->_auto_flush_enabled = (!((!__pyx_t_1) != 0));
+1197: self._auto_flush_watermark = int(auto_flush) \
__pyx_t_6 = __Pyx_PyNumber_Int(__pyx_v_auto_flush); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = PyInt_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1197, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = __pyx_t_8; } else { __pyx_t_7 = 0; } __pyx_v_self->_auto_flush_watermark = __pyx_t_7;
+1198: if self._auto_flush_enabled else 0
if ((__pyx_v_self->_auto_flush_enabled != 0)) {
+1199: if self._auto_flush_watermark < 0:
__pyx_t_1 = ((__pyx_v_self->_auto_flush_watermark < 0) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+1200: raise ValueError(
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 1200, __pyx_L1_error)
+1201: 'auto_flush_watermark must be >= 0, '
__pyx_t_5 = __Pyx_PyUnicode_Concat(__pyx_kp_u_auto_flush_watermark_must_be_0_n, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1202: f'not {self._auto_flush_watermark}')
__pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_self->_auto_flush_watermark, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6);
1203:
+1204: def new_buffer(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_3new_buffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Sender_2new_buffer[] = "\n Make a new configured buffer.\n\n The buffer is set up with the configured `init_capacity` and\n `max_name_len`.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_3new_buffer = {"new_buffer", (PyCFunction)__pyx_pw_7questdb_7ingress_6Sender_3new_buffer, METH_NOARGS, __pyx_doc_7questdb_7ingress_6Sender_2new_buffer}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_3new_buffer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_buffer (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_2new_buffer(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_2new_buffer(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("new_buffer", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Sender.new_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 1204, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__46); __Pyx_GIVEREF(__pyx_tuple__46); /* … */ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_3new_buffer, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_new_buffer, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Sender->tp_dict, __pyx_n_s_new_buffer, __pyx_t_4) < 0) __PYX_ERR(0, 1204, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_new_buffer, 1204, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 1204, __pyx_L1_error)
1205: """
1206: Make a new configured buffer.
1207:
1208: The buffer is set up with the configured `init_capacity` and
1209: `max_name_len`.
1210: """
+1211: return Buffer(
__Pyx_XDECREF(__pyx_r); /* … */ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7questdb_7ingress_Buffer), __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+1212: init_capacity=self._init_capacity,
__pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_init_capacity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_init_capacity, __pyx_t_2) < 0) __PYX_ERR(0, 1212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1213: max_name_len=self._max_name_len)
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_max_name_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_max_name_len, __pyx_t_2) < 0) __PYX_ERR(0, 1212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1214:
1215: @property
+1216: def init_capacity(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_13init_capacity_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_13init_capacity_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_13init_capacity___get__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_13init_capacity___get__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.init_capacity.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1217: """The initial capacity of the sender's internal buffer."""
+1218: return self._init_capacity
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_init_capacity); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1218, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
1219:
1220: @property
+1221: def max_name_len(self) -> int:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_12max_name_len_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_12max_name_len_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_12max_name_len___get__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_12max_name_len___get__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.max_name_len.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1222: """Maximum length of a table or column name."""
+1223: return self._max_name_len
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->_max_name_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
1224:
+1225: def connect(self):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Sender_4connect[] = "\n Connect to the QuestDB server.\n\n This method is synchronous and will block until the connection is\n established.\n\n If the connection is set up with authentication and/or TLS, this\n method will return only *after* the handshake(s) is/are complete.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_5connect = {"connect", (PyCFunction)__pyx_pw_7questdb_7ingress_6Sender_5connect, METH_NOARGS, __pyx_doc_7questdb_7ingress_6Sender_4connect}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_5connect(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("connect (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_4connect(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_4connect(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { struct line_sender_error *__pyx_v_err; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("connect", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ingress.Sender.connect", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__48 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_err); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 1225, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__48); __Pyx_GIVEREF(__pyx_tuple__48); /* … */ __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_5connect, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_connect, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Sender->tp_dict, __pyx_n_s_connect, __pyx_t_4) < 0) __PYX_ERR(0, 1225, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_connect, 1225, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 1225, __pyx_L1_error)
1226: """
1227: Connect to the QuestDB server.
1228:
1229: This method is synchronous and will block until the connection is
1230: established.
1231:
1232: If the connection is set up with authentication and/or TLS, this
1233: method will return only *after* the handshake(s) is/are complete.
1234: """
+1235: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+1236: if self._opts == NULL:
__pyx_t_1 = ((__pyx_v_self->_opts == NULL) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+1237: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+1238: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_connect_can_t_be_called_after_cl}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1237, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_kp_u_connect_can_t_be_called_after_cl}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1237, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_kp_u_connect_can_t_be_called_after_cl); __Pyx_GIVEREF(__pyx_kp_u_connect_can_t_be_called_after_cl); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_kp_u_connect_can_t_be_called_after_cl); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1237, __pyx_L1_error)
1239: 'connect() can\'t be called after close().')
+1240: self._impl = line_sender_connect(self._opts, &err)
__pyx_v_self->_impl = line_sender_connect(__pyx_v_self->_opts, (&__pyx_v_err));
+1241: if self._impl == NULL:
__pyx_t_1 = ((__pyx_v_self->_impl == NULL) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+1242: raise c_err_to_py(err)
__pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1242, __pyx_L1_error)
+1243: line_sender_opts_free(self._opts)
line_sender_opts_free(__pyx_v_self->_opts);
+1244: self._opts = NULL
__pyx_v_self->_opts = NULL;
1245:
1246: # Request callbacks when rows are complete.
+1247: if self._buffer is not None:
__pyx_t_1 = (((PyObject *)__pyx_v_self->_buffer) != Py_None); __pyx_t_8 = (__pyx_t_1 != 0); if (__pyx_t_8) { /* … */ }
+1248: self._buffer._row_complete_sender = PyWeakref_NewRef(self, None)
__pyx_t_2 = PyWeakref_NewRef(((PyObject *)__pyx_v_self), Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->_buffer->_row_complete_sender); __Pyx_DECREF(__pyx_v_self->_buffer->_row_complete_sender); __pyx_v_self->_buffer->_row_complete_sender = __pyx_t_2; __pyx_t_2 = 0;
1249:
+1250: def __enter__(self) -> Sender:
/* Python wrapper */ static struct __pyx_obj_7questdb_7ingress_Sender *__pyx_pw_7questdb_7ingress_6Sender_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Sender_6__enter__[] = "Call :func:`Sender.connect` at the start of a ``with`` block."; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_7__enter__ = {"__enter__", (PyCFunction)__pyx_pw_7questdb_7ingress_6Sender_7__enter__, METH_NOARGS, __pyx_doc_7questdb_7ingress_6Sender_6__enter__}; static struct __pyx_obj_7questdb_7ingress_Sender *__pyx_pw_7questdb_7ingress_6Sender_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { struct __pyx_obj_7questdb_7ingress_Sender *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_6__enter__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_obj_7questdb_7ingress_Sender *__pyx_pf_7questdb_7ingress_6Sender_6__enter__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { struct __pyx_obj_7questdb_7ingress_Sender *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("questdb.ingress.Sender.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 1250, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__50); __Pyx_GIVEREF(__pyx_tuple__50); /* … */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_n_u_Sender) < 0) __PYX_ERR(0, 1250, __pyx_L1_error) __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_7__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender___enter, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Sender->tp_dict, __pyx_n_s_enter, __pyx_t_2) < 0) __PYX_ERR(0, 1250, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_enter, 1250, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 1250, __pyx_L1_error)
1251: """Call :func:`Sender.connect` at the start of a ``with`` block."""
+1252: self.connect()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_connect); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+1253: return self
__Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = __pyx_v_self; goto __pyx_L0;
1254:
+1255: def __str__(self) -> str:
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_9__str__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Sender_8__str__[] = "\n Inspect the contents of the internal buffer.\n\n The ``str`` value returned represents the unsent data.\n\n Also see :func:`Sender.__len__`.\n "; #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_7questdb_7ingress_6Sender_8__str__; #endif static PyObject *__pyx_pw_7questdb_7ingress_6Sender_9__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_8__str__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_8__str__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
1256: """
1257: Inspect the contents of the internal buffer.
1258:
1259: The ``str`` value returned represents the unsent data.
1260:
1261: Also see :func:`Sender.__len__`.
1262: """
+1263: return str(self._buffer)
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), ((PyObject *)__pyx_v_self->_buffer)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
1264:
+1265: def __len__(self) -> int:
/* Python wrapper */ static Py_ssize_t __pyx_pw_7questdb_7ingress_6Sender_11__len__(PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Sender_10__len__[] = "\n Number of bytes of unsent data in the internal buffer.\n\n Equivalent (but cheaper) to ``len(str(sender))``.\n "; #if CYTHON_UPDATE_DESCRIPTOR_DOC struct wrapperbase __pyx_wrapperbase_7questdb_7ingress_6Sender_10__len__; #endif static Py_ssize_t __pyx_pw_7questdb_7ingress_6Sender_11__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_10__len__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_pf_7questdb_7ingress_6Sender_10__len__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
1266: """
1267: Number of bytes of unsent data in the internal buffer.
1268:
1269: Equivalent (but cheaper) to ``len(str(sender))``.
1270: """
+1271: return len(self._buffer)
__pyx_t_1 = ((PyObject *)__pyx_v_self->_buffer); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1271, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0;
1272:
+1273: def row(self,
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_13row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Sender_12row[] = "\n Write a row to the internal buffer.\n\n This may be sent automatically depending on the ``auto_flush`` setting\n in the constructor.\n\n Refer to the :func:`Buffer.row` documentation for details on arguments.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_13row = {"row", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_13row, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_12row}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_13row(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_table_name = 0; PyObject *__pyx_v_symbols = 0; PyObject *__pyx_v_columns = 0; PyObject *__pyx_v_at = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_table_name,&__pyx_n_s_symbols,&__pyx_n_s_columns,&__pyx_n_s_at,0}; PyObject* values[4] = {0,0,0,0}; /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_12row(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, PyObject *__pyx_v_table_name, PyObject *__pyx_v_symbols, PyObject *__pyx_v_columns, PyObject *__pyx_v_at) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("row", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("questdb.ingress.Sender.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__52 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_table_name, __pyx_n_s_symbols, __pyx_n_s_columns, __pyx_n_s_at); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 1273, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__52); __Pyx_GIVEREF(__pyx_tuple__52); /* … */ __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_table_name, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1273, __pyx_L1_error) /* … */ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_13row, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_row, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Sender->tp_dict, __pyx_n_s_row, __pyx_t_3) < 0) __PYX_ERR(0, 1273, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 3, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_row, 1273, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 1273, __pyx_L1_error)
1274: table_name: str,
1275: *,
+1276: symbols: Optional[Dict[str, str]]=None,
values[1] = ((PyObject *)Py_None); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Optional); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)(&PyUnicode_Type))); __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_symbols, __pyx_t_3) < 0) __PYX_ERR(0, 1273, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1277: columns: Optional[Dict[
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Optional); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); /* … */ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_columns, __pyx_t_6) < 0) __PYX_ERR(0, 1273, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1278: str,
+1279: Union[bool, int, float, str, TimestampMicros, datetime]]]=None,
values[2] = ((PyObject *)Py_None); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Union); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_4bool_bool)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_4bool_bool)); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)); __Pyx_INCREF(((PyObject *)(&PyInt_Type))); __Pyx_GIVEREF(((PyObject *)(&PyInt_Type))); PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)(&PyInt_Type))); __Pyx_INCREF(((PyObject *)(&PyFloat_Type))); __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type))); PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)(&PyFloat_Type))); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_6, 3, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros)); PyTuple_SET_ITEM(__pyx_t_6, 4, ((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampMicros)); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); PyTuple_SET_ITEM(__pyx_t_6, 5, ((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1280: at: Union[None, TimestampNanos, datetime]=None):
values[3] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_table_name)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; } if (kw_args > 0 && likely(kw_args <= 3)) { Py_ssize_t index; for (index = 1; index < 4 && kw_args > 0; index++) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, *__pyx_pyargnames[index]); if (value) { values[index] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "row") < 0)) __PYX_ERR(0, 1273, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_table_name = ((PyObject*)values[0]); __pyx_v_symbols = values[1]; __pyx_v_columns = values[2]; __pyx_v_at = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("row", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1273, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.Sender.row", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_table_name), (&PyUnicode_Type), 1, "table_name", 1))) __PYX_ERR(0, 1274, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_12row(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_table_name, __pyx_v_symbols, __pyx_v_columns, __pyx_v_at); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Union); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_1, 0, Py_None); __Pyx_INCREF(((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_ptype_7questdb_7ingress_TimestampNanos)); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_ptype_7cpython_8datetime_datetime)); __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_at, __pyx_t_3) < 0) __PYX_ERR(0, 1273, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1281: """
1282: Write a row to the internal buffer.
1283:
1284: This may be sent automatically depending on the ``auto_flush`` setting
1285: in the constructor.
1286:
1287: Refer to the :func:`Buffer.row` documentation for details on arguments.
1288: """
+1289: self._buffer.row(table_name, symbols=symbols, columns=columns, at=at)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->_buffer), __pyx_n_s_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_table_name); __Pyx_GIVEREF(__pyx_v_table_name); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_table_name); __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_symbols, __pyx_v_symbols) < 0) __PYX_ERR(0, 1289, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_columns, __pyx_v_columns) < 0) __PYX_ERR(0, 1289, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_at, __pyx_v_at) < 0) __PYX_ERR(0, 1289, __pyx_L1_error) __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1290:
+1291: cpdef flush(self, Buffer buffer=None, bint clear=True):
static PyObject *__pyx_pw_7questdb_7ingress_6Sender_15flush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7questdb_7ingress_6Sender_flush(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_7ingress_6Sender_flush *__pyx_optional_args) { struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None); int __pyx_v_clear = ((int)1); struct line_sender_error *__pyx_v_err; struct line_sender_buffer *__pyx_v_c_buf; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flush", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_buffer = __pyx_optional_args->buffer; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_clear = __pyx_optional_args->clear; } } } /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_flush); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7questdb_7ingress_6Sender_15flush)) { __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_clear); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_buffer), __pyx_t_3}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_buffer), __pyx_t_3}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(((PyObject *)__pyx_v_buffer)); __Pyx_GIVEREF(((PyObject *)__pyx_v_buffer)); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_buffer)); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("questdb.ingress.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_15flush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Sender_14flush[] = "\n If called with no arguments, immediately flushes the internal buffer.\n\n Alternatively you can flush a buffer that was constructed explicitly\n by passing ``buffer``.\n\n The buffer will be cleared by default, unless ``clear`` is set to\n ``False``.\n\n This method does nothing if the provided or internal buffer is empty.\n\n :param buffer: The buffer to flush. If ``None``, the internal buffer\n is flushed.\n\n :param clear: If ``True``, the flushed buffer is cleared (default).\n If ``False``, the flushed buffer is left in the internal buffer.\n Note that ``clear=False`` is only supported if ``buffer`` is also\n specified.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_15flush = {"flush", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_15flush, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_14flush}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_15flush(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_buffer = 0; int __pyx_v_clear; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flush (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buffer,&__pyx_n_s_clear,0}; PyObject* values[2] = {0,0}; values[0] = (PyObject *)((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer); if (value) { values[0] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clear); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "flush") < 0)) __PYX_ERR(0, 1291, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)values[0]); if (values[1]) { __pyx_v_clear = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_clear == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1291, __pyx_L3_error) } else { __pyx_v_clear = ((int)1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("flush", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1291, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buffer), __pyx_ptype_7questdb_7ingress_Buffer, 1, "buffer", 0))) __PYX_ERR(0, 1291, __pyx_L1_error) __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_14flush(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_buffer, __pyx_v_clear); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_14flush(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, struct __pyx_obj_7questdb_7ingress_Buffer *__pyx_v_buffer, int __pyx_v_clear) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flush", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 2; __pyx_t_2.buffer = __pyx_v_buffer; __pyx_t_2.clear = __pyx_v_clear; __pyx_t_1 = __pyx_vtabptr_7questdb_7ingress_Sender->flush(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__54 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_buffer, __pyx_n_s_clear); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__54); __Pyx_GIVEREF(__pyx_tuple__54); /* … */ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_15flush, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_flush, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Sender->tp_dict, __pyx_n_s_flush, __pyx_t_3) < 0) __PYX_ERR(0, 1291, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_flush, 1291, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 1291, __pyx_L1_error) /* … */ struct __pyx_opt_args_7questdb_7ingress_6Sender_flush { int __pyx_n; struct __pyx_obj_7questdb_7ingress_Buffer *buffer; int clear; };
1292: """
1293: If called with no arguments, immediately flushes the internal buffer.
1294:
1295: Alternatively you can flush a buffer that was constructed explicitly
1296: by passing ``buffer``.
1297:
1298: The buffer will be cleared by default, unless ``clear`` is set to
1299: ``False``.
1300:
1301: This method does nothing if the provided or internal buffer is empty.
1302:
1303: :param buffer: The buffer to flush. If ``None``, the internal buffer
1304: is flushed.
1305:
1306: :param clear: If ``True``, the flushed buffer is cleared (default).
1307: If ``False``, the flushed buffer is left in the internal buffer.
1308: Note that ``clear=False`` is only supported if ``buffer`` is also
1309: specified.
1310: """
+1311: if buffer is None and not clear:
__pyx_t_9 = (((PyObject *)__pyx_v_buffer) == Py_None); __pyx_t_10 = (__pyx_t_9 != 0); if (__pyx_t_10) { } else { __pyx_t_8 = __pyx_t_10; goto __pyx_L4_bool_binop_done; } __pyx_t_10 = ((!(__pyx_v_clear != 0)) != 0); __pyx_t_8 = __pyx_t_10; __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_8)) { /* … */ }
+1312: raise ValueError('The internal buffer must always be cleared.')
__pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1312, __pyx_L1_error) /* … */ __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_u_The_internal_buffer_must_always); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 1312, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13);
1313:
+1314: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+1315: cdef line_sender_buffer* c_buf = NULL
__pyx_v_c_buf = NULL;
+1316: if self._impl == NULL:
__pyx_t_8 = ((__pyx_v_self->_impl == NULL) != 0); if (unlikely(__pyx_t_8)) { /* … */ }
+1317: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+1318: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1318, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_kp_u_flush_can_t_be_called_Not_connec}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_kp_u_flush_can_t_be_called_Not_connec}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_kp_u_flush_can_t_be_called_Not_connec); __Pyx_GIVEREF(__pyx_kp_u_flush_can_t_be_called_Not_connec); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_kp_u_flush_can_t_be_called_Not_connec); __pyx_t_7 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1317, __pyx_L1_error)
1319: 'flush() can\'t be called: Not connected.')
+1320: if buffer is not None:
__pyx_t_8 = (((PyObject *)__pyx_v_buffer) != Py_None); __pyx_t_10 = (__pyx_t_8 != 0); if (__pyx_t_10) { /* … */ goto __pyx_L7; }
+1321: c_buf = buffer._impl
__pyx_t_11 = __pyx_v_buffer->_impl; __pyx_v_c_buf = __pyx_t_11;
1322: else:
+1323: c_buf = self._buffer._impl
/*else*/ { __pyx_t_11 = __pyx_v_self->_buffer->_impl; __pyx_v_c_buf = __pyx_t_11; } __pyx_L7:;
+1324: if line_sender_buffer_size(c_buf) == 0:
__pyx_t_10 = ((line_sender_buffer_size(__pyx_v_c_buf) == 0) != 0); if (__pyx_t_10) { /* … */ }
+1325: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
1326:
+1327: try:
{ /*try:*/ { /* … */ } __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; goto __pyx_L14_try_end; __pyx_L9_error:; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; /* … */ __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_13, __pyx_t_14); goto __pyx_L1_error; __pyx_L14_try_end:; }
+1328: if clear:
__pyx_t_10 = (__pyx_v_clear != 0); if (__pyx_t_10) { /* … */ goto __pyx_L15; }
+1329: if not line_sender_flush(self._impl, c_buf, &err):
__pyx_t_10 = ((!(line_sender_flush(__pyx_v_self->_impl, __pyx_v_c_buf, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_10)) { /* … */ }
+1330: raise c_err_to_py_fmt(err, _FLUSH_FMT)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FLUSH_FMT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1330, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 1330, __pyx_L9_error) __pyx_t_2 = __pyx_f_7questdb_7ingress_c_err_to_py_fmt(__pyx_v_err, ((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1330, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 1330, __pyx_L9_error)
1331: else:
+1332: if not line_sender_flush_and_keep(self._impl, c_buf, &err):
/*else*/ { __pyx_t_10 = ((!(line_sender_flush_and_keep(__pyx_v_self->_impl, __pyx_v_c_buf, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_10)) { /* … */ } } __pyx_L15:;
+1333: raise c_err_to_py_fmt(err, _FLUSH_FMT)
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_FLUSH_FMT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1333, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_2); if (!(likely(PyUnicode_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 1333, __pyx_L9_error) __pyx_t_1 = __pyx_f_7questdb_7ingress_c_err_to_py_fmt(__pyx_v_err, ((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1333, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 1333, __pyx_L9_error)
+1334: except:
/*except:*/ { __Pyx_AddTraceback("questdb.ingress.Sender.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 1334, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3);
1335: # Prevent a follow-up call to `.close(flush=True)` (as is usually
1336: # called from `__exit__`) to raise after the sender entered an error
1337: # state following a failed call to `.flush()`.
+1338: if c_buf == self._buffer._impl:
__pyx_t_10 = ((__pyx_v_c_buf == __pyx_v_self->_buffer->_impl) != 0); if (__pyx_t_10) { /* … */ }
+1339: line_sender_buffer_clear(c_buf)
line_sender_buffer_clear(__pyx_v_c_buf);
+1340: raise
__Pyx_GIVEREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ErrRestoreWithState(__pyx_t_1, __pyx_t_2, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __PYX_ERR(0, 1340, __pyx_L11_except_error) } __pyx_L11_except_error:;
1341:
+1342: cdef _close(self):
static PyObject *__pyx_f_7questdb_7ingress_6Sender__close(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_close", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+1343: self._buffer = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_buffer); __Pyx_DECREF(((PyObject *)__pyx_v_self->_buffer)); __pyx_v_self->_buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None);
+1344: line_sender_opts_free(self._opts)
line_sender_opts_free(__pyx_v_self->_opts);
+1345: self._opts = NULL
__pyx_v_self->_opts = NULL;
+1346: line_sender_close(self._impl)
line_sender_close(__pyx_v_self->_impl);
+1347: self._impl = NULL
__pyx_v_self->_impl = NULL;
1348:
+1349: cpdef close(self, bint flush=True):
static PyObject *__pyx_pw_7questdb_7ingress_6Sender_17close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7questdb_7ingress_6Sender_close(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_7questdb_7ingress_6Sender_close *__pyx_optional_args) { int __pyx_v_flush = ((int)1); PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_flush = __pyx_optional_args->flush; } } /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) { PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_7questdb_7ingress_6Sender_17close)) { __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_flush); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self)); __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) { __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS } #endif } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("questdb.ingress.Sender.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_17close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Sender_16close[] = "\n Disconnect.\n\n This method is idempotent and can be called repeatedly.\n\n Once a sender is closed, it can't be re-used.\n\n :param bool flush: If ``True``, flush the internal buffer before closing.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_17close = {"close", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_17close, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_16close}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_17close(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_flush; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_flush,0}; PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flush); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "close") < 0)) __PYX_ERR(0, 1349, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } if (values[0]) { __pyx_v_flush = __Pyx_PyObject_IsTrue(values[0]); if (unlikely((__pyx_v_flush == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1349, __pyx_L3_error) } else { __pyx_v_flush = ((int)1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("close", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1349, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.Sender.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_16close(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_flush); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_16close(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, int __pyx_v_flush) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("close", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.flush = __pyx_v_flush; __pyx_t_1 = __pyx_vtabptr_7questdb_7ingress_Sender->close(__pyx_v_self, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("questdb.ingress.Sender.close", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__56 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_flush); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 1349, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__56); __Pyx_GIVEREF(__pyx_tuple__56); /* … */ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_17close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender_close, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Sender->tp_dict, __pyx_n_s_close, __pyx_t_3) < 0) __PYX_ERR(0, 1349, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_close, 1349, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 1349, __pyx_L1_error) /* … */ struct __pyx_opt_args_7questdb_7ingress_6Sender_close { int __pyx_n; int flush; };
1350: """
1351: Disconnect.
1352:
1353: This method is idempotent and can be called repeatedly.
1354:
1355: Once a sender is closed, it can't be re-used.
1356:
1357: :param bool flush: If ``True``, flush the internal buffer before closing.
1358: """
+1359: try:
/*try:*/ {
+1360: if (flush and (self._impl != NULL) and
__pyx_t_7 = (__pyx_v_flush != 0); if (__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } __pyx_t_7 = ((__pyx_v_self->_impl != NULL) != 0); if (__pyx_t_7) { } else { __pyx_t_6 = __pyx_t_7; goto __pyx_L7_bool_binop_done; } /* … */ if (__pyx_t_6) { /* … */ } }
+1361: (not line_sender_must_close(self._impl))):
__pyx_t_7 = ((!(line_sender_must_close(__pyx_v_self->_impl) != 0)) != 0); __pyx_t_6 = __pyx_t_7; __pyx_L7_bool_binop_done:;
+1362: self.flush(None, True)
__pyx_t_8.__pyx_n = 2; __pyx_t_8.buffer = ((struct __pyx_obj_7questdb_7ingress_Buffer *)Py_None); __pyx_t_8.clear = 1; __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->flush(__pyx_v_self, 0, &__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1362, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1363: finally:
+1364: self._close()
/*finally:*/ { /*normal exit:*/{ __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L5; } __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __pyx_t_9 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename; { __pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1364, __pyx_L11_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14); __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_lineno = __pyx_t_9; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11; goto __pyx_L1_error; __pyx_L11_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17); } __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; goto __pyx_L1_error; } __pyx_L5:; }
1365:
+1366: def __exit__(self, exc_type, _exc_val, _exc_tb):
/* Python wrapper */ static PyObject *__pyx_pw_7questdb_7ingress_6Sender_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_7questdb_7ingress_6Sender_18__exit__[] = "\n Flush pending and disconnect at the end of a ``with`` block.\n\n If the ``with`` block raises an exception, any pending data will\n *NOT* be flushed.\n\n This is implemented by calling :func:`Sender.close`.\n "; static PyMethodDef __pyx_mdef_7questdb_7ingress_6Sender_19__exit__ = {"__exit__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7questdb_7ingress_6Sender_19__exit__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7questdb_7ingress_6Sender_18__exit__}; static PyObject *__pyx_pw_7questdb_7ingress_6Sender_19__exit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_exc_type = 0; CYTHON_UNUSED PyObject *__pyx_v__exc_val = 0; CYTHON_UNUSED PyObject *__pyx_v__exc_tb = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_val,&__pyx_n_s_exc_tb,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_type)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_val)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 1366, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exc_tb)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 1366, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 1366, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_exc_type = values[0]; __pyx_v__exc_val = values[1]; __pyx_v__exc_tb = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1366, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("questdb.ingress.Sender.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7questdb_7ingress_6Sender_18__exit__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self), __pyx_v_exc_type, __pyx_v__exc_val, __pyx_v__exc_tb); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_7questdb_7ingress_6Sender_18__exit__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self, PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v__exc_val, CYTHON_UNUSED PyObject *__pyx_v__exc_tb) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__exit__", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("questdb.ingress.Sender.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__58 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_exc_type, __pyx_n_s_exc_val, __pyx_n_s_exc_tb); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 1366, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__58); __Pyx_GIVEREF(__pyx_tuple__58); /* … */ __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7questdb_7ingress_6Sender_19__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_Sender___exit, NULL, __pyx_n_s_questdb_ingress, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Sender->tp_dict, __pyx_n_s_exit, __pyx_t_3) < 0) __PYX_ERR(0, 1366, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_Sender); __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_questdb_ingress_pyx, __pyx_n_s_exit, 1366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 1366, __pyx_L1_error)
1367: """
1368: Flush pending and disconnect at the end of a ``with`` block.
1369:
1370: If the ``with`` block raises an exception, any pending data will
1371: *NOT* be flushed.
1372:
1373: This is implemented by calling :func:`Sender.close`.
1374: """
+1375: self.close(not exc_type)
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_exc_type); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1375, __pyx_L1_error) __pyx_t_3.__pyx_n = 1; __pyx_t_3.flush = (!__pyx_t_1); __pyx_t_2 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->close(__pyx_v_self, 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1375, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1376:
+1377: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_7questdb_7ingress_6Sender_21__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_7questdb_7ingress_6Sender_21__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_7questdb_7ingress_6Sender_20__dealloc__(((struct __pyx_obj_7questdb_7ingress_Sender *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_7questdb_7ingress_6Sender_20__dealloc__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("questdb.ingress.Sender.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+1378: self._close()
__pyx_t_1 = ((struct __pyx_vtabstruct_7questdb_7ingress_Sender *)__pyx_v_self->__pyx_vtab)->_close(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;