Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: speed up ServiceInfo with a cython pxd (#1264)
- Loading branch information
Showing
3 changed files
with
128 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
|
||
import cython | ||
|
||
from .._cache cimport DNSCache | ||
from .._dns cimport DNSPointer, DNSRecord, DNSService, DNSText | ||
from .._protocol.outgoing cimport DNSOutgoing | ||
from .._updates cimport RecordUpdateListener | ||
from .._utils.time cimport current_time_millis | ||
|
||
|
||
cdef object _resolve_all_futures_to_none | ||
|
||
cdef object _TYPE_SRV | ||
cdef object _TYPE_TXT | ||
cdef object _TYPE_A | ||
cdef object _TYPE_AAAA | ||
cdef object _TYPE_PTR | ||
cdef object _TYPE_NSEC | ||
cdef object _CLASS_IN | ||
cdef object _FLAGS_QR_QUERY | ||
|
||
cdef object service_type_name | ||
|
||
cdef object DNS_QUESTION_TYPE_QU | ||
cdef object DNS_QUESTION_TYPE_QM | ||
|
||
cdef object _IPVersion_All_value | ||
cdef object _IPVersion_V4Only_value | ||
|
||
cdef object TYPE_CHECKING | ||
|
||
cdef class ServiceInfo(RecordUpdateListener): | ||
|
||
cdef public cython.bytes text | ||
cdef public str type | ||
cdef str _name | ||
cdef public str key | ||
cdef public cython.list _ipv4_addresses | ||
cdef public cython.list _ipv6_addresses | ||
cdef public object port | ||
cdef public object weight | ||
cdef public object priority | ||
cdef public str server | ||
cdef public str server_key | ||
cdef public cython.dict _properties | ||
cdef public object host_ttl | ||
cdef public object other_ttl | ||
cdef public object interface_index | ||
cdef public cython.set _new_records_futures | ||
cdef public DNSPointer _dns_pointer_cache | ||
cdef public DNSService _dns_service_cache | ||
cdef public DNSText _dns_text_cache | ||
cdef public cython.list _dns_address_cache | ||
cdef public cython.set _get_address_and_nsec_records_cache | ||
|
||
@cython.locals( | ||
cache=DNSCache | ||
) | ||
cpdef async_update_records(self, object zc, object now, cython.list records) | ||
|
||
@cython.locals( | ||
cache=DNSCache | ||
) | ||
cpdef _load_from_cache(self, object zc, object now) | ||
|
||
cdef _unpack_text_into_properties(self) | ||
|
||
cdef _set_properties(self, cython.dict properties) | ||
|
||
cdef _set_text(self, cython.bytes text) | ||
|
||
cdef _get_ip_addresses_from_cache_lifo(self, object zc, object now, object type) | ||
|
||
cdef _process_record_threadsafe(self, object zc, DNSRecord record, object now) | ||
|
||
@cython.locals( | ||
cache=DNSCache | ||
) | ||
cdef cython.list _get_address_records_from_cache_by_type(self, object zc, object _type) | ||
|
||
cdef _set_ipv4_addresses_from_cache(self, object zc, object now) | ||
|
||
cdef _set_ipv6_addresses_from_cache(self, object zc, object now) | ||
|
||
cdef cython.list _ip_addresses_by_version_value(self, object version_value) | ||
|
||
cdef addresses_by_version(self, object version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters