Home | History | Annotate | Download | only in memory_image
      1 // Copyright (C) 2017 The Android Open Source Project
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //      http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 // Protos for a data store: a barebone in-memory file system.
     16 //
     17 // A DataStore maintains an association between names and chunks of bytes.  It
     18 // can be serialized into a string.  Of course, it can be deserialized from a
     19 // string, with minimal parsing; after deserialization, all chunks of bytes
     20 // start at aligned addresses (aligned = multiple of an address specified at
     21 // build time).
     22 
     23 syntax = "proto2";
     24 option optimize_for = LITE_RUNTIME;
     25 
     26 package libtextclassifier.nlp_core.memory_image;
     27 
     28 // Bytes for a data store entry.  They can be stored either directly in the
     29 // "data" field, or in the DataBlob with the 0-based index "blob_index".
     30 message DataStoreEntryBytes {
     31   oneof data {
     32     // Bytes for this data store entry, stored in this message.
     33     string in_place_data = 1;
     34 
     35     // 0-based index of the data blob with bytes for this data store entry.  In
     36     // this case, the actual bytes are stored outside this message; the
     37     // DataStore code handles the association.
     38     int32 blob_index = 2 [default = -1];
     39   }
     40 }
     41 
     42 message DataStoreProto {
     43   map<string, DataStoreEntryBytes> entries = 1;
     44 }
     45