blob: 6748f0ec0e8f6e9429bad2c170dc83a580bcf9f2 [file] [log] [blame]
Matthias Andreas Benkardb5d657a2022-02-03 21:14:30 +01001// SPDX-FileCopyrightText: © 2021 Matthias Andreas Benkard <code@mail.matthias.benkard.de>
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
Matthias Andreas Benkard4e8423d2021-12-19 22:56:09 +01005package eu.mulk.jgvariant.ostree;
6
7import eu.mulk.jgvariant.core.Decoder;
8
9/**
Matthias Andreas Benkard05114642021-12-29 21:51:29 +010010 * A POSIX extended attribute of a file or directory.
11 *
12 * <p>Reference: (embedded in other data types, e.g. {@code
Matthias Andreas Benkard4e8423d2021-12-19 22:56:09 +010013 * ostree-core.h#OSTREE_DIRMETA_GVARIANT_STRING}, {@code
14 * ostree-core.h#OSTREE_FILEMETA_GVARIANT_STRING})
Matthias Andreas Benkard05114642021-12-29 21:51:29 +010015 *
16 * @param name the name part of the extended attribute.
17 * @param value the value part of the extended attribute.
18 * @see DirMeta
19 * @see FileMeta
Matthias Andreas Benkard4e8423d2021-12-19 22:56:09 +010020 */
21public record Xattr(ByteString name, ByteString value) {
22
23 private static final Decoder<Xattr> DECODER =
24 Decoder.ofStructure(Xattr.class, ByteString.decoder(), ByteString.decoder());
25
Matthias Andreas Benkard05114642021-12-29 21:51:29 +010026 /**
27 * Acquires a {@link Decoder} for the enclosing type.
28 *
29 * @return a possibly shared {@link Decoder}.
30 */
Matthias Andreas Benkard4e8423d2021-12-19 22:56:09 +010031 public static Decoder<Xattr> decoder() {
32 return DECODER;
33 }
34}