mirror of
https://github.com/accumulator/charge-lnd.git
synced 2026-08-13 12:33:01 +02:00
Add circuitbreaker v0.5.1 protos and grpc generated
This commit is contained in:
parent
481ccf5282
commit
495b27e7ba
3 changed files with 548 additions and 0 deletions
80
charge_lnd/grpc_generated/circuitbreaker_pb2.py
Normal file
80
charge_lnd/grpc_generated/circuitbreaker_pb2.py
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: circuitbreaker.proto
|
||||
# Protobuf Python Version: 5.26.1
|
||||
"""Generated protocol buffer code."""
|
||||
from google.protobuf import descriptor as _descriptor
|
||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||
from google.protobuf import symbol_database as _symbol_database
|
||||
from google.protobuf.internal import builder as _builder
|
||||
# @@protoc_insertion_point(imports)
|
||||
|
||||
_sym_db = _symbol_database.Default()
|
||||
|
||||
|
||||
from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
|
||||
|
||||
|
||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14\x63ircuitbreaker.proto\x12\x0e\x63ircuitbreaker\x1a\x1cgoogle/api/annotations.proto\"\x10\n\x0eGetInfoRequest\"^\n\x0fGetInfoResponse\x12\x10\n\x08node_key\x18\x01 \x01(\t\x12\x12\n\nnode_alias\x18\x02 \x01(\t\x12\x14\n\x0cnode_version\x18\x03 \x01(\t\x12\x0f\n\x07version\x18\x04 \x01(\t\"#\n\x12\x43learLimitsRequest\x12\r\n\x05nodes\x18\x01 \x03(\t\"\x15\n\x13\x43learLimitsResponse\"\x9c\x01\n\x13UpdateLimitsRequest\x12?\n\x06limits\x18\x01 \x03(\x0b\x32/.circuitbreaker.UpdateLimitsRequest.LimitsEntry\x1a\x44\n\x0bLimitsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12$\n\x05value\x18\x02 \x01(\x0b\x32\x15.circuitbreaker.Limit:\x02\x38\x01\"\x16\n\x14UpdateLimitsResponse\"A\n\x19UpdateDefaultLimitRequest\x12$\n\x05limit\x18\x01 \x01(\x0b\x32\x15.circuitbreaker.Limit\"\x1c\n\x1aUpdateDefaultLimitResponse\"\x13\n\x11ListLimitsRequest\"m\n\x12ListLimitsResponse\x12)\n\x06limits\x18\x05 \x03(\x0b\x32\x19.circuitbreaker.NodeLimit\x12,\n\rdefault_limit\x18\x02 \x01(\x0b\x32\x15.circuitbreaker.Limit\"\xd8\x01\n\tNodeLimit\x12\x0c\n\x04node\x18\x01 \x01(\t\x12\r\n\x05\x61lias\x18\x05 \x01(\t\x12$\n\x05limit\x18\x02 \x01(\x0b\x32\x15.circuitbreaker.Limit\x12+\n\ncounter_1h\x18\x03 \x01(\x0b\x32\x17.circuitbreaker.Counter\x12,\n\x0b\x63ounter_24h\x18\x04 \x01(\x0b\x32\x17.circuitbreaker.Counter\x12\x11\n\tqueue_len\x18\x06 \x01(\x03\x12\x1a\n\x12pending_htlc_count\x18\x07 \x01(\x03\"Y\n\x05Limit\x12\x17\n\x0fmax_hourly_rate\x18\x03 \x01(\x03\x12\x13\n\x0bmax_pending\x18\x05 \x01(\x03\x12\"\n\x04mode\x18\x06 \x01(\x0e\x32\x14.circuitbreaker.Mode\"8\n\x07\x43ounter\x12\x0c\n\x04\x66\x61il\x18\x01 \x01(\x03\x12\x0f\n\x07success\x18\x02 \x01(\x03\x12\x0e\n\x06reject\x18\x03 \x01(\x03\"R\n\x1cListForwardingHistoryRequest\x12\x19\n\x11\x61\x64\x64_start_time_ns\x18\x01 \x01(\x03\x12\x17\n\x0f\x61\x64\x64_end_time_ns\x18\x02 \x01(\x03\"J\n\x1dListForwardingHistoryResponse\x12)\n\x08\x66orwards\x18\x01 \x03(\x0b\x32\x17.circuitbreaker.Forward\":\n\nCircuitKey\x12\x18\n\x10short_channel_id\x18\x01 \x01(\x04\x12\x12\n\nhtlc_index\x18\x02 \x01(\r\"\x94\x02\n\x07\x46orward\x12\x13\n\x0b\x61\x64\x64_time_ns\x18\x01 \x01(\x04\x12\x17\n\x0fresolve_time_ns\x18\x02 \x01(\x04\x12\x0f\n\x07settled\x18\x03 \x01(\x08\x12\x17\n\x0fincoming_amount\x18\x04 \x01(\x04\x12\x17\n\x0foutgoing_amount\x18\x05 \x01(\x04\x12\x15\n\rincoming_peer\x18\x06 \x01(\t\x12\x34\n\x10incoming_circuit\x18\x07 \x01(\x0b\x32\x1a.circuitbreaker.CircuitKey\x12\x15\n\routgoing_peer\x18\x08 \x01(\t\x12\x34\n\x10outgoing_circuit\x18\t \x01(\x0b\x32\x1a.circuitbreaker.CircuitKey*T\n\x04Mode\x12\r\n\tMODE_FAIL\x10\x00\x12\x0e\n\nMODE_QUEUE\x10\x01\x12\x1d\n\x19MODE_QUEUE_PEER_INITIATED\x10\x02\x12\x0e\n\nMODE_BLOCK\x10\x03\x32\xd2\x05\n\x07Service\x12Y\n\x07GetInfo\x12\x1e.circuitbreaker.GetInfoRequest\x1a\x1f.circuitbreaker.GetInfoResponse\"\r\x82\xd3\xe4\x93\x02\x07\x12\x05/info\x12s\n\x0cUpdateLimits\x12#.circuitbreaker.UpdateLimitsRequest\x1a$.circuitbreaker.UpdateLimitsResponse\"\x18\x82\xd3\xe4\x93\x02\x12\"\r/updatelimits:\x01*\x12o\n\x0b\x43learLimits\x12\".circuitbreaker.ClearLimitsRequest\x1a#.circuitbreaker.ClearLimitsResponse\"\x17\x82\xd3\xe4\x93\x02\x11\"\x0c/clearlimits:\x01*\x12\x8b\x01\n\x12UpdateDefaultLimit\x12).circuitbreaker.UpdateDefaultLimitRequest\x1a*.circuitbreaker.UpdateDefaultLimitResponse\"\x1e\x82\xd3\xe4\x93\x02\x18\"\x13/updatedefaultlimit:\x01*\x12\x64\n\nListLimits\x12!.circuitbreaker.ListLimitsRequest\x1a\".circuitbreaker.ListLimitsResponse\"\x0f\x82\xd3\xe4\x93\x02\t\x12\x07/limits\x12\x91\x01\n\x15ListForwardingHistory\x12,.circuitbreaker.ListForwardingHistoryRequest\x1a-.circuitbreaker.ListForwardingHistoryResponse\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/forwarding_historyB@Z>github.com/lightningequipment/circuitbreaker/circuitbreakerrpcb\x06proto3')
|
||||
|
||||
_globals = globals()
|
||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'circuitbreaker_pb2', _globals)
|
||||
if not _descriptor._USE_C_DESCRIPTORS:
|
||||
_globals['DESCRIPTOR']._loaded_options = None
|
||||
_globals['DESCRIPTOR']._serialized_options = b'Z>github.com/lightningequipment/circuitbreaker/circuitbreakerrpc'
|
||||
_globals['_UPDATELIMITSREQUEST_LIMITSENTRY']._loaded_options = None
|
||||
_globals['_UPDATELIMITSREQUEST_LIMITSENTRY']._serialized_options = b'8\001'
|
||||
_globals['_SERVICE'].methods_by_name['GetInfo']._loaded_options = None
|
||||
_globals['_SERVICE'].methods_by_name['GetInfo']._serialized_options = b'\202\323\344\223\002\007\022\005/info'
|
||||
_globals['_SERVICE'].methods_by_name['UpdateLimits']._loaded_options = None
|
||||
_globals['_SERVICE'].methods_by_name['UpdateLimits']._serialized_options = b'\202\323\344\223\002\022\"\r/updatelimits:\001*'
|
||||
_globals['_SERVICE'].methods_by_name['ClearLimits']._loaded_options = None
|
||||
_globals['_SERVICE'].methods_by_name['ClearLimits']._serialized_options = b'\202\323\344\223\002\021\"\014/clearlimits:\001*'
|
||||
_globals['_SERVICE'].methods_by_name['UpdateDefaultLimit']._loaded_options = None
|
||||
_globals['_SERVICE'].methods_by_name['UpdateDefaultLimit']._serialized_options = b'\202\323\344\223\002\030\"\023/updatedefaultlimit:\001*'
|
||||
_globals['_SERVICE'].methods_by_name['ListLimits']._loaded_options = None
|
||||
_globals['_SERVICE'].methods_by_name['ListLimits']._serialized_options = b'\202\323\344\223\002\t\022\007/limits'
|
||||
_globals['_SERVICE'].methods_by_name['ListForwardingHistory']._loaded_options = None
|
||||
_globals['_SERVICE'].methods_by_name['ListForwardingHistory']._serialized_options = b'\202\323\344\223\002\025\022\023/forwarding_history'
|
||||
_globals['_MODE']._serialized_start=1523
|
||||
_globals['_MODE']._serialized_end=1607
|
||||
_globals['_GETINFOREQUEST']._serialized_start=70
|
||||
_globals['_GETINFOREQUEST']._serialized_end=86
|
||||
_globals['_GETINFORESPONSE']._serialized_start=88
|
||||
_globals['_GETINFORESPONSE']._serialized_end=182
|
||||
_globals['_CLEARLIMITSREQUEST']._serialized_start=184
|
||||
_globals['_CLEARLIMITSREQUEST']._serialized_end=219
|
||||
_globals['_CLEARLIMITSRESPONSE']._serialized_start=221
|
||||
_globals['_CLEARLIMITSRESPONSE']._serialized_end=242
|
||||
_globals['_UPDATELIMITSREQUEST']._serialized_start=245
|
||||
_globals['_UPDATELIMITSREQUEST']._serialized_end=401
|
||||
_globals['_UPDATELIMITSREQUEST_LIMITSENTRY']._serialized_start=333
|
||||
_globals['_UPDATELIMITSREQUEST_LIMITSENTRY']._serialized_end=401
|
||||
_globals['_UPDATELIMITSRESPONSE']._serialized_start=403
|
||||
_globals['_UPDATELIMITSRESPONSE']._serialized_end=425
|
||||
_globals['_UPDATEDEFAULTLIMITREQUEST']._serialized_start=427
|
||||
_globals['_UPDATEDEFAULTLIMITREQUEST']._serialized_end=492
|
||||
_globals['_UPDATEDEFAULTLIMITRESPONSE']._serialized_start=494
|
||||
_globals['_UPDATEDEFAULTLIMITRESPONSE']._serialized_end=522
|
||||
_globals['_LISTLIMITSREQUEST']._serialized_start=524
|
||||
_globals['_LISTLIMITSREQUEST']._serialized_end=543
|
||||
_globals['_LISTLIMITSRESPONSE']._serialized_start=545
|
||||
_globals['_LISTLIMITSRESPONSE']._serialized_end=654
|
||||
_globals['_NODELIMIT']._serialized_start=657
|
||||
_globals['_NODELIMIT']._serialized_end=873
|
||||
_globals['_LIMIT']._serialized_start=875
|
||||
_globals['_LIMIT']._serialized_end=964
|
||||
_globals['_COUNTER']._serialized_start=966
|
||||
_globals['_COUNTER']._serialized_end=1022
|
||||
_globals['_LISTFORWARDINGHISTORYREQUEST']._serialized_start=1024
|
||||
_globals['_LISTFORWARDINGHISTORYREQUEST']._serialized_end=1106
|
||||
_globals['_LISTFORWARDINGHISTORYRESPONSE']._serialized_start=1108
|
||||
_globals['_LISTFORWARDINGHISTORYRESPONSE']._serialized_end=1182
|
||||
_globals['_CIRCUITKEY']._serialized_start=1184
|
||||
_globals['_CIRCUITKEY']._serialized_end=1242
|
||||
_globals['_FORWARD']._serialized_start=1245
|
||||
_globals['_FORWARD']._serialized_end=1521
|
||||
_globals['_SERVICE']._serialized_start=1610
|
||||
_globals['_SERVICE']._serialized_end=2332
|
||||
# @@protoc_insertion_point(module_scope)
|
||||
317
charge_lnd/grpc_generated/circuitbreaker_pb2_grpc.py
Normal file
317
charge_lnd/grpc_generated/circuitbreaker_pb2_grpc.py
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
"""Client and server classes corresponding to protobuf-defined services."""
|
||||
import grpc
|
||||
import warnings
|
||||
|
||||
from . import circuitbreaker_pb2 as circuitbreaker__pb2
|
||||
|
||||
GRPC_GENERATED_VERSION = '1.63.0'
|
||||
GRPC_VERSION = grpc.__version__
|
||||
EXPECTED_ERROR_RELEASE = '1.65.0'
|
||||
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
|
||||
_version_not_supported = False
|
||||
|
||||
try:
|
||||
from grpc._utilities import first_version_is_lower
|
||||
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
||||
except ImportError:
|
||||
_version_not_supported = True
|
||||
|
||||
if _version_not_supported:
|
||||
warnings.warn(
|
||||
f'The grpc package installed is at version {GRPC_VERSION},'
|
||||
+ f' but the generated code in circuitbreaker_pb2_grpc.py depends on'
|
||||
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
||||
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
||||
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
||||
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
|
||||
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
|
||||
RuntimeWarning
|
||||
)
|
||||
|
||||
|
||||
class ServiceStub(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def __init__(self, channel):
|
||||
"""Constructor.
|
||||
|
||||
Args:
|
||||
channel: A grpc.Channel.
|
||||
"""
|
||||
self.GetInfo = channel.unary_unary(
|
||||
'/circuitbreaker.Service/GetInfo',
|
||||
request_serializer=circuitbreaker__pb2.GetInfoRequest.SerializeToString,
|
||||
response_deserializer=circuitbreaker__pb2.GetInfoResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.UpdateLimits = channel.unary_unary(
|
||||
'/circuitbreaker.Service/UpdateLimits',
|
||||
request_serializer=circuitbreaker__pb2.UpdateLimitsRequest.SerializeToString,
|
||||
response_deserializer=circuitbreaker__pb2.UpdateLimitsResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.ClearLimits = channel.unary_unary(
|
||||
'/circuitbreaker.Service/ClearLimits',
|
||||
request_serializer=circuitbreaker__pb2.ClearLimitsRequest.SerializeToString,
|
||||
response_deserializer=circuitbreaker__pb2.ClearLimitsResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.UpdateDefaultLimit = channel.unary_unary(
|
||||
'/circuitbreaker.Service/UpdateDefaultLimit',
|
||||
request_serializer=circuitbreaker__pb2.UpdateDefaultLimitRequest.SerializeToString,
|
||||
response_deserializer=circuitbreaker__pb2.UpdateDefaultLimitResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.ListLimits = channel.unary_unary(
|
||||
'/circuitbreaker.Service/ListLimits',
|
||||
request_serializer=circuitbreaker__pb2.ListLimitsRequest.SerializeToString,
|
||||
response_deserializer=circuitbreaker__pb2.ListLimitsResponse.FromString,
|
||||
_registered_method=True)
|
||||
self.ListForwardingHistory = channel.unary_unary(
|
||||
'/circuitbreaker.Service/ListForwardingHistory',
|
||||
request_serializer=circuitbreaker__pb2.ListForwardingHistoryRequest.SerializeToString,
|
||||
response_deserializer=circuitbreaker__pb2.ListForwardingHistoryResponse.FromString,
|
||||
_registered_method=True)
|
||||
|
||||
|
||||
class ServiceServicer(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
def GetInfo(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def UpdateLimits(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def ClearLimits(self, request, context):
|
||||
"""Clear specific limits and use default.
|
||||
"""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def UpdateDefaultLimit(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def ListLimits(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
def ListForwardingHistory(self, request, context):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
|
||||
def add_ServiceServicer_to_server(servicer, server):
|
||||
rpc_method_handlers = {
|
||||
'GetInfo': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.GetInfo,
|
||||
request_deserializer=circuitbreaker__pb2.GetInfoRequest.FromString,
|
||||
response_serializer=circuitbreaker__pb2.GetInfoResponse.SerializeToString,
|
||||
),
|
||||
'UpdateLimits': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.UpdateLimits,
|
||||
request_deserializer=circuitbreaker__pb2.UpdateLimitsRequest.FromString,
|
||||
response_serializer=circuitbreaker__pb2.UpdateLimitsResponse.SerializeToString,
|
||||
),
|
||||
'ClearLimits': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.ClearLimits,
|
||||
request_deserializer=circuitbreaker__pb2.ClearLimitsRequest.FromString,
|
||||
response_serializer=circuitbreaker__pb2.ClearLimitsResponse.SerializeToString,
|
||||
),
|
||||
'UpdateDefaultLimit': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.UpdateDefaultLimit,
|
||||
request_deserializer=circuitbreaker__pb2.UpdateDefaultLimitRequest.FromString,
|
||||
response_serializer=circuitbreaker__pb2.UpdateDefaultLimitResponse.SerializeToString,
|
||||
),
|
||||
'ListLimits': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.ListLimits,
|
||||
request_deserializer=circuitbreaker__pb2.ListLimitsRequest.FromString,
|
||||
response_serializer=circuitbreaker__pb2.ListLimitsResponse.SerializeToString,
|
||||
),
|
||||
'ListForwardingHistory': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.ListForwardingHistory,
|
||||
request_deserializer=circuitbreaker__pb2.ListForwardingHistoryRequest.FromString,
|
||||
response_serializer=circuitbreaker__pb2.ListForwardingHistoryResponse.SerializeToString,
|
||||
),
|
||||
}
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
'circuitbreaker.Service', rpc_method_handlers)
|
||||
server.add_generic_rpc_handlers((generic_handler,))
|
||||
|
||||
|
||||
# This class is part of an EXPERIMENTAL API.
|
||||
class Service(object):
|
||||
"""Missing associated documentation comment in .proto file."""
|
||||
|
||||
@staticmethod
|
||||
def GetInfo(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/circuitbreaker.Service/GetInfo',
|
||||
circuitbreaker__pb2.GetInfoRequest.SerializeToString,
|
||||
circuitbreaker__pb2.GetInfoResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def UpdateLimits(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/circuitbreaker.Service/UpdateLimits',
|
||||
circuitbreaker__pb2.UpdateLimitsRequest.SerializeToString,
|
||||
circuitbreaker__pb2.UpdateLimitsResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def ClearLimits(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/circuitbreaker.Service/ClearLimits',
|
||||
circuitbreaker__pb2.ClearLimitsRequest.SerializeToString,
|
||||
circuitbreaker__pb2.ClearLimitsResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def UpdateDefaultLimit(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/circuitbreaker.Service/UpdateDefaultLimit',
|
||||
circuitbreaker__pb2.UpdateDefaultLimitRequest.SerializeToString,
|
||||
circuitbreaker__pb2.UpdateDefaultLimitResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def ListLimits(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/circuitbreaker.Service/ListLimits',
|
||||
circuitbreaker__pb2.ListLimitsRequest.SerializeToString,
|
||||
circuitbreaker__pb2.ListLimitsResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
|
||||
@staticmethod
|
||||
def ListForwardingHistory(request,
|
||||
target,
|
||||
options=(),
|
||||
channel_credentials=None,
|
||||
call_credentials=None,
|
||||
insecure=False,
|
||||
compression=None,
|
||||
wait_for_ready=None,
|
||||
timeout=None,
|
||||
metadata=None):
|
||||
return grpc.experimental.unary_unary(
|
||||
request,
|
||||
target,
|
||||
'/circuitbreaker.Service/ListForwardingHistory',
|
||||
circuitbreaker__pb2.ListForwardingHistoryRequest.SerializeToString,
|
||||
circuitbreaker__pb2.ListForwardingHistoryResponse.FromString,
|
||||
options,
|
||||
channel_credentials,
|
||||
insecure,
|
||||
call_credentials,
|
||||
compression,
|
||||
wait_for_ready,
|
||||
timeout,
|
||||
metadata,
|
||||
_registered_method=True)
|
||||
151
proto/circuitbreaker.proto
Normal file
151
proto/circuitbreaker.proto
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package circuitbreaker;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "github.com/lightningequipment/circuitbreaker/circuitbreakerrpc";
|
||||
|
||||
service Service {
|
||||
rpc GetInfo (GetInfoRequest) returns (GetInfoResponse) {
|
||||
option (google.api.http) = {
|
||||
get:"/info"
|
||||
};
|
||||
}
|
||||
|
||||
rpc UpdateLimits (UpdateLimitsRequest) returns (UpdateLimitsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/updatelimits"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
// Clear specific limits and use default.
|
||||
rpc ClearLimits (ClearLimitsRequest) returns (ClearLimitsResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/clearlimits"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc UpdateDefaultLimit (UpdateDefaultLimitRequest) returns (UpdateDefaultLimitResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/updatedefaultlimit"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ListLimits (ListLimitsRequest) returns (ListLimitsResponse) {
|
||||
option (google.api.http) = {
|
||||
get:"/limits"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ListForwardingHistory (ListForwardingHistoryRequest) returns (ListForwardingHistoryResponse) {
|
||||
option (google.api.http) = {
|
||||
get:"/forwarding_history"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message GetInfoRequest {}
|
||||
|
||||
message GetInfoResponse {
|
||||
string node_key = 1;
|
||||
string node_alias = 2;
|
||||
string node_version = 3;
|
||||
|
||||
string version = 4;
|
||||
}
|
||||
|
||||
enum Mode {
|
||||
MODE_FAIL = 0;
|
||||
MODE_QUEUE = 1;
|
||||
MODE_QUEUE_PEER_INITIATED = 2;
|
||||
MODE_BLOCK = 3;
|
||||
}
|
||||
|
||||
message ClearLimitsRequest {
|
||||
repeated string nodes = 1;
|
||||
}
|
||||
|
||||
message ClearLimitsResponse {}
|
||||
|
||||
message UpdateLimitsRequest {
|
||||
map<string, Limit> limits = 1;
|
||||
}
|
||||
|
||||
message UpdateLimitsResponse {}
|
||||
|
||||
message UpdateDefaultLimitRequest {
|
||||
Limit limit = 1;
|
||||
}
|
||||
|
||||
message UpdateDefaultLimitResponse {}
|
||||
|
||||
message ListLimitsRequest {}
|
||||
|
||||
message ListLimitsResponse {
|
||||
repeated NodeLimit limits = 5;
|
||||
|
||||
Limit default_limit = 2;
|
||||
}
|
||||
|
||||
message NodeLimit {
|
||||
string node = 1;
|
||||
string alias = 5;
|
||||
|
||||
// The default limit applies if limit is not set.
|
||||
Limit limit = 2;
|
||||
|
||||
Counter counter_1h = 3;
|
||||
Counter counter_24h = 4;
|
||||
int64 queue_len = 6;
|
||||
int64 pending_htlc_count = 7;
|
||||
}
|
||||
|
||||
message Limit {
|
||||
int64 max_hourly_rate = 3;
|
||||
int64 max_pending = 5;
|
||||
Mode mode = 6;
|
||||
}
|
||||
|
||||
message Counter {
|
||||
int64 fail = 1;
|
||||
int64 success = 2;
|
||||
int64 reject = 3;
|
||||
}
|
||||
|
||||
message ListForwardingHistoryRequest {
|
||||
// The inclusive start time for the query, used to filter HTLCs by the time they were added
|
||||
// to local incoming channel. If this value is zero, it will be treated as the unix epoch.
|
||||
int64 add_start_time_ns = 1;
|
||||
|
||||
// The exclusive end time for the query, used to filter HTLCs by the time they were added to
|
||||
// the local incoming channel. If this value is zero, it will be assumed to be the current time.
|
||||
int64 add_end_time_ns = 2;
|
||||
}
|
||||
|
||||
message ListForwardingHistoryResponse {
|
||||
repeated Forward forwards = 1;
|
||||
}
|
||||
|
||||
message CircuitKey {
|
||||
uint64 short_channel_id = 1;
|
||||
uint32 htlc_index = 2;
|
||||
}
|
||||
|
||||
message Forward {
|
||||
// The time that the htlc was added to the incoming channel. Note that this value
|
||||
// may be zero if circuitbreaker restarted while the htlc was in flight - this
|
||||
// indicates that the value is unknown.
|
||||
uint64 add_time_ns = 1;
|
||||
uint64 resolve_time_ns = 2;
|
||||
bool settled = 3;
|
||||
uint64 incoming_amount = 4;
|
||||
uint64 outgoing_amount = 5;
|
||||
string incoming_peer = 6;
|
||||
CircuitKey incoming_circuit = 7;
|
||||
string outgoing_peer = 8;
|
||||
CircuitKey outgoing_circuit = 9;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue