From 0fd36e395dbe05fb77a4e76bc6ea4c83597d86ff Mon Sep 17 00:00:00 2001 From: Jianjian Huo Date: Tue, 2 Jul 2024 08:37:12 -0700 Subject: [PATCH] common: move memcached exceptions to the base file. Change-Id: I022404cd90d9755a09c20619c3a72588d3367467 --- swift/common/exceptions.py | 12 ++++++++++++ swift/common/memcached.py | 14 ++------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/swift/common/exceptions.py b/swift/common/exceptions.py index 8e825ef967..af61c25f05 100644 --- a/swift/common/exceptions.py +++ b/swift/common/exceptions.py @@ -243,6 +243,18 @@ class QuarantineRequest(SwiftException): pass +class MemcacheConnectionError(Exception): + pass + + +class MemcacheIncrNotFoundError(MemcacheConnectionError): + pass + + +class MemcachePoolTimeout(Timeout): + pass + + class ClientException(Exception): def __init__(self, msg, http_scheme='', http_host='', http_port='', diff --git a/swift/common/memcached.py b/swift/common/memcached.py index 3175b09aa0..68f3424c76 100644 --- a/swift/common/memcached.py +++ b/swift/common/memcached.py @@ -59,6 +59,8 @@ from eventlet import Timeout from six.moves import range from six.moves.configparser import ConfigParser, NoSectionError, NoOptionError from swift.common import utils +from swift.common.exceptions import MemcacheConnectionError, \ + MemcacheIncrNotFoundError, MemcachePoolTimeout from swift.common.utils import md5, human_readable, config_true_value, \ memcached_timing_stats @@ -122,18 +124,6 @@ def set_msg(key, flags, timeout, value): ]) + (b'\r\n' + value + b'\r\n') -class MemcacheConnectionError(Exception): - pass - - -class MemcacheIncrNotFoundError(MemcacheConnectionError): - pass - - -class MemcachePoolTimeout(Timeout): - pass - - class MemcacheConnPool(Pool): """ Connection pool for Memcache Connections