Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add storage index create indexOnly flag #130

Merged
merged 4 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr

## [Unreleased]
### Fixed
- Fixed linter-found test issue.
- Fix linter-found test issue.
- Fix storage index listing results sometimes being returned with incorrect order.

### Changed
- Add create_time and update_time to returned storage engine writes acks.
- Add storage index create flag to read only from the index.

## [1.28.1] - 2023-08-23
### Added
Expand Down
974 changes: 501 additions & 473 deletions api/api.pb.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@ message StorageObjectAck {
string version = 3;
// The owner of the object.
string user_id = 4;
// The UNIX time (for gRPC clients) or ISO string (for REST clients) when the object was created.
google.protobuf.Timestamp create_time = 5;
// The UNIX time (for gRPC clients) or ISO string (for REST clients) when the object was last updated.
google.protobuf.Timestamp update_time = 6;
}

// Batch of acknowledgements for the storage object write.
Expand Down
5 changes: 3 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2321,12 +2321,13 @@ declare namespace nkruntime {
*
* @param name - Name of the new index. Must be unique.
* @param collection - Collection of storage engine to index objects from.
* @param key - Opt. Key of storage objects to index. Set to null, undefined or emtpy string to index all objects of collection.
* @param key - Key of storage objects to index. Set to null, undefined or emtpy string to index all objects of collection.
* @param fields - Array of fields of object to index. The values of these fields will be searchable in the index.
* @param maxEntries - Maximum number of entries to keep in the index.
* @param indexOnly - Opt. The returned values are fetched from the index only instead of the db, which might return a partial value. Defaults to false.
* @throws {TypeError, GoError}
*/
registerStorageIndex(name: string, collection: string, key: string, fields: string[], maxEntries: number): void;
registerStorageIndex(name: string, collection: string, key: string | void, fields: string[], maxEntries: number, indexOnly: boolean): void;

/**
* Register purchase notification Google handler.
Expand Down
2 changes: 1 addition & 1 deletion rtapi/realtime.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ type Initializer interface {
RegisterEventSessionEnd(fn func(ctx context.Context, logger Logger, evt *api.Event)) error

// Register a new storage index.
RegisterStorageIndex(name, collection, key string, fields []string, maxEntries int) error
RegisterStorageIndex(name, collection, key string, fields []string, maxEntries int, indexOnly bool) error

// RegisterStorageIndexFilter can be used to define a filtering function for a given storage index.
RegisterStorageIndexFilter(indexName string, fn func(ctx context.Context, logger Logger, db *sql.DB, nk NakamaModule, write *StorageWrite) bool) error
Expand Down