diff options
author | Simon Rettberg | 2020-03-03 12:21:01 +0100 |
---|---|---|
committer | Simon Rettberg | 2020-03-03 12:21:01 +0100 |
commit | 26c1ad7af0f5749c5343a5823b9c8cece885ce84 (patch) | |
tree | 0fe45f629560edb47bd86c7dc78b69715348b600 /src/server/globals.h | |
parent | [SERVER] altservers: Fix missing index mapping (replication) (diff) | |
download | dnbd3-26c1ad7af0f5749c5343a5823b9c8cece885ce84.tar.gz dnbd3-26c1ad7af0f5749c5343a5823b9c8cece885ce84.tar.xz dnbd3-26c1ad7af0f5749c5343a5823b9c8cece885ce84.zip |
[SERVER] Remove "working" flag, introduce fine-grained flags
Tracking the "working" state of images using one boolean is insufficient
regarding the different ways in which providing an image can fail.
Introduce separate flags for different conditions, like "file not
readable", "file not writable", "no uplink server available", "file
content has changed".
Diffstat (limited to 'src/server/globals.h')
-rw-r--r-- | src/server/globals.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/server/globals.h b/src/server/globals.h index b1336dc..31fbce5 100644 --- a/src/server/globals.h +++ b/src/server/globals.h @@ -136,7 +136,12 @@ struct _dnbd3_image atomic_int completenessEstimate; // Completeness estimate in percent atomic_int users; // clients currently using this image. XXX Lock on imageListLock when modifying and checking whether the image should be freed. Reading it elsewhere is fine without the lock. int id; // Unique ID of this image. Only unique in the context of this running instance of DNBD3-Server - atomic_bool working; // true if image exists and completeness is == 100% or a working upstream proxy is connected + struct { + atomic_bool uplink; // No uplink connected + atomic_bool write; // Error writing to file + atomic_bool read; // Error reading from file + atomic_bool changed; // File disappeared or changed, thorough check required if it seems to be back + } problem; uint16_t rid; // revision of image pthread_mutex_t lock; }; |