feat(phase1): add image storage utilities
- Create backend/services/image_storage.py with 4 core functions:
- sanitize_filename(): remove unsafe chars, limit to 255 chars, convert to lowercase
- get_unique_filename(): handle collisions with UUID suffix (format: {name}_{uuid8}_{variant}.jpg)
- ensure_image_directories(): create /images/ root and category subdirs on startup
- save_image(): save bytes to /images/{category}/{filename}, returns relative path
- Create comprehensive test suite (22 tests) covering all functionality
- Integrate ensure_image_directories() into FastAPI startup event
- Directory structure: /images/{category}/{filename}
- Collision handling: auto-suffix with UUID if filename exists
- All tests passing, pathlib.Path for safe operations
This commit is contained in:
33
venv/lib/python3.12/site-packages/uvloop/includes/consts.pxi
Normal file
33
venv/lib/python3.12/site-packages/uvloop/includes/consts.pxi
Normal file
@@ -0,0 +1,33 @@
|
||||
cdef enum:
|
||||
UV_STREAM_RECV_BUF_SIZE = 256000 # 250kb
|
||||
|
||||
FLOW_CONTROL_HIGH_WATER = 64 # KiB
|
||||
FLOW_CONTROL_HIGH_WATER_SSL_READ = 256 # KiB
|
||||
FLOW_CONTROL_HIGH_WATER_SSL_WRITE = 512 # KiB
|
||||
|
||||
DEFAULT_FREELIST_SIZE = 250
|
||||
DNS_PYADDR_TO_SOCKADDR_CACHE_SIZE = 2048
|
||||
|
||||
DEBUG_STACK_DEPTH = 10
|
||||
|
||||
|
||||
__PROCESS_DEBUG_SLEEP_AFTER_FORK = 1
|
||||
|
||||
|
||||
LOG_THRESHOLD_FOR_CONNLOST_WRITES = 5
|
||||
SSL_READ_MAX_SIZE = 256 * 1024
|
||||
|
||||
|
||||
cdef extern from *:
|
||||
'''
|
||||
// Number of seconds to wait for SSL handshake to complete
|
||||
// The default timeout matches that of Nginx.
|
||||
#define SSL_HANDSHAKE_TIMEOUT 60.0
|
||||
|
||||
// Number of seconds to wait for SSL shutdown to complete
|
||||
// The default timeout mimics lingering_time
|
||||
#define SSL_SHUTDOWN_TIMEOUT 30.0
|
||||
'''
|
||||
|
||||
const float SSL_HANDSHAKE_TIMEOUT
|
||||
const float SSL_SHUTDOWN_TIMEOUT
|
||||
Reference in New Issue
Block a user