-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathchange.zig
46 lines (36 loc) · 1.03 KB
/
change.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const msgpack = @import("msgpack");
pub const Insert = struct {
id: u32,
hashes: []const u32,
pub fn msgpackFormat() msgpack.StructFormat {
return .{ .as_map = .{ .key = .{ .field_name_prefix = 1 } } };
}
};
pub const Delete = struct {
id: u32,
pub fn msgpackFormat() msgpack.StructFormat {
return .{ .as_map = .{ .key = .{ .field_name_prefix = 1 } } };
}
};
pub const SetAttribute = struct {
name: []const u8,
value: u64,
pub fn msgpackFormat() msgpack.StructFormat {
return .{ .as_map = .{ .key = .{ .field_name_prefix = 1 } } };
}
};
pub const Change = union(enum) {
insert: Insert,
delete: Delete,
set_attribute: SetAttribute,
pub fn msgpackFormat() msgpack.UnionFormat {
return .{ .as_map = .{ .key = .{ .field_name_prefix = 1 } } };
}
};
pub const Transaction = struct {
id: u64,
changes: []const Change,
pub fn msgpackFormat() msgpack.StructFormat {
return .{ .as_map = .{ .key = .{ .field_name_prefix = 1 } } };
}
};