apache-ignite
/
communication.py
73 строки · 2.5 Кб
1# Licensed to the Apache Software Foundation (ASF) under one or more
2# contributor license agreements. See the NOTICE file distributed with
3# this work for additional information regarding copyright ownership.
4# The ASF licenses this file to You under the Apache License, Version 2.0
5# (the "License"); you may not use this file except in compliance with
6# the License. You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License
15
16"""
17Module contains classes and utility methods to create communication configuration for ignite nodes.
18"""
19
20from abc import ABCMeta, abstractmethod
21
22
23class CommunicationSpi(metaclass=ABCMeta):
24"""
25Abstract class for CommunicationSpi.
26"""
27@property
28@abstractmethod
29def type(self):
30"""
31Type of CommunicationSpi.
32"""
33
34@property
35@abstractmethod
36def class_name(self):
37"""
38Class name of CommunicationSpi.
39"""
40
41
42class TcpCommunicationSpi(CommunicationSpi):
43"""
44TcpCommunicationSpi.
45"""
46
47def __init__(self,
48local_port=47100,
49local_port_range=100,
50idle_connection_timeout: int = None,
51socket_write_timeout: int = None,
52selectors_count: int = None,
53connections_per_node: int = None,
54use_paired_connections: bool = None,
55message_queue_limit: int = None,
56unacknowledged_messages_buffer_size: int = None):
57self.local_port = local_port
58self.local_port_range = local_port_range
59self.idle_connection_timeout: int = idle_connection_timeout
60self.socket_write_timeout: int = socket_write_timeout
61self.selectors_count: int = selectors_count
62self.connections_per_node: int = connections_per_node
63self.use_paired_connections: bool = use_paired_connections
64self.message_queue_limit: int = message_queue_limit
65self.unacknowledged_messages_buffer_size: int = unacknowledged_messages_buffer_size
66
67@property
68def class_name(self):
69return "org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi"
70
71@property
72def type(self):
73return "TCP"
74