1ZDIR_PATCH(3) CZMQ Manual ZDIR_PATCH(3)
2
3
4
6 zdir_patch - work with directory patches
7
9 // This is a stable class, and may not change except for emergencies. It
10 // is provided in stable builds.
11 #define ZDIR_PATCH_CREATE 1 // Creates a new file
12 #define ZDIR_PATCH_DELETE 2 // Delete a file
13
14 // Create new patch
15 CZMQ_EXPORT zdir_patch_t *
16 zdir_patch_new (const char *path, zfile_t *file, int op, const char *alias);
17
18 // Destroy a patch
19 CZMQ_EXPORT void
20 zdir_patch_destroy (zdir_patch_t **self_p);
21
22 // Create copy of a patch. If the patch is null, or memory was exhausted,
23 // returns null.
24 // Caller owns return value and must destroy it when done.
25 CZMQ_EXPORT zdir_patch_t *
26 zdir_patch_dup (zdir_patch_t *self);
27
28 // Return patch file directory path
29 CZMQ_EXPORT const char *
30 zdir_patch_path (zdir_patch_t *self);
31
32 // Return patch file item
33 CZMQ_EXPORT zfile_t *
34 zdir_patch_file (zdir_patch_t *self);
35
36 // Return operation
37 CZMQ_EXPORT int
38 zdir_patch_op (zdir_patch_t *self);
39
40 // Return patch virtual file path
41 CZMQ_EXPORT const char *
42 zdir_patch_vpath (zdir_patch_t *self);
43
44 // Calculate hash digest for file (create only)
45 CZMQ_EXPORT void
46 zdir_patch_digest_set (zdir_patch_t *self);
47
48 // Return hash digest for patch file
49 CZMQ_EXPORT const char *
50 zdir_patch_digest (zdir_patch_t *self);
51
52 // Self test of this class.
53 CZMQ_EXPORT void
54 zdir_patch_test (bool verbose);
55
56 Please add '@interface' section in './../src/zdir_patch.c'.
57
59 The zdir_patch class works with one patch, which says "create this
60 file" or "delete this file" (referring to a zfile item each time).
61
62 Please add @discuss section in ./../src/zdir_patch.c.
63
65 From zdir_patch_test method.
66
67 zfile_t *file = zfile_new (".", "bilbo");
68 assert (file);
69 zdir_patch_t *patch = zdir_patch_new (".", file, patch_create, "/");
70 assert (patch);
71 zfile_destroy (&file);
72
73 file = zdir_patch_file (patch);
74 assert (file);
75 assert (streq (zfile_filename (file, "."), "bilbo"));
76 assert (streq (zdir_patch_vpath (patch), "/bilbo"));
77 zdir_patch_destroy (&patch);
78
79
81 The czmq manual was written by the authors in the AUTHORS file.
82
84 Main web site:
85
86 Report bugs to the email <zeromq-dev@lists.zeromq.org[1]>
87
89 Copyright (c) the Contributors as noted in the AUTHORS file. This file
90 is part of CZMQ, the high-level C binding for 0MQ:
91 http://czmq.zeromq.org. This Source Code Form is subject to the terms
92 of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
93 distributed with this file, You can obtain one at
94 http://mozilla.org/MPL/2.0/. LICENSE included with the czmq
95 distribution.
96
98 1. zeromq-dev@lists.zeromq.org
99 mailto:zeromq-dev@lists.zeromq.org
100
101
102
103CZMQ 4.0.2 12/31/2016 ZDIR_PATCH(3)