ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/map-tags.ext
(Generate patch)

Comparing deliantra/server/ext/map-tags.ext (file contents):
Revision 1.12 by root, Sun Dec 2 15:16:28 2007 UTC vs.
Revision 1.13 by root, Wed Dec 5 11:08:34 2007 UTC

48 48
49 utf8::encode $key; 49 utf8::encode $key;
50 BDB::db_get $db_mapinfo, $txn, $key, my $data; 50 BDB::db_get $db_mapinfo, $txn, $key, my $data;
51 51
52 unless ($!) { 52 unless ($!) {
53 $data = from_json $data; 53 $data = decode_json $data;
54 return if $data->{hash} eq $hash; 54 return if $data->{hash} eq $hash;
55 $old_tags = $data->{tags}; 55 $old_tags = $data->{tags};
56 } 56 }
57 57
58 $old_tags ||= []; 58 $old_tags ||= [];
59 59
60 my $f = new_from_file cf::object::thawer $file 60 my $f = new_from_file cf::object::thawer $file
61 or return; 61 or return;
62 62
63 my @tags = sort $f->extract_tags; 63 my @tags = sort $f->extract_tags;
64 $data = to_json { hash => $hash, tags => \@tags }; 64 $data = encode_json { hash => $hash, tags => \@tags };
65 65
66 BDB::db_put $db_mapinfo, $txn, $key, $data; 66 BDB::db_put $db_mapinfo, $txn, $key, $data;
67 67
68 # 1. remove tags no longer existing 68 # 1. remove tags no longer existing
69 for my $tag (@$old_tags) { 69 for my $tag (@$old_tags) {
115 my $cursor = $db_mapinfo->cursor; 115 my $cursor = $db_mapinfo->cursor;
116 for (;;) { 116 for (;;) {
117 BDB::db_c_get $cursor, my $key, my $data, BDB::NEXT; 117 BDB::db_c_get $cursor, my $key, my $data, BDB::NEXT;
118 last if $!; 118 last if $!;
119 119
120 my $data = JSON::XS::from_json $data; 120 my $data = JSON::XS::decode_json $data;
121 my ($ver, undef, undef, $path) = split /,/, $data->{hash}, 4; 121 my ($ver, undef, undef, $path) = split /,/, $data->{hash}, 4;
122 push @delkeys, [$key, $data->{tags}] 122 push @delkeys, [$key, $data->{tags}]
123 if $ver != 1 || Coro::AIO::aio_stat $path; 123 if $ver != 1 || Coro::AIO::aio_stat $path;
124 } 124 }
125 BDB::db_c_close $cursor; 125 BDB::db_c_close $cursor;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines