mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00

Realised this is clearer than tagging each method individually. The enum has been retained for the case where we want to implement the backend method separately from the collection one.
31 lines
1.1 KiB
Protocol Buffer
31 lines
1.1 KiB
Protocol Buffer
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
syntax = "proto3";
|
|
|
|
package anki.codegen;
|
|
|
|
import "google/protobuf/descriptor.proto";
|
|
|
|
extend google.protobuf.MethodOptions {
|
|
BackendMethod backend_method = 50000;
|
|
}
|
|
|
|
message MethodOptions {
|
|
BackendMethod backend_method = 50000;
|
|
}
|
|
|
|
enum BackendMethod {
|
|
/// Used for typical collection-based operations. We must implement the
|
|
// method on Collection. The same method is automatically implemented on
|
|
// Backend, which forwards to Collection.
|
|
BACKEND_METHOD_DELEGATE = 0;
|
|
/// Both the backend and collection need to implement the method; there
|
|
/// is no auto-delegation. Can be used to provide a method on both, but
|
|
/// skip the Collection mutex lock when a backend handle is available.
|
|
/// In practice we only do this for the i18n methods; for the occasional
|
|
/// method in other services that doesn't happen to need the collection,
|
|
/// we just delegate to the collection method for convenience, and to make
|
|
/// sure it's available even if the consumer is not using Backend.
|
|
BACKEND_METHOD_IMPLEMENT = 1;
|
|
}
|