Shaka Player Embedded
object_store.h
Go to the documentation of this file.
1 // Copyright 2016 Google LLC
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 // https://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 #ifndef SHAKA_EMBEDDED_JS_IDB_OBJECT_STORE_H_
16 #define SHAKA_EMBEDDED_JS_IDB_OBJECT_STORE_H_
17 
18 #include <string>
19 
20 #include "shaka/optional.h"
21 #include "src/core/member.h"
22 #include "src/core/ref_ptr.h"
23 #include "src/js/idb/cursor.h"
24 #include "src/js/idb/idb_utils.h"
25 #include "src/mapping/any.h"
29 
30 namespace shaka {
31 namespace js {
32 namespace idb {
33 
34 class IDBRequest;
35 class IDBTransaction;
36 
37 class IDBObjectStore : public BackingObject {
38  DECLARE_TYPE_INFO(IDBObjectStore);
39 
40  public:
42 
43  void Trace(memory::HeapTracer* tracer) const override;
44 
45  const bool auto_increment = true;
47  const std::string store_name; // JavaScript "name"
49 
56 
58  bool no_overwrite);
59 
60  private:
61  ExceptionOr<void> CheckState(bool need_write) const;
62 };
63 
64 class IDBObjectStoreFactory : public BackingObjectFactory<IDBObjectStore> {
65  public:
67 };
68 
69 } // namespace idb
70 } // namespace js
71 } // namespace shaka
72 
73 #endif // SHAKA_EMBEDDED_JS_IDB_OBJECT_STORE_H_
Definition: any.h:31
const Member< IDBTransaction > transaction
Definition: object_store.h:48
ExceptionOr< RefPtr< IDBRequest > > Put(Any value, optional< IdbKeyType > key)
Definition: object_store.cc:48
ExceptionOr< RefPtr< IDBRequest > > Get(IdbKeyType key)
Definition: object_store.cc:97
const std::string store_name
Definition: object_store.h:47
IDBObjectStore(RefPtr< IDBTransaction > transaction, const std::string &name)
Definition: object_store.cc:31
int64_t IdbKeyType
Definition: idb_utils.h:29
ExceptionOr< RefPtr< IDBRequest > > AddOrPut(Any value, optional< IdbKeyType > key, bool no_overwrite)
Definition: object_store.cc:53
const optional< std::string > key_path
Definition: object_store.h:46
ExceptionOr< RefPtr< IDBRequest > > Delete(IdbKeyType key)
Definition: object_store.cc:84
ExceptionOr< RefPtr< IDBRequest > > Add(Any value, optional< IdbKeyType > key)
Definition: object_store.cc:43
ExceptionOr< RefPtr< IDBRequest > > OpenCursor(optional< IdbKeyType > range, optional< IDBCursorDirection > direction)
void Trace(memory::HeapTracer *tracer) const override
Definition: object_store.cc:38
std::string name() const