1ZDIR_PATCH(3)                     CZMQ Manual                    ZDIR_PATCH(3)
2
3
4

NAME

6       zdir_patch - Class for work with directory patches
7

SYNOPSIS

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

DESCRIPTION

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

EXAMPLE

65       From zdir_patch_test method.
66
67           const char *SELFTEST_DIR_RW = "src/selftest-rw";
68
69           const char *testfile = "bilbo";
70           const char *prefix   = "/";
71           char *prefixed_testfile = zsys_sprintf ("%s%s", prefix, testfile);
72           assert (prefixed_testfile);
73
74           // Make sure old aborted tests do not hinder us
75           zsys_file_delete (prefixed_testfile);
76
77           zfile_t *file = zfile_new (SELFTEST_DIR_RW, testfile);
78           assert (file);
79           zdir_patch_t *patch = zdir_patch_new (SELFTEST_DIR_RW, file, patch_create, prefix);
80           assert (patch);
81           zfile_destroy (&file);
82
83           file = zdir_patch_file (patch);
84           assert (file);
85           assert (streq (zfile_filename (file, SELFTEST_DIR_RW), testfile));
86           assert (streq (zdir_patch_vpath (patch), prefixed_testfile));
87           zdir_patch_destroy (&patch);
88
89           zstr_free (&prefixed_testfile);
90
91           #if defined (__WINDOWS__)
92           zsys_shutdown();
93           #endif
94
95

AUTHORS

97       The czmq manual was written by the authors in the AUTHORS file.
98

RESOURCES

100       Main web site:
101
102       Report bugs to the email <zeromq-dev@lists.zeromq.org[1]>
103
105       Copyright (c) the Contributors as noted in the AUTHORS file. This file
106       is part of CZMQ, the high-level C binding for 0MQ:
107       http://czmq.zeromq.org. This Source Code Form is subject to the terms
108       of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
109       distributed with this file, You can obtain one at
110       http://mozilla.org/MPL/2.0/. LICENSE included with the czmq
111       distribution.
112

NOTES

114        1. zeromq-dev@lists.zeromq.org
115           mailto:zeromq-dev@lists.zeromq.org
116
117
118
119CZMQ 4.2.1                        07/19/2023                     ZDIR_PATCH(3)
Impressum