Generated by Cython 0.29.30
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, 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:
0039: from .line_sender cimport *
0040:
0041: cdef extern from "Python.h":
0042: ctypedef uint8_t Py_UCS1 # unicodeobject.h
0043:
0044: ctypedef unsigned int uint
0045:
0046: cdef enum PyUnicode_Kind:
0047: PyUnicode_1BYTE_KIND
0048: PyUnicode_2BYTE_KIND
0049: PyUnicode_4BYTE_KIND
0050:
0051: # Note: Returning an `object` rather than `PyObject` as the function
0052: # returns a new reference rather than borrowing an existing one.
0053: object PyUnicode_FromKindAndData(
0054: int kind, const void* buffer, Py_ssize_t size)
0055:
0056: # Ditto, see comment on why not returning a `PyObject` above.
0057: str PyUnicode_FromStringAndSize(
0058: const char* u, Py_ssize_t size)
0059:
0060: # Must be called before accessing data or is compact check.
0061: int PyUnicode_READY(object o) except -1
0062:
0063: # Is UCS1 and ascii (and therefore valid UTF-8).
0064: bint PyUnicode_IS_COMPACT_ASCII(object o)
0065:
0066: # Get length.
0067: Py_ssize_t PyUnicode_GET_LENGTH(object o)
0068:
0069: # Zero-copy access to buffer.
0070: Py_UCS1* PyUnicode_1BYTE_DATA(object o)
0071:
0072: Py_ssize_t PyBytes_GET_SIZE(object o)
0073:
0074: char* PyBytes_AsString(object o)
0075:
0076:
+0077: from enum import Enum
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __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, 77, __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, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Enum, __pyx_t_1) < 0) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+0078: 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, 78, __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, 78, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_2) < 0) __PYX_ERR(0, 78, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Tuple, __pyx_t_2) < 0) __PYX_ERR(0, 78, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_2) < 0) __PYX_ERR(0, 78, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Union, __pyx_t_2) < 0) __PYX_ERR(0, 78, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Any, __pyx_t_2) < 0) __PYX_ERR(0, 78, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_2) < 0) __PYX_ERR(0, 78, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Callable, __pyx_t_2) < 0) __PYX_ERR(0, 78, __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, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Iterable, __pyx_t_2) < 0) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0079: import pathlib
__pyx_t_1 = __Pyx_Import(__pyx_n_s_pathlib, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pathlib, __pyx_t_1) < 0) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0080:
+0081: import sys
__pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0082:
+0083: class IngressErrorCode(Enum):
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Enum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __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, 83, __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, 83, __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, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_d, __pyx_n_s_IngressErrorCode, __pyx_t_5) < 0) __PYX_ERR(0, 83, __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;
0084: """Category of Error."""
+0085: 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, 85, __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, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0086: 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, 86, __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, 86, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0087: 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, 87, __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, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0088: 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, 88, __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, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0089: 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, 89, __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, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0090: 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, 90, __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, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0091: 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, 91, __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, 91, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0092: 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, 92, __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, 92, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0093:
+0094: 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, 94, __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, 94, __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, 94, __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, 94, __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, 94, __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, 94, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 94, __pyx_L1_error)
0095: """Return the name of the enum."""
+0096: 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, 96, __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, 96, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0;
0097:
0098:
+0099: class IngressError(Exception):
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __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, 99, __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, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 99, __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, 99, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_CyFunction_InitClassCell(__pyx_t_5, __pyx_t_4) < 0) __PYX_ERR(0, 99, __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, 99, __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;
0100: """An error whilst using the ``Sender`` or constructing its ``Buffer``."""
+0101: 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, 101, __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, 101, __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, 101, __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, 101, __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, 101, __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, 101, __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, 101, __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, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 101, __pyx_L1_error)
+0102: 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, 102, __pyx_L1_error) } __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __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, 102, __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, 102, __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, 102, __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;
+0103: self._code = code
if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_code_2, __pyx_v_code) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
0104:
+0105: @property
__pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __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, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0106: 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, 106, __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, 106, __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, 106, __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, 106, __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, 106, __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, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 106, __pyx_L1_error)
0107: """Return the error code."""
+0108: 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, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0109:
0110:
+0111: 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; }
+0112: 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:
+0113: return IngressErrorCode.CouldNotResolveAddr
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __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, 113, __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;
+0114: elif code == line_sender_error_invalid_api_call:
break; case line_sender_error_socket_error:
+0115: return IngressErrorCode.InvalidApiCall
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __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, 115, __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;
+0116: elif code == line_sender_error_socket_error:
break; case line_sender_error_invalid_utf8:
+0117: return IngressErrorCode.SocketError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __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, 117, __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;
+0118: elif code == line_sender_error_invalid_utf8:
break; case line_sender_error_invalid_name:
+0119: return IngressErrorCode.InvalidUtf8
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __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, 119, __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;
+0120: elif code == line_sender_error_invalid_name:
break; case line_sender_error_invalid_timestamp:
+0121: return IngressErrorCode.InvalidName
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __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, 121, __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;
+0122: elif code == line_sender_error_invalid_timestamp:
break; case line_sender_error_auth_error:
+0123: return IngressErrorCode.InvalidTimestamp
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __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, 123, __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;
+0124: elif code == line_sender_error_auth_error:
break; case line_sender_error_tls_error:
+0125: return IngressErrorCode.AuthError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __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, 125, __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;
+0126: elif code == line_sender_error_tls_error:
break; default:
+0127: return IngressErrorCode.TlsError
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __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, 127, __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;
0128: else:
+0129: 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, 129, __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, 129, __pyx_L1_error) break; } /* … */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Internal_error_converting_error); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
0130:
0131:
+0132: 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) { 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_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_5); __Pyx_AddTraceback("questdb.ingress.c_err_to_py", __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; }
0133: """Construct a ``SenderError`` from a C error, which will also be freed."""
+0134: cdef line_sender_error_code code = line_sender_error_get_code(err)
__pyx_v_code = line_sender_error_get_code(__pyx_v_err);
+0135: cdef size_t c_len = 0
__pyx_v_c_len = 0;
+0136: 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));
0137: cdef object py_err
0138: cdef object py_msg
0139: cdef object py_code
+0140: try:
/*try:*/ {
+0141: 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, 141, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_code = __pyx_t_1; __pyx_t_1 = 0;
+0142: py_msg = PyUnicode_FromKindAndData(
__pyx_t_1 = PyUnicode_FromKindAndData(PyUnicode_1BYTE_KIND, __pyx_v_c_msg, ((Py_ssize_t)__pyx_v_c_len)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_py_msg = __pyx_t_1; __pyx_t_1 = 0;
0143: PyUnicode_1BYTE_KIND,
0144: c_msg,
0145: <Py_ssize_t>c_len)
+0146: return IngressError(py_code, py_msg)
__Pyx_XDECREF(__pyx_r); __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(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_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_py_code, __pyx_v_py_msg}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_py_code, __pyx_v_py_msg}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_v_py_code); __Pyx_GIVEREF(__pyx_v_py_code); PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_py_code); __Pyx_INCREF(__pyx_v_py_msg); __Pyx_GIVEREF(__pyx_v_py_msg); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_py_msg); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __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_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 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_5); __pyx_t_5 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10) < 0)) __Pyx_ErrFetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); __Pyx_XGOTREF(__pyx_t_8); __Pyx_XGOTREF(__pyx_t_9); __Pyx_XGOTREF(__pyx_t_10); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __pyx_t_4 = __pyx_lineno; __pyx_t_6 = __pyx_clineno; __pyx_t_7 = __pyx_filename; { line_sender_error_free(__pyx_v_err); } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13); } __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); __Pyx_XGIVEREF(__pyx_t_10); __Pyx_ErrRestore(__pyx_t_8, __pyx_t_9, __pyx_t_10); __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_6; __pyx_filename = __pyx_t_7; goto __pyx_L1_error; } __pyx_L3_return: { __pyx_t_13 = __pyx_r; __pyx_r = 0; line_sender_error_free(__pyx_v_err); __pyx_r = __pyx_t_13; __pyx_t_13 = 0; goto __pyx_L0; } }
0149:
0150:
+0151: 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; }
0152: """
0153: Init the `utf8_out` object from the `string`.
0154: If the string is held as a UCS1 and is purely ascii, then
0155: the memory is borrowed.
0156: Otherwise the string is first encoded to UTF-8 into a bytes object
0157: and such bytes object is returned to transfer ownership and extend
0158: the lifetime of the buffer pointed to by `utf8_out`.
0159: """
0160: # Note that we bypass `line_sender_utf8_init`.
+0161: cdef bytes owner = None
__Pyx_INCREF(Py_None);
__pyx_v_owner = ((PyObject*)Py_None);
+0162: PyUnicode_READY(string)
__pyx_t_1 = PyUnicode_READY(__pyx_v_string); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 162, __pyx_L1_error)
+0163: if PyUnicode_IS_COMPACT_ASCII(string):
__pyx_t_2 = (PyUnicode_IS_COMPACT_ASCII(__pyx_v_string) != 0);
if (__pyx_t_2) {
/* … */
}
+0164: utf8_out.len = <size_t>(PyUnicode_GET_LENGTH(string))
__pyx_v_utf8_out->len = ((size_t)PyUnicode_GET_LENGTH(__pyx_v_string));
+0165: utf8_out.buf = <const char*>(PyUnicode_1BYTE_DATA(string))
__pyx_v_utf8_out->buf = ((char const *)PyUnicode_1BYTE_DATA(__pyx_v_string));
+0166: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0;
0167: else:
+0168: 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, 168, __pyx_L1_error) } __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_string); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_owner, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0;
+0169: utf8_out.len = <size_t>(PyBytes_GET_SIZE(owner))
__pyx_v_utf8_out->len = ((size_t)PyBytes_GET_SIZE(__pyx_v_owner));
+0170: utf8_out.buf = <const char*>(PyBytes_AsString(owner))
__pyx_v_utf8_out->buf = ((char const *)PyBytes_AsString(__pyx_v_owner));
+0171: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0; }
0172:
0173:
+0174: 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; }
0175: """
0176: Python string to borrowed C table name.
0177: Also see `str_to_utf8`.
0178: """
+0179: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0180: cdef line_sender_utf8 utf8
+0181: 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, 181, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0182: 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)) { /* … */ }
+0183: 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, 183, __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, 183, __pyx_L1_error)
+0184: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0;
0185:
0186:
+0187: 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; }
0188: """
0189: Python string to borrowed C column name.
0190: Also see `str_to_utf8`.
0191: """
+0192: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0193: cdef line_sender_utf8 utf8
+0194: 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, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0195: 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)) { /* … */ }
+0196: 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, 196, __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, 196, __pyx_L1_error)
+0197: return owner
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_owner); __pyx_r = __pyx_v_owner; goto __pyx_L0;
0198:
0199:
+0200: 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; }
0201: """
0202: Convert a `datetime.datetime` to microseconds since the epoch.
0203: """
0204: return (
+0205: <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, 205, __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, 205, __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, 205, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0206: <int64_t>(1000000) +
__pyx_r = ((((int64_t)__pyx_t_4) * ((int64_t)0xF4240)) + ((int64_t)__pyx_t_5)); goto __pyx_L0;
+0207: <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, 207, __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, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0208:
0209:
+0210: 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; }
0211: """
0212: Convert a `datetime.datetime` to nanoseconds since the epoch.
0213: """
0214: return (
+0215: <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, 215, __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, 215, __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, 215, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+0216: <int64_t>(1000000000) +
__pyx_r = ((((int64_t)__pyx_t_4) * ((int64_t)0x3B9ACA00)) + ((int64_t)__pyx_t_5)); goto __pyx_L0;
+0217: <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, 217, __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, 217, __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, 217, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
0218:
0219:
+0220: cdef class TimestampMicros:
struct __pyx_obj_7questdb_7ingress_TimestampMicros { PyObject_HEAD int64_t _value; };
0221: """
0222: A timestamp in microseconds since the UNIX epoch.
0223:
0224: You may construct a ``TimestampMicros`` from an integer or a ``datetime``.
0225:
0226: .. code-block:: python
0227:
0228: # Can't be negative.
0229: TimestampMicros(1657888365426838016)
0230:
0231: # Careful with the timezeone!
0232: TimestampMicros.from_datetime(datetime.datetime.utcnow())
0233:
0234: When constructing from a ``datetime``, you should take extra care
0235: to ensure that the timezone is correct.
0236:
0237: For example, ``datetime.now()`` implies the `local` timezone which
0238: is probably not what you want.
0239:
0240: When constructing the ``datetime`` object explicity, you pass in the
0241: timezone to use.
0242:
0243: .. code-block:: python
0244:
0245: TimestampMicros.from_datetime(
0246: datetime.datetime(2000, 1, 1, tzinfo=datetime.timezone.utc))
0247:
0248: """
0249: cdef int64_t _value
0250:
+0251: 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, 251, __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, 251, __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; }
+0252: 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, 252, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+0253: 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, 253, __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, 253, __pyx_L1_error) /* … */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_value_must_positive_integer); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2);
+0254: 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, 254, __pyx_L1_error) __pyx_v_self->_value = __pyx_t_3;
0255:
+0256: @classmethod
__pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 256, __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, 257, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampMicros);
+0257: 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, 257, __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, 257, __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, 257, __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, 257, __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, 257, __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, 257, __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, 257, __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, 257, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 257, __pyx_L1_error)
0258: """
0259: Construct a ``TimestampMicros`` from a ``datetime.datetime`` object.
0260: """
+0261: 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)) {
/* … */
}
+0262: 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, 262, __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, 262, __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, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3);
+0263: 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, 263, __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, 263, __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;
0264:
0265: @property
+0266: 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; }
0267: """Number of microseconds."""
+0268: 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, 268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0269:
0270:
+0271: cdef class TimestampNanos:
struct __pyx_obj_7questdb_7ingress_TimestampNanos { PyObject_HEAD int64_t _value; };
0272: """
0273: A timestamp in nanoseconds since the UNIX epoch.
0274:
0275: You may construct a ``TimestampNanos`` from an integer or a ``datetime``.
0276:
0277: .. code-block:: python
0278:
0279: # Can't be negative.
0280: TimestampNanos(1657888365426838016)
0281:
0282: # Careful with the timezeone!
0283: TimestampNanos.from_datetime(datetime.datetime.utcnow())
0284:
0285: When constructing from a ``datetime``, you should take extra care
0286: to ensure that the timezone is correct.
0287:
0288: For example, ``datetime.now()`` implies the `local` timezone which
0289: is probably not what you want.
0290:
0291: When constructing the ``datetime`` object explicity, you pass in the
0292: timezone to use.
0293:
0294: .. code-block:: python
0295:
0296: TimestampMicros.from_datetime(
0297: datetime.datetime(2000, 1, 1, tzinfo=datetime.timezone.utc))
0298:
0299: """
0300: cdef int64_t _value
0301:
+0302: 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, 302, __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, 302, __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; }
+0303: 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, 303, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+0304: 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, 304, __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, 304, __pyx_L1_error)
+0305: 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, 305, __pyx_L1_error) __pyx_v_self->_value = __pyx_t_3;
0306:
+0307: @classmethod
__pyx_t_2 = __Pyx_Method_ClassMethod(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __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, 308, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyType_Modified(__pyx_ptype_7questdb_7ingress_TimestampNanos);
+0308: 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, 308, __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, 308, __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, 308, __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, 308, __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, 308, __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, 308, __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, 308, __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, 308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 308, __pyx_L1_error)
0309: """
0310: Construct a ``TimestampNanos`` from a ``datetime.datetime`` object.
0311: """
+0312: 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)) {
/* … */
}
+0313: 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, 313, __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, 313, __pyx_L1_error)
+0314: 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, 314, __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, 314, __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;
0315:
0316: @property
+0317: 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; }
0318: """Number of nanoseconds."""
+0319: 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, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0320:
0321:
+0322: 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; };
+0323: 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; };
0324:
0325:
+0326: 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; }
+0327: if sender._auto_flush_enabled:
__pyx_t_1 = (__pyx_v_sender->_auto_flush_enabled != 0); if (__pyx_t_1) { /* … */ }
+0328: 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, 328, __pyx_L1_error) __pyx_t_1 = ((__pyx_t_2 >= __pyx_v_sender->_auto_flush_watermark) != 0); if (__pyx_t_1) { /* … */ }
+0329: 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, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0330:
0331:
+0332: 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, int); int (*_column_f64)(struct __pyx_obj_7questdb_7ingress_Buffer *, struct line_sender_column_name, float); 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;
0333: """
0334: Construct QuestDB-flavored InfluxDB Line Protocol (ILP) messages.
0335:
0336: The :func:`Buffer.row` method is used to add a row to the buffer.
0337:
0338: You can call this many times.
0339:
0340: .. code-block:: python
0341:
0342: from questdb.ingress import Buffer
0343:
0344: buf = Buffer()
0345: buf.row(
0346: 'table_name1',
0347: symbols={'s1', 'v1', 's2', 'v2'},
0348: columns={'c1': True, 'c2': 0.5})
0349:
0350: buf.row(
0351: 'table_name2',
0352: symbols={'questdb': '❤️'},
0353: columns={'like': 100000})
0354:
0355: # Append any additional rows then, once ready, call
0356: sender.flush(buffer) # a `Sender` instance.
0357:
0358: # The sender auto-cleared the buffer, ready for reuse.
0359:
0360: buf.row(
0361: 'table_name1',
0362: symbols={'s1', 'v1', 's2', 'v2'},
0363: columns={'c1': True, 'c2': 0.5})
0364:
0365: # etc.
0366:
0367:
0368: Buffer Constructor Arguments:
0369: * ``init_capacity`` (``int``): Initial capacity of the buffer in bytes.
0370: Defaults to ``65536`` (64KiB).
0371: * ``max_name_len`` (``int``): Maximum length of a column name.
0372: Defaults to ``127`` which is the same default value as QuestDB.
0373: This should match the ``cairo.max.file.name.length`` setting of the
0374: QuestDB instance you're connecting to.
0375:
0376: .. code-block:: python
0377:
0378: # These two buffer constructions are equivalent.
0379: buf1 = Buffer()
0380: buf2 = Buffer(init_capacity=65536, max_name_len=127)
0381:
0382: To avoid having to manually set these arguments every time, you can call
0383: the sender's ``new_buffer()`` method instead.
0384:
0385: .. code-block:: python
0386:
0387: from questdb.ingress import Sender, Buffer
0388:
0389: sender = Sender(host='localhost', port=9009,
0390: init_capacity=16384, max_name_len=64)
0391: buf = sender.new_buffer()
0392: assert buf.init_capacity == 16384
0393: assert buf.max_name_len == 64
0394:
0395: """
0396: cdef line_sender_buffer* _impl
0397: cdef size_t _init_capacity
0398: cdef size_t _max_name_len
0399: cdef object _row_complete_sender
0400:
+0401: 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, 401, __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, 401, __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; }
0402: """
0403: Create a new buffer with the an initial capacity and max name length.
0404: :param int init_capacity: Initial capacity of the buffer in bytes.
0405: :param int max_name_len: Maximum length of a table or column name.
0406: """
+0407: 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, 407, __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, 407, __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, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0408:
+0409: 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; }
+0410: 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);
+0411: line_sender_buffer_reserve(self._impl, init_capacity)
line_sender_buffer_reserve(__pyx_v_self->_impl, __pyx_v_init_capacity);
+0412: self._init_capacity = init_capacity
__pyx_v_self->_init_capacity = __pyx_v_init_capacity;
+0413: self._max_name_len = max_name_len
__pyx_v_self->_max_name_len = __pyx_v_max_name_len;
+0414: 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;
0415:
+0416: 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(); }
+0417: 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;
+0418: line_sender_buffer_free(self._impl)
line_sender_buffer_free(__pyx_v_self->_impl);
0419:
0420: @property
+0421: 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; }
0422: """
0423: The initial capacity of the buffer when first created.
0424:
0425: This may grow over time, see ``capacity()``.
0426: """
+0427: 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, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0428:
0429: @property
0430: def max_name_len(self) -> int:
0431: """Maximum length of a table or column name."""
0432: return self._max_name_len
0433:
0434: @property
+0435: 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; }
0436: """Maximum length of a table or column name."""
+0437: 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, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0438:
+0439: 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, 439, __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, 439, __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, 439, __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, 439, __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, 439, __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, 439, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 439, __pyx_L1_error)
0440: """
0441: Ensure the buffer has at least `additional` bytes of future capacity.
0442:
0443: :param int additional: Additional bytes to reserve.
0444: """
+0445: 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, 445, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 445, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_2)) { /* … */ }
+0446: 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, 446, __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, 446, __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, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8);
+0447: 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, 447, __pyx_L1_error) line_sender_buffer_reserve(__pyx_v_self->_impl, __pyx_t_3);
0448:
+0449: 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, 449, __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, 449, __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, 449, __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, 449, __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, 449, __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, 449, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 449, __pyx_L1_error)
0450: """The current buffer capacity."""
+0451: 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, 451, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0452:
+0453: 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, 453, __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, 453, __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, 453, __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, 453, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 453, __pyx_L1_error)
0454: """
0455: Reset the buffer.
0456:
0457: Note that flushing a buffer will (unless otherwise specified)
0458: also automatically clear it.
0459:
0460: This method is designed to be called only in conjunction with
0461: ``sender.flush(buffer, clear=False)``.
0462: """
+0463: line_sender_buffer_clear(self._impl)
line_sender_buffer_clear(__pyx_v_self->_impl);
0464:
+0465: def __len__(self):
/* 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; }
0466: """
0467: The current number of bytes currently in the buffer.
0468:
0469: Equivalent (but cheaper) to ``len(str(sender))``.
0470: """
+0471: return line_sender_buffer_size(self._impl)
__pyx_r = line_sender_buffer_size(__pyx_v_self->_impl); goto __pyx_L0;
0472:
+0473: def __str__(self):
/* 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; }
0474: """Return the constructed buffer as a string. Use for debugging."""
+0475: 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, 475, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0476:
+0477: 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; }
+0478: cdef size_t size = 0
__pyx_v_size = 0;
+0479: 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));
+0480: 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, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
0481:
+0482: 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; }
+0483: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0484: 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)) { /* … */ }
+0485: 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, 485, __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, 485, __pyx_L1_error)
0486:
+0487: 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; }
+0488: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0489: 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)) { /* … */ }
+0490: 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, 490, __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, 490, __pyx_L1_error)
0491:
+0492: 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; }
+0493: line_sender_buffer_clear_marker(self._impl)
line_sender_buffer_clear_marker(__pyx_v_self->_impl);
0494:
+0495: 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; }
+0496: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0497: cdef line_sender_table_name c_table_name
+0498: 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, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0499: 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)) { /* … */ }
+0500: 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, 500, __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, 500, __pyx_L1_error)
+0501: return 0
__pyx_r = 0; goto __pyx_L0;
0502:
+0503: 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; }
+0504: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0505: cdef line_sender_column_name c_name
0506: cdef line_sender_utf8 c_value
+0507: 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, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_name = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0508: 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, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_value = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0509: 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)) { /* … */ }
+0510: 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, 510, __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, 510, __pyx_L1_error)
+0511: return 0
__pyx_r = 0; goto __pyx_L0;
0512:
+0513: 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; }
0514: self, line_sender_column_name c_name, bint value) except -1:
+0515: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0516: 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)) { /* … */ }
+0517: 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, 517, __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, 517, __pyx_L1_error)
+0518: return 0
__pyx_r = 0; goto __pyx_L0;
0519:
+0520: 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, int __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; }
0521: self, line_sender_column_name c_name, int value) except -1:
0522: # TODO: Generally audit for int overflows this in the whole codebase.
0523: # We pretty certainly have one here :-).
+0524: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0525: 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)) { /* … */ }
+0526: 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, 526, __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, 526, __pyx_L1_error)
+0527: return 0
__pyx_r = 0; goto __pyx_L0;
0528:
+0529: 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, float __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; }
0530: self, line_sender_column_name c_name, float value) except -1:
+0531: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0532: 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)) { /* … */ }
+0533: 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, 533, __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, 533, __pyx_L1_error)
+0534: return 0
__pyx_r = 0; goto __pyx_L0;
0535:
+0536: 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; }
0537: self, line_sender_column_name c_name, str value) except -1:
+0538: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
0539: cdef line_sender_utf8 c_value
+0540: 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, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_value = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0541: 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)) { /* … */ }
+0542: 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, 542, __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, 542, __pyx_L1_error)
+0543: return 0
__pyx_r = 0; goto __pyx_L0;
0544:
+0545: 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_1); __Pyx_AddTraceback("questdb.ingress.Buffer._column_ts", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
0546: self, line_sender_column_name c_name, TimestampMicros ts) except -1:
+0547: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0548: if not line_sender_buffer_column_ts(self._impl, c_name, ts.value, &err):
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ts), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!(line_sender_buffer_column_ts(__pyx_v_self->_impl, __pyx_v_c_name, __pyx_t_2, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_3)) { /* … */ }
+0549: 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, 549, __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, 549, __pyx_L1_error)
+0550: return 0
__pyx_r = 0; goto __pyx_L0;
0551:
+0552: 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; }
0553: self, line_sender_column_name c_name, datetime dt) except -1:
+0554: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0555: 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)) { /* … */ }
0556: self._impl, c_name, datetime_to_micros(dt), &err):
+0557: 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, 557, __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, 557, __pyx_L1_error)
+0558: return 0
__pyx_r = 0; goto __pyx_L0;
0559:
+0560: 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; }
0561: cdef line_sender_column_name c_name
+0562: 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, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_owner_name = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0563: if PyBool_Check(value):
__pyx_t_2 = (PyBool_Check(__pyx_v_value) != 0);
if (__pyx_t_2) {
/* … */
}
+0564: 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, 564, __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, 564, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+0565: elif isinstance(value, int):
__pyx_t_2 = PyInt_Check(__pyx_v_value);
__pyx_t_4 = (__pyx_t_2 != 0);
if (__pyx_t_4) {
/* … */
}
+0566: return self._column_i64(c_name, value)
__pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 566, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_7ingress_6Buffer__column_i64(__pyx_v_self, __pyx_v_c_name, __pyx_t_3); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 566, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
+0567: elif isinstance(value, float):
__pyx_t_4 = PyFloat_Check(__pyx_v_value);
__pyx_t_2 = (__pyx_t_4 != 0);
if (__pyx_t_2) {
/* … */
}
+0568: return self._column_f64(c_name, value)
__pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 568, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_7ingress_6Buffer__column_f64(__pyx_v_self, __pyx_v_c_name, __pyx_t_6); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 568, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
+0569: elif isinstance(value, str):
__pyx_t_2 = PyUnicode_Check(__pyx_v_value);
__pyx_t_4 = (__pyx_t_2 != 0);
if (__pyx_t_4) {
/* … */
}
+0570: 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, 570, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_7ingress_6Buffer__column_str(__pyx_v_self, __pyx_v_c_name, ((PyObject*)__pyx_v_value)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 570, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
+0571: elif isinstance(value, TimestampMicros):
__pyx_t_4 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_7questdb_7ingress_TimestampMicros);
__pyx_t_2 = (__pyx_t_4 != 0);
if (__pyx_t_2) {
/* … */
}
+0572: 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, 572, __pyx_L1_error) __pyx_t_5 = __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_5 == ((int)-1))) __PYX_ERR(0, 572, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
+0573: elif isinstance(value, datetime):
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_ptype_7cpython_8datetime_datetime);
__pyx_t_4 = (__pyx_t_2 != 0);
if (likely(__pyx_t_4)) {
/* … */
}
+0574: 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, 574, __pyx_L1_error) __pyx_t_5 = __pyx_f_7questdb_7ingress_6Buffer__column_dt(__pyx_v_self, __pyx_v_c_name, ((PyDateTime_DateTime *)__pyx_v_value)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 574, __pyx_L1_error) __pyx_r = __pyx_t_5; goto __pyx_L0;
0575: else:
+0576: valid = ', '.join((
/*else*/ { /* … */ __pyx_t_1 = PyUnicode_Join(__pyx_kp_u__9, __pyx_tuple__10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_valid = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0;
+0577: '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, 577, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10);
0578: 'int',
0579: 'float',
0580: 'str',
0581: 'TimestampMicros',
0582: 'datetime.datetime'))
+0583: raise TypeError(
__pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 583, __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, 583, __pyx_L1_error) }
+0584: f'Unsupported type: {type(value)}. Must be one of: {valid}')
__pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 584, __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, 584, __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, 584, __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, 584, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
0585:
+0586: 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; }
+0587: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0588: cdef PyObject* sender = NULL
__pyx_v_sender = NULL;
+0589: 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, 589, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 589, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+0590: 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, 590, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_sender = __pyx_t_3;
+0591: if sender != NULL:
__pyx_t_2 = ((__pyx_v_sender != NULL) != 0); if (__pyx_t_2) { /* … */ }
+0592: 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, 592, __pyx_L1_error)
0593:
+0594: 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_1); __Pyx_AddTraceback("questdb.ingress.Buffer._at_ts", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+0595: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0596: if not line_sender_buffer_at(self._impl, ts.value, &err):
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ts), __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int64_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 596, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!(line_sender_buffer_at(__pyx_v_self->_impl, __pyx_t_2, (&__pyx_v_err)) != 0)) != 0); if (unlikely(__pyx_t_3)) { /* … */ }
+0597: 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, 597, __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, 597, __pyx_L1_error)
+0598: self._may_trigger_row_complete()
__pyx_t_4 = __pyx_f_7questdb_7ingress_6Buffer__may_trigger_row_complete(__pyx_v_self); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 598, __pyx_L1_error)
+0599: return 0
__pyx_r = 0; goto __pyx_L0;
0600:
+0601: 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; }
+0602: cdef int64_t value = datetime_to_nanos(dt)
__pyx_v_value = __pyx_f_7questdb_7ingress_datetime_to_nanos(__pyx_v_dt);
+0603: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0604: 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)) { /* … */ }
+0605: 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, 605, __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, 605, __pyx_L1_error)
+0606: self._may_trigger_row_complete()
__pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__may_trigger_row_complete(__pyx_v_self); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 606, __pyx_L1_error)
+0607: return 0
__pyx_r = 0; goto __pyx_L0;
0608:
+0609: 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; }
+0610: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+0611: 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)) { /* … */ }
+0612: 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, 612, __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, 612, __pyx_L1_error)
+0613: self._may_trigger_row_complete()
__pyx_t_3 = __pyx_f_7questdb_7ingress_6Buffer__may_trigger_row_complete(__pyx_v_self); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 613, __pyx_L1_error)
+0614: return 0
__pyx_r = 0; goto __pyx_L0;
0615:
+0616: 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; }
+0617: if ts is None:
__pyx_t_1 = (__pyx_v_ts == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+0618: 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, 618, __pyx_L1_error)
__pyx_r = __pyx_t_3;
goto __pyx_L0;
+0619: 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) {
/* … */
}
+0620: 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, 620, __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, 620, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
+0621: 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)) {
/* … */
}
+0622: 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, 622, __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, 622, __pyx_L1_error) __pyx_r = __pyx_t_3; goto __pyx_L0;
0623: else:
+0624: raise TypeError(
/*else*/ { /* … */ __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 624, __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, 624, __pyx_L1_error) }
+0625: f'Unsupported type: {type(ts)}. Must be one of: ' +
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 625, __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, 625, __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, 625, __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, 625, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
0626: 'TimestampNanos, datetime, None')
0627:
+0628: 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_8); __Pyx_XDECREF(__pyx_t_9); __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; };
0629: self,
0630: str table_name,
+0631: dict symbols=None,
PyObject *__pyx_v_symbols = ((PyObject*)Py_None);
+0632: dict columns=None,
PyObject *__pyx_v_columns = ((PyObject*)Py_None);
+0633: object at=None) except -1:
PyObject *__pyx_v_at = ((PyObject *)Py_None); 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; } } } }
0634: """
0635: Add a row to the buffer.
0636: """
+0637: 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, 637, __pyx_L1_error)
+0638: 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_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 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:; }
+0639: 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, 639, __pyx_L3_error)
+0640: if not (symbols or columns):
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_symbols); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 640, __pyx_L3_error) if (!__pyx_t_6) { } else { __pyx_t_5 = __pyx_t_6; goto __pyx_L10_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_columns); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 640, __pyx_L3_error) __pyx_t_5 = __pyx_t_6; __pyx_L10_bool_binop_done:; __pyx_t_6 = ((!__pyx_t_5) != 0); if (unlikely(__pyx_t_6)) { /* … */ }
+0641: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 641, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_8);
+0642: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 642, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_InvalidApiCall); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 642, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = NULL; __pyx_t_1 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_1 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_10, __pyx_kp_u_Must_specify_at_least_one_symbol}; __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 641, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_10, __pyx_kp_u_Must_specify_at_least_one_symbol}; __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 641, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else #endif { __pyx_t_11 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 641, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_11); if (__pyx_t_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; } __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_kp_u_Must_specify_at_least_one_symbol); __Pyx_GIVEREF(__pyx_kp_u_Must_specify_at_least_one_symbol); PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_1, __pyx_kp_u_Must_specify_at_least_one_symbol); __pyx_t_10 = 0; __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 641, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __PYX_ERR(0, 641, __pyx_L3_error)
0643: 'Must specify at least one symbol or column')
+0644: if symbols is not None:
__pyx_t_6 = (__pyx_v_symbols != ((PyObject*)Py_None)); __pyx_t_5 = (__pyx_t_6 != 0); if (__pyx_t_5) { /* … */ }
+0645: for name, value in symbols.items():
__pyx_t_12 = 0; if (unlikely(__pyx_v_symbols == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 645, __pyx_L3_error) } __pyx_t_8 = __Pyx_dict_iterator(__pyx_v_symbols, 1, __pyx_n_s_items, (&__pyx_t_13), (&__pyx_t_1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 645, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = __pyx_t_8; __pyx_t_8 = 0; while (1) { __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_13, &__pyx_t_12, &__pyx_t_8, &__pyx_t_11, NULL, __pyx_t_1); if (unlikely(__pyx_t_14 == 0)) break; if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 645, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11); __pyx_t_11 = 0;
+0646: 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, 646, __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, 646, __pyx_L3_error) __pyx_t_14 = __pyx_f_7questdb_7ingress_6Buffer__symbol(__pyx_v_self, ((PyObject*)__pyx_v_name), ((PyObject*)__pyx_v_value)); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 646, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+0647: 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) { /* … */ }
+0648: for name, value in columns.items():
__pyx_t_13 = 0; if (unlikely(__pyx_v_columns == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); __PYX_ERR(0, 648, __pyx_L3_error) } __pyx_t_11 = __Pyx_dict_iterator(__pyx_v_columns, 1, __pyx_n_s_items, (&__pyx_t_12), (&__pyx_t_1)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 648, __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_14 = __Pyx_dict_iter_next(__pyx_t_7, __pyx_t_12, &__pyx_t_13, &__pyx_t_11, &__pyx_t_8, NULL, __pyx_t_1); if (unlikely(__pyx_t_14 == 0)) break; if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 648, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GOTREF(__pyx_t_8); __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_8); __pyx_t_8 = 0;
+0649: 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, 649, __pyx_L3_error) __pyx_t_14 = __pyx_f_7questdb_7ingress_6Buffer__column(__pyx_v_self, ((PyObject*)__pyx_v_name), __pyx_v_value); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 649, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+0650: 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, 650, __pyx_L3_error)
+0651: self._clear_marker()
__pyx_t_7 = __pyx_f_7questdb_7ingress_6Buffer__clear_marker(__pyx_v_self); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 651, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+0652: except:
/*except:*/ { __Pyx_AddTraceback("questdb.ingress.Buffer._row", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_11) < 0) __PYX_ERR(0, 652, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_11);
+0653: 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, 653, __pyx_L5_except_error)
+0654: raise
__Pyx_GIVEREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_11); __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_8, __pyx_t_11); __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_11 = 0; __PYX_ERR(0, 654, __pyx_L5_except_error) } __pyx_L5_except_error:;
0655:
+0656: 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 At least one ``symbols`` or ``columns`` must be specified.\n\n .. code-block:: python\n\n # All fields specified.\n buffer.row(\n 'table_name',\n symbols={'sym1': 'abc', 'sym2': 'def'},\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 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 :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 :param columns: A dictionary of column names to ``bool``, ``int``,\n ``float``, ``str``"", ``TimestampMicros`` or ``datetime`` values.\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, 656, __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, 656, __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, 656, __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, 656, __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, 656, __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, 656, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 656, __pyx_L1_error)
0657: self,
0658: table_name: str,
0659: *,
+0660: symbols: Optional[Dict[str, str]]=None,
values[1] = ((PyObject *)Py_None); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Optional); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 660, __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, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __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_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)(&PyUnicode_Type))); __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 660, __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, 660, __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, 656, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+0661: columns: Optional[Dict[
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_Optional); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __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, 661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); /* … */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __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, 661, __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, 661, __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, 656, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
0662: str,
+0663: Union[bool, int, float, str, TimestampMicros, datetime]]]=None,
values[2] = ((PyObject *)Py_None); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Union); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_ptype_7cpython_4bool_bool)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_7cpython_4bool_bool)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)); __Pyx_INCREF(((PyObject *)(&PyInt_Type))); __Pyx_GIVEREF(((PyObject *)(&PyInt_Type))); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)(&PyInt_Type))); __Pyx_INCREF(((PyObject *)(&PyFloat_Type))); __Pyx_GIVEREF(((PyObject *)(&PyFloat_Type))); PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)(&PyFloat_Type))); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); PyTuple_SET_ITEM(__pyx_t_3, 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_3, 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_3, 5, ((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, 663, __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;
+0664: 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, 656, __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, 656, __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, 658, __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, 664, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 664, __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, 664, __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, 656, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
0665: """
0666: Add a single row (line) to the buffer.
0667:
0668: At least one ``symbols`` or ``columns`` must be specified.
0669:
0670: .. code-block:: python
0671:
0672: # All fields specified.
0673: buffer.row(
0674: 'table_name',
0675: symbols={'sym1': 'abc', 'sym2': 'def'},
0676: columns={
0677: 'col1': True,
0678: 'col2': 123,
0679: 'col3': 3.14,
0680: 'col4': 'xyz',
0681: 'col5': TimestampMicros(123456789),
0682: 'col6': datetime(2019, 1, 1, 12, 0, 0)},
0683: at=TimestampNanos(123456789))
0684:
0685: # Only symbols specified. Designated timestamp assigned by the db.
0686: buffer.row(
0687: 'table_name',
0688: symbols={'sym1': 'abc', 'sym2': 'def'})
0689:
0690: # Float columns and timestamp specified as `datetime.datetime`.
0691: # Pay special attention to the timezone, which if unspecified is
0692: # assumed to be the local timezone (and not UTC).
0693: buffer.row(
0694: 'sensor data',
0695: columns={
0696: 'temperature': 24.5,
0697: 'humidity': 0.5},
0698: at=datetime.datetime.utcnow())
0699:
0700:
0701: Python strings passed as values to ``symbols`` are going to be encoded
0702: as the ``SYMBOL`` type in QuestDB, whilst Python strings passed as
0703: values to ``columns`` are going to be encoded as the ``STRING`` type.
0704:
0705: Refer to the
0706: `QuestDB documentation <https://questdb.io/docs/concept/symbol/>`_ to
0707: understand the difference between the ``SYMBOL`` and ``STRING`` types
0708: (TL;DR: symbols are interned strings).
0709:
0710: :param table_name: The name of the table to which the row belongs.
0711: :param symbols: A dictionary of symbol column names to ``str`` values.
0712: :param columns: A dictionary of column names to ``bool``, ``int``,
0713: ``float``, ``str``, ``TimestampMicros`` or ``datetime`` values.
0714: :param at: The timestamp of the row. If ``None``, timestamp is assigned
0715: by the server. If ``datetime``, the timestamp is converted to
0716: nanoseconds. A nanosecond unix epoch timestamp can be passed
0717: explicitly as a ``TimestampNanos`` object.
0718: """
+0719: 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, 719, __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, 719, __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, 719, __pyx_L1_error)
+0720: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
0721:
0722: # def tabular(
0723: # self,
0724: # table_name: str,
0725: # data: Iterable[Iterable[Union[
0726: # bool, int, float, str,
0727: # TimestampMicros, TimestampNanos, datetime]]],
0728: # *,
0729: # header: Optional[List[Optional[str]]]=None,
0730: # symbols: Union[bool, List[int]]=False,
0731: # at: Union[None, TimestampNanos, datetime]=None):
0732: # """
0733: # Add multiple rows as an iterable of iterables (e.g. list of lists) to
0734: # the buffer.
0735:
0736: # **Data and header**
0737:
0738: # The ``data`` argument specifies rows which must all be for the same
0739: # table. Column names are provided as the ``header``.
0740:
0741: # .. code-block:: python
0742:
0743: # buffer.tabular(
0744: # 'table_name',
0745: # [[True, 123, 3.14, 'xyz'],
0746: # [False, 456, 6.28, 'abc'],
0747: # [True, 789, 9.87, 'def']],
0748: # header=['col1', 'col2', 'col3', 'col4'])
0749:
0750: # **Designated Timestamp Column**
0751:
0752: # QuestDB supports a special `designated timestamp
0753: # <https://questdb.io/docs/concept/designated-timestamp/>`_ column that it
0754: # uses to sort the rows by timestamp.
0755:
0756: # If the data section contains the same number of columns as the header,
0757: # then the designated is going to be
0758: # assigned by the server, unless specified for all columns the `at`
0759: # argument as either an integer wrapped in a ``TimestampNanos`` object
0760: # representing nanoseconds since unix epoch (1970-01-01 00:00:00 UTC) or
0761: # as a ``datetime.datetime`` object.
0762:
0763: # .. code-block:: python
0764:
0765: # buffer.tabular(
0766: # 'table_name',
0767: # [[True, 123, 3.14, 'xyz'],
0768: # [False, 456, 6.28, 'abc'],
0769: # [True, 789, 9.87, 'def']],
0770: # header=['col1', 'col2', 'col3', 'col4'],
0771: # at=datetime.datetime.utcnow())
0772:
0773: # # or ...
0774: # # at=TimestampNanos(1657386397157631000))
0775:
0776: # If the rows need different `designated timestamp
0777: # <https://questdb.io/docs/concept/designated-timestamp/>`_ values across
0778: # different rows, you can provide them as an additional unlabeled column.
0779: # An unlabled column is one that has its name set to ``None``.
0780:
0781: # .. code-block:: python
0782:
0783: # ts1 = datetime.datetime.utcnow()
0784: # ts2 = (
0785: # datetime.datetime.utcnow() +
0786: # datetime.timedelta(microseconds=1))
0787: # buffer.tabular(
0788: # 'table_name',
0789: # [[True, 123, ts1],
0790: # [False, 456, ts2]],
0791: # header=['col1', 'col2', None])
0792:
0793: # Like the ``at`` argument, the designated timestamp column may also be
0794: # specified as ``TimestampNanos`` objects.
0795:
0796: # .. code-block:: python
0797:
0798: # buffer.tabular(
0799: # 'table_name',
0800: # [[True, 123, TimestampNanos(1657386397157630000)],
0801: # [False, 456, TimestampNanos(1657386397157631000)]],
0802: # header=['col1', 'col2', None])
0803:
0804: # The designated timestamp column may appear anywhere positionally.
0805:
0806: # .. code-block:: python
0807:
0808: # ts1 = datetime.datetime.utcnow()
0809: # ts2 = (
0810: # datetime.datetime.utcnow() +
0811: # datetime.timedelta(microseconds=1))
0812: # buffer.tabular(
0813: # 'table_name',
0814: # [[1000, ts1, 123],
0815: # [2000, ts2, 456]],
0816: # header=['col1', None, 'col2'])
0817:
0818: # **Other timestamp columns**
0819:
0820: # Other columns may also contain timestamps. These columns can take
0821: # ``datetime.datetime`` objects or ``TimestampMicros`` (*not nanos*)
0822: # objects.
0823:
0824: # .. code-block:: python
0825:
0826: # ts1 = datetime.datetime.utcnow()
0827: # ts2 = (
0828: # datetime.datetime.utcnow() +
0829: # datetime.timedelta(microseconds=1))
0830: # buffer.tabular(
0831: # 'table_name',
0832: # [[1000, ts1, 123],
0833: # [2000, ts2, 456]],
0834: # header=['col1', 'col2', 'col3'],
0835: # at=datetime.datetime.utcnow())
0836:
0837: # **Symbol Columns**
0838:
0839: # QuestDB can represent strings via the ``STRING`` or ``SYMBOL`` types.
0840:
0841: # If all the columns of type ``str`` are to be treated as ``STRING``, then
0842: # specify ``symbols=False`` (default - see exaples above).
0843:
0844: # If all need to be treated as ``SYMBOL`` specify ``symbols=True``.
0845:
0846: # .. code-block:: python
0847:
0848: # buffer.tabular(
0849: # 'table_name',
0850: # [['abc', 123, 3.14, 'xyz'],
0851: # ['def', 456, 6.28, 'abc'],
0852: # ['ghi', 789, 9.87, 'def']],
0853: # header=['col1', 'col2', 'col3', 'col4'],
0854: # symbols=True) # `col1` and `col4` are SYMBOL columns.
0855:
0856: # Whilst if only a select few are to be treated as ``SYMBOL``, specify a
0857: # list of column indices to the ``symbols`` arg.
0858:
0859: # .. code-block:: python
0860:
0861: # buffer.tabular(
0862: # 'table_name',
0863: # [['abc', 123, 3.14, 'xyz'],
0864: # ['def', 456, 6.28, 'abc'],
0865: # ['ghi', 789, 9.87, 'def']],
0866: # header=['col1', 'col2', 'col3', 'col4'],
0867: # symbols=[0]) # `col1` is SYMBOL; 'col4' is STRING.
0868:
0869: # Alternatively, you can specify a list of symbol column names.
0870:
0871: # .. code-block:: python
0872:
0873: # buffer.tabular(
0874: # 'table_name',
0875: # [['abc', 123, 3.14, 'xyz'],
0876: # ['def', 456, 6.28, 'abc'],
0877: # ['ghi', 789, 9.87, 'def']],
0878: # header=['col1', 'col2', 'col3', 'col4'],
0879: # symbols=['col1']) # `col1` is SYMBOL; 'col4' is STRING.
0880:
0881: # Note that column indices are 0-based and negative indices are counted
0882: # from the end.
0883: # """
0884: # raise ValueError('nyi')
0885:
0886: # def pandas(
0887: # self,
0888: # table_name: str,
0889: # data: pd.DataFrame,
0890: # *,
0891: # symbols: Union[bool, List[int]]=False,
0892: # at: Union[None, TimestampNanos, datetime]=None):
0893: # """
0894: # Add a pandas DataFrame to the buffer.
0895: # """
0896: # raise ValueError('nyi')
0897:
0898:
+0899: 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;
0900: """
0901: A sender is a client that inserts rows into QuestDB via the ILP protocol.
0902:
0903: **Inserting two rows**
0904:
0905: In this example, data will be flushed and sent at the end of the ``with``
0906: block.
0907:
0908: .. code-block:: python
0909:
0910: with Sender('localhost', 9009) as sender:
0911: sender.row(
0912: 'weather_sensor',
0913: symbols={'id': 'toronto1'},
0914: columns={'temperature': 23.5, 'humidity': 0.49})
0915: sensor.row(
0916: 'weather_sensor',
0917: symbols={'id': 'dubai2'},
0918: columns={'temperature': 41.2, 'humidity': 0.34})
0919:
0920: The ``Sender`` object holds an internal buffer. The call to ``.row()``
0921: simply forwards all arguments to the :func:`Buffer.row` method.
0922:
0923:
0924: **Explicit flushing**
0925:
0926: An explicit call to :func:`Sender.flush` will send any pending data
0927: immediately.
0928:
0929: .. code-block:: python
0930:
0931: with Sender('localhost', 9009) as sender:
0932: sender.row(
0933: 'weather_sensor',
0934: symbols={'id': 'toronto1'},
0935: columns={'temperature': 23.5, 'humidity': 0.49})
0936: sender.flush()
0937: sender.row(
0938: 'weather_sensor',
0939: symbols={'id': 'dubai2'},
0940: columns={'temperature': 41.2, 'humidity': 0.34})
0941: sender.flush()
0942:
0943:
0944: **Auto-flushing (on by default)**
0945:
0946: To avoid accumulating very large buffers, the sender will flush the buffer
0947: automatically once its buffer reaches a certain byte-size watermark.
0948:
0949: You can control this behavior by setting the ``auto_flush`` argument.
0950:
0951: .. code-block:: python
0952:
0953: # Never flushes automatically.
0954: sender = Sender('localhost', 9009, auto_flush=False)
0955: sender = Sender('localhost', 9009, auto_flush=None) # Ditto.
0956: sender = Sender('localhost', 9009, auto_flush=0) # Ditto.
0957:
0958: # Flushes automatically when the buffer reaches 1KiB.
0959: sender = Sender('localhost', 9009, auto_flush=1024)
0960:
0961: # Flushes automatically after every row.
0962: sender = Sender('localhost', 9009, auto_flush=True)
0963: sender = Sender('localhost', 9009, auto_flush=1) # Ditto.
0964:
0965:
0966: **Authentication and TLS Encryption**
0967:
0968: This implementation supports authentication and TLS full-connection
0969: encryption.
0970:
0971: The ``Sender(.., auth=..)`` argument is a tuple of ``(kid, d, x, y)`` as
0972: documented on the `QuestDB ILP authentication
0973: <https://questdb.io/docs/reference/api/ilp/authenticate>`_ documentation.
0974: Authentication is optional and disabled by default.
0975:
0976: The ``Sender(.., tls=..)`` argument is one of:
0977:
0978: * ``False``: No TLS encryption (default).
0979:
0980: * ``True``: TLS encryption, accepting all common certificates as recognized
0981: by the `webpki-roots <https://crates.io/crates/webpki-roots>`_ Rust crate
0982: which in turn relies on https://mkcert.org/.
0983:
0984: * A ``str`` or ``pathlib.Path``: Path to a PEM-encoded certificate authority
0985: file. This is useful for testing with self-signed certificates.
0986:
0987: * A special ``'insecure_skip_verify'`` string: Dangerously disable all
0988: TLS certificate verification (do *NOT* use in production environments).
0989:
0990: **Positional constructor arguments for the ``Sender(..)``**
0991:
0992: * ``host``: Hostname or IP address of the QuestDB server.
0993:
0994: * ``port``: Port number of the QuestDB server.
0995:
0996:
0997: **Keyword-only constructor arguments for the ``Sender(..)``**
0998:
0999: * ``interface`` (``str``): Network interface to bind to.
1000: Set this if you have an accelerated network interface (e.g. Solarflare)
1001: and want to use it.
1002:
1003: * ``auth`` (``tuple``): Authentication tuple or ``None`` (default).
1004: *See above for details*.
1005:
1006: * ``tls`` (``bool``, ``pathlib.Path`` or ``str``): TLS configuration or
1007: ``False`` (default). *See above for details*.
1008:
1009: * ``read_timeout`` (``int``): How long to wait for messages from the QuestDB server
1010: during the TLS handshake or authentication process.
1011: This field is expressed in milliseconds. The default is 15 seconds.
1012:
1013: * ``init_capacity`` (``int``): Initial buffer capacity of the internal buffer.
1014: *See :class:`Buffer`'s constructor for more details.*
1015:
1016: * ``max_name_length`` (``int``): Maximum length of a table or column name.
1017: *See :class:`Buffer`'s constructor for more details.*
1018:
1019: * ``auto_flush`` (``bool`` or ``int``): Whether to automatically flush the
1020: buffer when it reaches a certain byte-size watermark.
1021: *See above for details.*
1022: """
1023:
1024: # We need the Buffer held by a Sender can hold a weakref to its Sender.
1025: # This avoids a circular reference that requires the GC to clean up.
1026: cdef object __weakref__
1027:
1028: cdef line_sender_opts* _opts
1029: cdef line_sender* _impl
1030: cdef Buffer _buffer
1031: cdef bint _auto_flush_enabled
1032: cdef ssize_t _auto_flush_watermark
1033: cdef size_t _init_capacity
1034: cdef size_t _max_name_len
1035:
+1036: 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; int __pyx_v_read_timeout; int __pyx_v_init_capacity; int __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, int __pyx_v_read_timeout, int __pyx_v_init_capacity, int __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_3); __Pyx_XDECREF(__pyx_t_4); __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; }
1037: self,
1038: str host,
1039: object port,
1040: *,
+1041: str interface=None,
values[2] = ((PyObject*)Py_None);
+1042: tuple auth=None,
values[3] = ((PyObject*)Py_None);
+1043: 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, 1036, __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, 1036, __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_int(values[5]); if (unlikely((__pyx_v_read_timeout == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1044, __pyx_L3_error) } else { __pyx_v_read_timeout = ((int)0x3A98); } if (values[6]) { __pyx_v_init_capacity = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_init_capacity == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1045, __pyx_L3_error) } else { __pyx_v_init_capacity = ((int)0x10000); } if (values[7]) { __pyx_v_max_name_len = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_max_name_len == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1046, __pyx_L3_error) } else { __pyx_v_max_name_len = ((int)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, 1036, __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, 1038, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interface), (&PyUnicode_Type), 1, "interface", 1))) __PYX_ERR(0, 1041, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_auth), (&PyTuple_Type), 1, "auth", 1))) __PYX_ERR(0, 1042, __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);
1044: int read_timeout=15000,
1045: int init_capacity=65536, # 64KiB
1046: int max_name_len=127,
1047: object auto_flush=64512): # 63KiB
+1048: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
1049:
1050: cdef line_sender_utf8 host_utf8
1051: cdef bytes host_owner
1052:
1053: cdef str port_str
1054: cdef line_sender_utf8 port_utf8
1055: cdef bytes port_owner
1056:
1057: cdef str interface_str
1058: cdef line_sender_utf8 interface_utf8
1059: cdef bytes interface_owner
1060:
1061: cdef str a_key_id
1062: cdef bytes a_key_id_owner
1063: cdef line_sender_utf8 a_key_id_utf8
1064:
1065: cdef str a_priv_key
1066: cdef bytes a_priv_key_owner
1067: cdef line_sender_utf8 a_priv_key_utf8
1068:
1069: cdef str a_pub_key_x
1070: cdef bytes a_pub_key_x_owner
1071: cdef line_sender_utf8 a_pub_key_x_utf8
1072:
1073: cdef str a_pub_key_y
1074: cdef bytes a_pub_key_y_owner
1075: cdef line_sender_utf8 a_pub_key_y_utf8
1076:
1077: cdef bytes ca_owner
1078: cdef line_sender_utf8 ca_utf8
1079:
+1080: self._opts = NULL
__pyx_v_self->_opts = NULL;
+1081: self._impl = NULL
__pyx_v_self->_impl = NULL;
+1082: 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);
1083:
+1084: if isinstance(port, int):
__pyx_t_1 = PyInt_Check(__pyx_v_port);
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
/* … */
goto __pyx_L3;
}
+1085: port_str = str(port)
__pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_port); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1085, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_port_str = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
+1086: elif isinstance(port, str):
__pyx_t_2 = PyUnicode_Check(__pyx_v_port);
__pyx_t_1 = (__pyx_t_2 != 0);
if (likely(__pyx_t_1)) {
/* … */
goto __pyx_L3;
}
+1087: 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, 1087, __pyx_L1_error) __pyx_t_3 = __pyx_v_port; __Pyx_INCREF(__pyx_t_3); __pyx_v_port_str = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
1088: else:
+1089: raise TypeError(
/*else*/ { /* … */ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1089, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 1089, __pyx_L1_error) } __pyx_L3:;
+1090: f'port must be an integer or a string, not {type(port)}')
__pyx_t_3 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_port)), __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyUnicode_Concat(__pyx_kp_u_port_must_be_an_integer_or_a_str, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1091:
+1092: host_owner = str_to_utf8(host, &host_utf8)
__pyx_t_3 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_host, (&__pyx_v_host_utf8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1092, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_host_owner = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
+1093: port_owner = str_to_utf8(port_str, &port_utf8)
__pyx_t_3 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_port_str, (&__pyx_v_port_utf8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1093, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_port_owner = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
+1094: 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);
1095:
+1096: if interface is not None:
__pyx_t_1 = (__pyx_v_interface != ((PyObject*)Py_None)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+1097: interface_owner = str_to_utf8(interface, &interface_utf8)
__pyx_t_3 = __pyx_f_7questdb_7ingress_str_to_utf8(__pyx_v_interface, (&__pyx_v_interface_utf8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1097, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_interface_owner = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0;
+1098: line_sender_opts_net_interface(self._opts, interface_utf8)
line_sender_opts_net_interface(__pyx_v_self->_opts, __pyx_v_interface_utf8);
1099:
+1100: if auth is not None:
__pyx_t_2 = (__pyx_v_auth != ((PyObject*)Py_None)); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
+1101: (a_key_id,
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, 1101, __pyx_L1_error) if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 1101, __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, 1101, __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, 1101, __pyx_L1_error) __pyx_v_a_key_id = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; __pyx_v_a_priv_key = ((PyObject*)__pyx_t_4); __pyx_t_4 = 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;
1102: a_priv_key,
1103: a_pub_key_x,
+1104: 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, 1101, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = 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_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else { Py_ssize_t i; PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_5,&__pyx_t_6}; for (i=0; i < 4; i++) { PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1101, __pyx_L1_error) __Pyx_GOTREF(item); *(temps[i]) = item; } } #endif } else { __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1101, __pyx_L1_error) }
+1105: 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, 1105, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_key_id_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1106: 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, 1106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_priv_key_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1107: 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, 1107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_pub_key_x_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1108: 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, 1108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_a_pub_key_y_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1109: 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);
1110: self._opts,
1111: a_key_id_utf8,
1112: a_priv_key_utf8,
1113: a_pub_key_x_utf8,
1114: a_pub_key_y_utf8)
1115:
+1116: if tls:
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_tls); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1116, __pyx_L1_error) if (__pyx_t_1) { /* … */ }
+1117: if tls is True:
__pyx_t_1 = (__pyx_v_tls == Py_True); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ goto __pyx_L7; }
+1118: line_sender_opts_tls(self._opts)
line_sender_opts_tls(__pyx_v_self->_opts);
+1119: elif isinstance(tls, str):
__pyx_t_2 = PyUnicode_Check(__pyx_v_tls);
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* … */
goto __pyx_L7;
}
+1120: 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, 1120, __pyx_L1_error) if (__pyx_t_1) { /* … */ goto __pyx_L8; }
+1121: line_sender_opts_tls_insecure_skip_verify(self._opts)
line_sender_opts_tls_insecure_skip_verify(__pyx_v_self->_opts);
1122: else:
+1123: 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, 1123, __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, 1123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_v_ca_owner = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0;
+1124: line_sender_opts_tls_ca(self._opts, ca_utf8)
line_sender_opts_tls_ca(__pyx_v_self->_opts, __pyx_v_ca_utf8); } __pyx_L8:;
+1125: elif isinstance(tls, pathlib.Path):
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pathlib); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1125, __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, 1125, __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, 1125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = (__pyx_t_1 != 0); if (likely(__pyx_t_2)) { /* … */ goto __pyx_L7; }
+1126: tls = str(tls)
__pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyUnicode_Type)), __pyx_v_tls); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF_SET(__pyx_v_tls, __pyx_t_5); __pyx_t_5 = 0;
+1127: 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, 1127, __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, 1127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_ca_owner = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0;
+1128: line_sender_opts_tls_ca(self._opts, ca_utf8)
line_sender_opts_tls_ca(__pyx_v_self->_opts, __pyx_v_ca_utf8);
1129: else:
+1130: raise TypeError(
/*else*/ { /* … */ __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __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, 1130, __pyx_L1_error) } __pyx_L7:;
+1131: '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, 1131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+1132: 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, 1132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5);
1133:
+1134: if read_timeout is not None:
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_read_timeout); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = (__pyx_t_5 != Py_None); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { /* … */ }
+1135: line_sender_opts_read_timeout(self._opts, read_timeout)
line_sender_opts_read_timeout(__pyx_v_self->_opts, __pyx_v_read_timeout);
1136:
+1137: self._init_capacity = init_capacity
__pyx_v_self->_init_capacity = __pyx_v_init_capacity;
+1138: self._max_name_len = max_name_len
__pyx_v_self->_max_name_len = __pyx_v_max_name_len;
1139:
+1140: 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, 1140, __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;
+1141: init_capacity=init_capacity,
__pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_init_capacity); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1141, __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, 1141, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1142: max_name_len=max_name_len)
__pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_max_name_len); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1142, __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, 1141, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1143:
+1144: 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, 1144, __pyx_L1_error) __pyx_v_self->_auto_flush_enabled = (!((!__pyx_t_1) != 0));
+1145: 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, 1145, __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, 1145, __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;
+1146: if self._auto_flush_enabled else 0
if ((__pyx_v_self->_auto_flush_enabled != 0)) {
+1147: if self._auto_flush_watermark < 0:
__pyx_t_1 = ((__pyx_v_self->_auto_flush_watermark < 0) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+1148: raise ValueError(
__pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1148, __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, 1148, __pyx_L1_error)
+1149: '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, 1149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1150: 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, 1150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6);
1151:
+1152: 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, 1152, __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, 1152, __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, 1152, __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, 1152, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 1152, __pyx_L1_error)
1153: """
1154: Make a new configured buffer.
1155:
1156: The buffer is set up with the configured `init_capacity` and
1157: `max_name_len`.
1158: """
+1159: 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, 1159, __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;
+1160: init_capacity=self._init_capacity,
__pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1160, __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, 1160, __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, 1160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+1161: 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, 1161, __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, 1160, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1162:
1163: @property
+1164: 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; }
1165: """The initial capacity of the sender's internal buffer."""
+1166: 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, 1166, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
1167:
1168: @property
+1169: 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; }
1170: """Maximum length of a table or column name."""
+1171: 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, 1171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
1172:
+1173: 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, 1173, __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, 1173, __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, 1173, __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, 1173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 1173, __pyx_L1_error)
1174: """
1175: Connect to the QuestDB server.
1176:
1177: This method is synchronous and will block until the connection is
1178: established.
1179:
1180: If the connection is set up with authentication and/or TLS, this
1181: method will return only *after* the handshake(s) is/are complete.
1182: """
+1183: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+1184: if self._opts == NULL:
__pyx_t_1 = ((__pyx_v_self->_opts == NULL) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+1185: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);
+1186: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1186, __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, 1186, __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, 1185, __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, 1185, __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, 1185, __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, 1185, __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, 1185, __pyx_L1_error)
1187: 'connect() can\'t be called after close().')
+1188: self._impl = line_sender_connect(self._opts, &err)
__pyx_v_self->_impl = line_sender_connect(__pyx_v_self->_opts, (&__pyx_v_err));
+1189: if self._impl == NULL:
__pyx_t_1 = ((__pyx_v_self->_impl == NULL) != 0); if (unlikely(__pyx_t_1)) { /* … */ }
+1190: 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, 1190, __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, 1190, __pyx_L1_error)
+1191: line_sender_opts_free(self._opts)
line_sender_opts_free(__pyx_v_self->_opts);
+1192: self._opts = NULL
__pyx_v_self->_opts = NULL;
1193:
1194: # Request callbacks when rows are complete.
+1195: 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) { /* … */ }
+1196: 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, 1196, __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;
1197:
+1198: def __enter__(self):
/* Python wrapper */ static PyObject *__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 PyObject *__pyx_pw_7questdb_7ingress_6Sender_7__enter__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__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 PyObject *__pyx_pf_7questdb_7ingress_6Sender_6__enter__(struct __pyx_obj_7questdb_7ingress_Sender *__pyx_v_self) { PyObject *__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(__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, 1198, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__50); __Pyx_GIVEREF(__pyx_tuple__50); /* … */ __pyx_t_4 = __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_4)) __PYX_ERR(0, 1198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem((PyObject *)__pyx_ptype_7questdb_7ingress_Sender->tp_dict, __pyx_n_s_enter, __pyx_t_4) < 0) __PYX_ERR(0, 1198, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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, 1198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 1198, __pyx_L1_error)
1199: """Call :func:`Sender.connect` at the start of a ``with`` block."""
+1200: self.connect()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_connect); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1200, __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, 1200, __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;
+1201: return self
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0;
1202:
+1203: 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; }
1204: """
1205: Inspect the contents of the internal buffer.
1206:
1207: The ``str`` value returned represents the unsent data.
1208:
1209: Also see :func:`Sender.__len__`.
1210: """
+1211: 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, 1211, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
1212:
+1213: def __len__(self):
/* 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; }
1214: """
1215: Number of bytes of unsent data in the internal buffer.
1216:
1217: Equivalent (but cheaper) to ``len(str(sender))``.
1218: """
+1219: 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, 1219, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0;
1220:
+1221: 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, 1221, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__52); __Pyx_GIVEREF(__pyx_tuple__52); /* … */ __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_table_name, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 1221, __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, 1221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __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_row, __pyx_t_3) < 0) __PYX_ERR(0, 1221, __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, 1221, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 1221, __pyx_L1_error)
1222: table_name: str,
1223: *,
+1224: symbols: Optional[Dict[str, str]]=None,
values[1] = ((PyObject *)Py_None); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Optional); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1224, __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, 1224, __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_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_symbols, __pyx_t_3) < 0) __PYX_ERR(0, 1221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+1225: columns: Optional[Dict[
__Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Optional); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1225, __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, 1225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); /* … */ __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1225, __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, 1225, __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, 1225, __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_4, __pyx_n_s_columns, __pyx_t_6) < 0) __PYX_ERR(0, 1221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1226: str,
+1227: Union[bool, int, float, str, TimestampMicros, datetime]]]=None,
values[2] = ((PyObject *)Py_None); /* … */ __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Union); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = PyTuple_New(6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1227, __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_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1227, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+1228: 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, 1221, __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, 1221, __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, 1222, __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, 1228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1228, __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, 1228, __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_4, __pyx_n_s_at, __pyx_t_3) < 0) __PYX_ERR(0, 1221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1229: """
1230: Write a row to the internal buffer.
1231:
1232: This may be sent automatically depending on the ``auto_flush`` setting
1233: in the constructor.
1234:
1235: Refer to the :func:`Buffer.row` documentation for details on arguments.
1236: """
+1237: 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, 1237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1237, __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, 1237, __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, 1237, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_columns, __pyx_v_columns) < 0) __PYX_ERR(0, 1237, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_at, __pyx_v_at) < 0) __PYX_ERR(0, 1237, __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, 1237, __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;
1238:
+1239: 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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __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, 1239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 1239, __pyx_L1_error) /* … */ struct __pyx_opt_args_7questdb_7ingress_6Sender_flush { int __pyx_n; struct __pyx_obj_7questdb_7ingress_Buffer *buffer; int clear; };
1240: """
1241: If called with no arguments, immediately flushes the internal buffer.
1242:
1243: Alternatively you can flush a buffer that was constructed explicitly
1244: by passing ``buffer``.
1245:
1246: The buffer will be cleared by default, unless ``clear`` is set to
1247: ``False``.
1248:
1249: This method does nothing if the provided or internal buffer is empty.
1250:
1251: :param buffer: The buffer to flush. If ``None``, the internal buffer
1252: is flushed.
1253:
1254: :param clear: If ``True``, the flushed buffer is cleared (default).
1255: If ``False``, the flushed buffer is left in the internal buffer.
1256: Note that ``clear=False`` is only supported if ``buffer`` is also
1257: specified.
1258: """
+1259: 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)) { /* … */ }
+1260: 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, 1260, __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, 1260, __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, 1260, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13);
1261:
+1262: cdef line_sender_error* err = NULL
__pyx_v_err = NULL;
+1263: cdef line_sender_buffer* c_buf = NULL
__pyx_v_c_buf = NULL;
+1264: if self._impl == NULL:
__pyx_t_8 = ((__pyx_v_self->_impl == NULL) != 0); if (unlikely(__pyx_t_8)) { /* … */ }
+1265: raise IngressError(
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_IngressError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1265, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2);
+1266: IngressErrorCode.InvalidApiCall,
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IngressErrorCode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1266, __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, 1266, __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, 1265, __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, 1265, __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, 1265, __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, 1265, __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, 1265, __pyx_L1_error)
1267: 'flush() can\'t be called: Not connected.')
+1268: 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; }
+1269: c_buf = buffer._impl
__pyx_t_11 = __pyx_v_buffer->_impl; __pyx_v_c_buf = __pyx_t_11;
1270: else:
+1271: c_buf = self._buffer._impl
/*else*/ { __pyx_t_11 = __pyx_v_self->_buffer->_impl; __pyx_v_c_buf = __pyx_t_11; } __pyx_L7:;
+1272: 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) { /* … */ }
+1273: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
1274:
+1275: 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:; }
+1276: if clear:
__pyx_t_10 = (__pyx_v_clear != 0); if (__pyx_t_10) { /* … */ goto __pyx_L15; }
+1277: 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)) { /* … */ }
+1278: 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, 1278, __pyx_L9_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, 1278, __pyx_L9_error)
1279: else:
+1280: 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:;
+1281: 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, 1281, __pyx_L9_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, 1281, __pyx_L9_error)
+1282: 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, 1282, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_3);
1283: # Prevent a follow-up call to `.close(flush=True)` (as is usually
1284: # called from `__exit__`) to raise after the sender entered an error
1285: # state following a failed call to `.flush()`.
+1286: if c_buf == self._buffer._impl:
__pyx_t_10 = ((__pyx_v_c_buf == __pyx_v_self->_buffer->_impl) != 0); if (__pyx_t_10) { /* … */ }
+1287: line_sender_buffer_clear(c_buf)
line_sender_buffer_clear(__pyx_v_c_buf);
+1288: 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, 1288, __pyx_L11_except_error) } __pyx_L11_except_error:;
1289:
+1290: 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; }
+1291: 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);
+1292: line_sender_opts_free(self._opts)
line_sender_opts_free(__pyx_v_self->_opts);
+1293: self._opts = NULL
__pyx_v_self->_opts = NULL;
+1294: line_sender_close(self._impl)
line_sender_close(__pyx_v_self->_impl);
+1295: self._impl = NULL
__pyx_v_self->_impl = NULL;
1296:
+1297: 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, 1297, __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, 1297, __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, 1297, __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, 1297, __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, 1297, __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, 1297, __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, 1297, __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, 1297, __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, 1297, __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, 1297, __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, 1297, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 1297, __pyx_L1_error) /* … */ struct __pyx_opt_args_7questdb_7ingress_6Sender_close { int __pyx_n; int flush; };
1298: """
1299: Disconnect.
1300:
1301: This method is idempotent and can be called repeatedly.
1302:
1303: Once a sender is closed, it can't be re-used.
1304:
1305: :param bool flush: If ``True``, flush the internal buffer before closing.
1306: """
+1307: try:
/*try:*/ {
+1308: 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) { /* … */ } }
+1309: (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:;
+1310: 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, 1310, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1311: finally:
+1312: 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, 1312, __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, 1312, __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:; }
1313:
+1314: 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, 1314, __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, 1314, __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, 1314, __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, 1314, __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, 1314, __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, 1314, __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, 1314, __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, 1314, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 1314, __pyx_L1_error)
1315: """
1316: Flush pending and disconnect at the end of a ``with`` block.
1317:
1318: If the ``with`` block raises an exception, any pending data will
1319: *NOT* be flushed.
1320:
1321: This is implemented by calling :func:`Sender.close`.
1322: """
+1323: self.close(not exc_type)
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_exc_type); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1323, __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, 1323, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1324:
+1325: 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(); }
+1326: 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, 1326, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;