Mercurial > dovecot > core-2.2
annotate src/lib/iostream-temp.h @ 22664:fea53c2725c0
director: Fix director_max_parallel_moves/kicks type
Should be uint, not time.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 09 Nov 2017 12:24:16 +0200 |
parents | 244720af3113 |
children |
rev | line source |
---|---|
15402
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
1 #ifndef IOSTREAM_TEMP_H |
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
2 #define IOSTREAM_TEMP_H |
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
3 |
15721
50d43f04511b
iostream-temp: Avoid copying data if IOSTREAM_TEMP_FLAG_TRY_FD_DUP is set.
Timo Sirainen <tss@iki.fi>
parents:
15402
diff
changeset
|
4 enum iostream_temp_flags { |
50d43f04511b
iostream-temp: Avoid copying data if IOSTREAM_TEMP_FLAG_TRY_FD_DUP is set.
Timo Sirainen <tss@iki.fi>
parents:
15402
diff
changeset
|
5 /* if o_stream_send_istream() is called with a readable fd, don't |
50d43f04511b
iostream-temp: Avoid copying data if IOSTREAM_TEMP_FLAG_TRY_FD_DUP is set.
Timo Sirainen <tss@iki.fi>
parents:
15402
diff
changeset
|
6 actually copy the input stream, just have iostream_temp_finish() |
50d43f04511b
iostream-temp: Avoid copying data if IOSTREAM_TEMP_FLAG_TRY_FD_DUP is set.
Timo Sirainen <tss@iki.fi>
parents:
15402
diff
changeset
|
7 return a new iostream pointing to the fd dup()ed */ |
50d43f04511b
iostream-temp: Avoid copying data if IOSTREAM_TEMP_FLAG_TRY_FD_DUP is set.
Timo Sirainen <tss@iki.fi>
parents:
15402
diff
changeset
|
8 IOSTREAM_TEMP_FLAG_TRY_FD_DUP = 0x01 |
50d43f04511b
iostream-temp: Avoid copying data if IOSTREAM_TEMP_FLAG_TRY_FD_DUP is set.
Timo Sirainen <tss@iki.fi>
parents:
15402
diff
changeset
|
9 }; |
50d43f04511b
iostream-temp: Avoid copying data if IOSTREAM_TEMP_FLAG_TRY_FD_DUP is set.
Timo Sirainen <tss@iki.fi>
parents:
15402
diff
changeset
|
10 |
15402
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
11 /* Start writing to given output stream. The data is initially written to |
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
12 memory, and later to a temporary file that is immediately unlinked. */ |
15721
50d43f04511b
iostream-temp: Avoid copying data if IOSTREAM_TEMP_FLAG_TRY_FD_DUP is set.
Timo Sirainen <tss@iki.fi>
parents:
15402
diff
changeset
|
13 struct ostream *iostream_temp_create(const char *temp_path_prefix, |
50d43f04511b
iostream-temp: Avoid copying data if IOSTREAM_TEMP_FLAG_TRY_FD_DUP is set.
Timo Sirainen <tss@iki.fi>
parents:
15402
diff
changeset
|
14 enum iostream_temp_flags flags); |
18084
4e10ca59e907
lib: Added iostream_temp_create_named()
Timo Sirainen <tss@iki.fi>
parents:
15721
diff
changeset
|
15 struct ostream *iostream_temp_create_named(const char *temp_path_prefix, |
4e10ca59e907
lib: Added iostream_temp_create_named()
Timo Sirainen <tss@iki.fi>
parents:
15721
diff
changeset
|
16 enum iostream_temp_flags flags, |
4e10ca59e907
lib: Added iostream_temp_create_named()
Timo Sirainen <tss@iki.fi>
parents:
15721
diff
changeset
|
17 const char *name); |
19835
c2999b133d37
lib: Added iostream_temp_create_sized() to specify the max in-memory size
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
18084
diff
changeset
|
18 struct ostream *iostream_temp_create_sized(const char *temp_path_prefix, |
c2999b133d37
lib: Added iostream_temp_create_sized() to specify the max in-memory size
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
18084
diff
changeset
|
19 enum iostream_temp_flags flags, |
c2999b133d37
lib: Added iostream_temp_create_sized() to specify the max in-memory size
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
18084
diff
changeset
|
20 const char *name, |
c2999b133d37
lib: Added iostream_temp_create_sized() to specify the max in-memory size
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
18084
diff
changeset
|
21 size_t max_mem_size); |
15402
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
22 /* Finished writing to stream. Return input stream for it and free the |
19835
c2999b133d37
lib: Added iostream_temp_create_sized() to specify the max in-memory size
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
18084
diff
changeset
|
23 output stream. (It's also possible to abort iostream-temp by simply |
c2999b133d37
lib: Added iostream_temp_create_sized() to specify the max in-memory size
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
18084
diff
changeset
|
24 destroying the ostream.) */ |
15402
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
25 struct istream *iostream_temp_finish(struct ostream **output, |
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
26 size_t max_buffer_size); |
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
27 |
20745
244720af3113
iostream-temp: If write() to temp file fails at any time, move it back to memory.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
19835
diff
changeset
|
28 /* For internal testing: */ |
244720af3113
iostream-temp: If write() to temp file fails at any time, move it back to memory.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
19835
diff
changeset
|
29 int o_stream_temp_move_to_memory(struct ostream *output); |
244720af3113
iostream-temp: If write() to temp file fails at any time, move it back to memory.
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
19835
diff
changeset
|
30 |
15402
faa3a83282fb
Added iostream-temp for easily creating a temporary istream (to memory/file).
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
31 #endif |