From 80c8ff78b4af9fe5ecdfdd48543044750e98e066 Mon Sep 17 00:00:00 2001 From: Ehsan Noureddin Moosa Date: Sun, 11 Feb 2024 13:31:45 +0330 Subject: [PATCH] chore: refactor module --- cmd/cli-river/commands.go | 1212 ++-- cmd/cli-river/commands_account.go | 278 +- cmd/cli-river/commands_auth.go | 297 +- cmd/cli-river/commands_bot.go | 144 +- cmd/cli-river/commands_call.go | 178 +- cmd/cli-river/commands_contact.go | 246 +- cmd/cli-river/commands_debug.go | 381 +- cmd/cli-river/commands_file.go | 441 +- cmd/cli-river/commands_gif.go | 98 +- cmd/cli-river/commands_group.go | 286 +- cmd/cli-river/commands_label.go | 475 +- cmd/cli-river/commands_message.go | 708 +- cmd/cli-river/commands_mini.go | 222 +- cmd/cli-river/commands_sdk.go | 251 +- cmd/cli-river/commands_system.go | 30 +- cmd/cli-river/commands_team.go | 230 +- cmd/cli-river/commands_user.go | 102 +- cmd/cli-river/commands_wallpaper.go | 30 +- cmd/cli-river/delegates.go | 323 +- cmd/cli-river/main.go | 349 +- cmd/cli-river/printer_message.go | 933 +-- cmd/cli-river/printer_updates.go | 72 +- go.mod | 135 +- go.sum | 132 +- internal/ctrl_file/downloader.go | 403 +- internal/ctrl_file/executor/executor.go | 289 +- internal/ctrl_file/executor/executor_test.go | 183 +- internal/ctrl_file/file.go | 757 +-- internal/ctrl_file/file_test.go | 635 +- internal/ctrl_file/statics.go | 41 +- internal/ctrl_file/uploader.go | 715 +- internal/ctrl_network/network.go | 1675 ++--- internal/ctrl_network/network_test.go | 291 +- internal/ctrl_queue/queue.go | 545 +- internal/ctrl_sync/remote_commands.go | 725 +- internal/ctrl_sync/synchronizer.go | 1157 ++-- internal/domain/constants.go | 263 +- internal/domain/handlers.go | 4 +- internal/domain/message_action.go | 72 +- internal/domain/statics.go | 703 +- internal/hole/hole.go | 531 +- internal/hole/hole_test.go | 179 +- internal/logs/sentry.go | 153 +- internal/minirepo/dialogs.go | 221 +- internal/minirepo/dialogs_test.go | 65 +- internal/minirepo/groups.go | 197 +- internal/minirepo/repo.go | 127 +- internal/minirepo/repo_test.go | 4 +- internal/minirepo/teams.go | 124 +- internal/minirepo/users.go | 427 +- internal/monitoring/monitoring.go | 255 +- internal/repo/account.go | 79 +- internal/repo/dialogs.go | 569 +- internal/repo/files.go | 1299 ++-- internal/repo/gif.go | 209 +- internal/repo/gif_test.go | 67 +- internal/repo/groups.go | 867 +-- internal/repo/labels.go | 835 +-- internal/repo/labels_test.go | 317 +- internal/repo/messages.go | 1775 ++--- internal/repo/messages_extra.go | 123 +- internal/repo/messages_pending.go | 967 +-- internal/repo/messages_test.go | 115 +- internal/repo/notifications.go | 78 +- internal/repo/reactions.go | 98 +- internal/repo/recent_searches.go | 146 +- internal/repo/recent_searches_test.go | 75 +- internal/repo/repo.go | 661 +- internal/repo/repo_test.go | 791 +-- internal/repo/teams.go | 175 +- internal/repo/top_peers.go | 373 +- internal/repo/top_peers_test.go | 99 +- internal/repo/users.go | 1173 ++-- internal/repo/wallpapers.go | 32 +- internal/request/callback.go | 443 +- internal/request/callback_test.go | 103 +- internal/request/delegate.go | 149 +- internal/request/request.go | 6 +- internal/salt/salt.go | 167 +- internal/testenv/testenv.go | 6 +- internal/uiexec/uiexec.go | 207 +- module/account/account.go | 44 +- module/account/handlers.go | 231 +- module/account/update_appliers.go | 84 +- module/auth/auth.go | 98 +- module/bot/bot.go | 74 +- module/call/api.go | 1027 +-- module/call/call.go | 179 +- module/call/callbacks.go | 311 +- module/call/handlers.go | 526 +- module/call/methods.go | 3997 +++++------ module/call/update_appliers.go | 126 +- module/call/utils.go | 337 +- module/contact/contact.go | 54 +- module/contact/handlers.go | 459 +- module/contact/message_appliers.go | 127 +- module/gif/gif.go | 40 +- module/gif/handlers.go | 132 +- module/gif/message_appliers.go | 74 +- module/group/group.go | 64 +- module/group/handlers.go | 242 +- module/group/message_appliers.go | 52 +- module/group/update_appliers.go | 172 +- module/label/handlers.go | 309 +- module/label/label.go | 62 +- module/label/message_appliers.go | 52 +- module/label/update_appliers.go | 164 +- module/message/handlers.go | 1969 +++--- module/message/message.go | 118 +- module/message/message_appliers.go | 188 +- module/message/update_appliers.go | 1013 +-- module/module.go | 94 +- module/notification/notification.go | 76 +- module/search/handlers.go | 331 +- module/search/search.go | 32 +- module/system/handlers.go | 8 +- module/system/message_appliers.go | 44 +- module/system/system.go | 36 +- module/team/handlers.go | 58 +- module/team/message_appliers.go | 50 +- module/team/team.go | 58 +- module/team/update_appliers.go | 186 +- module/user/handler.go | 139 +- module/user/message_appliers.go | 28 +- module/user/update_appliers.go | 124 +- module/user/user.go | 52 +- module/wallpaper/wallpaper.go | 50 +- sdk/mini/cmd_file.go | 179 +- sdk/mini/cmd_general.go | 253 +- sdk/mini/delegates.go | 42 +- sdk/mini/handlers_client.go | 531 +- sdk/mini/handlers_local.go | 220 +- sdk/mini/river.go | 295 +- sdk/mini/river_sync.go | 377 +- sdk/prime/cmd_db.go | 32 +- sdk/prime/cmd_debug.go | 76 +- sdk/prime/cmd_file.go | 275 +- sdk/prime/cmd_general.go | 1109 +-- sdk/prime/cmd_general_test.go | 52 +- sdk/prime/cmd_network.go | 30 +- sdk/prime/cmd_search.go | 29 +- sdk/prime/delegates.go | 66 +- sdk/prime/message_hole.go | 48 +- sdk/prime/river.go | 1377 ++-- sdk/prime/river_test.go | 157 +- sdk/prime/statics.go | 225 +- .../river/msg/go/msg/accounts.pb.go | 3032 --------- .../river/msg/go/msg/accounts.rony.go | 2444 ------- .../river/msg/go/msg/admin.pb.go | 2817 -------- .../river/msg/go/msg/admin.rony.go | 2051 ------ .../river/msg/go/msg/auth.pb.go | 2387 ------- .../river/msg/go/msg/auth.rony.go | 1715 ----- .../river/msg/go/msg/calendar.pb.go | 849 --- .../river/msg/go/msg/calendar.rony.go | 423 -- .../river/msg/go/msg/chat.bot.pb.go | 3153 --------- .../river/msg/go/msg/chat.bot.rony.go | 2337 ------- .../river/msg/go/msg/chat.community.pb.go | 1059 --- .../river/msg/go/msg/chat.community.rony.go | 715 -- .../river/msg/go/msg/chat.groups.pb.go | 1183 ---- .../river/msg/go/msg/chat.groups.rony.go | 939 --- .../river/msg/go/msg/chat.labels.pb.go | 754 -- .../river/msg/go/msg/chat.labels.rony.go | 574 -- .../msg/go/msg/chat.messages.actions.pb.go | 838 --- .../msg/go/msg/chat.messages.actions.rony.go | 678 -- .../msg/go/msg/chat.messages.markups.pb.go | 1036 --- .../msg/go/msg/chat.messages.markups.rony.go | 825 --- .../msg/go/msg/chat.messages.medias.pb.go | 2506 ------- .../msg/go/msg/chat.messages.medias.rony.go | 1770 ----- .../river/msg/go/msg/chat.messages.pb.go | 2876 -------- .../river/msg/go/msg/chat.messages.rony.go | 2340 ------- .../msg/go/msg/chat.password.algorithms.pb.go | 170 - .../go/msg/chat.password.algorithms.rony.go | 87 - .../river/msg/go/msg/chat.phone.pb.go | 3920 ----------- .../river/msg/go/msg/chat.phone.rony.go | 2756 -------- .../river/msg/go/msg/chat.wallpaper.pb.go | 877 --- .../river/msg/go/msg/chat.wallpaper.rony.go | 672 -- .../river/msg/go/msg/client.call.pb.go | 4340 ------------ .../river/msg/go/msg/client.call.rony.go | 3317 --------- .../river/msg/go/msg/client.pb.go | 3332 --------- .../river/msg/go/msg/client.rony.go | 2346 ------- .../river/msg/go/msg/client.updates.pb.go | 260 - .../river/msg/go/msg/client.updates.rony.go | 167 - .../river/msg/go/msg/constructors.json | 1126 --- .../river/msg/go/msg/contacts.pb.go | 1524 ----- .../river/msg/go/msg/contacts.rony.go | 1216 ---- .../river/msg/go/msg/core.types.pb.go | 5753 ---------------- .../river/msg/go/msg/core.types.rony.go | 3286 --------- .../river/msg/go/msg/crypto.go | 127 - .../river/msg/go/msg/dev.pb.go | 413 -- .../river/msg/go/msg/dev.rony.go | 317 - .../river/msg/go/msg/errors.go | 115 - .../river/msg/go/msg/files.pb.go | 515 -- .../river/msg/go/msg/files.rony.go | 283 - .../river/msg/go/msg/gif.pb.go | 617 -- .../river/msg/go/msg/gif.rony.go | 513 -- .../river/msg/go/msg/public.pb.go | 285 - .../river/msg/go/msg/public.rony.go | 155 - .../git.ronaksoft.com/river/msg/go/msg/rpc.go | 11 - .../river/msg/go/msg/service.pb.go | 208 - .../river/msg/go/msg/service.rony.go | 113 - .../river/msg/go/msg/system.pb.go | 1519 ----- .../river/msg/go/msg/system.rony.go | 1018 --- .../river/msg/go/msg/team.pb.go | 1141 ---- .../river/msg/go/msg/team.rony.go | 923 --- .../river/msg/go/msg/updates.pb.go | 6047 ----------------- .../river/msg/go/msg/updates.rony.go | 4251 ------------ .../river/msg/go/msg/users.pb.go | 292 - .../river/msg/go/msg/users.rony.go | 229 - vendor/github.com/DataDog/zstd/LICENSE | 27 - vendor/github.com/DataDog/zstd/README.md | 124 - vendor/github.com/DataDog/zstd/ZSTD_LICENSE | 30 - vendor/github.com/DataDog/zstd/bitstream.h | 460 -- vendor/github.com/DataDog/zstd/compiler.h | 159 - vendor/github.com/DataDog/zstd/cover.c | 1236 ---- vendor/github.com/DataDog/zstd/cover.h | 147 - vendor/github.com/DataDog/zstd/cpu.h | 215 - vendor/github.com/DataDog/zstd/debug.c | 44 - vendor/github.com/DataDog/zstd/debug.h | 134 - vendor/github.com/DataDog/zstd/divsufsort.c | 1913 ------ vendor/github.com/DataDog/zstd/divsufsort.h | 67 - .../github.com/DataDog/zstd/entropy_common.c | 236 - .../github.com/DataDog/zstd/error_private.c | 54 - .../github.com/DataDog/zstd/error_private.h | 76 - vendor/github.com/DataDog/zstd/errors.go | 35 - vendor/github.com/DataDog/zstd/fastcover.c | 747 -- vendor/github.com/DataDog/zstd/fse.h | 708 -- vendor/github.com/DataDog/zstd/fse_compress.c | 721 -- .../github.com/DataDog/zstd/fse_decompress.c | 311 - vendor/github.com/DataDog/zstd/hist.c | 203 - vendor/github.com/DataDog/zstd/hist.h | 95 - vendor/github.com/DataDog/zstd/huf.h | 358 - vendor/github.com/DataDog/zstd/huf_compress.c | 798 --- .../github.com/DataDog/zstd/huf_decompress.c | 1234 ---- vendor/github.com/DataDog/zstd/mem.h | 453 -- vendor/github.com/DataDog/zstd/pool.c | 344 - vendor/github.com/DataDog/zstd/pool.h | 84 - vendor/github.com/DataDog/zstd/threading.c | 120 - vendor/github.com/DataDog/zstd/threading.h | 154 - .../github.com/DataDog/zstd/travis_test_32.sh | 17 - vendor/github.com/DataDog/zstd/update.txt | 56 - vendor/github.com/DataDog/zstd/xxhash.c | 882 --- vendor/github.com/DataDog/zstd/xxhash.h | 305 - vendor/github.com/DataDog/zstd/zbuff.h | 214 - vendor/github.com/DataDog/zstd/zbuff_common.c | 26 - .../github.com/DataDog/zstd/zbuff_compress.c | 147 - .../DataDog/zstd/zbuff_decompress.c | 75 - vendor/github.com/DataDog/zstd/zdict.c | 1111 --- vendor/github.com/DataDog/zstd/zdict.h | 282 - vendor/github.com/DataDog/zstd/zstd.go | 147 - vendor/github.com/DataDog/zstd/zstd.h | 2049 ------ vendor/github.com/DataDog/zstd/zstd_common.c | 83 - .../github.com/DataDog/zstd/zstd_compress.c | 4103 ----------- .../DataDog/zstd/zstd_compress_internal.h | 1003 --- .../DataDog/zstd/zstd_compress_literals.c | 154 - .../DataDog/zstd/zstd_compress_literals.h | 29 - .../DataDog/zstd/zstd_compress_sequences.c | 415 -- .../DataDog/zstd/zstd_compress_sequences.h | 47 - vendor/github.com/DataDog/zstd/zstd_cwksp.h | 535 -- vendor/github.com/DataDog/zstd/zstd_ddict.c | 240 - vendor/github.com/DataDog/zstd/zstd_ddict.h | 44 - .../github.com/DataDog/zstd/zstd_decompress.c | 1769 ----- .../DataDog/zstd/zstd_decompress_block.c | 1323 ---- .../DataDog/zstd/zstd_decompress_block.h | 59 - .../DataDog/zstd/zstd_decompress_internal.h | 175 - .../DataDog/zstd/zstd_double_fast.c | 518 -- .../DataDog/zstd/zstd_double_fast.h | 38 - vendor/github.com/DataDog/zstd/zstd_errors.h | 93 - vendor/github.com/DataDog/zstd/zstd_fast.c | 484 -- vendor/github.com/DataDog/zstd/zstd_fast.h | 37 - .../github.com/DataDog/zstd/zstd_internal.h | 350 - vendor/github.com/DataDog/zstd/zstd_lazy.c | 1115 --- vendor/github.com/DataDog/zstd/zstd_lazy.h | 67 - vendor/github.com/DataDog/zstd/zstd_ldm.c | 597 -- vendor/github.com/DataDog/zstd/zstd_ldm.h | 105 - vendor/github.com/DataDog/zstd/zstd_legacy.h | 415 -- vendor/github.com/DataDog/zstd/zstd_opt.c | 1246 ---- vendor/github.com/DataDog/zstd/zstd_opt.h | 56 - vendor/github.com/DataDog/zstd/zstd_stream.go | 454 -- vendor/github.com/DataDog/zstd/zstd_v01.c | 2152 ------ vendor/github.com/DataDog/zstd/zstd_v01.h | 94 - vendor/github.com/DataDog/zstd/zstd_v02.c | 3514 ---------- vendor/github.com/DataDog/zstd/zstd_v02.h | 93 - vendor/github.com/DataDog/zstd/zstd_v03.c | 3156 --------- vendor/github.com/DataDog/zstd/zstd_v03.h | 93 - vendor/github.com/DataDog/zstd/zstd_v04.c | 3641 ---------- vendor/github.com/DataDog/zstd/zstd_v04.h | 142 - vendor/github.com/DataDog/zstd/zstd_v05.c | 4046 ----------- vendor/github.com/DataDog/zstd/zstd_v05.h | 162 - vendor/github.com/DataDog/zstd/zstd_v06.c | 4150 ----------- vendor/github.com/DataDog/zstd/zstd_v06.h | 172 - vendor/github.com/DataDog/zstd/zstd_v07.c | 4533 ------------ vendor/github.com/DataDog/zstd/zstd_v07.h | 187 - .../github.com/DataDog/zstd/zstdmt_compress.c | 2116 ------ .../github.com/DataDog/zstd/zstdmt_compress.h | 192 - .../github.com/RoaringBitmap/roaring/go.mod | 16 - .../github.com/RoaringBitmap/roaring/go.sum | 30 - vendor/github.com/allegro/bigcache/v2/go.mod | 3 - vendor/github.com/allegro/bigcache/v2/go.sum | 0 .../andybalholm/brotli/cluster_command.go | 162 - .../andybalholm/brotli/compress_fragment.go | 2 +- .../github.com/andybalholm/brotli/decode.go | 77 +- .../github.com/andybalholm/brotli/encode.go | 3 +- .../github.com/andybalholm/brotli/fast_log.go | 16 +- vendor/github.com/andybalholm/brotli/go.mod | 3 - vendor/github.com/andybalholm/brotli/go.sum | 0 vendor/github.com/andybalholm/brotli/hash.go | 2 - .../brotli/hash_forgetful_chain.go | 3 +- .../andybalholm/brotli/hash_rolling.go | 1 - vendor/github.com/andybalholm/brotli/http.go | 4 +- .../github.com/andybalholm/brotli/reader.go | 8 +- vendor/github.com/andybalholm/brotli/state.go | 1 - .../andybalholm/brotli/static_dict.go | 12 +- .../andybalholm/brotli/utf8_util.go | 3 +- .../github.com/andybalholm/brotli/writer.go | 1 + vendor/github.com/armon/go-metrics/go.mod | 17 - vendor/github.com/armon/go-metrics/go.sum | 125 - vendor/github.com/blevesearch/bleve/go.mod | 27 - .../blevesearch/go-porterstemmer/go.mod | 3 - vendor/github.com/blevesearch/mmap-go/go.mod | 3 - vendor/github.com/blevesearch/mmap-go/go.sum | 2 - vendor/github.com/blevesearch/segment/go.mod | 3 - .../blevesearch/snowballstem/go.mod | 3 - vendor/github.com/blevesearch/zap/v11/go.mod | 12 - vendor/github.com/blevesearch/zap/v12/go.mod | 12 - vendor/github.com/blevesearch/zap/v13/go.mod | 12 - vendor/github.com/blevesearch/zap/v14/go.mod | 12 - vendor/github.com/blevesearch/zap/v15/go.mod | 12 - vendor/github.com/c-bata/go-prompt/go.mod | 11 - vendor/github.com/c-bata/go-prompt/go.sum | 41 - vendor/github.com/cespare/xxhash/go.mod | 6 - vendor/github.com/cespare/xxhash/go.sum | 4 - vendor/github.com/cespare/xxhash/v2/go.mod | 3 - vendor/github.com/cespare/xxhash/v2/go.sum | 0 vendor/github.com/couchbase/vellum/go.mod | 10 - vendor/github.com/couchbase/vellum/go.sum | 40 - .../dgraph-io/badger/v2/.travis.yml | 2 + .../dgraph-io/badger/v2/CHANGELOG.md | 8 + .../github.com/dgraph-io/badger/v2/README.md | 1 - vendor/github.com/dgraph-io/badger/v2/db.go | 4 - .../dgraph-io/badger/v2/dir_unix.go | 2 +- .../github.com/dgraph-io/badger/v2/errors.go | 3 + vendor/github.com/dgraph-io/badger/v2/go.mod | 21 - vendor/github.com/dgraph-io/badger/v2/go.sum | 74 - .../github.com/dgraph-io/badger/v2/options.go | 2 + .../dgraph-io/badger/v2/y/file_dsync.go | 2 +- .../dgraph-io/badger/v2/y/file_nodsync.go | 2 +- .../dgraph-io/badger/v2/y/mmap_unix.go | 2 +- vendor/github.com/dgraph-io/badger/v2/y/y.go | 5 - .../dgraph-io/badger/v2/y/zstd_cgo.go | 36 - .../dgraph-io/badger/v2/y/zstd_nocgo.go | 32 - vendor/github.com/dgraph-io/badger/v3/go.mod | 26 - vendor/github.com/dgraph-io/badger/v3/go.sum | 146 - vendor/github.com/dgraph-io/ristretto/go.mod | 14 - vendor/github.com/dgraph-io/ristretto/go.sum | 24 - .../github.com/dustin/go-humanize/.travis.yml | 16 +- .../dustin/go-humanize/README.markdown | 2 +- .../github.com/dustin/go-humanize/bigbytes.go | 20 +- .../github.com/dustin/go-humanize/commaf.go | 1 + vendor/github.com/dustin/go-humanize/ftoa.go | 3 + .../github.com/dustin/go-humanize/number.go | 2 +- vendor/github.com/dustin/go-humanize/si.go | 4 + vendor/github.com/fatih/color/README.md | 21 +- vendor/github.com/fatih/color/color.go | 109 +- vendor/github.com/fatih/color/doc.go | 139 +- vendor/github.com/fatih/color/go.mod | 8 - vendor/github.com/fatih/color/go.sum | 7 - vendor/github.com/fsnotify/fsnotify/go.mod | 5 - vendor/github.com/fsnotify/fsnotify/go.sum | 2 - .../github.com/getsentry/sentry-go/.craft.yml | 17 +- .../github.com/getsentry/sentry-go/.gitignore | 10 +- .../getsentry/sentry-go/.golangci.yml | 11 +- .../getsentry/sentry-go/CHANGELOG.md | 488 +- .../getsentry/sentry-go/CONTRIBUTING.md | 2 + vendor/github.com/getsentry/sentry-go/LICENSE | 24 +- .../getsentry/sentry-go/MIGRATION.md | 391 +- .../github.com/getsentry/sentry-go/README.md | 35 +- .../github.com/getsentry/sentry-go/client.go | 304 +- vendor/github.com/getsentry/sentry-go/doc.go | 61 +- vendor/github.com/getsentry/sentry-go/dsn.go | 65 +- vendor/github.com/getsentry/sentry-go/go.mod | 34 - vendor/github.com/getsentry/sentry-go/go.sum | 256 - vendor/github.com/getsentry/sentry-go/hub.go | 67 +- .../getsentry/sentry-go/integrations.go | 121 +- .../getsentry/sentry-go/interfaces.go | 263 +- .../internal/crypto/randutil/randutil.go | 23 - .../sentry-go/internal/ratelimit/category.go | 15 +- .../internal/ratelimit/rate_limits.go | 2 +- .../github.com/getsentry/sentry-go/scope.go | 104 +- .../github.com/getsentry/sentry-go/sentry.go | 13 +- .../getsentry/sentry-go/sourcereader.go | 4 +- .../getsentry/sentry-go/span_recorder.go | 9 +- .../getsentry/sentry-go/stacktrace.go | 241 +- .../getsentry/sentry-go/traces_sampler.go | 164 +- .../github.com/getsentry/sentry-go/tracing.go | 590 +- .../getsentry/sentry-go/transport.go | 174 +- vendor/github.com/getsentry/sentry-go/util.go | 77 +- vendor/github.com/gobwas/httphead/option.go | 6 + vendor/github.com/gobwas/ws/.travis.yml | 25 - vendor/github.com/gobwas/ws/LICENSE | 2 +- vendor/github.com/gobwas/ws/Makefile | 11 +- vendor/github.com/gobwas/ws/README.md | 187 +- vendor/github.com/gobwas/ws/cipher.go | 2 +- vendor/github.com/gobwas/ws/dialer.go | 11 +- vendor/github.com/gobwas/ws/errors.go | 29 +- vendor/github.com/gobwas/ws/frame.go | 59 +- vendor/github.com/gobwas/ws/http.go | 46 +- vendor/github.com/gobwas/ws/server.go | 72 +- vendor/github.com/gobwas/ws/wsutil/helper.go | 4 +- vendor/github.com/gobwas/ws/wsutil/reader.go | 38 +- vendor/github.com/gobwas/ws/wsutil/writer.go | 319 +- vendor/github.com/gocql/gocql/go.mod | 13 - vendor/github.com/gocql/gocql/go.sum | 22 - vendor/github.com/golang/snappy/AUTHORS | 1 + vendor/github.com/golang/snappy/CONTRIBUTORS | 2 + vendor/github.com/golang/snappy/decode.go | 83 +- .../github.com/golang/snappy/encode_arm64.s | 4 +- vendor/github.com/golang/snappy/go.mod | 1 - vendor/github.com/google/btree/go.mod | 17 - vendor/github.com/hashicorp/errwrap/go.mod | 1 - .../hashicorp/go-immutable-radix/go.mod | 6 - .../hashicorp/go-immutable-radix/go.sum | 4 - .../github.com/hashicorp/go-multierror/go.mod | 5 - .../github.com/hashicorp/go-multierror/go.sum | 2 - .../github.com/hashicorp/go-sockaddr/go.mod | 8 - .../github.com/hashicorp/go-sockaddr/go.sum | 24 - vendor/github.com/hashicorp/hcl/go.mod | 3 - vendor/github.com/hashicorp/hcl/go.sum | 2 - vendor/github.com/klauspost/compress/LICENSE | 276 + .../klauspost/compress/flate/deflate.go | 283 +- .../klauspost/compress/flate/dict_decoder.go | 24 +- .../klauspost/compress/flate/fast_encoder.go | 86 +- .../compress/flate/huffman_bit_writer.go | 371 +- .../klauspost/compress/flate/huffman_code.go | 121 +- .../klauspost/compress/flate/inflate.go | 257 +- .../klauspost/compress/flate/inflate_gen.go | 729 +- .../klauspost/compress/flate/level1.go | 96 +- .../klauspost/compress/flate/level2.go | 45 +- .../klauspost/compress/flate/level3.go | 80 +- .../klauspost/compress/flate/level4.go | 21 +- .../klauspost/compress/flate/level5.go | 38 +- .../klauspost/compress/flate/level6.go | 40 +- .../klauspost/compress/flate/regmask_other.go | 3 +- .../klauspost/compress/flate/stateless.go | 33 +- .../klauspost/compress/flate/token.go | 49 +- .../klauspost/compress/fse/compress.go | 31 +- .../klauspost/compress/gzip/gunzip.go | 75 +- .../klauspost/compress/huff0/bitreader.go | 130 +- .../klauspost/compress/huff0/bitwriter.go | 115 - .../klauspost/compress/huff0/bytereader.go | 10 - .../klauspost/compress/huff0/compress.go | 188 +- .../klauspost/compress/huff0/decompress.go | 1017 +-- .../klauspost/compress/huff0/huff0.go | 64 + .../klauspost/compress/zlib/reader.go | 8 +- .../klauspost/compress/zstd/README.md | 182 +- .../klauspost/compress/zstd/bitreader.go | 12 +- .../klauspost/compress/zstd/bitwriter.go | 98 +- .../klauspost/compress/zstd/blockdec.go | 546 +- .../klauspost/compress/zstd/blockenc.go | 160 +- .../klauspost/compress/zstd/bytebuf.go | 25 +- .../klauspost/compress/zstd/bytereader.go | 6 - .../klauspost/compress/zstd/decodeheader.go | 93 +- .../klauspost/compress/zstd/decoder.go | 722 +- .../compress/zstd/decoder_options.go | 120 +- .../klauspost/compress/zstd/dict.go | 53 +- .../klauspost/compress/zstd/enc_base.go | 20 +- .../klauspost/compress/zstd/enc_best.go | 217 +- .../klauspost/compress/zstd/enc_better.go | 115 +- .../klauspost/compress/zstd/enc_dfast.go | 102 +- .../klauspost/compress/zstd/enc_fast.go | 220 +- .../klauspost/compress/zstd/encoder.go | 154 +- .../compress/zstd/encoder_options.go | 51 +- .../klauspost/compress/zstd/framedec.go | 410 +- .../klauspost/compress/zstd/fse_decoder.go | 128 +- .../klauspost/compress/zstd/fse_encoder.go | 30 +- .../klauspost/compress/zstd/hash.go | 66 +- .../klauspost/compress/zstd/history.go | 67 +- .../compress/zstd/internal/xxhash/README.md | 49 +- .../compress/zstd/internal/xxhash/xxhash.go | 48 +- .../zstd/internal/xxhash/xxhash_amd64.go | 13 - .../zstd/internal/xxhash/xxhash_amd64.s | 337 +- .../zstd/internal/xxhash/xxhash_other.go | 22 +- .../klauspost/compress/zstd/seqdec.go | 327 +- .../klauspost/compress/zstd/snappy.go | 6 +- .../github.com/klauspost/compress/zstd/zip.go | 78 +- .../klauspost/compress/zstd/zstd.go | 61 +- .../github.com/magiconair/properties/go.mod | 3 - .../github.com/mattn/go-colorable/.travis.yml | 15 - .../github.com/mattn/go-colorable/README.md | 2 +- .../mattn/go-colorable/colorable_appengine.go | 1 + .../mattn/go-colorable/colorable_others.go | 4 +- .../mattn/go-colorable/colorable_windows.go | 14 +- vendor/github.com/mattn/go-colorable/go.mod | 8 - vendor/github.com/mattn/go-colorable/go.sum | 5 - .../mattn/go-colorable/noncolorable.go | 12 +- vendor/github.com/mattn/go-isatty/.travis.yml | 14 - vendor/github.com/mattn/go-isatty/go.mod | 5 - vendor/github.com/mattn/go-isatty/go.sum | 2 - .../github.com/mattn/go-isatty/isatty_bsd.go | 4 +- .../mattn/go-isatty/isatty_others.go | 4 +- .../mattn/go-isatty/isatty_plan9.go | 1 + .../mattn/go-isatty/isatty_solaris.go | 9 +- .../mattn/go-isatty/isatty_tcgets.go | 4 +- .../mattn/go-isatty/isatty_windows.go | 6 +- .../github.com/mattn/go-isatty/renovate.json | 8 - vendor/github.com/mattn/go-runewidth/go.mod | 5 - vendor/github.com/mattn/go-runewidth/go.sum | 2 - vendor/github.com/mattn/go-tty/go.mod | 11 - vendor/github.com/mattn/go-tty/go.sum | 13 - vendor/github.com/miekg/dns/go.mod | 9 - vendor/github.com/miekg/dns/go.sum | 10 - .../github.com/mitchellh/mapstructure/go.mod | 3 - vendor/github.com/mschoch/smat/go.mod | 3 - vendor/github.com/nyaruka/phonenumbers/go.mod | 5 - vendor/github.com/nyaruka/phonenumbers/go.sum | 2 - .../github.com/olekukonko/tablewriter/go.mod | 5 - .../github.com/olekukonko/tablewriter/go.sum | 2 - vendor/github.com/panjf2000/ants/v2/go.mod | 9 - vendor/github.com/panjf2000/ants/v2/go.sum | 13 - vendor/github.com/panjf2000/gnet/go.mod | 18 - vendor/github.com/panjf2000/gnet/go.sum | 61 - vendor/github.com/pelletier/go-toml/go.mod | 3 - vendor/github.com/prometheus/procfs/go.mod | 9 - vendor/github.com/prometheus/procfs/go.sum | 8 - vendor/github.com/rivo/uniseg/go.mod | 3 - vendor/github.com/ronaksoft/memberlist/go.mod | 14 - vendor/github.com/ronaksoft/memberlist/go.sum | 141 - vendor/github.com/ronaksoft/rony/go.mod | 41 - vendor/github.com/scylladb/gocqlx/v2/go.mod | 13 - vendor/github.com/scylladb/gocqlx/v2/go.sum | 32 - vendor/github.com/spf13/afero/go.mod | 9 - vendor/github.com/spf13/afero/go.sum | 29 - vendor/github.com/spf13/cast/go.mod | 7 - vendor/github.com/spf13/cast/go.sum | 6 - vendor/github.com/spf13/cobra/go.mod | 11 - vendor/github.com/spf13/cobra/go.sum | 592 -- .../github.com/spf13/jwalterweatherman/go.mod | 7 - vendor/github.com/spf13/pflag/go.mod | 3 - vendor/github.com/spf13/pflag/go.sum | 0 vendor/github.com/spf13/viper/go.mod | 21 - vendor/github.com/spf13/viper/go.sum | 632 -- vendor/github.com/steveyen/gtreap/go.mod | 3 - vendor/github.com/tidwall/buntdb/go.mod | 12 - vendor/github.com/tidwall/buntdb/go.sum | 22 - vendor/github.com/tidwall/gjson/go.mod | 8 - vendor/github.com/tidwall/gjson/go.sum | 6 - vendor/github.com/tidwall/match/go.mod | 3 - vendor/github.com/valyala/fasthttp/.gitignore | 2 + vendor/github.com/valyala/fasthttp/README.md | 58 +- vendor/github.com/valyala/fasthttp/args.go | 46 +- vendor/github.com/valyala/fasthttp/brotli.go | 18 +- .../github.com/valyala/fasthttp/bytesconv.go | 34 +- .../valyala/fasthttp/bytesconv_32.go | 3 +- .../valyala/fasthttp/bytesconv_64.go | 3 +- vendor/github.com/valyala/fasthttp/client.go | 311 +- .../github.com/valyala/fasthttp/compress.go | 48 +- vendor/github.com/valyala/fasthttp/cookie.go | 28 +- vendor/github.com/valyala/fasthttp/doc.go | 78 +- .../valyala/fasthttp/fasthttputil/ecdsa.key | 5 - .../valyala/fasthttp/fasthttputil/ecdsa.pem | 10 - .../fasthttp/fasthttputil/pipeconns.go | 8 +- vendor/github.com/valyala/fasthttp/fs.go | 277 +- vendor/github.com/valyala/fasthttp/go.mod | 13 - vendor/github.com/valyala/fasthttp/go.sum | 23 - vendor/github.com/valyala/fasthttp/header.go | 969 ++- vendor/github.com/valyala/fasthttp/headers.go | 5 +- vendor/github.com/valyala/fasthttp/http.go | 359 +- .../github.com/valyala/fasthttp/lbclient.go | 39 + vendor/github.com/valyala/fasthttp/nocopy.go | 4 +- .../github.com/valyala/fasthttp/peripconn.go | 4 +- vendor/github.com/valyala/fasthttp/server.go | 545 +- .../valyala/fasthttp/stackless/func.go | 6 +- vendor/github.com/valyala/fasthttp/status.go | 40 +- .../github.com/valyala/fasthttp/streaming.go | 26 +- vendor/github.com/valyala/fasthttp/strings.go | 101 +- .../github.com/valyala/fasthttp/tcpdialer.go | 137 +- vendor/github.com/valyala/fasthttp/uri.go | 368 +- .../github.com/valyala/fasthttp/uri_unix.go | 1 + .../valyala/fasthttp/uri_windows.go | 1 + .../github.com/valyala/fasthttp/userdata.go | 24 + .../github.com/valyala/fasthttp/workerpool.go | 6 +- vendor/github.com/valyala/tcplisten/go.mod | 3 - vendor/github.com/willf/bitset/go.mod | 3 - vendor/github.com/willf/bitset/go.sum | 0 vendor/go.etcd.io/bbolt/go.mod | 5 - vendor/go.etcd.io/bbolt/go.sum | 2 - vendor/go.opencensus.io/go.mod | 12 - vendor/go.opencensus.io/go.sum | 116 - vendor/go.uber.org/atomic/go.mod | 8 - vendor/go.uber.org/atomic/go.sum | 8 - vendor/go.uber.org/multierr/go.mod | 9 - vendor/go.uber.org/multierr/go.sum | 16 - vendor/go.uber.org/zap/go.mod | 14 - vendor/go.uber.org/zap/go.sum | 54 - vendor/golang.org/x/mod/semver/semver.go | 30 +- vendor/golang.org/x/net/AUTHORS | 3 - vendor/golang.org/x/net/CONTRIBUTORS | 3 - vendor/golang.org/x/net/bpf/doc.go | 6 +- .../golang.org/x/net/bpf/vm_instructions.go | 4 +- .../internal/socket/cmsghdr_linux_64bit.go | 4 +- .../x/net/internal/socket/cmsghdr_unix.go | 4 +- .../net/internal/socket/cmsghdr_zos_s390x.go | 14 - .../golang.org/x/net/internal/socket/empty.s | 1 + .../x/net/internal/socket/iovec_64bit.go | 4 +- .../x/net/internal/socket/mmsghdr_unix.go | 96 +- .../x/net/internal/socket/msghdr_linux.go | 3 - .../net/internal/socket/msghdr_linux_64bit.go | 4 +- .../x/net/internal/socket/rawconn_mmsg.go | 44 +- .../x/net/internal/socket/rawconn_msg.go | 59 +- .../x/net/internal/socket/sys_bsd.go | 4 +- .../x/net/internal/socket/sys_linkname.go | 43 - .../x/net/internal/socket/sys_linux_386.go | 29 +- .../x/net/internal/socket/sys_linux_s390x.go | 29 +- .../x/net/internal/socket/sys_solaris.go | 59 - .../x/net/internal/socket/sys_solaris_amd64.s | 11 - .../x/net/internal/socket/sys_stub.go | 6 +- .../x/net/internal/socket/sys_unix.go | 114 +- .../x/net/internal/socket/sys_windows.go | 7 +- .../x/net/internal/socket/sys_zos_s390x.go | 38 +- .../x/net/internal/socket/zsys_darwin_386.go | 30 - .../x/net/internal/socket/zsys_darwin_arm.go | 30 - .../x/net/internal/socket/zsys_linux_ppc.go | 32 +- vendor/golang.org/x/net/ipv4/doc.go | 12 +- vendor/golang.org/x/net/ipv6/dgramopt.go | 2 +- vendor/golang.org/x/net/ipv6/doc.go | 12 +- vendor/golang.org/x/net/trace/histogram.go | 2 +- vendor/golang.org/x/net/trace/trace.go | 2 +- vendor/golang.org/x/sync/AUTHORS | 3 - vendor/golang.org/x/sync/CONTRIBUTORS | 3 - .../x/sync/singleflight/singleflight.go | 11 +- vendor/golang.org/x/sys/AUTHORS | 3 - vendor/golang.org/x/sys/CONTRIBUTORS | 3 - vendor/golang.org/x/sys/execabs/execabs.go | 4 +- .../sys/internal/unsafeheader/unsafeheader.go | 30 - vendor/golang.org/x/sys/unix/README.md | 2 +- vendor/golang.org/x/sys/unix/aliases.go | 2 - vendor/golang.org/x/sys/unix/asm_aix_ppc64.s | 1 - vendor/golang.org/x/sys/unix/asm_bsd_386.s | 2 - vendor/golang.org/x/sys/unix/asm_bsd_amd64.s | 2 - vendor/golang.org/x/sys/unix/asm_bsd_arm.s | 2 - vendor/golang.org/x/sys/unix/asm_bsd_arm64.s | 2 - vendor/golang.org/x/sys/unix/asm_linux_386.s | 1 - .../golang.org/x/sys/unix/asm_linux_amd64.s | 1 - vendor/golang.org/x/sys/unix/asm_linux_arm.s | 1 - .../golang.org/x/sys/unix/asm_linux_arm64.s | 3 - .../golang.org/x/sys/unix/asm_linux_mips64x.s | 3 - .../golang.org/x/sys/unix/asm_linux_mipsx.s | 3 - .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 3 - .../golang.org/x/sys/unix/asm_linux_riscv64.s | 2 - .../golang.org/x/sys/unix/asm_linux_s390x.s | 3 - .../x/sys/unix/asm_openbsd_mips64.s | 1 - .../golang.org/x/sys/unix/asm_solaris_amd64.s | 1 - vendor/golang.org/x/sys/unix/asm_zos_s390x.s | 3 - vendor/golang.org/x/sys/unix/cap_freebsd.go | 1 - vendor/golang.org/x/sys/unix/constants.go | 1 - vendor/golang.org/x/sys/unix/dev_aix_ppc.go | 1 - vendor/golang.org/x/sys/unix/dev_aix_ppc64.go | 1 - vendor/golang.org/x/sys/unix/dev_zos.go | 1 - vendor/golang.org/x/sys/unix/dirent.go | 3 +- vendor/golang.org/x/sys/unix/endian_big.go | 1 - vendor/golang.org/x/sys/unix/endian_little.go | 3 +- vendor/golang.org/x/sys/unix/env_unix.go | 1 - vendor/golang.org/x/sys/unix/epoll_zos.go | 1 - .../x/sys/unix/errors_freebsd_386.go | 233 - .../x/sys/unix/errors_freebsd_amd64.go | 233 - .../x/sys/unix/errors_freebsd_arm.go | 226 - .../x/sys/unix/errors_freebsd_arm64.go | 17 - vendor/golang.org/x/sys/unix/fcntl.go | 1 - .../x/sys/unix/fcntl_linux_32bit.go | 1 - vendor/golang.org/x/sys/unix/fdset.go | 1 - vendor/golang.org/x/sys/unix/fstatfs_zos.go | 1 - vendor/golang.org/x/sys/unix/gccgo.go | 3 +- vendor/golang.org/x/sys/unix/gccgo_c.c | 3 +- .../x/sys/unix/gccgo_linux_amd64.go | 1 - vendor/golang.org/x/sys/unix/ioctl.go | 75 - vendor/golang.org/x/sys/unix/ioctl_linux.go | 121 +- vendor/golang.org/x/sys/unix/ioctl_zos.go | 21 +- vendor/golang.org/x/sys/unix/mkall.sh | 64 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 52 +- vendor/golang.org/x/sys/unix/pagesize_unix.go | 1 - .../golang.org/x/sys/unix/pledge_openbsd.go | 92 +- vendor/golang.org/x/sys/unix/ptrace_darwin.go | 1 - vendor/golang.org/x/sys/unix/ptrace_ios.go | 1 - vendor/golang.org/x/sys/unix/race.go | 1 - vendor/golang.org/x/sys/unix/race0.go | 1 - .../x/sys/unix/readdirent_getdents.go | 1 - .../x/sys/unix/readdirent_getdirentries.go | 1 - .../golang.org/x/sys/unix/sockcmsg_linux.go | 49 + vendor/golang.org/x/sys/unix/sockcmsg_unix.go | 15 +- .../x/sys/unix/sockcmsg_unix_other.go | 1 - vendor/golang.org/x/sys/unix/str.go | 27 - vendor/golang.org/x/sys/unix/syscall.go | 11 +- vendor/golang.org/x/sys/unix/syscall_aix.go | 131 +- .../golang.org/x/sys/unix/syscall_aix_ppc.go | 2 - .../x/sys/unix/syscall_aix_ppc64.go | 2 - vendor/golang.org/x/sys/unix/syscall_bsd.go | 119 +- .../x/sys/unix/syscall_darwin.1_12.go | 32 - .../x/sys/unix/syscall_darwin.1_13.go | 108 - .../golang.org/x/sys/unix/syscall_darwin.go | 453 +- .../x/sys/unix/syscall_darwin_amd64.go | 1 - .../x/sys/unix/syscall_darwin_arm64.go | 1 - .../x/sys/unix/syscall_darwin_libSystem.go | 1 - .../x/sys/unix/syscall_dragonfly.go | 222 +- .../x/sys/unix/syscall_dragonfly_amd64.go | 1 - .../golang.org/x/sys/unix/syscall_freebsd.go | 571 +- .../x/sys/unix/syscall_freebsd_386.go | 13 +- .../x/sys/unix/syscall_freebsd_amd64.go | 13 +- .../x/sys/unix/syscall_freebsd_arm.go | 11 +- .../x/sys/unix/syscall_freebsd_arm64.go | 11 +- .../golang.org/x/sys/unix/syscall_illumos.go | 104 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 769 ++- .../x/sys/unix/syscall_linux_386.go | 84 +- .../x/sys/unix/syscall_linux_amd64.go | 62 +- .../x/sys/unix/syscall_linux_amd64_gc.go | 1 - .../x/sys/unix/syscall_linux_arm.go | 81 +- .../x/sys/unix/syscall_linux_arm64.go | 76 +- .../golang.org/x/sys/unix/syscall_linux_gc.go | 1 - .../x/sys/unix/syscall_linux_gc_386.go | 1 - .../x/sys/unix/syscall_linux_gc_arm.go | 1 - .../x/sys/unix/syscall_linux_gccgo_386.go | 1 - .../x/sys/unix/syscall_linux_gccgo_arm.go | 1 - .../x/sys/unix/syscall_linux_mips64x.go | 53 +- .../x/sys/unix/syscall_linux_mipsx.go | 75 +- .../x/sys/unix/syscall_linux_ppc.go | 78 +- .../x/sys/unix/syscall_linux_ppc64x.go | 50 +- .../x/sys/unix/syscall_linux_riscv64.go | 74 +- .../x/sys/unix/syscall_linux_s390x.go | 55 +- .../x/sys/unix/syscall_linux_sparc64.go | 48 +- .../golang.org/x/sys/unix/syscall_netbsd.go | 315 +- .../x/sys/unix/syscall_netbsd_386.go | 1 - .../x/sys/unix/syscall_netbsd_amd64.go | 1 - .../x/sys/unix/syscall_netbsd_arm.go | 1 - .../x/sys/unix/syscall_netbsd_arm64.go | 1 - .../golang.org/x/sys/unix/syscall_openbsd.go | 121 +- .../x/sys/unix/syscall_openbsd_386.go | 1 - .../x/sys/unix/syscall_openbsd_amd64.go | 1 - .../x/sys/unix/syscall_openbsd_arm.go | 1 - .../x/sys/unix/syscall_openbsd_arm64.go | 1 - .../x/sys/unix/syscall_openbsd_mips64.go | 4 + .../golang.org/x/sys/unix/syscall_solaris.go | 544 +- .../x/sys/unix/syscall_solaris_amd64.go | 1 - vendor/golang.org/x/sys/unix/syscall_unix.go | 199 +- .../golang.org/x/sys/unix/syscall_unix_gc.go | 6 +- .../x/sys/unix/syscall_unix_gc_ppc64x.go | 3 - .../x/sys/unix/syscall_zos_s390x.go | 217 +- vendor/golang.org/x/sys/unix/timestruct.go | 3 +- .../golang.org/x/sys/unix/unveil_openbsd.go | 41 +- vendor/golang.org/x/sys/unix/xattr_bsd.go | 105 +- .../golang.org/x/sys/unix/zerrors_aix_ppc.go | 1 - .../x/sys/unix/zerrors_aix_ppc64.go | 1 - .../x/sys/unix/zerrors_darwin_amd64.go | 3145 ++++----- .../x/sys/unix/zerrors_darwin_arm64.go | 3145 ++++----- .../x/sys/unix/zerrors_dragonfly_amd64.go | 1 - .../x/sys/unix/zerrors_freebsd_386.go | 110 +- .../x/sys/unix/zerrors_freebsd_amd64.go | 108 +- .../x/sys/unix/zerrors_freebsd_arm.go | 221 +- .../x/sys/unix/zerrors_freebsd_arm64.go | 101 +- vendor/golang.org/x/sys/unix/zerrors_linux.go | 676 +- .../x/sys/unix/zerrors_linux_386.go | 25 +- .../x/sys/unix/zerrors_linux_amd64.go | 25 +- .../x/sys/unix/zerrors_linux_arm.go | 25 +- .../x/sys/unix/zerrors_linux_arm64.go | 28 +- .../x/sys/unix/zerrors_linux_mips.go | 25 +- .../x/sys/unix/zerrors_linux_mips64.go | 25 +- .../x/sys/unix/zerrors_linux_mips64le.go | 25 +- .../x/sys/unix/zerrors_linux_mipsle.go | 25 +- .../x/sys/unix/zerrors_linux_ppc.go | 25 +- .../x/sys/unix/zerrors_linux_ppc64.go | 25 +- .../x/sys/unix/zerrors_linux_ppc64le.go | 25 +- .../x/sys/unix/zerrors_linux_riscv64.go | 28 +- .../x/sys/unix/zerrors_linux_s390x.go | 25 +- .../x/sys/unix/zerrors_linux_sparc64.go | 73 +- .../x/sys/unix/zerrors_netbsd_386.go | 1 - .../x/sys/unix/zerrors_netbsd_amd64.go | 1 - .../x/sys/unix/zerrors_netbsd_arm.go | 1 - .../x/sys/unix/zerrors_netbsd_arm64.go | 1 - .../x/sys/unix/zerrors_openbsd_386.go | 360 +- .../x/sys/unix/zerrors_openbsd_amd64.go | 190 +- .../x/sys/unix/zerrors_openbsd_arm.go | 352 +- .../x/sys/unix/zerrors_openbsd_arm64.go | 161 +- .../x/sys/unix/zerrors_openbsd_mips64.go | 96 +- .../x/sys/unix/zerrors_solaris_amd64.go | 1 - .../x/sys/unix/zerrors_zos_s390x.go | 1 - .../x/sys/unix/zptrace_armnn_linux.go | 10 +- .../x/sys/unix/zptrace_linux_arm64.go | 4 +- .../x/sys/unix/zptrace_mipsnn_linux.go | 10 +- .../x/sys/unix/zptrace_mipsnnle_linux.go | 10 +- .../x/sys/unix/zptrace_x86_linux.go | 10 +- .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 72 +- .../x/sys/unix/zsyscall_aix_ppc64.go | 71 +- .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 38 +- .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 37 +- .../x/sys/unix/zsyscall_darwin_amd64.1_13.go | 40 - .../x/sys/unix/zsyscall_darwin_amd64.1_13.s | 25 - .../x/sys/unix/zsyscall_darwin_amd64.go | 202 +- .../x/sys/unix/zsyscall_darwin_amd64.s | 205 +- .../x/sys/unix/zsyscall_darwin_arm64.1_13.go | 40 - .../x/sys/unix/zsyscall_darwin_arm64.1_13.s | 25 - .../x/sys/unix/zsyscall_darwin_arm64.go | 202 +- .../x/sys/unix/zsyscall_darwin_arm64.s | 205 +- .../x/sys/unix/zsyscall_dragonfly_amd64.go | 53 +- .../x/sys/unix/zsyscall_freebsd_386.go | 208 +- .../x/sys/unix/zsyscall_freebsd_amd64.go | 206 +- .../x/sys/unix/zsyscall_freebsd_arm.go | 236 +- .../x/sys/unix/zsyscall_freebsd_arm64.go | 206 +- .../x/sys/unix/zsyscall_illumos_amd64.go | 39 +- .../golang.org/x/sys/unix/zsyscall_linux.go | 336 +- .../x/sys/unix/zsyscall_linux_386.go | 105 +- .../x/sys/unix/zsyscall_linux_amd64.go | 139 +- .../x/sys/unix/zsyscall_linux_arm.go | 119 +- .../x/sys/unix/zsyscall_linux_arm64.go | 77 +- .../x/sys/unix/zsyscall_linux_mips.go | 118 +- .../x/sys/unix/zsyscall_linux_mips64.go | 95 +- .../x/sys/unix/zsyscall_linux_mips64le.go | 98 +- .../x/sys/unix/zsyscall_linux_mipsle.go | 118 +- .../x/sys/unix/zsyscall_linux_ppc.go | 132 +- .../x/sys/unix/zsyscall_linux_ppc64.go | 132 +- .../x/sys/unix/zsyscall_linux_ppc64le.go | 132 +- .../x/sys/unix/zsyscall_linux_riscv64.go | 93 +- .../x/sys/unix/zsyscall_linux_s390x.go | 109 +- .../x/sys/unix/zsyscall_linux_sparc64.go | 105 +- .../x/sys/unix/zsyscall_netbsd_386.go | 76 +- .../x/sys/unix/zsyscall_netbsd_amd64.go | 76 +- .../x/sys/unix/zsyscall_netbsd_arm.go | 76 +- .../x/sys/unix/zsyscall_netbsd_arm64.go | 76 +- .../x/sys/unix/zsyscall_openbsd_386.go | 888 ++- .../x/sys/unix/zsyscall_openbsd_amd64.go | 888 ++- .../x/sys/unix/zsyscall_openbsd_arm.go | 888 ++- .../x/sys/unix/zsyscall_openbsd_arm64.go | 888 ++- .../x/sys/unix/zsyscall_openbsd_mips64.go | 888 ++- .../x/sys/unix/zsyscall_solaris_amd64.go | 404 +- .../x/sys/unix/zsyscall_zos_s390x.go | 24 +- .../x/sys/unix/zsysctl_openbsd_386.go | 52 +- .../x/sys/unix/zsysctl_openbsd_amd64.go | 18 +- .../x/sys/unix/zsysctl_openbsd_arm.go | 52 +- .../x/sys/unix/zsysctl_openbsd_arm64.go | 12 +- .../x/sys/unix/zsysctl_openbsd_mips64.go | 4 +- .../x/sys/unix/zsysnum_darwin_amd64.go | 1 - .../x/sys/unix/zsysnum_darwin_arm64.go | 1 - .../x/sys/unix/zsysnum_dragonfly_amd64.go | 1 - .../x/sys/unix/zsysnum_freebsd_386.go | 108 +- .../x/sys/unix/zsysnum_freebsd_amd64.go | 108 +- .../x/sys/unix/zsysnum_freebsd_arm.go | 108 +- .../x/sys/unix/zsysnum_freebsd_arm64.go | 108 +- .../x/sys/unix/zsysnum_linux_386.go | 13 +- .../x/sys/unix/zsysnum_linux_amd64.go | 722 +- .../x/sys/unix/zsysnum_linux_arm.go | 13 +- .../x/sys/unix/zsysnum_linux_arm64.go | 611 +- .../x/sys/unix/zsysnum_linux_mips.go | 12 +- .../x/sys/unix/zsysnum_linux_mips64.go | 706 +- .../x/sys/unix/zsysnum_linux_mips64le.go | 706 +- .../x/sys/unix/zsysnum_linux_mipsle.go | 12 +- .../x/sys/unix/zsysnum_linux_ppc.go | 12 +- .../x/sys/unix/zsysnum_linux_ppc64.go | 804 +-- .../x/sys/unix/zsysnum_linux_ppc64le.go | 804 +-- .../x/sys/unix/zsysnum_linux_riscv64.go | 611 +- .../x/sys/unix/zsysnum_linux_s390x.go | 735 +- .../x/sys/unix/zsysnum_linux_sparc64.go | 762 ++- .../x/sys/unix/zsysnum_netbsd_386.go | 1 - .../x/sys/unix/zsysnum_netbsd_amd64.go | 1 - .../x/sys/unix/zsysnum_netbsd_arm.go | 1 - .../x/sys/unix/zsysnum_netbsd_arm64.go | 1 - .../x/sys/unix/zsysnum_openbsd_386.go | 2 +- .../x/sys/unix/zsysnum_openbsd_amd64.go | 2 +- .../x/sys/unix/zsysnum_openbsd_arm.go | 2 +- .../x/sys/unix/zsysnum_openbsd_arm64.go | 2 +- .../x/sys/unix/zsysnum_openbsd_mips64.go | 2 +- .../x/sys/unix/zsysnum_zos_s390x.go | 1 - .../golang.org/x/sys/unix/ztypes_aix_ppc.go | 1 - .../golang.org/x/sys/unix/ztypes_aix_ppc64.go | 1 - .../x/sys/unix/ztypes_darwin_amd64.go | 208 +- .../x/sys/unix/ztypes_darwin_arm64.go | 208 +- .../x/sys/unix/ztypes_dragonfly_amd64.go | 1 - .../x/sys/unix/ztypes_freebsd_386.go | 115 +- .../x/sys/unix/ztypes_freebsd_amd64.go | 113 +- .../x/sys/unix/ztypes_freebsd_arm.go | 162 +- .../x/sys/unix/ztypes_freebsd_arm64.go | 111 +- .../x/sys/unix/ztypes_illumos_amd64.go | 40 - vendor/golang.org/x/sys/unix/ztypes_linux.go | 2143 +++++- .../golang.org/x/sys/unix/ztypes_linux_386.go | 71 +- .../x/sys/unix/ztypes_linux_amd64.go | 68 +- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 71 +- .../x/sys/unix/ztypes_linux_arm64.go | 68 +- .../x/sys/unix/ztypes_linux_mips.go | 70 +- .../x/sys/unix/ztypes_linux_mips64.go | 68 +- .../x/sys/unix/ztypes_linux_mips64le.go | 68 +- .../x/sys/unix/ztypes_linux_mipsle.go | 70 +- .../golang.org/x/sys/unix/ztypes_linux_ppc.go | 72 +- .../x/sys/unix/ztypes_linux_ppc64.go | 67 +- .../x/sys/unix/ztypes_linux_ppc64le.go | 67 +- .../x/sys/unix/ztypes_linux_riscv64.go | 95 +- .../x/sys/unix/ztypes_linux_s390x.go | 71 +- .../x/sys/unix/ztypes_linux_sparc64.go | 67 +- .../x/sys/unix/ztypes_netbsd_386.go | 85 +- .../x/sys/unix/ztypes_netbsd_amd64.go | 85 +- .../x/sys/unix/ztypes_netbsd_arm.go | 85 +- .../x/sys/unix/ztypes_netbsd_arm64.go | 85 +- .../x/sys/unix/ztypes_openbsd_386.go | 117 +- .../x/sys/unix/ztypes_openbsd_amd64.go | 53 +- .../x/sys/unix/ztypes_openbsd_arm.go | 29 +- .../x/sys/unix/ztypes_openbsd_arm64.go | 29 +- .../x/sys/unix/ztypes_openbsd_mips64.go | 29 +- .../x/sys/unix/ztypes_solaris_amd64.go | 78 +- .../golang.org/x/sys/unix/ztypes_zos_s390x.go | 12 +- vendor/golang.org/x/sys/windows/aliases.go | 3 +- vendor/golang.org/x/sys/windows/empty.s | 1 - .../golang.org/x/sys/windows/env_windows.go | 6 +- vendor/golang.org/x/sys/windows/eventlog.go | 2 +- .../golang.org/x/sys/windows/exec_windows.go | 139 +- .../x/sys/windows/memory_windows.go | 11 + vendor/golang.org/x/sys/windows/mksyscall.go | 4 +- vendor/golang.org/x/sys/windows/race.go | 2 +- vendor/golang.org/x/sys/windows/race0.go | 2 +- .../x/sys/windows/security_windows.go | 22 +- vendor/golang.org/x/sys/windows/service.go | 26 +- .../x/sys/windows/setupapierrors_windows.go | 100 - vendor/golang.org/x/sys/windows/str.go | 2 +- vendor/golang.org/x/sys/windows/syscall.go | 12 +- .../x/sys/windows/syscall_windows.go | 312 +- .../golang.org/x/sys/windows/types_windows.go | 667 +- .../x/sys/windows/zsyscall_windows.go | 766 ++- vendor/golang.org/x/text/AUTHORS | 3 - vendor/golang.org/x/text/CONTRIBUTORS | 3 - .../x/text/unicode/norm/forminfo.go | 11 +- .../x/text/unicode/norm/normalize.go | 11 +- .../x/text/unicode/norm/tables13.0.0.go | 4 +- vendor/golang.org/x/tools/AUTHORS | 3 - vendor/golang.org/x/tools/CONTRIBUTORS | 3 - .../x/tools/go/gcexportdata/gcexportdata.go | 104 +- .../x/tools/go/gcexportdata/importer.go | 2 + .../x/tools/go/internal/gcimporter/bexport.go | 852 --- .../x/tools/go/internal/gcimporter/bimport.go | 1039 --- .../go/internal/gcimporter/exportdata.go | 93 - .../go/internal/gcimporter/gcimporter.go | 1078 --- .../x/tools/go/internal/gcimporter/iexport.go | 781 --- .../x/tools/go/internal/gcimporter/iimport.go | 676 -- .../go/internal/gcimporter/newInterface10.go | 22 - .../go/internal/gcimporter/newInterface11.go | 14 - vendor/golang.org/x/tools/go/packages/doc.go | 1 - .../golang.org/x/tools/go/packages/golist.go | 114 +- .../x/tools/go/packages/loadmode_string.go | 4 +- .../x/tools/go/packages/packages.go | 165 +- .../x/tools/internal/gocommand/invoke.go | 105 +- .../x/tools/internal/gocommand/vendor.go | 22 +- .../x/tools/internal/gocommand/version.go | 36 +- .../internal/packagesinternal/packages.go | 2 + .../tools/internal/typesinternal/errorcode.go | 196 +- .../typesinternal/errorcode_string.go | 40 +- .../x/tools/internal/typesinternal/types.go | 11 +- vendor/golang.org/x/xerrors/LICENSE | 27 - vendor/golang.org/x/xerrors/PATENTS | 22 - vendor/golang.org/x/xerrors/README | 2 - vendor/golang.org/x/xerrors/adaptor.go | 193 - vendor/golang.org/x/xerrors/codereview.cfg | 1 - vendor/golang.org/x/xerrors/doc.go | 22 - vendor/golang.org/x/xerrors/errors.go | 33 - vendor/golang.org/x/xerrors/fmt.go | 187 - vendor/golang.org/x/xerrors/format.go | 34 - vendor/golang.org/x/xerrors/frame.go | 56 - vendor/golang.org/x/xerrors/go.mod | 3 - .../golang.org/x/xerrors/internal/internal.go | 8 - vendor/golang.org/x/xerrors/wrap.go | 106 - vendor/google.golang.org/protobuf/AUTHORS | 3 - .../google.golang.org/protobuf/CONTRIBUTORS | 3 - .../protobuf/encoding/protojson/decode.go | 174 +- .../protobuf/encoding/protojson/doc.go | 2 +- .../protobuf/encoding/protojson/encode.go | 51 +- .../encoding/protojson/well_known_types.go | 88 +- .../protobuf/encoding/prototext/decode.go | 116 +- .../protobuf/encoding/prototext/encode.go | 39 +- .../protobuf/encoding/protowire/wire.go | 31 +- .../protobuf/internal/descfmt/stringer.go | 66 +- .../internal/encoding/defval/default.go | 78 +- .../protobuf/internal/encoding/json/decode.go | 2 +- .../encoding/messageset/messageset.go | 7 +- .../protobuf/internal/encoding/tag/tag.go | 96 +- .../protobuf/internal/encoding/text/decode.go | 37 +- .../internal/encoding/text/decode_number.go | 49 +- .../protobuf/internal/encoding/text/doc.go | 4 +- .../protobuf/internal/errors/is_go112.go | 1 + .../protobuf/internal/errors/is_go113.go | 1 + .../protobuf/internal/filedesc/build.go | 19 +- .../protobuf/internal/filedesc/desc.go | 380 +- .../protobuf/internal/filedesc/desc_init.go | 36 +- .../protobuf/internal/filedesc/desc_lazy.go | 80 +- .../protobuf/internal/filedesc/desc_list.go | 167 +- .../protobuf/internal/filedesc/placeholder.go | 136 +- .../protobuf/internal/filetype/build.go | 87 +- .../internal/flags/proto_legacy_disable.go | 1 + .../internal/flags/proto_legacy_enable.go | 1 + .../protobuf/internal/genid/descriptor_gen.go | 90 +- .../protobuf/internal/impl/api_export.go | 42 +- .../protobuf/internal/impl/checkinit.go | 12 +- .../protobuf/internal/impl/codec_extension.go | 36 +- .../protobuf/internal/impl/codec_field.go | 90 +- .../protobuf/internal/impl/codec_map.go | 20 +- .../protobuf/internal/impl/codec_map_go111.go | 1 + .../protobuf/internal/impl/codec_map_go112.go | 1 + .../protobuf/internal/impl/codec_message.go | 30 +- .../protobuf/internal/impl/codec_reflect.go | 1 + .../protobuf/internal/impl/codec_tables.go | 290 +- .../protobuf/internal/impl/codec_unsafe.go | 1 + .../protobuf/internal/impl/convert.go | 229 +- .../protobuf/internal/impl/convert_list.go | 42 +- .../protobuf/internal/impl/convert_map.go | 32 +- .../protobuf/internal/impl/decode.go | 29 +- .../protobuf/internal/impl/enum.go | 10 +- .../protobuf/internal/impl/extension.go | 26 +- .../protobuf/internal/impl/legacy_enum.go | 57 +- .../protobuf/internal/impl/legacy_export.go | 18 +- .../internal/impl/legacy_extension.go | 100 +- .../protobuf/internal/impl/legacy_message.go | 122 +- .../protobuf/internal/impl/merge.go | 32 +- .../protobuf/internal/impl/message.go | 41 +- .../protobuf/internal/impl/message_reflect.go | 74 +- .../internal/impl/message_reflect_field.go | 118 +- .../protobuf/internal/impl/pointer_reflect.go | 1 + .../protobuf/internal/impl/pointer_unsafe.go | 1 + .../protobuf/internal/impl/validate.go | 50 +- .../protobuf/internal/impl/weak.go | 16 +- .../protobuf/internal/order/order.go | 16 +- .../protobuf/internal/order/range.go | 22 +- .../protobuf/internal/strs/strings_pure.go | 1 + .../protobuf/internal/strs/strings_unsafe.go | 9 +- .../protobuf/internal/version/version.go | 54 +- .../protobuf/proto/decode.go | 20 +- .../google.golang.org/protobuf/proto/doc.go | 24 +- .../protobuf/proto/encode.go | 5 +- .../google.golang.org/protobuf/proto/equal.go | 178 +- .../protobuf/proto/proto_methods.go | 1 + .../protobuf/proto/proto_reflect.go | 1 + .../reflect/protodesc/desc_resolve.go | 6 +- .../protobuf/reflect/protoreflect/methods.go | 1 + .../protobuf/reflect/protoreflect/proto.go | 32 +- .../protobuf/reflect/protoreflect/source.go | 1 + .../reflect/protoreflect/source_gen.go | 14 + .../protobuf/reflect/protoreflect/type.go | 1 + .../protobuf/reflect/protoreflect/value.go | 2 +- .../reflect/protoreflect/value_pure.go | 1 + .../reflect/protoreflect/value_union.go | 27 + .../reflect/protoreflect/value_unsafe.go | 1 + .../reflect/protoregistry/registry.go | 4 +- .../protobuf/runtime/protoiface/methods.go | 1 + .../protobuf/runtime/protoimpl/version.go | 8 +- .../types/descriptorpb/descriptor.pb.go | 1547 +++-- .../protobuf/types/known/anypb/any.pb.go | 135 +- .../types/known/durationpb/duration.pb.go | 63 +- .../types/known/timestamppb/timestamp.pb.go | 61 +- vendor/gopkg.in/ini.v1/.gitignore | 1 + vendor/gopkg.in/ini.v1/README.md | 4 +- vendor/gopkg.in/ini.v1/codecov.yml | 9 +- vendor/gopkg.in/ini.v1/deprecated.go | 5 +- vendor/gopkg.in/ini.v1/error.go | 15 + vendor/gopkg.in/ini.v1/file.go | 44 +- vendor/gopkg.in/ini.v1/ini.go | 12 +- vendor/gopkg.in/ini.v1/key.go | 36 +- vendor/gopkg.in/ini.v1/parser.go | 47 +- vendor/gopkg.in/ini.v1/section.go | 2 +- vendor/gopkg.in/yaml.v2/go.mod | 5 - vendor/modules.txt | 208 +- 1059 files changed, 62136 insertions(+), 213234 deletions(-) delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/accounts.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/accounts.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/admin.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/admin.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/auth.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/auth.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/calendar.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/calendar.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.bot.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.bot.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.community.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.community.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.groups.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.groups.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.labels.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.labels.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.actions.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.actions.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.markups.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.markups.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.medias.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.medias.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.password.algorithms.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.password.algorithms.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.phone.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.phone.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.wallpaper.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/chat.wallpaper.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/client.call.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/client.call.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/client.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/client.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/client.updates.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/client.updates.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/constructors.json delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/contacts.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/contacts.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/core.types.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/core.types.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/crypto.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/dev.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/dev.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/errors.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/files.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/files.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/gif.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/gif.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/public.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/public.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/rpc.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/service.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/service.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/system.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/system.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/team.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/team.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/updates.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/updates.rony.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/users.pb.go delete mode 100644 vendor/git.ronaksoft.com/river/msg/go/msg/users.rony.go delete mode 100644 vendor/github.com/DataDog/zstd/LICENSE delete mode 100644 vendor/github.com/DataDog/zstd/README.md delete mode 100644 vendor/github.com/DataDog/zstd/ZSTD_LICENSE delete mode 100644 vendor/github.com/DataDog/zstd/bitstream.h delete mode 100644 vendor/github.com/DataDog/zstd/compiler.h delete mode 100644 vendor/github.com/DataDog/zstd/cover.c delete mode 100644 vendor/github.com/DataDog/zstd/cover.h delete mode 100644 vendor/github.com/DataDog/zstd/cpu.h delete mode 100644 vendor/github.com/DataDog/zstd/debug.c delete mode 100644 vendor/github.com/DataDog/zstd/debug.h delete mode 100644 vendor/github.com/DataDog/zstd/divsufsort.c delete mode 100644 vendor/github.com/DataDog/zstd/divsufsort.h delete mode 100644 vendor/github.com/DataDog/zstd/entropy_common.c delete mode 100644 vendor/github.com/DataDog/zstd/error_private.c delete mode 100644 vendor/github.com/DataDog/zstd/error_private.h delete mode 100644 vendor/github.com/DataDog/zstd/errors.go delete mode 100644 vendor/github.com/DataDog/zstd/fastcover.c delete mode 100644 vendor/github.com/DataDog/zstd/fse.h delete mode 100644 vendor/github.com/DataDog/zstd/fse_compress.c delete mode 100644 vendor/github.com/DataDog/zstd/fse_decompress.c delete mode 100644 vendor/github.com/DataDog/zstd/hist.c delete mode 100644 vendor/github.com/DataDog/zstd/hist.h delete mode 100644 vendor/github.com/DataDog/zstd/huf.h delete mode 100644 vendor/github.com/DataDog/zstd/huf_compress.c delete mode 100644 vendor/github.com/DataDog/zstd/huf_decompress.c delete mode 100644 vendor/github.com/DataDog/zstd/mem.h delete mode 100644 vendor/github.com/DataDog/zstd/pool.c delete mode 100644 vendor/github.com/DataDog/zstd/pool.h delete mode 100644 vendor/github.com/DataDog/zstd/threading.c delete mode 100644 vendor/github.com/DataDog/zstd/threading.h delete mode 100644 vendor/github.com/DataDog/zstd/travis_test_32.sh delete mode 100644 vendor/github.com/DataDog/zstd/update.txt delete mode 100644 vendor/github.com/DataDog/zstd/xxhash.c delete mode 100644 vendor/github.com/DataDog/zstd/xxhash.h delete mode 100644 vendor/github.com/DataDog/zstd/zbuff.h delete mode 100644 vendor/github.com/DataDog/zstd/zbuff_common.c delete mode 100644 vendor/github.com/DataDog/zstd/zbuff_compress.c delete mode 100644 vendor/github.com/DataDog/zstd/zbuff_decompress.c delete mode 100644 vendor/github.com/DataDog/zstd/zdict.c delete mode 100644 vendor/github.com/DataDog/zstd/zdict.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd.go delete mode 100644 vendor/github.com/DataDog/zstd/zstd.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_common.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_compress.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_compress_internal.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_compress_literals.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_compress_literals.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_compress_sequences.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_compress_sequences.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_cwksp.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_ddict.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_ddict.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_decompress.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_decompress_block.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_decompress_block.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_decompress_internal.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_double_fast.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_double_fast.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_errors.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_fast.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_fast.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_internal.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_lazy.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_lazy.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_ldm.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_ldm.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_legacy.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_opt.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_opt.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_stream.go delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v01.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v01.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v02.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v02.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v03.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v03.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v04.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v04.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v05.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v05.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v06.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v06.h delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v07.c delete mode 100644 vendor/github.com/DataDog/zstd/zstd_v07.h delete mode 100644 vendor/github.com/DataDog/zstd/zstdmt_compress.c delete mode 100644 vendor/github.com/DataDog/zstd/zstdmt_compress.h delete mode 100644 vendor/github.com/RoaringBitmap/roaring/go.mod delete mode 100644 vendor/github.com/RoaringBitmap/roaring/go.sum delete mode 100644 vendor/github.com/allegro/bigcache/v2/go.mod delete mode 100644 vendor/github.com/allegro/bigcache/v2/go.sum delete mode 100644 vendor/github.com/andybalholm/brotli/go.mod delete mode 100644 vendor/github.com/andybalholm/brotli/go.sum delete mode 100644 vendor/github.com/armon/go-metrics/go.mod delete mode 100644 vendor/github.com/armon/go-metrics/go.sum delete mode 100644 vendor/github.com/blevesearch/bleve/go.mod delete mode 100644 vendor/github.com/blevesearch/go-porterstemmer/go.mod delete mode 100644 vendor/github.com/blevesearch/mmap-go/go.mod delete mode 100644 vendor/github.com/blevesearch/mmap-go/go.sum delete mode 100644 vendor/github.com/blevesearch/segment/go.mod delete mode 100644 vendor/github.com/blevesearch/snowballstem/go.mod delete mode 100644 vendor/github.com/blevesearch/zap/v11/go.mod delete mode 100644 vendor/github.com/blevesearch/zap/v12/go.mod delete mode 100644 vendor/github.com/blevesearch/zap/v13/go.mod delete mode 100644 vendor/github.com/blevesearch/zap/v14/go.mod delete mode 100644 vendor/github.com/blevesearch/zap/v15/go.mod delete mode 100644 vendor/github.com/c-bata/go-prompt/go.mod delete mode 100644 vendor/github.com/c-bata/go-prompt/go.sum delete mode 100644 vendor/github.com/cespare/xxhash/go.mod delete mode 100644 vendor/github.com/cespare/xxhash/go.sum delete mode 100644 vendor/github.com/cespare/xxhash/v2/go.mod delete mode 100644 vendor/github.com/cespare/xxhash/v2/go.sum delete mode 100644 vendor/github.com/couchbase/vellum/go.mod delete mode 100644 vendor/github.com/couchbase/vellum/go.sum delete mode 100644 vendor/github.com/dgraph-io/badger/v2/go.mod delete mode 100644 vendor/github.com/dgraph-io/badger/v2/go.sum delete mode 100644 vendor/github.com/dgraph-io/badger/v2/y/zstd_cgo.go delete mode 100644 vendor/github.com/dgraph-io/badger/v2/y/zstd_nocgo.go delete mode 100644 vendor/github.com/dgraph-io/badger/v3/go.mod delete mode 100644 vendor/github.com/dgraph-io/badger/v3/go.sum delete mode 100644 vendor/github.com/dgraph-io/ristretto/go.mod delete mode 100644 vendor/github.com/dgraph-io/ristretto/go.sum delete mode 100644 vendor/github.com/fatih/color/go.mod delete mode 100644 vendor/github.com/fatih/color/go.sum delete mode 100644 vendor/github.com/fsnotify/fsnotify/go.mod delete mode 100644 vendor/github.com/fsnotify/fsnotify/go.sum delete mode 100644 vendor/github.com/getsentry/sentry-go/go.mod delete mode 100644 vendor/github.com/getsentry/sentry-go/go.sum delete mode 100644 vendor/github.com/getsentry/sentry-go/internal/crypto/randutil/randutil.go delete mode 100644 vendor/github.com/gobwas/ws/.travis.yml delete mode 100644 vendor/github.com/gocql/gocql/go.mod delete mode 100644 vendor/github.com/gocql/gocql/go.sum delete mode 100644 vendor/github.com/golang/snappy/go.mod delete mode 100644 vendor/github.com/google/btree/go.mod delete mode 100644 vendor/github.com/hashicorp/errwrap/go.mod delete mode 100644 vendor/github.com/hashicorp/go-immutable-radix/go.mod delete mode 100644 vendor/github.com/hashicorp/go-immutable-radix/go.sum delete mode 100644 vendor/github.com/hashicorp/go-multierror/go.mod delete mode 100644 vendor/github.com/hashicorp/go-multierror/go.sum delete mode 100644 vendor/github.com/hashicorp/go-sockaddr/go.mod delete mode 100644 vendor/github.com/hashicorp/go-sockaddr/go.sum delete mode 100644 vendor/github.com/hashicorp/hcl/go.mod delete mode 100644 vendor/github.com/hashicorp/hcl/go.sum delete mode 100644 vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go delete mode 100644 vendor/github.com/magiconair/properties/go.mod delete mode 100644 vendor/github.com/mattn/go-colorable/.travis.yml delete mode 100644 vendor/github.com/mattn/go-colorable/go.mod delete mode 100644 vendor/github.com/mattn/go-colorable/go.sum delete mode 100644 vendor/github.com/mattn/go-isatty/.travis.yml delete mode 100644 vendor/github.com/mattn/go-isatty/go.mod delete mode 100644 vendor/github.com/mattn/go-isatty/go.sum delete mode 100644 vendor/github.com/mattn/go-isatty/renovate.json delete mode 100644 vendor/github.com/mattn/go-runewidth/go.mod delete mode 100644 vendor/github.com/mattn/go-runewidth/go.sum delete mode 100644 vendor/github.com/mattn/go-tty/go.mod delete mode 100644 vendor/github.com/mattn/go-tty/go.sum delete mode 100644 vendor/github.com/miekg/dns/go.mod delete mode 100644 vendor/github.com/miekg/dns/go.sum delete mode 100644 vendor/github.com/mitchellh/mapstructure/go.mod delete mode 100644 vendor/github.com/mschoch/smat/go.mod delete mode 100644 vendor/github.com/nyaruka/phonenumbers/go.mod delete mode 100644 vendor/github.com/nyaruka/phonenumbers/go.sum delete mode 100644 vendor/github.com/olekukonko/tablewriter/go.mod delete mode 100644 vendor/github.com/olekukonko/tablewriter/go.sum delete mode 100644 vendor/github.com/panjf2000/ants/v2/go.mod delete mode 100644 vendor/github.com/panjf2000/ants/v2/go.sum delete mode 100644 vendor/github.com/panjf2000/gnet/go.mod delete mode 100644 vendor/github.com/panjf2000/gnet/go.sum delete mode 100644 vendor/github.com/pelletier/go-toml/go.mod delete mode 100644 vendor/github.com/prometheus/procfs/go.mod delete mode 100644 vendor/github.com/prometheus/procfs/go.sum delete mode 100644 vendor/github.com/rivo/uniseg/go.mod delete mode 100644 vendor/github.com/ronaksoft/memberlist/go.mod delete mode 100644 vendor/github.com/ronaksoft/memberlist/go.sum delete mode 100644 vendor/github.com/ronaksoft/rony/go.mod delete mode 100644 vendor/github.com/scylladb/gocqlx/v2/go.mod delete mode 100644 vendor/github.com/scylladb/gocqlx/v2/go.sum delete mode 100644 vendor/github.com/spf13/afero/go.mod delete mode 100644 vendor/github.com/spf13/afero/go.sum delete mode 100644 vendor/github.com/spf13/cast/go.mod delete mode 100644 vendor/github.com/spf13/cast/go.sum delete mode 100644 vendor/github.com/spf13/cobra/go.mod delete mode 100644 vendor/github.com/spf13/cobra/go.sum delete mode 100644 vendor/github.com/spf13/jwalterweatherman/go.mod delete mode 100644 vendor/github.com/spf13/pflag/go.mod delete mode 100644 vendor/github.com/spf13/pflag/go.sum delete mode 100644 vendor/github.com/spf13/viper/go.mod delete mode 100644 vendor/github.com/spf13/viper/go.sum delete mode 100644 vendor/github.com/steveyen/gtreap/go.mod delete mode 100644 vendor/github.com/tidwall/buntdb/go.mod delete mode 100644 vendor/github.com/tidwall/buntdb/go.sum delete mode 100644 vendor/github.com/tidwall/gjson/go.mod delete mode 100644 vendor/github.com/tidwall/gjson/go.sum delete mode 100644 vendor/github.com/tidwall/match/go.mod delete mode 100644 vendor/github.com/valyala/fasthttp/fasthttputil/ecdsa.key delete mode 100644 vendor/github.com/valyala/fasthttp/fasthttputil/ecdsa.pem delete mode 100644 vendor/github.com/valyala/fasthttp/go.mod delete mode 100644 vendor/github.com/valyala/fasthttp/go.sum delete mode 100644 vendor/github.com/valyala/tcplisten/go.mod delete mode 100644 vendor/github.com/willf/bitset/go.mod delete mode 100644 vendor/github.com/willf/bitset/go.sum delete mode 100644 vendor/go.etcd.io/bbolt/go.mod delete mode 100644 vendor/go.etcd.io/bbolt/go.sum delete mode 100644 vendor/go.opencensus.io/go.mod delete mode 100644 vendor/go.opencensus.io/go.sum delete mode 100644 vendor/go.uber.org/atomic/go.mod delete mode 100644 vendor/go.uber.org/atomic/go.sum delete mode 100644 vendor/go.uber.org/multierr/go.mod delete mode 100644 vendor/go.uber.org/multierr/go.sum delete mode 100644 vendor/go.uber.org/zap/go.mod delete mode 100644 vendor/go.uber.org/zap/go.sum delete mode 100644 vendor/golang.org/x/net/AUTHORS delete mode 100644 vendor/golang.org/x/net/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_linkname.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_solaris.go delete mode 100644 vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go delete mode 100644 vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go delete mode 100644 vendor/golang.org/x/sync/AUTHORS delete mode 100644 vendor/golang.org/x/sync/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/sys/AUTHORS delete mode 100644 vendor/golang.org/x/sys/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_386.go delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/errors_freebsd_arm64.go delete mode 100644 vendor/golang.org/x/sys/unix/ioctl.go delete mode 100644 vendor/golang.org/x/sys/unix/str.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go delete mode 100644 vendor/golang.org/x/sys/windows/setupapierrors_windows.go delete mode 100644 vendor/golang.org/x/text/AUTHORS delete mode 100644 vendor/golang.org/x/text/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/tools/AUTHORS delete mode 100644 vendor/golang.org/x/tools/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go delete mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go delete mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go delete mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go delete mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go delete mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go delete mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go delete mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go delete mode 100644 vendor/golang.org/x/xerrors/LICENSE delete mode 100644 vendor/golang.org/x/xerrors/PATENTS delete mode 100644 vendor/golang.org/x/xerrors/README delete mode 100644 vendor/golang.org/x/xerrors/adaptor.go delete mode 100644 vendor/golang.org/x/xerrors/codereview.cfg delete mode 100644 vendor/golang.org/x/xerrors/doc.go delete mode 100644 vendor/golang.org/x/xerrors/errors.go delete mode 100644 vendor/golang.org/x/xerrors/fmt.go delete mode 100644 vendor/golang.org/x/xerrors/format.go delete mode 100644 vendor/golang.org/x/xerrors/frame.go delete mode 100644 vendor/golang.org/x/xerrors/go.mod delete mode 100644 vendor/golang.org/x/xerrors/internal/internal.go delete mode 100644 vendor/golang.org/x/xerrors/wrap.go delete mode 100644 vendor/google.golang.org/protobuf/AUTHORS delete mode 100644 vendor/google.golang.org/protobuf/CONTRIBUTORS delete mode 100644 vendor/gopkg.in/yaml.v2/go.mod diff --git a/cmd/cli-river/commands.go b/cmd/cli-river/commands.go index 18864bd9..2d8436c2 100644 --- a/cmd/cli-river/commands.go +++ b/cmd/cli-river/commands.go @@ -1,799 +1,799 @@ package main import ( - "fmt" - "sort" - "strconv" - "strings" - "time" - - "git.ronaksoft.com/river/msg/go/msg" - "gopkg.in/abiosoft/ishell.v2" + "fmt" + "sort" + "strconv" + "strings" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "gopkg.in/abiosoft/ishell.v2" ) func fnGetString(c *ishell.Context, prompt string) string { - c.Print(prompt, ": ") - x := c.ReadLine() - return x + c.Print(prompt, ": ") + x := c.ReadLine() + return x } func fnGetBool(c *ishell.Context, prompt string) bool { - del := false - for { - c.Print(prompt, ": (0 = false , >=1 : true)") - id, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - del = id > 0 - break - } else { - c.Println(err.Error()) - } - } - return del + del := false + for { + c.Print(prompt, ": (0 = false , >=1 : true)") + id, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + del = id > 0 + break + } else { + c.Println(err.Error()) + } + } + return del } func fnGetPhone(c *ishell.Context) string { - c.Print("Phone: ") - phone := c.ReadLine() - return phone + c.Print("Phone: ") + phone := c.ReadLine() + return phone } func fnGetPhoneCode(c *ishell.Context) string { - c.Print("Phone Code: ") - code := c.ReadLine() - return code + c.Print("Phone Code: ") + code := c.ReadLine() + return code } func fnGetPhoneCodeHash(c *ishell.Context) string { - c.Print("Phone Code Hash: ") - hash := c.ReadLine() - return hash + c.Print("Phone Code Hash: ") + hash := c.ReadLine() + return hash } func fnGetFirstName(c *ishell.Context) string { - c.Print("First Name: ") - fName := c.ReadLine() - return fName + c.Print("First Name: ") + fName := c.ReadLine() + return fName } func fnGetLastName(c *ishell.Context) string { - c.Print("Last Name: ") - lName := c.ReadLine() - return lName + c.Print("Last Name: ") + lName := c.ReadLine() + return lName } func fnGetPeerID(c *ishell.Context) int64 { - var peerID int64 - for { - c.Print("Peer ID: ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - peerID = id - break - } else { - c.Println(err.Error()) - } - } - return peerID + var peerID int64 + for { + c.Print("Peer ID: ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + peerID = id + break + } else { + c.Println(err.Error()) + } + } + return peerID } func fnGetBotID(c *ishell.Context) int64 { - var botID int64 - for { - c.Print("Bot ID: ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - botID = id - break - } else { - c.Println(err.Error()) - } - } - return botID + var botID int64 + for { + c.Print("Bot ID: ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + botID = id + break + } else { + c.Println(err.Error()) + } + } + return botID } func fnGetCallID(c *ishell.Context) int64 { - var callID int64 - for { - c.Print("Call ID: ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - callID = id - break - } else { - c.Println(err.Error()) - } - } - return callID + var callID int64 + for { + c.Print("Call ID: ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + callID = id + break + } else { + c.Println(err.Error()) + } + } + return callID } func fnGetConnId(c *ishell.Context) int32 { - var connId int64 - for { - c.Print("Conn Id: ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - connId = id - break - } else { - c.Println(err.Error()) - } - } - return int32(connId) + var connId int64 + for { + c.Print("Conn Id: ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + connId = id + break + } else { + c.Println(err.Error()) + } + } + return int32(connId) } func fnGetPeerType(c *ishell.Context) msg.PeerType { - var peerType msg.PeerType - - for { - c.Print("Peer Type: ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - switch id { - case 0: - peerType = msg.PeerType_PeerSelf - case 1: - peerType = msg.PeerType_PeerUser - case 2: - peerType = msg.PeerType_PeerGroup - case 3: - peerType = msg.PeerType_PeerChannel - default: - c.Println("Invalid peerType (0:self,1:user,2:group,3:channel)") - } - break - } else { - c.Println(err.Error()) - } - } - - return peerType + var peerType msg.PeerType + + for { + c.Print("Peer Type: ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + switch id { + case 0: + peerType = msg.PeerType_PeerSelf + case 1: + peerType = msg.PeerType_PeerUser + case 2: + peerType = msg.PeerType_PeerGroup + case 3: + peerType = msg.PeerType_PeerChannel + default: + c.Println("Invalid peerType (0:self,1:user,2:group,3:channel)") + } + break + } else { + c.Println(err.Error()) + } + } + + return peerType } func fnGetAccessHash(c *ishell.Context) uint64 { - var accessHash uint64 - for { - c.Print("Access Hash: ") - hash, err := strconv.ParseUint(c.ReadLine(), 10, 64) - if err == nil { - accessHash = hash - break - } else { - c.Println(err.Error()) - } - } - return accessHash + var accessHash uint64 + for { + c.Print("Access Hash: ") + hash, err := strconv.ParseUint(c.ReadLine(), 10, 64) + if err == nil { + accessHash = hash + break + } else { + c.Println(err.Error()) + } + } + return accessHash } func fnGetTries(c *ishell.Context) int { - var count int - for { - c.Print("Tries : ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - count = int(tmp) - break - } else { - c.Println(err.Error()) - } - } - return count + var count int + for { + c.Print("Tries : ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + count = int(tmp) + break + } else { + c.Println(err.Error()) + } + } + return count } func fnGetInterval(c *ishell.Context) time.Duration { - var interval time.Duration - for { - c.Print("Interval: ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - interval = time.Duration(tmp) * time.Millisecond - break - } else { - c.Println(err.Error()) - } - } - return interval + var interval time.Duration + for { + c.Print("Interval: ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + interval = time.Duration(tmp) * time.Millisecond + break + } else { + c.Println(err.Error()) + } + } + return interval } func fnGetBody(c *ishell.Context) string { - c.Print("Body: ") - body := c.ReadLine() - return body + c.Print("Body: ") + body := c.ReadLine() + return body } func fnGetPassword(c *ishell.Context) []byte { - c.Print("Password: ") - body := c.ReadLine() - return []byte(body) + c.Print("Password: ") + body := c.ReadLine() + return []byte(body) } func fnGetMaxID(c *ishell.Context) int64 { - var maxID int64 - for { - c.Print("Max ID: ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - maxID = tmp - break - } else { - c.Println(err.Error()) - } - } - return maxID + var maxID int64 + for { + c.Print("Max ID: ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + maxID = tmp + break + } else { + c.Println(err.Error()) + } + } + return maxID } func fnGetMinID(c *ishell.Context) int64 { - var minID int64 - for { - c.Print("Min ID: ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - minID = tmp - break - } else { - c.Println(err.Error()) - } - } - return minID + var minID int64 + for { + c.Print("Min ID: ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + minID = tmp + break + } else { + c.Println(err.Error()) + } + } + return minID } func fnGetLabelID(c *ishell.Context) int32 { - var labelID int32 - for { - c.Print("LabelID: ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - labelID = int32(tmp) - break - } else { - c.Println(err.Error()) - } - } - return labelID + var labelID int32 + for { + c.Print("LabelID: ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + labelID = int32(tmp) + break + } else { + c.Println(err.Error()) + } + } + return labelID } func fnGetLimit(c *ishell.Context) int32 { - var limit int32 - for { - c.Print("Limit: ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - limit = int32(tmp) - break - } else { - c.Println(err.Error()) - } - } - return limit + var limit int32 + for { + c.Print("Limit: ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + limit = int32(tmp) + break + } else { + c.Println(err.Error()) + } + } + return limit } func fnGetTypingAction(c *ishell.Context) msg.TypingAction { - var action msg.TypingAction - for { - c.Print("Action (0:Typing, 4:Cancel): ") - actionID, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - action = msg.TypingAction(actionID) - break - } else { - c.Println(err.Error()) - } - } - return action + var action msg.TypingAction + for { + c.Print("Action (0:Typing, 4:Cancel): ") + actionID, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + action = msg.TypingAction(actionID) + break + } else { + c.Println(err.Error()) + } + } + return action } func fnGetMessageIDs(c *ishell.Context) []int64 { - messagesIDs := make([]int64, 0) - for { + messagesIDs := make([]int64, 0) + for { - c.Print(len(messagesIDs), "Enter none numeric character to break\r\n") - c.Print(len(messagesIDs), "MessageID: ") - msgID, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err != nil { - break - } else { - messagesIDs = append(messagesIDs, msgID) - } - } - return messagesIDs + c.Print(len(messagesIDs), "Enter none numeric character to break\r\n") + c.Print(len(messagesIDs), "MessageID: ") + msgID, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err != nil { + break + } else { + messagesIDs = append(messagesIDs, msgID) + } + } + return messagesIDs } func fnGetMessageID(c *ishell.Context) int64 { - messageID := int64(0) - for { - c.Print("MessageID: ") - msgID, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err != nil { - break - } else { - messageID = msgID - break - } - } - return messageID + messageID := int64(0) + for { + c.Print("MessageID: ") + msgID, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err != nil { + break + } else { + messageID = msgID + break + } + } + return messageID } func fnGetFromUpdateID(c *ishell.Context) int64 { - var updateID int64 - for { - c.Print("From GetUpdateID: ") - fromUpdateID, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - updateID = fromUpdateID - break - } else { - c.Println(err.Error()) - } - } - return updateID + var updateID int64 + for { + c.Print("From GetUpdateID: ") + fromUpdateID, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + updateID = fromUpdateID + break + } else { + c.Println(err.Error()) + } + } + return updateID } func fnGetInputUser(c *ishell.Context) []*msg.InputUser { - users := make([]*msg.InputUser, 0) - for { - c.Print("Enter none numeric character to break\r\n") - - c.Print(len(users), "User ID: ") - userID, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err != nil { - break - } - - c.Print(len(users), "Access Hash: ") - accessHash, err := strconv.ParseUint(c.ReadLine(), 10, 64) - if err != nil { - break - } - - u := new(msg.InputUser) - u.UserID = userID - u.AccessHash = accessHash - users = append(users, u) - } - return users + users := make([]*msg.InputUser, 0) + for { + c.Print("Enter none numeric character to break\r\n") + + c.Print(len(users), "User ID: ") + userID, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err != nil { + break + } + + c.Print(len(users), "Access Hash: ") + accessHash, err := strconv.ParseUint(c.ReadLine(), 10, 64) + if err != nil { + break + } + + u := new(msg.InputUser) + u.UserID = userID + u.AccessHash = accessHash + users = append(users, u) + } + return users } func fnGetUsername(c *ishell.Context) string { - c.Print("Username: ") - uname := c.ReadLine() - return uname + c.Print("Username: ") + uname := c.ReadLine() + return uname } func fnGetQuery(c *ishell.Context) string { - c.Print("Query: ") - uname := c.ReadLine() - return uname + c.Print("Query: ") + uname := c.ReadLine() + return uname } func fnGetResultID(c *ishell.Context) string { - c.Print("ResultID: ") - uname := c.ReadLine() - return uname + c.Print("ResultID: ") + uname := c.ReadLine() + return uname } func fnGetQueryID(c *ishell.Context) int64 { - var queryID int64 - for { - c.Print("QueryID: ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - queryID = id - break - } else { - c.Println(err.Error()) - } - } - return queryID + var queryID int64 + for { + c.Print("QueryID: ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + queryID = id + break + } else { + c.Println(err.Error()) + } + } + return queryID } func fnGetTitle(c *ishell.Context) string { - c.Print("Title: ") - title := c.ReadLine() - return title + c.Print("Title: ") + title := c.ReadLine() + return title } func fnGetGroupID(c *ishell.Context) int64 { - var groupID int64 - for { - c.Print("Group ID: ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - groupID = id - break - } else { - c.Println(err.Error()) - } - } - return groupID + var groupID int64 + for { + c.Print("Group ID: ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + groupID = id + break + } else { + c.Println(err.Error()) + } + } + return groupID } func fnGetForwardLimit(c *ishell.Context) int32 { - var fwdLimit int32 - for { - c.Print("Forward Limit: ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - fwdLimit = int32(id) - break - } else { - c.Println(err.Error()) - } - } - return fwdLimit + var fwdLimit int32 + for { + c.Print("Forward Limit: ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + fwdLimit = int32(id) + break + } else { + c.Println(err.Error()) + } + } + return fwdLimit } func fnGetRevoke(c *ishell.Context) bool { - revoke := false - for { - c.Print("Revoke : (0 = false , >=1 : true)") - id, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - revoke = id > 0 - break - } else { - c.Println(err.Error()) - } - } - return revoke + revoke := false + for { + c.Print("Revoke : (0 = false , >=1 : true)") + id, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + revoke = id > 0 + break + } else { + c.Println(err.Error()) + } + } + return revoke } func fnGetSilence(c *ishell.Context) bool { - silence := false - for { - c.Print("Silence : (0 = false , >=1 : true)") - id, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - silence = id > 0 - break - } else { - c.Println(err.Error()) - } - } - return silence + silence := false + for { + c.Print("Silence : (0 = false , >=1 : true)") + id, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + silence = id > 0 + break + } else { + c.Println(err.Error()) + } + } + return silence } func fnGetDelete(c *ishell.Context) bool { - del := false - for { - c.Print("Delete : (0 = false , >=1 : true)") - id, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - del = id > 0 - break - } else { - c.Println(err.Error()) - } - } - return del + del := false + for { + c.Print("Delete : (0 = false , >=1 : true)") + id, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + del = id > 0 + break + } else { + c.Println(err.Error()) + } + } + return del } func fnGetAdmin(c *ishell.Context) bool { - del := false - for { - c.Print("Admin : (0 = false , >=1 : true)") - id, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - del = id > 0 - break - } else { - c.Println(err.Error()) - } - } - return del + del := false + for { + c.Print("Admin : (0 = false , >=1 : true)") + id, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + del = id > 0 + break + } else { + c.Println(err.Error()) + } + } + return del } func fnGetAdminEnabled(c *ishell.Context) bool { - del := false - for { - c.Print("Admin Enabled : (0 = false , >=1 : true)") - id, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - del = id > 0 - break - } else { - c.Println(err.Error()) - } - } - return del + del := false + for { + c.Print("Admin Enabled : (0 = false , >=1 : true)") + id, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + del = id > 0 + break + } else { + c.Println(err.Error()) + } + } + return del } func fnGetEntities(c *ishell.Context) []*msg.MessageEntity { - entities := make([]*msg.MessageEntity, 0) - for { - c.Print("Enter none numeric character to break\r\n") - var entityType msg.MessageEntityType - var offset int32 - var length int32 - var userID int64 - for { - c.Print(len(entities), "Type: (0:Bold, 1:Italic, 2:Mention,3:Url, 4:Email ,5:Hashtag)") - typeID, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil && typeID < 6 { - entityType = msg.MessageEntityType(typeID) - break - } else { - return entities - } - } - - for { - c.Print(len(entities), "Offset: ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - offset = int32(tmp) - break - } else { - return entities - } - } - - for { - c.Print(len(entities), "Length: ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - length = int32(tmp) - break - } else { - return entities - } - } - - for { - c.Print(len(entities), "userID: ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - userID = tmp - break - } else { - return entities - } - } - - e := &msg.MessageEntity{ - Length: length, - Offset: offset, - Type: entityType, - UserID: userID, - } - entities = append(entities, e) - } + entities := make([]*msg.MessageEntity, 0) + for { + c.Print("Enter none numeric character to break\r\n") + var entityType msg.MessageEntityType + var offset int32 + var length int32 + var userID int64 + for { + c.Print(len(entities), "Type: (0:Bold, 1:Italic, 2:Mention,3:Url, 4:Email ,5:Hashtag)") + typeID, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil && typeID < 6 { + entityType = msg.MessageEntityType(typeID) + break + } else { + return entities + } + } + + for { + c.Print(len(entities), "Offset: ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + offset = int32(tmp) + break + } else { + return entities + } + } + + for { + c.Print(len(entities), "Length: ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + length = int32(tmp) + break + } else { + return entities + } + } + + for { + c.Print(len(entities), "userID: ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + userID = tmp + break + } else { + return entities + } + } + + e := &msg.MessageEntity{ + Length: length, + Offset: offset, + Type: entityType, + UserID: userID, + } + entities = append(entities, e) + } } func fnGetTokenType(c *ishell.Context) msg.PushTokenProvider { - var tokenType msg.PushTokenProvider - for { - c.Print("TokenType (Firebase = 0 , APN = 1) : ") - tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - tokenType = msg.PushTokenProvider(tmp) - break - } - } - return tokenType + var tokenType msg.PushTokenProvider + for { + c.Print("TokenType (Firebase = 0 , APN = 1) : ") + tmp, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + tokenType = msg.PushTokenProvider(tmp) + break + } + } + return tokenType } func fnGetToken(c *ishell.Context) string { - c.Print("Token: ") - token := c.ReadLine() - return token + c.Print("Token: ") + token := c.ReadLine() + return token } func fnGetProvider(c *ishell.Context) string { - c.Print("Provider (ap, nested, google, apple): ") - token := c.ReadLine() - return token + c.Print("Provider (ap, nested, google, apple): ") + token := c.ReadLine() + return token } func fnGetDeviceModel(c *ishell.Context) string { - c.Print("Model(ios | android) : ") - model := c.ReadLine() - return model + c.Print("Model(ios | android) : ") + model := c.ReadLine() + return model } func fnGetSysytemVersion(c *ishell.Context) string { - c.Print("Sysytem Version : ") - version := c.ReadLine() - return version + c.Print("Sysytem Version : ") + version := c.ReadLine() + return version } func fnGetAppVersion(c *ishell.Context) string { - c.Print("App Version : ") - version := c.ReadLine() - return version + c.Print("App Version : ") + version := c.ReadLine() + return version } func fnGetLangCode(c *ishell.Context) string { - c.Print("Language Code : ") - code := c.ReadLine() - return code + c.Print("Language Code : ") + code := c.ReadLine() + return code } func fnGetClientID(c *ishell.Context) string { - c.Print("Client ID : ") - code := c.ReadLine() - return code + c.Print("Client ID : ") + code := c.ReadLine() + return code } func fnGetLabelName(c *ishell.Context) string { - c.Print("Label Name: ") - name := c.ReadLine() - return name + c.Print("Label Name: ") + name := c.ReadLine() + return name } func fnGetLabelColour(c *ishell.Context) string { - c.Print("Label Colour: ") - name := c.ReadLine() - return name + c.Print("Label Colour: ") + name := c.ReadLine() + return name } func fnGetFilePath(c *ishell.Context) string { - c.Print("File Path: ") - name := c.ReadLine() - return name + c.Print("File Path: ") + name := c.ReadLine() + return name } func fnGetThumbFilePath(c *ishell.Context) string { - c.Print("Thumbnail File Path: ") - name := c.ReadLine() - return name + c.Print("Thumbnail File Path: ") + name := c.ReadLine() + return name } func fnGetReplyTo(c *ishell.Context) int64 { - var replyTo int64 - for { - c.Print("Reply To: ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - replyTo = id - break - } else { - c.Println(err.Error()) - } - } - return replyTo + var replyTo int64 + for { + c.Print("Reply To: ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + replyTo = id + break + } else { + c.Println(err.Error()) + } + } + return replyTo } func fnGetPeer(c *ishell.Context) *msg.InputPeer { - options := make([]string, 0, len(MyDialogs)) - for _, d := range MyDialogs { - switch d.PeerType { - case 1: - options = append(options, fmt.Sprintf("%s %s (%d)", MyUsers[d.PeerID].FirstName, MyUsers[d.PeerID].LastName, d.TopMessageID)) - case 2: - options = append(options, fmt.Sprintf("%s (%d)", MyGroups[d.PeerID].Title, d.TopMessageID)) - } - - } - idx := c.MultiChoice(options, "Please Select Your Dialog:") - return &msg.InputPeer{ - ID: MyDialogs[idx].PeerID, - Type: msg.PeerType(MyDialogs[idx].PeerType), - AccessHash: MyDialogs[idx].AccessHash, - } + options := make([]string, 0, len(MyDialogs)) + for _, d := range MyDialogs { + switch d.PeerType { + case 1: + options = append(options, fmt.Sprintf("%s %s (%d)", MyUsers[d.PeerID].FirstName, MyUsers[d.PeerID].LastName, d.TopMessageID)) + case 2: + options = append(options, fmt.Sprintf("%s (%d)", MyGroups[d.PeerID].Title, d.TopMessageID)) + } + + } + idx := c.MultiChoice(options, "Please Select Your Dialog:") + return &msg.InputPeer{ + ID: MyDialogs[idx].PeerID, + Type: msg.PeerType(MyDialogs[idx].PeerType), + AccessHash: MyDialogs[idx].AccessHash, + } } func fnGetUser(c *ishell.Context) *msg.InputUser { - options := make([]string, 0, len(MyUsers)) - optionsUser := make([]*msg.User, 0, len(MyUsers)) - for _, u := range MyUsers { - optionsUser = append(optionsUser, MyUsers[u.ID]) - } - sort.Slice(optionsUser, func(i, j int) bool { - return strings.Compare(optionsUser[i].FirstName, optionsUser[j].FirstName) < 0 - }) - - for idx := range optionsUser { - options = append(options, fmt.Sprintf("%s %s", optionsUser[idx].FirstName, optionsUser[idx].LastName)) - } - - idx := c.MultiChoice(options, "Please Select Your User:") - return &msg.InputUser{ - UserID: optionsUser[idx].ID, - AccessHash: optionsUser[idx].AccessHash, - } + options := make([]string, 0, len(MyUsers)) + optionsUser := make([]*msg.User, 0, len(MyUsers)) + for _, u := range MyUsers { + optionsUser = append(optionsUser, MyUsers[u.ID]) + } + sort.Slice(optionsUser, func(i, j int) bool { + return strings.Compare(optionsUser[i].FirstName, optionsUser[j].FirstName) < 0 + }) + + for idx := range optionsUser { + options = append(options, fmt.Sprintf("%s %s", optionsUser[idx].FirstName, optionsUser[idx].LastName)) + } + + idx := c.MultiChoice(options, "Please Select Your User:") + return &msg.InputUser{ + UserID: optionsUser[idx].ID, + AccessHash: optionsUser[idx].AccessHash, + } } func fnGetBot(c *ishell.Context) *msg.InputUser { - options := make([]string, 0, len(MyUsers)) - optionsUser := make([]*msg.User, 0, len(MyUsers)) - for _, u := range MyUsers { - if u.IsBot { - options = append(options, fmt.Sprintf("%s %s", MyUsers[u.ID].FirstName, MyUsers[u.ID].LastName)) - optionsUser = append(optionsUser, MyUsers[u.ID]) - } - } - idx := c.MultiChoice(options, "Please Select Your Bot:") - return &msg.InputUser{ - UserID: optionsUser[idx].ID, - AccessHash: optionsUser[idx].AccessHash, - } + options := make([]string, 0, len(MyUsers)) + optionsUser := make([]*msg.User, 0, len(MyUsers)) + for _, u := range MyUsers { + if u.IsBot { + options = append(options, fmt.Sprintf("%s %s", MyUsers[u.ID].FirstName, MyUsers[u.ID].LastName)) + optionsUser = append(optionsUser, MyUsers[u.ID]) + } + } + idx := c.MultiChoice(options, "Please Select Your Bot:") + return &msg.InputUser{ + UserID: optionsUser[idx].ID, + AccessHash: optionsUser[idx].AccessHash, + } } func fnGetTopPeerCat(c *ishell.Context) msg.TopPeerCategory { - options := []string{ - msg.TopPeerCategory_Users.String(), - msg.TopPeerCategory_Groups.String(), - msg.TopPeerCategory_Forwards.String(), - msg.TopPeerCategory_BotsMessage.String(), - msg.TopPeerCategory_BotsInline.String(), - } - idx := c.MultiChoice(options, "Select the category:") - return msg.TopPeerCategory(idx) + options := []string{ + msg.TopPeerCategory_Users.String(), + msg.TopPeerCategory_Groups.String(), + msg.TopPeerCategory_Forwards.String(), + msg.TopPeerCategory_BotsMessage.String(), + msg.TopPeerCategory_BotsInline.String(), + } + idx := c.MultiChoice(options, "Select the category:") + return msg.TopPeerCategory(idx) } func fnGetMime(c *ishell.Context) string { - c.Print("MIME Type:") - mime := c.ReadLine() - return mime + c.Print("MIME Type:") + mime := c.ReadLine() + return mime } func fnGetMediaCat(c *ishell.Context) msg.MediaCategory { - options := make([]string, len(msg.MediaCategory_value)) - for n, v := range msg.MediaCategory_value { - options[v] = n - } + options := make([]string, len(msg.MediaCategory_value)) + for n, v := range msg.MediaCategory_value { + options[v] = n + } - idx := c.MultiChoice(options, "Please Select Category:") - return msg.MediaCategory(idx) + idx := c.MultiChoice(options, "Please Select Category:") + return msg.MediaCategory(idx) } func fnGetFileID(c *ishell.Context) int64 { - var res int64 - for { - c.Print("FileID : ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - res = id - break - } else { - c.Println(err.Error()) - } - } - return res + var res int64 + for { + c.Print("FileID : ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + res = id + break + } else { + c.Println(err.Error()) + } + } + return res } func fnGetOffset(c *ishell.Context) int32 { - var res int32 - for { - c.Print("Offset : ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 32) - if err == nil { - res = int32(id) - break - } else { - c.Println(err.Error()) - } - } - return res + var res int32 + for { + c.Print("Offset : ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 32) + if err == nil { + res = int32(id) + break + } else { + c.Println(err.Error()) + } + } + return res } func fnGetTeamID(c *ishell.Context) int64 { - var res int64 - for { - c.Print("TeamID : ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - res = id - break - } else { - c.Println(err.Error()) - } - } - return res + var res int64 + for { + c.Print("TeamID : ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + res = id + break + } else { + c.Println(err.Error()) + } + } + return res } func fnGetUserID(c *ishell.Context) int64 { - var res int64 - for { - c.Print("UserID : ") - id, err := strconv.ParseInt(c.ReadLine(), 10, 64) - if err == nil { - res = id - break - } else { - c.Println(err.Error()) - } - } - return res + var res int64 + for { + c.Print("UserID : ") + id, err := strconv.ParseInt(c.ReadLine(), 10, 64) + if err == nil { + res = id + break + } else { + c.Println(err.Error()) + } + } + return res } diff --git a/cmd/cli-river/commands_account.go b/cmd/cli-river/commands_account.go index cf76e1af..3259a297 100644 --- a/cmd/cli-river/commands_account.go +++ b/cmd/cli-river/commands_account.go @@ -1,177 +1,177 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "gopkg.in/abiosoft/ishell.v2" ) var Account = &ishell.Cmd{ - Name: "Account", + Name: "Account", } var AccountRegisterDevice = &ishell.Cmd{ - Name: "RegisterDevice", - Func: func(c *ishell.Context) { - req := msg.AccountRegisterDevice{} - req.TokenType = fnGetTokenType(c) - req.Token = fnGetToken(c) - req.DeviceModel = fnGetDeviceModel(c) - req.SystemVersion = fnGetSysytemVersion(c) - req.AppVersion = fnGetAppVersion(c) - req.LangCode = fnGetLangCode(c) - req.ClientID = fnGetClientID(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - - if reqID, err := _SDK.ExecuteCommand(msg.C_AccountRegisterDevice, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "RegisterDevice", + Func: func(c *ishell.Context) { + req := msg.AccountRegisterDevice{} + req.TokenType = fnGetTokenType(c) + req.Token = fnGetToken(c) + req.DeviceModel = fnGetDeviceModel(c) + req.SystemVersion = fnGetSysytemVersion(c) + req.AppVersion = fnGetAppVersion(c) + req.LangCode = fnGetLangCode(c) + req.ClientID = fnGetClientID(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + + if reqID, err := _SDK.ExecuteCommand(msg.C_AccountRegisterDevice, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AccountUpdateUsername = &ishell.Cmd{ - Name: "UpdateUsername", - Func: func(c *ishell.Context) { - req := msg.AccountUpdateUsername{} - req.Username = fnGetUsername(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - - if reqID, err := _SDK.ExecuteCommand(msg.C_AccountUpdateUsername, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "UpdateUsername", + Func: func(c *ishell.Context) { + req := msg.AccountUpdateUsername{} + req.Username = fnGetUsername(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + + if reqID, err := _SDK.ExecuteCommand(msg.C_AccountUpdateUsername, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AccountCheckUsername = &ishell.Cmd{ - Name: "CheckUsername", - Func: func(c *ishell.Context) { - req := msg.AccountCheckUsername{} - req.Username = fnGetUsername(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - - if reqID, err := _SDK.ExecuteCommand(msg.C_AccountCheckUsername, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "CheckUsername", + Func: func(c *ishell.Context) { + req := msg.AccountCheckUsername{} + req.Username = fnGetUsername(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + + if reqID, err := _SDK.ExecuteCommand(msg.C_AccountCheckUsername, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AccountUnregisterDevice = &ishell.Cmd{ - Name: "UnregisterDevice", - Func: func(c *ishell.Context) { - req := msg.AccountUnregisterDevice{} - req.TokenType = 1 - req.Token = "token" - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - - if reqID, err := _SDK.ExecuteCommand(msg.C_AccountUnregisterDevice, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "UnregisterDevice", + Func: func(c *ishell.Context) { + req := msg.AccountUnregisterDevice{} + req.TokenType = 1 + req.Token = "token" + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + + if reqID, err := _SDK.ExecuteCommand(msg.C_AccountUnregisterDevice, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AccountUpdateProfile = &ishell.Cmd{ - Name: "UpdateProfile", - Func: func(c *ishell.Context) { - req := msg.AccountUpdateProfile{} - req.FirstName = fnGetFirstName(c) - req.LastName = fnGetLastName(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_AccountUpdateProfile, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "UpdateProfile", + Func: func(c *ishell.Context) { + req := msg.AccountUpdateProfile{} + req.FirstName = fnGetFirstName(c) + req.LastName = fnGetLastName(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_AccountUpdateProfile, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AccountSetNotifySettings = &ishell.Cmd{ - Name: "SetNotifySettings", - Func: func(c *ishell.Context) { - req := msg.AccountSetNotifySettings{ - Peer: new(msg.InputPeer), - Settings: new(msg.PeerNotifySettings), - } - req.Peer.ID = fnGetPeerID(c) - req.Peer.Type = 1 - req.Peer.AccessHash = fnGetAccessHash(c) - req.Settings.Flags = 113 - req.Settings.MuteUntil = 0 - req.Settings.Sound = "" - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - - if reqID, err := _SDK.ExecuteCommand(msg.C_AccountSetNotifySettings, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "SetNotifySettings", + Func: func(c *ishell.Context) { + req := msg.AccountSetNotifySettings{ + Peer: new(msg.InputPeer), + Settings: new(msg.PeerNotifySettings), + } + req.Peer.ID = fnGetPeerID(c) + req.Peer.Type = 1 + req.Peer.AccessHash = fnGetAccessHash(c) + req.Settings.Flags = 113 + req.Settings.MuteUntil = 0 + req.Settings.Sound = "" + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + + if reqID, err := _SDK.ExecuteCommand(msg.C_AccountSetNotifySettings, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AccountUploadPhoto = &ishell.Cmd{ - Name: "UploadPhoto", - Func: func(c *ishell.Context) { - filePath := fnGetFilePath(c) - _SDK.AccountUploadPhoto(filePath) + Name: "UploadPhoto", + Func: func(c *ishell.Context) { + filePath := fnGetFilePath(c) + _SDK.AccountUploadPhoto(filePath) - }, + }, } var AccountRemovePhoto = &ishell.Cmd{ - Name: "RemovePhoto", - Func: func(c *ishell.Context) { - req := msg.AccountRemovePhoto{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - - if reqID, err := _SDK.ExecuteCommand(msg.C_AccountRemovePhoto, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "RemovePhoto", + Func: func(c *ishell.Context) { + req := msg.AccountRemovePhoto{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + + if reqID, err := _SDK.ExecuteCommand(msg.C_AccountRemovePhoto, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AccountGetTeams = &ishell.Cmd{ - Name: "GetTeams", - Func: func(c *ishell.Context) { - req := msg.AccountGetTeams{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - - if reqID, err := _SDK.ExecuteCommand(msg.C_AccountGetTeams, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "GetTeams", + Func: func(c *ishell.Context) { + req := msg.AccountGetTeams{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + + if reqID, err := _SDK.ExecuteCommand(msg.C_AccountGetTeams, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - Account.AddCmd(AccountRegisterDevice) - Account.AddCmd(AccountUpdateUsername) - Account.AddCmd(AccountCheckUsername) - Account.AddCmd(AccountUnregisterDevice) - Account.AddCmd(AccountUpdateProfile) - Account.AddCmd(AccountSetNotifySettings) - Account.AddCmd(AccountUploadPhoto) - Account.AddCmd(AccountRemovePhoto) - Account.AddCmd(AccountGetTeams) + Account.AddCmd(AccountRegisterDevice) + Account.AddCmd(AccountUpdateUsername) + Account.AddCmd(AccountCheckUsername) + Account.AddCmd(AccountUnregisterDevice) + Account.AddCmd(AccountUpdateProfile) + Account.AddCmd(AccountSetNotifySettings) + Account.AddCmd(AccountUploadPhoto) + Account.AddCmd(AccountRemovePhoto) + Account.AddCmd(AccountGetTeams) } diff --git a/cmd/cli-river/commands_auth.go b/cmd/cli-river/commands_auth.go index 01681836..3cb65038 100644 --- a/cmd/cli-river/commands_auth.go +++ b/cmd/cli-river/commands_auth.go @@ -1,182 +1,183 @@ package main import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - riversdk "git.ronaksoft.com/river/sdk/sdk/prime" - "gopkg.in/abiosoft/ishell.v2" - "io/ioutil" - "os" - "path/filepath" - "strings" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + + "github.com/ronaksoft/river-msg/go/msg" + riversdk "github.com/ronaksoft/river-sdk/sdk/prime" + "gopkg.in/abiosoft/ishell.v2" ) var Auth = &ishell.Cmd{ - Name: "Auth", + Name: "Auth", } var AuthCheckPhone = &ishell.Cmd{ - Name: "CheckPhone", - Func: func(c *ishell.Context) { - req := msg.AuthCheckPhone{} - req.Phone = fnGetPhone(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthCheckPhone, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "CheckPhone", + Func: func(c *ishell.Context) { + req := msg.AuthCheckPhone{} + req.Phone = fnGetPhone(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthCheckPhone, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AuthSendCode = &ishell.Cmd{ - Name: "SendCode", - Func: func(c *ishell.Context) { - req := msg.AuthSendCode{} - req.Phone = fnGetPhone(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthSendCode, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "SendCode", + Func: func(c *ishell.Context) { + req := msg.AuthSendCode{} + req.Phone = fnGetPhone(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthSendCode, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AuthRegister = &ishell.Cmd{ - Name: "Register", - Func: func(c *ishell.Context) { - req := msg.AuthRegister{} - - req.Phone = fnGetPhone(c) - req.PhoneCode = fnGetPhoneCode(c) - req.PhoneCodeHash = fnGetPhoneCodeHash(c) - req.FirstName = fnGetFirstName(c) - req.LastName = fnGetLastName(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthRegister, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "Register", + Func: func(c *ishell.Context) { + req := msg.AuthRegister{} + + req.Phone = fnGetPhone(c) + req.PhoneCode = fnGetPhoneCode(c) + req.PhoneCodeHash = fnGetPhoneCodeHash(c) + req.FirstName = fnGetFirstName(c) + req.LastName = fnGetLastName(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthRegister, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var AuthLogin = &ishell.Cmd{ - Name: "Login", - Func: func(c *ishell.Context) { - req := msg.AuthLogin{} - phoneFile, err := os.Open("./_phone") - if err != nil { - req.Phone = fnGetPhone(c) - req.PhoneCode = fnGetPhoneCode(c) - req.PhoneCodeHash = fnGetPhoneCodeHash(c) - - } else { - b, _ := ioutil.ReadAll(phoneFile) - req.Phone = string(b) - if strings.HasPrefix(req.Phone, "2374") { - File, err := os.Open("./_phoneCodeHash") - if err != nil { - req.PhoneCodeHash = fnGetPhoneCode(c) - } else { - req.PhoneCode = req.Phone[len(req.Phone)-5:] - b, _ := ioutil.ReadAll(File) - req.PhoneCodeHash = string(b) - } - } - } - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - os.Remove("./_phone") - os.Remove("./_phoneCodeHash") - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthLogin, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "Login", + Func: func(c *ishell.Context) { + req := msg.AuthLogin{} + phoneFile, err := os.Open("./_phone") + if err != nil { + req.Phone = fnGetPhone(c) + req.PhoneCode = fnGetPhoneCode(c) + req.PhoneCodeHash = fnGetPhoneCodeHash(c) + + } else { + b, _ := ioutil.ReadAll(phoneFile) + req.Phone = string(b) + if strings.HasPrefix(req.Phone, "2374") { + File, err := os.Open("./_phoneCodeHash") + if err != nil { + req.PhoneCodeHash = fnGetPhoneCode(c) + } else { + req.PhoneCode = req.Phone[len(req.Phone)-5:] + b, _ := ioutil.ReadAll(File) + req.PhoneCodeHash = string(b) + } + } + } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + os.Remove("./_phone") + os.Remove("./_phoneCodeHash") + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthLogin, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var AuthCheckPassword = &ishell.Cmd{ - Name: "CheckPassword", - Func: func(c *ishell.Context) { - passwordFile, err := os.Open("./_password") - if err != nil { - c.Println(err) - return - } - b, _ := ioutil.ReadAll(passwordFile) - passwordFile.Close() - os.Remove("./_password") - - inputPassword := &msg.InputPassword{} - inputPassword.Unmarshal(riversdk.GenInputPassword(fnGetPassword(c), b)) - req := &msg.AuthCheckPassword{ - Password: inputPassword, - } - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthCheckPassword, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "CheckPassword", + Func: func(c *ishell.Context) { + passwordFile, err := os.Open("./_password") + if err != nil { + c.Println(err) + return + } + b, _ := ioutil.ReadAll(passwordFile) + passwordFile.Close() + os.Remove("./_password") + + inputPassword := &msg.InputPassword{} + inputPassword.Unmarshal(riversdk.GenInputPassword(fnGetPassword(c), b)) + req := &msg.AuthCheckPassword{ + Password: inputPassword, + } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthCheckPassword, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AuthLogout = &ishell.Cmd{ - Name: "Logout", - Func: func(c *ishell.Context) { - if err := _SDK.Logout(true, 0); err != nil { - c.Println("Command Failed:", err) - } - _ = os.Remove(filepath.Join(_DbPath, fmt.Sprintf("connInfo.%s", _DbID))) - }, + Name: "Logout", + Func: func(c *ishell.Context) { + if err := _SDK.Logout(true, 0); err != nil { + c.Println("Command Failed:", err) + } + _ = os.Remove(filepath.Join(_DbPath, fmt.Sprintf("connInfo.%s", _DbID))) + }, } var AuthRecall = &ishell.Cmd{ - Name: "Recall", - Func: func(c *ishell.Context) { - req := msg.AuthRecall{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthRecall, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Recall", + Func: func(c *ishell.Context) { + req := msg.AuthRecall{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthRecall, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AuthLoginByToken = &ishell.Cmd{ - Name: "LoginByToken", - Func: func(c *ishell.Context) { - req := msg.AuthLoginByToken{} - req.Provider = fnGetProvider(c) - req.Token = fnGetToken(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthLoginByToken, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "LoginByToken", + Func: func(c *ishell.Context) { + req := msg.AuthLoginByToken{} + req.Provider = fnGetProvider(c) + req.Token = fnGetToken(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthLoginByToken, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - Auth.AddCmd(AuthSendCode) - Auth.AddCmd(AuthCheckPhone) - Auth.AddCmd(AuthRegister) - Auth.AddCmd(AuthLogin) - Auth.AddCmd(AuthCheckPassword) - Auth.AddCmd(AuthRecall) - Auth.AddCmd(AuthLogout) - Auth.AddCmd(AuthLoginByToken) + Auth.AddCmd(AuthSendCode) + Auth.AddCmd(AuthCheckPhone) + Auth.AddCmd(AuthRegister) + Auth.AddCmd(AuthLogin) + Auth.AddCmd(AuthCheckPassword) + Auth.AddCmd(AuthRecall) + Auth.AddCmd(AuthLogout) + Auth.AddCmd(AuthLoginByToken) } diff --git a/cmd/cli-river/commands_bot.go b/cmd/cli-river/commands_bot.go index edbabf6e..89c639b5 100644 --- a/cmd/cli-river/commands_bot.go +++ b/cmd/cli-river/commands_bot.go @@ -1,9 +1,9 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "gopkg.in/abiosoft/ishell.v2" ) /* @@ -16,91 +16,91 @@ import ( */ var Bot = &ishell.Cmd{ - Name: "Bot", + Name: "Bot", } var BotGetInlineQueryResults = &ishell.Cmd{ - Name: "GetInlineQueryResults", - Func: func(c *ishell.Context) { - req := msg.BotGetInlineResults{} - c.Println("Enter Bot:") - req.Bot = fnGetBot(c) - c.Println("Enter Peer:") - req.Peer = fnGetPeer(c) - req.Peer.Type = msg.PeerType_PeerUser - req.Query = fnGetQuery(c) - req.Offset = "" - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_BotGetInlineResults, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "GetInlineQueryResults", + Func: func(c *ishell.Context) { + req := msg.BotGetInlineResults{} + c.Println("Enter Bot:") + req.Bot = fnGetBot(c) + c.Println("Enter Peer:") + req.Peer = fnGetPeer(c) + req.Peer.Type = msg.PeerType_PeerUser + req.Query = fnGetQuery(c) + req.Offset = "" + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_BotGetInlineResults, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var BotSendInlineQueryResults = &ishell.Cmd{ - Name: "SendInlineQueryResults", - Func: func(c *ishell.Context) { - req := msg.BotSendInlineResults{} - c.Println("Enter Bot:") - req.QueryID = fnGetQueryID(c) - req.ResultID = fnGetResultID(c) - req.Peer = fnGetPeer(c) - req.RandomID = domain.RandomInt64(0) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_BotSendInlineResults, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "SendInlineQueryResults", + Func: func(c *ishell.Context) { + req := msg.BotSendInlineResults{} + c.Println("Enter Bot:") + req.QueryID = fnGetQueryID(c) + req.ResultID = fnGetResultID(c) + req.Peer = fnGetPeer(c) + req.RandomID = domain.RandomInt64(0) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_BotSendInlineResults, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var BotGetCommands = &ishell.Cmd{ - Name: "BotGetCommands", - Func: func(c *ishell.Context) { - req := msg.BotGetCommands{} - req.Peer = &msg.InputPeer{} - req.Peer.Type = fnGetPeerType(c) - req.Peer.ID = fnGetBotID(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_BotGetCommands, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "BotGetCommands", + Func: func(c *ishell.Context) { + req := msg.BotGetCommands{} + req.Peer = &msg.InputPeer{} + req.Peer.Type = fnGetPeerType(c) + req.Peer.ID = fnGetBotID(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_BotGetCommands, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var BotStart = &ishell.Cmd{ - Name: "BotStart", - Func: func(c *ishell.Context) { - req := msg.BotStart{} - req.Bot = &msg.InputPeer{} - req.Bot.Type = fnGetPeerType(c) - req.Bot.ID = fnGetBotID(c) - req.RandomID = domain.RandomInt63() - req.StartParam = "startparam" - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_BotStart, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "BotStart", + Func: func(c *ishell.Context) { + req := msg.BotStart{} + req.Bot = &msg.InputPeer{} + req.Bot.Type = fnGetPeerType(c) + req.Bot.ID = fnGetBotID(c) + req.RandomID = domain.RandomInt63() + req.StartParam = "startparam" + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_BotStart, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } func init() { - Bot.AddCmd(BotGetInlineQueryResults) - Bot.AddCmd(BotSendInlineQueryResults) - Bot.AddCmd(BotStart) - Bot.AddCmd(BotGetCommands) + Bot.AddCmd(BotGetInlineQueryResults) + Bot.AddCmd(BotSendInlineQueryResults) + Bot.AddCmd(BotStart) + Bot.AddCmd(BotGetCommands) } diff --git a/cmd/cli-river/commands_call.go b/cmd/cli-river/commands_call.go index 7ed58f65..7dfca958 100644 --- a/cmd/cli-river/commands_call.go +++ b/cmd/cli-river/commands_call.go @@ -1,8 +1,8 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "gopkg.in/abiosoft/ishell.v2" ) /* @@ -15,109 +15,109 @@ import ( */ var Call = &ishell.Cmd{ - Name: "Call", + Name: "Call", } var CallStart = &ishell.Cmd{ - Name: "Start", - Func: func(c *ishell.Context) { - req := msg.ClientCallStart{} - req.CallID = 0 - req.Peer = fnGetPeer(c) - req.Video = false - inputUser := &msg.InputUser{} - inputUser.UserID = req.Peer.ID - inputUser.AccessHash = req.Peer.AccessHash - req.InputUsers = append(req.InputUsers, inputUser) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - // id: 1201478792185258 - // accesshash: 4502681147619876 - if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallStart, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Start", + Func: func(c *ishell.Context) { + req := msg.ClientCallStart{} + req.CallID = 0 + req.Peer = fnGetPeer(c) + req.Video = false + inputUser := &msg.InputUser{} + inputUser.UserID = req.Peer.ID + inputUser.AccessHash = req.Peer.AccessHash + req.InputUsers = append(req.InputUsers, inputUser) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + // id: 1201478792185258 + // accesshash: 4502681147619876 + if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallStart, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var CallReject = &ishell.Cmd{ - Name: "Reject", - Func: func(c *ishell.Context) { - req := msg.ClientCallReject{} - req.CallID = fnGetCallID(c) - req.Duration = 0 - req.Reason = msg.DiscardReason_DiscardReasonHangup - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallReject, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Reject", + Func: func(c *ishell.Context) { + req := msg.ClientCallReject{} + req.CallID = fnGetCallID(c) + req.Duration = 0 + req.Reason = msg.DiscardReason_DiscardReasonHangup + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallReject, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var CallAccept = &ishell.Cmd{ - Name: "Accept", - Func: func(c *ishell.Context) { - req := msg.ClientCallAccept{} - req.CallID = fnGetCallID(c) - req.Video = false - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallAccept, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Accept", + Func: func(c *ishell.Context) { + req := msg.ClientCallAccept{} + req.CallID = fnGetCallID(c) + req.Video = false + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallAccept, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var CallMediaSettings = &ishell.Cmd{ - Name: "MediaSettings", - Func: func(c *ishell.Context) { - req := msg.ClientCallSendMediaSettings{} - req.MediaSettings = &msg.CallMediaSettings{ - Audio: true, - ScreenShare: false, - Video: false, - } - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallSendMediaSettings, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "MediaSettings", + Func: func(c *ishell.Context) { + req := msg.ClientCallSendMediaSettings{} + req.MediaSettings = &msg.CallMediaSettings{ + Audio: true, + ScreenShare: false, + Video: false, + } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallSendMediaSettings, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var CallIceCandidate = &ishell.Cmd{ - Name: "IceCandidate", - Func: func(c *ishell.Context) { - req := msg.ClientCallSendIceCandidate{} - req.ConnId = fnGetConnId(c) - req.Candidate = &msg.CallRTCIceCandidate{ - Candidate: "", - SdpMLineIndex: 0, - SdpMid: "", - UsernameFragment: "", - } - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallSendIceCandidate, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "IceCandidate", + Func: func(c *ishell.Context) { + req := msg.ClientCallSendIceCandidate{} + req.ConnId = fnGetConnId(c) + req.Candidate = &msg.CallRTCIceCandidate{ + Candidate: "", + SdpMLineIndex: 0, + SdpMid: "", + UsernameFragment: "", + } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ClientCallSendIceCandidate, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - Call.AddCmd(CallStart) - Call.AddCmd(CallReject) - Call.AddCmd(CallAccept) - Call.AddCmd(CallMediaSettings) - Call.AddCmd(CallIceCandidate) + Call.AddCmd(CallStart) + Call.AddCmd(CallReject) + Call.AddCmd(CallAccept) + Call.AddCmd(CallMediaSettings) + Call.AddCmd(CallIceCandidate) } diff --git a/cmd/cli-river/commands_contact.go b/cmd/cli-river/commands_contact.go index af2e88d0..f63c36fe 100644 --- a/cmd/cli-river/commands_contact.go +++ b/cmd/cli-river/commands_contact.go @@ -1,157 +1,157 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - riversdk "git.ronaksoft.com/river/sdk/sdk/prime" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + riversdk "github.com/ronaksoft/river-sdk/sdk/prime" + "gopkg.in/abiosoft/ishell.v2" ) var Contact = &ishell.Cmd{ - Name: "Contact", + Name: "Contact", } var ContactImport = &ishell.Cmd{ - Name: "Import", - Func: func(c *ishell.Context) { - req := msg.ContactsImport{} - req.Replace = true - contact := msg.PhoneContact{} - contact.FirstName = fnGetFirstName(c) - contact.LastName = fnGetLastName(c) - contact.Phone = fnGetPhone(c) - contact.ClientID = domain.RandomInt63() - req.Contacts = append(req.Contacts, &contact) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsImport, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Import", + Func: func(c *ishell.Context) { + req := msg.ContactsImport{} + req.Replace = true + contact := msg.PhoneContact{} + contact.FirstName = fnGetFirstName(c) + contact.LastName = fnGetLastName(c) + contact.Phone = fnGetPhone(c) + contact.ClientID = domain.RandomInt63() + req.Contacts = append(req.Contacts, &contact) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsImport, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var ContactGet = &ishell.Cmd{ - Name: "Get", - Func: func(c *ishell.Context) { - req := &msg.ContactsGet{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsGet, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Get", + Func: func(c *ishell.Context) { + req := &msg.ContactsGet{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsGet, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var ContactGetTeam = &ishell.Cmd{ - Name: "GetTeam", - Func: func(c *ishell.Context) { - req := msg.ContactsGet{} - teamID := fnGetTeamID(c) - accessHash := fnGetAccessHash(c) - reqBytes, _ := req.Marshal() - reqDelegate := NewCustomDelegate() - reqDelegate.FlagsFunc = func() riversdk.RequestDelegateFlag { - return request.Blocking - } - if reqID, err := _SDK.ExecuteCommandWithTeam(teamID, int64(accessHash), msg.C_ContactsGet, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "GetTeam", + Func: func(c *ishell.Context) { + req := msg.ContactsGet{} + teamID := fnGetTeamID(c) + accessHash := fnGetAccessHash(c) + reqBytes, _ := req.Marshal() + reqDelegate := NewCustomDelegate() + reqDelegate.FlagsFunc = func() riversdk.RequestDelegateFlag { + return request.Blocking + } + if reqID, err := _SDK.ExecuteCommandWithTeam(teamID, int64(accessHash), msg.C_ContactsGet, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var ContactAdd = &ishell.Cmd{ - Name: "Add", - Func: func(c *ishell.Context) { - req := msg.ContactsAdd{} - req.FirstName = fnGetFirstName(c) - req.LastName = fnGetLastName(c) - req.Phone = fnGetPhone(c) - req.User = fnGetUser(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsAdd, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Add", + Func: func(c *ishell.Context) { + req := msg.ContactsAdd{} + req.FirstName = fnGetFirstName(c) + req.LastName = fnGetLastName(c) + req.Phone = fnGetPhone(c) + req.User = fnGetUser(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsAdd, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var ContactDelete = &ishell.Cmd{ - Name: "Delete", - Func: func(c *ishell.Context) { - req := msg.ContactsDelete{} - req.UserIDs = append(req.UserIDs, fnGetUserID(c)) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsDelete, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Delete", + Func: func(c *ishell.Context) { + req := msg.ContactsDelete{} + req.UserIDs = append(req.UserIDs, fnGetUserID(c)) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsDelete, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var ContactSearch = &ishell.Cmd{ - Name: "Search", - Func: func(c *ishell.Context) { - req := msg.ContactsSearch{} - req.Q = fnGetUsername(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsSearch, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Search", + Func: func(c *ishell.Context) { + req := msg.ContactsSearch{} + req.Q = fnGetUsername(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsSearch, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var ContactGetTopPeers = &ishell.Cmd{ - Name: "GetTopPeers", - Func: func(c *ishell.Context) { - req := msg.ContactsGetTopPeers{ - Limit: 10, - } - req.Category = fnGetTopPeerCat(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsGetTopPeers, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "GetTopPeers", + Func: func(c *ishell.Context) { + req := msg.ContactsGetTopPeers{ + Limit: 10, + } + req.Category = fnGetTopPeerCat(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsGetTopPeers, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var ContactDeleteAll = &ishell.Cmd{ - Name: "DeleteAll", - Func: func(c *ishell.Context) { - req := msg.ContactsDeleteAll{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsDeleteAll, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "DeleteAll", + Func: func(c *ishell.Context) { + req := msg.ContactsDeleteAll{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsDeleteAll, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - Contact.AddCmd(ContactImport) - Contact.AddCmd(ContactGet) - Contact.AddCmd(ContactGetTeam) - Contact.AddCmd(ContactAdd) - Contact.AddCmd(ContactDelete) - Contact.AddCmd(ContactGetTopPeers) - Contact.AddCmd(ContactDeleteAll) - Contact.AddCmd(ContactSearch) + Contact.AddCmd(ContactImport) + Contact.AddCmd(ContactGet) + Contact.AddCmd(ContactGetTeam) + Contact.AddCmd(ContactAdd) + Contact.AddCmd(ContactDelete) + Contact.AddCmd(ContactGetTopPeers) + Contact.AddCmd(ContactDeleteAll) + Contact.AddCmd(ContactSearch) } diff --git a/cmd/cli-river/commands_debug.go b/cmd/cli-river/commands_debug.go index 8df93515..34c49dc9 100644 --- a/cmd/cli-river/commands_debug.go +++ b/cmd/cli-river/commands_debug.go @@ -1,230 +1,231 @@ package main import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "go.uber.org/zap/zapcore" - "gopkg.in/abiosoft/ishell.v2" - "io/ioutil" - "mime" - "os" - "strings" - "sync" - "time" + "fmt" + "io/ioutil" + "mime" + "os" + "strings" + "sync" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "go.uber.org/zap/zapcore" + "gopkg.in/abiosoft/ishell.v2" ) var Debug = &ishell.Cmd{ - Name: "Debug", + Name: "Debug", } func init() { - Debug.AddCmd(DebugSendTyping) - Debug.AddCmd(DebugContactImportMany) - Debug.AddCmd(DebugMimeToExt) - Debug.AddCmd(DebugLogoutLoop) - Debug.AddCmd(SetUpdateState) - Debug.AddCmd(DebugConcurrent) - Debug.AddCmd(DebugReconnect) + Debug.AddCmd(DebugSendTyping) + Debug.AddCmd(DebugContactImportMany) + Debug.AddCmd(DebugMimeToExt) + Debug.AddCmd(DebugLogoutLoop) + Debug.AddCmd(SetUpdateState) + Debug.AddCmd(DebugConcurrent) + Debug.AddCmd(DebugReconnect) } var DebugConcurrent = &ishell.Cmd{ - Name: "Concurrent", - Func: func(c *ishell.Context) { - for j := 0; j < 20; j++ { - wg := sync.WaitGroup{} - for i := 0; i < 20; i++ { - wg.Add(1) - go func() { - req := msg.ContactsGetTopPeers{ - Offset: 0, - Limit: 100, - Category: msg.TopPeerCategory_Users, - } - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsGetTopPeers, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - wg.Done() - }() - } - wg.Wait() - } - }, + Name: "Concurrent", + Func: func(c *ishell.Context) { + for j := 0; j < 20; j++ { + wg := sync.WaitGroup{} + for i := 0; i < 20; i++ { + wg.Add(1) + go func() { + req := msg.ContactsGetTopPeers{ + Offset: 0, + Limit: 100, + Category: msg.TopPeerCategory_Users, + } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsGetTopPeers, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + wg.Done() + }() + } + wg.Wait() + } + }, } var DebugReconnect = &ishell.Cmd{ - Name: "Reconnect", - Func: func(c *ishell.Context) { - for i := 0; i < 10; i++ { - _SDK.StopNetwork() - _SDK.StartNetwork("IR") - } - - }, + Name: "Reconnect", + Func: func(c *ishell.Context) { + for i := 0; i < 10; i++ { + _SDK.StopNetwork() + _SDK.StartNetwork("IR") + } + + }, } var DebugSendTyping = &ishell.Cmd{ - Name: "SendTyping", - Func: func(c *ishell.Context) { - // for just one user - req := msg.MessagesSetTyping{} - req.Peer = &msg.InputPeer{} - req.Peer.ID = fnGetPeerID(c) - req.Peer.AccessHash = fnGetAccessHash(c) - - count := fnGetTries(c) - interval := fnGetInterval(c) - - for i := 0; i < count; i++ { - time.Sleep(interval) - if i%2 == 0 { - req.Action = msg.TypingAction_TypingActionTyping - } else { - req.Action = msg.TypingAction_TypingActionCancel - } - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSetTyping, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - } - - }, + Name: "SendTyping", + Func: func(c *ishell.Context) { + // for just one user + req := msg.MessagesSetTyping{} + req.Peer = &msg.InputPeer{} + req.Peer.ID = fnGetPeerID(c) + req.Peer.AccessHash = fnGetAccessHash(c) + + count := fnGetTries(c) + interval := fnGetInterval(c) + + for i := 0; i < count; i++ { + time.Sleep(interval) + if i%2 == 0 { + req.Action = msg.TypingAction_TypingActionTyping + } else { + req.Action = msg.TypingAction_TypingActionCancel + } + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSetTyping, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + } + + }, } var DebugContactImportMany = &ishell.Cmd{ - Name: "ContactImportMany", - Func: func(c *ishell.Context) { - req := msg.ContactsImport{} - req.Replace = true - for i := 0; i < 80; i++ { - txt := fmt.Sprintf("237400%d", 23740010+i) - contact := msg.PhoneContact{} - contact.FirstName = txt - contact.LastName = txt - contact.Phone = txt - contact.ClientID = domain.SequentialUniqueID() - req.Contacts = append(req.Contacts, &contact) - } - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsImport, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - time.Sleep(200 * time.Millisecond) - - }, + Name: "ContactImportMany", + Func: func(c *ishell.Context) { + req := msg.ContactsImport{} + req.Replace = true + for i := 0; i < 80; i++ { + txt := fmt.Sprintf("237400%d", 23740010+i) + contact := msg.PhoneContact{} + contact.FirstName = txt + contact.LastName = txt + contact.Phone = txt + contact.ClientID = domain.SequentialUniqueID() + req.Contacts = append(req.Contacts, &contact) + } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ContactsImport, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + time.Sleep(200 * time.Millisecond) + + }, } var DebugLogoutLoop = &ishell.Cmd{ - Name: "LogoutLoop", - Func: func(c *ishell.Context) { - _Log.SetLogLevel(int(zapcore.WarnLevel)) - phone := fnGetPhone(c) - for { - if _SDK.ConnInfo.UserID == 0 { - c.Println("Sending Code") - sendCode(c, phone) - c.Println("Sending Login") - login(c, phone) - time.Sleep(time.Second * 3) - } - recall() - c.Println("Sending Logout") - logout() - if _SDK.ConnInfo.UserID != 0 { - c.Println("WRONG!!!!!!!!!! We are not logout correctly") - } - time.Sleep(time.Second * 3) - } - }, + Name: "LogoutLoop", + Func: func(c *ishell.Context) { + _Log.SetLogLevel(int(zapcore.WarnLevel)) + phone := fnGetPhone(c) + for { + if _SDK.ConnInfo.UserID == 0 { + c.Println("Sending Code") + sendCode(c, phone) + c.Println("Sending Login") + login(c, phone) + time.Sleep(time.Second * 3) + } + recall() + c.Println("Sending Logout") + logout() + if _SDK.ConnInfo.UserID != 0 { + c.Println("WRONG!!!!!!!!!! We are not logout correctly") + } + time.Sleep(time.Second * 3) + } + }, } func sendCode(c *ishell.Context, phone string) { - req := msg.AuthSendCode{ - Phone: phone, - } - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - reqDelegate.FlagsVal = request.Blocking - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthSendCode, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + req := msg.AuthSendCode{ + Phone: phone, + } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + reqDelegate.FlagsVal = request.Blocking + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthSendCode, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } } func login(c *ishell.Context, phone string) { - req := msg.AuthLogin{} - phoneFile, err := os.Open("./_phone") - if err != nil { - return - } else { - b, _ := ioutil.ReadAll(phoneFile) - req.Phone = string(b) - if strings.HasPrefix(req.Phone, "2374") { - File, err := os.Open("./_phoneCodeHash") - if err != nil { - return - } else { - req.PhoneCode = req.Phone[len(req.Phone)-5:] - b, _ := ioutil.ReadAll(File) - req.PhoneCodeHash = string(b) - } - } - } - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - reqDelegate.FlagsVal = request.Blocking - os.Remove("./_phone") - os.Remove("./_phoneCodeHash") - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthLogin, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + req := msg.AuthLogin{} + phoneFile, err := os.Open("./_phone") + if err != nil { + return + } else { + b, _ := ioutil.ReadAll(phoneFile) + req.Phone = string(b) + if strings.HasPrefix(req.Phone, "2374") { + File, err := os.Open("./_phoneCodeHash") + if err != nil { + return + } else { + req.PhoneCode = req.Phone[len(req.Phone)-5:] + b, _ := ioutil.ReadAll(File) + req.PhoneCodeHash = string(b) + } + } + } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + reqDelegate.FlagsVal = request.Blocking + os.Remove("./_phone") + os.Remove("./_phoneCodeHash") + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthLogin, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } } func logout() { - _SDK.Logout(true, 0) + _SDK.Logout(true, 0) } func recall() { - req := msg.AuthRecall{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_AuthRecall, reqBytes, reqDelegate); err == nil { - reqDelegate.RequestID = reqID - } + req := msg.AuthRecall{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_AuthRecall, reqBytes, reqDelegate); err == nil { + reqDelegate.RequestID = reqID + } } var DebugMimeToExt = &ishell.Cmd{ - Name: "MimeToExt", - Func: func(c *ishell.Context) { - mimeType := fnGetMime(c) - exts, err := mime.ExtensionsByType(mimeType) - if err != nil { - c.Println(err) - return - } - for _, ext := range exts { - c.Println(ext) - } - }, + Name: "MimeToExt", + Func: func(c *ishell.Context) { + mimeType := fnGetMime(c) + exts, err := mime.ExtensionsByType(mimeType) + if err != nil { + c.Println(err) + return + } + for _, ext := range exts { + c.Println(ext) + } + }, } var SetUpdateState = &ishell.Cmd{ - Name: "SetUpdateState", - Func: func(c *ishell.Context) { - updateID := fnGetFromUpdateID(c) - _SDK.SetUpdateState(updateID) - }, + Name: "SetUpdateState", + Func: func(c *ishell.Context) { + updateID := fnGetFromUpdateID(c) + _SDK.SetUpdateState(updateID) + }, } diff --git a/cmd/cli-river/commands_file.go b/cmd/cli-river/commands_file.go index c04d3c5a..60916306 100644 --- a/cmd/cli-river/commands_file.go +++ b/cmd/cli-river/commands_file.go @@ -1,245 +1,246 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "gopkg.in/abiosoft/ishell.v2" - "mime" - "os" - "path" + "mime" + "os" + "path" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "gopkg.in/abiosoft/ishell.v2" ) var File = &ishell.Cmd{ - Name: "File", + Name: "File", } var Upload = &ishell.Cmd{ - Name: "Upload", - Func: func(c *ishell.Context) { - - req := msg.ClientSendMessageMedia{} - req.Attributes = make([]*msg.DocumentAttribute, 0) - - req.Peer = new(msg.InputPeer) - req.Peer.Type = msg.PeerType_PeerUser - req.Peer.ID = _SDK.ConnInfo.UserID - // req.Peer.Type = fnGetPeerType(c) - // req.Peer.ID = fnGetPeerID(c) - // req.Peer.AccessHash = fnGetAccessHash(c) - req.FilePath = "./_testdata/TEST1.png" - req.ThumbFilePath = "./_testdata/FileThumb.png" - // req.FilePath = fnGetFilePath(c) - // req.ThumbFilePath = fnGetThumbFilePath(c) - // req.ReplyTo = fnGetReplyTo(c) - - f, _ := os.Open(req.FilePath) - filename := f.Name() - f.Close() - - req.Caption = filename - req.ClearDraft = true - req.FileMIME = mime.TypeByExtension(path.Ext(filename)) - req.FileName = filename - - req.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument - - // req.MediaType = fnGetInputMediaType(c) - // req.Attributes = fnGetAttributes(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "Upload", + Func: func(c *ishell.Context) { + + req := msg.ClientSendMessageMedia{} + req.Attributes = make([]*msg.DocumentAttribute, 0) + + req.Peer = new(msg.InputPeer) + req.Peer.Type = msg.PeerType_PeerUser + req.Peer.ID = _SDK.ConnInfo.UserID + // req.Peer.Type = fnGetPeerType(c) + // req.Peer.ID = fnGetPeerID(c) + // req.Peer.AccessHash = fnGetAccessHash(c) + req.FilePath = "./_testdata/TEST1.png" + req.ThumbFilePath = "./_testdata/FileThumb.png" + // req.FilePath = fnGetFilePath(c) + // req.ThumbFilePath = fnGetThumbFilePath(c) + // req.ReplyTo = fnGetReplyTo(c) + + f, _ := os.Open(req.FilePath) + filename := f.Name() + f.Close() + + req.Caption = filename + req.ClearDraft = true + req.FileMIME = mime.TypeByExtension(path.Ext(filename)) + req.FileName = filename + + req.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument + + // req.MediaType = fnGetInputMediaType(c) + // req.Attributes = fnGetAttributes(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var ShareContact = &ishell.Cmd{ - Name: "ShareContact", - Func: func(c *ishell.Context) { - - req := new(msg.MessagesSendMedia) - - req.Peer = &msg.InputPeer{} - req.Peer.Type = fnGetPeerType(c) - req.Peer.ID = fnGetPeerID(c) - req.Peer.AccessHash = fnGetAccessHash(c) - req.ReplyTo = fnGetReplyTo(c) - - // get Media Contact - req.MediaType = msg.InputMediaType_InputMediaTypeContact - contact := new(msg.InputMediaContact) - contact.FirstName = fnGetFirstName(c) - contact.LastName = fnGetLastName(c) - contact.Phone = fnGetPhone(c) - // marshal contact - req.MediaData, _ = contact.Marshal() - - req.ClearDraft = true - req.RandomID = domain.SequentialUniqueID() - - // send request to server - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSendMedia, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "ShareContact", + Func: func(c *ishell.Context) { + + req := new(msg.MessagesSendMedia) + + req.Peer = &msg.InputPeer{} + req.Peer.Type = fnGetPeerType(c) + req.Peer.ID = fnGetPeerID(c) + req.Peer.AccessHash = fnGetAccessHash(c) + req.ReplyTo = fnGetReplyTo(c) + + // get Media Contact + req.MediaType = msg.InputMediaType_InputMediaTypeContact + contact := new(msg.InputMediaContact) + contact.FirstName = fnGetFirstName(c) + contact.LastName = fnGetLastName(c) + contact.Phone = fnGetPhone(c) + // marshal contact + req.MediaData, _ = contact.Marshal() + + req.ClearDraft = true + req.RandomID = domain.SequentialUniqueID() + + // send request to server + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSendMedia, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var GetSharedMedia = &ishell.Cmd{ - Name: "GetSharedMedia", - Func: func(c *ishell.Context) { - mediaType := fnGetMediaCat(c) - reqDelegate := &RequestDelegate{} - req := &msg.MessagesGetMediaHistory{ - Cat: mediaType, - Peer: fnGetPeer(c), - MaxID: 0, - } - reqBytes, _ := req.Marshal() - _SDK.ExecuteCommand(msg.C_MessagesGetMediaHistory, reqBytes, reqDelegate) - }, + Name: "GetSharedMedia", + Func: func(c *ishell.Context) { + mediaType := fnGetMediaCat(c) + reqDelegate := &RequestDelegate{} + req := &msg.MessagesGetMediaHistory{ + Cat: mediaType, + Peer: fnGetPeer(c), + MaxID: 0, + } + reqBytes, _ := req.Marshal() + _SDK.ExecuteCommand(msg.C_MessagesGetMediaHistory, reqBytes, reqDelegate) + }, } var TestUpload = &ishell.Cmd{ - Name: "TestUpload", - Func: func(c *ishell.Context) { - - peer := &msg.InputPeer{ - AccessHash: 0, - ID: -65984812425083, - Type: msg.PeerType_PeerGroup, - } - f1 := new(msg.ClientSendMessageMedia) - f2 := new(msg.ClientSendMessageMedia) - f3 := new(msg.ClientSendMessageMedia) - f4 := new(msg.ClientSendMessageMedia) - f5 := new(msg.ClientSendMessageMedia) - - f1.Peer = peer - f2.Peer = peer - f3.Peer = peer - f4.Peer = peer - f5.Peer = peer - - f1.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument - f2.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument - f3.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument - f4.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument - f5.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument - - f1.Caption = "AAAA-1" - f2.Caption = "AAAA-2" - f3.Caption = "AAAA-3" - f4.Caption = "AAAA-4" - f5.Caption = "AAAA-5" - - f1.FileName = "AAAA-1.jpg" - f2.FileName = "AAAA-2.jpg" - f3.FileName = "AAAA-3.jpg" - f4.FileName = "AAAA-4.jpg" - f5.FileName = "AAAA-5.jpg" - - f1.FilePath = "/tmpfs/1.jpg" - f2.FilePath = "/tmpfs/2.jpg" - f3.FilePath = "/tmpfs/3.jpg" - f4.FilePath = "/tmpfs/4.jpg" - f5.FilePath = "/tmpfs/5.jpg" - - f1.ThumbFilePath = "/tmpfs/t1.jpg" - f2.ThumbFilePath = "/tmpfs/t2.jpg" - f3.ThumbFilePath = "/tmpfs/t3.jpg" - f4.ThumbFilePath = "/tmpfs/t4.jpg" - f5.ThumbFilePath = "/tmpfs/t5.jpg" - - f1.FileMIME = "image/jpeg" - f2.FileMIME = "image/jpeg" - f3.FileMIME = "image/jpeg" - f4.FileMIME = "image/jpeg" - f5.FileMIME = "image/jpeg" - - f1.ThumbMIME = "image/jpeg" - f2.ThumbMIME = "image/jpeg" - f3.ThumbMIME = "image/jpeg" - f4.ThumbMIME = "image/jpeg" - f5.ThumbMIME = "image/jpeg" - - f1.ReplyTo = 0 - f2.ReplyTo = 0 - f3.ReplyTo = 0 - f4.ReplyTo = 0 - f5.ReplyTo = 0 - - f1.ClearDraft = true - f2.ClearDraft = true - f3.ClearDraft = true - f4.ClearDraft = true - f5.ClearDraft = true - - attr1 := msg.DocumentAttributeFile{Filename: "AAAA-1.jpg"} - attr2 := msg.DocumentAttributeFile{Filename: "AAAA-2.jpg"} - attr3 := msg.DocumentAttributeFile{Filename: "AAAA-3.jpg"} - attr4 := msg.DocumentAttributeFile{Filename: "AAAA-4.jpg"} - attr5 := msg.DocumentAttributeFile{Filename: "AAAA-5.jpg"} - - attrBuff1, _ := attr1.Marshal() - attrBuff2, _ := attr2.Marshal() - attrBuff3, _ := attr3.Marshal() - attrBuff4, _ := attr4.Marshal() - attrBuff5, _ := attr5.Marshal() - - f1.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff1}} - f2.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff2}} - f3.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff3}} - f4.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff4}} - f5.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff5}} - - reqBuff1, _ := f1.Marshal() - reqBuff2, _ := f2.Marshal() - reqBuff3, _ := f3.Marshal() - reqBuff4, _ := f4.Marshal() - reqBuff5, _ := f5.Marshal() - - req1 := &RequestDelegate{} - req2 := &RequestDelegate{} - req3 := &RequestDelegate{} - req4 := &RequestDelegate{} - req5 := &RequestDelegate{} - - _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff1, req1) - _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff2, req2) - _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff3, req3) - _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff4, req4) - _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff5, req5) - - }, + Name: "TestUpload", + Func: func(c *ishell.Context) { + + peer := &msg.InputPeer{ + AccessHash: 0, + ID: -65984812425083, + Type: msg.PeerType_PeerGroup, + } + f1 := new(msg.ClientSendMessageMedia) + f2 := new(msg.ClientSendMessageMedia) + f3 := new(msg.ClientSendMessageMedia) + f4 := new(msg.ClientSendMessageMedia) + f5 := new(msg.ClientSendMessageMedia) + + f1.Peer = peer + f2.Peer = peer + f3.Peer = peer + f4.Peer = peer + f5.Peer = peer + + f1.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument + f2.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument + f3.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument + f4.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument + f5.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument + + f1.Caption = "AAAA-1" + f2.Caption = "AAAA-2" + f3.Caption = "AAAA-3" + f4.Caption = "AAAA-4" + f5.Caption = "AAAA-5" + + f1.FileName = "AAAA-1.jpg" + f2.FileName = "AAAA-2.jpg" + f3.FileName = "AAAA-3.jpg" + f4.FileName = "AAAA-4.jpg" + f5.FileName = "AAAA-5.jpg" + + f1.FilePath = "/tmpfs/1.jpg" + f2.FilePath = "/tmpfs/2.jpg" + f3.FilePath = "/tmpfs/3.jpg" + f4.FilePath = "/tmpfs/4.jpg" + f5.FilePath = "/tmpfs/5.jpg" + + f1.ThumbFilePath = "/tmpfs/t1.jpg" + f2.ThumbFilePath = "/tmpfs/t2.jpg" + f3.ThumbFilePath = "/tmpfs/t3.jpg" + f4.ThumbFilePath = "/tmpfs/t4.jpg" + f5.ThumbFilePath = "/tmpfs/t5.jpg" + + f1.FileMIME = "image/jpeg" + f2.FileMIME = "image/jpeg" + f3.FileMIME = "image/jpeg" + f4.FileMIME = "image/jpeg" + f5.FileMIME = "image/jpeg" + + f1.ThumbMIME = "image/jpeg" + f2.ThumbMIME = "image/jpeg" + f3.ThumbMIME = "image/jpeg" + f4.ThumbMIME = "image/jpeg" + f5.ThumbMIME = "image/jpeg" + + f1.ReplyTo = 0 + f2.ReplyTo = 0 + f3.ReplyTo = 0 + f4.ReplyTo = 0 + f5.ReplyTo = 0 + + f1.ClearDraft = true + f2.ClearDraft = true + f3.ClearDraft = true + f4.ClearDraft = true + f5.ClearDraft = true + + attr1 := msg.DocumentAttributeFile{Filename: "AAAA-1.jpg"} + attr2 := msg.DocumentAttributeFile{Filename: "AAAA-2.jpg"} + attr3 := msg.DocumentAttributeFile{Filename: "AAAA-3.jpg"} + attr4 := msg.DocumentAttributeFile{Filename: "AAAA-4.jpg"} + attr5 := msg.DocumentAttributeFile{Filename: "AAAA-5.jpg"} + + attrBuff1, _ := attr1.Marshal() + attrBuff2, _ := attr2.Marshal() + attrBuff3, _ := attr3.Marshal() + attrBuff4, _ := attr4.Marshal() + attrBuff5, _ := attr5.Marshal() + + f1.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff1}} + f2.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff2}} + f3.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff3}} + f4.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff4}} + f5.Attributes = []*msg.DocumentAttribute{{Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attrBuff5}} + + reqBuff1, _ := f1.Marshal() + reqBuff2, _ := f2.Marshal() + reqBuff3, _ := f3.Marshal() + reqBuff4, _ := f4.Marshal() + reqBuff5, _ := f5.Marshal() + + req1 := &RequestDelegate{} + req2 := &RequestDelegate{} + req3 := &RequestDelegate{} + req4 := &RequestDelegate{} + req5 := &RequestDelegate{} + + _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff1, req1) + _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff2, req2) + _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff3, req3) + _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff4, req4) + _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBuff5, req5) + + }, } var Download = &ishell.Cmd{ - Name: "Download", - Func: func(c *ishell.Context) { - clusterID := int32(1) - docID := fnGetFileID(c) - accessHash := fnGetAccessHash(c) - err := _SDK.FileDownloadSync(clusterID, docID, int64(accessHash), true) - if err != nil { - c.Println(err) - return - } - }, + Name: "Download", + Func: func(c *ishell.Context) { + clusterID := int32(1) + docID := fnGetFileID(c) + accessHash := fnGetAccessHash(c) + err := _SDK.FileDownloadSync(clusterID, docID, int64(accessHash), true) + if err != nil { + c.Println(err) + return + } + }, } func init() { - File.AddCmd(Upload) - File.AddCmd(Download) - File.AddCmd(ShareContact) - File.AddCmd(GetSharedMedia) - File.AddCmd(TestUpload) + File.AddCmd(Upload) + File.AddCmd(Download) + File.AddCmd(ShareContact) + File.AddCmd(GetSharedMedia) + File.AddCmd(TestUpload) } diff --git a/cmd/cli-river/commands_gif.go b/cmd/cli-river/commands_gif.go index 0345f597..01903ea8 100644 --- a/cmd/cli-river/commands_gif.go +++ b/cmd/cli-river/commands_gif.go @@ -1,68 +1,68 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "gopkg.in/abiosoft/ishell.v2" ) var Gif = &ishell.Cmd{ - Name: "Gif", + Name: "Gif", } var GifSave = &ishell.Cmd{ - Name: "Save", - Func: func(c *ishell.Context) { - req := msg.GifSave{ - Doc: &msg.InputDocument{}, - } - req.Doc.ClusterID = 1 - req.Doc.ID = fnGetFileID(c) - req.Doc.AccessHash = fnGetAccessHash(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GifSave, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Save", + Func: func(c *ishell.Context) { + req := msg.GifSave{ + Doc: &msg.InputDocument{}, + } + req.Doc.ClusterID = 1 + req.Doc.ID = fnGetFileID(c) + req.Doc.AccessHash = fnGetAccessHash(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GifSave, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var GifGetSaved = &ishell.Cmd{ - Name: "GetSaved", - Func: func(c *ishell.Context) { - req := msg.GifGetSaved{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GifGetSaved, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "GetSaved", + Func: func(c *ishell.Context) { + req := msg.GifGetSaved{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GifGetSaved, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var GifDelete = &ishell.Cmd{ - Name: "Delete", - Func: func(c *ishell.Context) { - req := msg.GifDelete{ - Doc: &msg.InputDocument{}, - } - req.Doc.ID = fnGetFileID(c) - req.Doc.AccessHash = fnGetAccessHash(c) - req.Doc.ClusterID = 1 - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GifDelete, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Delete", + Func: func(c *ishell.Context) { + req := msg.GifDelete{ + Doc: &msg.InputDocument{}, + } + req.Doc.ID = fnGetFileID(c) + req.Doc.AccessHash = fnGetAccessHash(c) + req.Doc.ClusterID = 1 + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GifDelete, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - Gif.AddCmd(GifSave) - Gif.AddCmd(GifGetSaved) - Gif.AddCmd(GifDelete) + Gif.AddCmd(GifSave) + Gif.AddCmd(GifGetSaved) + Gif.AddCmd(GifDelete) } diff --git a/cmd/cli-river/commands_group.go b/cmd/cli-river/commands_group.go index 853a6653..776207f9 100644 --- a/cmd/cli-river/commands_group.go +++ b/cmd/cli-river/commands_group.go @@ -1,184 +1,184 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "gopkg.in/abiosoft/ishell.v2" ) var Group = &ishell.Cmd{ - Name: "Group", + Name: "Group", } var Create = &ishell.Cmd{ - Name: "Create", - Func: func(c *ishell.Context) { - req := msg.GroupsCreate{} - req.Title = fnGetTitle(c) - req.Users = fnGetInputUser(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsCreate, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Create", + Func: func(c *ishell.Context) { + req := msg.GroupsCreate{} + req.Title = fnGetTitle(c) + req.Users = fnGetInputUser(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsCreate, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var AddUser = &ishell.Cmd{ - Name: "AddUser", - Func: func(c *ishell.Context) { - req := msg.GroupsAddUser{} - req.User = &msg.InputUser{} - req.GroupID = fnGetGroupID(c) - req.User.UserID = fnGetPeerID(c) - req.User.AccessHash = fnGetAccessHash(c) - req.ForwardLimit = fnGetForwardLimit(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsAddUser, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "AddUser", + Func: func(c *ishell.Context) { + req := msg.GroupsAddUser{} + req.User = &msg.InputUser{} + req.GroupID = fnGetGroupID(c) + req.User.UserID = fnGetPeerID(c) + req.User.AccessHash = fnGetAccessHash(c) + req.ForwardLimit = fnGetForwardLimit(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsAddUser, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var DeleteUser = &ishell.Cmd{ - Name: "DeleteUser", - Func: func(c *ishell.Context) { - req := msg.GroupsDeleteUser{} - req.User = &msg.InputUser{} - req.GroupID = fnGetGroupID(c) - req.User.UserID = fnGetPeerID(c) - req.User.AccessHash = fnGetAccessHash(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsDeleteUser, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "DeleteUser", + Func: func(c *ishell.Context) { + req := msg.GroupsDeleteUser{} + req.User = &msg.InputUser{} + req.GroupID = fnGetGroupID(c) + req.User.UserID = fnGetPeerID(c) + req.User.AccessHash = fnGetAccessHash(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsDeleteUser, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var EditTitle = &ishell.Cmd{ - Name: "EditTitle", - Func: func(c *ishell.Context) { - req := msg.GroupsEditTitle{} - req.GroupID = fnGetGroupID(c) - req.Title = fnGetTitle(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsEditTitle, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "EditTitle", + Func: func(c *ishell.Context) { + req := msg.GroupsEditTitle{} + req.GroupID = fnGetGroupID(c) + req.Title = fnGetTitle(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsEditTitle, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var GetFull = &ishell.Cmd{ - Name: "GetFull", - Func: func(c *ishell.Context) { - req := msg.GroupsGetFull{} - req.GroupID = fnGetGroupID(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - _, err := _SDK.ExecuteCommand(msg.C_GroupsGetFull, reqBytes, reqDelegate) - if err != nil { - c.Println("Command Failed:", err) - } - }, + Name: "GetFull", + Func: func(c *ishell.Context) { + req := msg.GroupsGetFull{} + req.GroupID = fnGetGroupID(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + _, err := _SDK.ExecuteCommand(msg.C_GroupsGetFull, reqBytes, reqDelegate) + if err != nil { + c.Println("Command Failed:", err) + } + }, } var UpdateAdmin = &ishell.Cmd{ - Name: "UpdateAdmin", - Func: func(c *ishell.Context) { - req := msg.GroupsUpdateAdmin{} - req.User = new(msg.InputUser) - req.GroupID = fnGetGroupID(c) - req.User.UserID = fnGetPeerID(c) - req.User.AccessHash = fnGetAccessHash(c) - req.Admin = fnGetAdmin(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsUpdateAdmin, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "UpdateAdmin", + Func: func(c *ishell.Context) { + req := msg.GroupsUpdateAdmin{} + req.User = new(msg.InputUser) + req.GroupID = fnGetGroupID(c) + req.User.UserID = fnGetPeerID(c) + req.User.AccessHash = fnGetAccessHash(c) + req.Admin = fnGetAdmin(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsUpdateAdmin, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var ToggleAdmins = &ishell.Cmd{ - Name: "ToggleAdmins", - Func: func(c *ishell.Context) { - req := msg.GroupsToggleAdmins{} - req.GroupID = fnGetGroupID(c) - req.AdminEnabled = fnGetAdminEnabled(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsToggleAdmins, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "ToggleAdmins", + Func: func(c *ishell.Context) { + req := msg.GroupsToggleAdmins{} + req.GroupID = fnGetGroupID(c) + req.AdminEnabled = fnGetAdminEnabled(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsToggleAdmins, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var ToggleAdminOnly = &ishell.Cmd{ - Name: "ToggleAdminOnly", - Func: func(c *ishell.Context) { - req := msg.GroupsToggleAdminOnly{} - req.GroupID = fnGetGroupID(c) - req.AdminOnly = fnGetBool(c, "AdminOnly") - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsToggleAdminOnly, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "ToggleAdminOnly", + Func: func(c *ishell.Context) { + req := msg.GroupsToggleAdminOnly{} + req.GroupID = fnGetGroupID(c) + req.AdminOnly = fnGetBool(c, "AdminOnly") + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsToggleAdminOnly, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var GroupUploadPhoto = &ishell.Cmd{ - Name: "UploadPhoto", - Func: func(c *ishell.Context) { - groupID := fnGetGroupID(c) - filePath := fnGetFilePath(c) - _SDK.GroupUploadPhoto(groupID, filePath) + Name: "UploadPhoto", + Func: func(c *ishell.Context) { + groupID := fnGetGroupID(c) + filePath := fnGetFilePath(c) + _SDK.GroupUploadPhoto(groupID, filePath) - }, + }, } var GroupRemovePhoto = &ishell.Cmd{ - Name: "RemovePhoto", - Func: func(c *ishell.Context) { - req := new(msg.GroupsRemovePhoto) - req.GroupID = fnGetGroupID(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - - if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsRemovePhoto, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "RemovePhoto", + Func: func(c *ishell.Context) { + req := new(msg.GroupsRemovePhoto) + req.GroupID = fnGetGroupID(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + + if reqID, err := _SDK.ExecuteCommand(msg.C_GroupsRemovePhoto, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - Group.AddCmd(Create) - Group.AddCmd(AddUser) - Group.AddCmd(DeleteUser) - Group.AddCmd(EditTitle) - Group.AddCmd(GetFull) - Group.AddCmd(UpdateAdmin) - Group.AddCmd(ToggleAdmins) - Group.AddCmd(ToggleAdminOnly) - Group.AddCmd(GroupUploadPhoto) - Group.AddCmd(GroupRemovePhoto) + Group.AddCmd(Create) + Group.AddCmd(AddUser) + Group.AddCmd(DeleteUser) + Group.AddCmd(EditTitle) + Group.AddCmd(GetFull) + Group.AddCmd(UpdateAdmin) + Group.AddCmd(ToggleAdmins) + Group.AddCmd(ToggleAdminOnly) + Group.AddCmd(GroupUploadPhoto) + Group.AddCmd(GroupRemovePhoto) } diff --git a/cmd/cli-river/commands_label.go b/cmd/cli-river/commands_label.go index d2ce85ce..72b7d45c 100644 --- a/cmd/cli-river/commands_label.go +++ b/cmd/cli-river/commands_label.go @@ -1,281 +1,282 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony" - "gopkg.in/abiosoft/ishell.v2" - "sync" + "sync" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony" + "gopkg.in/abiosoft/ishell.v2" ) var Label = &ishell.Cmd{ - Name: "Label", + Name: "Label", } func init() { - Label.AddCmd(LabelGet) - Label.AddCmd(LabelListItems) - Label.AddCmd(LabelCreate) - Label.AddCmd(LabelTest) - Label.AddCmd(LabelAddToMessage) - Label.AddCmd(LabelRemoveFromMessage) + Label.AddCmd(LabelGet) + Label.AddCmd(LabelListItems) + Label.AddCmd(LabelCreate) + Label.AddCmd(LabelTest) + Label.AddCmd(LabelAddToMessage) + Label.AddCmd(LabelRemoveFromMessage) } var LabelGet = &ishell.Cmd{ - Name: "Get", - Func: func(c *ishell.Context) { - req := msg.LabelsGet{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - // reqDelegate.FlagsVal = riversdk.RequestServerForced - if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsGet, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "Get", + Func: func(c *ishell.Context) { + req := msg.LabelsGet{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + // reqDelegate.FlagsVal = riversdk.RequestServerForced + if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsGet, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var LabelCreate = &ishell.Cmd{ - Name: "Create", - Func: func(c *ishell.Context) { - req := msg.LabelsCreate{} - req.Name = fnGetLabelName(c) - req.Colour = fnGetLabelColour(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsCreate, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Create", + Func: func(c *ishell.Context) { + req := msg.LabelsCreate{} + req.Name = fnGetLabelName(c) + req.Colour = fnGetLabelColour(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsCreate, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var LabelListItems = &ishell.Cmd{ - Name: "ListItems", - Func: func(c *ishell.Context) { - req := msg.LabelsListItems{} - req.LabelID = fnGetLabelID(c) - req.Limit = fnGetLimit(c) - req.MinID = fnGetMinID(c) - req.MaxID = fnGetMaxID(c) + Name: "ListItems", + Func: func(c *ishell.Context) { + req := msg.LabelsListItems{} + req.LabelID = fnGetLabelID(c) + req.Limit = fnGetLimit(c) + req.MinID = fnGetMinID(c) + req.MaxID = fnGetMaxID(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - c.Println("LabelFill", repo.Labels.GetFilled(domain.GetCurrTeamID(), req.LabelID)) - if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsListItems, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + c.Println("LabelFill", repo.Labels.GetFilled(domain.GetCurrTeamID(), req.LabelID)) + if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsListItems, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var LabelAddToMessage = &ishell.Cmd{ - Name: "AddToMessage", - Func: func(c *ishell.Context) { - req := msg.LabelsAddToMessage{} - req.Peer = fnGetPeer(c) - getHistory(c, req.Peer) - req.LabelIDs = []int32{fnGetLabelID(c)} - req.MessageIDs = []int64{fnGetMessageID(c)} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsAddToMessage, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "AddToMessage", + Func: func(c *ishell.Context) { + req := msg.LabelsAddToMessage{} + req.Peer = fnGetPeer(c) + getHistory(c, req.Peer) + req.LabelIDs = []int32{fnGetLabelID(c)} + req.MessageIDs = []int64{fnGetMessageID(c)} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsAddToMessage, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func getHistory(c *ishell.Context, p *msg.InputPeer) { - req := msg.MessagesGetHistory{} - req.Peer = p - req.Limit = 10 - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetHistory, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + req := msg.MessagesGetHistory{} + req.Peer = p + req.Limit = 10 + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetHistory, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } } var LabelRemoveFromMessage = &ishell.Cmd{ - Name: "RemoveFromMessage", - Func: func(c *ishell.Context) { - req := msg.LabelsRemoveFromMessage{} - req.Peer = fnGetPeer(c) - getHistory(c, req.Peer) - req.LabelIDs = []int32{fnGetLabelID(c)} - req.MessageIDs = []int64{fnGetMessageID(c)} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsRemoveFromMessage, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "RemoveFromMessage", + Func: func(c *ishell.Context) { + req := msg.LabelsRemoveFromMessage{} + req.Peer = fnGetPeer(c) + getHistory(c, req.Peer) + req.LabelIDs = []int32{fnGetLabelID(c)} + req.MessageIDs = []int64{fnGetMessageID(c)} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsRemoveFromMessage, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var LabelTest = &ishell.Cmd{ - Name: "Test", - Func: func(c *ishell.Context) { - labels := getLabels(c) - var labelIDs []int32 - for _, l := range labels { - labelIDs = append(labelIDs, l.ID) - } - msgIDs := fnGetMessageIDs(c) - addLabelToMessage(c, msgIDs, labelIDs) - getMessage(c, msgIDs) - removeLabelFromMessage(c, msgIDs, labelIDs) - getMessage(c, msgIDs) - }, + Name: "Test", + Func: func(c *ishell.Context) { + labels := getLabels(c) + var labelIDs []int32 + for _, l := range labels { + labelIDs = append(labelIDs, l.ID) + } + msgIDs := fnGetMessageIDs(c) + addLabelToMessage(c, msgIDs, labelIDs) + getMessage(c, msgIDs) + removeLabelFromMessage(c, msgIDs, labelIDs) + getMessage(c, msgIDs) + }, } func getLabels(c *ishell.Context) (labels []*msg.Label) { - req := msg.LabelsGet{} - reqBytes, _ := req.Marshal() - reqD := NewCustomDelegate() - wg := sync.WaitGroup{} - wg.Add(1) - reqD.OnCompleteFunc = func(b []byte) { - defer wg.Done() - x := &rony.MessageEnvelope{} - _ = x.Unmarshal(b) - switch x.Constructor { - case msg.C_LabelsMany: - xx := &msg.LabelsMany{} - _ = xx.Unmarshal(x.Message) - labels = xx.Labels - default: - c.Println(x) - } - } - reqD.OnTimeoutFunc = func(err error) { - wg.Done() - } - if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsGet, reqBytes, reqD); err != nil { - c.Println("Command Failed:", err) - } else { - reqD.RequestID = reqID - } - wg.Wait() - return + req := msg.LabelsGet{} + reqBytes, _ := req.Marshal() + reqD := NewCustomDelegate() + wg := sync.WaitGroup{} + wg.Add(1) + reqD.OnCompleteFunc = func(b []byte) { + defer wg.Done() + x := &rony.MessageEnvelope{} + _ = x.Unmarshal(b) + switch x.Constructor { + case msg.C_LabelsMany: + xx := &msg.LabelsMany{} + _ = xx.Unmarshal(x.Message) + labels = xx.Labels + default: + c.Println(x) + } + } + reqD.OnTimeoutFunc = func(err error) { + wg.Done() + } + if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsGet, reqBytes, reqD); err != nil { + c.Println("Command Failed:", err) + } else { + reqD.RequestID = reqID + } + wg.Wait() + return } func addLabelToMessage(c *ishell.Context, msgIDs []int64, labelIDs []int32) { - req := msg.LabelsAddToMessage{ - Peer: &msg.InputPeer{ - ID: _SDK.ConnInfo.UserID, - Type: msg.PeerType_PeerUser, - AccessHash: 0, - }, - LabelIDs: labelIDs, - MessageIDs: msgIDs, - } - reqBytes, _ := req.Marshal() - reqD := NewCustomDelegate() - wg := sync.WaitGroup{} - wg.Add(1) - reqD.OnCompleteFunc = func(b []byte) { - defer wg.Done() - x := &rony.MessageEnvelope{} - _ = x.Unmarshal(b) - switch x.Constructor { - case msg.C_Bool: - c.Println(x) - default: - c.Println(x) - } - } - reqD.OnTimeoutFunc = func(err error) { - wg.Done() - } - if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsAddToMessage, reqBytes, reqD); err != nil { - c.Println("Command Failed:", err) - } else { - reqD.RequestID = reqID - } - wg.Wait() + req := msg.LabelsAddToMessage{ + Peer: &msg.InputPeer{ + ID: _SDK.ConnInfo.UserID, + Type: msg.PeerType_PeerUser, + AccessHash: 0, + }, + LabelIDs: labelIDs, + MessageIDs: msgIDs, + } + reqBytes, _ := req.Marshal() + reqD := NewCustomDelegate() + wg := sync.WaitGroup{} + wg.Add(1) + reqD.OnCompleteFunc = func(b []byte) { + defer wg.Done() + x := &rony.MessageEnvelope{} + _ = x.Unmarshal(b) + switch x.Constructor { + case msg.C_Bool: + c.Println(x) + default: + c.Println(x) + } + } + reqD.OnTimeoutFunc = func(err error) { + wg.Done() + } + if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsAddToMessage, reqBytes, reqD); err != nil { + c.Println("Command Failed:", err) + } else { + reqD.RequestID = reqID + } + wg.Wait() } func removeLabelFromMessage(c *ishell.Context, msgIDs []int64, labelIDs []int32) { - req := msg.LabelsRemoveFromMessage{ - Peer: &msg.InputPeer{ - ID: _SDK.ConnInfo.UserID, - Type: msg.PeerType_PeerUser, - AccessHash: 0, - }, - LabelIDs: labelIDs, - MessageIDs: msgIDs, - } - reqBytes, _ := req.Marshal() - reqD := NewCustomDelegate() - wg := sync.WaitGroup{} - wg.Add(1) - reqD.OnCompleteFunc = func(b []byte) { - defer wg.Done() - x := &rony.MessageEnvelope{} - _ = x.Unmarshal(b) - switch x.Constructor { - case msg.C_Bool: - c.Println(x) - default: - c.Println(x) - } - } - reqD.OnTimeoutFunc = func(err error) { - wg.Done() - } - if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsRemoveFromMessage, reqBytes, reqD); err != nil { - c.Println("Command Failed:", err) - } else { - reqD.RequestID = reqID - } - wg.Wait() + req := msg.LabelsRemoveFromMessage{ + Peer: &msg.InputPeer{ + ID: _SDK.ConnInfo.UserID, + Type: msg.PeerType_PeerUser, + AccessHash: 0, + }, + LabelIDs: labelIDs, + MessageIDs: msgIDs, + } + reqBytes, _ := req.Marshal() + reqD := NewCustomDelegate() + wg := sync.WaitGroup{} + wg.Add(1) + reqD.OnCompleteFunc = func(b []byte) { + defer wg.Done() + x := &rony.MessageEnvelope{} + _ = x.Unmarshal(b) + switch x.Constructor { + case msg.C_Bool: + c.Println(x) + default: + c.Println(x) + } + } + reqD.OnTimeoutFunc = func(err error) { + wg.Done() + } + if reqID, err := _SDK.ExecuteCommand(msg.C_LabelsRemoveFromMessage, reqBytes, reqD); err != nil { + c.Println("Command Failed:", err) + } else { + reqD.RequestID = reqID + } + wg.Wait() } func getMessage(c *ishell.Context, msgIDs []int64) { - req := msg.MessagesGet{ - Peer: &msg.InputPeer{ - ID: _SDK.ConnInfo.UserID, - Type: msg.PeerType_PeerUser, - AccessHash: 0, - }, - MessagesIDs: msgIDs, - } - reqBytes, _ := req.Marshal() - reqD := NewCustomDelegate() - wg := sync.WaitGroup{} - wg.Add(1) - reqD.OnCompleteFunc = func(b []byte) { - defer wg.Done() - x := &rony.MessageEnvelope{} - _ = x.Unmarshal(b) - switch x.Constructor { - case msg.C_MessagesMany: - xx := &msg.MessagesMany{} - _ = xx.Unmarshal(x.Message) - for _, m := range xx.Messages { - c.Println(m.ID, m.Body, m.LabelIDs) - } - default: - c.Println(x) - } - } - reqD.OnTimeoutFunc = func(err error) { - wg.Done() - } - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGet, reqBytes, reqD); err != nil { - c.Println("Command Failed:", err) - } else { - reqD.RequestID = reqID - } - wg.Wait() + req := msg.MessagesGet{ + Peer: &msg.InputPeer{ + ID: _SDK.ConnInfo.UserID, + Type: msg.PeerType_PeerUser, + AccessHash: 0, + }, + MessagesIDs: msgIDs, + } + reqBytes, _ := req.Marshal() + reqD := NewCustomDelegate() + wg := sync.WaitGroup{} + wg.Add(1) + reqD.OnCompleteFunc = func(b []byte) { + defer wg.Done() + x := &rony.MessageEnvelope{} + _ = x.Unmarshal(b) + switch x.Constructor { + case msg.C_MessagesMany: + xx := &msg.MessagesMany{} + _ = xx.Unmarshal(x.Message) + for _, m := range xx.Messages { + c.Println(m.ID, m.Body, m.LabelIDs) + } + default: + c.Println(x) + } + } + reqD.OnTimeoutFunc = func(err error) { + wg.Done() + } + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGet, reqBytes, reqD); err != nil { + c.Println("Command Failed:", err) + } else { + reqD.RequestID = reqID + } + wg.Wait() } diff --git a/cmd/cli-river/commands_message.go b/cmd/cli-river/commands_message.go index 2c348144..dfa81b8f 100644 --- a/cmd/cli-river/commands_message.go +++ b/cmd/cli-river/commands_message.go @@ -1,415 +1,415 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/ronaksoft/rony" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony" + "gopkg.in/abiosoft/ishell.v2" ) var Message = &ishell.Cmd{ - Name: "Messages", + Name: "Messages", } var MessageSend = &ishell.Cmd{ - Name: "SendMessage", - Func: func(c *ishell.Context) { - req := msg.MessagesSend{} - req.RandomID = domain.RandomInt63() - req.Peer = &msg.InputPeer{} - req.Peer.Type = fnGetPeerType(c) - req.Peer.ID = fnGetPeerID(c) - req.Peer.AccessHash = fnGetAccessHash(c) - req.Body = fnGetBody(c) - req.Entities = fnGetEntities(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSend, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "SendMessage", + Func: func(c *ishell.Context) { + req := msg.MessagesSend{} + req.RandomID = domain.RandomInt63() + req.Peer = &msg.InputPeer{} + req.Peer.Type = fnGetPeerType(c) + req.Peer.ID = fnGetPeerID(c) + req.Peer.AccessHash = fnGetAccessHash(c) + req.Body = fnGetBody(c) + req.Entities = fnGetEntities(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSend, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessageSendToSelf = &ishell.Cmd{ - Name: "SendToMe", - Func: func(c *ishell.Context) { - req := msg.MessagesSend{} - req.RandomID = domain.RandomInt63() - req.Peer = &msg.InputPeer{} - req.Peer.Type = msg.PeerType_PeerUser - req.Peer.ID = _SDK.ConnInfo.UserID - req.Peer.AccessHash = 0 - req.Body = fnGetBody(c) - if len(req.Body) == 0 { - req.Body = domain.RandomID(32) - } - req.Entities = nil - reqBytes, _ := req.Marshal() - reqDelegate := NewCustomDelegate() - reqDelegate.OnCompleteFunc = func(b []byte) { - x := &rony.MessageEnvelope{} - _ = x.Unmarshal(b) - MessagePrinter(x) - // _Shell.Println("Execute Time:", time.Since(startTime)) - } - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSend, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "SendToMe", + Func: func(c *ishell.Context) { + req := msg.MessagesSend{} + req.RandomID = domain.RandomInt63() + req.Peer = &msg.InputPeer{} + req.Peer.Type = msg.PeerType_PeerUser + req.Peer.ID = _SDK.ConnInfo.UserID + req.Peer.AccessHash = 0 + req.Body = fnGetBody(c) + if len(req.Body) == 0 { + req.Body = domain.RandomID(32) + } + req.Entities = nil + reqBytes, _ := req.Marshal() + reqDelegate := NewCustomDelegate() + reqDelegate.OnCompleteFunc = func(b []byte) { + x := &rony.MessageEnvelope{} + _ = x.Unmarshal(b) + MessagePrinter(x) + // _Shell.Println("Execute Time:", time.Since(startTime)) + } + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSend, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessageSendMediaToSelf = &ishell.Cmd{ - Name: "SendMediaToMe", - Func: func(c *ishell.Context) { - attrFile := &msg.DocumentAttributeFile{ - Filename: "File.jpg", - } - attrFileBytes, _ := attrFile.Marshal() - attrPhoto := &msg.DocumentAttributePhoto{ - Width: 720, - Height: 720, - } - attrPhotoBytes, _ := attrPhoto.Marshal() - req := msg.ClientSendMessageMedia{ - Peer: &msg.InputPeer{ - ID: _SDK.ConnInfo.UserID, - Type: msg.PeerType_PeerUser, - AccessHash: 0, - }, - MediaType: msg.InputMediaType_InputMediaTypeUploadedDocument, - Caption: "Some Random Caption", - FileName: "Uploaded File", - FileMIME: "image/jpeg", - ThumbMIME: "", - ReplyTo: 0, - ClearDraft: false, - Attributes: []*msg.DocumentAttribute{ - { - Type: msg.DocumentAttributeType_AttributeTypePhoto, - Data: attrPhotoBytes, - }, - { - Type: msg.DocumentAttributeType_AttributeTypeFile, - Data: attrFileBytes, - }, - }, - } - // _ = exec.Command("cp", "./_testdata/T.jpg", "./_testdata/F.jpg").Run() - // req.FilePath = "./_testdata/F.jpg" - // req.ThumbFilePath = "./_testdata/T.jpg" - req.FilePath = fnGetFilePath(c) - req.ThumbFilePath = fnGetThumbFilePath(c) - req.Entities = nil - reqBytes, _ := req.Marshal() - reqDelegate := NewCustomDelegate() - reqDelegate.OnCompleteFunc = func(b []byte) { - x := &rony.MessageEnvelope{} - _ = x.Unmarshal(b) - MessagePrinter(x) - } - if reqID, err := _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "SendMediaToMe", + Func: func(c *ishell.Context) { + attrFile := &msg.DocumentAttributeFile{ + Filename: "File.jpg", + } + attrFileBytes, _ := attrFile.Marshal() + attrPhoto := &msg.DocumentAttributePhoto{ + Width: 720, + Height: 720, + } + attrPhotoBytes, _ := attrPhoto.Marshal() + req := msg.ClientSendMessageMedia{ + Peer: &msg.InputPeer{ + ID: _SDK.ConnInfo.UserID, + Type: msg.PeerType_PeerUser, + AccessHash: 0, + }, + MediaType: msg.InputMediaType_InputMediaTypeUploadedDocument, + Caption: "Some Random Caption", + FileName: "Uploaded File", + FileMIME: "image/jpeg", + ThumbMIME: "", + ReplyTo: 0, + ClearDraft: false, + Attributes: []*msg.DocumentAttribute{ + { + Type: msg.DocumentAttributeType_AttributeTypePhoto, + Data: attrPhotoBytes, + }, + { + Type: msg.DocumentAttributeType_AttributeTypeFile, + Data: attrFileBytes, + }, + }, + } + // _ = exec.Command("cp", "./_testdata/T.jpg", "./_testdata/F.jpg").Run() + // req.FilePath = "./_testdata/F.jpg" + // req.ThumbFilePath = "./_testdata/T.jpg" + req.FilePath = fnGetFilePath(c) + req.ThumbFilePath = fnGetThumbFilePath(c) + req.Entities = nil + reqBytes, _ := req.Marshal() + reqDelegate := NewCustomDelegate() + reqDelegate.OnCompleteFunc = func(b []byte) { + x := &rony.MessageEnvelope{} + _ = x.Unmarshal(b) + MessagePrinter(x) + } + if reqID, err := _SDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessageGetDialogs = &ishell.Cmd{ - Name: "GetDialogs", - Func: func(c *ishell.Context) { - req := msg.MessagesGetDialogs{} - req.Limit = int32(100) - req.Offset = fnGetOffset(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetDialogs, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "GetDialogs", + Func: func(c *ishell.Context) { + req := msg.MessagesGetDialogs{} + req.Limit = int32(100) + req.Offset = fnGetOffset(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetDialogs, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessageGetDialog = &ishell.Cmd{ - Name: "GetDialog", - Func: func(c *ishell.Context) { - req := msg.MessagesGetDialog{} - req.Peer = &msg.InputPeer{} - req.Peer.Type = fnGetPeerType(c) - req.Peer.ID = fnGetPeerID(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetDialog, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "GetDialog", + Func: func(c *ishell.Context) { + req := msg.MessagesGetDialog{} + req.Peer = &msg.InputPeer{} + req.Peer.Type = fnGetPeerType(c) + req.Peer.ID = fnGetPeerID(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetDialog, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessageGetHistory = &ishell.Cmd{ - Name: "GetHistory", - Func: func(c *ishell.Context) { - req := msg.MessagesGetHistory{} - req.Peer = fnGetPeer(c) - req.MaxID = fnGetMaxID(c) - req.MinID = fnGetMinID(c) - req.Limit = fnGetLimit(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetHistory, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "GetHistory", + Func: func(c *ishell.Context) { + req := msg.MessagesGetHistory{} + req.Peer = fnGetPeer(c) + req.MaxID = fnGetMaxID(c) + req.MinID = fnGetMinID(c) + req.Limit = fnGetLimit(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetHistory, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessageReadHistory = &ishell.Cmd{ - Name: "ReadHistory", - Func: func(c *ishell.Context) { - req := msg.MessagesReadHistory{} - req.Peer = fnGetPeer(c) - req.MaxID = fnGetMaxID(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesReadHistory, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "ReadHistory", + Func: func(c *ishell.Context) { + req := msg.MessagesReadHistory{} + req.Peer = fnGetPeer(c) + req.MaxID = fnGetMaxID(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesReadHistory, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessageSetTyping = &ishell.Cmd{ - Name: "SetTyping", - Func: func(c *ishell.Context) { - req := msg.MessagesSetTyping{} - req.Peer = fnGetPeer(c) - req.Action = fnGetTypingAction(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSetTyping, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "SetTyping", + Func: func(c *ishell.Context) { + req := msg.MessagesSetTyping{} + req.Peer = fnGetPeer(c) + req.Action = fnGetTypingAction(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesSetTyping, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessagesGet = &ishell.Cmd{ - Name: "Get", - Func: func(c *ishell.Context) { - req := msg.MessagesGet{} - req.Peer = &msg.InputPeer{} - req.Peer.Type = fnGetPeerType(c) - - req.Peer.ID = fnGetPeerID(c) - req.Peer.AccessHash = fnGetAccessHash(c) - req.MessagesIDs = fnGetMessageIDs(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGet, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "Get", + Func: func(c *ishell.Context) { + req := msg.MessagesGet{} + req.Peer = &msg.InputPeer{} + req.Peer.Type = fnGetPeerType(c) + + req.Peer.ID = fnGetPeerID(c) + req.Peer.AccessHash = fnGetAccessHash(c) + req.MessagesIDs = fnGetMessageIDs(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGet, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessagesClearHistory = &ishell.Cmd{ - Name: "ClearHistory", - Func: func(c *ishell.Context) { - req := msg.MessagesClearHistory{} - req.Peer = fnGetPeer(c) - req.MaxID = fnGetMaxID(c) - req.Delete = fnGetDelete(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesClearHistory, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "ClearHistory", + Func: func(c *ishell.Context) { + req := msg.MessagesClearHistory{} + req.Peer = fnGetPeer(c) + req.MaxID = fnGetMaxID(c) + req.Delete = fnGetDelete(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesClearHistory, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessagesDelete = &ishell.Cmd{ - Name: "Delete", - Func: func(c *ishell.Context) { - req := msg.MessagesDelete{} - req.Peer = &msg.InputPeer{} - req.Peer.Type = fnGetPeerType(c) - req.Peer.ID = fnGetPeerID(c) - req.Peer.AccessHash = fnGetAccessHash(c) - req.Revoke = fnGetRevoke(c) - req.MessageIDs = fnGetMessageIDs(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesDelete, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "Delete", + Func: func(c *ishell.Context) { + req := msg.MessagesDelete{} + req.Peer = &msg.InputPeer{} + req.Peer.Type = fnGetPeerType(c) + req.Peer.ID = fnGetPeerID(c) + req.Peer.AccessHash = fnGetAccessHash(c) + req.Revoke = fnGetRevoke(c) + req.MessageIDs = fnGetMessageIDs(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesDelete, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessagesEdit = &ishell.Cmd{ - Name: "Edit", - Func: func(c *ishell.Context) { - req := msg.MessagesEdit{} - req.Peer = &msg.InputPeer{} - req.Peer.Type = fnGetPeerType(c) - req.Peer.ID = fnGetPeerID(c) - req.Peer.AccessHash = fnGetAccessHash(c) - req.MessageID = fnGetMessageID(c) - req.Body = fnGetBody(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesEdit, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "Edit", + Func: func(c *ishell.Context) { + req := msg.MessagesEdit{} + req.Peer = &msg.InputPeer{} + req.Peer.Type = fnGetPeerType(c) + req.Peer.ID = fnGetPeerID(c) + req.Peer.AccessHash = fnGetAccessHash(c) + req.MessageID = fnGetMessageID(c) + req.Body = fnGetBody(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesEdit, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessagesForward = &ishell.Cmd{ - Name: "Forward", - Func: func(c *ishell.Context) { - req := msg.MessagesForward{} - req.FromPeer = &msg.InputPeer{} - req.ToPeer = &msg.InputPeer{} - - req.RandomID = domain.SequentialUniqueID() - req.Silence = fnGetSilence(c) - - c.Println("***** From Peer :") - req.FromPeer.Type = fnGetPeerType(c) - req.FromPeer.ID = fnGetPeerID(c) - req.FromPeer.AccessHash = fnGetAccessHash(c) - - c.Println("***** To Peer :") - req.ToPeer.Type = fnGetPeerType(c) - req.ToPeer.ID = fnGetPeerID(c) - req.ToPeer.AccessHash = fnGetAccessHash(c) - - req.MessageIDs = fnGetMessageIDs(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesForward, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "Forward", + Func: func(c *ishell.Context) { + req := msg.MessagesForward{} + req.FromPeer = &msg.InputPeer{} + req.ToPeer = &msg.InputPeer{} + + req.RandomID = domain.SequentialUniqueID() + req.Silence = fnGetSilence(c) + + c.Println("***** From Peer :") + req.FromPeer.Type = fnGetPeerType(c) + req.FromPeer.ID = fnGetPeerID(c) + req.FromPeer.AccessHash = fnGetAccessHash(c) + + c.Println("***** To Peer :") + req.ToPeer.Type = fnGetPeerType(c) + req.ToPeer.ID = fnGetPeerID(c) + req.ToPeer.AccessHash = fnGetAccessHash(c) + + req.MessageIDs = fnGetMessageIDs(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesForward, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessagesReadContents = &ishell.Cmd{ - Name: "ReadContents", - Func: func(c *ishell.Context) { - req := msg.MessagesReadContents{ - Peer: new(msg.InputPeer), - MessageIDs: make([]int64, 0), - } - req.Peer.Type = fnGetPeerType(c) - req.Peer.ID = fnGetPeerID(c) - req.Peer.AccessHash = fnGetAccessHash(c) - req.MessageIDs = fnGetMessageIDs(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesReadContents, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "ReadContents", + Func: func(c *ishell.Context) { + req := msg.MessagesReadContents{ + Peer: new(msg.InputPeer), + MessageIDs: make([]int64, 0), + } + req.Peer.Type = fnGetPeerType(c) + req.Peer.ID = fnGetPeerID(c) + req.Peer.AccessHash = fnGetAccessHash(c) + req.MessageIDs = fnGetMessageIDs(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesReadContents, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } var MessagesGetDBMediaStatus = &ishell.Cmd{ - Name: "GetDBMediaStatus", - Func: func(c *ishell.Context) { - // reqDelegate := new(dbMediaDelegate) - // _SDK.GetDBStatus(reqDelegate) - }, + Name: "GetDBMediaStatus", + Func: func(c *ishell.Context) { + // reqDelegate := new(dbMediaDelegate) + // _SDK.GetDBStatus(reqDelegate) + }, } var MessagesClearMedia = &ishell.Cmd{ - Name: "ClearMedia", - Func: func(c *ishell.Context) { - // peerId := fnGetPeerID(c) - // all := fnClearAll(c) - // mediaType := fnGetMediaTypes(c) - // status := _SDK.ClearCache(peerId, mediaType, all) - // _Log.Debug("MessagesClearMedia::status", zap.Bool("", status)) - }, + Name: "ClearMedia", + Func: func(c *ishell.Context) { + // peerId := fnGetPeerID(c) + // all := fnClearAll(c) + // mediaType := fnGetMediaTypes(c) + // status := _SDK.ClearCache(peerId, mediaType, all) + // _Log.Debug("MessagesClearMedia::status", zap.Bool("", status)) + }, } var MessagesGetMediaHistory = &ishell.Cmd{ - Name: "GetMediaHistory", - Func: func(c *ishell.Context) { - req := msg.MessagesGetMediaHistory{} - req.Peer = fnGetPeer(c) - req.MaxID = fnGetMaxID(c) - req.Limit = fnGetLimit(c) - req.Cat = fnGetMediaCat(c) - - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetMediaHistory, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - - }, + Name: "GetMediaHistory", + Func: func(c *ishell.Context) { + req := msg.MessagesGetMediaHistory{} + req.Peer = fnGetPeer(c) + req.MaxID = fnGetMaxID(c) + req.Limit = fnGetLimit(c) + req.Cat = fnGetMediaCat(c) + + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetMediaHistory, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + + }, } func init() { - Message.AddCmd(MessageGetDialogs) - Message.AddCmd(MessageGetDialog) - Message.AddCmd(MessageSend) - Message.AddCmd(MessageSendToSelf) - Message.AddCmd(MessageSendMediaToSelf) - Message.AddCmd(MessageGetHistory) - Message.AddCmd(MessageReadHistory) - Message.AddCmd(MessageSetTyping) - Message.AddCmd(MessagesGet) - Message.AddCmd(MessagesClearHistory) - Message.AddCmd(MessagesDelete) - Message.AddCmd(MessagesEdit) - Message.AddCmd(MessagesForward) - Message.AddCmd(MessagesReadContents) - Message.AddCmd(MessagesGetDBMediaStatus) - Message.AddCmd(MessagesClearMedia) - Message.AddCmd(MessagesGetMediaHistory) + Message.AddCmd(MessageGetDialogs) + Message.AddCmd(MessageGetDialog) + Message.AddCmd(MessageSend) + Message.AddCmd(MessageSendToSelf) + Message.AddCmd(MessageSendMediaToSelf) + Message.AddCmd(MessageGetHistory) + Message.AddCmd(MessageReadHistory) + Message.AddCmd(MessageSetTyping) + Message.AddCmd(MessagesGet) + Message.AddCmd(MessagesClearHistory) + Message.AddCmd(MessagesDelete) + Message.AddCmd(MessagesEdit) + Message.AddCmd(MessagesForward) + Message.AddCmd(MessagesReadContents) + Message.AddCmd(MessagesGetDBMediaStatus) + Message.AddCmd(MessagesClearMedia) + Message.AddCmd(MessagesGetMediaHistory) } diff --git a/cmd/cli-river/commands_mini.go b/cmd/cli-river/commands_mini.go index 0e9ebd4d..a14be758 100644 --- a/cmd/cli-river/commands_mini.go +++ b/cmd/cli-river/commands_mini.go @@ -1,9 +1,9 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "github.com/ronaksoft/rony" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/rony" + "gopkg.in/abiosoft/ishell.v2" ) /* @@ -16,136 +16,136 @@ import ( */ func init() { - Mini.AddCmd(MiniMessageGetDialogs) - Mini.AddCmd(MiniAccountGetTeams) - Mini.AddCmd(MiniMessageSendMediaToSelf) - Mini.AddCmd(MiniContactsGet) - Mini.AddCmd(MiniClientSearch) + Mini.AddCmd(MiniMessageGetDialogs) + Mini.AddCmd(MiniAccountGetTeams) + Mini.AddCmd(MiniMessageSendMediaToSelf) + Mini.AddCmd(MiniContactsGet) + Mini.AddCmd(MiniClientSearch) } var Mini = &ishell.Cmd{ - Name: "Mini", + Name: "Mini", } var MiniMessageGetDialogs = &ishell.Cmd{ - Name: "GetDialogs", - Func: func(c *ishell.Context) { - req := msg.MessagesGetDialogs{} - req.Limit = int32(100) - req.Offset = fnGetOffset(c) + Name: "GetDialogs", + Func: func(c *ishell.Context) { + req := msg.MessagesGetDialogs{} + req.Limit = int32(100) + req.Offset = fnGetOffset(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _MiniSDK.ExecuteCommand(msg.C_MessagesGetDialogs, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _MiniSDK.ExecuteCommand(msg.C_MessagesGetDialogs, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var MiniAccountGetTeams = &ishell.Cmd{ - Name: "GetTeams", - Func: func(c *ishell.Context) { - req := msg.AccountGetTeams{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) + Name: "GetTeams", + Func: func(c *ishell.Context) { + req := msg.AccountGetTeams{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) - if reqID, err := _MiniSDK.ExecuteCommand(msg.C_AccountGetTeams, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + if reqID, err := _MiniSDK.ExecuteCommand(msg.C_AccountGetTeams, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var MiniContactsGet = &ishell.Cmd{ - Name: "GetContacts", - Func: func(c *ishell.Context) { - req := msg.ContactsGet{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _MiniSDK.ExecuteCommand(msg.C_ContactsGet, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "GetContacts", + Func: func(c *ishell.Context) { + req := msg.ContactsGet{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _MiniSDK.ExecuteCommand(msg.C_ContactsGet, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var MiniClientSearch = &ishell.Cmd{ - Name: "ClientSearch", - Func: func(c *ishell.Context) { - req := msg.ClientGlobalSearch{} - req.Text = fnGetString(c, "Phrase:") - req.Limit = 10 - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _MiniSDK.ExecuteCommand(msg.C_ClientGlobalSearch, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "ClientSearch", + Func: func(c *ishell.Context) { + req := msg.ClientGlobalSearch{} + req.Text = fnGetString(c, "Phrase:") + req.Limit = 10 + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _MiniSDK.ExecuteCommand(msg.C_ClientGlobalSearch, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var MiniMessageSendMediaToSelf = &ishell.Cmd{ - Name: "SendMediaToMe", - Func: func(c *ishell.Context) { - attrFile := &msg.DocumentAttributeFile{ - Filename: "File.jpg", - } - attrFileBytes, _ := attrFile.Marshal() - attrPhoto := &msg.DocumentAttributePhoto{ - Width: 720, - Height: 720, - } - attrPhotoBytes, _ := attrPhoto.Marshal() - req := msg.ClientSendMessageMedia{ - Peer: &msg.InputPeer{ - ID: _MiniSDK.ConnInfo.UserID, - Type: msg.PeerType_PeerUser, - AccessHash: 0, - }, - MediaType: msg.InputMediaType_InputMediaTypeUploadedDocument, - Caption: "Some Random Caption", - FileName: "Uploaded File", - FileMIME: "image/jpeg", - ThumbMIME: "", - ReplyTo: 0, - ClearDraft: false, - Attributes: []*msg.DocumentAttribute{ - { - Type: msg.DocumentAttributeType_AttributeTypePhoto, - Data: attrPhotoBytes, - }, - { - Type: msg.DocumentAttributeType_AttributeTypeFile, - Data: attrFileBytes, - }, - }, - } - // _ = exec.Command("cp", "./_testdata/T.jpg", "./_testdata/F.jpg").Run() - // req.FilePath = "./_testdata/F.jpg" - // req.ThumbFilePath = "./_testdata/T.jpg" - req.FilePath = fnGetFilePath(c) - req.ThumbFilePath = fnGetThumbFilePath(c) - req.Entities = nil - reqBytes, _ := req.Marshal() - reqDelegate := NewCustomDelegate() - reqDelegate.OnCompleteFunc = func(b []byte) { - x := &rony.MessageEnvelope{} - _ = x.Unmarshal(b) - MessagePrinter(x) - } - if reqID, err := _MiniSDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "SendMediaToMe", + Func: func(c *ishell.Context) { + attrFile := &msg.DocumentAttributeFile{ + Filename: "File.jpg", + } + attrFileBytes, _ := attrFile.Marshal() + attrPhoto := &msg.DocumentAttributePhoto{ + Width: 720, + Height: 720, + } + attrPhotoBytes, _ := attrPhoto.Marshal() + req := msg.ClientSendMessageMedia{ + Peer: &msg.InputPeer{ + ID: _MiniSDK.ConnInfo.UserID, + Type: msg.PeerType_PeerUser, + AccessHash: 0, + }, + MediaType: msg.InputMediaType_InputMediaTypeUploadedDocument, + Caption: "Some Random Caption", + FileName: "Uploaded File", + FileMIME: "image/jpeg", + ThumbMIME: "", + ReplyTo: 0, + ClearDraft: false, + Attributes: []*msg.DocumentAttribute{ + { + Type: msg.DocumentAttributeType_AttributeTypePhoto, + Data: attrPhotoBytes, + }, + { + Type: msg.DocumentAttributeType_AttributeTypeFile, + Data: attrFileBytes, + }, + }, + } + // _ = exec.Command("cp", "./_testdata/T.jpg", "./_testdata/F.jpg").Run() + // req.FilePath = "./_testdata/F.jpg" + // req.ThumbFilePath = "./_testdata/T.jpg" + req.FilePath = fnGetFilePath(c) + req.ThumbFilePath = fnGetThumbFilePath(c) + req.Entities = nil + reqBytes, _ := req.Marshal() + reqDelegate := NewCustomDelegate() + reqDelegate.OnCompleteFunc = func(b []byte) { + x := &rony.MessageEnvelope{} + _ = x.Unmarshal(b) + MessagePrinter(x) + } + if reqID, err := _MiniSDK.ExecuteCommand(msg.C_ClientSendMessageMedia, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } diff --git a/cmd/cli-river/commands_sdk.go b/cmd/cli-river/commands_sdk.go index da97c89a..dbb919e1 100644 --- a/cmd/cli-river/commands_sdk.go +++ b/cmd/cli-river/commands_sdk.go @@ -1,188 +1,189 @@ package main import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - mon "git.ronaksoft.com/river/sdk/internal/monitoring" - riversdk "git.ronaksoft.com/river/sdk/sdk/prime" - "gopkg.in/abiosoft/ishell.v2" - "time" + "fmt" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + mon "github.com/ronaksoft/river-sdk/internal/monitoring" + riversdk "github.com/ronaksoft/river-sdk/sdk/prime" + "gopkg.in/abiosoft/ishell.v2" ) var SDK = &ishell.Cmd{ - Name: "SDK", + Name: "SDK", } var SdkConnInfo = &ishell.Cmd{ - Name: "ConnInfo", - Func: func(c *ishell.Context) { - c.Println("UserID:", _SDK.ConnInfo.UserID) - c.Println("AuthID:", _SDK.ConnInfo.AuthID) - c.Println("Phone:", _SDK.ConnInfo.Phone) - c.Println("FirstName:", _SDK.ConnInfo.FirstName) - c.Println("LastName:", _SDK.ConnInfo.LastName) - c.Println("Username", _SDK.ConnInfo.Username) - c.Println("AuthKey:", _SDK.ConnInfo.AuthKey) - }, + Name: "ConnInfo", + Func: func(c *ishell.Context) { + c.Println("UserID:", _SDK.ConnInfo.UserID) + c.Println("AuthID:", _SDK.ConnInfo.AuthID) + c.Println("Phone:", _SDK.ConnInfo.Phone) + c.Println("FirstName:", _SDK.ConnInfo.FirstName) + c.Println("LastName:", _SDK.ConnInfo.LastName) + c.Println("Username", _SDK.ConnInfo.Username) + c.Println("AuthKey:", _SDK.ConnInfo.AuthKey) + }, } var GetAuthKey = &ishell.Cmd{ - Name: "GetAuthKey", - Func: func(c *ishell.Context) { - authKey := _SDK.ConnInfo.GetAuthKey() - fmt.Println("authKey", authKey) - }, + Name: "GetAuthKey", + Func: func(c *ishell.Context) { + authKey := _SDK.ConnInfo.GetAuthKey() + fmt.Println("authKey", authKey) + }, } var SdkSetLogLevel = &ishell.Cmd{ - Name: "SetLogLevel", - Func: func(c *ishell.Context) { - choiceIndex := c.MultiChoice([]string{ - "Debug", "Info", "Warn", "Error", - }, "Level") - riversdk.SetLogLevel(choiceIndex - 1) - }, + Name: "SetLogLevel", + Func: func(c *ishell.Context) { + choiceIndex := c.MultiChoice([]string{ + "Debug", "Info", "Warn", "Error", + }, "Level") + riversdk.SetLogLevel(choiceIndex - 1) + }, } var SdkGetDifference = &ishell.Cmd{ - Name: "GetDifference", - Func: func(c *ishell.Context) { - req := msg.UpdateGetDifference{} - req.Limit = fnGetLimit(c) - req.From = fnGetFromUpdateID(c) + Name: "GetDifference", + Func: func(c *ishell.Context) { + req := msg.UpdateGetDifference{} + req.Limit = fnGetLimit(c) + req.From = fnGetFromUpdateID(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_UpdateGetDifference, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_UpdateGetDifference, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var SdkGetServerTime = &ishell.Cmd{ - Name: "GetServerTime", - Func: func(c *ishell.Context) { - req := msg.SystemGetServerTime{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_SystemGetServerTime, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "GetServerTime", + Func: func(c *ishell.Context) { + req := msg.SystemGetServerTime{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_SystemGetServerTime, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var SdkUpdateGetState = &ishell.Cmd{ - Name: "UpdateGetState", - Func: func(c *ishell.Context) { - req := msg.UpdateGetState{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_UpdateGetState, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "UpdateGetState", + Func: func(c *ishell.Context) { + req := msg.UpdateGetState{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_UpdateGetState, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var SdkAppForeground = &ishell.Cmd{ - Name: "AppForeground", - Func: func(c *ishell.Context) { - _SDK.AppForeground(true) - }, + Name: "AppForeground", + Func: func(c *ishell.Context) { + _SDK.AppForeground(true) + }, } var SdkAppBackground = &ishell.Cmd{ - Name: "AppBackground", - Func: func(c *ishell.Context) { - _SDK.AppBackground() - }, + Name: "AppBackground", + Func: func(c *ishell.Context) { + _SDK.AppBackground() + }, } var SdkPrintMonitor = &ishell.Cmd{ - Name: "Monitor", - Func: func(c *ishell.Context) { - c.Println("ForegroundTime:", mon.Stats.ForegroundTime) - c.Println((time.Duration(mon.Stats.ForegroundTime) * time.Second).String()) - }, + Name: "Monitor", + Func: func(c *ishell.Context) { + c.Println("ForegroundTime:", mon.Stats.ForegroundTime) + c.Println((time.Duration(mon.Stats.ForegroundTime) * time.Second).String()) + }, } var SdkResetUsage = &ishell.Cmd{ - Name: "ResetUsage", - Func: func(c *ishell.Context) { - mon.ResetUsage() - }, + Name: "ResetUsage", + Func: func(c *ishell.Context) { + mon.ResetUsage() + }, } var SdkSetTeam = &ishell.Cmd{ - Name: "SetTeam", - Func: func(c *ishell.Context) { - teamID := fnGetTeamID(c) - accessHash := fnGetAccessHash(c) - _SDK.SetTeam(teamID, int64(accessHash), false) - }, + Name: "SetTeam", + Func: func(c *ishell.Context) { + teamID := fnGetTeamID(c) + accessHash := fnGetAccessHash(c) + _SDK.SetTeam(teamID, int64(accessHash), false) + }, } var SdkGetTeam = &ishell.Cmd{ - Name: "GetTeam", - Func: func(c *ishell.Context) { - c.Println(domain.GetCurrTeamID(), domain.GetCurrTeamAccess()) - }, + Name: "GetTeam", + Func: func(c *ishell.Context) { + c.Println(domain.GetCurrTeamID(), domain.GetCurrTeamAccess()) + }, } var SdkDeletePending = &ishell.Cmd{ - Name: "DeletePending", - Func: func(c *ishell.Context) { - _SDK.DeletePendingMessage(fnGetMessageID(c)) + Name: "DeletePending", + Func: func(c *ishell.Context) { + _SDK.DeletePendingMessage(fnGetMessageID(c)) - }, + }, } var SdkCancelFileRequest = &ishell.Cmd{ - Name: "CancelFileRequest", - Func: func(c *ishell.Context) { - _SDK.CancelFileRequest(fnGetString(c, "FileRequestID")) - }, + Name: "CancelFileRequest", + Func: func(c *ishell.Context) { + _SDK.CancelFileRequest(fnGetString(c, "FileRequestID")) + }, } var SdkDeleteAllPendingMessages = &ishell.Cmd{ - Name: "DeleteAllPendingMessages", - Func: func(c *ishell.Context) { - _SDK.DeleteAllPendingMessages() - }, + Name: "DeleteAllPendingMessages", + Func: func(c *ishell.Context) { + _SDK.DeleteAllPendingMessages() + }, } var SdkRemoteLog = &ishell.Cmd{ - Name: "LiveLog", - Func: func(c *ishell.Context) { - logs.SetRemoteLog("https://livelog.ronaksoftware.com/cli") - }, + Name: "LiveLog", + Func: func(c *ishell.Context) { + logs.SetRemoteLog("https://livelog.ronaksoftware.com/cli") + }, } func init() { - SDK.AddCmd(SdkDeleteAllPendingMessages) - SDK.AddCmd(SdkCancelFileRequest) - SDK.AddCmd(SdkDeletePending) - SDK.AddCmd(SdkConnInfo) - SDK.AddCmd(SdkSetLogLevel) - SDK.AddCmd(SdkGetDifference) - SDK.AddCmd(SdkGetServerTime) - SDK.AddCmd(SdkUpdateGetState) - SDK.AddCmd(GetAuthKey) - SDK.AddCmd(SdkAppForeground) - SDK.AddCmd(SdkAppBackground) - SDK.AddCmd(SdkPrintMonitor) - SDK.AddCmd(SdkResetUsage) - SDK.AddCmd(SdkSetTeam) - SDK.AddCmd(SdkGetTeam) - SDK.AddCmd(SdkRemoteLog) + SDK.AddCmd(SdkDeleteAllPendingMessages) + SDK.AddCmd(SdkCancelFileRequest) + SDK.AddCmd(SdkDeletePending) + SDK.AddCmd(SdkConnInfo) + SDK.AddCmd(SdkSetLogLevel) + SDK.AddCmd(SdkGetDifference) + SDK.AddCmd(SdkGetServerTime) + SDK.AddCmd(SdkUpdateGetState) + SDK.AddCmd(GetAuthKey) + SDK.AddCmd(SdkAppForeground) + SDK.AddCmd(SdkAppBackground) + SDK.AddCmd(SdkPrintMonitor) + SDK.AddCmd(SdkResetUsage) + SDK.AddCmd(SdkSetTeam) + SDK.AddCmd(SdkGetTeam) + SDK.AddCmd(SdkRemoteLog) } diff --git a/cmd/cli-river/commands_system.go b/cmd/cli-river/commands_system.go index 7c37445d..f6a7ebda 100644 --- a/cmd/cli-river/commands_system.go +++ b/cmd/cli-river/commands_system.go @@ -1,28 +1,28 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "gopkg.in/abiosoft/ishell.v2" ) var System = &ishell.Cmd{ - Name: "System", + Name: "System", } var SystemGetConfig = &ishell.Cmd{ - Name: "GetConfig", - Func: func(c *ishell.Context) { - req := msg.SystemGetConfig{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_SystemGetConfig, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "GetConfig", + Func: func(c *ishell.Context) { + req := msg.SystemGetConfig{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_SystemGetConfig, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - System.AddCmd(SystemGetConfig) + System.AddCmd(SystemGetConfig) } diff --git a/cmd/cli-river/commands_team.go b/cmd/cli-river/commands_team.go index f31988ce..f8ce139f 100644 --- a/cmd/cli-river/commands_team.go +++ b/cmd/cli-river/commands_team.go @@ -1,148 +1,148 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/request" - riversdk "git.ronaksoft.com/river/sdk/sdk/prime" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/request" + riversdk "github.com/ronaksoft/river-sdk/sdk/prime" + "gopkg.in/abiosoft/ishell.v2" ) var Team = &ishell.Cmd{ - Name: "Team", + Name: "Team", } var TeamAddMember = &ishell.Cmd{ - Name: "AddMember", - Func: func(c *ishell.Context) { - req := msg.TeamAddMember{} - req.TeamID = fnGetTeamID(c) - req.UserID = fnGetUserID(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_TeamAddMember, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "AddMember", + Func: func(c *ishell.Context) { + req := msg.TeamAddMember{} + req.TeamID = fnGetTeamID(c) + req.UserID = fnGetUserID(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_TeamAddMember, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var TeamRemoveMember = &ishell.Cmd{ - Name: "RemoveMember", - Func: func(c *ishell.Context) { - req := msg.TeamRemoveMember{} - req.TeamID = fnGetTeamID(c) - req.UserID = fnGetUserID(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_TeamRemoveMember, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "RemoveMember", + Func: func(c *ishell.Context) { + req := msg.TeamRemoveMember{} + req.TeamID = fnGetTeamID(c) + req.UserID = fnGetUserID(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_TeamRemoveMember, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var TeamPromote = &ishell.Cmd{ - Name: "Promote", - Func: func(c *ishell.Context) { - req := msg.TeamPromote{} - req.TeamID = fnGetTeamID(c) - req.UserID = fnGetUserID(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_TeamPromote, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Promote", + Func: func(c *ishell.Context) { + req := msg.TeamPromote{} + req.TeamID = fnGetTeamID(c) + req.UserID = fnGetUserID(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_TeamPromote, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var TeamDemote = &ishell.Cmd{ - Name: "Demote", - Func: func(c *ishell.Context) { - req := msg.TeamDemote{} - req.TeamID = fnGetTeamID(c) - req.UserID = fnGetUserID(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_TeamPromote, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Demote", + Func: func(c *ishell.Context) { + req := msg.TeamDemote{} + req.TeamID = fnGetTeamID(c) + req.UserID = fnGetUserID(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_TeamPromote, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var TeamListMembers = &ishell.Cmd{ - Name: "ListMembers", - Func: func(c *ishell.Context) { - req := msg.TeamListMembers{} - req.TeamID = fnGetTeamID(c) - ah := fnGetAccessHash(c) - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommandWithTeam(req.TeamID, int64(ah), msg.C_TeamListMembers, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "ListMembers", + Func: func(c *ishell.Context) { + req := msg.TeamListMembers{} + req.TeamID = fnGetTeamID(c) + ah := fnGetAccessHash(c) + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommandWithTeam(req.TeamID, int64(ah), msg.C_TeamListMembers, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var TeamGetDialogs = &ishell.Cmd{ - Name: "GetDialogs", - Func: func(c *ishell.Context) { - req := msg.MessagesGetDialogs{} - req.Offset = fnGetOffset(c) - req.Limit = 100 - teamID := fnGetTeamID(c) - accesshHash := fnGetAccessHash(c) - _SDK.SetTeam(teamID, int64(accesshHash), false) - reqBytes, _ := req.Marshal() - reqDelegate := NewCustomDelegate() - reqDelegate.FlagsFunc = func() riversdk.RequestDelegateFlag { - return request.ServerForced - } + Name: "GetDialogs", + Func: func(c *ishell.Context) { + req := msg.MessagesGetDialogs{} + req.Offset = fnGetOffset(c) + req.Limit = 100 + teamID := fnGetTeamID(c) + accesshHash := fnGetAccessHash(c) + _SDK.SetTeam(teamID, int64(accesshHash), false) + reqBytes, _ := req.Marshal() + reqDelegate := NewCustomDelegate() + reqDelegate.FlagsFunc = func() riversdk.RequestDelegateFlag { + return request.ServerForced + } - if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetDialogs, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + if reqID, err := _SDK.ExecuteCommand(msg.C_MessagesGetDialogs, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } var TeamEdit = &ishell.Cmd{ - Name: "Edit", - Func: func(c *ishell.Context) { - req := msg.TeamEdit{} - req.TeamID = fnGetTeamID(c) - req.Name = fnGetString(c, "Name") - teamID := req.TeamID - accesshHash := fnGetAccessHash(c) - _SDK.SetTeam(teamID, int64(accesshHash), false) - reqBytes, _ := req.Marshal() - reqDelegate := NewCustomDelegate() - reqDelegate.FlagsFunc = func() riversdk.RequestDelegateFlag { - return request.ServerForced - } + Name: "Edit", + Func: func(c *ishell.Context) { + req := msg.TeamEdit{} + req.TeamID = fnGetTeamID(c) + req.Name = fnGetString(c, "Name") + teamID := req.TeamID + accesshHash := fnGetAccessHash(c) + _SDK.SetTeam(teamID, int64(accesshHash), false) + reqBytes, _ := req.Marshal() + reqDelegate := NewCustomDelegate() + reqDelegate.FlagsFunc = func() riversdk.RequestDelegateFlag { + return request.ServerForced + } - if reqID, err := _SDK.ExecuteCommand(msg.C_TeamEdit, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + if reqID, err := _SDK.ExecuteCommand(msg.C_TeamEdit, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - Team.AddCmd(TeamAddMember) - Team.AddCmd(TeamRemoveMember) - Team.AddCmd(TeamListMembers) - Team.AddCmd(TeamPromote) - Team.AddCmd(TeamDemote) - Team.AddCmd(TeamGetDialogs) - Team.AddCmd(TeamEdit) + Team.AddCmd(TeamAddMember) + Team.AddCmd(TeamRemoveMember) + Team.AddCmd(TeamListMembers) + Team.AddCmd(TeamPromote) + Team.AddCmd(TeamDemote) + Team.AddCmd(TeamGetDialogs) + Team.AddCmd(TeamEdit) } diff --git a/cmd/cli-river/commands_user.go b/cmd/cli-river/commands_user.go index 17932e9a..161e70b3 100644 --- a/cmd/cli-river/commands_user.go +++ b/cmd/cli-river/commands_user.go @@ -1,76 +1,76 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "gopkg.in/abiosoft/ishell.v2" ) var User = &ishell.Cmd{ - Name: "User", + Name: "User", } var UserGet = &ishell.Cmd{ - Name: "Get", - Func: func(c *ishell.Context) { - // for just one user - req := msg.UsersGet{} - req.Users = []*msg.InputUser{fnGetUser(c)} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_UsersGet, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + Name: "Get", + Func: func(c *ishell.Context) { + // for just one user + req := msg.UsersGet{} + req.Users = []*msg.InputUser{fnGetUser(c)} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_UsersGet, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var UserGetFull = &ishell.Cmd{ - Name: "GetFull", - Func: func(c *ishell.Context) { - // for just one user - req := msg.UsersGetFull{} - req.Users = []*msg.InputUser{fnGetUser(c)} + Name: "GetFull", + Func: func(c *ishell.Context) { + // for just one user + req := msg.UsersGetFull{} + req.Users = []*msg.InputUser{fnGetUser(c)} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_UsersGetFull, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_UsersGetFull, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } - }, + }, } var SetLangCode = &ishell.Cmd{ - Name: "SetLangCode", - Func: func(c *ishell.Context) { - // for just one user - req := msg.AccountSetLang{} + Name: "SetLangCode", + Func: func(c *ishell.Context) { + // for just one user + req := msg.AccountSetLang{} - code := fnGetLangCode(c) + code := fnGetLangCode(c) - if code != "en" && code != "fa" { - c.Println("Invalid lang code. Using en as default:", code) - code = "en" - } - c.Println("LangCode:", code) - req.LangCode = code + if code != "en" && code != "fa" { + c.Println("Invalid lang code. Using en as default:", code) + code = "en" + } + c.Println("LangCode:", code) + req.LangCode = code - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_AccountSetLang, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_AccountSetLang, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - User.AddCmd(UserGet) - User.AddCmd(UserGetFull) - User.AddCmd(SetLangCode) + User.AddCmd(UserGet) + User.AddCmd(UserGetFull) + User.AddCmd(SetLangCode) } diff --git a/cmd/cli-river/commands_wallpaper.go b/cmd/cli-river/commands_wallpaper.go index c1be0d30..ff7ba4a2 100644 --- a/cmd/cli-river/commands_wallpaper.go +++ b/cmd/cli-river/commands_wallpaper.go @@ -1,28 +1,28 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "gopkg.in/abiosoft/ishell.v2" + "github.com/ronaksoft/river-msg/go/msg" + "gopkg.in/abiosoft/ishell.v2" ) var WallPaper = &ishell.Cmd{ - Name: "WallPaper", + Name: "WallPaper", } var WallPaperGet = &ishell.Cmd{ - Name: "Get", - Func: func(c *ishell.Context) { - req := msg.WallPaperGet{} - reqBytes, _ := req.Marshal() - reqDelegate := new(RequestDelegate) - if reqID, err := _SDK.ExecuteCommand(msg.C_WallPaperGet, reqBytes, reqDelegate); err != nil { - c.Println("Command Failed:", err) - } else { - reqDelegate.RequestID = reqID - } - }, + Name: "Get", + Func: func(c *ishell.Context) { + req := msg.WallPaperGet{} + reqBytes, _ := req.Marshal() + reqDelegate := new(RequestDelegate) + if reqID, err := _SDK.ExecuteCommand(msg.C_WallPaperGet, reqBytes, reqDelegate); err != nil { + c.Println("Command Failed:", err) + } else { + reqDelegate.RequestID = reqID + } + }, } func init() { - WallPaper.AddCmd(WallPaperGet) + WallPaper.AddCmd(WallPaperGet) } diff --git a/cmd/cli-river/delegates.go b/cmd/cli-river/delegates.go index c084df89..d2d8f7cc 100644 --- a/cmd/cli-river/delegates.go +++ b/cmd/cli-river/delegates.go @@ -1,118 +1,119 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - riversdk "git.ronaksoft.com/river/sdk/sdk/prime" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/registry" - "go.uber.org/zap" - "io/ioutil" - "os" + "io/ioutil" + "os" + + "github.com/ronaksoft/river-msg/go/msg" + riversdk "github.com/ronaksoft/river-sdk/sdk/prime" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/registry" + "go.uber.org/zap" ) type ConnInfoDelegates struct { - dbPath string - filePath string + dbPath string + filePath string } func (c *ConnInfoDelegates) Get(key string) string { - panic("implement me") + panic("implement me") } func (c *ConnInfoDelegates) Set(key, value string) { - panic("implement me") + panic("implement me") } func (c *ConnInfoDelegates) SaveConnInfo(connInfo []byte) { - _ = os.MkdirAll(c.dbPath, os.ModePerm) - err := ioutil.WriteFile(c.filePath, connInfo, 0666) - if err != nil { - _Shell.Println(err) - } + _ = os.MkdirAll(c.dbPath, os.ModePerm) + err := ioutil.WriteFile(c.filePath, connInfo, 0666) + if err != nil { + _Shell.Println(err) + } } type MainDelegate struct{} func (d *MainDelegate) OnSearchComplete(b []byte) { - result := new(msg.ClientSearchResult) - err := result.Unmarshal(b) - if err != nil { - _Shell.Println("Error On OnSearchComplete:", err.Error()) - return - } - _Shell.Println("OnSearchComplete::Messages", result.Messages) - _Shell.Println("OnSearchComplete::Groups", result.Groups) - _Shell.Println("OnSearchComplete::MatchedGroups", result.MatchedGroups) - _Shell.Println("OnSearchComplete::MatchedUsers", result.MatchedUsers) + result := new(msg.ClientSearchResult) + err := result.Unmarshal(b) + if err != nil { + _Shell.Println("Error On OnSearchComplete:", err.Error()) + return + } + _Shell.Println("OnSearchComplete::Messages", result.Messages) + _Shell.Println("OnSearchComplete::Groups", result.Groups) + _Shell.Println("OnSearchComplete::MatchedGroups", result.MatchedGroups) + _Shell.Println("OnSearchComplete::MatchedUsers", result.MatchedUsers) } func (d *MainDelegate) OnUpdates(constructor int64, b []byte) { - switch constructor { - case msg.C_UpdateContainer: - updateContainer := new(msg.UpdateContainer) - err := updateContainer.Unmarshal(b) - if err != nil { - _Shell.Println("Failed To Unmarshal UpdateContainer:", err) - return - } - // _Shell.Println("Processing UpdateContainer:", updateContainer.MinUpdateID, updateContainer.MaxUpdateID) - for _, update := range updateContainer.Updates { - // _Shell.Println("Processing Update", update.GetUpdateID, registry.ConstructorName(update.Constructor)) - UpdatePrinter(update) - } - case msg.C_ClientUpdatePendingMessageDelivery: - // wrapping it to update envelop to pass UpdatePrinter - udp := new(msg.UpdateEnvelope) - udp.Constructor = constructor - udp.Update = b - // _Shell.Println("Processing ClientUpdatePendingMessageDelivery") - UpdatePrinter(udp) - case msg.C_UpdateEnvelope: - update := new(msg.UpdateEnvelope) - err := update.Unmarshal(b) - if err != nil { - _Shell.Println("Error On Unmarshal UpdateEnvelope:", err) - return - } else { - // _Shell.Println("Processing UpdateEnvelop", update.GetUpdateID, registry.ConstructorName(update.Constructor)) - UpdatePrinter(update) - } - } + switch constructor { + case msg.C_UpdateContainer: + updateContainer := new(msg.UpdateContainer) + err := updateContainer.Unmarshal(b) + if err != nil { + _Shell.Println("Failed To Unmarshal UpdateContainer:", err) + return + } + // _Shell.Println("Processing UpdateContainer:", updateContainer.MinUpdateID, updateContainer.MaxUpdateID) + for _, update := range updateContainer.Updates { + // _Shell.Println("Processing Update", update.GetUpdateID, registry.ConstructorName(update.Constructor)) + UpdatePrinter(update) + } + case msg.C_ClientUpdatePendingMessageDelivery: + // wrapping it to update envelop to pass UpdatePrinter + udp := new(msg.UpdateEnvelope) + udp.Constructor = constructor + udp.Update = b + // _Shell.Println("Processing ClientUpdatePendingMessageDelivery") + UpdatePrinter(udp) + case msg.C_UpdateEnvelope: + update := new(msg.UpdateEnvelope) + err := update.Unmarshal(b) + if err != nil { + _Shell.Println("Error On Unmarshal UpdateEnvelope:", err) + return + } else { + // _Shell.Println("Processing UpdateEnvelop", update.GetUpdateID, registry.ConstructorName(update.Constructor)) + UpdatePrinter(update) + } + } } func (d *MainDelegate) OnDeferredRequests(requestID int64, b []byte) { - envelope := new(rony.MessageEnvelope) - envelope.Unmarshal(b) - _Shell.Println("Deferred Request received", - zap.Uint64("ReqID", envelope.RequestID), - zap.String("C", registry.ConstructorName(envelope.Constructor)), - ) - // MessagePrinter(envelope) + envelope := new(rony.MessageEnvelope) + envelope.Unmarshal(b) + _Shell.Println("Deferred Request received", + zap.Uint64("ReqID", envelope.RequestID), + zap.String("C", registry.ConstructorName(envelope.Constructor)), + ) + // MessagePrinter(envelope) } func (d *MainDelegate) OnNetworkStatusChanged(quality int) { - // state := domain.NetworkStatus(quality) - // _Shell.Println("Network status changed:", state.ToString()) + // state := domain.NetworkStatus(quality) + // _Shell.Println("Network status changed:", state.ToString()) } func (d *MainDelegate) OnSyncStatusChanged(newStatus int) { - // state := domain.SyncStatus(newStatus) - // _Shell.Println("Sync status changed:", state.ToString()) + // state := domain.SyncStatus(newStatus) + // _Shell.Println("Sync status changed:", state.ToString()) } func (d *MainDelegate) OnAuthKeyCreated(authID int64) { - _Shell.Println("Auth Key Created", zap.Int64("AuthID", authID)) + _Shell.Println("Auth Key Created", zap.Int64("AuthID", authID)) } func (d *MainDelegate) OnGeneralError(b []byte) { - e := new(rony.Error) - e.Unmarshal(b) - _Shell.Println("Received general error", zap.String("Code", e.Code), zap.String("Items", e.Items)) + e := new(rony.Error) + e.Unmarshal(b) + _Shell.Println("Received general error", zap.String("Code", e.Code), zap.String("Items", e.Items)) } func (d *MainDelegate) OnSessionClosed(res int) { - _Shell.Println("Session Closed:", res) + _Shell.Println("Session Closed:", res) } func (d *MainDelegate) ShowLoggerAlert() {} @@ -126,163 +127,163 @@ func (d *MainDelegate) DataSynced(dialogs, contacts, gifs bool) {} type PrintDelegate struct{} func (d *PrintDelegate) Log(logLevel int, msg string) { - switch logLevel { - case int(zap.DebugLevel): - _Shell.Println("DBG : \t", msg) - case int(zap.WarnLevel): - _Shell.Println(yellow("WRN : \t %s", msg)) - case int(zap.InfoLevel): - _Shell.Println(green("INF : \t %s", msg)) - case int(zap.ErrorLevel): - _Shell.Println(red("ERR : \t %s", msg)) - case int(zap.FatalLevel): - _Shell.Println(red("FTL : \t %s", msg)) - default: - _Shell.Println(blue("MSG : \t %s", msg)) - } + switch logLevel { + case int(zap.DebugLevel): + _Shell.Println("DBG : \t", msg) + case int(zap.WarnLevel): + _Shell.Println(yellow("WRN : \t %s", msg)) + case int(zap.InfoLevel): + _Shell.Println(green("INF : \t %s", msg)) + case int(zap.ErrorLevel): + _Shell.Println(red("ERR : \t %s", msg)) + case int(zap.FatalLevel): + _Shell.Println(red("FTL : \t %s", msg)) + default: + _Shell.Println(blue("MSG : \t %s", msg)) + } } type FileDelegate struct{} func (d *FileDelegate) OnProgressChanged(reqID string, clusterID int32, fileID, accessHash int64, percent int64, peerID int64) { - // _Shell.Println("File Progress Changed", reqID, fileID, percent) + // _Shell.Println("File Progress Changed", reqID, fileID, percent) } func (d *FileDelegate) OnCompleted(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) { - // _Shell.Println("File Progress Completed", reqID, filePath) + // _Shell.Println("File Progress Completed", reqID, filePath) } func (d *FileDelegate) OnCancel(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) { - // _Shell.Println("File Progress Canceled", reqID, hasError) + // _Shell.Println("File Progress Canceled", reqID, hasError) } type CallDelegate struct{} func (c *CallDelegate) OnUpdate(action int32, b []byte) { - _Log.Info("CallDelegate On UpdateReceived", zap.String("C", msg.CallUpdate(action).String())) - a := msg.CallUpdate(action) - switch a { - case msg.CallUpdate_CallRequested: - x := msg.CallUpdateCallRequested{} - err := x.Unmarshal(b) - if err == nil { - _Log.Info("CallUpdateCallRequested", zap.Int64("CallID", x.CallID), zap.Any("Peer", x.Peer)) - } - } + _Log.Info("CallDelegate On UpdateReceived", zap.String("C", msg.CallUpdate(action).String())) + a := msg.CallUpdate(action) + switch a { + case msg.CallUpdate_CallRequested: + x := msg.CallUpdateCallRequested{} + err := x.Unmarshal(b) + if err == nil { + _Log.Info("CallUpdateCallRequested", zap.Int64("CallID", x.CallID), zap.Any("Peer", x.Peer)) + } + } } func (c *CallDelegate) InitStream(audio, video bool) bool { - _Log.Info("CallDelegate On InitStream", zap.Bool("Audio", audio), zap.Bool("Video", video)) - return true + _Log.Info("CallDelegate On InitStream", zap.Bool("Audio", audio), zap.Bool("Video", video)) + return true } func (c *CallDelegate) InitConnection(connId int32, b []byte) int64 { - _Log.Info("CallDelegate On InitConnection", zap.Int32("ConnID", connId)) - return 1 + _Log.Info("CallDelegate On InitConnection", zap.Int32("ConnID", connId)) + return 1 } func (c *CallDelegate) CloseConnection(connId int32) bool { - _Log.Info("CallDelegate On CloseConnection", zap.Int32("ConnID", connId)) - return true + _Log.Info("CallDelegate On CloseConnection", zap.Int32("ConnID", connId)) + return true } func (c *CallDelegate) GetOfferSDP(connId int32) []byte { - _Log.Info("CallDelegate On GetOfferSDP", zap.Int32("ConnID", connId)) - offerSdp := &msg.PhoneActionSDPOffer{ - SDP: "", - Type: "", - } - d, err := offerSdp.Marshal() - if err != nil { - return nil - } - - me := &rony.MessageEnvelope{ - Constructor: msg.C_PhoneActionSDPOffer, - Message: d, - } - d, err = me.Marshal() - if err != nil { - return nil - } - - return d + _Log.Info("CallDelegate On GetOfferSDP", zap.Int32("ConnID", connId)) + offerSdp := &msg.PhoneActionSDPOffer{ + SDP: "", + Type: "", + } + d, err := offerSdp.Marshal() + if err != nil { + return nil + } + + me := &rony.MessageEnvelope{ + Constructor: msg.C_PhoneActionSDPOffer, + Message: d, + } + d, err = me.Marshal() + if err != nil { + return nil + } + + return d } func (c *CallDelegate) SetOfferGetAnswerSDP(connId int32, req []byte) []byte { - _Log.Info("CallDelegate On SetOfferGetAnswerSDP", zap.Int32("ConnID", connId)) - return nil + _Log.Info("CallDelegate On SetOfferGetAnswerSDP", zap.Int32("ConnID", connId)) + return nil } func (c *CallDelegate) SetAnswerSDP(connId int32, b []byte) bool { - _Log.Info("CallDelegate On SetAnswerSDP", zap.Int32("ConnID", connId)) - return true + _Log.Info("CallDelegate On SetAnswerSDP", zap.Int32("ConnID", connId)) + return true } func (c *CallDelegate) AddIceCandidate(connId int32, b []byte) bool { - _Log.Info("CallDelegate On AddIceCandidate", zap.Int32("ConnID", connId)) - return true + _Log.Info("CallDelegate On AddIceCandidate", zap.Int32("ConnID", connId)) + return true } type RequestDelegate struct { - RequestID int64 - Envelope rony.MessageEnvelope - FlagsVal riversdk.RequestDelegateFlag + RequestID int64 + Envelope rony.MessageEnvelope + FlagsVal riversdk.RequestDelegateFlag } func (d *RequestDelegate) OnComplete(b []byte) { - err := d.Envelope.Unmarshal(b) - if err != nil { - _Shell.Println("Error On OnComplete:", err) - return - } - _Shell.Println("Request Completed:", d.RequestID, registry.ConstructorName(d.Envelope.Constructor)) - MessagePrinter(&d.Envelope) + err := d.Envelope.Unmarshal(b) + if err != nil { + _Shell.Println("Error On OnComplete:", err) + return + } + _Shell.Println("Request Completed:", d.RequestID, registry.ConstructorName(d.Envelope.Constructor)) + MessagePrinter(&d.Envelope) } func (d *RequestDelegate) OnTimeout(err error) { - _Shell.Println("Request TimedOut:", d.RequestID, err) + _Shell.Println("Request TimedOut:", d.RequestID, err) } func (d *RequestDelegate) OnProgress(percent int64) { - _Shell.Println("Progress:", d.RequestID, percent) + _Shell.Println("Progress:", d.RequestID, percent) } func (d *RequestDelegate) Flags() riversdk.RequestDelegateFlag { - return d.FlagsVal + return d.FlagsVal } type CustomRequestDelegate struct { - RequestID int64 - OnCompleteFunc func(b []byte) - OnTimeoutFunc func(err error) - OnProgressFunc func(int64) - FlagsFunc func() riversdk.RequestDelegateFlag + RequestID int64 + OnCompleteFunc func(b []byte) + OnTimeoutFunc func(err error) + OnProgressFunc func(int64) + FlagsFunc func() riversdk.RequestDelegateFlag } func (c CustomRequestDelegate) OnComplete(b []byte) { - c.OnCompleteFunc(b) + c.OnCompleteFunc(b) } func (c CustomRequestDelegate) OnTimeout(err error) { - c.OnTimeoutFunc(err) + c.OnTimeoutFunc(err) } func (c *CustomRequestDelegate) OnProgress(percent int64) { - c.OnProgressFunc(percent) + c.OnProgressFunc(percent) } func (c CustomRequestDelegate) Flags() riversdk.RequestDelegateFlag { - return c.FlagsFunc() + return c.FlagsFunc() } func NewCustomDelegate() *CustomRequestDelegate { - c := &CustomRequestDelegate{} - d := &RequestDelegate{} - c.OnCompleteFunc = d.OnComplete - c.OnTimeoutFunc = d.OnTimeout - c.OnProgressFunc = d.OnProgress - c.FlagsFunc = d.Flags - return c + c := &CustomRequestDelegate{} + d := &RequestDelegate{} + c.OnCompleteFunc = d.OnComplete + c.OnTimeoutFunc = d.OnTimeout + c.OnProgressFunc = d.OnProgress + c.FlagsFunc = d.Flags + return c } diff --git a/cmd/cli-river/main.go b/cmd/cli-river/main.go index 2775b709..8923c719 100644 --- a/cmd/cli-river/main.go +++ b/cmd/cli-river/main.go @@ -1,188 +1,189 @@ package main import ( - "encoding/json" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/sdk/mini" - riversdk "git.ronaksoft.com/river/sdk/sdk/prime" - "github.com/fatih/color" - "go.uber.org/zap/zapcore" - "gopkg.in/abiosoft/ishell.v2" - "io/ioutil" - "os" - "path/filepath" - "strings" + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path/filepath" + "strings" + + "github.com/fatih/color" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/sdk/mini" + riversdk "github.com/ronaksoft/river-sdk/sdk/prime" + "go.uber.org/zap/zapcore" + "gopkg.in/abiosoft/ishell.v2" ) var ( - _Shell *ishell.Shell - _SDK *riversdk.River - _MiniSDK *mini.River - _DbID string - _DbPath string - _Log *logs.Logger - green, red, yellow, blue func(format string, a ...interface{}) string + _Shell *ishell.Shell + _SDK *riversdk.River + _MiniSDK *mini.River + _DbID string + _DbPath string + _Log *logs.Logger + green, red, yellow, blue func(format string, a ...interface{}) string ) func main() { - green = color.New(color.FgHiGreen).SprintfFunc() - red = color.New(color.FgHiRed).SprintfFunc() - yellow = color.New(color.FgHiYellow).SprintfFunc() - blue = color.New(color.FgHiBlue).SprintfFunc() - - _Log = logs.With("RiverCLI") - // Initialize Shell - _Shell = ishell.New() - - _Shell.Println("============================") - _Shell.Println("## River CLI Console ##") - _Shell.Println("============================") - _Shell.Print("River Host (default: river.im):") - _Shell.Print("DB Path (./_db): ") - - _DbPath = _Shell.ReadLine() - _Shell.Print("DB ID: ") - _DbID = _Shell.ReadLine() - if _DbPath == "" { - _DbPath = "./_db" - } - - connInfo := new(riversdk.RiverConnection) - connInfoPath := filepath.Join(_DbPath, fmt.Sprintf("connInfo.%s", _DbID)) - file, err := os.Open(connInfoPath) - if err == nil { - b, _ := ioutil.ReadAll(file) - err := json.Unmarshal(b, connInfo) - if err != nil { - _Shell.Print(err.Error()) - } - } - - connInfo.Delegate = &ConnInfoDelegates{ - dbPath: _DbPath, - filePath: connInfoPath, - } - - var serverHostPorts string - sdkMode := "prime" - - switch len(os.Args) { - case 2: - switch strings.ToLower(os.Args[1]) { - case "production": - serverHostPorts = "edge.river.im, edge.rivermsg.com" - case "staging": - serverHostPorts = "river.ronaksoftware.com" - case "local": - serverHostPorts = "localhost" - case "local2": - serverHostPorts = "localhost:81" - default: - serverHostPorts = os.Args[1] - } - case 3: - switch strings.ToLower(os.Args[1]) { - case "mini": - sdkMode = "mini" - default: - } - switch strings.ToLower(os.Args[2]) { - case "production": - serverHostPorts = "edge.river.im,edge.rivermsg.com" - case "staging": - serverHostPorts = "river.ronaksoftware.com" - case "local": - serverHostPorts = "localhost" - case "local2": - serverHostPorts = "localhost:81" - default: - serverHostPorts = os.Args[1] - } - } - - switch sdkMode { - case "mini": - _MiniSDK = &mini.River{} - _MiniSDK.SetConfig(&mini.RiverConfig{ - SeedHostPorts: serverHostPorts, - DbPath: _DbPath, - DbID: _DbID, - MainDelegate: new(MainDelegate), - LogLevel: int(zapcore.DebugLevel), - DocumentAudioDirectory: "./_files/audio", - DocumentVideoDirectory: "./_files/video", - DocumentPhotoDirectory: "./_files/photo", - DocumentFileDirectory: "./_files/file", - DocumentCacheDirectory: "./_files/cache", - LogDirectory: "./_files/logs", - ConnInfo: &mini.RiverConnection{ - AuthID: connInfo.AuthID, - AuthKey: connInfo.AuthKey[:], - UserID: connInfo.UserID, - }, - }) - - err = _MiniSDK.AppStart() - if err != nil { - panic(err) - } - - loadCommands( - Mini, - ) - - default: - _SDK = &riversdk.River{} - _SDK.SetConfig(&riversdk.RiverConfig{ - SeedHostPorts: serverHostPorts, - DbPath: _DbPath, - DbID: _DbID, - MainDelegate: new(MainDelegate), - FileDelegate: new(FileDelegate), - CallDelegate: new(CallDelegate), - LogLevel: int(zapcore.InfoLevel), - DocumentAudioDirectory: "./_files/audio", - DocumentVideoDirectory: "./_files/video", - DocumentPhotoDirectory: "./_files/photo", - DocumentFileDirectory: "./_files/file", - DocumentCacheDirectory: "./_files/cache", - LogDirectory: "./_files/logs", - ConnInfo: connInfo, - }) - err = _SDK.AppStart() - if err != nil { - panic(err) - } - _SDK.StartNetwork("") - if _SDK.ConnInfo.AuthID == 0 { - if err := _SDK.CreateAuthKey(); err != nil { - _Shell.Println("CreateAuthKey::", err.Error()) - } - } - - if _SDK.ConnInfo.UserID != 0 { - req := &msg.MessagesGetDialogs{ - Offset: 0, - Limit: 500, - } - reqBytes, _ := req.Marshal() - delegate := new(RequestDelegate) - _, _ = _SDK.ExecuteCommand(msg.C_MessagesGetDialogs, reqBytes, delegate) - } - loadCommands( - Account, Auth, Bot, Contact, Debug, File, Gif, Group, Init, Label, Message, SDK, System, Team, User, WallPaper, Call, - ) - - } - - _Shell.Run() + green = color.New(color.FgHiGreen).SprintfFunc() + red = color.New(color.FgHiRed).SprintfFunc() + yellow = color.New(color.FgHiYellow).SprintfFunc() + blue = color.New(color.FgHiBlue).SprintfFunc() + + _Log = logs.With("RiverCLI") + // Initialize Shell + _Shell = ishell.New() + + _Shell.Println("============================") + _Shell.Println("## River CLI Console ##") + _Shell.Println("============================") + _Shell.Print("River Host (default: river.im):") + _Shell.Print("DB Path (./_db): ") + + _DbPath = _Shell.ReadLine() + _Shell.Print("DB ID: ") + _DbID = _Shell.ReadLine() + if _DbPath == "" { + _DbPath = "./_db" + } + + connInfo := new(riversdk.RiverConnection) + connInfoPath := filepath.Join(_DbPath, fmt.Sprintf("connInfo.%s", _DbID)) + file, err := os.Open(connInfoPath) + if err == nil { + b, _ := ioutil.ReadAll(file) + err := json.Unmarshal(b, connInfo) + if err != nil { + _Shell.Print(err.Error()) + } + } + + connInfo.Delegate = &ConnInfoDelegates{ + dbPath: _DbPath, + filePath: connInfoPath, + } + + var serverHostPorts string + sdkMode := "prime" + + switch len(os.Args) { + case 2: + switch strings.ToLower(os.Args[1]) { + case "production": + serverHostPorts = "edge.river.im, edge.rivermsg.com" + case "staging": + serverHostPorts = "river.ronaksoftware.com" + case "local": + serverHostPorts = "localhost" + case "local2": + serverHostPorts = "localhost:81" + default: + serverHostPorts = os.Args[1] + } + case 3: + switch strings.ToLower(os.Args[1]) { + case "mini": + sdkMode = "mini" + default: + } + switch strings.ToLower(os.Args[2]) { + case "production": + serverHostPorts = "edge.river.im,edge.rivermsg.com" + case "staging": + serverHostPorts = "river.ronaksoftware.com" + case "local": + serverHostPorts = "localhost" + case "local2": + serverHostPorts = "localhost:81" + default: + serverHostPorts = os.Args[1] + } + } + + switch sdkMode { + case "mini": + _MiniSDK = &mini.River{} + _MiniSDK.SetConfig(&mini.RiverConfig{ + SeedHostPorts: serverHostPorts, + DbPath: _DbPath, + DbID: _DbID, + MainDelegate: new(MainDelegate), + LogLevel: int(zapcore.DebugLevel), + DocumentAudioDirectory: "./_files/audio", + DocumentVideoDirectory: "./_files/video", + DocumentPhotoDirectory: "./_files/photo", + DocumentFileDirectory: "./_files/file", + DocumentCacheDirectory: "./_files/cache", + LogDirectory: "./_files/logs", + ConnInfo: &mini.RiverConnection{ + AuthID: connInfo.AuthID, + AuthKey: connInfo.AuthKey[:], + UserID: connInfo.UserID, + }, + }) + + err = _MiniSDK.AppStart() + if err != nil { + panic(err) + } + + loadCommands( + Mini, + ) + + default: + _SDK = &riversdk.River{} + _SDK.SetConfig(&riversdk.RiverConfig{ + SeedHostPorts: serverHostPorts, + DbPath: _DbPath, + DbID: _DbID, + MainDelegate: new(MainDelegate), + FileDelegate: new(FileDelegate), + CallDelegate: new(CallDelegate), + LogLevel: int(zapcore.InfoLevel), + DocumentAudioDirectory: "./_files/audio", + DocumentVideoDirectory: "./_files/video", + DocumentPhotoDirectory: "./_files/photo", + DocumentFileDirectory: "./_files/file", + DocumentCacheDirectory: "./_files/cache", + LogDirectory: "./_files/logs", + ConnInfo: connInfo, + }) + err = _SDK.AppStart() + if err != nil { + panic(err) + } + _SDK.StartNetwork("") + if _SDK.ConnInfo.AuthID == 0 { + if err := _SDK.CreateAuthKey(); err != nil { + _Shell.Println("CreateAuthKey::", err.Error()) + } + } + + if _SDK.ConnInfo.UserID != 0 { + req := &msg.MessagesGetDialogs{ + Offset: 0, + Limit: 500, + } + reqBytes, _ := req.Marshal() + delegate := new(RequestDelegate) + _, _ = _SDK.ExecuteCommand(msg.C_MessagesGetDialogs, reqBytes, delegate) + } + loadCommands( + Account, Auth, Bot, Contact, Debug, File, Gif, Group, Init, Label, Message, SDK, System, Team, User, WallPaper, Call, + ) + + } + + _Shell.Run() } func loadCommands(cmds ...*ishell.Cmd) { - for _, cmd := range cmds { - _Shell.AddCmd(cmd) - } + for _, cmd := range cmds { + _Shell.AddCmd(cmd) + } } diff --git a/cmd/cli-river/printer_message.go b/cmd/cli-river/printer_message.go index 35b24d8d..6ab781d5 100644 --- a/cmd/cli-river/printer_message.go +++ b/cmd/cli-river/printer_message.go @@ -1,546 +1,547 @@ package main import ( - "bytes" - "encoding/hex" - "fmt" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/registry" - "go.uber.org/zap" - "google.golang.org/protobuf/proto" - "io/ioutil" - "os" - "strings" - "time" + "bytes" + "encoding/hex" + "fmt" + "io/ioutil" + "os" + "strings" + "time" - "git.ronaksoft.com/river/msg/go/msg" - "github.com/olekukonko/tablewriter" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/registry" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" + + "github.com/olekukonko/tablewriter" + "github.com/ronaksoft/river-msg/go/msg" ) var ( - MyDialogs []*msg.Dialog - MyUsers = map[int64]*msg.User{} - MyGroups = map[int64]*msg.Group{} - Printers = map[int64]domain.MessageApplier{} + MyDialogs []*msg.Dialog + MyUsers = map[int64]*msg.User{} + MyGroups = map[int64]*msg.Group{} + Printers = map[int64]domain.MessageApplier{} ) func init() { - Printers = map[int64]domain.MessageApplier{ - msg.C_AccountPassword: printAccountPassword, - msg.C_AuthAuthorization: printAuthAuthorization, - msg.C_AuthCheckedPhone: printAuthCheckedPhone, - msg.C_AuthRecalled: printAuthRecalled, - msg.C_AuthSentCode: printAuthSentCode, - msg.C_ClientPendingMessage: printClientPendingMessage, - msg.C_ClientSearchResult: printClientSearchResult, - msg.C_ContactsImported: printContactsImported, - msg.C_ContactsMany: printContactsMany, - msg.C_Dialog: printDialog, - msg.C_GroupFull: printGroupFull, - msg.C_LabelItems: printLabelItems, - msg.C_LabelsMany: printLabelsMany, - msg.C_MessagesDialogs: printMessagesDialogs, - msg.C_MessagesMany: printMessagesMany, - msg.C_MessagesSent: printMessagesSent, - msg.C_SystemConfig: printSystemConfig, - msg.C_TeamsMany: printTeamsMany, - msg.C_UpdateDifference: printUpdateDifference, - msg.C_UsersMany: printUsersMany, - rony.C_Error: printError, - } + Printers = map[int64]domain.MessageApplier{ + msg.C_AccountPassword: printAccountPassword, + msg.C_AuthAuthorization: printAuthAuthorization, + msg.C_AuthCheckedPhone: printAuthCheckedPhone, + msg.C_AuthRecalled: printAuthRecalled, + msg.C_AuthSentCode: printAuthSentCode, + msg.C_ClientPendingMessage: printClientPendingMessage, + msg.C_ClientSearchResult: printClientSearchResult, + msg.C_ContactsImported: printContactsImported, + msg.C_ContactsMany: printContactsMany, + msg.C_Dialog: printDialog, + msg.C_GroupFull: printGroupFull, + msg.C_LabelItems: printLabelItems, + msg.C_LabelsMany: printLabelsMany, + msg.C_MessagesDialogs: printMessagesDialogs, + msg.C_MessagesMany: printMessagesMany, + msg.C_MessagesSent: printMessagesSent, + msg.C_SystemConfig: printSystemConfig, + msg.C_TeamsMany: printTeamsMany, + msg.C_UpdateDifference: printUpdateDifference, + msg.C_UsersMany: printUsersMany, + rony.C_Error: printError, + } } func MessagePrinter(envelope *rony.MessageEnvelope) { - p := Printers[envelope.Constructor] - if p != nil { - p(envelope) - return - } + p := Printers[envelope.Constructor] + if p != nil { + p(envelope) + return + } - switch envelope.Constructor { - case msg.C_Bool: - x := new(msg.Bool) - x.Unmarshal(envelope.Message) - _Shell.Println(fmt.Sprintf("Bool \t Res:%t", x.Result)) - case msg.C_UpdateNewMessage: - x := new(msg.UpdateNewMessage) - x.Unmarshal(envelope.Message) + switch envelope.Constructor { + case msg.C_Bool: + x := new(msg.Bool) + x.Unmarshal(envelope.Message) + _Shell.Println(fmt.Sprintf("Bool \t Res:%t", x.Result)) + case msg.C_UpdateNewMessage: + x := new(msg.UpdateNewMessage) + x.Unmarshal(envelope.Message) - bufMsg := new(bytes.Buffer) - tableMsg := tablewriter.NewWriter(bufMsg) - tableMsg.SetHeader([]string{ - "GetUpdateID", "AccessHash", "Sender", "Message.ID", "Message.Body", - }) + bufMsg := new(bytes.Buffer) + tableMsg := tablewriter.NewWriter(bufMsg) + tableMsg.SetHeader([]string{ + "GetUpdateID", "AccessHash", "Sender", "Message.ID", "Message.Body", + }) - tableMsg.Append([]string{ - fmt.Sprintf("%d", x.UpdateID), - fmt.Sprintf("%d", x.AccessHash), - fmt.Sprintf("%s %s", x.Sender.FirstName, x.Sender.LastName), - fmt.Sprintf("%d", x.Message.ID), - x.Message.Body, - }) + tableMsg.Append([]string{ + fmt.Sprintf("%d", x.UpdateID), + fmt.Sprintf("%d", x.AccessHash), + fmt.Sprintf("%s %s", x.Sender.FirstName, x.Sender.LastName), + fmt.Sprintf("%d", x.Message.ID), + x.Message.Body, + }) - tableMsg.Render() - _Shell.Println("\r\n" + bufMsg.String()) - case msg.C_InputUser: - x := new(msg.InputUser) - x.Unmarshal(envelope.Message) - bufUsers := new(bytes.Buffer) - tableUsers := tablewriter.NewWriter(bufUsers) - tableUsers.SetHeader([]string{ - "userID", "AccessHash", - }) - tableUsers.Append([]string{ - fmt.Sprintf("%d", x.UserID), - fmt.Sprintf("%d", x.AccessHash), - }) - tableUsers.Render() - _Shell.Println("\r\n" + bufUsers.String()) - case msg.C_SystemServerTime: - x := new(msg.SystemServerTime) - x.Unmarshal(envelope.Message) - serverTime := x.Timestamp - clientTime := time.Now().Unix() - delta := serverTime - clientTime - _Shell.Println(fmt.Sprintf("ServerTime : %d \t ClientTime : %d \t Delta: %d", serverTime, clientTime, delta)) - case msg.C_UpdateState: - x := new(msg.UpdateState) - x.Unmarshal(envelope.Message) - _Shell.Println("\r\n" + x.String()) - case msg.C_BotCommandsMany: - x := new(msg.BotCommandsMany) - x.Unmarshal(envelope.Message) - _Shell.Println("Available commands: ") - for _, cmd := range x.Commands { - _Shell.Println(cmd.Command, "-", cmd.Description) - } - case msg.C_ContactsTopPeers: - x := &msg.ContactsTopPeers{} - x.Unmarshal(envelope.Message) - for _, tp := range x.Peers { - _Shell.Println(tp.Peer.ID, tp.Peer.Type, tp.Rate) - } - case msg.C_WallPapersMany: - x := &msg.WallPapersMany{} - x.Unmarshal(envelope.Message) - for _, wp := range x.WallPapers { - _Shell.Println(wp.ID, wp.AccessHash, wp.Creator, wp.Document.ID, wp.Document.AccessHash) - } - case msg.C_ClientFilesMany: - x := &msg.ClientFilesMany{} - x.Unmarshal(envelope.Message) - _Shell.Println(x.Total, len(x.Gifs)) - for _, g := range x.Gifs { - _Shell.Println(g.FileID, g.AccessHash) - } - case msg.C_SavedGifs: - x := &msg.SavedGifs{} - x.Unmarshal(envelope.Message) - _Shell.Println(x.Hash, x.NotModified, len(x.Docs)) - for _, d := range x.Docs { - fmt.Println(d.Caption, d.Doc.ID, d.Doc.Attributes) - } - case msg.C_TeamMembers: - x := &msg.TeamMembers{} - _ = x.Unmarshal(envelope.Message) - for _, m := range x.Members { - _Shell.Println(m.Admin, m.UserID, m.User.Username, m.User.FirstName, m.User.LastName) - } - case msg.C_BotResults: - x := &msg.BotResults{} - _ = x.Unmarshal(envelope.Message) + tableMsg.Render() + _Shell.Println("\r\n" + bufMsg.String()) + case msg.C_InputUser: + x := new(msg.InputUser) + x.Unmarshal(envelope.Message) + bufUsers := new(bytes.Buffer) + tableUsers := tablewriter.NewWriter(bufUsers) + tableUsers.SetHeader([]string{ + "userID", "AccessHash", + }) + tableUsers.Append([]string{ + fmt.Sprintf("%d", x.UserID), + fmt.Sprintf("%d", x.AccessHash), + }) + tableUsers.Render() + _Shell.Println("\r\n" + bufUsers.String()) + case msg.C_SystemServerTime: + x := new(msg.SystemServerTime) + x.Unmarshal(envelope.Message) + serverTime := x.Timestamp + clientTime := time.Now().Unix() + delta := serverTime - clientTime + _Shell.Println(fmt.Sprintf("ServerTime : %d \t ClientTime : %d \t Delta: %d", serverTime, clientTime, delta)) + case msg.C_UpdateState: + x := new(msg.UpdateState) + x.Unmarshal(envelope.Message) + _Shell.Println("\r\n" + x.String()) + case msg.C_BotCommandsMany: + x := new(msg.BotCommandsMany) + x.Unmarshal(envelope.Message) + _Shell.Println("Available commands: ") + for _, cmd := range x.Commands { + _Shell.Println(cmd.Command, "-", cmd.Description) + } + case msg.C_ContactsTopPeers: + x := &msg.ContactsTopPeers{} + x.Unmarshal(envelope.Message) + for _, tp := range x.Peers { + _Shell.Println(tp.Peer.ID, tp.Peer.Type, tp.Rate) + } + case msg.C_WallPapersMany: + x := &msg.WallPapersMany{} + x.Unmarshal(envelope.Message) + for _, wp := range x.WallPapers { + _Shell.Println(wp.ID, wp.AccessHash, wp.Creator, wp.Document.ID, wp.Document.AccessHash) + } + case msg.C_ClientFilesMany: + x := &msg.ClientFilesMany{} + x.Unmarshal(envelope.Message) + _Shell.Println(x.Total, len(x.Gifs)) + for _, g := range x.Gifs { + _Shell.Println(g.FileID, g.AccessHash) + } + case msg.C_SavedGifs: + x := &msg.SavedGifs{} + x.Unmarshal(envelope.Message) + _Shell.Println(x.Hash, x.NotModified, len(x.Docs)) + for _, d := range x.Docs { + fmt.Println(d.Caption, d.Doc.ID, d.Doc.Attributes) + } + case msg.C_TeamMembers: + x := &msg.TeamMembers{} + _ = x.Unmarshal(envelope.Message) + for _, m := range x.Members { + _Shell.Println(m.Admin, m.UserID, m.User.Username, m.User.FirstName, m.User.LastName) + } + case msg.C_BotResults: + x := &msg.BotResults{} + _ = x.Unmarshal(envelope.Message) - buf := new(bytes.Buffer) - table := tablewriter.NewWriter(buf) - table.SetHeader([]string{ - "ID", "Type", "Title", "Message (Size)", - }) - for _, r := range x.Results { - table.Append([]string{ - r.ID, - r.Type.String(), - r.Title, - fmt.Sprintf("%d", proto.Size(r.Message)), - }) - } - _Shell.Println("QueryID:", x.QueryID) - _Shell.Println("NextOffset:", x.NextOffset) - table.Render() - _Shell.Println(buf) - default: - constructorName := registry.ConstructorName(envelope.Constructor) - _Shell.Println("DEFAULT", constructorName, len(envelope.Message)) - } + buf := new(bytes.Buffer) + table := tablewriter.NewWriter(buf) + table.SetHeader([]string{ + "ID", "Type", "Title", "Message (Size)", + }) + for _, r := range x.Results { + table.Append([]string{ + r.ID, + r.Type.String(), + r.Title, + fmt.Sprintf("%d", proto.Size(r.Message)), + }) + } + _Shell.Println("QueryID:", x.QueryID) + _Shell.Println("NextOffset:", x.NextOffset) + table.Render() + _Shell.Println(buf) + default: + constructorName := registry.ConstructorName(envelope.Constructor) + _Shell.Println("DEFAULT", constructorName, len(envelope.Message)) + } } func printTeamsMany(envelope *rony.MessageEnvelope) { - x := &msg.TeamsMany{} - x.Unmarshal(envelope.Message) - for _, t := range x.Teams { - _Shell.Println(t.ID, t.AccessHash, t.Name, t.CreatorID) - } + x := &msg.TeamsMany{} + x.Unmarshal(envelope.Message) + for _, t := range x.Teams { + _Shell.Println(t.ID, t.AccessHash, t.Name, t.CreatorID) + } } func printMessagesMany(envelope *rony.MessageEnvelope) { - x := new(msg.MessagesMany) - x.Unmarshal(envelope.Message) - bufMessages := new(bytes.Buffer) - tableMessages := tablewriter.NewWriter(bufMessages) - tableMessages.SetHeader([]string{ - "MsgID", "PeerID", "PeerType", "CreatedOn", "Flags", "Body", "Entities", "MeidaType", "FileID", "AccessHash", - }) + x := new(msg.MessagesMany) + x.Unmarshal(envelope.Message) + bufMessages := new(bytes.Buffer) + tableMessages := tablewriter.NewWriter(bufMessages) + tableMessages.SetHeader([]string{ + "MsgID", "PeerID", "PeerType", "CreatedOn", "Flags", "Body", "Entities", "MeidaType", "FileID", "AccessHash", + }) - for _, d := range x.Messages { - var docID int64 - var accessHash uint64 - if d.MediaType == msg.MediaType_MediaTypeDocument { - xx := &msg.MediaDocument{} - xx.Unmarshal(d.Media) - docID = xx.Doc.ID - accessHash = xx.Doc.AccessHash - } else { - docID = 0 - accessHash = 0 - } - tableMessages.Append([]string{ - fmt.Sprintf("%d", d.ID), - fmt.Sprintf("%d", d.PeerID), - fmt.Sprintf("%d", d.PeerType), - fmt.Sprintf("%d", d.CreatedOn), - fmt.Sprintf("%d", d.Flags), - fmt.Sprintf("%v", d.Body), - fmt.Sprintf("%v", d.Entities), - d.MediaType.String(), - fmt.Sprintf("%d", docID), - fmt.Sprintf("%d", accessHash), - }) - } - tableMessages.Render() - bufUsers := new(bytes.Buffer) - tableUsers := tablewriter.NewWriter(bufUsers) - tableUsers.SetHeader([]string{ - "userID", "FirstName", "LastName", "Photo", - }) - for _, x := range x.Users { - tableUsers.Append([]string{ - fmt.Sprintf("%d", x.ID), - x.FirstName, - x.LastName, - fmt.Sprintf("%d", len(x.Photo.String())), - }) - } - tableUsers.Render() + for _, d := range x.Messages { + var docID int64 + var accessHash uint64 + if d.MediaType == msg.MediaType_MediaTypeDocument { + xx := &msg.MediaDocument{} + xx.Unmarshal(d.Media) + docID = xx.Doc.ID + accessHash = xx.Doc.AccessHash + } else { + docID = 0 + accessHash = 0 + } + tableMessages.Append([]string{ + fmt.Sprintf("%d", d.ID), + fmt.Sprintf("%d", d.PeerID), + fmt.Sprintf("%d", d.PeerType), + fmt.Sprintf("%d", d.CreatedOn), + fmt.Sprintf("%d", d.Flags), + fmt.Sprintf("%v", d.Body), + fmt.Sprintf("%v", d.Entities), + d.MediaType.String(), + fmt.Sprintf("%d", docID), + fmt.Sprintf("%d", accessHash), + }) + } + tableMessages.Render() + bufUsers := new(bytes.Buffer) + tableUsers := tablewriter.NewWriter(bufUsers) + tableUsers.SetHeader([]string{ + "userID", "FirstName", "LastName", "Photo", + }) + for _, x := range x.Users { + tableUsers.Append([]string{ + fmt.Sprintf("%d", x.ID), + x.FirstName, + x.LastName, + fmt.Sprintf("%d", len(x.Photo.String())), + }) + } + tableUsers.Render() - _Shell.Println(fmt.Sprintf("Total Message Count: %d", len(x.Messages))) - _Shell.Println("\r\n" + bufMessages.String()) - _Shell.Println("\r\n" + bufUsers.String()) + _Shell.Println(fmt.Sprintf("Total Message Count: %d", len(x.Messages))) + _Shell.Println("\r\n" + bufMessages.String()) + _Shell.Println("\r\n" + bufUsers.String()) } func printUsersMany(envelope *rony.MessageEnvelope) { - x := new(msg.UsersMany) - _ = x.Unmarshal(envelope.Message) - bufUsers := new(bytes.Buffer) - tableUsers := tablewriter.NewWriter(bufUsers) - tableUsers.SetHeader([]string{ - "userID", "FirstName", "LastName", "Username", "Photo", "LastSeen", - }) - for _, x := range x.Users { - var photoID int64 = 0 - if x.Photo != nil { - photoID = x.Photo.PhotoID - } - tableUsers.Append([]string{ - fmt.Sprintf("%d", x.ID), - x.FirstName, - x.LastName, - x.Username, - fmt.Sprintf("%d", photoID), - time.Unix(x.LastSeen, 0).Format(time.RFC822), - }) - } - tableUsers.Render() - _Shell.Println("\r\n" + bufUsers.String()) + x := new(msg.UsersMany) + _ = x.Unmarshal(envelope.Message) + bufUsers := new(bytes.Buffer) + tableUsers := tablewriter.NewWriter(bufUsers) + tableUsers.SetHeader([]string{ + "userID", "FirstName", "LastName", "Username", "Photo", "LastSeen", + }) + for _, x := range x.Users { + var photoID int64 = 0 + if x.Photo != nil { + photoID = x.Photo.PhotoID + } + tableUsers.Append([]string{ + fmt.Sprintf("%d", x.ID), + x.FirstName, + x.LastName, + x.Username, + fmt.Sprintf("%d", photoID), + time.Unix(x.LastSeen, 0).Format(time.RFC822), + }) + } + tableUsers.Render() + _Shell.Println("\r\n" + bufUsers.String()) } func printUpdateDifference(envelope *rony.MessageEnvelope) { - x := new(msg.UpdateDifference) - x.Unmarshal(envelope.Message) + x := new(msg.UpdateDifference) + x.Unmarshal(envelope.Message) - _Shell.Println(fmt.Sprintf("Received UpdateDifference \t MaxID:%d \t MinID:%d \t UpdateCounts:%d", x.MaxUpdateID, x.MinUpdateID, len(x.Updates))) + _Shell.Println(fmt.Sprintf("Received UpdateDifference \t MaxID:%d \t MinID:%d \t UpdateCounts:%d", x.MaxUpdateID, x.MinUpdateID, len(x.Updates))) - for _, v := range x.Updates { - if v.Constructor == msg.C_UpdateNewMessage { - msg := new(rony.MessageEnvelope) - msg.Constructor = v.Constructor - msg.Message = v.Update + for _, v := range x.Updates { + if v.Constructor == msg.C_UpdateNewMessage { + msg := new(rony.MessageEnvelope) + msg.Constructor = v.Constructor + msg.Message = v.Update - MessagePrinter(msg) - } + MessagePrinter(msg) + } - } + } } func printGroupFull(envelope *rony.MessageEnvelope) { - x := new(msg.GroupFull) - err := x.Unmarshal(envelope.Message) - if err != nil { - _Shell.Println("Failed to unmarshal", zap.Error(err)) - return - } + x := new(msg.GroupFull) + err := x.Unmarshal(envelope.Message) + if err != nil { + _Shell.Println("Failed to unmarshal", zap.Error(err)) + return + } - if x.Group != nil { - _Shell.Println(fmt.Sprintf("GroupID : %d \t Title : %s \t Flags :%v", x.Group.ID, x.Group.Title, x.Group.Flags)) - if x.Group.Photo == nil { - _Shell.Println("GroupPhoto is null") - } else { - _Shell.Println("GroupPhoto", zap.String("Big", x.Group.Photo.PhotoBig.String()), zap.String("Small", x.Group.Photo.PhotoSmall.String())) - } + if x.Group != nil { + _Shell.Println(fmt.Sprintf("GroupID : %d \t Title : %s \t Flags :%v", x.Group.ID, x.Group.Title, x.Group.Flags)) + if x.Group.Photo == nil { + _Shell.Println("GroupPhoto is null") + } else { + _Shell.Println("GroupPhoto", zap.String("Big", x.Group.Photo.PhotoBig.String()), zap.String("Small", x.Group.Photo.PhotoSmall.String())) + } - } else { - _Shell.Println("x.Group is null") - } - if x.NotifySettings != nil { - _Shell.Println(fmt.Sprintf("NotifySettings Sound: %s \t Mute : %d \t Flag : %d", x.NotifySettings.Sound, x.NotifySettings.MuteUntil, x.NotifySettings.Flags)) - } else { - _Shell.Println("x.NotifySettings is null") - } - if x.Participants != nil { - _Shell.Println(fmt.Sprintf("Participants Count : %d ", len(x.Participants))) + } else { + _Shell.Println("x.Group is null") + } + if x.NotifySettings != nil { + _Shell.Println(fmt.Sprintf("NotifySettings Sound: %s \t Mute : %d \t Flag : %d", x.NotifySettings.Sound, x.NotifySettings.MuteUntil, x.NotifySettings.Flags)) + } else { + _Shell.Println("x.NotifySettings is null") + } + if x.Participants != nil { + _Shell.Println(fmt.Sprintf("Participants Count : %d ", len(x.Participants))) - bufUsers := new(bytes.Buffer) - tableUsers := tablewriter.NewWriter(bufUsers) - tableUsers.SetHeader([]string{ - "userID", "FirstName", "LastName", "AccessHash", "Username", "Photo", - }) - for _, x := range x.Participants { - tableUsers.Append([]string{ - fmt.Sprintf("%d", x.UserID), - x.FirstName, - x.LastName, - fmt.Sprintf("%d", x.AccessHash), - x.Username, - fmt.Sprintf("%d", len(x.Photo.String())), - }) - } - tableUsers.Render() - _Shell.Println("\r\n" + bufUsers.String()) + bufUsers := new(bytes.Buffer) + tableUsers := tablewriter.NewWriter(bufUsers) + tableUsers.SetHeader([]string{ + "userID", "FirstName", "LastName", "AccessHash", "Username", "Photo", + }) + for _, x := range x.Participants { + tableUsers.Append([]string{ + fmt.Sprintf("%d", x.UserID), + x.FirstName, + x.LastName, + fmt.Sprintf("%d", x.AccessHash), + x.Username, + fmt.Sprintf("%d", len(x.Photo.String())), + }) + } + tableUsers.Render() + _Shell.Println("\r\n" + bufUsers.String()) - } else { - _Shell.Println("x.Participants is null") - } + } else { + _Shell.Println("x.Participants is null") + } } func printLabelsMany(envelope *rony.MessageEnvelope) { - x := &msg.LabelsMany{} - x.Unmarshal(envelope.Message) - for _, l := range x.Labels { - _Shell.Println(l.ID, l.Count, l.Name) - } + x := &msg.LabelsMany{} + x.Unmarshal(envelope.Message) + for _, l := range x.Labels { + _Shell.Println(l.ID, l.Count, l.Name) + } } func printLabelItems(envelope *rony.MessageEnvelope) { - x := &msg.LabelItems{} - x.Unmarshal(envelope.Message) - bufMessages := new(bytes.Buffer) - tableMessages := tablewriter.NewWriter(bufMessages) - tableMessages.SetHeader([]string{ - "MsgID", "PeerID", "PeerType", "CreatedOn", "Flags", "Body", "Entities", "MeidaType", - }) + x := &msg.LabelItems{} + x.Unmarshal(envelope.Message) + bufMessages := new(bytes.Buffer) + tableMessages := tablewriter.NewWriter(bufMessages) + tableMessages.SetHeader([]string{ + "MsgID", "PeerID", "PeerType", "CreatedOn", "Flags", "Body", "Entities", "MeidaType", + }) - for _, d := range x.Messages { - tableMessages.Append([]string{ - fmt.Sprintf("%d", d.ID), - fmt.Sprintf("%d", d.PeerID), - fmt.Sprintf("%d", d.PeerType), - fmt.Sprintf("%d", d.CreatedOn), - fmt.Sprintf("%d", d.Flags), - d.Body, - fmt.Sprintf("%v", d.Entities), - d.MediaType.String(), - }) - } - tableMessages.Render() - bufUsers := new(bytes.Buffer) - tableUsers := tablewriter.NewWriter(bufUsers) - tableUsers.SetHeader([]string{ - "userID", "FirstName", "LastName", "Photo", - }) - for _, x := range x.Users { - tableUsers.Append([]string{ - fmt.Sprintf("%d", x.ID), - x.FirstName, - x.LastName, - fmt.Sprintf("%d", len(x.Photo.String())), - }) - } - tableUsers.Render() + for _, d := range x.Messages { + tableMessages.Append([]string{ + fmt.Sprintf("%d", d.ID), + fmt.Sprintf("%d", d.PeerID), + fmt.Sprintf("%d", d.PeerType), + fmt.Sprintf("%d", d.CreatedOn), + fmt.Sprintf("%d", d.Flags), + d.Body, + fmt.Sprintf("%v", d.Entities), + d.MediaType.String(), + }) + } + tableMessages.Render() + bufUsers := new(bytes.Buffer) + tableUsers := tablewriter.NewWriter(bufUsers) + tableUsers.SetHeader([]string{ + "userID", "FirstName", "LastName", "Photo", + }) + for _, x := range x.Users { + tableUsers.Append([]string{ + fmt.Sprintf("%d", x.ID), + x.FirstName, + x.LastName, + fmt.Sprintf("%d", len(x.Photo.String())), + }) + } + tableUsers.Render() - _Shell.Println(fmt.Sprintf("Total Message Count: %d", len(x.Messages))) - _Shell.Println("\r\n" + bufMessages.String()) - _Shell.Println("\r\n" + bufUsers.String()) + _Shell.Println(fmt.Sprintf("Total Message Count: %d", len(x.Messages))) + _Shell.Println("\r\n" + bufMessages.String()) + _Shell.Println("\r\n" + bufUsers.String()) } func printContactsImported(envelope *rony.MessageEnvelope) { - x := new(msg.ContactsImported) - x.Unmarshal(envelope.Message) - buf := new(bytes.Buffer) - table := tablewriter.NewWriter(buf) - table.SetHeader([]string{ - "FirstName", "LastName", "Username", "User ID", "AccessHash", - }) + x := new(msg.ContactsImported) + x.Unmarshal(envelope.Message) + buf := new(bytes.Buffer) + table := tablewriter.NewWriter(buf) + table.SetHeader([]string{ + "FirstName", "LastName", "Username", "User ID", "AccessHash", + }) - for _, u := range x.Users { - table.Append([]string{ - u.FirstName, - u.LastName, - u.Username, - fmt.Sprintf("%d", u.ID), - fmt.Sprintf("%d", u.AccessHash), - }) - } - table.Render() - _Shell.Println("\r\n" + buf.String()) + for _, u := range x.Users { + table.Append([]string{ + u.FirstName, + u.LastName, + u.Username, + fmt.Sprintf("%d", u.ID), + fmt.Sprintf("%d", u.AccessHash), + }) + } + table.Render() + _Shell.Println("\r\n" + buf.String()) } func printContactsMany(envelope *rony.MessageEnvelope) { - x := new(msg.ContactsMany) - x.Unmarshal(envelope.Message) + x := new(msg.ContactsMany) + x.Unmarshal(envelope.Message) - bufUsers := new(bytes.Buffer) - tableUsers := tablewriter.NewWriter(bufUsers) - tableUsers.SetCaption(true, "Users") - tableUsers.SetHeader([]string{ - "FirstName", "LastName", "Username", "User ID", "AccessHash", "Phone", - }) + bufUsers := new(bytes.Buffer) + tableUsers := tablewriter.NewWriter(bufUsers) + tableUsers.SetCaption(true, "Users") + tableUsers.SetHeader([]string{ + "FirstName", "LastName", "Username", "User ID", "AccessHash", "Phone", + }) - for _, u := range x.ContactUsers { - tableUsers.Append([]string{ - u.FirstName, - u.LastName, - u.Username, - fmt.Sprintf("%d", u.ID), - fmt.Sprintf("%d", u.AccessHash), - u.Phone, - }) - } - tableUsers.Render() - _Shell.Println("\r\n" + bufUsers.String()) + for _, u := range x.ContactUsers { + tableUsers.Append([]string{ + u.FirstName, + u.LastName, + u.Username, + fmt.Sprintf("%d", u.ID), + fmt.Sprintf("%d", u.AccessHash), + u.Phone, + }) + } + tableUsers.Render() + _Shell.Println("\r\n" + bufUsers.String()) } func printMessagesDialogs(envelope *rony.MessageEnvelope) { - x := new(msg.MessagesDialogs) - x.Unmarshal(envelope.Message) + x := new(msg.MessagesDialogs) + x.Unmarshal(envelope.Message) - bufDialogs := new(bytes.Buffer) - tableDialogs := tablewriter.NewWriter(bufDialogs) - tableDialogs.SetHeader([]string{ - "PeerID", "PeerType", "Top Message ID", "Unread", "AccessHash", "MentionedCount", - }) - MyDialogs = append(MyDialogs[:0], x.Dialogs...) - for _, d := range x.Dialogs { - tableDialogs.Append([]string{ - fmt.Sprintf("%d", d.PeerID), - fmt.Sprintf("%d", d.PeerType), - fmt.Sprintf("%d", d.TopMessageID), - fmt.Sprintf("%d", d.UnreadCount), - fmt.Sprintf("%d", d.AccessHash), - fmt.Sprintf("%d", d.MentionedCount), - }) - } - tableDialogs.Render() - for _, x := range x.Users { - MyUsers[x.ID] = x - } - for _, x := range x.Groups { - MyGroups[x.ID] = x - } + bufDialogs := new(bytes.Buffer) + tableDialogs := tablewriter.NewWriter(bufDialogs) + tableDialogs.SetHeader([]string{ + "PeerID", "PeerType", "Top Message ID", "Unread", "AccessHash", "MentionedCount", + }) + MyDialogs = append(MyDialogs[:0], x.Dialogs...) + for _, d := range x.Dialogs { + tableDialogs.Append([]string{ + fmt.Sprintf("%d", d.PeerID), + fmt.Sprintf("%d", d.PeerType), + fmt.Sprintf("%d", d.TopMessageID), + fmt.Sprintf("%d", d.UnreadCount), + fmt.Sprintf("%d", d.AccessHash), + fmt.Sprintf("%d", d.MentionedCount), + }) + } + tableDialogs.Render() + for _, x := range x.Users { + MyUsers[x.ID] = x + } + for _, x := range x.Groups { + MyGroups[x.ID] = x + } - _Shell.Println("\r\n" + fmt.Sprintf("Total: %d", x.Count)) - _Shell.Println("\r\n" + bufDialogs.String()) + _Shell.Println("\r\n" + fmt.Sprintf("Total: %d", x.Count)) + _Shell.Println("\r\n" + bufDialogs.String()) } func printDialog(envelope *rony.MessageEnvelope) { - x := new(msg.Dialog) - x.Unmarshal(envelope.Message) - buf := new(bytes.Buffer) - table := tablewriter.NewWriter(buf) - table.SetHeader([]string{ - "PeerID", "PeerType", "Top Message ID", "Unread", "AccessHash", - }) - table.Append([]string{ - fmt.Sprintf("%d", x.PeerID), - fmt.Sprintf("%d", x.PeerType), - fmt.Sprintf("%d", x.TopMessageID), - fmt.Sprintf("%d", x.UnreadCount), - fmt.Sprintf("%d", x.AccessHash), - }) - table.Render() - _Shell.Println("\r\n" + buf.String()) + x := new(msg.Dialog) + x.Unmarshal(envelope.Message) + buf := new(bytes.Buffer) + table := tablewriter.NewWriter(buf) + table.SetHeader([]string{ + "PeerID", "PeerType", "Top Message ID", "Unread", "AccessHash", + }) + table.Append([]string{ + fmt.Sprintf("%d", x.PeerID), + fmt.Sprintf("%d", x.PeerType), + fmt.Sprintf("%d", x.TopMessageID), + fmt.Sprintf("%d", x.UnreadCount), + fmt.Sprintf("%d", x.AccessHash), + }) + table.Render() + _Shell.Println("\r\n" + buf.String()) } func printMessagesSent(envelope *rony.MessageEnvelope) { - x := new(msg.MessagesSent) - x.Unmarshal(envelope.Message) - _Shell.Println(fmt.Sprintf("MessagesSent \t MsgID:%d , RandomID:%d", x.MessageID, x.RandomID)) + x := new(msg.MessagesSent) + x.Unmarshal(envelope.Message) + _Shell.Println(fmt.Sprintf("MessagesSent \t MsgID:%d , RandomID:%d", x.MessageID, x.RandomID)) } func printError(envelope *rony.MessageEnvelope) { - x := new(rony.Error) - _ = x.Unmarshal(envelope.Message) - _Shell.Println(fmt.Sprintf("Error \t %s:%s (%s)", x.Code, x.Items, x.Description)) + x := new(rony.Error) + _ = x.Unmarshal(envelope.Message) + _Shell.Println(fmt.Sprintf("Error \t %s:%s (%s)", x.Code, x.Items, x.Description)) } func printSystemConfig(envelope *rony.MessageEnvelope) { - x := &msg.SystemConfig{} - x.Unmarshal(envelope.Message) - _Shell.Println("Reactions", x.Reactions) + x := &msg.SystemConfig{} + x.Unmarshal(envelope.Message) + _Shell.Println("Reactions", x.Reactions) } func printClientPendingMessage(envelope *rony.MessageEnvelope) { - x := &msg.ClientPendingMessage{} - x.Unmarshal(envelope.Message) - _Shell.Println(fmt.Sprintf("ClientPendingMessage ID:%d, FileID:%d, FileUploadID:%s", x.ID, x.FileID, x.FileUploadID)) + x := &msg.ClientPendingMessage{} + x.Unmarshal(envelope.Message) + _Shell.Println(fmt.Sprintf("ClientPendingMessage ID:%d, FileID:%d, FileUploadID:%s", x.ID, x.FileID, x.FileUploadID)) } func printAuthAuthorization(envelope *rony.MessageEnvelope) { - x := new(msg.AuthAuthorization) - x.Unmarshal(envelope.Message) - _Shell.Println(fmt.Sprintf("AuthAuthorization \t %s %s (%d)", x.User.FirstName, x.User.LastName, x.User.ID)) + x := new(msg.AuthAuthorization) + x.Unmarshal(envelope.Message) + _Shell.Println(fmt.Sprintf("AuthAuthorization \t %s %s (%d)", x.User.FirstName, x.User.LastName, x.User.ID)) } func printAuthCheckedPhone(envelope *rony.MessageEnvelope) { - x := new(msg.AuthCheckedPhone) - x.Unmarshal(envelope.Message) - _Shell.Println(fmt.Sprintf("AuthCheckedPhone \t Registered:%t", x.Registered)) + x := new(msg.AuthCheckedPhone) + x.Unmarshal(envelope.Message) + _Shell.Println(fmt.Sprintf("AuthCheckedPhone \t Registered:%t", x.Registered)) } func printAuthRecalled(envelope *rony.MessageEnvelope) { - x := new(msg.AuthRecalled) - x.Unmarshal(envelope.Message) - _Shell.Println(fmt.Sprintf("AuthRecalled \t ClientID:%d , Timestamp:%d", x.ClientID, x.Timestamp)) + x := new(msg.AuthRecalled) + x.Unmarshal(envelope.Message) + _Shell.Println(fmt.Sprintf("AuthRecalled \t ClientID:%d , Timestamp:%d", x.ClientID, x.Timestamp)) } func printAuthSentCode(envelope *rony.MessageEnvelope) { - x := new(msg.AuthSentCode) - x.Unmarshal(envelope.Message) - if strings.HasPrefix(x.Phone, "2374") { - os.Remove("./_phone") - os.Remove("./_phoneCodeHash") - ioutil.WriteFile("./_phone", []byte(x.Phone), 0666) - ioutil.WriteFile("./_phoneCodeHash", []byte(x.PhoneCodeHash), 0666) - } - _Shell.Println(fmt.Sprintf("AuthSentCode \t Phone:%s , Hash:%s", x.Phone, x.PhoneCodeHash)) + x := new(msg.AuthSentCode) + x.Unmarshal(envelope.Message) + if strings.HasPrefix(x.Phone, "2374") { + os.Remove("./_phone") + os.Remove("./_phoneCodeHash") + ioutil.WriteFile("./_phone", []byte(x.Phone), 0666) + ioutil.WriteFile("./_phoneCodeHash", []byte(x.PhoneCodeHash), 0666) + } + _Shell.Println(fmt.Sprintf("AuthSentCode \t Phone:%s , Hash:%s", x.Phone, x.PhoneCodeHash)) } func printAccountPassword(envelope *rony.MessageEnvelope) { - x := &msg.AccountPassword{} - x.Unmarshal(envelope.Message) - os.Remove("./_password") - ioutil.WriteFile("./_password", envelope.Message, 0666) - _Shell.Println("SrpB:", hex.EncodeToString(x.SrpB)) - _Shell.Println("SrpID:", x.SrpID) - _Shell.Println("Hint:", x.Hint) + x := &msg.AccountPassword{} + x.Unmarshal(envelope.Message) + os.Remove("./_password") + ioutil.WriteFile("./_password", envelope.Message, 0666) + _Shell.Println("SrpB:", hex.EncodeToString(x.SrpB)) + _Shell.Println("SrpID:", x.SrpID) + _Shell.Println("Hint:", x.Hint) } func printClientSearchResult(envelope *rony.MessageEnvelope) { - x := &msg.ClientSearchResult{} - x.Unmarshal(envelope.Message) - bufUsers := new(bytes.Buffer) - tableUsers := tablewriter.NewWriter(bufUsers) - tableUsers.SetHeader([]string{ - "userID", "FirstName", "LastName", "Username", "LastSeen", - }) - for _, x := range x.Users { - tableUsers.Append([]string{ - fmt.Sprintf("%d", x.ID), - x.FirstName, - x.LastName, - x.Username, - time.Unix(x.LastSeen, 0).Format(time.RFC822), - }) - } - tableUsers.Render() - _Shell.Println("\r\n" + bufUsers.String()) + x := &msg.ClientSearchResult{} + x.Unmarshal(envelope.Message) + bufUsers := new(bytes.Buffer) + tableUsers := tablewriter.NewWriter(bufUsers) + tableUsers.SetHeader([]string{ + "userID", "FirstName", "LastName", "Username", "LastSeen", + }) + for _, x := range x.Users { + tableUsers.Append([]string{ + fmt.Sprintf("%d", x.ID), + x.FirstName, + x.LastName, + x.Username, + time.Unix(x.LastSeen, 0).Format(time.RFC822), + }) + } + tableUsers.Render() + _Shell.Println("\r\n" + bufUsers.String()) } diff --git a/cmd/cli-river/printer_updates.go b/cmd/cli-river/printer_updates.go index 81279520..ea54de95 100644 --- a/cmd/cli-river/printer_updates.go +++ b/cmd/cli-river/printer_updates.go @@ -1,44 +1,44 @@ package main import ( - "git.ronaksoft.com/river/msg/go/msg" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "go.uber.org/zap" ) func UpdatePrinter(envelope *msg.UpdateEnvelope) { - switch envelope.Constructor { - case msg.C_UpdateNewMessage: - x := new(msg.UpdateNewMessage) - x.Unmarshal(envelope.Update) - case msg.C_UpdateReadHistoryInbox: - x := new(msg.UpdateReadHistoryInbox) - x.Unmarshal(envelope.Update) - case msg.C_UpdateReadHistoryOutbox: - x := new(msg.UpdateReadHistoryOutbox) - x.Unmarshal(envelope.Update) - case msg.C_UpdateUserTyping: - x := new(msg.UpdateUserTyping) - x.Unmarshal(envelope.Update) - case msg.C_ClientUpdatePendingMessageDelivery: - x := new(msg.ClientUpdatePendingMessageDelivery) - err := x.Unmarshal(envelope.Update) - if err != nil { - _Shell.Println("Failed to unmarshal", zap.Error(err)) - return - } - case msg.C_UpdateMessageID: - case msg.C_UpdateContainer: - x := new(msg.UpdateContainer) - err := x.Unmarshal(envelope.Update) - if err != nil { - _Shell.Println("Failed to unmarshal", zap.Error(err)) - return - } - for _, u := range x.Updates { - UpdatePrinter(u) - } + switch envelope.Constructor { + case msg.C_UpdateNewMessage: + x := new(msg.UpdateNewMessage) + x.Unmarshal(envelope.Update) + case msg.C_UpdateReadHistoryInbox: + x := new(msg.UpdateReadHistoryInbox) + x.Unmarshal(envelope.Update) + case msg.C_UpdateReadHistoryOutbox: + x := new(msg.UpdateReadHistoryOutbox) + x.Unmarshal(envelope.Update) + case msg.C_UpdateUserTyping: + x := new(msg.UpdateUserTyping) + x.Unmarshal(envelope.Update) + case msg.C_ClientUpdatePendingMessageDelivery: + x := new(msg.ClientUpdatePendingMessageDelivery) + err := x.Unmarshal(envelope.Update) + if err != nil { + _Shell.Println("Failed to unmarshal", zap.Error(err)) + return + } + case msg.C_UpdateMessageID: + case msg.C_UpdateContainer: + x := new(msg.UpdateContainer) + err := x.Unmarshal(envelope.Update) + if err != nil { + _Shell.Println("Failed to unmarshal", zap.Error(err)) + return + } + for _, u := range x.Updates { + UpdatePrinter(u) + } - default: - // _Shell.Println("Received Update", zap.String("C", registry.ConstructorName(envelope.Constructor))) - } + default: + // _Shell.Println("Received Update", zap.String("C", registry.ConstructorName(envelope.Constructor))) + } } diff --git a/go.mod b/go.mod index c142a5ae..10a06082 100644 --- a/go.mod +++ b/go.mod @@ -1,41 +1,140 @@ -module git.ronaksoft.com/river/sdk +module github.com/ronaksoft/river-sdk + +go 1.18 require ( - git.ronaksoft.com/river/msg v0.0.0-20210803111706-69c45391ba2d - github.com/RoaringBitmap/roaring v0.5.1 // indirect github.com/Workiva/go-datastructures v1.0.53 - github.com/abiosoft/ishell v2.0.0+incompatible // indirect - github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db // indirect github.com/beeker1121/goque v2.1.0+incompatible github.com/blevesearch/bleve v1.0.14 github.com/boltdb/bolt v1.3.1 - github.com/dgraph-io/badger/v2 v2.2007.3 - github.com/dustin/go-humanize v1.0.0 - github.com/fatih/color v1.11.0 - github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect - github.com/getsentry/sentry-go v0.11.0 - github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a // indirect - github.com/gobwas/ws v1.0.4 - github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/dgraph-io/badger/v2 v2.2007.4 + github.com/dustin/go-humanize v1.0.1 + github.com/fatih/color v1.16.0 + github.com/getsentry/sentry-go v0.27.0 + github.com/gobwas/ws v1.1.0 github.com/juju/ratelimit v1.0.1 github.com/monnand/dhkx v0.0.0-20180522003156-9e5b033f1ac4 github.com/nyaruka/phonenumbers v1.0.70 github.com/olekukonko/tablewriter v0.0.4 github.com/pkg/errors v0.9.1 + github.com/ronaksoft/river-msg v0.0.0-20240204095508-6868e75c8967 github.com/ronaksoft/rony v0.12.29 github.com/siongui/instago v0.0.0-20200627103523-54424cb565ea github.com/smartystreets/goconvey v1.6.4 github.com/spf13/cobra v1.2.1 github.com/spf13/viper v1.8.1 github.com/tidwall/buntdb v1.1.7 - github.com/valyala/fasthttp v1.28.0 + github.com/valyala/fasthttp v1.40.0 github.com/valyala/tcplisten v1.0.0 - github.com/willf/bitset v1.1.11 // indirect go.uber.org/zap v1.18.1 golang.org/x/mobile v0.0.0-20210527171505-7e972142eb43 - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - google.golang.org/protobuf v1.27.1 + golang.org/x/sync v0.1.0 + google.golang.org/protobuf v1.29.1 gopkg.in/abiosoft/ishell.v2 v2.0.0 ) -go 1.15 +require ( + github.com/RoaringBitmap/roaring v0.5.1 // indirect + github.com/abiosoft/ishell v2.0.0+incompatible // indirect + github.com/abiosoft/readline v0.0.0-20180607040430-155bce2042db // indirect + github.com/allegro/bigcache/v2 v2.2.5 // indirect + github.com/andybalholm/brotli v1.0.5 // indirect + github.com/armon/go-metrics v0.3.9 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/blevesearch/go-porterstemmer v1.0.3 // indirect + github.com/blevesearch/mmap-go v1.0.2 // indirect + github.com/blevesearch/segment v0.9.0 // indirect + github.com/blevesearch/snowballstem v0.9.0 // indirect + github.com/blevesearch/zap/v11 v11.0.14 // indirect + github.com/blevesearch/zap/v12 v12.0.14 // indirect + github.com/blevesearch/zap/v13 v13.0.6 // indirect + github.com/blevesearch/zap/v14 v14.0.5 // indirect + github.com/blevesearch/zap/v15 v15.0.3 // indirect + github.com/c-bata/go-prompt v0.2.5 // indirect + github.com/cespare/xxhash v1.1.0 // indirect + github.com/cespare/xxhash/v2 v2.1.1 // indirect + github.com/couchbase/vellum v1.0.2 // indirect + github.com/dgraph-io/badger/v3 v3.2103.1 // indirect + github.com/dgraph-io/ristretto v0.1.0 // indirect + github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect + github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a // indirect + github.com/gobwas/httphead v0.1.0 // indirect + github.com/gobwas/pool v0.2.1 // indirect + github.com/gocql/gocql v0.0.0-20200131111108-92af2e088537 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect + github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/btree v1.0.1 // indirect + github.com/google/flatbuffers v1.12.0 // indirect + github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 // indirect + github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-immutable-radix v1.1.0 // indirect + github.com/hashicorp/go-msgpack v1.1.5 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-sockaddr v1.0.2 // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jtolds/gls v4.20.0+incompatible // indirect + github.com/klauspost/compress v1.16.0 // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/mailru/easygo v0.0.0-20190618140210-3c14a0dc985f // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.10 // indirect + github.com/mattn/go-tty v0.0.3 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/miekg/dns v1.1.43 // indirect + github.com/mitchellh/mapstructure v1.4.1 // indirect + github.com/mschoch/smat v0.2.0 // indirect + github.com/panjf2000/ants/v2 v2.4.6 // indirect + github.com/panjf2000/gnet v1.5.0 // indirect + github.com/pelletier/go-toml v1.9.3 // indirect + github.com/philhofer/fwd v1.1.1 // indirect + github.com/pkg/term v1.1.0 // indirect + github.com/prometheus/client_golang v1.11.0 // indirect + github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/common v0.26.0 // indirect + github.com/prometheus/procfs v0.6.0 // indirect + github.com/rivo/uniseg v0.2.0 // indirect + github.com/ronaksoft/memberlist v0.2.7 // indirect + github.com/scylladb/go-reflectx v1.0.1 // indirect + github.com/scylladb/gocqlx/v2 v2.4.0 // indirect + github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect + github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/steveyen/gtreap v0.1.0 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + github.com/syndtr/goleveldb v1.0.0 // indirect + github.com/tidwall/btree v0.3.0 // indirect + github.com/tidwall/gjson v1.6.7 // indirect + github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb // indirect + github.com/tidwall/match v1.0.3 // indirect + github.com/tidwall/pretty v1.0.2 // indirect + github.com/tidwall/rtree v0.0.0-20201103190202-0d877048965d // indirect + github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 // indirect + github.com/tinylib/msgp v1.1.5 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/willf/bitset v1.1.11 // indirect + go.etcd.io/bbolt v1.3.5 // indirect + go.opencensus.io v0.23.0 // indirect + go.uber.org/atomic v1.8.0 // indirect + go.uber.org/multierr v1.7.0 // indirect + golang.org/x/mod v0.8.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/text v0.8.0 // indirect + golang.org/x/tools v0.6.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect +) diff --git a/go.sum b/go.sum index d26ab0ee..4f7ab572 100644 --- a/go.sum +++ b/go.sum @@ -37,17 +37,13 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.ronaksoft.com/river/msg v0.0.0-20210803111706-69c45391ba2d h1:B0sp/6+Na4FHUwi13dFH1vowVXczYTXSXjPiIYCJbOs= -git.ronaksoft.com/river/msg v0.0.0-20210803111706-69c45391ba2d/go.mod h1:dcjQjaR3z8KW6YBjZBTDwo5nE9AGHU0rD+qIBwd25MY= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMdUywE7VMo= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -71,8 +67,10 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/allegro/bigcache/v2 v2.2.5 h1:mRc8r6GQjuJsmSKQNPsR5jQVXc8IJ1xsW5YXUYMLfqI= github.com/allegro/bigcache/v2 v2.2.5/go.mod h1:FppZsIO+IZk7gCuj5FiIDHGygD9xvWQcqg1uIPMb6tY= -github.com/andybalholm/brotli v1.0.2 h1:JKnhI/XQ75uFBTiuzXpzFrUriDPiZjlOSzh6wXogP0E= github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= +github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= +github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= @@ -152,17 +150,14 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d h1:SwD98825d6bdB+pEuTxWOXiSjBrHdOl/UVp75eI7JT8= github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= -github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 h1:iwZdTE0PVqJCos1vaoKsclOGD3ADKpshg3SRtYBbwso= github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= -github.com/cznic/strutil v0.0.0-20181122101858-275e90344537 h1:MZRmHqDBd0vxNwenEbKSQqRVT24d3C05ft8kduSwlqM= github.com/cznic/strutil v0.0.0-20181122101858-275e90344537/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgraph-io/badger v1.6.0 h1:DshxFxZWXUcO0xX476VJC07Xsr6ZCBVRHKZ93Oh7Evo= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= -github.com/dgraph-io/badger/v2 v2.2007.3 h1:Sl9tQWz92WCbVSe8pj04Tkqlm2boW+KAxd+XSs58SQI= -github.com/dgraph-io/badger/v2 v2.2007.3/go.mod h1:26P/7fbL4kUZVEVKLAKXkBXKOydDmM2p1e+NhhnBCAE= +github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= +github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= github.com/dgraph-io/badger/v3 v3.2103.1 h1:zaX53IRg7ycxVlkd5pYdCeFp1FynD6qBGQoQql3R3Hk= github.com/dgraph-io/badger/v3 v3.2103.1/go.mod h1:dULbq6ehJ5K0cGW/1TQ9iSfUk0gbSiToDWmWmTsJ53E= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= @@ -172,8 +167,9 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -183,27 +179,23 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.11.0 h1:l4iX0RqNnx/pU7rY2DB/I+znuYY0K3x6Ywac6EIr0PA= -github.com/fatih/color v1.11.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BMXYYRWTLOJKlh+lOBt6nUQgXAfB7oVIQt5cNreqSLI= github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:rZfgFAXFS/z/lEd6LJmf9HVZ1LkgYiHx5pHhV5DR16M= -github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= -github.com/getsentry/sentry-go v0.11.0 h1:qro8uttJGvNAMr5CLcFI9CHR0aDzXl0Vs3Pmw/oTPg8= github.com/getsentry/sentry-go v0.11.0/go.mod h1:KBQIxiZAetw62Cj8Ri964vAEWVdgfaUCn30Q3bCvANo= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= @@ -215,8 +207,8 @@ github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a/go.mod github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 h1:gclg6gY70GLy3PbkQ1AERPfmLMMagS60DKF78eWwLn8= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= -github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -242,15 +234,16 @@ github.com/gobuffalo/plush/v4 v4.0.0/go.mod h1:ErFS3UxKqEb8fpFJT7lYErfN/Nw6vHGiD github.com/gobuffalo/plush/v4 v4.1.5/go.mod h1:ErFS3UxKqEb8fpFJT7lYErfN/Nw6vHGiDMTjxpk5bQ0= github.com/gobuffalo/tags/v3 v3.0.2/go.mod h1:ZQeN6TCTiwAFnS0dNcbDtSgZDwNKSpqajvVtt6mlYpA= github.com/gobuffalo/validate/v3 v3.0.0/go.mod h1:HFpjq+AIiA2RHoQnQVTFKF/ZpUPXwyw82LgyDPxQ9r0= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= +github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= +github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/gobwas/ws v1.0.4 h1:5eXU1CZhpQdq5kXbKb+sECH5Ia5KiO6CYzIzdlVx6Bs= -github.com/gobwas/ws v1.0.4/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/gobwas/ws v1.1.0 h1:7RFti/xnNkMJnrK7D1yQ/iCIB5OrrY/54/H930kIbHA= +github.com/gobwas/ws v1.1.0/go.mod h1:nzvNcVha5eUziGrbxFCo6qFIojQHjJV5cLYIbezhfL0= github.com/gocql/gocql v0.0.0-20200131111108-92af2e088537 h1:NaMut1fdw76YYX/TPinSAbai4DShF5tPort3bHpET6g= github.com/gocql/gocql v0.0.0-20200131111108-92af2e088537/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -260,7 +253,6 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= @@ -287,7 +279,6 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= @@ -295,11 +286,11 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= @@ -315,8 +306,8 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -356,13 +347,11 @@ github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjh github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs= github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4= -github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= @@ -422,10 +411,11 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.12.2 h1:2KCfW3I9M7nSc5wOqXAlW2v2U6v+w6cbjvbfp+OykW8= github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.12.3 h1:G5AfA94pHPysR56qqrkO2pxEexdDzrpFJ6yt/VqWxVU= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.16.0 h1:iULayQNOReoYUe+1qtKOqw9CwJv3aNQu8ivo7lw1HU4= +github.com/klauspost/compress v1.16.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/kljensen/snowball v0.6.0/go.mod h1:27N7E8fVU5H68RlUmnWwZCfxgt4POBJfENGMvNRhldw= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -453,15 +443,18 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -485,7 +478,6 @@ github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUb github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -526,7 +518,6 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/philhofer/fwd v1.1.1 h1:GdGcTjf5RNAxwS4QLsiMzJYj5KEvPJD3Abr261yRQXQ= github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= @@ -544,7 +535,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.4.0 h1:YVIb/fVcOTMSqtqZWSKnHpSLBxu8DKgxq8z6RuBZwqI= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.0 h1:HNkLOAEQMIDv/K+04rukrLx6ch7msSRwf3/SASFAGtQ= @@ -555,21 +545,18 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0 h1:iMAkS2TDoNWnKM+Kopnx/8tnEStIfpYA0ur0xQzzhMQ= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef/go.mod h1:tcaRap0jS3eifrEEllL6ZMd9dg8IlDpi2S1oARrQ+NI= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= @@ -578,6 +565,8 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/ronaksoft/memberlist v0.2.7 h1:Y4bZjKPc1sJ4qCdTnnLW/HdWvOiZugm9qlg25ZnAr/A= github.com/ronaksoft/memberlist v0.2.7/go.mod h1:VBpJGpiaUma9qsGzwF7eTHrsC/MZriNQSA+5S3A+kAQ= +github.com/ronaksoft/river-msg v0.0.0-20240204095508-6868e75c8967 h1:AsuiBXi/RcXv7AkaOfxl7Kad5q0uTV03Kt98B35EUDM= +github.com/ronaksoft/river-msg v0.0.0-20240204095508-6868e75c8967/go.mod h1:z3IO9qO9E8wcUSVInWTOebJ0F8eG4FLqJNwIqtVOJug= github.com/ronaksoft/rony v0.12.28/go.mod h1:zFTRu/B1z4njwi28FfpyF9unZLfR3tr2gAy9PXu1vsA= github.com/ronaksoft/rony v0.12.29 h1:ePg45a5QZgczpGuwYcFb7Dr6M2nLgbR2C8c0VsYjIJ8= github.com/ronaksoft/rony v0.12.29/go.mod h1:zFTRu/B1z4njwi28FfpyF9unZLfR3tr2gAy9PXu1vsA= @@ -612,18 +601,15 @@ github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= -github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -642,8 +628,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= @@ -680,10 +666,10 @@ github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKn github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= -github.com/valyala/fasthttp v1.28.0 h1:ruVmTmZaBR5i67NqnjvvH5gEv0zwHfWtbjoyW98iho4= github.com/valyala/fasthttp v1.28.0/go.mod h1:cmWIqlu99AO/RKcp1HWaViTqc57FswJOfYYdPJBl8BA= +github.com/valyala/fasthttp v1.40.0 h1:CRq/00MfruPGFLTQKY8b+8SfdK60TxNztjRMnH0t1Yc= +github.com/valyala/fasthttp v1.40.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a h1:0R4NLDRDZX6JcmhJgXi5E4b8Wg84ihbmUKp/GvSPEzc= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= @@ -713,17 +699,14 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.8.0 h1:CUhrE4N1rqSE6FM9ecihEjRkLQu8cDfgDyoOs83mEY4= go.uber.org/atomic v1.8.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= -go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.7.0 h1:zaiO/rmgFjbmCXdSYJWQcdvOCsthmdaHfr3Gm2Kx4Ec= go.uber.org/multierr v1.7.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= @@ -743,6 +726,7 @@ golang.org/x/crypto v0.0.0-20191122220453-ac88ee75c92c/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -762,7 +746,6 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -771,7 +754,6 @@ golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mobile v0.0.0-20210527171505-7e972142eb43 h1:YfX4EDYuRrJhCu1S8M+jsXVoQj+koh5ZIwpI7bzeQ38= golang.org/x/mobile v0.0.0-20210527171505-7e972142eb43/go.mod h1:jFTmtFYCV0MFtXBU+J5V/+5AUeVS0ON/0WkE/KSrl6E= @@ -781,11 +763,11 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0 h1:8pl+sMODzuvGJkmj2W4kZihvVb5mKm8pB/X44PIQHv8= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -827,10 +809,12 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210510120150-4163338589ed h1:p9UgmWI9wKpfYmgaV/IZKGdXc5qEK45tDwwwDyjS26I= golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -851,11 +835,11 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -905,6 +889,7 @@ golang.org/x/sys v0.0.0-20200918174421-af09f7315aff/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -916,23 +901,30 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -992,14 +984,13 @@ golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.2 h1:kRBLX7v7Af8W7Gdbbc908OJcdgtK8bOz9Uaj8/F1ACA= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1102,10 +1093,10 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM= +google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/abiosoft/ishell.v2 v2.0.0 h1:/J5yh3nWYSSGFjALcitTI9CLE0Tu27vBYHX0srotqOc= gopkg.in/abiosoft/ishell.v2 v2.0.0/go.mod h1:sFp+cGtH6o4s1FtpVPTMcHq2yue+c4DGOVohJCPUzwY= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -1121,10 +1112,10 @@ gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/R gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.51.1 h1:GyboHr4UqMiLUybYjd22ZjQIKEJEpgtLXtuGbR21Oho= gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= +gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= @@ -1142,15 +1133,14 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/internal/ctrl_file/downloader.go b/internal/ctrl_file/downloader.go index 7709e294..af50b353 100644 --- a/internal/ctrl_file/downloader.go +++ b/internal/ctrl_file/downloader.go @@ -1,16 +1,17 @@ package fileCtrl import ( - "context" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/ctrl_file/executor" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "go.uber.org/zap" - "os" - "sync" + "context" + "os" + "sync" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/ctrl_file/executor" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -23,243 +24,243 @@ import ( */ type DownloadRequest struct { - msg.ClientFileRequest - ctrl *Controller - mtx sync.Mutex - file *os.File - parts chan int32 - done chan struct{} - progress int64 - finished bool + msg.ClientFileRequest + ctrl *Controller + mtx sync.Mutex + file *os.File + parts chan int32 + done chan struct{} + progress int64 + finished bool } func (d *DownloadRequest) isDownloaded(partIndex int32) bool { - d.mtx.Lock() - defer d.mtx.Unlock() - for _, index := range d.FinishedParts { - if partIndex == index { - return true - } - } - return false + d.mtx.Lock() + defer d.mtx.Unlock() + for _, index := range d.FinishedParts { + if partIndex == index { + return true + } + } + return false } func (d *DownloadRequest) addToDownloaded(partIndex int32) { - d.mtx.Lock() - d.FinishedParts = append(d.FinishedParts, partIndex) - progress := int64(float64(len(d.FinishedParts)) / float64(d.TotalParts) * 100) - skipOnProgress := false - if d.progress > progress { - skipOnProgress = true - } else { - d.progress = progress - } - d.mtx.Unlock() - saved, _ := repo.Files.SaveFileRequest(d.GetID(), &d.ClientFileRequest, true) - if saved && !d.SkipDelegateCall && !skipOnProgress { - d.ctrl.onProgressChanged(d.GetID(), d.ClusterID, d.FileID, int64(d.AccessHash), progress, d.PeerID) - } + d.mtx.Lock() + d.FinishedParts = append(d.FinishedParts, partIndex) + progress := int64(float64(len(d.FinishedParts)) / float64(d.TotalParts) * 100) + skipOnProgress := false + if d.progress > progress { + skipOnProgress = true + } else { + d.progress = progress + } + d.mtx.Unlock() + saved, _ := repo.Files.SaveFileRequest(d.GetID(), &d.ClientFileRequest, true) + if saved && !d.SkipDelegateCall && !skipOnProgress { + d.ctrl.onProgressChanged(d.GetID(), d.ClusterID, d.FileID, int64(d.AccessHash), progress, d.PeerID) + } } func (d *DownloadRequest) cancel(err error) { - if !d.SkipDelegateCall { - d.ctrl.onCancel(d.GetID(), d.ClusterID, d.FileID, int64(d.AccessHash), err != nil, d.PeerID) - } - _ = repo.Files.DeleteFileRequest(d.GetID()) + if !d.SkipDelegateCall { + d.ctrl.onCancel(d.GetID(), d.ClusterID, d.FileID, int64(d.AccessHash), err != nil, d.PeerID) + } + _ = repo.Files.DeleteFileRequest(d.GetID()) } func (d *DownloadRequest) complete() { - if !d.SkipDelegateCall { - d.ctrl.onCompleted(d.GetID(), d.ClusterID, d.FileID, int64(d.AccessHash), d.FilePath, d.PeerID) - } - _ = repo.Files.DeleteFileRequest(d.GetID()) + if !d.SkipDelegateCall { + d.ctrl.onCompleted(d.GetID(), d.ClusterID, d.FileID, int64(d.AccessHash), d.FilePath, d.PeerID) + } + _ = repo.Files.DeleteFileRequest(d.GetID()) } func (d *DownloadRequest) GetID() string { - return getRequestID(d.ClusterID, d.FileID, d.AccessHash) + return getRequestID(d.ClusterID, d.FileID, d.AccessHash) } func (d *DownloadRequest) Prepare() error { - logger.Info("prepare DownloadRequest", zap.String("ReqID", d.GetID())) - // Check temp file stat and if it does not exists, we create it - _, err := os.Stat(d.TempPath) - if err != nil { - if os.IsNotExist(err) { - d.file, err = os.Create(d.TempPath) - if err != nil { - d.cancel(err) - return err - } - } else { - d.cancel(err) - return err - } - } else { - d.file, err = os.OpenFile(d.TempPath, os.O_RDWR, 0666) - if err != nil { - d.cancel(err) - return err - } - } + logger.Info("prepare DownloadRequest", zap.String("ReqID", d.GetID())) + // Check temp file stat and if it does not exists, we create it + _, err := os.Stat(d.TempPath) + if err != nil { + if os.IsNotExist(err) { + d.file, err = os.Create(d.TempPath) + if err != nil { + d.cancel(err) + return err + } + } else { + d.cancel(err) + return err + } + } else { + d.file, err = os.OpenFile(d.TempPath, os.O_RDWR, 0666) + if err != nil { + d.cancel(err) + return err + } + } - // If the size is known, we truncate the temp file - if d.FileSize > 0 { - err := os.Truncate(d.TempPath, d.FileSize) - if err != nil { - d.cancel(err) - return err - } - dividend := int32(d.FileSize / int64(d.ChunkSize)) - if d.FileSize%int64(d.ChunkSize) > 0 { - d.TotalParts = dividend + 1 - } else { - d.TotalParts = dividend - } - } else { - d.TotalParts = 1 - d.ChunkSize = 0 - } + // If the size is known, we truncate the temp file + if d.FileSize > 0 { + err := os.Truncate(d.TempPath, d.FileSize) + if err != nil { + d.cancel(err) + return err + } + dividend := int32(d.FileSize / int64(d.ChunkSize)) + if d.FileSize%int64(d.ChunkSize) > 0 { + d.TotalParts = dividend + 1 + } else { + d.TotalParts = dividend + } + } else { + d.TotalParts = 1 + d.ChunkSize = 0 + } - // Reset FinishedParts if all parts are finished. Probably something went wrong, it is better to retry - if int32(len(d.FinishedParts)) == d.TotalParts { - d.FinishedParts = d.FinishedParts[:0] - } + // Reset FinishedParts if all parts are finished. Probably something went wrong, it is better to retry + if int32(len(d.FinishedParts)) == d.TotalParts { + d.FinishedParts = d.FinishedParts[:0] + } - // Prepare Channels to active the system dynamics - d.parts = make(chan int32, d.TotalParts) - d.done = make(chan struct{}, 1) - for partIndex := int32(0); partIndex < d.TotalParts; partIndex++ { - if d.isDownloaded(partIndex) { - continue - } - d.parts <- partIndex - } + // Prepare Channels to active the system dynamics + d.parts = make(chan int32, d.TotalParts) + d.done = make(chan struct{}, 1) + for partIndex := int32(0); partIndex < d.TotalParts; partIndex++ { + if d.isDownloaded(partIndex) { + continue + } + d.parts <- partIndex + } - logger.Debug("Download Prepared", - zap.String("ID", d.GetID()), - zap.Int32("TotalParts", d.TotalParts), - zap.Int32s("Finished", d.FinishedParts), - ) - return nil + logger.Debug("Download Prepared", + zap.String("ID", d.GetID()), + zap.Int32("TotalParts", d.TotalParts), + zap.Int32s("Finished", d.FinishedParts), + ) + return nil } func (d *DownloadRequest) NextAction() executor.Action { - // If request is canceled then return nil - if _, err := repo.Files.GetFileRequest(d.GetID()); err != nil { - logger.Warn("did not find DownloadRequest, we cancel it", zap.Error(err)) - return nil - } + // If request is canceled then return nil + if _, err := repo.Files.GetFileRequest(d.GetID()); err != nil { + logger.Warn("did not find DownloadRequest, we cancel it", zap.Error(err)) + return nil + } - // Wait for next part, or return nil if we finished - select { - case partID := <-d.parts: - return &DownloadAction{ - id: partID, - req: d, - } - case <-d.done: - return nil - } + // Wait for next part, or return nil if we finished + select { + case partID := <-d.parts: + return &DownloadAction{ + id: partID, + req: d, + } + case <-d.done: + return nil + } } func (d *DownloadRequest) ActionDone(id int32) { - logger.Info("finished download part", - zap.String("ReqID", d.GetID()), - zap.Int32("PartID", id), - zap.Int("FinishedParts", len(d.FinishedParts)), - zap.Int32("TotalParts", d.TotalParts), - ) + logger.Info("finished download part", + zap.String("ReqID", d.GetID()), + zap.Int32("PartID", id), + zap.Int("FinishedParts", len(d.FinishedParts)), + zap.Int32("TotalParts", d.TotalParts), + ) - if int32(len(d.FinishedParts)) == d.TotalParts { - if d.finished { - return - } - d.finished = true - d.done <- struct{}{} - _ = d.file.Close() - err := os.Rename(d.TempPath, d.FilePath) - if err != nil { - _ = os.Remove(d.TempPath) - d.cancel(err) - return - } - d.complete() - } + if int32(len(d.FinishedParts)) == d.TotalParts { + if d.finished { + return + } + d.finished = true + d.done <- struct{}{} + _ = d.file.Close() + err := os.Rename(d.TempPath, d.FilePath) + if err != nil { + _ = os.Remove(d.TempPath) + d.cancel(err) + return + } + d.complete() + } } func (d *DownloadRequest) Serialize() []byte { - b, err := d.Marshal() - if err != nil { - panic(err) - } - return b + b, err := d.Marshal() + if err != nil { + panic(err) + } + return b } func (d *DownloadRequest) Next() executor.Request { - // We don't support chained downloads, no need so far - return nil + // We don't support chained downloads, no need so far + return nil } type DownloadAction struct { - id int32 - req *DownloadRequest + id int32 + req *DownloadRequest } func (a *DownloadAction) ID() int32 { - return a.id + return a.id } func (a *DownloadAction) Do(ctx context.Context) { - offset := a.id * a.req.ChunkSize - ctx, cf := context.WithTimeout(ctx, domain.HttpRequestTimeout) - defer cf() - req := &msg.FileGet{ - Location: &msg.InputFileLocation{ - ClusterID: a.req.ClusterID, - FileID: a.req.FileID, - AccessHash: a.req.AccessHash, - Version: a.req.Version, - }, - Offset: offset, - Limit: a.req.ChunkSize, - } + offset := a.id * a.req.ChunkSize + ctx, cf := context.WithTimeout(ctx, domain.HttpRequestTimeout) + defer cf() + req := &msg.FileGet{ + Location: &msg.InputFileLocation{ + ClusterID: a.req.ClusterID, + FileID: a.req.FileID, + AccessHash: a.req.AccessHash, + Version: a.req.Version, + }, + Offset: offset, + Limit: a.req.ChunkSize, + } - reqCB := request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_FileGet, req, - func() { - a.req.parts <- a.id - }, - func(res *rony.MessageEnvelope) { - switch res.Constructor { - case msg.C_File: - file := &msg.File{} - err := file.Unmarshal(res.Message) - if err != nil { - logger.Warn("couldn't unmarshal server response FileGet (File), will retry ...", - zap.Error(err), - zap.Int32("Offset", offset), - zap.Int("Byte", len(file.Bytes)), - ) - a.req.parts <- a.id - return - } - _, err = a.req.file.WriteAt(file.Bytes, int64(offset)) - if err != nil { - logger.Error("couldn't write to file, will retry...", - zap.Error(err), - zap.Int32("Offset", offset), - zap.Int("Byte", len(file.Bytes)), - ) - a.req.parts <- a.id - return - } - a.req.addToDownloaded(a.id) - default: - a.req.parts <- a.id - return - } - }, nil, false, 0, domain.HttpRequestTimeout) - a.req.ctrl.network.HttpCommand(ctx, reqCB) + reqCB := request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_FileGet, req, + func() { + a.req.parts <- a.id + }, + func(res *rony.MessageEnvelope) { + switch res.Constructor { + case msg.C_File: + file := &msg.File{} + err := file.Unmarshal(res.Message) + if err != nil { + logger.Warn("couldn't unmarshal server response FileGet (File), will retry ...", + zap.Error(err), + zap.Int32("Offset", offset), + zap.Int("Byte", len(file.Bytes)), + ) + a.req.parts <- a.id + return + } + _, err = a.req.file.WriteAt(file.Bytes, int64(offset)) + if err != nil { + logger.Error("couldn't write to file, will retry...", + zap.Error(err), + zap.Int32("Offset", offset), + zap.Int("Byte", len(file.Bytes)), + ) + a.req.parts <- a.id + return + } + a.req.addToDownloaded(a.id) + default: + a.req.parts <- a.id + return + } + }, nil, false, 0, domain.HttpRequestTimeout) + a.req.ctrl.network.HttpCommand(ctx, reqCB) } diff --git a/internal/ctrl_file/executor/executor.go b/internal/ctrl_file/executor/executor.go index 4378ae9c..9feec87c 100644 --- a/internal/ctrl_file/executor/executor.go +++ b/internal/ctrl_file/executor/executor.go @@ -1,12 +1,13 @@ package executor import ( - "context" - "git.ronaksoft.com/river/sdk/internal/logs" - "github.com/beeker1121/goque" - "go.uber.org/zap" - "path/filepath" - "sync" + "context" + "path/filepath" + "sync" + + "github.com/beeker1121/goque" + "github.com/ronaksoft/river-sdk/internal/logs" + "go.uber.org/zap" ) /* @@ -19,168 +20,168 @@ import ( */ const ( - defaultConcurrentRequests = 5 - defaultConcurrentAction = 5 + defaultConcurrentRequests = 5 + defaultConcurrentAction = 5 ) type RequestFactoryFunc func(data []byte) Request type Executor struct { - name string - stack *goque.Stack - factory RequestFactoryFunc - logger *logs.Logger - - // internals - waitGroupsLock sync.Mutex - waitGroups map[string]*sync.WaitGroup - ctx context.Context - cf context.CancelFunc - rt chan struct{} - mtx sync.Mutex - running bool + name string + stack *goque.Stack + factory RequestFactoryFunc + logger *logs.Logger + + // internals + waitGroupsLock sync.Mutex + waitGroups map[string]*sync.WaitGroup + ctx context.Context + cf context.CancelFunc + rt chan struct{} + mtx sync.Mutex + running bool } func NewExecutor(dbPath string, name string, factory RequestFactoryFunc, opts ...Option) (*Executor, error) { - s, err := goque.OpenStack(filepath.Join(dbPath, name)) - if err != nil { - return nil, err - } - e := &Executor{ - stack: s, - name: name, - factory: factory, - rt: make(chan struct{}, defaultConcurrentRequests), - waitGroups: make(map[string]*sync.WaitGroup), - logger: logs.With("FileExecutor"), - } - e.ctx, e.cf = context.WithCancel(context.Background()) - - // Apply options - for _, opt := range opts { - opt(e) - } - - return e, nil + s, err := goque.OpenStack(filepath.Join(dbPath, name)) + if err != nil { + return nil, err + } + e := &Executor{ + stack: s, + name: name, + factory: factory, + rt: make(chan struct{}, defaultConcurrentRequests), + waitGroups: make(map[string]*sync.WaitGroup), + logger: logs.With("FileExecutor"), + } + e.ctx, e.cf = context.WithCancel(context.Background()) + + // Apply options + for _, opt := range opts { + opt(e) + } + + return e, nil } func (e *Executor) execute() { - for { - e.mtx.Lock() - if e.stack.Length() == 0 { - e.running = false - e.mtx.Unlock() - return - } - e.mtx.Unlock() - - // Pop the next request from the stack - stackItem, err := e.stack.Pop() - if err != nil { - e.logger.Fatal("got Serious Error", zap.Error(err)) - return - } - - // Check rate limit and if it is ok then run the job in background - e.rt <- struct{}{} - go func() { - defer func() { - <-e.rt - }() - - req := e.factory(stackItem.Value) - e.waitGroupsLock.Lock() - waitGroup := e.waitGroups[req.GetID()] - if waitGroup != nil { - delete(e.waitGroups, req.GetID()) - } - e.waitGroupsLock.Unlock() - - oWaitGroup := &sync.WaitGroup{} - // External loop over requests - for req != nil { - err := req.Prepare() - if err != nil { - e.logger.Warn("got error on Prepare", - zap.String("ReqID", req.GetID()), - zap.Error(err), - ) - req = req.Next() - continue - } - - oWaitGroup.Add(1) - go func(req Request) { - defer oWaitGroup.Done() - iMutex := sync.Mutex{} - iRateLimit := make(chan struct{}, defaultConcurrentAction) - iWaitGroup := sync.WaitGroup{} - // Run actions in a loop - for { - act := req.NextAction() - if act == nil { - // Wait for all actions to be done before going to next request - iWaitGroup.Wait() - break - } - iRateLimit <- struct{}{} - iWaitGroup.Add(1) - go func() { - act.Do(e.ctx) - iMutex.Lock() - req.ActionDone(act.ID()) - iMutex.Unlock() - iWaitGroup.Done() - <-iRateLimit - }() - } - }(req) - - // Goto next chained request - req = req.Next() - } - - // Wait for all chained requests to finish - oWaitGroup.Wait() - - // If there is a waiter for this request, then mark it done. - if waitGroup != nil { - waitGroup.Done() - } - - }() - } + for { + e.mtx.Lock() + if e.stack.Length() == 0 { + e.running = false + e.mtx.Unlock() + return + } + e.mtx.Unlock() + + // Pop the next request from the stack + stackItem, err := e.stack.Pop() + if err != nil { + e.logger.Fatal("got Serious Error", zap.Error(err)) + return + } + + // Check rate limit and if it is ok then run the job in background + e.rt <- struct{}{} + go func() { + defer func() { + <-e.rt + }() + + req := e.factory(stackItem.Value) + e.waitGroupsLock.Lock() + waitGroup := e.waitGroups[req.GetID()] + if waitGroup != nil { + delete(e.waitGroups, req.GetID()) + } + e.waitGroupsLock.Unlock() + + oWaitGroup := &sync.WaitGroup{} + // External loop over requests + for req != nil { + err := req.Prepare() + if err != nil { + e.logger.Warn("got error on Prepare", + zap.String("ReqID", req.GetID()), + zap.Error(err), + ) + req = req.Next() + continue + } + + oWaitGroup.Add(1) + go func(req Request) { + defer oWaitGroup.Done() + iMutex := sync.Mutex{} + iRateLimit := make(chan struct{}, defaultConcurrentAction) + iWaitGroup := sync.WaitGroup{} + // Run actions in a loop + for { + act := req.NextAction() + if act == nil { + // Wait for all actions to be done before going to next request + iWaitGroup.Wait() + break + } + iRateLimit <- struct{}{} + iWaitGroup.Add(1) + go func() { + act.Do(e.ctx) + iMutex.Lock() + req.ActionDone(act.ID()) + iMutex.Unlock() + iWaitGroup.Done() + <-iRateLimit + }() + } + }(req) + + // Goto next chained request + req = req.Next() + } + + // Wait for all chained requests to finish + oWaitGroup.Wait() + + // If there is a waiter for this request, then mark it done. + if waitGroup != nil { + waitGroup.Done() + } + + }() + } } // Execute pushes the request into the stack. This function is non-blocking. If you need a blocking call // you should use ExecuteAndWait function func (e *Executor) Execute(req Request) error { - _, err := e.stack.Push(req.Serialize()) - if err != nil { - return err - } - e.mtx.Lock() - if !e.running { - e.running = true - go e.execute() - } - e.mtx.Unlock() - return nil + _, err := e.stack.Push(req.Serialize()) + if err != nil { + return err + } + e.mtx.Lock() + if !e.running { + e.running = true + go e.execute() + } + e.mtx.Unlock() + return nil } // ExecuteAndWait accepts a waitGroup which its Done() function will be called when process is done func (e *Executor) ExecuteAndWait(waitGroup *sync.WaitGroup, req Request) error { - e.waitGroupsLock.Lock() - e.waitGroups[req.GetID()] = waitGroup - e.waitGroupsLock.Unlock() - return e.Execute(req) + e.waitGroupsLock.Lock() + e.waitGroups[req.GetID()] = waitGroup + e.waitGroupsLock.Unlock() + return e.Execute(req) } // Option to config Executor type Option func(e *Executor) func WithConcurrency(c int32) Option { - return func(e *Executor) { - e.rt = make(chan struct{}, c) - } + return func(e *Executor) { + e.rt = make(chan struct{}, c) + } } diff --git a/internal/ctrl_file/executor/executor_test.go b/internal/ctrl_file/executor/executor_test.go index e6b00efb..84e28465 100644 --- a/internal/ctrl_file/executor/executor_test.go +++ b/internal/ctrl_file/executor/executor_test.go @@ -1,16 +1,17 @@ package executor import ( - "context" - "encoding/json" - "git.ronaksoft.com/river/sdk/internal/testenv" - "github.com/ronaksoft/rony/tools" - . "github.com/smartystreets/goconvey/convey" - "go.uber.org/zap" - "os" - "sync" - "testing" - "time" + "context" + "encoding/json" + "os" + "sync" + "testing" + "time" + + "github.com/ronaksoft/river-sdk/internal/testenv" + "github.com/ronaksoft/rony/tools" + . "github.com/smartystreets/goconvey/convey" + "go.uber.org/zap" ) /* @@ -23,118 +24,118 @@ import ( */ type dummyAction struct { - id int32 - req *dummyRequest + id int32 + req *dummyRequest } func (d *dummyAction) ID() int32 { - return d.id + return d.id } func (d *dummyAction) Do(ctx context.Context) { - testenv.Log().Info("Do", - zap.String("ReqID", d.req.GetID()), - zap.Int32("ActionID", d.id), - ) + testenv.Log().Info("Do", + zap.String("ReqID", d.req.GetID()), + zap.Int32("ActionID", d.id), + ) } type dummyRequest struct { - ID string - chunks chan int32 - Done []int32 - NextReq *dummyRequest + ID string + chunks chan int32 + Done []int32 + NextReq *dummyRequest } func (d *dummyRequest) GetID() string { - return d.ID + return d.ID } func (d *dummyRequest) Prepare() error { - d.chunks = make(chan int32, 10) - d.Done = d.Done[:0] - for i := int32(0); i < 10; i++ { - d.chunks <- i - } - return nil + d.chunks = make(chan int32, 10) + d.Done = d.Done[:0] + for i := int32(0); i < 10; i++ { + d.chunks <- i + } + return nil } func (d *dummyRequest) NextAction() Action { - select { - case id := <-d.chunks: - return &dummyAction{ - id: id, - req: d, - } - default: - return nil - } + select { + case id := <-d.chunks: + return &dummyAction{ + id: id, + req: d, + } + default: + return nil + } } func (d *dummyRequest) ActionDone(id int32) { - d.Done = append(d.Done, id) - if len(d.chunks) == 0 { - testenv.Log().Info("Request Done", zap.String("ID", d.ID)) - } + d.Done = append(d.Done, id) + if len(d.chunks) == 0 { + testenv.Log().Info("Request Done", zap.String("ID", d.ID)) + } } func (d *dummyRequest) Serialize() []byte { - b, err := json.Marshal(d) - if err != nil { - panic(err) - } - return b + b, err := json.Marshal(d) + if err != nil { + panic(err) + } + return b } func (d *dummyRequest) Next() Request { - testenv.Log().Debug("Next", zap.Bool("Exists", d.NextReq != nil)) - if d.NextReq != nil { - *d = *d.NextReq - return d - } - return nil + testenv.Log().Debug("Next", zap.Bool("Exists", d.NextReq != nil)) + if d.NextReq != nil { + *d = *d.NextReq + return d + } + return nil } func init() { - testenv.Log().SetLogLevel(-1) + testenv.Log().SetLogLevel(-1) } func TestNewExecutor(t *testing.T) { - _ = os.MkdirAll("./_hdd", os.ModePerm) - e, err := NewExecutor("./_hdd", "dummy", - func(data []byte) Request { - r := &dummyRequest{} - err := json.Unmarshal(data, r) - if err != nil { - panic(err) - } - return r - }, - ) - if err != nil { - t.Fatal(err) - } - Convey("Executor", t, func(c C) { - Convey("Execute", func(c C) { - r := &dummyRequest{ - NextReq: &dummyRequest{}, - } - err = e.Execute(r) - c.So(err, ShouldBeNil) - - time.Sleep(time.Second * 3) - }) - Convey("ExecuteAndWait", func(c C) { - r := &dummyRequest{ - ID: tools.RandomID(32), - NextReq: &dummyRequest{}, - } - waitGroup := &sync.WaitGroup{} - waitGroup.Add(1) - err = e.ExecuteAndWait(waitGroup, r) - c.So(err, ShouldBeNil) - waitGroup.Wait() - - }) - - }) + _ = os.MkdirAll("./_hdd", os.ModePerm) + e, err := NewExecutor("./_hdd", "dummy", + func(data []byte) Request { + r := &dummyRequest{} + err := json.Unmarshal(data, r) + if err != nil { + panic(err) + } + return r + }, + ) + if err != nil { + t.Fatal(err) + } + Convey("Executor", t, func(c C) { + Convey("Execute", func(c C) { + r := &dummyRequest{ + NextReq: &dummyRequest{}, + } + err = e.Execute(r) + c.So(err, ShouldBeNil) + + time.Sleep(time.Second * 3) + }) + Convey("ExecuteAndWait", func(c C) { + r := &dummyRequest{ + ID: tools.RandomID(32), + NextReq: &dummyRequest{}, + } + waitGroup := &sync.WaitGroup{} + waitGroup.Add(1) + err = e.ExecuteAndWait(waitGroup, r) + c.So(err, ShouldBeNil) + waitGroup.Wait() + + }) + + }) } diff --git a/internal/ctrl_file/file.go b/internal/ctrl_file/file.go index 588aabfd..74b3cc20 100644 --- a/internal/ctrl_file/file.go +++ b/internal/ctrl_file/file.go @@ -1,21 +1,22 @@ package fileCtrl import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/ctrl_file/executor" - networkCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_network" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "io/ioutil" - "os" - "strings" - "sync" + "fmt" + "io/ioutil" + "os" + "strings" + "sync" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/ctrl_file/executor" + networkCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_network" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) /* @@ -27,415 +28,415 @@ import ( Copyright Ronak Software Group 2018 */ var ( - logger *logs.Logger + logger *logs.Logger ) func init() { - logger = logs.With("FileCtrl") + logger = logs.With("FileCtrl") } type Config struct { - Network *networkCtrl.Controller - MaxInflightDownloads int32 - MaxInflightUploads int32 - DbPath string - PostUploadProcessCB func(req *msg.ClientFileRequest) bool - ProgressChangedCB func(reqID string, clusterID int32, fileID, accessHash int64, percent int64, peerID int64) - CompletedCB func(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) - CancelCB func(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) + Network *networkCtrl.Controller + MaxInflightDownloads int32 + MaxInflightUploads int32 + DbPath string + PostUploadProcessCB func(req *msg.ClientFileRequest) bool + ProgressChangedCB func(reqID string, clusterID int32, fileID, accessHash int64, percent int64, peerID int64) + CompletedCB func(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) + CancelCB func(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) } type Controller struct { - network *networkCtrl.Controller - downloader *executor.Executor - uploader *executor.Executor - - // Callbacks - onProgressChanged func(reqID string, clusterID int32, fileID, accessHash int64, percent int64, peerID int64) - onCompleted func(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) - onCancel func(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) - postUploadProcess func(req *msg.ClientFileRequest) bool + network *networkCtrl.Controller + downloader *executor.Executor + uploader *executor.Executor + + // Callbacks + onProgressChanged func(reqID string, clusterID int32, fileID, accessHash int64, percent int64, peerID int64) + onCompleted func(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) + onCancel func(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) + postUploadProcess func(req *msg.ClientFileRequest) bool } func New(config Config) *Controller { - var ( - err error - ) - - ctrl := &Controller{ - network: config.Network, - postUploadProcess: config.PostUploadProcessCB, - } - - if config.CompletedCB == nil { - ctrl.onCompleted = func(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) {} - } else { - ctrl.onCompleted = config.CompletedCB - } - if config.ProgressChangedCB == nil { - ctrl.onProgressChanged = func(reqID string, clusterID int32, fileID, accessHash int64, percent int64, peerID int64) {} - } else { - ctrl.onProgressChanged = config.ProgressChangedCB - } - if config.CancelCB == nil { - ctrl.onCancel = func(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) {} - } else { - ctrl.onCancel = config.CancelCB - } - - ctrl.downloader, err = executor.NewExecutor(config.DbPath, "downloader", func(data []byte) executor.Request { - r := &DownloadRequest{ - ctrl: ctrl, - } - _ = r.Unmarshal(data) - return r - }, executor.WithConcurrency(config.MaxInflightDownloads)) - if err != nil { - logger.Fatal("got error on initializing uploader", zap.Error(err)) - } - - ctrl.uploader, err = executor.NewExecutor(config.DbPath, "uploader", func(data []byte) executor.Request { - r := &UploadRequest{ - cfr: &msg.ClientFileRequest{}, - ctrl: ctrl, - startTime: domain.Now(), - } - _ = r.cfr.Unmarshal(data) - return r - }, executor.WithConcurrency(config.MaxInflightUploads)) - if err != nil { - logger.Fatal("got error on initializing uploader", zap.Error(err)) - } - - return ctrl + var ( + err error + ) + + ctrl := &Controller{ + network: config.Network, + postUploadProcess: config.PostUploadProcessCB, + } + + if config.CompletedCB == nil { + ctrl.onCompleted = func(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) {} + } else { + ctrl.onCompleted = config.CompletedCB + } + if config.ProgressChangedCB == nil { + ctrl.onProgressChanged = func(reqID string, clusterID int32, fileID, accessHash int64, percent int64, peerID int64) {} + } else { + ctrl.onProgressChanged = config.ProgressChangedCB + } + if config.CancelCB == nil { + ctrl.onCancel = func(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) {} + } else { + ctrl.onCancel = config.CancelCB + } + + ctrl.downloader, err = executor.NewExecutor(config.DbPath, "downloader", func(data []byte) executor.Request { + r := &DownloadRequest{ + ctrl: ctrl, + } + _ = r.Unmarshal(data) + return r + }, executor.WithConcurrency(config.MaxInflightDownloads)) + if err != nil { + logger.Fatal("got error on initializing uploader", zap.Error(err)) + } + + ctrl.uploader, err = executor.NewExecutor(config.DbPath, "uploader", func(data []byte) executor.Request { + r := &UploadRequest{ + cfr: &msg.ClientFileRequest{}, + ctrl: ctrl, + startTime: domain.Now(), + } + _ = r.cfr.Unmarshal(data) + return r + }, executor.WithConcurrency(config.MaxInflightUploads)) + if err != nil { + logger.Fatal("got error on initializing uploader", zap.Error(err)) + } + + return ctrl } func (ctrl *Controller) Start() { - reqs, _ := repo.Files.GetAllFileRequests() - for _, req := range reqs { - _ = repo.Files.DeleteFileRequest(getRequestID(req.ClusterID, req.FileID, req.AccessHash)) - } + reqs, _ := repo.Files.GetAllFileRequests() + for _, req := range reqs { + _ = repo.Files.DeleteFileRequest(getRequestID(req.ClusterID, req.FileID, req.AccessHash)) + } } func (ctrl *Controller) Stop() { - // Nothing + // Nothing } func (ctrl *Controller) GetUploadRequest(fileID int64) *msg.ClientFileRequest { - return ctrl.GetRequest(0, fileID, 0) + return ctrl.GetRequest(0, fileID, 0) } func (ctrl *Controller) GetDownloadRequest(clusterID int32, fileID int64, accessHash uint64) *msg.ClientFileRequest { - return ctrl.GetRequest(clusterID, fileID, accessHash) + return ctrl.GetRequest(clusterID, fileID, accessHash) } func (ctrl *Controller) GetRequest(clusterID int32, fileID int64, accessHash uint64) *msg.ClientFileRequest { - req, err := repo.Files.GetFileRequest(getRequestID(clusterID, fileID, accessHash)) - if err != nil { - return nil - } - return req + req, err := repo.Files.GetFileRequest(getRequestID(clusterID, fileID, accessHash)) + if err != nil { + return nil + } + return req } func (ctrl *Controller) CancelUploadRequest(fileID int64) { - logger.Info("cancels UploadRequest", zap.Int64("FileID", fileID)) - ctrl.CancelRequest(getRequestID(0, fileID, 0)) + logger.Info("cancels UploadRequest", zap.Int64("FileID", fileID)) + ctrl.CancelRequest(getRequestID(0, fileID, 0)) } func (ctrl *Controller) CancelDownloadRequest(clusterID int32, fileID int64, accessHash uint64) { - logger.Info("cancels DownloadRequest", - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - ) - ctrl.CancelRequest(getRequestID(clusterID, fileID, accessHash)) + logger.Info("cancels DownloadRequest", + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + ) + ctrl.CancelRequest(getRequestID(clusterID, fileID, accessHash)) } func (ctrl *Controller) CancelRequest(reqID string) { - _ = repo.Files.DeleteFileRequest(reqID) + _ = repo.Files.DeleteFileRequest(reqID) } func (ctrl *Controller) DownloadAsync(clusterID int32, fileID int64, accessHash uint64, skipDelegates bool) (reqID string, err error) { - defer logger.RecoverPanic( - "FileCtrl::DownloadASync", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - "FileID": fileID, - "ClusterID": clusterID, - }, - nil, - ) - - clientFile, err := repo.Files.Get(clusterID, fileID, accessHash) - if err != nil { - return "", err - } - - err = ctrl.download(&DownloadRequest{ - ClientFileRequest: msg.ClientFileRequest{ - MessageID: clientFile.MessageID, - ClusterID: clientFile.ClusterID, - FileID: clientFile.FileID, - AccessHash: clientFile.AccessHash, - Version: clientFile.Version, - FileSize: clientFile.FileSize, - ChunkSize: DefaultChunkSize, - FilePath: repo.Files.GetFilePath(clientFile), - SkipDelegateCall: skipDelegates, - PeerID: clientFile.PeerID, - }, - }, false) - logger.WarnOnErr("Error On DownloadAsync", err, - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - zap.Uint64("AccessHash", accessHash), - ) - - return getRequestID(clusterID, fileID, accessHash), err + defer logger.RecoverPanic( + "FileCtrl::DownloadASync", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + "FileID": fileID, + "ClusterID": clusterID, + }, + nil, + ) + + clientFile, err := repo.Files.Get(clusterID, fileID, accessHash) + if err != nil { + return "", err + } + + err = ctrl.download(&DownloadRequest{ + ClientFileRequest: msg.ClientFileRequest{ + MessageID: clientFile.MessageID, + ClusterID: clientFile.ClusterID, + FileID: clientFile.FileID, + AccessHash: clientFile.AccessHash, + Version: clientFile.Version, + FileSize: clientFile.FileSize, + ChunkSize: DefaultChunkSize, + FilePath: repo.Files.GetFilePath(clientFile), + SkipDelegateCall: skipDelegates, + PeerID: clientFile.PeerID, + }, + }, false) + logger.WarnOnErr("Error On DownloadAsync", err, + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + zap.Uint64("AccessHash", accessHash), + ) + + return getRequestID(clusterID, fileID, accessHash), err } func (ctrl *Controller) DownloadSync(clusterID int32, fileID int64, accessHash uint64, skipDelegate bool) (filePath string, err error) { - defer logger.RecoverPanic( - "FileCtrl::DownloadSync", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - "FileID": fileID, - "ClusterID": clusterID, - }, - nil, - ) - - clientFile, err := repo.Files.Get(clusterID, fileID, accessHash) - if err != nil { - return "", err - } - filePath = repo.Files.GetFilePath(clientFile) - switch clientFile.Type { - case msg.ClientFileType_GroupProfilePhoto, msg.ClientFileType_AccountProfilePhoto, - msg.ClientFileType_Thumbnail, msg.ClientFileType_Wallpaper: - req := &msg.FileGet{ - Location: &msg.InputFileLocation{ - ClusterID: clientFile.ClusterID, - FileID: clientFile.FileID, - AccessHash: clientFile.AccessHash, - Version: clientFile.Version, - }, - Offset: 0, - Limit: 0, - } - err = tools.Try(RetryMaxAttempts, RetryWaitTime, func() error { - reqCB := request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_FileGet, req, - func() { - err = domain.ErrRequestTimeout - }, - func(res *rony.MessageEnvelope) { - switch res.Constructor { - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(res.Message) - err = x - case msg.C_File: - x := new(msg.File) - err = x.Unmarshal(res.Message) - if err != nil { - return - } - - // write to file path - err = ioutil.WriteFile(filePath, x.Bytes, 0666) - if err != nil { - return - } - - // save to DB - _ = repo.Files.Save(clientFile) - return - default: - err = domain.ErrServer - return - } - - }, - nil, false, 0, domain.HttpRequestTimeout, - ) - - ctrl.network.HttpCommand(nil, reqCB) - return err - }) - return filePath, err - default: - err = ctrl.download(&DownloadRequest{ - ClientFileRequest: msg.ClientFileRequest{ - MessageID: clientFile.MessageID, - ClusterID: clientFile.ClusterID, - FileID: clientFile.FileID, - AccessHash: clientFile.AccessHash, - Version: clientFile.Version, - FileSize: clientFile.FileSize, - ChunkSize: DefaultChunkSize, - FilePath: filePath, - SkipDelegateCall: skipDelegate, - PeerID: clientFile.PeerID, - }, - }, true) - } - - return + defer logger.RecoverPanic( + "FileCtrl::DownloadSync", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + "FileID": fileID, + "ClusterID": clusterID, + }, + nil, + ) + + clientFile, err := repo.Files.Get(clusterID, fileID, accessHash) + if err != nil { + return "", err + } + filePath = repo.Files.GetFilePath(clientFile) + switch clientFile.Type { + case msg.ClientFileType_GroupProfilePhoto, msg.ClientFileType_AccountProfilePhoto, + msg.ClientFileType_Thumbnail, msg.ClientFileType_Wallpaper: + req := &msg.FileGet{ + Location: &msg.InputFileLocation{ + ClusterID: clientFile.ClusterID, + FileID: clientFile.FileID, + AccessHash: clientFile.AccessHash, + Version: clientFile.Version, + }, + Offset: 0, + Limit: 0, + } + err = tools.Try(RetryMaxAttempts, RetryWaitTime, func() error { + reqCB := request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_FileGet, req, + func() { + err = domain.ErrRequestTimeout + }, + func(res *rony.MessageEnvelope) { + switch res.Constructor { + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(res.Message) + err = x + case msg.C_File: + x := new(msg.File) + err = x.Unmarshal(res.Message) + if err != nil { + return + } + + // write to file path + err = ioutil.WriteFile(filePath, x.Bytes, 0666) + if err != nil { + return + } + + // save to DB + _ = repo.Files.Save(clientFile) + return + default: + err = domain.ErrServer + return + } + + }, + nil, false, 0, domain.HttpRequestTimeout, + ) + + ctrl.network.HttpCommand(nil, reqCB) + return err + }) + return filePath, err + default: + err = ctrl.download(&DownloadRequest{ + ClientFileRequest: msg.ClientFileRequest{ + MessageID: clientFile.MessageID, + ClusterID: clientFile.ClusterID, + FileID: clientFile.FileID, + AccessHash: clientFile.AccessHash, + Version: clientFile.Version, + FileSize: clientFile.FileSize, + ChunkSize: DefaultChunkSize, + FilePath: filePath, + SkipDelegateCall: skipDelegate, + PeerID: clientFile.PeerID, + }, + }, true) + } + + return } func (ctrl *Controller) download(req *DownloadRequest, blocking bool) error { - logger.Info("received download request", - zap.Bool("Blocking", blocking), - zap.Int64("FileID", req.FileID), - zap.Uint64("AccessHash", req.AccessHash), - zap.Int64("Size", req.FileSize), - ) - - if req.ClusterID == 0 { - return domain.ErrInvalidData - } - _, err := repo.Files.GetFileRequest(getRequestID(req.ClusterID, req.FileID, req.AccessHash)) - if err == nil { - return domain.ErrAlreadyDownloading - } - - _, _ = repo.Files.SaveFileRequest( - getRequestID(req.ClusterID, req.FileID, req.AccessHash), - &req.ClientFileRequest, - false, - ) - - req.TempPath = fmt.Sprintf("%s.tmp", req.FilePath) - if blocking { - waitGroup := &sync.WaitGroup{} - waitGroup.Add(1) - err = ctrl.downloader.ExecuteAndWait(waitGroup, req) - if err != nil { - return err - } - waitGroup.Wait() - } else { - err = ctrl.downloader.Execute(req) - if err != nil { - return err - } - - } - - return nil + logger.Info("received download request", + zap.Bool("Blocking", blocking), + zap.Int64("FileID", req.FileID), + zap.Uint64("AccessHash", req.AccessHash), + zap.Int64("Size", req.FileSize), + ) + + if req.ClusterID == 0 { + return domain.ErrInvalidData + } + _, err := repo.Files.GetFileRequest(getRequestID(req.ClusterID, req.FileID, req.AccessHash)) + if err == nil { + return domain.ErrAlreadyDownloading + } + + _, _ = repo.Files.SaveFileRequest( + getRequestID(req.ClusterID, req.FileID, req.AccessHash), + &req.ClientFileRequest, + false, + ) + + req.TempPath = fmt.Sprintf("%s.tmp", req.FilePath) + if blocking { + waitGroup := &sync.WaitGroup{} + waitGroup.Add(1) + err = ctrl.downloader.ExecuteAndWait(waitGroup, req) + if err != nil { + return err + } + waitGroup.Wait() + } else { + err = ctrl.downloader.Execute(req) + if err != nil { + return err + } + + } + + return nil } func (ctrl *Controller) UploadUserPhoto(filePath string) (reqID string) { - filePath = strings.TrimPrefix(filePath, "file://") - fileID := domain.RandomInt63() - err := ctrl.upload(&msg.ClientFileRequest{ - IsProfilePhoto: true, - FileID: fileID, - FilePath: filePath, - PeerID: 0, - }) - logger.WarnOnErr("Error On UploadUserPhoto", err) - reqID = getRequestID(0, fileID, 0) - return + filePath = strings.TrimPrefix(filePath, "file://") + fileID := domain.RandomInt63() + err := ctrl.upload(&msg.ClientFileRequest{ + IsProfilePhoto: true, + FileID: fileID, + FilePath: filePath, + PeerID: 0, + }) + logger.WarnOnErr("Error On UploadUserPhoto", err) + reqID = getRequestID(0, fileID, 0) + return } func (ctrl *Controller) UploadGroupPhoto(groupID int64, filePath string) (reqID string) { - // support IOS file path - filePath = strings.TrimPrefix(filePath, "file://") - - fileID := domain.RandomInt63() - err := ctrl.upload(&msg.ClientFileRequest{ - IsProfilePhoto: true, - GroupID: groupID, - FileID: fileID, - FilePath: filePath, - PeerID: groupID, - }) - logger.WarnOnErr("Error On UploadGroupPhoto", err) - reqID = getRequestID(0, fileID, 0) - return + // support IOS file path + filePath = strings.TrimPrefix(filePath, "file://") + + fileID := domain.RandomInt63() + err := ctrl.upload(&msg.ClientFileRequest{ + IsProfilePhoto: true, + GroupID: groupID, + FileID: fileID, + FilePath: filePath, + PeerID: groupID, + }) + logger.WarnOnErr("Error On UploadGroupPhoto", err) + reqID = getRequestID(0, fileID, 0) + return } func (ctrl *Controller) UploadMessageDocument( - messageID int64, filePath, thumbPath string, fileID, thumbID int64, fileSha256 []byte, peerID int64, checkSha256 bool, + messageID int64, filePath, thumbPath string, fileID, thumbID int64, fileSha256 []byte, peerID int64, checkSha256 bool, ) { - defer logger.RecoverPanic( - "FileCtrl::UploadMessageDocument", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - "FilePath": filePath, - }, - nil, - ) - - if _, err := os.Stat(filePath); err != nil { - logger.Warn("got error on upload message document (thumbnail)", zap.Error(err)) - return - } - - if thumbPath != "" { - if _, err := os.Stat(thumbPath); err != nil { - logger.Warn("got error on upload message document (thumbnail)", zap.Error(err)) - return - } - } - - reqFile := &msg.ClientFileRequest{ - MessageID: messageID, - FileID: fileID, - FilePath: filePath, - ThumbID: thumbID, - ThumbPath: thumbPath, - FileSha256: fileSha256, - PeerID: peerID, - CheckSha256: checkSha256, - } - - // If there is a thumbnail then set the reqFile as the next - if thumbID != 0 { - reqFile = &msg.ClientFileRequest{ - Next: &msg.ClientFileRequest{ - MessageID: messageID, - FileID: fileID, - FilePath: filePath, - ThumbID: thumbID, - ThumbPath: thumbPath, - FileSha256: fileSha256, - PeerID: peerID, - CheckSha256: checkSha256, - }, - MessageID: 0, - FileID: thumbID, - FilePath: thumbPath, - SkipDelegateCall: true, - } - } - - err := ctrl.upload(reqFile) - if err != nil { - logger.WarnOnErr("Error On Upload Message Media", err, zap.Int64("FileID", reqFile.FileID)) - } + defer logger.RecoverPanic( + "FileCtrl::UploadMessageDocument", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + "FilePath": filePath, + }, + nil, + ) + + if _, err := os.Stat(filePath); err != nil { + logger.Warn("got error on upload message document (thumbnail)", zap.Error(err)) + return + } + + if thumbPath != "" { + if _, err := os.Stat(thumbPath); err != nil { + logger.Warn("got error on upload message document (thumbnail)", zap.Error(err)) + return + } + } + + reqFile := &msg.ClientFileRequest{ + MessageID: messageID, + FileID: fileID, + FilePath: filePath, + ThumbID: thumbID, + ThumbPath: thumbPath, + FileSha256: fileSha256, + PeerID: peerID, + CheckSha256: checkSha256, + } + + // If there is a thumbnail then set the reqFile as the next + if thumbID != 0 { + reqFile = &msg.ClientFileRequest{ + Next: &msg.ClientFileRequest{ + MessageID: messageID, + FileID: fileID, + FilePath: filePath, + ThumbID: thumbID, + ThumbPath: thumbPath, + FileSha256: fileSha256, + PeerID: peerID, + CheckSha256: checkSha256, + }, + MessageID: 0, + FileID: thumbID, + FilePath: thumbPath, + SkipDelegateCall: true, + } + } + + err := ctrl.upload(reqFile) + if err != nil { + logger.WarnOnErr("Error On Upload Message Media", err, zap.Int64("FileID", reqFile.FileID)) + } } func (ctrl *Controller) upload(req *msg.ClientFileRequest) error { - if req.ClusterID != 0 { - return domain.ErrInvalidData - } - if req.FilePath == "" { - return domain.ErrNoFilePath - } - - _, err := repo.Files.GetFileRequest(getRequestID(req.ClusterID, req.FileID, req.AccessHash)) - if err == nil { - return domain.ErrAlreadyUploading - } - - _, _ = repo.Files.SaveFileRequest( - getRequestID(0, req.FileID, 0), - req, - false, - ) - - err = ctrl.uploader.Execute(&UploadRequest{ - cfr: req, - startTime: domain.Now(), - }) - if err != nil { - return err - } - - return nil + if req.ClusterID != 0 { + return domain.ErrInvalidData + } + if req.FilePath == "" { + return domain.ErrNoFilePath + } + + _, err := repo.Files.GetFileRequest(getRequestID(req.ClusterID, req.FileID, req.AccessHash)) + if err == nil { + return domain.ErrAlreadyUploading + } + + _, _ = repo.Files.SaveFileRequest( + getRequestID(0, req.FileID, 0), + req, + false, + ) + + err = ctrl.uploader.Execute(&UploadRequest{ + cfr: req, + startTime: domain.Now(), + }) + if err != nil { + return err + } + + return nil } diff --git a/internal/ctrl_file/file_test.go b/internal/ctrl_file/file_test.go index 64b3d005..5d4c1f0a 100644 --- a/internal/ctrl_file/file_test.go +++ b/internal/ctrl_file/file_test.go @@ -1,26 +1,27 @@ package fileCtrl_test import ( - "crypto/md5" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - fileCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_file" - networkCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_network" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/testenv" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/tools" - . "github.com/smartystreets/goconvey/convey" - "github.com/valyala/tcplisten" - "go.uber.org/zap" - "hash" - "io/ioutil" - "net/http" - "net/http/httptest" - "sync" - "testing" - "time" + "crypto/md5" + "fmt" + "hash" + "io/ioutil" + "net/http" + "net/http/httptest" + "sync" + "testing" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + fileCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_file" + networkCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_network" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/testenv" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/tools" + . "github.com/smartystreets/goconvey/convey" + "github.com/valyala/tcplisten" + "go.uber.org/zap" ) /* @@ -33,342 +34,342 @@ import ( */ var ( - _Network *networkCtrl.Controller - _File *fileCtrl.Controller + _Network *networkCtrl.Controller + _File *fileCtrl.Controller - waitMapLock = sync.Mutex{} - waitMap = make(map[string]struct{}) - speedBytesPerSec = 1024 * 1024 - errRatePercent int + waitMapLock = sync.Mutex{} + waitMap = make(map[string]struct{}) + speedBytesPerSec = 1024 * 1024 + errRatePercent int ) func init() { - repo.MustInit("./_hdd/_db", true) - repo.SetRootFolders( - "_hdd/_data/audio", "_hdd/_data/file", "_hdd/_data/photo", - "_hdd/_data/video", "_hdd/_data/cache", - ) - _Network = networkCtrl.New(networkCtrl.Config{ - SeedHosts: []string{"127.0.0.1:8080"}, - HttpTimeout: 10 * time.Second, - }) - _File = fileCtrl.New(fileCtrl.Config{ - Network: _Network, - MaxInflightDownloads: 2, - MaxInflightUploads: 3, - DbPath: "./_hdd", - ProgressChangedCB: func(reqID string, clusterID int32, fileID, accessHash int64, percent int64, peerID int64) { - testenv.Log().Info("Progress Changed", zap.String("ReqID", reqID), zap.Int64("Percent", percent)) - }, - CancelCB: func(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) { - testenv.Log().Error("File Canceled", zap.String("ReqID", reqID), zap.Bool("HasError", hasError)) - waitMapLock.Lock() - delete(waitMap, fmt.Sprintf("%d.%d.%d", clusterID, fileID, accessHash)) - waitMapLock.Unlock() - }, - CompletedCB: func(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) { - testenv.Log().Info("OnComplete", zap.Int64("FileID", fileID)) - waitMapLock.Lock() - delete(waitMap, fmt.Sprintf("%d.%d.%d", clusterID, fileID, accessHash)) - waitMapLock.Unlock() - }, - PostUploadProcessCB: func(req *msg.ClientFileRequest) bool { - testenv.Log().Info("PostProcess", - zap.Any("TotalParts", req.TotalParts), - zap.Int32("ChunkSize", req.ChunkSize), - zap.Any("FilePath", req.FilePath), - zap.Any("FileID", req.FileID), - zap.Int64("ThumbID", req.ThumbID), - ) - waitMapLock.Lock() - delete(waitMap, fmt.Sprintf("%d.%d.%d", req.ClusterID, req.FileID, req.AccessHash)) - waitMapLock.Unlock() - return true + repo.MustInit("./_hdd/_db", true) + repo.SetRootFolders( + "_hdd/_data/audio", "_hdd/_data/file", "_hdd/_data/photo", + "_hdd/_data/video", "_hdd/_data/cache", + ) + _Network = networkCtrl.New(networkCtrl.Config{ + SeedHosts: []string{"127.0.0.1:8080"}, + HttpTimeout: 10 * time.Second, + }) + _File = fileCtrl.New(fileCtrl.Config{ + Network: _Network, + MaxInflightDownloads: 2, + MaxInflightUploads: 3, + DbPath: "./_hdd", + ProgressChangedCB: func(reqID string, clusterID int32, fileID, accessHash int64, percent int64, peerID int64) { + testenv.Log().Info("Progress Changed", zap.String("ReqID", reqID), zap.Int64("Percent", percent)) + }, + CancelCB: func(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) { + testenv.Log().Error("File Canceled", zap.String("ReqID", reqID), zap.Bool("HasError", hasError)) + waitMapLock.Lock() + delete(waitMap, fmt.Sprintf("%d.%d.%d", clusterID, fileID, accessHash)) + waitMapLock.Unlock() + }, + CompletedCB: func(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) { + testenv.Log().Info("OnComplete", zap.Int64("FileID", fileID)) + waitMapLock.Lock() + delete(waitMap, fmt.Sprintf("%d.%d.%d", clusterID, fileID, accessHash)) + waitMapLock.Unlock() + }, + PostUploadProcessCB: func(req *msg.ClientFileRequest) bool { + testenv.Log().Info("PostProcess", + zap.Any("TotalParts", req.TotalParts), + zap.Int32("ChunkSize", req.ChunkSize), + zap.Any("FilePath", req.FilePath), + zap.Any("FileID", req.FileID), + zap.Int64("ThumbID", req.ThumbID), + ) + waitMapLock.Lock() + delete(waitMap, fmt.Sprintf("%d.%d.%d", req.ClusterID, req.FileID, req.AccessHash)) + waitMapLock.Unlock() + return true - }, - }) - _File.Start() - testenv.Log().SetLogLevel(0) + }, + }) + _File.Start() + testenv.Log().SetLogLevel(0) - tcpConfig := new(tcplisten.Config) - s := httptest.NewUnstartedServer(server{ - mtx: &sync.Mutex{}, - uploadTracker: make(map[int64]map[int32]struct{}), - sha: make(map[int64]hash.Hash), - }) + tcpConfig := new(tcplisten.Config) + s := httptest.NewUnstartedServer(server{ + mtx: &sync.Mutex{}, + uploadTracker: make(map[int64]map[int32]struct{}), + sha: make(map[int64]hash.Hash), + }) - wg := sync.WaitGroup{} + wg := sync.WaitGroup{} - for i := 1; i < 10; i++ { - wg.Add(1) - go func(i int) { - err := repo.Files.Save(&msg.ClientFile{ - ClusterID: 1, - FileID: int64(i), - AccessHash: 10, - Type: msg.ClientFileType_Message, - MimeType: "video/mp4", - UserID: 0, - GroupID: 0, - FileSize: 1024000, - MessageID: int64(i), - PeerID: 0, - PeerType: 0, - Version: 0, - }) - if err != nil { - panic(err) - } - wg.Done() - }(i) - } - wg.Wait() + for i := 1; i < 10; i++ { + wg.Add(1) + go func(i int) { + err := repo.Files.Save(&msg.ClientFile{ + ClusterID: 1, + FileID: int64(i), + AccessHash: 10, + Type: msg.ClientFileType_Message, + MimeType: "video/mp4", + UserID: 0, + GroupID: 0, + FileSize: 1024000, + MessageID: int64(i), + PeerID: 0, + PeerType: 0, + Version: 0, + }) + if err != nil { + panic(err) + } + wg.Done() + }(i) + } + wg.Wait() - var err error - s.Listener, err = tcpConfig.NewListener("tcp4", ":8080") - if err != nil { - testenv.Log().Fatal(err.Error()) - } - s.Start() - time.Sleep(time.Second * 2) + var err error + s.Listener, err = tcpConfig.NewListener("tcp4", ":8080") + if err != nil { + testenv.Log().Fatal(err.Error()) + } + s.Start() + time.Sleep(time.Second * 2) } type server struct { - mtx *sync.Mutex - uploadTracker map[int64]map[int32]struct{} - sha map[int64]hash.Hash + mtx *sync.Mutex + uploadTracker map[int64]map[int32]struct{} + sha map[int64]hash.Hash } func (t server) ServeHTTP(httpRes http.ResponseWriter, httpReq *http.Request) { - body, _ := ioutil.ReadAll(httpReq.Body) + body, _ := ioutil.ReadAll(httpReq.Body) - time.Sleep(time.Duration(len(body)/(speedBytesPerSec*(tools.RandomInt(10)+1))) * time.Second) + time.Sleep(time.Duration(len(body)/(speedBytesPerSec*(tools.RandomInt(10)+1))) * time.Second) - if domain.RandomInt(100) > (100 - errRatePercent) { - httpRes.WriteHeader(http.StatusForbidden) - return - } + if domain.RandomInt(100) > (100 - errRatePercent) { + httpRes.WriteHeader(http.StatusForbidden) + return + } - protoIn := &msg.ProtoMessage{} - protoOut := &msg.ProtoMessage{} - in := &rony.MessageEnvelope{} - out := &rony.MessageEnvelope{} + protoIn := &msg.ProtoMessage{} + protoOut := &msg.ProtoMessage{} + in := &rony.MessageEnvelope{} + out := &rony.MessageEnvelope{} - _ = protoIn.Unmarshal(body) - _ = in.Unmarshal(protoIn.Payload) - switch in.Constructor { - case msg.C_FileGet: - req := &msg.FileGet{} - _ = req.Unmarshal(in.Message) - // testenv.Log().Info("FileGet", zap.Int32("Offset", httpReq.Offset), zap.Int32("Limit", httpReq.Limit)) - file := &msg.File{} - file.Bytes = make([]byte, req.Limit) - for i := int32(0); i < req.Limit-2; i++ { - file.Bytes[i] = 'X' - } - file.Bytes[req.Limit-2] = '\r' - file.Bytes[req.Limit-1] = '\n' + _ = protoIn.Unmarshal(body) + _ = in.Unmarshal(protoIn.Payload) + switch in.Constructor { + case msg.C_FileGet: + req := &msg.FileGet{} + _ = req.Unmarshal(in.Message) + // testenv.Log().Info("FileGet", zap.Int32("Offset", httpReq.Offset), zap.Int32("Limit", httpReq.Limit)) + file := &msg.File{} + file.Bytes = make([]byte, req.Limit) + for i := int32(0); i < req.Limit-2; i++ { + file.Bytes[i] = 'X' + } + file.Bytes[req.Limit-2] = '\r' + file.Bytes[req.Limit-1] = '\n' - out.Constructor = msg.C_File - out.Message, _ = file.Marshal() - protoOut.Payload, _ = out.Marshal() - b, _ := protoOut.Marshal() - _, _ = httpRes.Write(b) - case msg.C_FileSavePart: - req := &msg.FileSavePart{} - _ = req.Unmarshal(in.Message) - // testenv.Log().Info("SavePart:", zap.Int64("FileID", req.FileID), zap.Int32("PartID", req.PartID), zap.Int32("TotalParts", req.TotalParts)) - t.mtx.Lock() - if _, ok := t.uploadTracker[req.FileID]; !ok { - t.uploadTracker[req.FileID] = make(map[int32]struct{}) - t.sha[req.FileID] = md5.New() - } - t.uploadTracker[req.FileID][req.PartID] = struct{}{} - t.sha[req.FileID].Write(req.Bytes) - t.mtx.Unlock() - if req.PartID == req.TotalParts { - sum := int32(0) - t.mtx.Lock() - for partID := range t.uploadTracker[req.FileID] { - sum += partID - } - t.mtx.Unlock() - if sum != (req.TotalParts*(req.TotalParts+1))/2 { - out.Constructor = rony.C_Error - out.Message, _ = (&rony.Error{ - Code: msg.ErrCodeIncomplete, - Items: msg.ErrItemFileParts, - }).Marshal() - protoOut.Payload, _ = out.Marshal() - b, _ := protoOut.Marshal() - _, _ = httpRes.Write(b) - } - } - out.Constructor = msg.C_Bool - out.Message, _ = (&msg.Bool{}).Marshal() - protoOut.Payload, _ = out.Marshal() - b, _ := protoOut.Marshal() - _, _ = httpRes.Write(b) - } + out.Constructor = msg.C_File + out.Message, _ = file.Marshal() + protoOut.Payload, _ = out.Marshal() + b, _ := protoOut.Marshal() + _, _ = httpRes.Write(b) + case msg.C_FileSavePart: + req := &msg.FileSavePart{} + _ = req.Unmarshal(in.Message) + // testenv.Log().Info("SavePart:", zap.Int64("FileID", req.FileID), zap.Int32("PartID", req.PartID), zap.Int32("TotalParts", req.TotalParts)) + t.mtx.Lock() + if _, ok := t.uploadTracker[req.FileID]; !ok { + t.uploadTracker[req.FileID] = make(map[int32]struct{}) + t.sha[req.FileID] = md5.New() + } + t.uploadTracker[req.FileID][req.PartID] = struct{}{} + t.sha[req.FileID].Write(req.Bytes) + t.mtx.Unlock() + if req.PartID == req.TotalParts { + sum := int32(0) + t.mtx.Lock() + for partID := range t.uploadTracker[req.FileID] { + sum += partID + } + t.mtx.Unlock() + if sum != (req.TotalParts*(req.TotalParts+1))/2 { + out.Constructor = rony.C_Error + out.Message, _ = (&rony.Error{ + Code: msg.ErrCodeIncomplete, + Items: msg.ErrItemFileParts, + }).Marshal() + protoOut.Payload, _ = out.Marshal() + b, _ := protoOut.Marshal() + _, _ = httpRes.Write(b) + } + } + out.Constructor = msg.C_Bool + out.Message, _ = (&msg.Bool{}).Marshal() + protoOut.Payload, _ = out.Marshal() + b, _ := protoOut.Marshal() + _, _ = httpRes.Write(b) + } } func TestDownloadFileSync(t *testing.T) { - Convey("DownloadFile (Synced)", t, func(c C) { - wg := sync.WaitGroup{} + Convey("DownloadFile (Synced)", t, func(c C) { + wg := sync.WaitGroup{} - for i := 1; i < 5; i++ { - wg.Add(1) - go func(i int) { - clientFile, err := repo.Files.Get(1, int64(i), 10) - c.So(err, ShouldBeNil) - filePath, err := _File.DownloadSync(clientFile.ClusterID, clientFile.FileID, clientFile.AccessHash, false) - if err != domain.ErrAlreadyDownloading { - c.So(err, ShouldBeNil) - } - c.So(filePath, ShouldEqual, repo.Files.GetFilePath(clientFile)) - wg.Done() - }(i) - } - wg.Wait() - }) + for i := 1; i < 5; i++ { + wg.Add(1) + go func(i int) { + clientFile, err := repo.Files.Get(1, int64(i), 10) + c.So(err, ShouldBeNil) + filePath, err := _File.DownloadSync(clientFile.ClusterID, clientFile.FileID, clientFile.AccessHash, false) + if err != domain.ErrAlreadyDownloading { + c.So(err, ShouldBeNil) + } + c.So(filePath, ShouldEqual, repo.Files.GetFilePath(clientFile)) + wg.Done() + }(i) + } + wg.Wait() + }) } func TestDownloadFileASync(t *testing.T) { - Convey("DownloadFile (Async)", t, func(c C) { - for i := 5; i < 10; i++ { - clientFile, err := repo.Files.Get(1, int64(i), 10) - c.So(err, ShouldBeNil) - _, err = _File.DownloadAsync(clientFile.ClusterID, clientFile.FileID, clientFile.AccessHash, false) - c.So(err, ShouldBeNil) - } - }) + Convey("DownloadFile (Async)", t, func(c C) { + for i := 5; i < 10; i++ { + clientFile, err := repo.Files.Get(1, int64(i), 10) + c.So(err, ShouldBeNil) + _, err = _File.DownloadAsync(clientFile.ClusterID, clientFile.FileID, clientFile.AccessHash, false) + c.So(err, ShouldBeNil) + } + }) } func TestUpload(t *testing.T) { - Convey("Upload", t, func(c C) { - fileID := domain.RandomInt63() - msgID := domain.RandomInt63() - peerID := domain.RandomInt63() - Convey("Good Network", func(c C) { - Convey("Upload Big File (Good Network)", func(c C) { - c.Println() - waitMapLock.Lock() - waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} - waitMapLock.Unlock() - speedBytesPerSec = 1024 * 512 - _File.UploadMessageDocument(msgID, "./testdata/big", "", fileID, 0, nil, peerID, true) - }) - Convey("Upload Medium File (Good Network)", func(c C) { - c.Println() - waitMapLock.Lock() - waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} - waitMapLock.Unlock() - speedBytesPerSec = 1024 * 512 - _File.UploadMessageDocument(msgID, "./testdata/medium", "", fileID, 0, nil, peerID, true) - }) - for { - if len(waitMap) == 0 { - break - } - time.Sleep(time.Second) - } - }) - Convey("Bad Network", func(c C) { - Convey("Upload Big File (Bad Network)", func(c C) { - c.Println() - speedBytesPerSec = 1024 * 8 - errRatePercent = 0 - waitMapLock.Lock() - waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} - waitMapLock.Unlock() - _File.UploadMessageDocument(msgID, "./testdata/big", "", fileID, 0, nil, peerID, true) - }) - Convey("Upload Medium File (Bad Network)", func(c C) { - c.Println() - speedBytesPerSec = 8192 - errRatePercent = 0 - waitMapLock.Lock() - waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} - waitMapLock.Unlock() - _File.UploadMessageDocument(msgID, "./testdata/medium", "", fileID, 0, nil, peerID, true) - }) - for { - if len(waitMap) == 0 { - break - } - time.Sleep(time.Second) - } - }) - }) + Convey("Upload", t, func(c C) { + fileID := domain.RandomInt63() + msgID := domain.RandomInt63() + peerID := domain.RandomInt63() + Convey("Good Network", func(c C) { + Convey("Upload Big File (Good Network)", func(c C) { + c.Println() + waitMapLock.Lock() + waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} + waitMapLock.Unlock() + speedBytesPerSec = 1024 * 512 + _File.UploadMessageDocument(msgID, "./testdata/big", "", fileID, 0, nil, peerID, true) + }) + Convey("Upload Medium File (Good Network)", func(c C) { + c.Println() + waitMapLock.Lock() + waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} + waitMapLock.Unlock() + speedBytesPerSec = 1024 * 512 + _File.UploadMessageDocument(msgID, "./testdata/medium", "", fileID, 0, nil, peerID, true) + }) + for { + if len(waitMap) == 0 { + break + } + time.Sleep(time.Second) + } + }) + Convey("Bad Network", func(c C) { + Convey("Upload Big File (Bad Network)", func(c C) { + c.Println() + speedBytesPerSec = 1024 * 8 + errRatePercent = 0 + waitMapLock.Lock() + waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} + waitMapLock.Unlock() + _File.UploadMessageDocument(msgID, "./testdata/big", "", fileID, 0, nil, peerID, true) + }) + Convey("Upload Medium File (Bad Network)", func(c C) { + c.Println() + speedBytesPerSec = 8192 + errRatePercent = 0 + waitMapLock.Lock() + waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} + waitMapLock.Unlock() + _File.UploadMessageDocument(msgID, "./testdata/medium", "", fileID, 0, nil, peerID, true) + }) + for { + if len(waitMap) == 0 { + break + } + time.Sleep(time.Second) + } + }) + }) } func TestManyUpload(t *testing.T) { - Convey("Upload Many Files (Good Network)", t, func(c C) { - c.Println() - speedBytesPerSec = 1024 * 1024 - for i := 0; i < 20; i++ { - fileID := int64(i + 1) - thumbID := domain.RandomInt63() - msgID := int64(i + 1) - peerID := int64(i + 1) - waitMapLock.Lock() - waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} - waitMapLock.Unlock() - _File.UploadMessageDocument(msgID, "./testdata/big", "./testdata/small", fileID, thumbID, nil, peerID, false) - } - for { - testenv.Log().Info("WaitMap", zap.Int("Size", len(waitMap))) - if len(waitMap) == 0 { - break - } - time.Sleep(time.Second) - } - }) - Convey("Upload Many Files (Bad Network)", t, func(c C) { - c.Println() - speedBytesPerSec = 1024 * 128 - for i := 0; i < 10; i++ { - fileID := int64(i + 1) - msgID := int64(i + 1) - peerID := int64(i + 1) - waitMapLock.Lock() - waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} - waitMapLock.Unlock() - _File.UploadMessageDocument(msgID, "./testdata/big", "", fileID, 0, nil, peerID, true) - } - for { - testenv.Log().Info("WaitMap", zap.Int("Size", len(waitMap))) - if len(waitMap) == 0 { - break - } - time.Sleep(time.Second) - } - }) + Convey("Upload Many Files (Good Network)", t, func(c C) { + c.Println() + speedBytesPerSec = 1024 * 1024 + for i := 0; i < 20; i++ { + fileID := int64(i + 1) + thumbID := domain.RandomInt63() + msgID := int64(i + 1) + peerID := int64(i + 1) + waitMapLock.Lock() + waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} + waitMapLock.Unlock() + _File.UploadMessageDocument(msgID, "./testdata/big", "./testdata/small", fileID, thumbID, nil, peerID, false) + } + for { + testenv.Log().Info("WaitMap", zap.Int("Size", len(waitMap))) + if len(waitMap) == 0 { + break + } + time.Sleep(time.Second) + } + }) + Convey("Upload Many Files (Bad Network)", t, func(c C) { + c.Println() + speedBytesPerSec = 1024 * 128 + for i := 0; i < 10; i++ { + fileID := int64(i + 1) + msgID := int64(i + 1) + peerID := int64(i + 1) + waitMapLock.Lock() + waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} + waitMapLock.Unlock() + _File.UploadMessageDocument(msgID, "./testdata/big", "", fileID, 0, nil, peerID, true) + } + for { + testenv.Log().Info("WaitMap", zap.Int("Size", len(waitMap))) + if len(waitMap) == 0 { + break + } + time.Sleep(time.Second) + } + }) } func TestUploadWithThumbnail(t *testing.T) { - fileID := domain.RandomInt63() - thumbID := domain.RandomInt63() - msgID := domain.RandomInt63() - peerID := domain.RandomInt63() - Convey("Upload File With Thumbnail", t, func(c C) { - c.Println() - speedBytesPerSec = 1024 * 256 - waitMapLock.Lock() - waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} - waitMapLock.Unlock() - _File.UploadMessageDocument(msgID, "./testdata/small", "./testdata/small", fileID, thumbID, nil, peerID, true) - }) - for { - if len(waitMap) == 0 { - break - } - time.Sleep(time.Second) - } + fileID := domain.RandomInt63() + thumbID := domain.RandomInt63() + msgID := domain.RandomInt63() + peerID := domain.RandomInt63() + Convey("Upload File With Thumbnail", t, func(c C) { + c.Println() + speedBytesPerSec = 1024 * 256 + waitMapLock.Lock() + waitMap[fmt.Sprintf("%d.%d.%d", 0, fileID, 0)] = struct{}{} + waitMapLock.Unlock() + _File.UploadMessageDocument(msgID, "./testdata/small", "./testdata/small", fileID, thumbID, nil, peerID, true) + }) + for { + if len(waitMap) == 0 { + break + } + time.Sleep(time.Second) + } - time.Sleep(time.Second * 10) + time.Sleep(time.Second * 10) } diff --git a/internal/ctrl_file/statics.go b/internal/ctrl_file/statics.go index 2039be55..8dfd3a04 100644 --- a/internal/ctrl_file/statics.go +++ b/internal/ctrl_file/statics.go @@ -1,9 +1,10 @@ package fileCtrl import ( - "fmt" - mon "git.ronaksoft.com/river/sdk/internal/monitoring" - "math" + "fmt" + "math" + + mon "github.com/ronaksoft/river-sdk/internal/monitoring" ) /* @@ -16,24 +17,24 @@ import ( */ func bestChunkSize(fileSize int64) int32 { - if fileSize <= MaxChunkSize { - return DefaultChunkSize - } - minChunkSize := (fileSize / MaxParts) >> 10 - dataRate := mon.GetDataTransferRate() - if dataRate == 0 { - dataRate = chunkSizesKB[len(chunkSizesKB)-1] - } - max := int32(math.Max(float64(minChunkSize), float64(dataRate))) - for _, cs := range chunkSizesKB { - if max > cs { - continue - } - return cs << 10 - } - return chunkSizesKB[len(chunkSizesKB)-1] << 10 + if fileSize <= MaxChunkSize { + return DefaultChunkSize + } + minChunkSize := (fileSize / MaxParts) >> 10 + dataRate := mon.GetDataTransferRate() + if dataRate == 0 { + dataRate = chunkSizesKB[len(chunkSizesKB)-1] + } + max := int32(math.Max(float64(minChunkSize), float64(dataRate))) + for _, cs := range chunkSizesKB { + if max > cs { + continue + } + return cs << 10 + } + return chunkSizesKB[len(chunkSizesKB)-1] << 10 } func getRequestID(clusterID int32, fileID int64, accessHash uint64) string { - return fmt.Sprintf("%d.%d.%d", clusterID, fileID, accessHash) + return fmt.Sprintf("%d.%d.%d", clusterID, fileID, accessHash) } diff --git a/internal/ctrl_file/uploader.go b/internal/ctrl_file/uploader.go index caf3286c..3859f823 100644 --- a/internal/ctrl_file/uploader.go +++ b/internal/ctrl_file/uploader.go @@ -1,22 +1,23 @@ package fileCtrl import ( - "context" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/ctrl_file/executor" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/registry" - "go.uber.org/zap" - "io" - "os" - "sync" - "sync/atomic" - "time" + "context" + "fmt" + "io" + "os" + "sync" + "sync/atomic" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/ctrl_file/executor" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/registry" + "go.uber.org/zap" ) /* @@ -29,396 +30,396 @@ import ( */ type UploadRequest struct { - cfr *msg.ClientFileRequest - ctrl *Controller - mtx sync.Mutex - file *os.File - parts chan int32 - done chan struct{} - lastPartSent bool - progress int64 - failedActions int32 - startTime time.Time + cfr *msg.ClientFileRequest + ctrl *Controller + mtx sync.Mutex + file *os.File + parts chan int32 + done chan struct{} + lastPartSent bool + progress int64 + failedActions int32 + startTime time.Time } func (u *UploadRequest) checkSha256() (err error) { - req := &msg.FileGetBySha256{ - Sha256: u.cfr.FileSha256, - FileSize: int32(u.cfr.FileSize), - } - reqCB := request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_FileGetBySha256, req, - func() { - err = domain.ErrRequestTimeout - }, - func(res *rony.MessageEnvelope) { - switch res.Constructor { - case msg.C_FileLocation: - x := &msg.FileLocation{} - _ = x.Unmarshal(res.Message) - u.cfr.ClusterID = x.ClusterID - u.cfr.AccessHash = x.AccessHash - u.cfr.FileID = x.FileID - u.cfr.TotalParts = -1 // dirty hack, which queue.Start() knows the upload request is completed - return - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(res.Message) - err = x - } - }, - nil, false, 0, domain.HttpRequestTimeout, - ) - - u.ctrl.network.HttpCommand(nil, reqCB) - - return + req := &msg.FileGetBySha256{ + Sha256: u.cfr.FileSha256, + FileSize: int32(u.cfr.FileSize), + } + reqCB := request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_FileGetBySha256, req, + func() { + err = domain.ErrRequestTimeout + }, + func(res *rony.MessageEnvelope) { + switch res.Constructor { + case msg.C_FileLocation: + x := &msg.FileLocation{} + _ = x.Unmarshal(res.Message) + u.cfr.ClusterID = x.ClusterID + u.cfr.AccessHash = x.AccessHash + u.cfr.FileID = x.FileID + u.cfr.TotalParts = -1 // dirty hack, which queue.Start() knows the upload request is completed + return + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(res.Message) + err = x + } + }, + nil, false, 0, domain.HttpRequestTimeout, + ) + + u.ctrl.network.HttpCommand(nil, reqCB) + + return } func (u *UploadRequest) resetUploadedList() { - u.mtx.Lock() - u.cfr.FinishedParts = u.cfr.FinishedParts[:0] - u.mtx.Unlock() - - _, _ = repo.Files.SaveFileRequest(u.GetID(), u.cfr, false) - if !u.cfr.SkipDelegateCall { - u.ctrl.onProgressChanged(u.GetID(), 0, u.cfr.FileID, 0, 0, u.cfr.PeerID) - } + u.mtx.Lock() + u.cfr.FinishedParts = u.cfr.FinishedParts[:0] + u.mtx.Unlock() + + _, _ = repo.Files.SaveFileRequest(u.GetID(), u.cfr, false) + if !u.cfr.SkipDelegateCall { + u.ctrl.onProgressChanged(u.GetID(), 0, u.cfr.FileID, 0, 0, u.cfr.PeerID) + } } func (u *UploadRequest) isUploaded(partIndex int32) bool { - u.mtx.Lock() - defer u.mtx.Unlock() - for _, index := range u.cfr.FinishedParts { - if partIndex == index { - return true - } - } - return false + u.mtx.Lock() + defer u.mtx.Unlock() + for _, index := range u.cfr.FinishedParts { + if partIndex == index { + return true + } + } + return false } func (u *UploadRequest) addToUploaded(partIndex int32) { - if u.isUploaded(partIndex) { - return - } - u.mtx.Lock() - u.cfr.FinishedParts = append(u.cfr.FinishedParts, partIndex) - progress := int64(float64(len(u.cfr.FinishedParts)) / float64(u.cfr.TotalParts) * 100) - skipOnProgress := false - if u.progress > progress { - skipOnProgress = true - } else { - u.progress = progress - } - u.mtx.Unlock() - - saved, _ := repo.Files.SaveFileRequest(u.GetID(), u.cfr, true) - if saved && !u.cfr.SkipDelegateCall && !skipOnProgress { - u.ctrl.onProgressChanged(u.GetID(), 0, u.cfr.FileID, 0, progress, u.cfr.PeerID) - } + if u.isUploaded(partIndex) { + return + } + u.mtx.Lock() + u.cfr.FinishedParts = append(u.cfr.FinishedParts, partIndex) + progress := int64(float64(len(u.cfr.FinishedParts)) / float64(u.cfr.TotalParts) * 100) + skipOnProgress := false + if u.progress > progress { + skipOnProgress = true + } else { + u.progress = progress + } + u.mtx.Unlock() + + saved, _ := repo.Files.SaveFileRequest(u.GetID(), u.cfr, true) + if saved && !u.cfr.SkipDelegateCall && !skipOnProgress { + u.ctrl.onProgressChanged(u.GetID(), 0, u.cfr.FileID, 0, progress, u.cfr.PeerID) + } } func (u *UploadRequest) reset() { - // Reset failed counter - atomic.StoreInt32(&u.failedActions, 0) + // Reset failed counter + atomic.StoreInt32(&u.failedActions, 0) - // Reset the uploaded list - u.resetUploadedList() - u.progress = 0 + // Reset the uploaded list + u.resetUploadedList() + u.progress = 0 - if u.file != nil { - _ = u.file.Close() - } + if u.file != nil { + _ = u.file.Close() + } } func (u *UploadRequest) cancel(err error) { - _ = repo.Files.DeleteFileRequest(u.GetID()) - if !u.cfr.SkipDelegateCall { - u.ctrl.onCancel(u.GetID(), 0, u.cfr.FileID, 0, err != nil, u.cfr.PeerID) - } + _ = repo.Files.DeleteFileRequest(u.GetID()) + if !u.cfr.SkipDelegateCall { + u.ctrl.onCancel(u.GetID(), 0, u.cfr.FileID, 0, err != nil, u.cfr.PeerID) + } } func (u *UploadRequest) complete() { - _ = repo.Files.DeleteFileRequest(u.GetID()) - if !u.cfr.SkipDelegateCall { - u.ctrl.onCompleted(u.GetID(), 0, u.cfr.FileID, 0, u.cfr.FilePath, u.cfr.PeerID) - } + _ = repo.Files.DeleteFileRequest(u.GetID()) + if !u.cfr.SkipDelegateCall { + u.ctrl.onCompleted(u.GetID(), 0, u.cfr.FileID, 0, u.cfr.FilePath, u.cfr.PeerID) + } } func (u *UploadRequest) GetID() string { - return getRequestID(u.cfr.ClusterID, u.cfr.FileID, u.cfr.AccessHash) + return getRequestID(u.cfr.ClusterID, u.cfr.FileID, u.cfr.AccessHash) } func (u *UploadRequest) Prepare() error { - logger.Info("prepares UploadRequest", - zap.String("ReqID", u.GetID()), - zap.Duration("D", domain.Now().Sub(u.startTime)), - ) - st0 := domain.Now() - u.reset() - - // Check File stats and return error if any problem exists - fileInfo, err := os.Stat(u.cfr.FilePath) - if err != nil { - u.cancel(err) - return err - } else { - u.cfr.FileSize = fileInfo.Size() - if u.cfr.FileSize <= 0 { - err = domain.ErrInvalidData - u.cancel(err) - return err - } else if u.cfr.FileSize > MaxFileSizeAllowedSize { - err = domain.ErrFileTooLarge - u.cancel(err) - return err - } - } - - // If Sha256 exists in the request then we check server if this file has been already uploaded, if true, then - // we do not upload it again and we call postUploadProcess with the updated details - st1 := domain.Now() - if u.cfr.CheckSha256 && len(u.cfr.FileSha256) != 0 { - oldReqID := u.GetID() - err = u.checkSha256() - if err == nil { - logger.Info("detects the file already exists in the server", - zap.Int64("FileID", u.cfr.FileID), - zap.Int32("ClusterID", u.cfr.ClusterID), - ) - _ = repo.Files.DeleteFileRequest(oldReqID) - err = domain.ErrAlreadyUploaded - if !u.ctrl.postUploadProcess(u.cfr) { - err = domain.ErrInvalidData - u.cancel(err) - } - return err - } - } - st2 := domain.Now() - - // Open the file for read - u.file, err = os.OpenFile(u.cfr.FilePath, os.O_RDONLY, 0) - if err != nil { - u.cancel(err) - return err - } - - // If chunk size is not set recalculate it - if u.cfr.ChunkSize <= 0 { - u.cfr.ChunkSize = bestChunkSize(u.cfr.FileSize) - } - - // Calculate number of parts based on our chunk size - dividend := int32(u.cfr.FileSize / int64(u.cfr.ChunkSize)) - if u.cfr.FileSize%int64(u.cfr.ChunkSize) > 0 { - u.cfr.TotalParts = dividend + 1 - } else { - u.cfr.TotalParts = dividend - } - - // Reset FinishedParts if all parts are finished. Probably something went wrong, it is better to retry - if int32(len(u.cfr.FinishedParts)) == u.cfr.TotalParts { - u.cfr.FinishedParts = u.cfr.FinishedParts[:0] - } - - // Prepare Channels to active the system dynamics - u.parts = make(chan int32, u.cfr.TotalParts) - u.done = make(chan struct{}, 1) - maxPartIndex := u.cfr.TotalParts - 1 - if u.cfr.TotalParts == 1 { - maxPartIndex = u.cfr.TotalParts - } - for partIndex := int32(0); partIndex < maxPartIndex; partIndex++ { - if u.isUploaded(partIndex) { - continue - } - u.parts <- partIndex - } - - st3 := domain.Now() - logger.Debug("prepared UploadRequest", - zap.String("ReqID", u.GetID()), - zap.Duration("D", domain.Now().Sub(u.startTime)), - zap.Duration("CheckShaD", st2.Sub(st1)), - zap.Duration("PrepareD", st3.Sub(st0)), - zap.String("Progress", fmt.Sprintf("%d / %d", len(u.cfr.FinishedParts), u.cfr.TotalParts)), - ) - return nil + logger.Info("prepares UploadRequest", + zap.String("ReqID", u.GetID()), + zap.Duration("D", domain.Now().Sub(u.startTime)), + ) + st0 := domain.Now() + u.reset() + + // Check File stats and return error if any problem exists + fileInfo, err := os.Stat(u.cfr.FilePath) + if err != nil { + u.cancel(err) + return err + } else { + u.cfr.FileSize = fileInfo.Size() + if u.cfr.FileSize <= 0 { + err = domain.ErrInvalidData + u.cancel(err) + return err + } else if u.cfr.FileSize > MaxFileSizeAllowedSize { + err = domain.ErrFileTooLarge + u.cancel(err) + return err + } + } + + // If Sha256 exists in the request then we check server if this file has been already uploaded, if true, then + // we do not upload it again and we call postUploadProcess with the updated details + st1 := domain.Now() + if u.cfr.CheckSha256 && len(u.cfr.FileSha256) != 0 { + oldReqID := u.GetID() + err = u.checkSha256() + if err == nil { + logger.Info("detects the file already exists in the server", + zap.Int64("FileID", u.cfr.FileID), + zap.Int32("ClusterID", u.cfr.ClusterID), + ) + _ = repo.Files.DeleteFileRequest(oldReqID) + err = domain.ErrAlreadyUploaded + if !u.ctrl.postUploadProcess(u.cfr) { + err = domain.ErrInvalidData + u.cancel(err) + } + return err + } + } + st2 := domain.Now() + + // Open the file for read + u.file, err = os.OpenFile(u.cfr.FilePath, os.O_RDONLY, 0) + if err != nil { + u.cancel(err) + return err + } + + // If chunk size is not set recalculate it + if u.cfr.ChunkSize <= 0 { + u.cfr.ChunkSize = bestChunkSize(u.cfr.FileSize) + } + + // Calculate number of parts based on our chunk size + dividend := int32(u.cfr.FileSize / int64(u.cfr.ChunkSize)) + if u.cfr.FileSize%int64(u.cfr.ChunkSize) > 0 { + u.cfr.TotalParts = dividend + 1 + } else { + u.cfr.TotalParts = dividend + } + + // Reset FinishedParts if all parts are finished. Probably something went wrong, it is better to retry + if int32(len(u.cfr.FinishedParts)) == u.cfr.TotalParts { + u.cfr.FinishedParts = u.cfr.FinishedParts[:0] + } + + // Prepare Channels to active the system dynamics + u.parts = make(chan int32, u.cfr.TotalParts) + u.done = make(chan struct{}, 1) + maxPartIndex := u.cfr.TotalParts - 1 + if u.cfr.TotalParts == 1 { + maxPartIndex = u.cfr.TotalParts + } + for partIndex := int32(0); partIndex < maxPartIndex; partIndex++ { + if u.isUploaded(partIndex) { + continue + } + u.parts <- partIndex + } + + st3 := domain.Now() + logger.Debug("prepared UploadRequest", + zap.String("ReqID", u.GetID()), + zap.Duration("D", domain.Now().Sub(u.startTime)), + zap.Duration("CheckShaD", st2.Sub(st1)), + zap.Duration("PrepareD", st3.Sub(st0)), + zap.String("Progress", fmt.Sprintf("%d / %d", len(u.cfr.FinishedParts), u.cfr.TotalParts)), + ) + return nil } func (u *UploadRequest) NextAction() executor.Action { - // If request is canceled then return nil - if _, err := repo.Files.GetFileRequest(u.GetID()); err != nil { - logger.Warn("did not find UploadRequest, we cancel it", zap.Error(err)) - return nil - } - - // Wait for next part, or return nil if we finished - select { - case partID := <-u.parts: - logger.Debug("got next upload part", - zap.String("ReqID", u.GetID()), - zap.Int32("PartID", partID), - zap.Duration("D", domain.Now().Sub(u.startTime)), - ) - return &UploadAction{ - id: partID, - req: u, - } - case <-u.done: - return nil - } + // If request is canceled then return nil + if _, err := repo.Files.GetFileRequest(u.GetID()); err != nil { + logger.Warn("did not find UploadRequest, we cancel it", zap.Error(err)) + return nil + } + + // Wait for next part, or return nil if we finished + select { + case partID := <-u.parts: + logger.Debug("got next upload part", + zap.String("ReqID", u.GetID()), + zap.Int32("PartID", partID), + zap.Duration("D", domain.Now().Sub(u.startTime)), + ) + return &UploadAction{ + id: partID, + req: u, + } + case <-u.done: + return nil + } } func (u *UploadRequest) ActionDone(id int32) { - logger.Info("finished upload part", - zap.String("ID", u.GetID()), - zap.Int32("PartID", id), - zap.Duration("D", domain.Now().Sub(u.startTime)), - zap.String("Progress", fmt.Sprintf("%d / %d", len(u.cfr.FinishedParts), u.cfr.TotalParts)), - ) - // If we have failed too many times, and we can decrease the chunk size the we do it again. - if atomic.LoadInt32(&u.failedActions) > RetryMaxAttempts { - atomic.StoreInt32(&u.failedActions, 0) - logger.Debug("Max Attempts", - zap.Int32("ChunkSize", u.cfr.ChunkSize), - ) - } - - // For single part uploads we are done - // For n-part uploads if we have done n-1 part then we add the last part - finishedParts := int32(len(u.cfr.FinishedParts)) - switch u.cfr.TotalParts { - case 1: - if finishedParts != u.cfr.TotalParts { - return - } - default: - switch { - case finishedParts < u.cfr.TotalParts-1: - return - case finishedParts == u.cfr.TotalParts-1: - if u.lastPartSent { - return - } - u.lastPartSent = true - u.parts <- u.cfr.TotalParts - 1 - return - } - } - - // This is last part so we make the executor free to run the next job if exist - u.done <- struct{}{} - _ = u.file.Close() - - // Run the post process - if !u.ctrl.postUploadProcess(u.cfr) { - u.cancel(domain.ErrNoPostProcess) - return - } - - // Clean up - u.complete() + logger.Info("finished upload part", + zap.String("ID", u.GetID()), + zap.Int32("PartID", id), + zap.Duration("D", domain.Now().Sub(u.startTime)), + zap.String("Progress", fmt.Sprintf("%d / %d", len(u.cfr.FinishedParts), u.cfr.TotalParts)), + ) + // If we have failed too many times, and we can decrease the chunk size the we do it again. + if atomic.LoadInt32(&u.failedActions) > RetryMaxAttempts { + atomic.StoreInt32(&u.failedActions, 0) + logger.Debug("Max Attempts", + zap.Int32("ChunkSize", u.cfr.ChunkSize), + ) + } + + // For single part uploads we are done + // For n-part uploads if we have done n-1 part then we add the last part + finishedParts := int32(len(u.cfr.FinishedParts)) + switch u.cfr.TotalParts { + case 1: + if finishedParts != u.cfr.TotalParts { + return + } + default: + switch { + case finishedParts < u.cfr.TotalParts-1: + return + case finishedParts == u.cfr.TotalParts-1: + if u.lastPartSent { + return + } + u.lastPartSent = true + u.parts <- u.cfr.TotalParts - 1 + return + } + } + + // This is last part so we make the executor free to run the next job if exist + u.done <- struct{}{} + _ = u.file.Close() + + // Run the post process + if !u.ctrl.postUploadProcess(u.cfr) { + u.cancel(domain.ErrNoPostProcess) + return + } + + // Clean up + u.complete() } func (u *UploadRequest) Serialize() []byte { - b, err := u.cfr.Marshal() - if err != nil { - panic(err) - } - return b + b, err := u.cfr.Marshal() + if err != nil { + panic(err) + } + return b } func (u *UploadRequest) Next() executor.Request { - // If the request has a chained request then we swap them and reset the progress - if u.cfr.Next == nil { - return nil - } - - u2 := &UploadRequest{ - cfr: u.cfr.Next, - ctrl: u.ctrl, - startTime: u.startTime, - } - - return u2 + // If the request has a chained request then we swap them and reset the progress + if u.cfr.Next == nil { + return nil + } + + u2 := &UploadRequest{ + cfr: u.cfr.Next, + ctrl: u.ctrl, + startTime: u.startTime, + } + + return u2 } type UploadAction struct { - id int32 - req *UploadRequest + id int32 + req *UploadRequest } func (a *UploadAction) ID() int32 { - return a.id + return a.id } func (a *UploadAction) Do(ctx context.Context) { - startTime := domain.Now() - - bytes := pools.Bytes.GetLen(int(a.req.cfr.ChunkSize)) - defer pools.Bytes.Put(bytes) - - // Calculate offset based on chunk id and the chunk size - offset := a.id * a.req.cfr.ChunkSize - - // We try to read the chunk, if it failed we try one more time - n, err := a.req.file.ReadAt(bytes, int64(offset)) - if err != nil && err != io.EOF { - logger.Warn("got error in ReadFile (Upload)", zap.Error(err)) - a.req.parts <- a.id - return - } - - // If we read 0 bytes then something is wrong - if n == 0 { - logger.Fatal("read zero bytes from file", - zap.String("FilePath", a.req.cfr.FilePath), - zap.Int32("TotalParts", a.req.cfr.TotalParts), - zap.Int32("ChunkSize", a.req.cfr.ChunkSize), - ) - } - - req := &msg.FileSavePart{ - TotalParts: a.req.cfr.TotalParts, - Bytes: bytes[:n], - FileID: a.req.cfr.FileID, - PartID: a.id + 1, - } - reqCB := request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_FileSavePart, req, - func() { - atomic.AddInt32(&a.req.failedActions, 1) - a.req.parts <- a.id - }, - func(res *rony.MessageEnvelope) { - switch res.Constructor { - case msg.C_Bool: - a.req.addToUploaded(a.id) - logger.Debug("upload action done", - zap.String("ID", a.req.GetID()), - zap.Int32("PartID", a.ID()), - zap.Duration("D", domain.Now().Sub(startTime)), - ) - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(res.Message) - logger.Warn("received Error response (Upload)", - zap.Int32("PartID", a.id+1), - zap.String("Code", x.Code), - zap.String("Item", x.Items), - ) - atomic.AddInt32(&a.req.failedActions, 1) - a.req.parts <- a.id - default: - logger.Fatal("received unexpected response (Upload)", zap.String("C", registry.ConstructorName(res.Constructor))) - return - } - }, - nil, false, 0, domain.HttpRequestTimeout, - ) - - a.req.ctrl.network.HttpCommand(nil, reqCB) + startTime := domain.Now() + + bytes := pools.Bytes.GetLen(int(a.req.cfr.ChunkSize)) + defer pools.Bytes.Put(bytes) + + // Calculate offset based on chunk id and the chunk size + offset := a.id * a.req.cfr.ChunkSize + + // We try to read the chunk, if it failed we try one more time + n, err := a.req.file.ReadAt(bytes, int64(offset)) + if err != nil && err != io.EOF { + logger.Warn("got error in ReadFile (Upload)", zap.Error(err)) + a.req.parts <- a.id + return + } + + // If we read 0 bytes then something is wrong + if n == 0 { + logger.Fatal("read zero bytes from file", + zap.String("FilePath", a.req.cfr.FilePath), + zap.Int32("TotalParts", a.req.cfr.TotalParts), + zap.Int32("ChunkSize", a.req.cfr.ChunkSize), + ) + } + + req := &msg.FileSavePart{ + TotalParts: a.req.cfr.TotalParts, + Bytes: bytes[:n], + FileID: a.req.cfr.FileID, + PartID: a.id + 1, + } + reqCB := request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_FileSavePart, req, + func() { + atomic.AddInt32(&a.req.failedActions, 1) + a.req.parts <- a.id + }, + func(res *rony.MessageEnvelope) { + switch res.Constructor { + case msg.C_Bool: + a.req.addToUploaded(a.id) + logger.Debug("upload action done", + zap.String("ID", a.req.GetID()), + zap.Int32("PartID", a.ID()), + zap.Duration("D", domain.Now().Sub(startTime)), + ) + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(res.Message) + logger.Warn("received Error response (Upload)", + zap.Int32("PartID", a.id+1), + zap.String("Code", x.Code), + zap.String("Item", x.Items), + ) + atomic.AddInt32(&a.req.failedActions, 1) + a.req.parts <- a.id + default: + logger.Fatal("received unexpected response (Upload)", zap.String("C", registry.ConstructorName(res.Constructor))) + return + } + }, + nil, false, 0, domain.HttpRequestTimeout, + ) + + a.req.ctrl.network.HttpCommand(nil, reqCB) } diff --git a/internal/ctrl_network/network.go b/internal/ctrl_network/network.go index 60bc754d..756a3453 100644 --- a/internal/ctrl_network/network.go +++ b/internal/ctrl_network/network.go @@ -1,257 +1,258 @@ package networkCtrl import ( - "context" - "encoding/binary" - "encoding/hex" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - mon "git.ronaksoft.com/river/sdk/internal/monitoring" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/internal/salt" - "github.com/gobwas/ws" - "github.com/gobwas/ws/wsutil" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/registry" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "google.golang.org/protobuf/proto" - "io/ioutil" - "net" - "net/http" - "sort" - "strings" - "sync" - "sync/atomic" - "time" + "context" + "encoding/binary" + "encoding/hex" + "fmt" + "io/ioutil" + "net" + "net/http" + "sort" + "strings" + "sync" + "sync/atomic" + "time" + + "github.com/gobwas/ws" + "github.com/gobwas/ws/wsutil" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + mon "github.com/ronaksoft/river-sdk/internal/monitoring" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/internal/salt" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/registry" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" ) var ( - logger *logs.Logger - dnsServers = []string{ - "8.8.8.8:53", "1.1.1.1:53", "9.9.9.9:53", "185.228.168.168:53", - } + logger *logs.Logger + dnsServers = []string{ + "8.8.8.8:53", "1.1.1.1:53", "9.9.9.9:53", "185.228.168.168:53", + } ) func init() { - logger = logs.With("NetCtrl") + logger = logs.With("NetCtrl") } // Config network controller config type Config struct { - SeedHosts []string - HttpTimeout time.Duration - CountryCode string - DumpData bool - DumpPath string + SeedHosts []string + HttpTimeout time.Duration + CountryCode string + DumpData bool + DumpPath string } // Controller websocket network controller type Controller struct { - // Authorization Keys - authID int64 - authKey []byte - authRecalled int32 // atomic boolean for checking if AuthRecall is sent - messageSeq int64 - sessionSeq int64 - endPoints []string - curEndpoint string - curEndpointIP string - - // Websocket Settings - wsWriteLock sync.Mutex - wsDialer *ws.Dialer - wsKeepConnection bool - wsConn net.Conn - wsPingsMtx sync.Mutex - wsPings map[uint64]chan struct{} - wsQuality int32 // atomic network quality switch - - // Http Settings - httpClient *http.Client - - // External Handlers - OnGeneralError domain.ErrorHandler - OnWebsocketConnect domain.OnConnectCallback - OnNetworkStatusChange domain.NetworkStatusChangeCallback - - // External Processors - MessageChan chan []*rony.MessageEnvelope - UpdateChan chan *msg.UpdateContainer - - // internals - connectChannel chan bool - stopChannel chan bool - unauthorizedRequests map[int64]bool // requests that it should sent unencrypted - countryCode string // the country - sendRoutines map[string]*tools.FlusherPool + // Authorization Keys + authID int64 + authKey []byte + authRecalled int32 // atomic boolean for checking if AuthRecall is sent + messageSeq int64 + sessionSeq int64 + endPoints []string + curEndpoint string + curEndpointIP string + + // Websocket Settings + wsWriteLock sync.Mutex + wsDialer *ws.Dialer + wsKeepConnection bool + wsConn net.Conn + wsPingsMtx sync.Mutex + wsPings map[uint64]chan struct{} + wsQuality int32 // atomic network quality switch + + // Http Settings + httpClient *http.Client + + // External Handlers + OnGeneralError domain.ErrorHandler + OnWebsocketConnect domain.OnConnectCallback + OnNetworkStatusChange domain.NetworkStatusChangeCallback + + // External Processors + MessageChan chan []*rony.MessageEnvelope + UpdateChan chan *msg.UpdateContainer + + // internals + connectChannel chan bool + stopChannel chan bool + unauthorizedRequests map[int64]bool // requests that it should sent unencrypted + countryCode string // the country + sendRoutines map[string]*tools.FlusherPool } // New constructs the network controller func New(config Config) *Controller { - ctrl := &Controller{ - wsPings: make(map[uint64]chan struct{}), - endPoints: config.SeedHosts, - countryCode: strings.ToUpper(config.CountryCode), - wsKeepConnection: true, - stopChannel: make(chan bool, 1), - connectChannel: make(chan bool), - } - - if config.HttpTimeout == 0 { - config.HttpTimeout = domain.HttpRequestTimeout - } - - ctrl.createWebsocketDialer(domain.WebsocketDialTimeout) - ctrl.createHttpClient(config.HttpTimeout) - ctrl.sendRoutines = map[string]*tools.FlusherPool{ - "Messages": tools.NewFlusherPool(1, 250, ctrl.sendFlushFunc), - "General": tools.NewFlusherPool(3, 250, ctrl.sendFlushFunc), - "Batch": tools.NewFlusherPoolWithWaitTime(1, 250, 250*time.Millisecond, ctrl.sendFlushFunc), - } - ctrl.unauthorizedRequests = map[int64]bool{ - msg.C_SystemGetServerTime: true, - msg.C_InitConnect: true, - msg.C_InitCompleteAuth: true, - msg.C_SystemGetSalts: true, - } - - return ctrl + ctrl := &Controller{ + wsPings: make(map[uint64]chan struct{}), + endPoints: config.SeedHosts, + countryCode: strings.ToUpper(config.CountryCode), + wsKeepConnection: true, + stopChannel: make(chan bool, 1), + connectChannel: make(chan bool), + } + + if config.HttpTimeout == 0 { + config.HttpTimeout = domain.HttpRequestTimeout + } + + ctrl.createWebsocketDialer(domain.WebsocketDialTimeout) + ctrl.createHttpClient(config.HttpTimeout) + ctrl.sendRoutines = map[string]*tools.FlusherPool{ + "Messages": tools.NewFlusherPool(1, 250, ctrl.sendFlushFunc), + "General": tools.NewFlusherPool(3, 250, ctrl.sendFlushFunc), + "Batch": tools.NewFlusherPoolWithWaitTime(1, 250, 250*time.Millisecond, ctrl.sendFlushFunc), + } + ctrl.unauthorizedRequests = map[int64]bool{ + msg.C_SystemGetServerTime: true, + msg.C_InitConnect: true, + msg.C_InitCompleteAuth: true, + msg.C_SystemGetSalts: true, + } + + return ctrl } func (ctrl *Controller) createWebsocketDialer(timeout time.Duration) { - ctrl.wsDialer = &ws.Dialer{ - ReadBufferSize: 32 * 1024, // 32kB - WriteBufferSize: 32 * 1024, // 32kB - Timeout: timeout, - NetDial: func(ctx context.Context, network, addr string) (conn net.Conn, err error) { - host, port, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - d := net.Dialer{Timeout: timeout} - if ctrl.curEndpointIP != "" { - conn, err = d.DialContext(ctx, "tcp4", net.JoinHostPort(ctrl.curEndpointIP, port)) - if err == nil { - return - } - } - r := &net.Resolver{ - PreferGo: true, - Dial: func(ctx context.Context, network, address string) (net.Conn, error) { - dnsServer := dnsServers[tools.RandomInt(len(dnsServers))] - logger.Info("dial dns server", zap.String("DNS", dnsServer)) - return d.DialContext(ctx, "udp", dnsServer) - }, - } - ips, err := r.LookupIP(ctx, "ip4", host) - if err != nil { - return nil, err - } - logger.Info("look up for DNS", zap.String("Addr", addr), zap.Any("IPs", ips)) - - for _, ip := range ips { - if ip.To4() != nil { - conn, err = d.DialContext(ctx, "tcp4", net.JoinHostPort(ip.String(), port)) - if err != nil { - continue - } - ctrl.curEndpointIP = ip.String() - return - } - } - return nil, domain.ErrNoConnection - }, - OnStatusError: nil, - OnHeader: nil, - TLSClient: nil, - TLSConfig: nil, - WrapConn: nil, - } + ctrl.wsDialer = &ws.Dialer{ + ReadBufferSize: 32 * 1024, // 32kB + WriteBufferSize: 32 * 1024, // 32kB + Timeout: timeout, + NetDial: func(ctx context.Context, network, addr string) (conn net.Conn, err error) { + host, port, err := net.SplitHostPort(addr) + if err != nil { + return nil, err + } + d := net.Dialer{Timeout: timeout} + if ctrl.curEndpointIP != "" { + conn, err = d.DialContext(ctx, "tcp4", net.JoinHostPort(ctrl.curEndpointIP, port)) + if err == nil { + return + } + } + r := &net.Resolver{ + PreferGo: true, + Dial: func(ctx context.Context, network, address string) (net.Conn, error) { + dnsServer := dnsServers[tools.RandomInt(len(dnsServers))] + logger.Info("dial dns server", zap.String("DNS", dnsServer)) + return d.DialContext(ctx, "udp", dnsServer) + }, + } + ips, err := r.LookupIP(ctx, "ip4", host) + if err != nil { + return nil, err + } + logger.Info("look up for DNS", zap.String("Addr", addr), zap.Any("IPs", ips)) + + for _, ip := range ips { + if ip.To4() != nil { + conn, err = d.DialContext(ctx, "tcp4", net.JoinHostPort(ip.String(), port)) + if err != nil { + continue + } + ctrl.curEndpointIP = ip.String() + return + } + } + return nil, domain.ErrNoConnection + }, + OnStatusError: nil, + OnHeader: nil, + TLSClient: nil, + TLSConfig: nil, + WrapConn: nil, + } } func (ctrl *Controller) createHttpClient(timeout time.Duration) { - ctrl.httpClient = http.DefaultClient - ctrl.httpClient.Timeout = timeout - ctrl.httpClient.Transport = &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: time.Second, - KeepAlive: 30 * time.Second, - }).DialContext, - ForceAttemptHTTP2: false, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 3 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - } + ctrl.httpClient = http.DefaultClient + ctrl.httpClient.Timeout = timeout + ctrl.httpClient.Transport = &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + Timeout: time.Second, + KeepAlive: 30 * time.Second, + }).DialContext, + ForceAttemptHTTP2: false, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 3 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + } } func (ctrl *Controller) sendFlushFunc(targetID string, entries []tools.FlushEntry) { - itemsCount := len(entries) - switch itemsCount { - case 0: - return - case 1: - m := entries[0].Value().(*rony.MessageEnvelope) - err := ctrl.writeToWebsocket(m) - if err != nil { - logger.Warn("got error on writing to websocket conn", - zap.Uint64("ReqID", m.RequestID), - zap.String("C", registry.ConstructorName(m.Constructor)), - zap.Error(err), - ) - } - default: - messages := make([]*rony.MessageEnvelope, 0, itemsCount) - for idx := range entries { - m := entries[idx].Value().(*rony.MessageEnvelope) - logger.Debug("Message", - zap.Int("Idx", idx), - zap.String("TeamID", m.Get("TeamID", "0")), - zap.String("TeamAccess", m.Get("TeamAccess", "0")), - zap.String("C", registry.ConstructorName(m.Constructor)), - ) - messages = append(messages, m) - } - - // Make sure messages are sorted before sending to the wire - sort.Slice(messages, func(i, j int) bool { - return messages[i].RequestID < messages[j].RequestID - }) - - chunkSize := 50 - startIdx := 0 - endIdx := chunkSize - keepGoing := true - for keepGoing { - if endIdx > len(messages) { - endIdx = len(messages) - keepGoing = false - } - chunk := messages[startIdx:endIdx] - - msgContainer := &rony.MessageContainer{ - Envelopes: chunk, - Length: int32(len(chunk)), - } - messageEnvelope := &rony.MessageEnvelope{} - messageEnvelope.Fill(0, rony.C_MessageContainer, msgContainer) - - err := ctrl.writeToWebsocket(messageEnvelope) - if err != nil { - logger.Warn("got error on writing to websocket conn", - zap.String("C", registry.ConstructorName(messageEnvelope.Constructor)), - zap.Int("Count", len(chunk)), - zap.Error(err), - ) - return - } - startIdx = endIdx - endIdx += chunkSize - } - } + itemsCount := len(entries) + switch itemsCount { + case 0: + return + case 1: + m := entries[0].Value().(*rony.MessageEnvelope) + err := ctrl.writeToWebsocket(m) + if err != nil { + logger.Warn("got error on writing to websocket conn", + zap.Uint64("ReqID", m.RequestID), + zap.String("C", registry.ConstructorName(m.Constructor)), + zap.Error(err), + ) + } + default: + messages := make([]*rony.MessageEnvelope, 0, itemsCount) + for idx := range entries { + m := entries[idx].Value().(*rony.MessageEnvelope) + logger.Debug("Message", + zap.Int("Idx", idx), + zap.String("TeamID", m.Get("TeamID", "0")), + zap.String("TeamAccess", m.Get("TeamAccess", "0")), + zap.String("C", registry.ConstructorName(m.Constructor)), + ) + messages = append(messages, m) + } + + // Make sure messages are sorted before sending to the wire + sort.Slice(messages, func(i, j int) bool { + return messages[i].RequestID < messages[j].RequestID + }) + + chunkSize := 50 + startIdx := 0 + endIdx := chunkSize + keepGoing := true + for keepGoing { + if endIdx > len(messages) { + endIdx = len(messages) + keepGoing = false + } + chunk := messages[startIdx:endIdx] + + msgContainer := &rony.MessageContainer{ + Envelopes: chunk, + Length: int32(len(chunk)), + } + messageEnvelope := &rony.MessageEnvelope{} + messageEnvelope.Fill(0, rony.C_MessageContainer, msgContainer) + + err := ctrl.writeToWebsocket(messageEnvelope) + if err != nil { + logger.Warn("got error on writing to websocket conn", + zap.String("C", registry.ConstructorName(messageEnvelope.Constructor)), + zap.Int("Count", len(chunk)), + zap.Error(err), + ) + return + } + startIdx = endIdx + endIdx += chunkSize + } + } } // watchDog @@ -260,716 +261,716 @@ func (ctrl *Controller) sendFlushFunc(targetID string, entries []tools.FlushEntr // to listen and accept web-socket packets. If stop signal received it means we are // going to shutdown, hence returns from the function. func (ctrl *Controller) watchDog() { - for { - select { - case <-ctrl.connectChannel: - ctrl.receiver() - ctrl.updateNetworkStatus(domain.NetworkDisconnected) - if ctrl.wsKeepConnection { - go ctrl.Connect() - } - case <-ctrl.stopChannel: - logger.Info("NetCtrl's watchdog stopped!") - return - } - } + for { + select { + case <-ctrl.connectChannel: + ctrl.receiver() + ctrl.updateNetworkStatus(domain.NetworkDisconnected) + if ctrl.wsKeepConnection { + go ctrl.Connect() + } + case <-ctrl.stopChannel: + logger.Info("NetCtrl's watchdog stopped!") + return + } + } } // Ping the server to check connectivity func (ctrl *Controller) Ping(id uint64, timeout time.Duration) error { - logger.Debug("pings server", zap.Uint64("ID", id)) - // Create a channel for pong - ch := make(chan struct{}, 1) - ctrl.wsPingsMtx.Lock() - ctrl.wsPings[id] = ch - ctrl.wsPingsMtx.Unlock() - - // Create a byte slice for ping payload - b := make([]byte, 8) - binary.BigEndian.PutUint64(b, id) - - // Send the Ping to the wire - ctrl.wsWriteLock.Lock() - _ = ctrl.wsConn.SetWriteDeadline(time.Now().Add(domain.WebsocketWriteTime)) - err := wsutil.WriteClientMessage(ctrl.wsConn, ws.OpPing, b) - ctrl.wsWriteLock.Unlock() - if err != nil { - ctrl.wsPingsMtx.Lock() - delete(ctrl.wsPings, id) - ctrl.wsPingsMtx.Unlock() - return err - } - - select { - case <-time.After(timeout): - case <-ch: - // Pong Received - return nil - } - - return domain.ErrRequestTimeout + logger.Debug("pings server", zap.Uint64("ID", id)) + // Create a channel for pong + ch := make(chan struct{}, 1) + ctrl.wsPingsMtx.Lock() + ctrl.wsPings[id] = ch + ctrl.wsPingsMtx.Unlock() + + // Create a byte slice for ping payload + b := make([]byte, 8) + binary.BigEndian.PutUint64(b, id) + + // Send the Ping to the wire + ctrl.wsWriteLock.Lock() + _ = ctrl.wsConn.SetWriteDeadline(time.Now().Add(domain.WebsocketWriteTime)) + err := wsutil.WriteClientMessage(ctrl.wsConn, ws.OpPing, b) + ctrl.wsWriteLock.Unlock() + if err != nil { + ctrl.wsPingsMtx.Lock() + delete(ctrl.wsPings, id) + ctrl.wsPingsMtx.Unlock() + return err + } + + select { + case <-time.After(timeout): + case <-ch: + // Pong Received + return nil + } + + return domain.ErrRequestTimeout } // receiver // This is the background routine listen for incoming websocket packets and _Decrypt // the received message, if necessary, and pass the extracted envelopes to messageHandler. func (ctrl *Controller) receiver() { - defer logger.RecoverPanic( - "NetworkController:: receiver", - domain.M{ - "AuthID": ctrl.authID, - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - }, - nil, - ) - - res := msg.ProtoMessage{} - var ( - messages []wsutil.Message - err error - ) - for { - messages = messages[:0] - _ = ctrl.wsConn.SetReadDeadline(time.Now().Add(domain.WebsocketIdleTimeout)) - messages, err = wsutil.ReadServerMessage(ctrl.wsConn, messages) - if err != nil { - logger.Warn("got error on reading server message", zap.Error(err)) - // If we return then watchdog will re-connect - return - } - logger.Debug("received message", zap.Int("L", len(messages))) - for _, message := range messages { - switch message.OpCode { - case ws.OpPong: - logger.Info("Pong Received", zap.Int("L", len(message.Payload))) - if len(message.Payload) == 8 { - pingID := binary.BigEndian.Uint64(message.Payload) - ctrl.wsPingsMtx.Lock() - ch := ctrl.wsPings[pingID] - delete(ctrl.wsPings, pingID) - ctrl.wsPingsMtx.Unlock() - if ch != nil { - ch <- struct{}{} - } - } - case ws.OpBinary: - // If it is a BINARY message - err := res.Unmarshal(message.Payload) - if err != nil { - logger.Error("couldn't unmarshal received BinaryMessage", - zap.Error(err), - zap.String("Dump", string(message.Payload)), - ) - continue - } - - if res.AuthID == 0 { - receivedEnvelope := new(rony.MessageEnvelope) - err = receivedEnvelope.Unmarshal(res.Payload) - if err != nil { - logger.Error("couldn't unmarshal plain-text MessageEnvelope", zap.Error(err)) - continue - } - logger.Debug("received plain-text message", - zap.String("C", registry.ConstructorName(receivedEnvelope.Constructor)), - zap.Uint64("ReqID", receivedEnvelope.RequestID), - ) - messageHandler(ctrl, receivedEnvelope) - continue - } - - // We received an encrypted message - decryptedBytes, err := domain.Decrypt(ctrl.authKey, res.MessageKey, res.Payload) - if err != nil { - logger.Error("couldn't decrypt the received message", - zap.String("Error", err.Error()), - zap.Int64("ctrl.authID", ctrl.authID), - zap.Int64("resp.AuthID", res.AuthID), - zap.String("resp.MessageKey", hex.Dump(res.MessageKey)), - ) - continue - } - receivedEncryptedPayload := &msg.ProtoEncryptedPayload{} - err = receivedEncryptedPayload.Unmarshal(decryptedBytes) - pools.Bytes.Put(decryptedBytes) - if err != nil { - logger.Error("couldn't unmarshal decrypted message", zap.Error(err)) - continue - } - logger.Debug("received encrypted message", - zap.String("C", registry.ConstructorName(receivedEncryptedPayload.Envelope.Constructor)), - zap.Uint64("ReqID", receivedEncryptedPayload.Envelope.RequestID), - ) - // TODO:: check message id and server salt before handling the message - messageHandler(ctrl, receivedEncryptedPayload.Envelope) - } - } - } + defer logger.RecoverPanic( + "NetworkController:: receiver", + domain.M{ + "AuthID": ctrl.authID, + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + }, + nil, + ) + + res := msg.ProtoMessage{} + var ( + messages []wsutil.Message + err error + ) + for { + messages = messages[:0] + _ = ctrl.wsConn.SetReadDeadline(time.Now().Add(domain.WebsocketIdleTimeout)) + messages, err = wsutil.ReadServerMessage(ctrl.wsConn, messages) + if err != nil { + logger.Warn("got error on reading server message", zap.Error(err)) + // If we return then watchdog will re-connect + return + } + logger.Debug("received message", zap.Int("L", len(messages))) + for _, message := range messages { + switch message.OpCode { + case ws.OpPong: + logger.Info("Pong Received", zap.Int("L", len(message.Payload))) + if len(message.Payload) == 8 { + pingID := binary.BigEndian.Uint64(message.Payload) + ctrl.wsPingsMtx.Lock() + ch := ctrl.wsPings[pingID] + delete(ctrl.wsPings, pingID) + ctrl.wsPingsMtx.Unlock() + if ch != nil { + ch <- struct{}{} + } + } + case ws.OpBinary: + // If it is a BINARY message + err := res.Unmarshal(message.Payload) + if err != nil { + logger.Error("couldn't unmarshal received BinaryMessage", + zap.Error(err), + zap.String("Dump", string(message.Payload)), + ) + continue + } + + if res.AuthID == 0 { + receivedEnvelope := new(rony.MessageEnvelope) + err = receivedEnvelope.Unmarshal(res.Payload) + if err != nil { + logger.Error("couldn't unmarshal plain-text MessageEnvelope", zap.Error(err)) + continue + } + logger.Debug("received plain-text message", + zap.String("C", registry.ConstructorName(receivedEnvelope.Constructor)), + zap.Uint64("ReqID", receivedEnvelope.RequestID), + ) + messageHandler(ctrl, receivedEnvelope) + continue + } + + // We received an encrypted message + decryptedBytes, err := domain.Decrypt(ctrl.authKey, res.MessageKey, res.Payload) + if err != nil { + logger.Error("couldn't decrypt the received message", + zap.String("Error", err.Error()), + zap.Int64("ctrl.authID", ctrl.authID), + zap.Int64("resp.AuthID", res.AuthID), + zap.String("resp.MessageKey", hex.Dump(res.MessageKey)), + ) + continue + } + receivedEncryptedPayload := &msg.ProtoEncryptedPayload{} + err = receivedEncryptedPayload.Unmarshal(decryptedBytes) + pools.Bytes.Put(decryptedBytes) + if err != nil { + logger.Error("couldn't unmarshal decrypted message", zap.Error(err)) + continue + } + logger.Debug("received encrypted message", + zap.String("C", registry.ConstructorName(receivedEncryptedPayload.Envelope.Constructor)), + zap.Uint64("ReqID", receivedEncryptedPayload.Envelope.RequestID), + ) + // TODO:: check message id and server salt before handling the message + messageHandler(ctrl, receivedEncryptedPayload.Envelope) + } + } + } } func messageHandler(ctrl *Controller, message *rony.MessageEnvelope) { - // extract all updates/ messages - messages, updates := extractMessages(ctrl, message) - // sort messages by requestID - sort.Slice(messages, func(i, j int) bool { - return messages[i].RequestID < messages[j].RequestID - }) - ctrl.MessageChan <- messages - - sort.Slice(updates, func(i, j int) bool { - return updates[i].MinUpdateID < updates[j].MinUpdateID - }) - for _, updateContainer := range updates { - sort.Slice(updateContainer.Updates, func(i, j int) bool { - return updateContainer.Updates[i].UpdateID < updateContainer.Updates[j].UpdateID - }) - ctrl.UpdateChan <- updateContainer - } + // extract all updates/ messages + messages, updates := extractMessages(ctrl, message) + // sort messages by requestID + sort.Slice(messages, func(i, j int) bool { + return messages[i].RequestID < messages[j].RequestID + }) + ctrl.MessageChan <- messages + + sort.Slice(updates, func(i, j int) bool { + return updates[i].MinUpdateID < updates[j].MinUpdateID + }) + for _, updateContainer := range updates { + sort.Slice(updateContainer.Updates, func(i, j int) bool { + return updateContainer.Updates[i].UpdateID < updateContainer.Updates[j].UpdateID + }) + ctrl.UpdateChan <- updateContainer + } } func extractMessages(ctrl *Controller, m *rony.MessageEnvelope) ([]*rony.MessageEnvelope, []*msg.UpdateContainer) { - messages := make([]*rony.MessageEnvelope, 0) - updates := make([]*msg.UpdateContainer, 0) - switch m.Constructor { - case rony.C_MessageContainer: - x := new(rony.MessageContainer) - err := x.Unmarshal(m.Message) - if err == nil { - for _, env := range x.Envelopes { - msgs, upds := extractMessages(ctrl, env) - messages = append(messages, msgs...) - updates = append(updates, upds...) - } - } - case msg.C_UpdateContainer: - x := new(msg.UpdateContainer) - err := x.Unmarshal(m.Message) - if err == nil { - updates = append(updates, x) - } - case rony.C_Error: - e := new(rony.Error) - _ = e.Unmarshal(m.Message) - if ctrl.OnGeneralError != nil { - ctrl.OnGeneralError(m.RequestID, e) - } - if m.RequestID != 0 { - messages = append(messages, m) - } - case msg.C_SystemSalts: - x := new(msg.SystemSalts) - _ = x.Unmarshal(m.Message) - salt.Set(x) - fallthrough - default: - messages = append(messages, m) - } - return messages, updates + messages := make([]*rony.MessageEnvelope, 0) + updates := make([]*msg.UpdateContainer, 0) + switch m.Constructor { + case rony.C_MessageContainer: + x := new(rony.MessageContainer) + err := x.Unmarshal(m.Message) + if err == nil { + for _, env := range x.Envelopes { + msgs, upds := extractMessages(ctrl, env) + messages = append(messages, msgs...) + updates = append(updates, upds...) + } + } + case msg.C_UpdateContainer: + x := new(msg.UpdateContainer) + err := x.Unmarshal(m.Message) + if err == nil { + updates = append(updates, x) + } + case rony.C_Error: + e := new(rony.Error) + _ = e.Unmarshal(m.Message) + if ctrl.OnGeneralError != nil { + ctrl.OnGeneralError(m.RequestID, e) + } + if m.RequestID != 0 { + messages = append(messages, m) + } + case msg.C_SystemSalts: + x := new(msg.SystemSalts) + _ = x.Unmarshal(m.Message) + salt.Set(x) + fallthrough + default: + messages = append(messages, m) + } + return messages, updates } // updateNetworkStatus // The average ping times will be calculated and this function will be called if // quality of service changed. func (ctrl *Controller) updateNetworkStatus(newStatus domain.NetworkStatus) { - if ctrl.GetStatus() == newStatus { - return - } - ctrl.setStatus(newStatus) - if ctrl.OnNetworkStatusChange != nil { - ctrl.OnNetworkStatusChange(newStatus) - } + if ctrl.GetStatus() == newStatus { + return + } + ctrl.setStatus(newStatus) + if ctrl.OnNetworkStatusChange != nil { + ctrl.OnNetworkStatusChange(newStatus) + } } // Start starts the controller background controller and watcher routines func (ctrl *Controller) Start() { - // Run the keepAlive and watchDog in background - go ctrl.watchDog() + // Run the keepAlive and watchDog in background + go ctrl.watchDog() } // Stop sends stop signal to keepAlive and watchDog routines. func (ctrl *Controller) Stop() { - logger.Info("is stopping") - ctrl.Disconnect() - select { - case ctrl.stopChannel <- true: // receiver may or may not be listening - default: - } - logger.Info("stopped") + logger.Info("is stopping") + ctrl.Disconnect() + select { + case ctrl.stopChannel <- true: // receiver may or may not be listening + default: + } + logger.Info("stopped") } // Connect dial websocket func (ctrl *Controller) Connect() { - _, _, _ = domain.SingleFlight.Do("NetworkConnect", func() (i interface{}, e error) { - logger.Info("is connecting") - defer logger.RecoverPanic( - "NetCtrl::Connect", - domain.M{ - "AuthID": ctrl.authID, - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - }, - func() { - ctrl.Reconnect() - }, - ) - - ctrl.wsKeepConnection = true - keepGoing := true - attempts := 0 - for keepGoing { - ctrl.SetAuthRecalled(false) - ctrl.updateNetworkStatus(domain.NetworkConnecting) - // If there is a wsConn then close it before creating a new one - if ctrl.wsConn != nil { - _ = ctrl.wsConn.Close() - } - - // Stop connecting if KeepConnection is FALSE - if !ctrl.wsKeepConnection { - ctrl.updateNetworkStatus(domain.NetworkDisconnected) - return - } - reqHdr := http.Header{} - reqHdr.Set("X-Client-Type", fmt.Sprintf("SDK-%s-%s-%s", domain.SDKVersion, domain.ClientPlatform, domain.ClientVersion)) - - ctrl.UpdateEndpoint("") - ctrl.wsDialer.Header = ws.HandshakeHeaderHTTP(reqHdr) - ctrl.incSessionSeq() - wsConn, _, _, err := ctrl.wsDialer.Dial(context.Background(), fmt.Sprintf("ws://%s", ctrl.curEndpoint)) - if err != nil { - time.Sleep(domain.GetExponentialTime(100*time.Millisecond, 3*time.Second, attempts)) - attempts++ - if attempts > 5 { - attempts = 0 - logger.Info("got error on Dial", zap.Error(err), zap.String("Endpoint", ctrl.curEndpoint)) - ctrl.createWebsocketDialer(domain.WebsocketDialTimeoutLong) - } - continue - } - ctrl.ignoreSIGPIPE(wsConn) - keepGoing = false - domain.StartTime = time.Now() - ctrl.wsConn = wsConn - - // it should be started here cuz we need receiver to get AuthRecall answer - // WebsocketSend Signal to start the 'receiver' and 'keepAlive' routines - ctrl.connectChannel <- true - logger.Info("connected") - ctrl.updateNetworkStatus(domain.NetworkConnected) - - // Call the OnConnect handler here b4 changing network status that trigger queue to start working - // basically we writeToWebsocket priority requests b4 queue starts to work - err = ctrl.OnWebsocketConnect() - if !ctrl.Connected() || err != nil { - ctrl.updateNetworkStatus(domain.NetworkConnecting) - keepGoing = true - continue - } - } - return nil, nil - }) + _, _, _ = domain.SingleFlight.Do("NetworkConnect", func() (i interface{}, e error) { + logger.Info("is connecting") + defer logger.RecoverPanic( + "NetCtrl::Connect", + domain.M{ + "AuthID": ctrl.authID, + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + }, + func() { + ctrl.Reconnect() + }, + ) + + ctrl.wsKeepConnection = true + keepGoing := true + attempts := 0 + for keepGoing { + ctrl.SetAuthRecalled(false) + ctrl.updateNetworkStatus(domain.NetworkConnecting) + // If there is a wsConn then close it before creating a new one + if ctrl.wsConn != nil { + _ = ctrl.wsConn.Close() + } + + // Stop connecting if KeepConnection is FALSE + if !ctrl.wsKeepConnection { + ctrl.updateNetworkStatus(domain.NetworkDisconnected) + return + } + reqHdr := http.Header{} + reqHdr.Set("X-Client-Type", fmt.Sprintf("SDK-%s-%s-%s", domain.SDKVersion, domain.ClientPlatform, domain.ClientVersion)) + + ctrl.UpdateEndpoint("") + ctrl.wsDialer.Header = ws.HandshakeHeaderHTTP(reqHdr) + ctrl.incSessionSeq() + wsConn, _, _, err := ctrl.wsDialer.Dial(context.Background(), fmt.Sprintf("ws://%s", ctrl.curEndpoint)) + if err != nil { + time.Sleep(domain.GetExponentialTime(100*time.Millisecond, 3*time.Second, attempts)) + attempts++ + if attempts > 5 { + attempts = 0 + logger.Info("got error on Dial", zap.Error(err), zap.String("Endpoint", ctrl.curEndpoint)) + ctrl.createWebsocketDialer(domain.WebsocketDialTimeoutLong) + } + continue + } + ctrl.ignoreSIGPIPE(wsConn) + keepGoing = false + domain.StartTime = time.Now() + ctrl.wsConn = wsConn + + // it should be started here cuz we need receiver to get AuthRecall answer + // WebsocketSend Signal to start the 'receiver' and 'keepAlive' routines + ctrl.connectChannel <- true + logger.Info("connected") + ctrl.updateNetworkStatus(domain.NetworkConnected) + + // Call the OnConnect handler here b4 changing network status that trigger queue to start working + // basically we writeToWebsocket priority requests b4 queue starts to work + err = ctrl.OnWebsocketConnect() + if !ctrl.Connected() || err != nil { + ctrl.updateNetworkStatus(domain.NetworkConnecting) + keepGoing = true + continue + } + } + return nil, nil + }) } // UpdateEndpoint updates the url of the server based on the country. func (ctrl *Controller) UpdateEndpoint(country string) { - if country != "" { - ctrl.countryCode = country - } - - ctrl.curEndpoint = ctrl.endPoints[tools.RandomInt(len(ctrl.endPoints))] - - endpointParts := strings.Split(ctrl.curEndpoint, ".") - switch ctrl.countryCode { - case "IR", "": - endpointParts[0] = strings.TrimSuffix(endpointParts[0], "-cf") - default: - if !strings.HasSuffix(endpointParts[0], "-cf") { - endpointParts[0] = fmt.Sprintf("%s-cf", endpointParts[0]) - } - } - - ctrl.curEndpoint = strings.Join(endpointParts, ".") - logger.Info("endpoints updated", - zap.String("WS", ctrl.curEndpoint), - zap.String("Http", ctrl.curEndpoint), - zap.String("Country", ctrl.countryCode), - ) + if country != "" { + ctrl.countryCode = country + } + + ctrl.curEndpoint = ctrl.endPoints[tools.RandomInt(len(ctrl.endPoints))] + + endpointParts := strings.Split(ctrl.curEndpoint, ".") + switch ctrl.countryCode { + case "IR", "": + endpointParts[0] = strings.TrimSuffix(endpointParts[0], "-cf") + default: + if !strings.HasSuffix(endpointParts[0], "-cf") { + endpointParts[0] = fmt.Sprintf("%s-cf", endpointParts[0]) + } + } + + ctrl.curEndpoint = strings.Join(endpointParts, ".") + logger.Info("endpoints updated", + zap.String("WS", ctrl.curEndpoint), + zap.String("Http", ctrl.curEndpoint), + zap.String("Country", ctrl.countryCode), + ) } // Disconnect close websocket func (ctrl *Controller) Disconnect() { - _, _, _ = domain.SingleFlight.Do("NetworkDisconnect", func() (i interface{}, e error) { - ctrl.wsKeepConnection = false - if ctrl.wsConn != nil { - err := ctrl.wsConn.Close() - logger.Info("websocket conn closed", zap.Error(err)) - } - return nil, nil - }) + _, _, _ = domain.SingleFlight.Do("NetworkDisconnect", func() (i interface{}, e error) { + ctrl.wsKeepConnection = false + if ctrl.wsConn != nil { + err := ctrl.wsConn.Close() + logger.Info("websocket conn closed", zap.Error(err)) + } + return nil, nil + }) } // SetAuthorization ... // If authID and authKey are defined then sending messages will be encrypted before // writing on the wire. func (ctrl *Controller) SetAuthorization(authID int64, authKey []byte) { - logger.Info("set authorization info", zap.Int64("AuthID", authID)) - ctrl.authKey = make([]byte, len(authKey)) - ctrl.authID = authID - copy(ctrl.authKey, authKey) + logger.Info("set authorization info", zap.Int64("AuthID", authID)) + ctrl.authKey = make([]byte, len(authKey)) + ctrl.authID = authID + copy(ctrl.authKey, authKey) } func (ctrl *Controller) incMessageSeq() int64 { - return atomic.AddInt64(&ctrl.messageSeq, 1) + return atomic.AddInt64(&ctrl.messageSeq, 1) } func (ctrl *Controller) incSessionSeq() int64 { - return atomic.AddInt64(&ctrl.sessionSeq, 1) + return atomic.AddInt64(&ctrl.sessionSeq, 1) } func (ctrl *Controller) getSessionSeq() int64 { - return atomic.LoadInt64(&ctrl.sessionSeq) + return atomic.LoadInt64(&ctrl.sessionSeq) } // WebsocketCommand run request immediately. It is blocking call func (ctrl *Controller) WebsocketCommand(reqCB request.Callback) { - defer logger.RecoverPanic( - "NetCtrl::WebsocketCommandWithTimeout", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - "C": reqCB.Constructor(), - }, - nil, - ) - - logger.Debug("execute command over websocket", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(reqCB.Constructor())), - ) - - execBlock := func(reqID uint64, req *rony.MessageEnvelope) { - err := ctrl.WebsocketSend(req, reqCB.Flags()) - if err != nil { - logger.Warn("got error from NetCtrl", - zap.Uint64("ReqID", req.RequestID), - zap.String("C", registry.ConstructorName(req.Constructor)), - zap.Error(err), - ) - reqCB.OnTimeout() - - return - } - - select { - case <-time.After(reqCB.Timeout()): - logger.Debug("got timeout on websocket command", - zap.String("C", registry.ConstructorName(req.Constructor)), - zap.Uint64("ReqID", req.RequestID), - ) - reqCB.OnTimeout() - return - case res := <-reqCB.ResponseChan(): - logger.Debug("got response for websocket command", - zap.Uint64("ReqID", req.RequestID), - zap.String("ReqC", registry.ConstructorName(req.Constructor)), - zap.String("ResC", registry.ConstructorName(res.Constructor)), - ) - reqCB.OnComplete(res) - } - } - execBlock(reqCB.RequestID(), reqCB.Envelope()) + defer logger.RecoverPanic( + "NetCtrl::WebsocketCommandWithTimeout", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + "C": reqCB.Constructor(), + }, + nil, + ) + + logger.Debug("execute command over websocket", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(reqCB.Constructor())), + ) + + execBlock := func(reqID uint64, req *rony.MessageEnvelope) { + err := ctrl.WebsocketSend(req, reqCB.Flags()) + if err != nil { + logger.Warn("got error from NetCtrl", + zap.Uint64("ReqID", req.RequestID), + zap.String("C", registry.ConstructorName(req.Constructor)), + zap.Error(err), + ) + reqCB.OnTimeout() + + return + } + + select { + case <-time.After(reqCB.Timeout()): + logger.Debug("got timeout on websocket command", + zap.String("C", registry.ConstructorName(req.Constructor)), + zap.Uint64("ReqID", req.RequestID), + ) + reqCB.OnTimeout() + return + case res := <-reqCB.ResponseChan(): + logger.Debug("got response for websocket command", + zap.Uint64("ReqID", req.RequestID), + zap.String("ReqC", registry.ConstructorName(req.Constructor)), + zap.String("ResC", registry.ConstructorName(res.Constructor)), + ) + reqCB.OnComplete(res) + } + } + execBlock(reqCB.RequestID(), reqCB.Envelope()) } func (ctrl *Controller) WebsocketSend(msgEnvelope *rony.MessageEnvelope, flag request.DelegateFlag) error { - defer logger.RecoverPanic( - "NetCtrl::WebsocketSend", - domain.M{ - "AuthID": ctrl.authID, - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - "C": msgEnvelope.Constructor, - }, - func() { - ctrl.Reconnect() - }, - ) - - _, unauthorized := ctrl.unauthorizedRequests[msgEnvelope.Constructor] - if flag&request.SkipFlusher != 0 || unauthorized { - return ctrl.writeToWebsocket(msgEnvelope) - } - switch msgEnvelope.Constructor { - case msg.C_MessagesSend, msg.C_MessagesSendMedia, msg.C_MessagesForward: - ctrl.sendRoutines["Messages"].Enter("", tools.NewEntry(msgEnvelope)) - default: - if flag&request.Batch != 0 { - ctrl.sendRoutines["Batch"].Enter("", tools.NewEntry(msgEnvelope)) - } else { - ctrl.sendRoutines["General"].Enter("", tools.NewEntry(msgEnvelope)) - } - - } - - return nil + defer logger.RecoverPanic( + "NetCtrl::WebsocketSend", + domain.M{ + "AuthID": ctrl.authID, + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + "C": msgEnvelope.Constructor, + }, + func() { + ctrl.Reconnect() + }, + ) + + _, unauthorized := ctrl.unauthorizedRequests[msgEnvelope.Constructor] + if flag&request.SkipFlusher != 0 || unauthorized { + return ctrl.writeToWebsocket(msgEnvelope) + } + switch msgEnvelope.Constructor { + case msg.C_MessagesSend, msg.C_MessagesSendMedia, msg.C_MessagesForward: + ctrl.sendRoutines["Messages"].Enter("", tools.NewEntry(msgEnvelope)) + default: + if flag&request.Batch != 0 { + ctrl.sendRoutines["Batch"].Enter("", tools.NewEntry(msgEnvelope)) + } else { + ctrl.sendRoutines["General"].Enter("", tools.NewEntry(msgEnvelope)) + } + + } + + return nil } func (ctrl *Controller) writeToWebsocket(msgEnvelope *rony.MessageEnvelope) error { - defer logger.RecoverPanic( - "NetCtrl::writeToWebsocket", - domain.M{ - "AuthID": ctrl.authID, - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - "C": msgEnvelope.Constructor, - }, - func() { - ctrl.Reconnect() - }, - ) - - startTime := tools.NanoTime() - protoMessage := msg.PoolProtoMessage.Get() - defer msg.PoolProtoMessage.Put(protoMessage) - if cap(protoMessage.MessageKey) < 32 { - protoMessage.MessageKey = make([]byte, 32) - } else { - protoMessage.MessageKey = protoMessage.MessageKey[:32] - } - - logger.Debug("writing to the websocket conn", - zap.Uint64("ReqID", msgEnvelope.RequestID), - zap.String("C", registry.ConstructorName(msgEnvelope.Constructor)), - zap.String("TeamID", msgEnvelope.Get("TeamID", "0")), - zap.Bool("SendPlain", ctrl.unauthorizedRequests[msgEnvelope.Constructor]), - zap.Bool("Authorized", ctrl.authID != 0), - ) - if ctrl.authID == 0 || ctrl.unauthorizedRequests[msgEnvelope.Constructor] { - protoMessage.AuthID = 0 - buf := pools.Buffer.FromProto(msgEnvelope) - protoMessage.Payload = buf.AppendTo(protoMessage.Payload) - pools.Buffer.Put(buf) - } else { - protoMessage.AuthID = ctrl.authID - encryptedPayload := &msg.ProtoEncryptedPayload{ - ServerSalt: salt.Get(), - MessageID: uint64(domain.Now().Unix()<<32 | ctrl.incMessageSeq()), - SessionID: domain.Now().Unix()<<32 | ctrl.getSessionSeq(), - Envelope: msgEnvelope, - } - - mo := proto.MarshalOptions{UseCachedSize: true} - unencryptedBytes := pools.Bytes.GetCap(mo.Size(encryptedPayload)) - unencryptedBytes, _ = mo.MarshalAppend(unencryptedBytes, encryptedPayload) - encryptedPayloadBytes, _ := domain.Encrypt(ctrl.authKey, unencryptedBytes) - messageKey := domain.GenerateMessageKey(ctrl.authKey, unencryptedBytes) - copy(protoMessage.MessageKey, messageKey) - protoMessage.Payload = append(protoMessage.Payload[:0], encryptedPayloadBytes...) - pools.Bytes.Put(encryptedPayloadBytes) - } - - reqBuff := pools.Buffer.FromProto(protoMessage) - defer pools.Buffer.Put(reqBuff) - - if ctrl.wsConn == nil { - return domain.ErrNoConnection - } - - ctrl.wsWriteLock.Lock() - _ = ctrl.wsConn.SetWriteDeadline(time.Now().Add(domain.WebsocketWriteTime)) - err := wsutil.WriteClientMessage(ctrl.wsConn, ws.OpBinary, *reqBuff.Bytes()) - ctrl.wsWriteLock.Unlock() - if err != nil { - _ = ctrl.wsConn.Close() - return err - } - - logger.Debug("write to websocket completed.", - zap.Uint64("ReqID", msgEnvelope.RequestID), - zap.String("C", registry.ConstructorName(msgEnvelope.Constructor)), - zap.Duration("Duration", time.Duration(tools.NanoTime()-startTime)), - ) - - return nil + defer logger.RecoverPanic( + "NetCtrl::writeToWebsocket", + domain.M{ + "AuthID": ctrl.authID, + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + "C": msgEnvelope.Constructor, + }, + func() { + ctrl.Reconnect() + }, + ) + + startTime := tools.NanoTime() + protoMessage := msg.PoolProtoMessage.Get() + defer msg.PoolProtoMessage.Put(protoMessage) + if cap(protoMessage.MessageKey) < 32 { + protoMessage.MessageKey = make([]byte, 32) + } else { + protoMessage.MessageKey = protoMessage.MessageKey[:32] + } + + logger.Debug("writing to the websocket conn", + zap.Uint64("ReqID", msgEnvelope.RequestID), + zap.String("C", registry.ConstructorName(msgEnvelope.Constructor)), + zap.String("TeamID", msgEnvelope.Get("TeamID", "0")), + zap.Bool("SendPlain", ctrl.unauthorizedRequests[msgEnvelope.Constructor]), + zap.Bool("Authorized", ctrl.authID != 0), + ) + if ctrl.authID == 0 || ctrl.unauthorizedRequests[msgEnvelope.Constructor] { + protoMessage.AuthID = 0 + buf := pools.Buffer.FromProto(msgEnvelope) + protoMessage.Payload = buf.AppendTo(protoMessage.Payload) + pools.Buffer.Put(buf) + } else { + protoMessage.AuthID = ctrl.authID + encryptedPayload := &msg.ProtoEncryptedPayload{ + ServerSalt: salt.Get(), + MessageID: uint64(domain.Now().Unix()<<32 | ctrl.incMessageSeq()), + SessionID: domain.Now().Unix()<<32 | ctrl.getSessionSeq(), + Envelope: msgEnvelope, + } + + mo := proto.MarshalOptions{UseCachedSize: true} + unencryptedBytes := pools.Bytes.GetCap(mo.Size(encryptedPayload)) + unencryptedBytes, _ = mo.MarshalAppend(unencryptedBytes, encryptedPayload) + encryptedPayloadBytes, _ := domain.Encrypt(ctrl.authKey, unencryptedBytes) + messageKey := domain.GenerateMessageKey(ctrl.authKey, unencryptedBytes) + copy(protoMessage.MessageKey, messageKey) + protoMessage.Payload = append(protoMessage.Payload[:0], encryptedPayloadBytes...) + pools.Bytes.Put(encryptedPayloadBytes) + } + + reqBuff := pools.Buffer.FromProto(protoMessage) + defer pools.Buffer.Put(reqBuff) + + if ctrl.wsConn == nil { + return domain.ErrNoConnection + } + + ctrl.wsWriteLock.Lock() + _ = ctrl.wsConn.SetWriteDeadline(time.Now().Add(domain.WebsocketWriteTime)) + err := wsutil.WriteClientMessage(ctrl.wsConn, ws.OpBinary, *reqBuff.Bytes()) + ctrl.wsWriteLock.Unlock() + if err != nil { + _ = ctrl.wsConn.Close() + return err + } + + logger.Debug("write to websocket completed.", + zap.Uint64("ReqID", msgEnvelope.RequestID), + zap.String("C", registry.ConstructorName(msgEnvelope.Constructor)), + zap.Duration("Duration", time.Duration(tools.NanoTime()-startTime)), + ) + + return nil } // HttpCommand run request immediately func (ctrl *Controller) HttpCommand(ctx context.Context, reqCB request.Callback) { - if ctx == nil { - var cf context.CancelFunc - ctx, cf = context.WithTimeout(context.Background(), reqCB.Timeout()) - defer cf() - } - - res, err := ctrl.sendHttp(ctx, reqCB.Envelope()) - switch err { - case nil: - reqCB.OnComplete(res) - case context.DeadlineExceeded: - reqCB.OnTimeout() - case context.Canceled: - reqCB.Response(rony.C_Error, errors.New("Canceled", err.Error())) - default: - reqCB.Response(rony.C_Error, errors.New("00", err.Error())) - } + if ctx == nil { + var cf context.CancelFunc + ctx, cf = context.WithTimeout(context.Background(), reqCB.Timeout()) + defer cf() + } + + res, err := ctrl.sendHttp(ctx, reqCB.Envelope()) + switch err { + case nil: + reqCB.OnComplete(res) + case context.DeadlineExceeded: + reqCB.OnTimeout() + case context.Canceled: + reqCB.Response(rony.C_Error, errors.New("Canceled", err.Error())) + default: + reqCB.Response(rony.C_Error, errors.New("00", err.Error())) + } } func (ctrl *Controller) sendHttp(ctx context.Context, msgEnvelope *rony.MessageEnvelope) (*rony.MessageEnvelope, error) { - var ( - totalUploadBytes, totalDownloadBytes int - startTime = tools.NanoTime() - ) - - if ctx == nil { - var cf context.CancelFunc - ctx, cf = context.WithTimeout(context.Background(), domain.HttpRequestTimeout) - defer cf() - } - - protoMessage := msg.PoolProtoMessage.Get() - defer msg.PoolProtoMessage.Put(protoMessage) - if cap(protoMessage.MessageKey) < 32 { - protoMessage.MessageKey = make([]byte, 32) - } else { - protoMessage.MessageKey = protoMessage.MessageKey[:32] - } - if ctrl.unauthorizedRequests[msgEnvelope.Constructor] { - protoMessage.AuthID = 0 - } else { - protoMessage.AuthID = ctrl.authID - } - - if protoMessage.AuthID == 0 { - buf := pools.Buffer.FromProto(msgEnvelope) - protoMessage.Payload = buf.AppendTo(protoMessage.Payload) - pools.Buffer.Put(buf) - } else { - encryptedPayload := &msg.ProtoEncryptedPayload{ - ServerSalt: salt.Get(), - Envelope: msgEnvelope, - MessageID: uint64(domain.Now().Unix()<<32 | ctrl.incMessageSeq()), - } - mo := proto.MarshalOptions{UseCachedSize: true} - unencryptedBytes := pools.Bytes.GetCap(mo.Size(encryptedPayload)) - unencryptedBytes, _ = mo.MarshalAppend(unencryptedBytes, encryptedPayload) - encryptedPayloadBytes, _ := domain.Encrypt(ctrl.authKey, unencryptedBytes) - messageKey := domain.GenerateMessageKey(ctrl.authKey, unencryptedBytes) - pools.Bytes.Put(unencryptedBytes) - copy(protoMessage.MessageKey, messageKey) - protoMessage.Payload = append(protoMessage.Payload[:0], encryptedPayloadBytes...) - pools.Bytes.Put(encryptedPayloadBytes) - - } - - reqBuff := pools.Buffer.FromProto(protoMessage) - totalUploadBytes += reqBuff.Len() // len(reqBuff.Len()protoMessageBytes) - - // Send Data - httpReq, err := http.NewRequest(http.MethodPost, fmt.Sprintf("http://%s", ctrl.curEndpoint), reqBuff) - if err != nil { - return nil, err - } - httpReq.Header.Set("Content-Type", "application/protobuf") - httpResp, err := ctrl.httpClient.Do(httpReq.WithContext(ctx)) - if err != nil { - return nil, err - } - // Read response - resBuff, err := ioutil.ReadAll(httpResp.Body) - if err != nil { - return nil, err - } - totalDownloadBytes += len(resBuff) - mon.DataTransfer(totalUploadBytes, totalDownloadBytes, time.Duration(tools.NanoTime()-startTime)) - - // Decrypt response - res := &msg.ProtoMessage{} - err = res.Unmarshal(resBuff) - if err != nil { - return nil, err - } - if res.AuthID == 0 { - receivedEnvelope := &rony.MessageEnvelope{} - err = receivedEnvelope.Unmarshal(res.Payload) - return receivedEnvelope, err - } - decryptedBytes, err := domain.Decrypt(ctrl.authKey, res.MessageKey, res.Payload) - if err != nil { - return nil, err - } - - receivedEncryptedPayload := &msg.ProtoEncryptedPayload{} - err = receivedEncryptedPayload.Unmarshal(decryptedBytes) - pools.Bytes.Put(decryptedBytes) - if err != nil { - return nil, err - } - - logger.Debug("sendHttp", - zap.String("URL", ctrl.curEndpoint), - zap.String("ReqC", registry.ConstructorName(msgEnvelope.Constructor)), - zap.String("ResC", registry.ConstructorName(receivedEncryptedPayload.Envelope.Constructor)), - zap.Duration("D", time.Duration(tools.NanoTime()-startTime)), - ) - - return receivedEncryptedPayload.Envelope, nil + var ( + totalUploadBytes, totalDownloadBytes int + startTime = tools.NanoTime() + ) + + if ctx == nil { + var cf context.CancelFunc + ctx, cf = context.WithTimeout(context.Background(), domain.HttpRequestTimeout) + defer cf() + } + + protoMessage := msg.PoolProtoMessage.Get() + defer msg.PoolProtoMessage.Put(protoMessage) + if cap(protoMessage.MessageKey) < 32 { + protoMessage.MessageKey = make([]byte, 32) + } else { + protoMessage.MessageKey = protoMessage.MessageKey[:32] + } + if ctrl.unauthorizedRequests[msgEnvelope.Constructor] { + protoMessage.AuthID = 0 + } else { + protoMessage.AuthID = ctrl.authID + } + + if protoMessage.AuthID == 0 { + buf := pools.Buffer.FromProto(msgEnvelope) + protoMessage.Payload = buf.AppendTo(protoMessage.Payload) + pools.Buffer.Put(buf) + } else { + encryptedPayload := &msg.ProtoEncryptedPayload{ + ServerSalt: salt.Get(), + Envelope: msgEnvelope, + MessageID: uint64(domain.Now().Unix()<<32 | ctrl.incMessageSeq()), + } + mo := proto.MarshalOptions{UseCachedSize: true} + unencryptedBytes := pools.Bytes.GetCap(mo.Size(encryptedPayload)) + unencryptedBytes, _ = mo.MarshalAppend(unencryptedBytes, encryptedPayload) + encryptedPayloadBytes, _ := domain.Encrypt(ctrl.authKey, unencryptedBytes) + messageKey := domain.GenerateMessageKey(ctrl.authKey, unencryptedBytes) + pools.Bytes.Put(unencryptedBytes) + copy(protoMessage.MessageKey, messageKey) + protoMessage.Payload = append(protoMessage.Payload[:0], encryptedPayloadBytes...) + pools.Bytes.Put(encryptedPayloadBytes) + + } + + reqBuff := pools.Buffer.FromProto(protoMessage) + totalUploadBytes += reqBuff.Len() // len(reqBuff.Len()protoMessageBytes) + + // Send Data + httpReq, err := http.NewRequest(http.MethodPost, fmt.Sprintf("http://%s", ctrl.curEndpoint), reqBuff) + if err != nil { + return nil, err + } + httpReq.Header.Set("Content-Type", "application/protobuf") + httpResp, err := ctrl.httpClient.Do(httpReq.WithContext(ctx)) + if err != nil { + return nil, err + } + // Read response + resBuff, err := ioutil.ReadAll(httpResp.Body) + if err != nil { + return nil, err + } + totalDownloadBytes += len(resBuff) + mon.DataTransfer(totalUploadBytes, totalDownloadBytes, time.Duration(tools.NanoTime()-startTime)) + + // Decrypt response + res := &msg.ProtoMessage{} + err = res.Unmarshal(resBuff) + if err != nil { + return nil, err + } + if res.AuthID == 0 { + receivedEnvelope := &rony.MessageEnvelope{} + err = receivedEnvelope.Unmarshal(res.Payload) + return receivedEnvelope, err + } + decryptedBytes, err := domain.Decrypt(ctrl.authKey, res.MessageKey, res.Payload) + if err != nil { + return nil, err + } + + receivedEncryptedPayload := &msg.ProtoEncryptedPayload{} + err = receivedEncryptedPayload.Unmarshal(decryptedBytes) + pools.Bytes.Put(decryptedBytes) + if err != nil { + return nil, err + } + + logger.Debug("sendHttp", + zap.String("URL", ctrl.curEndpoint), + zap.String("ReqC", registry.ConstructorName(msgEnvelope.Constructor)), + zap.String("ResC", registry.ConstructorName(receivedEncryptedPayload.Envelope.Constructor)), + zap.Duration("D", time.Duration(tools.NanoTime()-startTime)), + ) + + return receivedEncryptedPayload.Envelope, nil } // Reconnect by wsKeepConnection = true the watchdog will connect itself again no need to call ctrl.Connect() func (ctrl *Controller) Reconnect() { - _, _, _ = domain.SingleFlight.Do("NetworkReconnect", func() (i interface{}, e error) { - if ctrl.GetStatus() == domain.NetworkDisconnected { - ctrl.Connect() - } else if ctrl.wsConn != nil { - _ = ctrl.wsConn.Close() - } - return nil, nil - }) + _, _, _ = domain.SingleFlight.Do("NetworkReconnect", func() (i interface{}, e error) { + if ctrl.GetStatus() == domain.NetworkDisconnected { + ctrl.Connect() + } else if ctrl.wsConn != nil { + _ = ctrl.wsConn.Close() + } + return nil, nil + }) } // WaitForNetwork this function sleeps until the websocket connection is established. If you set waitForRecall then // it also waits the initial AuthRecall request sent to the server. func (ctrl *Controller) WaitForNetwork(waitForRecall bool) { - // Wait While Network is Disconnected or Connecting - for ctrl.GetStatus() != domain.NetworkConnected { - logger.Debug("is waiting for Network", - zap.String("Quality", ctrl.GetStatus().ToString()), - ) - time.Sleep(time.Second) - } - if waitForRecall { - for !ctrl.GetAuthRecalled() { - logger.Debug("is waiting for AuthRecall") - time.Sleep(time.Second) - } - } + // Wait While Network is Disconnected or Connecting + for ctrl.GetStatus() != domain.NetworkConnected { + logger.Debug("is waiting for Network", + zap.String("Quality", ctrl.GetStatus().ToString()), + ) + time.Sleep(time.Second) + } + if waitForRecall { + for !ctrl.GetAuthRecalled() { + logger.Debug("is waiting for AuthRecall") + time.Sleep(time.Second) + } + } } // Connected return the connection status for the websocket connection func (ctrl *Controller) Connected() bool { - return ctrl.GetStatus() == domain.NetworkConnected + return ctrl.GetStatus() == domain.NetworkConnected } func (ctrl *Controller) Disconnected() bool { - return ctrl.GetStatus() == domain.NetworkDisconnected + return ctrl.GetStatus() == domain.NetworkDisconnected } // GetStatus returns the network status func (ctrl *Controller) GetStatus() domain.NetworkStatus { - return domain.NetworkStatus(atomic.LoadInt32(&ctrl.wsQuality)) + return domain.NetworkStatus(atomic.LoadInt32(&ctrl.wsQuality)) } func (ctrl *Controller) setStatus(s domain.NetworkStatus) { - atomic.StoreInt32(&ctrl.wsQuality, int32(s)) + atomic.StoreInt32(&ctrl.wsQuality, int32(s)) } // SetAuthRecalled update the internal flag to identify AuthRecall api has been successfully called func (ctrl *Controller) SetAuthRecalled(b bool) { - if b { - atomic.StoreInt32(&ctrl.authRecalled, 1) - } else { - atomic.StoreInt32(&ctrl.authRecalled, 0) - } + if b { + atomic.StoreInt32(&ctrl.authRecalled, 1) + } else { + atomic.StoreInt32(&ctrl.authRecalled, 0) + } } // GetAuthRecalled read the internal flag to check if AuthRecall has been called func (ctrl *Controller) GetAuthRecalled() bool { - return atomic.LoadInt32(&ctrl.authRecalled) > 0 + return atomic.LoadInt32(&ctrl.authRecalled) > 0 } diff --git a/internal/ctrl_network/network_test.go b/internal/ctrl_network/network_test.go index 9cca11b9..fe69bbc9 100644 --- a/internal/ctrl_network/network_test.go +++ b/internal/ctrl_network/network_test.go @@ -1,19 +1,20 @@ package networkCtrl_test import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/ctrl_network" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/internal/testenv" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/registry" - . "github.com/smartystreets/goconvey/convey" - "go.uber.org/zap" - "sync" - "sync/atomic" - "testing" - "time" + "sync" + "sync/atomic" + "testing" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + networkCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_network" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/internal/testenv" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/registry" + . "github.com/smartystreets/goconvey/convey" + "go.uber.org/zap" ) /* @@ -26,166 +27,166 @@ import ( */ var ( - requestID uint64 - ctrl *networkCtrl.Controller - messageChan = make(chan []*rony.MessageEnvelope, 100) - updateChan = make(chan *msg.UpdateContainer, 100) + requestID uint64 + ctrl *networkCtrl.Controller + messageChan = make(chan []*rony.MessageEnvelope, 100) + updateChan = make(chan *msg.UpdateContainer, 100) ) func dummyMessageReceiver() { - for msgs := range messageChan { - for _, m := range msgs { - testenv.Log().Info("Message", - zap.String("C", registry.ConstructorName(m.Constructor)), - zap.Uint64("ReqID", m.RequestID), - ) - } - } + for msgs := range messageChan { + for _, m := range msgs { + testenv.Log().Info("Message", + zap.String("C", registry.ConstructorName(m.Constructor)), + zap.Uint64("ReqID", m.RequestID), + ) + } + } } func dummyUpdateReceiver() { - for updateContainer := range updateChan { - testenv.Log().Info("Update Handler") - for _, u := range updateContainer.Updates { - testenv.Log().Info("Update", - zap.String("C", registry.ConstructorName(u.Constructor)), - zap.Int64("GetUpdateID", u.UpdateID), - ) - } - } + for updateContainer := range updateChan { + testenv.Log().Info("Update Handler") + for _, u := range updateContainer.Updates { + testenv.Log().Info("Update", + zap.String("C", registry.ConstructorName(u.Constructor)), + zap.Int64("GetUpdateID", u.UpdateID), + ) + } + } } func dummyOnConnectHandler() error { - testenv.Log().Info("Connected") - return nil + testenv.Log().Info("Connected") + return nil } func dummyErrorHandler(requestID uint64, e *rony.Error) { - testenv.Log().Info("Error Handler", - zap.String("Code", e.Code), - zap.String("Items", e.Items), - ) + testenv.Log().Info("Error Handler", + zap.String("Code", e.Code), + zap.String("Items", e.Items), + ) } func dummyNetworkChangeHandler(newStatus domain.NetworkStatus) { - testenv.Log().Info("Network Status Changed", - zap.String("New Status", newStatus.ToString()), - ) + testenv.Log().Info("Network Status Changed", + zap.String("New Status", newStatus.ToString()), + ) } func init() { - testenv.Log().SetLogLevel(0) - ctrl = networkCtrl.New(networkCtrl.Config{ - SeedHosts: []string{"edge.river.im", "edge.rivermsg.com"}, - CountryCode: "IR", - }) - go dummyMessageReceiver() - go dummyUpdateReceiver() - ctrl.OnGeneralError = dummyErrorHandler - ctrl.OnNetworkStatusChange = dummyNetworkChangeHandler - ctrl.OnWebsocketConnect = dummyOnConnectHandler - ctrl.MessageChan = messageChan - ctrl.UpdateChan = updateChan + testenv.Log().SetLogLevel(0) + ctrl = networkCtrl.New(networkCtrl.Config{ + SeedHosts: []string{"edge.river.im", "edge.rivermsg.com"}, + CountryCode: "IR", + }) + go dummyMessageReceiver() + go dummyUpdateReceiver() + ctrl.OnGeneralError = dummyErrorHandler + ctrl.OnNetworkStatusChange = dummyNetworkChangeHandler + ctrl.OnWebsocketConnect = dummyOnConnectHandler + ctrl.MessageChan = messageChan + ctrl.UpdateChan = updateChan } func TestNewController(t *testing.T) { - ctrl.Start() - ctrl.Connect() - go func() { - for { - ctrl.WebsocketCommand( - request.NewCallback( - 0, 0, atomic.AddUint64(&requestID, 1), msg.C_SystemGetServerTime, &msg.SystemGetServerTime{}, - func() { - t.Error(domain.ErrRequestTimeout) - }, - func(res *rony.MessageEnvelope) { - - }, - nil, false, request.SkipFlusher, 0, - ), - ) - time.Sleep(time.Second) - } - }() - time.Sleep(time.Second * 5) - err := ctrl.Ping(domain.RandomUint64(), domain.WebsocketWriteTime) - if err != nil { - t.Fatal(err) - } - time.Sleep(5 * time.Second) - - ctrl.Stop() + ctrl.Start() + ctrl.Connect() + go func() { + for { + ctrl.WebsocketCommand( + request.NewCallback( + 0, 0, atomic.AddUint64(&requestID, 1), msg.C_SystemGetServerTime, &msg.SystemGetServerTime{}, + func() { + t.Error(domain.ErrRequestTimeout) + }, + func(res *rony.MessageEnvelope) { + + }, + nil, false, request.SkipFlusher, 0, + ), + ) + time.Sleep(time.Second) + } + }() + time.Sleep(time.Second * 5) + err := ctrl.Ping(domain.RandomUint64(), domain.WebsocketWriteTime) + if err != nil { + t.Fatal(err) + } + time.Sleep(5 * time.Second) + + ctrl.Stop() } func TestStartStop(t *testing.T) { - ctrl.Start() - go func() { - for { - ctrl.WebsocketCommand( - request.NewCallback( - 0, 0, atomic.AddUint64(&requestID, 1), msg.C_SystemGetServerTime, &msg.SystemGetServerTime{}, - func() { - t.Error(domain.ErrRequestTimeout) - }, - func(res *rony.MessageEnvelope) { - - }, - nil, false, request.SkipFlusher, 0, - ), - ) - time.Sleep(time.Second) - } - }() - for j := 0; j < 20; j++ { - time.Sleep(5 * time.Second) - ctrl.Stop() - ctrl.Start() - ctrl.Connect() - } - - ctrl.Stop() + ctrl.Start() + go func() { + for { + ctrl.WebsocketCommand( + request.NewCallback( + 0, 0, atomic.AddUint64(&requestID, 1), msg.C_SystemGetServerTime, &msg.SystemGetServerTime{}, + func() { + t.Error(domain.ErrRequestTimeout) + }, + func(res *rony.MessageEnvelope) { + + }, + nil, false, request.SkipFlusher, 0, + ), + ) + time.Sleep(time.Second) + } + }() + for j := 0; j < 20; j++ { + time.Sleep(5 * time.Second) + ctrl.Stop() + ctrl.Start() + ctrl.Connect() + } + + ctrl.Stop() } func TestReconnect(t *testing.T) { - Convey("Reconnect Test", t, func(c C) { - wg := sync.WaitGroup{} - for i := 0; i < 100; i++ { - wg.Add(1) - go func() { - ctrl := networkCtrl.New(networkCtrl.Config{ - SeedHosts: []string{"edge.river.im"}, - CountryCode: "IR", - }) - - ctrl.OnGeneralError = dummyErrorHandler - ctrl.OnNetworkStatusChange = dummyNetworkChangeHandler - ctrl.OnWebsocketConnect = dummyOnConnectHandler - ctrl.MessageChan = messageChan - ctrl.UpdateChan = updateChan - ctrl.Start() - for i := 0; i < 100; i++ { - ctrl.Reconnect() - time.Sleep(time.Millisecond * 250) - } - wg.Done() - }() - } - wg.Wait() - }) + Convey("Reconnect Test", t, func(c C) { + wg := sync.WaitGroup{} + for i := 0; i < 100; i++ { + wg.Add(1) + go func() { + ctrl := networkCtrl.New(networkCtrl.Config{ + SeedHosts: []string{"edge.river.im"}, + CountryCode: "IR", + }) + + ctrl.OnGeneralError = dummyErrorHandler + ctrl.OnNetworkStatusChange = dummyNetworkChangeHandler + ctrl.OnWebsocketConnect = dummyOnConnectHandler + ctrl.MessageChan = messageChan + ctrl.UpdateChan = updateChan + ctrl.Start() + for i := 0; i < 100; i++ { + ctrl.Reconnect() + time.Sleep(time.Millisecond * 250) + } + wg.Done() + }() + } + wg.Wait() + }) } func TestPing(t *testing.T) { - ctrl.Start() - ctrl.Connect() - for i := 0; i < 10; i++ { - startTime := time.Now() - err := ctrl.Ping(domain.RandomUint64(), domain.WebsocketWriteTime) - if err != nil { - t.Fatal(err) - } - testenv.Log().Info("Pinged", zap.Duration("D", time.Since(startTime))) - } - time.Sleep(5 * time.Second) - ctrl.Stop() + ctrl.Start() + ctrl.Connect() + for i := 0; i < 10; i++ { + startTime := time.Now() + err := ctrl.Ping(domain.RandomUint64(), domain.WebsocketWriteTime) + if err != nil { + t.Fatal(err) + } + testenv.Log().Info("Pinged", zap.Duration("D", time.Since(startTime))) + } + time.Sleep(5 * time.Second) + ctrl.Stop() } diff --git a/internal/ctrl_queue/queue.go b/internal/ctrl_queue/queue.go index b93fd3ac..09f8f4f7 100644 --- a/internal/ctrl_queue/queue.go +++ b/internal/ctrl_queue/queue.go @@ -1,336 +1,337 @@ package queueCtrl import ( - "git.ronaksoft.com/river/msg/go/msg" - fileCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_file" - "git.ronaksoft.com/river/sdk/internal/ctrl_network" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/beeker1121/goque" - "github.com/juju/ratelimit" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/registry" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "os" - "path/filepath" - "sync" - "time" + "os" + "path/filepath" + "sync" + "time" + + "github.com/beeker1121/goque" + "github.com/juju/ratelimit" + "github.com/ronaksoft/river-msg/go/msg" + fileCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_file" + networkCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_network" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/registry" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) var ( - logger *logs.Logger + logger *logs.Logger ) func init() { - logger = logs.With("QueueCtrl") + logger = logs.With("QueueCtrl") } // Controller ... // This controller will be connected to networkController and messages will be queued here // before passing to the networkController. type Controller struct { - dataDir string - rateLimiter *ratelimit.Bucket - waitingList *goque.Queue - networkCtrl *networkCtrl.Controller - fileCtrl *fileCtrl.Controller - - // Internal Flags - distributorLock sync.Mutex - distributorRunning bool - - // Cancelled request - cancelLock sync.Mutex - cancelledRequest map[uint64]bool + dataDir string + rateLimiter *ratelimit.Bucket + waitingList *goque.Queue + networkCtrl *networkCtrl.Controller + fileCtrl *fileCtrl.Controller + + // Internal Flags + distributorLock sync.Mutex + distributorRunning bool + + // Cancelled request + cancelLock sync.Mutex + cancelledRequest map[uint64]bool } func New(fileCtrl *fileCtrl.Controller, network *networkCtrl.Controller, dataDir string) *Controller { - ctrl := new(Controller) - ctrl.dataDir = filepath.Join(dataDir, "queue") - ctrl.rateLimiter = ratelimit.NewBucket(time.Second, 20) - if dataDir == "" { - panic(domain.ErrQueuePathIsNotSet) - } - - ctrl.cancelledRequest = make(map[uint64]bool) - ctrl.networkCtrl = network - ctrl.fileCtrl = fileCtrl - return ctrl + ctrl := new(Controller) + ctrl.dataDir = filepath.Join(dataDir, "queue") + ctrl.rateLimiter = ratelimit.NewBucket(time.Second, 20) + if dataDir == "" { + panic(domain.ErrQueuePathIsNotSet) + } + + ctrl.cancelledRequest = make(map[uint64]bool) + ctrl.networkCtrl = network + ctrl.fileCtrl = fileCtrl + return ctrl } // distributor // Pulls the next request from the waitingList and pass it to the executor. It uses // a rate limiter to throttle the throughput func (ctrl *Controller) distributor() { - for { - // Wait until network is available - ctrl.networkCtrl.WaitForNetwork(true) - - ctrl.distributorLock.Lock() - if ctrl.waitingList.Length() == 0 { - ctrl.distributorRunning = false - ctrl.distributorLock.Unlock() - break - } - ctrl.distributorLock.Unlock() - - // Peek item from the queue - item, err := ctrl.waitingList.Dequeue() - if err != nil { - continue - } - - // Prepare - reqCB, err := request.UnmarshalCallback(item.Value) - if err != nil { - logger.Error("could not unmarshal popped request", zap.Error(err)) - continue - } - - // If request is already canceled ignore it - if ctrl.IsRequestCancelled(reqCB.RequestID()) { - logger.Info("discarded a canceled request", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(reqCB.Constructor())), - ) - continue - } - - go ctrl.executor(reqCB) - } + for { + // Wait until network is available + ctrl.networkCtrl.WaitForNetwork(true) + + ctrl.distributorLock.Lock() + if ctrl.waitingList.Length() == 0 { + ctrl.distributorRunning = false + ctrl.distributorLock.Unlock() + break + } + ctrl.distributorLock.Unlock() + + // Peek item from the queue + item, err := ctrl.waitingList.Dequeue() + if err != nil { + continue + } + + // Prepare + reqCB, err := request.UnmarshalCallback(item.Value) + if err != nil { + logger.Error("could not unmarshal popped request", zap.Error(err)) + continue + } + + // If request is already canceled ignore it + if ctrl.IsRequestCancelled(reqCB.RequestID()) { + logger.Info("discarded a canceled request", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(reqCB.Constructor())), + ) + continue + } + + go ctrl.executor(reqCB) + } } // addToWaitingList func (ctrl *Controller) addToWaitingList(reqCB request.Callback) { - jsonRequest, err := reqCB.Marshal() - if err != nil { - logger.Warn("couldn't marshal the request", zap.Error(err)) - return - } - if _, err := ctrl.waitingList.Enqueue(jsonRequest); err != nil { - logger.Warn("couldn't enqueue the request", zap.Error(err)) - return - } - ctrl.distributorLock.Lock() - if !ctrl.distributorRunning { - ctrl.distributorRunning = true - go ctrl.distributor() - } - ctrl.distributorLock.Unlock() + jsonRequest, err := reqCB.Marshal() + if err != nil { + logger.Warn("couldn't marshal the request", zap.Error(err)) + return + } + if _, err := ctrl.waitingList.Enqueue(jsonRequest); err != nil { + logger.Warn("couldn't enqueue the request", zap.Error(err)) + return + } + ctrl.distributorLock.Lock() + if !ctrl.distributorRunning { + ctrl.distributorRunning = true + go ctrl.distributor() + } + ctrl.distributorLock.Unlock() } // executor // Sends the message to the networkController and waits for the response. If time is up then it call the // TimeoutCallback otherwise if response arrived in time, SuccessCallback will be called. func (ctrl *Controller) executor(reqCB request.Callback) { - defer logger.RecoverPanic( - "SyncCtrl::executor", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - "C": reqCB.Constructor(), - }, - nil, - ) - - // Try to send it over wire, if error happened put it back into the queue - if err := ctrl.networkCtrl.WebsocketSend(reqCB.Envelope(), 0); err != nil { - logger.Info("re-push the request into the queue", zap.Error(err)) - ctrl.addToWaitingList(reqCB) - return - } - - select { - case <-time.After(reqCB.Timeout()): - switch reqCB.Constructor() { - case msg.C_MessagesSend, msg.C_MessagesSendMedia: - pm, _ := repo.PendingMessages.GetByRandomID(int64(reqCB.RequestID())) - if pm != nil { - ctrl.addToWaitingList(reqCB) - return - } - case msg.C_MessagesReadHistory, msg.C_MessagesGetHistory, - msg.C_ContactsImport, msg.C_ContactsGet, - msg.C_AuthSendCode, msg.C_AuthRegister, msg.C_AuthLogin, - msg.C_LabelsAddToMessage, msg.C_LabelsRemoveFromMessage: - ctrl.addToWaitingList(reqCB) - return - default: - reqCB.OnTimeout() - } - case res := <-reqCB.ResponseChan(): - switch reqCB.Constructor() { - case msg.C_MessagesSend, msg.C_MessagesSendMedia, msg.C_MessagesForward: - switch res.Constructor { - case rony.C_Error: - errMsg := &rony.Error{} - _ = errMsg.Unmarshal(res.Message) - - switch { - case domain.CheckError(errMsg, msg.ErrCodeAlreadyExists, msg.ErrItemRandomID): - fallthrough - case domain.CheckError(errMsg, msg.ErrCodeAccess, "NON_TEAM_MEMBER"): - pm, _ := repo.PendingMessages.GetByRandomID(int64(reqCB.RequestID())) - if pm != nil { - _ = repo.PendingMessages.Delete(pm.ID) - } - - } - } - default: - switch res.Constructor { - case rony.C_Error: - errMsg := &rony.Error{} - _ = errMsg.Unmarshal(res.Message) - switch { - case domain.CheckError(errMsg, msg.ErrCodeInvalid, msg.ErrItemSalt): - ctrl.addToWaitingList(reqCB) - } - } - } - reqCB.OnComplete(res) - } + defer logger.RecoverPanic( + "SyncCtrl::executor", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + "C": reqCB.Constructor(), + }, + nil, + ) + + // Try to send it over wire, if error happened put it back into the queue + if err := ctrl.networkCtrl.WebsocketSend(reqCB.Envelope(), 0); err != nil { + logger.Info("re-push the request into the queue", zap.Error(err)) + ctrl.addToWaitingList(reqCB) + return + } + + select { + case <-time.After(reqCB.Timeout()): + switch reqCB.Constructor() { + case msg.C_MessagesSend, msg.C_MessagesSendMedia: + pm, _ := repo.PendingMessages.GetByRandomID(int64(reqCB.RequestID())) + if pm != nil { + ctrl.addToWaitingList(reqCB) + return + } + case msg.C_MessagesReadHistory, msg.C_MessagesGetHistory, + msg.C_ContactsImport, msg.C_ContactsGet, + msg.C_AuthSendCode, msg.C_AuthRegister, msg.C_AuthLogin, + msg.C_LabelsAddToMessage, msg.C_LabelsRemoveFromMessage: + ctrl.addToWaitingList(reqCB) + return + default: + reqCB.OnTimeout() + } + case res := <-reqCB.ResponseChan(): + switch reqCB.Constructor() { + case msg.C_MessagesSend, msg.C_MessagesSendMedia, msg.C_MessagesForward: + switch res.Constructor { + case rony.C_Error: + errMsg := &rony.Error{} + _ = errMsg.Unmarshal(res.Message) + + switch { + case domain.CheckError(errMsg, msg.ErrCodeAlreadyExists, msg.ErrItemRandomID): + fallthrough + case domain.CheckError(errMsg, msg.ErrCodeAccess, "NON_TEAM_MEMBER"): + pm, _ := repo.PendingMessages.GetByRandomID(int64(reqCB.RequestID())) + if pm != nil { + _ = repo.PendingMessages.Delete(pm.ID) + } + + } + } + default: + switch res.Constructor { + case rony.C_Error: + errMsg := &rony.Error{} + _ = errMsg.Unmarshal(res.Message) + switch { + case domain.CheckError(errMsg, msg.ErrCodeInvalid, msg.ErrItemSalt): + ctrl.addToWaitingList(reqCB) + } + } + } + reqCB.OnComplete(res) + } } // EnqueueCommand put request in queue and distributor will execute it later func (ctrl *Controller) EnqueueCommand(reqCB request.Callback) { - defer logger.RecoverPanic( - "SyncCtrl::EnqueueCommandWithTimeout", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - "C": reqCB.Constructor(), - }, - nil, - ) - - logger.Debug("enqueues command", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(reqCB.Constructor())), - ) - - // Add the request to the queue - ctrl.addToWaitingList(reqCB) + defer logger.RecoverPanic( + "SyncCtrl::EnqueueCommandWithTimeout", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + "C": reqCB.Constructor(), + }, + nil, + ) + + logger.Debug("enqueues command", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(reqCB.Constructor())), + ) + + // Add the request to the queue + ctrl.addToWaitingList(reqCB) } // Start queue func (ctrl *Controller) Start(resetQueue bool) { - logger.Info("started") - if resetQueue { - _ = os.RemoveAll(ctrl.dataDir) - } - err := ctrl.OpenQueue() - if err != nil { - logger.Fatal("couldn't initialize the queue", zap.Error(err)) - } - - // Try to resend unsent messages - for _, pmsg := range repo.PendingMessages.GetAll() { - if resetQueue { - _ = repo.PendingMessages.Delete(pmsg.ID) - continue - } - switch pmsg.MediaType { - case msg.InputMediaType_InputMediaTypeEmpty: - logger.Info("loads pending messages", - zap.Int64("ID", pmsg.ID), - zap.Int64("FileID", pmsg.FileID), - ) - // it will be MessagesSend - req := repo.PendingMessages.ToMessagesSend(pmsg) - ctrl.EnqueueCommand( - request.NewCallback( - pmsg.TeamID, pmsg.TeamAccessHash, uint64(req.RandomID), msg.C_MessagesSend, req, - nil, nil, nil, false, 0, 0, - ), - ) - - default: - req := &msg.ClientSendMessageMedia{} - _ = req.Unmarshal(pmsg.Media) - switch req.MediaType { - case msg.InputMediaType_InputMediaTypeUploadedDocument: - checkSha256 := true - for _, attr := range req.Attributes { - if attr.Type == msg.DocumentAttributeType_AttributeTypeAudio { - x := &msg.DocumentAttributeAudio{} - _ = x.Unmarshal(attr.Data) - if x.Voice { - checkSha256 = false - } - } - } - ctrl.fileCtrl.UploadMessageDocument(pmsg.ID, req.FilePath, req.ThumbFilePath, req.FileID, req.ThumbID, pmsg.Sha256, pmsg.PeerID, checkSha256) - default: - // it will be MessagesSendMedia - req := repo.PendingMessages.ToMessagesSendMedia(pmsg) - if req == nil { - continue - } - ctrl.EnqueueCommand( - request.NewCallback( - pmsg.TeamID, pmsg.TeamAccessHash, uint64(req.RandomID), msg.C_MessagesSendMedia, req, - nil, nil, nil, false, 0, 0, - ), - ) - } - } - } - - go ctrl.distributor() + logger.Info("started") + if resetQueue { + _ = os.RemoveAll(ctrl.dataDir) + } + err := ctrl.OpenQueue() + if err != nil { + logger.Fatal("couldn't initialize the queue", zap.Error(err)) + } + + // Try to resend unsent messages + for _, pmsg := range repo.PendingMessages.GetAll() { + if resetQueue { + _ = repo.PendingMessages.Delete(pmsg.ID) + continue + } + switch pmsg.MediaType { + case msg.InputMediaType_InputMediaTypeEmpty: + logger.Info("loads pending messages", + zap.Int64("ID", pmsg.ID), + zap.Int64("FileID", pmsg.FileID), + ) + // it will be MessagesSend + req := repo.PendingMessages.ToMessagesSend(pmsg) + ctrl.EnqueueCommand( + request.NewCallback( + pmsg.TeamID, pmsg.TeamAccessHash, uint64(req.RandomID), msg.C_MessagesSend, req, + nil, nil, nil, false, 0, 0, + ), + ) + + default: + req := &msg.ClientSendMessageMedia{} + _ = req.Unmarshal(pmsg.Media) + switch req.MediaType { + case msg.InputMediaType_InputMediaTypeUploadedDocument: + checkSha256 := true + for _, attr := range req.Attributes { + if attr.Type == msg.DocumentAttributeType_AttributeTypeAudio { + x := &msg.DocumentAttributeAudio{} + _ = x.Unmarshal(attr.Data) + if x.Voice { + checkSha256 = false + } + } + } + ctrl.fileCtrl.UploadMessageDocument(pmsg.ID, req.FilePath, req.ThumbFilePath, req.FileID, req.ThumbID, pmsg.Sha256, pmsg.PeerID, checkSha256) + default: + // it will be MessagesSendMedia + req := repo.PendingMessages.ToMessagesSendMedia(pmsg) + if req == nil { + continue + } + ctrl.EnqueueCommand( + request.NewCallback( + pmsg.TeamID, pmsg.TeamAccessHash, uint64(req.RandomID), msg.C_MessagesSendMedia, req, + nil, nil, nil, false, 0, 0, + ), + ) + } + } + } + + go ctrl.distributor() } // Stop queue func (ctrl *Controller) Stop() { - logger.Info("stopped") - ctrl.DropQueue() + logger.Info("stopped") + ctrl.DropQueue() } // IsRequestCancelled handle canceled request to do not process its response func (ctrl *Controller) IsRequestCancelled(reqID uint64) bool { - _, ok := ctrl.cancelledRequest[reqID] - if ok { - ctrl.cancelLock.Lock() - delete(ctrl.cancelledRequest, reqID) - ctrl.cancelLock.Unlock() - } - return ok + _, ok := ctrl.cancelledRequest[reqID] + if ok { + ctrl.cancelLock.Lock() + delete(ctrl.cancelledRequest, reqID) + ctrl.cancelLock.Unlock() + } + return ok } // CancelRequest cancel request func (ctrl *Controller) CancelRequest(reqID uint64) { - ctrl.cancelLock.Lock() - ctrl.cancelledRequest[reqID] = true - ctrl.cancelLock.Unlock() + ctrl.cancelLock.Lock() + ctrl.cancelledRequest[reqID] = true + ctrl.cancelLock.Unlock() } // DropQueue remove queue from storage func (ctrl *Controller) DropQueue() { - err := tools.Try(10, time.Millisecond*100, func() error { - return ctrl.waitingList.Drop() - }) - if err != nil { - logger.Warn("got error on dropping queue") - } + err := tools.Try(10, time.Millisecond*100, func() error { + return ctrl.waitingList.Drop() + }) + if err != nil { + logger.Warn("got error on dropping queue") + } } // OpenQueue init queue files in storage func (ctrl *Controller) OpenQueue() (err error) { - err = tools.Try(10, 100*time.Millisecond, func() error { - if q, err := goque.OpenQueue(ctrl.dataDir); err != nil { - err = os.RemoveAll(ctrl.dataDir) - if err != nil { - logger.Warn("got error on removing queue directory", zap.Error(err)) - } - return err - } else { - ctrl.waitingList = q - } - return nil - }) - return + err = tools.Try(10, 100*time.Millisecond, func() error { + if q, err := goque.OpenQueue(ctrl.dataDir); err != nil { + err = os.RemoveAll(ctrl.dataDir) + if err != nil { + logger.Warn("got error on removing queue directory", zap.Error(err)) + } + return err + } else { + ctrl.waitingList = q + } + return nil + }) + return } diff --git a/internal/ctrl_sync/remote_commands.go b/internal/ctrl_sync/remote_commands.go index dcd8c65b..4a9a2bde 100644 --- a/internal/ctrl_sync/remote_commands.go +++ b/internal/ctrl_sync/remote_commands.go @@ -1,17 +1,18 @@ package syncCtrl import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/internal/uiexec" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/registry" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "sync" - "time" + "sync" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/internal/uiexec" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/registry" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) /* @@ -24,396 +25,396 @@ import ( */ func (ctrl *Controller) GetServerSalt() { - logger.Info("call GetServerSalt") - ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_SystemGetSalts, &msg.SystemGetSalts{}, - func() { - time.Sleep(time.Duration(domain.RandomInt(2000)) * time.Millisecond) + logger.Info("call GetServerSalt") + ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_SystemGetSalts, &msg.SystemGetSalts{}, + func() { + time.Sleep(time.Duration(domain.RandomInt(2000)) * time.Millisecond) - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_SystemSalts: - logger.Debug("received SystemSalts") - case rony.C_Error: - e := new(rony.Error) - _ = m.Unmarshal(m.Message) - logger.Error("received error response for SystemGetSalts (Error)", - zap.String("Code", e.Code), - zap.String("Item", e.Items), - ) - time.Sleep(time.Second) - } - }, nil, - false, request.SkipFlusher, 0, - ), - ) + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_SystemSalts: + logger.Debug("received SystemSalts") + case rony.C_Error: + e := new(rony.Error) + _ = m.Unmarshal(m.Message) + logger.Error("received error response for SystemGetSalts (Error)", + zap.String("Code", e.Code), + zap.String("Item", e.Items), + ) + time.Sleep(time.Second) + } + }, nil, + false, request.SkipFlusher, 0, + ), + ) } func (ctrl *Controller) GetSystemConfig() { - logger.Info("call SystemGetConfig") - ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_SystemGetConfig, &msg.SystemGetConfig{}, - func() { - time.Sleep(time.Duration(domain.RandomInt(2000)) * time.Millisecond) - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_SystemConfig: - logger.Debug("received SystemConfig") - case rony.C_Error: - e := new(rony.Error) - _ = m.Unmarshal(m.Message) - logger.Error("received error response for SystemGetSalts (Error)", - zap.String("Code", e.Code), - zap.String("Item", e.Items), - ) - time.Sleep(time.Second) - } - }, nil, - false, 0, 0, - ), - ) + logger.Info("call SystemGetConfig") + ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_SystemGetConfig, &msg.SystemGetConfig{}, + func() { + time.Sleep(time.Duration(domain.RandomInt(2000)) * time.Millisecond) + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_SystemConfig: + logger.Debug("received SystemConfig") + case rony.C_Error: + e := new(rony.Error) + _ = m.Unmarshal(m.Message) + logger.Error("received error response for SystemGetSalts (Error)", + zap.String("Code", e.Code), + zap.String("Item", e.Items), + ) + time.Sleep(time.Second) + } + }, nil, + false, 0, 0, + ), + ) } func (ctrl *Controller) AuthRecall(caller string) (updateID int64, err error) { - logger.Info("call AuthRecall", zap.String("Caller", caller)) - req := &msg.AuthRecall{ - ClientID: 0, - Version: 0, - AppVersion: domain.ClientVersion, - Platform: domain.ClientPlatform, - Vendor: domain.ClientVendor, - OSVersion: domain.ClientOS, - } - ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_AuthRecall, req, - func() { - logger.Warn("AuthRecall Timeout", - zap.Int64("AuthID", ctrl.connInfo.PickupAuthID()), - zap.Int64("UserID", ctrl.connInfo.PickupUserID()), - ) - err = domain.ErrRequestTimeout - time.Sleep(time.Duration(domain.RandomInt(2000)) * time.Millisecond) - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_AuthRecalled: - x := &msg.AuthRecalled{} - err = x.Unmarshal(m.Message) - if err != nil { - return - } - logger.Debug("received AuthRecalled") - updateID = x.UpdateID + logger.Info("call AuthRecall", zap.String("Caller", caller)) + req := &msg.AuthRecall{ + ClientID: 0, + Version: 0, + AppVersion: domain.ClientVersion, + Platform: domain.ClientPlatform, + Vendor: domain.ClientVendor, + OSVersion: domain.ClientOS, + } + ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_AuthRecall, req, + func() { + logger.Warn("AuthRecall Timeout", + zap.Int64("AuthID", ctrl.connInfo.PickupAuthID()), + zap.Int64("UserID", ctrl.connInfo.PickupUserID()), + ) + err = domain.ErrRequestTimeout + time.Sleep(time.Duration(domain.RandomInt(2000)) * time.Millisecond) + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_AuthRecalled: + x := &msg.AuthRecalled{} + err = x.Unmarshal(m.Message) + if err != nil { + return + } + logger.Debug("received AuthRecalled") + updateID = x.UpdateID - // Update the time difference between client & server - clientTime := tools.TimeUnix() - serverTime := x.Timestamp - domain.TimeDelta = time.Duration(serverTime-clientTime) * time.Second + // Update the time difference between client & server + clientTime := tools.TimeUnix() + serverTime := x.Timestamp + domain.TimeDelta = time.Duration(serverTime-clientTime) * time.Second - // Set the flag for network controller - ctrl.networkCtrl.SetAuthRecalled(true) + // Set the flag for network controller + ctrl.networkCtrl.SetAuthRecalled(true) - ctrl.appUpdateCallback(x.CurrentVersion, x.Available, x.Force) - case rony.C_Error: - err = domain.ParseServerError(m.Message) - default: - logger.Error("did not received expected response for AuthRecall", - zap.String("C", registry.ConstructorName(m.Constructor)), - ) - err = domain.ErrInvalidConstructor - } - }, nil, - false, request.SkipFlusher, 0, - ), - ) + ctrl.appUpdateCallback(x.CurrentVersion, x.Available, x.Force) + case rony.C_Error: + err = domain.ParseServerError(m.Message) + default: + logger.Error("did not received expected response for AuthRecall", + zap.String("C", registry.ConstructorName(m.Constructor)), + ) + err = domain.ErrInvalidConstructor + } + }, nil, + false, request.SkipFlusher, 0, + ), + ) - return + return } func (ctrl *Controller) GetServerTime() (err error) { - logger.Info("calls GetServerTime") - ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_SystemGetServerTime, &msg.SystemGetServerTime{}, - func() { - err = domain.ErrRequestTimeout - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_SystemServerTime: - x := new(msg.SystemServerTime) - err = x.Unmarshal(m.Message) - if err != nil { - logger.Error("couldn't unmarshal SystemGetServerTime response", zap.Error(err)) - return - } - clientTime := time.Now().Unix() - serverTime := x.Timestamp - domain.TimeDelta = time.Duration(serverTime-clientTime) * time.Second + logger.Info("calls GetServerTime") + ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_SystemGetServerTime, &msg.SystemGetServerTime{}, + func() { + err = domain.ErrRequestTimeout + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_SystemServerTime: + x := new(msg.SystemServerTime) + err = x.Unmarshal(m.Message) + if err != nil { + logger.Error("couldn't unmarshal SystemGetServerTime response", zap.Error(err)) + return + } + clientTime := time.Now().Unix() + serverTime := x.Timestamp + domain.TimeDelta = time.Duration(serverTime-clientTime) * time.Second - logger.Debug("received SystemServerTime", - zap.Int64("ServerTime", serverTime), - zap.Int64("ClientTime", clientTime), - zap.Duration("Difference", domain.TimeDelta), - ) - case rony.C_Error: - logger.Warn("received error on GetSystemServerTime", zap.Error(domain.ParseServerError(m.Message))) - err = domain.ParseServerError(m.Message) - } - }, nil, - false, request.SkipFlusher, 0, - ), - ) - return + logger.Debug("received SystemServerTime", + zap.Int64("ServerTime", serverTime), + zap.Int64("ClientTime", clientTime), + zap.Duration("Difference", domain.TimeDelta), + ) + case rony.C_Error: + logger.Warn("received error on GetSystemServerTime", zap.Error(domain.ParseServerError(m.Message))) + err = domain.ParseServerError(m.Message) + } + }, nil, + false, request.SkipFlusher, 0, + ), + ) + return } func (ctrl *Controller) GetAllDialogs(waitGroup *sync.WaitGroup, teamID int64, teamAccess uint64, offset int32, limit int32) { - logger.Info("calls GetAllDialogs", - zap.Int32("Offset", offset), - zap.Int32("Limit", limit), - ) - req := &msg.MessagesGetDialogs{ - Limit: limit, - Offset: offset, - } + logger.Info("calls GetAllDialogs", + zap.Int32("Offset", offset), + zap.Int32("Limit", limit), + ) + req := &msg.MessagesGetDialogs{ + Limit: limit, + Offset: offset, + } - ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - teamID, teamAccess, domain.NextRequestID(), msg.C_MessagesGetDialogs, req, - func() { - // If timeout, then retry the request - logger.Warn("Timeout! on GetAllDialogs, retrying ...") - _, _ = ctrl.AuthRecall("GetAllDialogs") - ctrl.GetAllDialogs(waitGroup, teamID, teamAccess, offset, limit) - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case rony.C_Error: - logger.Error("got error response on MessagesGetDialogs", zap.Error(domain.ParseServerError(m.Message))) - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - if x.Code == msg.ErrCodeUnavailable && x.Items == msg.ErrItemUserID { - waitGroup.Done() - return - } else if x.Code == msg.ErrCodeRateLimit { - time.Sleep(time.Second * time.Duration(tools.StrToInt64(x.Items))) - } - ctrl.GetAllDialogs(waitGroup, teamID, teamAccess, offset, limit) + ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + teamID, teamAccess, domain.NextRequestID(), msg.C_MessagesGetDialogs, req, + func() { + // If timeout, then retry the request + logger.Warn("Timeout! on GetAllDialogs, retrying ...") + _, _ = ctrl.AuthRecall("GetAllDialogs") + ctrl.GetAllDialogs(waitGroup, teamID, teamAccess, offset, limit) + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case rony.C_Error: + logger.Error("got error response on MessagesGetDialogs", zap.Error(domain.ParseServerError(m.Message))) + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + if x.Code == msg.ErrCodeUnavailable && x.Items == msg.ErrItemUserID { + waitGroup.Done() + return + } else if x.Code == msg.ErrCodeRateLimit { + time.Sleep(time.Second * time.Duration(tools.StrToInt64(x.Items))) + } + ctrl.GetAllDialogs(waitGroup, teamID, teamAccess, offset, limit) - case msg.C_MessagesDialogs: - x := msg.MessagesDialogs{} - err := x.Unmarshal(m.Message) - if err != nil { - logger.Error("cannot unmarshal server response on MessagesGetDialogs", zap.Error(err)) - return - } + case msg.C_MessagesDialogs: + x := msg.MessagesDialogs{} + err := x.Unmarshal(m.Message) + if err != nil { + logger.Error("cannot unmarshal server response on MessagesGetDialogs", zap.Error(err)) + return + } - if x.Count > offset+limit { - ctrl.GetAllDialogs(waitGroup, teamID, teamAccess, offset+limit, limit) - } else { - waitGroup.Done() - uiexec.ExecDataSynced(true, false, false) - } - } - }, nil, false, 0, 0, - ), - ) + if x.Count > offset+limit { + ctrl.GetAllDialogs(waitGroup, teamID, teamAccess, offset+limit, limit) + } else { + waitGroup.Done() + uiexec.ExecDataSynced(true, false, false) + } + } + }, nil, false, 0, 0, + ), + ) } func (ctrl *Controller) GetAllTopPeers( - waitGroup *sync.WaitGroup, teamID int64, teamAccess uint64, cat msg.TopPeerCategory, offset int32, limit int32, + waitGroup *sync.WaitGroup, teamID int64, teamAccess uint64, cat msg.TopPeerCategory, offset int32, limit int32, ) { - logger.Info("calls GetAllTopPeers", - zap.Int32("Offset", offset), - zap.Int32("Limit", limit), - ) + logger.Info("calls GetAllTopPeers", + zap.Int32("Offset", offset), + zap.Int32("Limit", limit), + ) - req := &msg.ContactsGetTopPeers{ - Limit: limit, - Offset: offset, - Category: cat, - } - ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - teamID, teamAccess, domain.NextRequestID(), msg.C_ContactsGetTopPeers, req, - func() { - // If timeout, then retry the request - logger.Warn("Timeout! on GetAllTopPeers, retrying ...", zap.String("Cat", cat.String())) - _, _ = ctrl.AuthRecall("GetAllTopPeers") - ctrl.GetAllTopPeers(waitGroup, teamID, teamAccess, cat, offset, limit) - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case rony.C_Error: - logger.Error("got error response on ContactsGetTopPeers", zap.Error(domain.ParseServerError(m.Message))) - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - switch { - case domain.CheckError(x, msg.ErrCodeUnavailable, msg.ErrItemUserID): - fallthrough - case domain.CheckError(x, msg.ErrCodeInvalid, msg.ErrItemAccessHash): - fallthrough - case domain.CheckErrorCode(x, msg.ErrCodeAccess): - waitGroup.Done() - return - case domain.CheckErrorCode(x, msg.ErrCodeRateLimit): - time.Sleep(time.Second * time.Duration(tools.StrToInt64(x.Items))) - } - ctrl.GetAllTopPeers(waitGroup, teamID, teamAccess, cat, offset, limit) - case msg.C_ContactsTopPeers: - x := msg.ContactsTopPeers{} - err := x.Unmarshal(m.Message) - if err != nil { - logger.Error("cannot unmarshal server response on MessagesGetDialogs", zap.Error(err)) - return - } + req := &msg.ContactsGetTopPeers{ + Limit: limit, + Offset: offset, + Category: cat, + } + ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + teamID, teamAccess, domain.NextRequestID(), msg.C_ContactsGetTopPeers, req, + func() { + // If timeout, then retry the request + logger.Warn("Timeout! on GetAllTopPeers, retrying ...", zap.String("Cat", cat.String())) + _, _ = ctrl.AuthRecall("GetAllTopPeers") + ctrl.GetAllTopPeers(waitGroup, teamID, teamAccess, cat, offset, limit) + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case rony.C_Error: + logger.Error("got error response on ContactsGetTopPeers", zap.Error(domain.ParseServerError(m.Message))) + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + switch { + case domain.CheckError(x, msg.ErrCodeUnavailable, msg.ErrItemUserID): + fallthrough + case domain.CheckError(x, msg.ErrCodeInvalid, msg.ErrItemAccessHash): + fallthrough + case domain.CheckErrorCode(x, msg.ErrCodeAccess): + waitGroup.Done() + return + case domain.CheckErrorCode(x, msg.ErrCodeRateLimit): + time.Sleep(time.Second * time.Duration(tools.StrToInt64(x.Items))) + } + ctrl.GetAllTopPeers(waitGroup, teamID, teamAccess, cat, offset, limit) + case msg.C_ContactsTopPeers: + x := msg.ContactsTopPeers{} + err := x.Unmarshal(m.Message) + if err != nil { + logger.Error("cannot unmarshal server response on MessagesGetDialogs", zap.Error(err)) + return + } - if len(x.Peers) >= int(limit) { - ctrl.GetAllTopPeers(waitGroup, teamID, teamAccess, cat, offset+limit, limit) - } else { - waitGroup.Done() - uiexec.ExecDataSynced(true, false, false) - } - } - }, nil, - false, 0, 0, - ), - ) + if len(x.Peers) >= int(limit) { + ctrl.GetAllTopPeers(waitGroup, teamID, teamAccess, cat, offset+limit, limit) + } else { + waitGroup.Done() + uiexec.ExecDataSynced(true, false, false) + } + } + }, nil, + false, 0, 0, + ), + ) } func (ctrl *Controller) GetLabels(waitGroup *sync.WaitGroup, teamID int64, teamAccess uint64) { - logger.Info("calls GetLabels") - ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - teamID, teamAccess, domain.NextRequestID(), msg.C_LabelsGet, &msg.LabelsGet{}, - func() { - // If timeout, then retry the request - logger.Warn("Timeout! on LabelsGet, retrying ...") - _, _ = ctrl.AuthRecall("LabelsGet") - ctrl.GetLabels(waitGroup, teamID, teamAccess) - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case rony.C_Error: - logger.Error("got error response on LabelsGet", zap.Error(domain.ParseServerError(m.Message))) - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - switch { - case domain.CheckError(x, msg.ErrCodeUnavailable, msg.ErrItemUserID): - fallthrough - case domain.CheckError(x, msg.ErrCodeInvalid, msg.ErrItemAccessHash): - fallthrough - case domain.CheckErrorCode(x, msg.ErrCodeAccess): - waitGroup.Done() - return - case domain.CheckErrorCode(x, msg.ErrCodeRateLimit): - time.Sleep(time.Second * time.Duration(tools.StrToInt64(x.Items))) - } - ctrl.GetLabels(waitGroup, teamID, teamAccess) - case msg.C_LabelsMany: - waitGroup.Done() - } - }, nil, - false, 0, 0, - ), - ) + logger.Info("calls GetLabels") + ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + teamID, teamAccess, domain.NextRequestID(), msg.C_LabelsGet, &msg.LabelsGet{}, + func() { + // If timeout, then retry the request + logger.Warn("Timeout! on LabelsGet, retrying ...") + _, _ = ctrl.AuthRecall("LabelsGet") + ctrl.GetLabels(waitGroup, teamID, teamAccess) + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case rony.C_Error: + logger.Error("got error response on LabelsGet", zap.Error(domain.ParseServerError(m.Message))) + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + switch { + case domain.CheckError(x, msg.ErrCodeUnavailable, msg.ErrItemUserID): + fallthrough + case domain.CheckError(x, msg.ErrCodeInvalid, msg.ErrItemAccessHash): + fallthrough + case domain.CheckErrorCode(x, msg.ErrCodeAccess): + waitGroup.Done() + return + case domain.CheckErrorCode(x, msg.ErrCodeRateLimit): + time.Sleep(time.Second * time.Duration(tools.StrToInt64(x.Items))) + } + ctrl.GetLabels(waitGroup, teamID, teamAccess) + case msg.C_LabelsMany: + waitGroup.Done() + } + }, nil, + false, 0, 0, + ), + ) } func (ctrl *Controller) GetContacts(waitGroup *sync.WaitGroup, teamID int64, teamAccess uint64) { - logger.Debug("calls GetContacts") + logger.Debug("calls GetContacts") - contactsGetHash, _ := repo.System.LoadInt(domain.GetContactsGetHashKey(teamID)) - req := &msg.ContactsGet{ - Crc32Hash: uint32(contactsGetHash), - } - ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - teamID, teamAccess, domain.NextRequestID(), msg.C_ContactsGet, req, - func() { - ctrl.GetContacts(waitGroup, teamID, teamAccess) - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case rony.C_Error: - x := new(rony.Error) - _ = x.Unmarshal(m.Message) - if x.Code == msg.ErrCodeUnavailable && x.Items == msg.ErrItemUserID { - waitGroup.Done() - return - } else if x.Code == msg.ErrCodeRateLimit { - time.Sleep(time.Second * time.Duration(tools.StrToInt64(x.Items))) - } - ctrl.GetContacts(waitGroup, teamID, teamAccess) + contactsGetHash, _ := repo.System.LoadInt(domain.GetContactsGetHashKey(teamID)) + req := &msg.ContactsGet{ + Crc32Hash: uint32(contactsGetHash), + } + ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + teamID, teamAccess, domain.NextRequestID(), msg.C_ContactsGet, req, + func() { + ctrl.GetContacts(waitGroup, teamID, teamAccess) + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case rony.C_Error: + x := new(rony.Error) + _ = x.Unmarshal(m.Message) + if x.Code == msg.ErrCodeUnavailable && x.Items == msg.ErrItemUserID { + waitGroup.Done() + return + } else if x.Code == msg.ErrCodeRateLimit { + time.Sleep(time.Second * time.Duration(tools.StrToInt64(x.Items))) + } + ctrl.GetContacts(waitGroup, teamID, teamAccess) - default: - waitGroup.Done() - } - // Controller applier will take care of this - }, nil, - false, 0, 0, - ), - ) + default: + waitGroup.Done() + } + // Controller applier will take care of this + }, nil, + false, 0, 0, + ), + ) } func (ctrl *Controller) Logout(waitGroup *sync.WaitGroup, retry int) { - if retry <= 0 { - waitGroup.Done() - return - } - go ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_AuthLogout, &msg.AuthLogout{}, - func() { - logger.Info("Logout Request was timeout, will retry") - ctrl.networkCtrl.Reconnect() - ctrl.Logout(waitGroup, retry-1) - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - logger.Warn("got error on AuthLogout", zap.String("Code", x.Code), zap.String("Item", x.Items)) - ctrl.Logout(waitGroup, retry-1) - default: - waitGroup.Done() - } - // Controller applier will take care of this - }, nil, - false, request.SkipFlusher, 0, - ), - ) + if retry <= 0 { + waitGroup.Done() + return + } + go ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_AuthLogout, &msg.AuthLogout{}, + func() { + logger.Info("Logout Request was timeout, will retry") + ctrl.networkCtrl.Reconnect() + ctrl.Logout(waitGroup, retry-1) + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + logger.Warn("got error on AuthLogout", zap.String("Code", x.Code), zap.String("Item", x.Items)) + ctrl.Logout(waitGroup, retry-1) + default: + waitGroup.Done() + } + // Controller applier will take care of this + }, nil, + false, request.SkipFlusher, 0, + ), + ) } func (ctrl *Controller) UpdateStatus(online bool) { - req := &msg.AccountUpdateStatus{ - Online: online, - } - retry := 3 - go ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_AccountUpdateStatus, req, - func() { - if retry--; retry > 0 { - time.Sleep(time.Second) - ctrl.UpdateStatus(online) - } - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - logger.Warn("got error on AccountUpdateStatus", zap.Error(x)) - } - // Controller applier will take care of this - }, nil, - false, 0, 0, - ), - ) + req := &msg.AccountUpdateStatus{ + Online: online, + } + retry := 3 + go ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_AccountUpdateStatus, req, + func() { + if retry--; retry > 0 { + time.Sleep(time.Second) + ctrl.UpdateStatus(online) + } + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + logger.Warn("got error on AccountUpdateStatus", zap.Error(x)) + } + // Controller applier will take care of this + }, nil, + false, 0, 0, + ), + ) } diff --git a/internal/ctrl_sync/synchronizer.go b/internal/ctrl_sync/synchronizer.go index 5707290b..97224d29 100644 --- a/internal/ctrl_sync/synchronizer.go +++ b/internal/ctrl_sync/synchronizer.go @@ -1,670 +1,671 @@ package syncCtrl import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/ctrl_file" - "git.ronaksoft.com/river/sdk/internal/ctrl_network" - "git.ronaksoft.com/river/sdk/internal/ctrl_queue" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/internal/uiexec" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/registry" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "sort" - "sync" - "time" + "fmt" + "sort" + "sync" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + fileCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_file" + networkCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_network" + queueCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_queue" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/internal/uiexec" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/registry" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) var ( - logger *logs.Logger + logger *logs.Logger ) func init() { - logger = logs.With("SyncCtrl") + logger = logs.With("SyncCtrl") } // Config sync controller required configs type Config struct { - ConnInfo domain.RiverConfigurator - NetworkCtrl *networkCtrl.Controller - QueueCtrl *queueCtrl.Controller - FileCtrl *fileCtrl.Controller - SyncStatusChangeCB domain.SyncStatusChangeCallback - AppUpdateCB domain.AppUpdateCallback + ConnInfo domain.RiverConfigurator + NetworkCtrl *networkCtrl.Controller + QueueCtrl *queueCtrl.Controller + FileCtrl *fileCtrl.Controller + SyncStatusChangeCB domain.SyncStatusChangeCallback + AppUpdateCB domain.AppUpdateCallback } // Controller cache received data from server to client DB type Controller struct { - connInfo domain.RiverConfigurator - networkCtrl *networkCtrl.Controller - queueCtrl *queueCtrl.Controller - fileCtrl *fileCtrl.Controller - - syncStatus domain.SyncStatus - lastUpdateReceived int64 - updateID int64 - updateAppliers map[int64]domain.UpdateApplier - messageAppliers map[int64]domain.MessageApplier - userID int64 - - // Callbacks - syncStatusChangeCallback domain.SyncStatusChangeCallback - appUpdateCallback domain.AppUpdateCallback + connInfo domain.RiverConfigurator + networkCtrl *networkCtrl.Controller + queueCtrl *queueCtrl.Controller + fileCtrl *fileCtrl.Controller + + syncStatus domain.SyncStatus + lastUpdateReceived int64 + updateID int64 + updateAppliers map[int64]domain.UpdateApplier + messageAppliers map[int64]domain.MessageApplier + userID int64 + + // Callbacks + syncStatusChangeCallback domain.SyncStatusChangeCallback + appUpdateCallback domain.AppUpdateCallback } // NewSyncController create new instance func NewSyncController(config Config) *Controller { - ctrl := &Controller{ - connInfo: config.ConnInfo, - queueCtrl: config.QueueCtrl, - networkCtrl: config.NetworkCtrl, - fileCtrl: config.FileCtrl, - } - - if config.SyncStatusChangeCB == nil { - config.SyncStatusChangeCB = func(newStatus domain.SyncStatus) {} - } - ctrl.syncStatusChangeCallback = config.SyncStatusChangeCB - - if config.AppUpdateCB == nil { - config.AppUpdateCB = func(version string, updateAvailable, force bool) {} - } - ctrl.appUpdateCallback = config.AppUpdateCB - - ctrl.updateAppliers = map[int64]domain.UpdateApplier{} - ctrl.messageAppliers = map[int64]domain.MessageApplier{} - return ctrl + ctrl := &Controller{ + connInfo: config.ConnInfo, + queueCtrl: config.QueueCtrl, + networkCtrl: config.NetworkCtrl, + fileCtrl: config.FileCtrl, + } + + if config.SyncStatusChangeCB == nil { + config.SyncStatusChangeCB = func(newStatus domain.SyncStatus) {} + } + ctrl.syncStatusChangeCallback = config.SyncStatusChangeCB + + if config.AppUpdateCB == nil { + config.AppUpdateCB = func(version string, updateAvailable, force bool) {} + } + ctrl.appUpdateCallback = config.AppUpdateCB + + ctrl.updateAppliers = map[int64]domain.UpdateApplier{} + ctrl.messageAppliers = map[int64]domain.MessageApplier{} + return ctrl } func (ctrl *Controller) RegisterUpdateApplier(constructor int64, ua domain.UpdateApplier) { - _, ok := ctrl.updateAppliers[constructor] - if ok { - panic(fmt.Sprintf("BUG!!::update applier already registered: %s", registry.ConstructorName(constructor))) - } - ctrl.updateAppliers[constructor] = ua + _, ok := ctrl.updateAppliers[constructor] + if ok { + panic(fmt.Sprintf("BUG!!::update applier already registered: %s", registry.ConstructorName(constructor))) + } + ctrl.updateAppliers[constructor] = ua } func (ctrl *Controller) RegisterMessageApplier(constructor int64, ma domain.MessageApplier) { - _, ok := ctrl.messageAppliers[constructor] - if ok { - panic(fmt.Sprintf("BUG!!::update applier already registered: %s", registry.ConstructorName(constructor))) - } - ctrl.messageAppliers[constructor] = ma + _, ok := ctrl.messageAppliers[constructor] + if ok { + panic(fmt.Sprintf("BUG!!::update applier already registered: %s", registry.ConstructorName(constructor))) + } + ctrl.messageAppliers[constructor] = ma } // watchDog // Checks if we have not received any updates since last watch tries to re-sync with server. func (ctrl *Controller) watchDog() { - syncTime := 3 * time.Minute - t := time.NewTimer(syncTime) - for { - if !t.Stop() { - <-t.C - } - t.Reset(syncTime) - - <-t.C - // Skip if we are not connected to server - if !ctrl.networkCtrl.Connected() { - break - } - - // Check if we were not syncing in the last 3 minutes - if time.Duration(tools.NanoTime()-ctrl.lastUpdateReceived) > syncTime { - go ctrl.Sync() - } - } + syncTime := 3 * time.Minute + t := time.NewTimer(syncTime) + for { + if !t.Stop() { + <-t.C + } + t.Reset(syncTime) + + <-t.C + // Skip if we are not connected to server + if !ctrl.networkCtrl.Connected() { + break + } + + // Check if we were not syncing in the last 3 minutes + if time.Duration(tools.NanoTime()-ctrl.lastUpdateReceived) > syncTime { + go ctrl.Sync() + } + } } func (ctrl *Controller) SetSynced() { - updateSyncStatus(ctrl, domain.Synced) + updateSyncStatus(ctrl, domain.Synced) } func (ctrl *Controller) Sync() { - _, _, _ = domain.SingleFlight.Do("Sync", func() (i interface{}, e error) { - // There is no need to sync when no user has been authorized - if ctrl.GetUserID() == 0 { - logger.Debug("does not sync when no user is set") - return - } - - // get updateID from server - var serverUpdateID int64 - var err error - var maxTry = 3 - for { - serverUpdateID, err = ctrl.AuthRecall("Sync") - if err != nil { - logger.Warn("got err on AuthRecall", zap.Error(err)) - time.Sleep(time.Duration(domain.RandomInt(1000)) * time.Millisecond) - if maxTry--; maxTry < 0 { - return - } - } else { - break - } - } - - if ctrl.GetUpdateID() == serverUpdateID { - updateSyncStatus(ctrl, domain.Synced) - return - } - - // Update the sync controller status - updateSyncStatus(ctrl, domain.Syncing) - - ctrlUpdateID := ctrl.GetUpdateID() - if ctrlUpdateID == 0 || (serverUpdateID-ctrlUpdateID) > domain.SnapshotSyncThreshold { - logger.Info("goes for a Snapshot sync") - - // Get Contacts from the server - waitGroup := &sync.WaitGroup{} - waitGroup.Add(8) - go ctrl.GetContacts(waitGroup, 0, 0) - go ctrl.GetAllDialogs(waitGroup, 0, 0, 0, 250) - go ctrl.GetLabels(waitGroup, 0, 0) - go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_Users, 0, 100) - go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_Groups, 0, 100) - go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_Forwards, 0, 100) - go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_BotsMessage, 0, 100) - go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_BotsInline, 0, 100) - waitGroup.Wait() - - if err := ctrl.SetUpdateID(serverUpdateID); err != nil { - logger.Error("couldn't save the current GetUpdateID", zap.Error(err)) - return - } - updateSyncStatus(ctrl, domain.Synced) - } else if serverUpdateID >= ctrl.GetUpdateID()+1 { - logger.Info("goes for a Sequential sync") - getUpdateDifference(ctrl, serverUpdateID) - updateSyncStatus(ctrl, domain.Synced) - } - return nil, nil - }) + _, _, _ = domain.SingleFlight.Do("Sync", func() (i interface{}, e error) { + // There is no need to sync when no user has been authorized + if ctrl.GetUserID() == 0 { + logger.Debug("does not sync when no user is set") + return + } + + // get updateID from server + var serverUpdateID int64 + var err error + var maxTry = 3 + for { + serverUpdateID, err = ctrl.AuthRecall("Sync") + if err != nil { + logger.Warn("got err on AuthRecall", zap.Error(err)) + time.Sleep(time.Duration(domain.RandomInt(1000)) * time.Millisecond) + if maxTry--; maxTry < 0 { + return + } + } else { + break + } + } + + if ctrl.GetUpdateID() == serverUpdateID { + updateSyncStatus(ctrl, domain.Synced) + return + } + + // Update the sync controller status + updateSyncStatus(ctrl, domain.Syncing) + + ctrlUpdateID := ctrl.GetUpdateID() + if ctrlUpdateID == 0 || (serverUpdateID-ctrlUpdateID) > domain.SnapshotSyncThreshold { + logger.Info("goes for a Snapshot sync") + + // Get Contacts from the server + waitGroup := &sync.WaitGroup{} + waitGroup.Add(8) + go ctrl.GetContacts(waitGroup, 0, 0) + go ctrl.GetAllDialogs(waitGroup, 0, 0, 0, 250) + go ctrl.GetLabels(waitGroup, 0, 0) + go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_Users, 0, 100) + go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_Groups, 0, 100) + go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_Forwards, 0, 100) + go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_BotsMessage, 0, 100) + go ctrl.GetAllTopPeers(waitGroup, 0, 0, msg.TopPeerCategory_BotsInline, 0, 100) + waitGroup.Wait() + + if err := ctrl.SetUpdateID(serverUpdateID); err != nil { + logger.Error("couldn't save the current GetUpdateID", zap.Error(err)) + return + } + updateSyncStatus(ctrl, domain.Synced) + } else if serverUpdateID >= ctrl.GetUpdateID()+1 { + logger.Info("goes for a Sequential sync") + getUpdateDifference(ctrl, serverUpdateID) + updateSyncStatus(ctrl, domain.Synced) + } + return nil, nil + }) } func updateSyncStatus(ctrl *Controller, newStatus domain.SyncStatus) { - if ctrl.syncStatus == newStatus { - return - } - logger.Info("status changed", zap.String("Status", newStatus.ToString())) - ctrl.syncStatus = newStatus - ctrl.syncStatusChangeCallback(newStatus) + if ctrl.syncStatus == newStatus { + return + } + logger.Info("status changed", zap.String("Status", newStatus.ToString())) + ctrl.syncStatus = newStatus + ctrl.syncStatusChangeCallback(newStatus) } func getUpdateDifference(ctrl *Controller, serverUpdateID int64) { - logger.Info("calls UpdateGetDifference", - zap.Int64("ServerUpdateID", serverUpdateID), - zap.Int64("ClientUpdateID", ctrl.GetUpdateID()), - ) - - for serverUpdateID > ctrl.GetUpdateID() { - limit := serverUpdateID - ctrl.GetUpdateID() - if limit > 250 { - limit = 250 - } - if limit <= 0 { - break - } - - // Break the loop if userID is set to zero - if ctrl.GetUserID() == 0 { - break - } - req := &msg.UpdateGetDifference{ - Limit: int32(limit), - From: ctrl.GetUpdateID() + 1, // +1 cuz we already have ctrl.updateID itself, - } - - ctrl.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_UpdateGetDifference, req, - func() { - logger.Warn("got timeout on UpdateGetDifference") - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_UpdateDifference: - x := new(msg.UpdateDifference) - err := x.Unmarshal(m.Message) - if err != nil { - logger.Error("couldn't unmarshal response (UpdateDifference)", zap.Error(err)) - time.Sleep(time.Second) - return - } - sort.Slice(x.Updates, func(i, j int) bool { - return x.Updates[i].UpdateID < x.Updates[j].UpdateID - }) - - onGetDifferenceSucceed(ctrl, x) - if x.CurrentUpdateID != 0 { - serverUpdateID = x.CurrentUpdateID - } - - // If there is no more update then set ClientUpdateID to the ServerUpdateID - if !x.More { - _ = ctrl.SetUpdateID(x.CurrentUpdateID) - } - case rony.C_Error: - logger.Debug("got error response", - zap.String("Error", domain.ParseServerError(m.Message).Error()), - ) - - } - - }, nil, - false, request.SkipFlusher, domain.WebsocketRequestTimeoutLong, - ), - ) - - } + logger.Info("calls UpdateGetDifference", + zap.Int64("ServerUpdateID", serverUpdateID), + zap.Int64("ClientUpdateID", ctrl.GetUpdateID()), + ) + + for serverUpdateID > ctrl.GetUpdateID() { + limit := serverUpdateID - ctrl.GetUpdateID() + if limit > 250 { + limit = 250 + } + if limit <= 0 { + break + } + + // Break the loop if userID is set to zero + if ctrl.GetUserID() == 0 { + break + } + req := &msg.UpdateGetDifference{ + Limit: int32(limit), + From: ctrl.GetUpdateID() + 1, // +1 cuz we already have ctrl.updateID itself, + } + + ctrl.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_UpdateGetDifference, req, + func() { + logger.Warn("got timeout on UpdateGetDifference") + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_UpdateDifference: + x := new(msg.UpdateDifference) + err := x.Unmarshal(m.Message) + if err != nil { + logger.Error("couldn't unmarshal response (UpdateDifference)", zap.Error(err)) + time.Sleep(time.Second) + return + } + sort.Slice(x.Updates, func(i, j int) bool { + return x.Updates[i].UpdateID < x.Updates[j].UpdateID + }) + + onGetDifferenceSucceed(ctrl, x) + if x.CurrentUpdateID != 0 { + serverUpdateID = x.CurrentUpdateID + } + + // If there is no more update then set ClientUpdateID to the ServerUpdateID + if !x.More { + _ = ctrl.SetUpdateID(x.CurrentUpdateID) + } + case rony.C_Error: + logger.Debug("got error response", + zap.String("Error", domain.ParseServerError(m.Message).Error()), + ) + + } + + }, nil, + false, request.SkipFlusher, domain.WebsocketRequestTimeoutLong, + ), + ) + + } } func getUpdateTargetID(u *msg.UpdateEnvelope) string { - switch u.Constructor { - case msg.C_UpdateNewMessage: - x := &msg.UpdateNewMessage{} - _ = x.Unmarshal(u.Update) - return fmt.Sprintf("NewMessage_%d_%d_%d", x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - case msg.C_UpdateDraftMessage: - x := &msg.UpdateDraftMessage{} - _ = x.Unmarshal(u.Update) - return fmt.Sprintf("DraftMessage_%d_%d_%d", x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - case msg.C_UpdateDraftMessageCleared: - x := &msg.UpdateDraftMessageCleared{} - _ = x.Unmarshal(u.Update) - return fmt.Sprintf("DraftMessage_%d_%d_%d", x.TeamID, x.Peer.ID, x.Peer.Type) - case msg.C_UpdateReadHistoryInbox: - x := &msg.UpdateReadHistoryInbox{} - _ = x.Unmarshal(u.Update) - return fmt.Sprintf("ReadHistoryIn_%d_%d_%d", x.TeamID, x.Peer.ID, x.Peer.Type) - case msg.C_UpdateReadHistoryOutbox: - x := &msg.UpdateReadHistoryOutbox{} - _ = x.Unmarshal(u.Update) - return fmt.Sprintf("ReadHistoryOut_%d_%d_%d", x.TeamID, x.Peer.ID, x.Peer.Type) - default: - return fmt.Sprintf("%d", u.Constructor) - } + switch u.Constructor { + case msg.C_UpdateNewMessage: + x := &msg.UpdateNewMessage{} + _ = x.Unmarshal(u.Update) + return fmt.Sprintf("NewMessage_%d_%d_%d", x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + case msg.C_UpdateDraftMessage: + x := &msg.UpdateDraftMessage{} + _ = x.Unmarshal(u.Update) + return fmt.Sprintf("DraftMessage_%d_%d_%d", x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + case msg.C_UpdateDraftMessageCleared: + x := &msg.UpdateDraftMessageCleared{} + _ = x.Unmarshal(u.Update) + return fmt.Sprintf("DraftMessage_%d_%d_%d", x.TeamID, x.Peer.ID, x.Peer.Type) + case msg.C_UpdateReadHistoryInbox: + x := &msg.UpdateReadHistoryInbox{} + _ = x.Unmarshal(u.Update) + return fmt.Sprintf("ReadHistoryIn_%d_%d_%d", x.TeamID, x.Peer.ID, x.Peer.Type) + case msg.C_UpdateReadHistoryOutbox: + x := &msg.UpdateReadHistoryOutbox{} + _ = x.Unmarshal(u.Update) + return fmt.Sprintf("ReadHistoryOut_%d_%d_%d", x.TeamID, x.Peer.ID, x.Peer.Type) + default: + return fmt.Sprintf("%d", u.Constructor) + } } func onGetDifferenceSucceed(ctrl *Controller, x *msg.UpdateDifference) { - mtx := sync.Mutex{} - updContainer := &msg.UpdateContainer{ - Updates: make([]*msg.UpdateEnvelope, 0), - Users: x.Users, - Groups: x.Groups, - MaxUpdateID: x.MaxUpdateID, - MinUpdateID: x.MinUpdateID, - } - var ( - startTime = tools.NanoTime() - timeLapse [2]int64 - ) - - logger.Info("received UpdateDifference", - zap.Int64("MaxUpdateID", x.MaxUpdateID), - zap.Int64("MinUpdateID", x.MinUpdateID), - zap.Int("Length", len(x.Updates)), - zap.Bool("More", x.More), - ) - defer func() { - endTime := tools.NanoTime() - logger.Info("applied UpdateDifference", - zap.Int("Length", len(x.Updates)), - zap.Duration("Messages", time.Duration(timeLapse[1]-timeLapse[0])), - zap.Duration("Others", time.Duration(endTime-timeLapse[1])), - zap.Duration("D", time.Duration(endTime-startTime)), - ) - }() - - if len(x.Updates) == 0 { - return - } - - // save Groups & Users - waitGroup := pools.AcquireWaitGroup() - defer pools.ReleaseWaitGroup(waitGroup) - - waitGroup.Add(2) - go func() { - _ = repo.Groups.Save(x.Groups...) - waitGroup.Done() - }() - go func() { - _ = repo.Users.Save(x.Users...) - waitGroup.Done() - }() - - applierFlusher := tools.NewFlusherPool(16, 10, func(targetID string, entries []tools.FlushEntry) { - for _, e := range entries { - ue := e.Value().(*msg.UpdateEnvelope) - if applier, ok := ctrl.updateAppliers[ue.Constructor]; ok { - externalHandlerUpdates, err := applier(ue) - if err != nil { - logger.Warn("got error on UpdateDifference", - zap.Error(err), - zap.Int64("UpdateID", ue.UpdateID), - zap.String("C", registry.ConstructorName(ue.Constructor)), - ) - break - } - mtx.Lock() - updContainer.Updates = append(updContainer.Updates, externalHandlerUpdates...) - mtx.Unlock() - } else { - mtx.Lock() - updContainer.Updates = append(updContainer.Updates, ue) - mtx.Unlock() - } - } - }) - waitGroup.Wait() - - // Separate updates into categories based on their constructor - var queues [2][]*msg.UpdateEnvelope - for _, update := range x.Updates { - switch update.Constructor { - case msg.C_UpdateNewMessage: - queues[0] = append(queues[0], update) - default: - queues[1] = append(queues[1], update) - } - } - - // apply updates based on their priority queue - for idx, updates := range queues { - timeLapse[idx] = tools.NanoTime() - for _, ue := range updates { - logger.Info("UpdateDifference applies", - zap.Int64("UpdateID", ue.UpdateID), - zap.String("C", registry.ConstructorName(ue.Constructor)), - ) - waitGroup.Add(1) - applierFlusher.Enter( - getUpdateTargetID(ue), - tools.NewEntryWithCallback(ue, func() { - waitGroup.Done() - }), - ) - } - waitGroup.Wait() - } - - if x.MaxUpdateID != 0 { - _ = ctrl.SetUpdateID(x.MaxUpdateID) - } - updContainer.Length = int32(len(updContainer.Updates)) - - uiexec.ExecUpdate(msg.C_UpdateContainer, updContainer) + mtx := sync.Mutex{} + updContainer := &msg.UpdateContainer{ + Updates: make([]*msg.UpdateEnvelope, 0), + Users: x.Users, + Groups: x.Groups, + MaxUpdateID: x.MaxUpdateID, + MinUpdateID: x.MinUpdateID, + } + var ( + startTime = tools.NanoTime() + timeLapse [2]int64 + ) + + logger.Info("received UpdateDifference", + zap.Int64("MaxUpdateID", x.MaxUpdateID), + zap.Int64("MinUpdateID", x.MinUpdateID), + zap.Int("Length", len(x.Updates)), + zap.Bool("More", x.More), + ) + defer func() { + endTime := tools.NanoTime() + logger.Info("applied UpdateDifference", + zap.Int("Length", len(x.Updates)), + zap.Duration("Messages", time.Duration(timeLapse[1]-timeLapse[0])), + zap.Duration("Others", time.Duration(endTime-timeLapse[1])), + zap.Duration("D", time.Duration(endTime-startTime)), + ) + }() + + if len(x.Updates) == 0 { + return + } + + // save Groups & Users + waitGroup := pools.AcquireWaitGroup() + defer pools.ReleaseWaitGroup(waitGroup) + + waitGroup.Add(2) + go func() { + _ = repo.Groups.Save(x.Groups...) + waitGroup.Done() + }() + go func() { + _ = repo.Users.Save(x.Users...) + waitGroup.Done() + }() + + applierFlusher := tools.NewFlusherPool(16, 10, func(targetID string, entries []tools.FlushEntry) { + for _, e := range entries { + ue := e.Value().(*msg.UpdateEnvelope) + if applier, ok := ctrl.updateAppliers[ue.Constructor]; ok { + externalHandlerUpdates, err := applier(ue) + if err != nil { + logger.Warn("got error on UpdateDifference", + zap.Error(err), + zap.Int64("UpdateID", ue.UpdateID), + zap.String("C", registry.ConstructorName(ue.Constructor)), + ) + break + } + mtx.Lock() + updContainer.Updates = append(updContainer.Updates, externalHandlerUpdates...) + mtx.Unlock() + } else { + mtx.Lock() + updContainer.Updates = append(updContainer.Updates, ue) + mtx.Unlock() + } + } + }) + waitGroup.Wait() + + // Separate updates into categories based on their constructor + var queues [2][]*msg.UpdateEnvelope + for _, update := range x.Updates { + switch update.Constructor { + case msg.C_UpdateNewMessage: + queues[0] = append(queues[0], update) + default: + queues[1] = append(queues[1], update) + } + } + + // apply updates based on their priority queue + for idx, updates := range queues { + timeLapse[idx] = tools.NanoTime() + for _, ue := range updates { + logger.Info("UpdateDifference applies", + zap.Int64("UpdateID", ue.UpdateID), + zap.String("C", registry.ConstructorName(ue.Constructor)), + ) + waitGroup.Add(1) + applierFlusher.Enter( + getUpdateTargetID(ue), + tools.NewEntryWithCallback(ue, func() { + waitGroup.Done() + }), + ) + } + waitGroup.Wait() + } + + if x.MaxUpdateID != 0 { + _ = ctrl.SetUpdateID(x.MaxUpdateID) + } + updContainer.Length = int32(len(updContainer.Updates)) + + uiexec.ExecUpdate(msg.C_UpdateContainer, updContainer) } func (ctrl *Controller) TeamSync(teamID int64, accessHash uint64, forceUpdate bool) { - teamKey := fmt.Sprintf("%s.%d", domain.SkTeam, teamID) - - if !forceUpdate { - lastSync, _ := repo.System.LoadInt64(teamKey) - if lastSync > 0 { - // we have been already synced - return - } - } - - // Get Contacts from the server - waitGroup := &sync.WaitGroup{} - waitGroup.Add(8) - go ctrl.GetContacts(waitGroup, teamID, accessHash) - go ctrl.GetAllDialogs(waitGroup, teamID, accessHash, 0, 250) - go ctrl.GetLabels(waitGroup, teamID, accessHash) - go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_Users, 0, 100) - go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_Groups, 0, 100) - go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_Forwards, 0, 100) - go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_BotsMessage, 0, 100) - go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_BotsInline, 0, 100) - waitGroup.Wait() - - // if this is the first time we switch to this team, then lets sync with server - err := repo.System.SaveInt(teamKey, uint64(tools.TimeUnix())) - logger.WarnOnErr("Team Sync", err) + teamKey := fmt.Sprintf("%s.%d", domain.SkTeam, teamID) + + if !forceUpdate { + lastSync, _ := repo.System.LoadInt64(teamKey) + if lastSync > 0 { + // we have been already synced + return + } + } + + // Get Contacts from the server + waitGroup := &sync.WaitGroup{} + waitGroup.Add(8) + go ctrl.GetContacts(waitGroup, teamID, accessHash) + go ctrl.GetAllDialogs(waitGroup, teamID, accessHash, 0, 250) + go ctrl.GetLabels(waitGroup, teamID, accessHash) + go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_Users, 0, 100) + go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_Groups, 0, 100) + go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_Forwards, 0, 100) + go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_BotsMessage, 0, 100) + go ctrl.GetAllTopPeers(waitGroup, teamID, accessHash, msg.TopPeerCategory_BotsInline, 0, 100) + waitGroup.Wait() + + // if this is the first time we switch to this team, then lets sync with server + err := repo.System.SaveInt(teamKey, uint64(tools.TimeUnix())) + logger.WarnOnErr("Team Sync", err) } func (ctrl *Controller) SetUserID(userID int64) { - ctrl.userID = userID - logger.Debug("user is set", - zap.Int64("userID", userID), - ) + ctrl.userID = userID + logger.Debug("user is set", + zap.Int64("userID", userID), + ) } func (ctrl *Controller) GetUserID() int64 { - return ctrl.userID + return ctrl.userID } // GetUpdateID returns current updateID func (ctrl *Controller) GetUpdateID() int64 { - return ctrl.updateID + return ctrl.updateID } // SetUpdateID set the controller last update id func (ctrl *Controller) SetUpdateID(id int64) error { - ctrl.updateID = id - return repo.System.SaveInt(domain.SkUpdateID, uint64(id)) + ctrl.updateID = id + return repo.System.SaveInt(domain.SkUpdateID, uint64(id)) } // Start controller func (ctrl *Controller) Start() { - logger.Info("started") - - // Load the latest GetUpdateID stored in DB - if v, err := repo.System.LoadInt(domain.SkUpdateID); err != nil { - err := repo.System.SaveInt(domain.SkUpdateID, 0) - if err != nil { - logger.Error("couldn't save current GetUpdateID", zap.Error(err)) - } - ctrl.updateID = 0 - } else { - ctrl.updateID = int64(v) - } - - // set default value to synced status - updateSyncStatus(ctrl, domain.OutOfSync) - - go ctrl.watchDog() + logger.Info("started") + + // Load the latest GetUpdateID stored in DB + if v, err := repo.System.LoadInt(domain.SkUpdateID); err != nil { + err := repo.System.SaveInt(domain.SkUpdateID, 0) + if err != nil { + logger.Error("couldn't save current GetUpdateID", zap.Error(err)) + } + ctrl.updateID = 0 + } else { + ctrl.updateID = int64(v) + } + + // set default value to synced status + updateSyncStatus(ctrl, domain.OutOfSync) + + go ctrl.watchDog() } // Stop controller func (ctrl *Controller) Stop() { - logger.Info("calls stop") - ctrl.ResetIDs() - logger.Info("Stopped") + logger.Info("calls stop") + ctrl.ResetIDs() + logger.Info("Stopped") } // MessageApplier call appliers-> repository and sync data func (ctrl *Controller) MessageApplier(messages []*rony.MessageEnvelope) { - for _, m := range messages { - switch m.Constructor { - case msg.C_MessagesSent: - // Do nothing - default: - if applier, ok := ctrl.messageAppliers[m.Constructor]; ok { - applier(m) - } - } - } + for _, m := range messages { + switch m.Constructor { + case msg.C_MessagesSent: + // Do nothing + default: + if applier, ok := ctrl.messageAppliers[m.Constructor]; ok { + applier(m) + } + } + } } // UpdateApplier receives update to cache them in client DB func (ctrl *Controller) UpdateApplier(updateContainer *msg.UpdateContainer, outOfSync bool) { - ctrl.lastUpdateReceived = tools.NanoTime() - - udpContainer := &msg.UpdateContainer{ - Updates: make([]*msg.UpdateEnvelope, 0), - MaxUpdateID: updateContainer.MaxUpdateID, - MinUpdateID: updateContainer.MinUpdateID, - Users: updateContainer.Users, - Groups: updateContainer.Groups, - } - - // save Groups & Users - waitGroup := pools.AcquireWaitGroup() - waitGroup.Add(2) - go func() { - _ = repo.Groups.Save(updateContainer.Groups...) - waitGroup.Done() - }() - go func() { - _ = repo.Users.Save(updateContainer.Users...) - waitGroup.Done() - }() - waitGroup.Wait() - pools.ReleaseWaitGroup(waitGroup) - - logger.Debug("receives UpdateContainer", - zap.Int64("ctrl.GetUpdateID", ctrl.GetUpdateID()), - zap.Int64("MaxID", updateContainer.MaxUpdateID), - zap.Int64("MinID", updateContainer.MinUpdateID), - zap.Int("Count", len(updateContainer.Updates)), - ) - - for _, update := range updateContainer.Updates { - - if outOfSync && update.UpdateID != 0 { - continue - } - applier, ok := ctrl.updateAppliers[update.Constructor] - if ok { - logger.Debug("applies Update", - zap.Int64("ctrl.GetUpdateID", ctrl.GetUpdateID()), - zap.Int64("MaxID", updateContainer.MaxUpdateID), - zap.Int64("MinID", updateContainer.MinUpdateID), - zap.String("C", registry.ConstructorName(update.Constructor)), - ) - - externalHandlerUpdates, err := applier(update) - if err != nil { - logger.Error("got error on update applier", - zap.Error(err), - zap.String("C", registry.ConstructorName(update.Constructor)), - zap.Int64("UpdateID", update.UpdateID), - ) - return - } - logger.Info("applied update", - zap.String("C", registry.ConstructorName(update.Constructor)), - zap.Int64("UpdateID", update.UpdateID), - ) - switch update.Constructor { - case msg.C_UpdateMessageID: - default: - udpContainer.Updates = append(udpContainer.Updates, externalHandlerUpdates...) - } - } else { - udpContainer.Updates = append(udpContainer.Updates, update) - } - if update.UpdateID != 0 { - _ = ctrl.SetUpdateID(update.UpdateID) - } - } - - udpContainer.Length = int32(len(udpContainer.Updates)) - uiexec.ExecUpdate(msg.C_UpdateContainer, updateContainer) + ctrl.lastUpdateReceived = tools.NanoTime() + + udpContainer := &msg.UpdateContainer{ + Updates: make([]*msg.UpdateEnvelope, 0), + MaxUpdateID: updateContainer.MaxUpdateID, + MinUpdateID: updateContainer.MinUpdateID, + Users: updateContainer.Users, + Groups: updateContainer.Groups, + } + + // save Groups & Users + waitGroup := pools.AcquireWaitGroup() + waitGroup.Add(2) + go func() { + _ = repo.Groups.Save(updateContainer.Groups...) + waitGroup.Done() + }() + go func() { + _ = repo.Users.Save(updateContainer.Users...) + waitGroup.Done() + }() + waitGroup.Wait() + pools.ReleaseWaitGroup(waitGroup) + + logger.Debug("receives UpdateContainer", + zap.Int64("ctrl.GetUpdateID", ctrl.GetUpdateID()), + zap.Int64("MaxID", updateContainer.MaxUpdateID), + zap.Int64("MinID", updateContainer.MinUpdateID), + zap.Int("Count", len(updateContainer.Updates)), + ) + + for _, update := range updateContainer.Updates { + + if outOfSync && update.UpdateID != 0 { + continue + } + applier, ok := ctrl.updateAppliers[update.Constructor] + if ok { + logger.Debug("applies Update", + zap.Int64("ctrl.GetUpdateID", ctrl.GetUpdateID()), + zap.Int64("MaxID", updateContainer.MaxUpdateID), + zap.Int64("MinID", updateContainer.MinUpdateID), + zap.String("C", registry.ConstructorName(update.Constructor)), + ) + + externalHandlerUpdates, err := applier(update) + if err != nil { + logger.Error("got error on update applier", + zap.Error(err), + zap.String("C", registry.ConstructorName(update.Constructor)), + zap.Int64("UpdateID", update.UpdateID), + ) + return + } + logger.Info("applied update", + zap.String("C", registry.ConstructorName(update.Constructor)), + zap.Int64("UpdateID", update.UpdateID), + ) + switch update.Constructor { + case msg.C_UpdateMessageID: + default: + udpContainer.Updates = append(udpContainer.Updates, externalHandlerUpdates...) + } + } else { + udpContainer.Updates = append(udpContainer.Updates, update) + } + if update.UpdateID != 0 { + _ = ctrl.SetUpdateID(update.UpdateID) + } + } + + udpContainer.Length = int32(len(udpContainer.Updates)) + uiexec.ExecUpdate(msg.C_UpdateContainer, updateContainer) } // ResetIDs reset updateID func (ctrl *Controller) ResetIDs() { - _ = ctrl.SetUpdateID(0) - ctrl.SetUserID(0) + _ = ctrl.SetUpdateID(0) + ctrl.SetUserID(0) } // ContactsImport executes ContactsImport rpc commands func (ctrl *Controller) ContactsImport(replace bool, successCB domain.MessageHandler) { - var ( - wg = sync.WaitGroup{} - limit = 250 - maxTry = 10 - keepGoing = true - contactsImported = &msg.ContactsImported{} - ) - out := &rony.MessageEnvelope{} - - for keepGoing { - phoneContacts, _ := repo.Users.GetPhoneContacts(limit) - if len(phoneContacts) < limit { - keepGoing = false - } - - // We have not more phone contacts left - if len(phoneContacts) == 0 { - break - } - - req := &msg.ContactsImport{ - Replace: replace, - Contacts: phoneContacts, - } - wg.Add(1) - ctrl.queueCtrl.EnqueueCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_ContactsImport, req, - func() { - wg.Done() - logger.Error("got timeout on ContactsImport") - }, - func(m *rony.MessageEnvelope) { - defer wg.Done() - switch m.Constructor { - case msg.C_ContactsImported: - x := &msg.ContactsImported{} - err := x.Unmarshal(m.Message) - if err != nil { - logger.Error("got error on ContactsImport when unmarshal", zap.Error(err)) - return - } - _ = repo.Users.DeletePhoneContact(phoneContacts...) - contactsImported.Users = append(contactsImported.Users, x.Users...) - contactsImported.ContactUsers = append(contactsImported.ContactUsers, x.ContactUsers...) - out.Fill(out.RequestID, msg.C_ContactsImported, contactsImported) - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - out.Fill(out.RequestID, rony.C_Error, x) - switch { - case x.Code == msg.ErrCodeRateLimit: - maxTry = 0 - default: - logger.Warn("got error response from server, will retry", - zap.String("Code", x.Code), zap.String("Item", x.Items), - ) - time.Sleep(time.Second) - } - if maxTry--; maxTry < 0 { - keepGoing = false - } - default: - logger.Error("expected ContactsImported but we got something else!!!", - zap.String("C", registry.ConstructorName(m.Constructor)), - ) - time.Sleep(time.Second) - if maxTry--; maxTry < 0 { - keepGoing = false - } - } - - }, nil, - false, 0, 0, - ), - ) - wg.Wait() - } - if successCB != nil && out != nil { - successCB(out) - } else { - uiexec.ExecDataSynced(false, true, false) - } + var ( + wg = sync.WaitGroup{} + limit = 250 + maxTry = 10 + keepGoing = true + contactsImported = &msg.ContactsImported{} + ) + out := &rony.MessageEnvelope{} + + for keepGoing { + phoneContacts, _ := repo.Users.GetPhoneContacts(limit) + if len(phoneContacts) < limit { + keepGoing = false + } + + // We have not more phone contacts left + if len(phoneContacts) == 0 { + break + } + + req := &msg.ContactsImport{ + Replace: replace, + Contacts: phoneContacts, + } + wg.Add(1) + ctrl.queueCtrl.EnqueueCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_ContactsImport, req, + func() { + wg.Done() + logger.Error("got timeout on ContactsImport") + }, + func(m *rony.MessageEnvelope) { + defer wg.Done() + switch m.Constructor { + case msg.C_ContactsImported: + x := &msg.ContactsImported{} + err := x.Unmarshal(m.Message) + if err != nil { + logger.Error("got error on ContactsImport when unmarshal", zap.Error(err)) + return + } + _ = repo.Users.DeletePhoneContact(phoneContacts...) + contactsImported.Users = append(contactsImported.Users, x.Users...) + contactsImported.ContactUsers = append(contactsImported.ContactUsers, x.ContactUsers...) + out.Fill(out.RequestID, msg.C_ContactsImported, contactsImported) + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + out.Fill(out.RequestID, rony.C_Error, x) + switch { + case x.Code == msg.ErrCodeRateLimit: + maxTry = 0 + default: + logger.Warn("got error response from server, will retry", + zap.String("Code", x.Code), zap.String("Item", x.Items), + ) + time.Sleep(time.Second) + } + if maxTry--; maxTry < 0 { + keepGoing = false + } + default: + logger.Error("expected ContactsImported but we got something else!!!", + zap.String("C", registry.ConstructorName(m.Constructor)), + ) + time.Sleep(time.Second) + if maxTry--; maxTry < 0 { + keepGoing = false + } + } + + }, nil, + false, 0, 0, + ), + ) + wg.Wait() + } + if successCB != nil && out != nil { + successCB(out) + } else { + uiexec.ExecDataSynced(false, true, false) + } } func (ctrl *Controller) GetSyncStatus() domain.SyncStatus { - return ctrl.syncStatus + return ctrl.syncStatus } diff --git a/internal/domain/constants.go b/internal/domain/constants.go index 36a6a521..0ff20c27 100644 --- a/internal/domain/constants.go +++ b/internal/domain/constants.go @@ -1,184 +1,185 @@ package domain import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "time" + "fmt" + "time" + + "github.com/ronaksoft/river-msg/go/msg" ) //go:generate go run update_version.go var ( - ClientPlatform string - ClientVersion string - ClientOS string - ClientVendor string - SysConfig *msg.SystemConfig - - /* - Parameters which prevent sending duplicate requests - */ - ContactsSynced int32 - TimeSynced int32 - ConfigSynced int32 + ClientPlatform string + ClientVersion string + ClientOS string + ClientVendor string + SysConfig *msg.SystemConfig + + /* + Parameters which prevent sending duplicate requests + */ + ContactsSynced int32 + TimeSynced int32 + ConfigSynced int32 ) func init() { - // Set Default SysConfig - SysConfig = &msg.SystemConfig{ - GifBot: "gif", - WikiBot: "wiki", - TestMode: false, - PhoneCallEnabled: false, - ExpireOn: 0, - GroupMaxSize: 250, - ForwardedMaxCount: 50, - OnlineUpdatePeriodInSec: 90, - EditTimeLimitInSec: 86400, - RevokeTimeLimitInSec: 86400, - PinnedDialogsMaxCount: 7, - UrlPrefix: 0, - MessageMaxLength: 4096, - CaptionMaxLength: 4096, - DCs: nil, - MaxLabels: 20, - TopPeerDecayRate: 3500000, - TopPeerMaxStep: 365, - MaxActiveSessions: 10, - // Reactions: []string{"😂", - // "😢", - // "😡", - // "👎", - // "👍", - // "🙋‍♀", - // "🙋‍♂", - // "🛢", - // "❤", - // "🤐", - // "😖", - // "🙁", - // "\U0001F973", - // "🤩", - // "😋", - // "😏", - // "🙏", - // "💯", - // "👏", - // "🤝", - // "😍", - // "🤔", - // "🤒", - // "😱", - // "😜", - // "😴", - // "💩", - // "😭", - // "🤨", - // "🤦‍♀", - // "🙄", - // "✅", - // "💪", - // "👌", - // "🤞"}, - } + // Set Default SysConfig + SysConfig = &msg.SystemConfig{ + GifBot: "gif", + WikiBot: "wiki", + TestMode: false, + PhoneCallEnabled: false, + ExpireOn: 0, + GroupMaxSize: 250, + ForwardedMaxCount: 50, + OnlineUpdatePeriodInSec: 90, + EditTimeLimitInSec: 86400, + RevokeTimeLimitInSec: 86400, + PinnedDialogsMaxCount: 7, + UrlPrefix: 0, + MessageMaxLength: 4096, + CaptionMaxLength: 4096, + DCs: nil, + MaxLabels: 20, + TopPeerDecayRate: 3500000, + TopPeerMaxStep: 365, + MaxActiveSessions: 10, + // Reactions: []string{"😂", + // "😢", + // "😡", + // "👎", + // "👍", + // "🙋‍♀", + // "🙋‍♂", + // "🛢", + // "❤", + // "🤐", + // "😖", + // "🙁", + // "\U0001F973", + // "🤩", + // "😋", + // "😏", + // "🙏", + // "💯", + // "👏", + // "🤝", + // "😍", + // "🤔", + // "🤒", + // "😱", + // "😜", + // "😴", + // "💩", + // "😭", + // "🤨", + // "🤦‍♀", + // "🙄", + // "✅", + // "💪", + // "👌", + // "🤞"}, + } } // Global Parameters const ( - WebsocketIdleTimeout = 5 * time.Minute - WebsocketPingTimeout = 2 * time.Second - WebsocketWriteTime = 3 * time.Second - WebsocketRequestTimeout = 3 * time.Second - WebsocketRequestTimeoutLong = 8 * time.Second - WebsocketDialTimeout = 3 * time.Second - WebsocketDialTimeoutLong = 10 * time.Second - HttpRequestTimeout = 30 * time.Second - HttpRequestTimeShort = 8 * time.Second - SnapshotSyncThreshold = 10000 + WebsocketIdleTimeout = 5 * time.Minute + WebsocketPingTimeout = 2 * time.Second + WebsocketWriteTime = 3 * time.Second + WebsocketRequestTimeout = 3 * time.Second + WebsocketRequestTimeoutLong = 8 * time.Second + WebsocketDialTimeout = 3 * time.Second + WebsocketDialTimeoutLong = 10 * time.Second + HttpRequestTimeout = 30 * time.Second + HttpRequestTimeShort = 8 * time.Second + SnapshotSyncThreshold = 10000 ) // System Keys const ( - SkUpdateID = "UPDATE_ID" - SkDeviceToken = "DEVICE_TOKEN_INFO" - SkContactsImportHash = "CONTACTS_IMPORT_HASH" - SkContactsGetHash = "CONTACTS_GET_HASH" - SkSystemSalts = "SERVER_SALTS" - SkReIndexTime = "RE_INDEX_TS" - SkGifHash = "GIF_HASH" - SkTeam = "TEAM" + SkUpdateID = "UPDATE_ID" + SkDeviceToken = "DEVICE_TOKEN_INFO" + SkContactsImportHash = "CONTACTS_IMPORT_HASH" + SkContactsGetHash = "CONTACTS_GET_HASH" + SkSystemSalts = "SERVER_SALTS" + SkReIndexTime = "RE_INDEX_TS" + SkGifHash = "GIF_HASH" + SkTeam = "TEAM" ) func GetContactsGetHashKey(teamID int64) string { - return fmt.Sprintf("%s.%021d", SkContactsGetHash, teamID) + return fmt.Sprintf("%s.%021d", SkContactsGetHash, teamID) } // NetworkStatus network controller status type NetworkStatus int const ( - NetworkDisconnected NetworkStatus = 0 - NetworkConnecting NetworkStatus = 1 - NetworkConnected NetworkStatus = 4 + NetworkDisconnected NetworkStatus = 0 + NetworkConnecting NetworkStatus = 1 + NetworkConnected NetworkStatus = 4 ) func (ns NetworkStatus) ToString() string { - switch ns { - case NetworkDisconnected: - return "Disconnected" - case NetworkConnecting: - return "Connecting" - case NetworkConnected: - return "Connected" - } - return "Unknown" + switch ns { + case NetworkDisconnected: + return "Disconnected" + case NetworkConnecting: + return "Connecting" + case NetworkConnected: + return "Connected" + } + return "Unknown" } // SyncStatus status of Sync Controller type SyncStatus int const ( - OutOfSync SyncStatus = iota - Syncing - Synced + OutOfSync SyncStatus = iota + Syncing + Synced ) func (ss SyncStatus) ToString() string { - switch ss { - case OutOfSync: - return "OutOfSync" - case Syncing: - return "Syncing" - case Synced: - return "Synced" - } - return "" + switch ss { + case OutOfSync: + return "OutOfSync" + case Syncing: + return "Syncing" + case Synced: + return "Synced" + } + return "" } // UserStatus Times const ( - Minute = 60 - Hour = Minute * 60 - Day = Hour * 24 - Week = Day * 7 + Minute = 60 + Hour = Minute * 60 + Day = Hour * 24 + Week = Day * 7 ) // UserStatus const ( - LastSeenUnknown = iota - LastSeenFewSeconds - LastSeenFewMinutes - LastSeenToday - LastSeenYesterday - LastSeenThisWeek - LastSeenLastWeek - LastSeenThisMonth - LastSeenLongTimeAgo + LastSeenUnknown = iota + LastSeenFewSeconds + LastSeenFewMinutes + LastSeenToday + LastSeenYesterday + LastSeenThisWeek + LastSeenLastWeek + LastSeenThisMonth + LastSeenLongTimeAgo ) // Network Connection const ( - ConnectionNone = iota - ConnectionWifi - ConnectionCellular + ConnectionNone = iota + ConnectionWifi + ConnectionCellular ) diff --git a/internal/domain/handlers.go b/internal/domain/handlers.go index ea2ac43e..a7f3f583 100644 --- a/internal/domain/handlers.go +++ b/internal/domain/handlers.go @@ -1,8 +1,8 @@ package domain import ( - "git.ronaksoft.com/river/msg/go/msg" - "github.com/ronaksoft/rony" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/rony" ) // UpdateReceivedCallback used as relay to pass getDifference updates to UI diff --git a/internal/domain/message_action.go b/internal/domain/message_action.go index ff6f34ff..632c8b05 100644 --- a/internal/domain/message_action.go +++ b/internal/domain/message_action.go @@ -1,48 +1,48 @@ package domain import ( - "git.ronaksoft.com/river/msg/go/msg" + "github.com/ronaksoft/river-msg/go/msg" ) const ( - MessageActionNope int32 = 0x00 - MessageActionContactRegistered int32 = 0x01 - MessageActionGroupCreated int32 = 0x02 - MessageActionGroupAddUser int32 = 0x03 - MessageActionGroupDeleteUser int32 = 0x05 - MessageActionGroupTitleChanged int32 = 0x06 - MessageActionClearHistory int32 = 0x07 + MessageActionNope int32 = 0x00 + MessageActionContactRegistered int32 = 0x01 + MessageActionGroupCreated int32 = 0x02 + MessageActionGroupAddUser int32 = 0x03 + MessageActionGroupDeleteUser int32 = 0x05 + MessageActionGroupTitleChanged int32 = 0x06 + MessageActionClearHistory int32 = 0x07 ) // ExtractActionUserIDs get user ids from MessageActions func ExtractActionUserIDs(act int32, data []byte) []int64 { - res := make([]int64, 0) - switch act { - case MessageActionNope: - case MessageActionContactRegistered: - case MessageActionGroupCreated: - x := &msg.MessageActionGroupCreated{} - err := x.Unmarshal(data) - if err == nil { - res = append(res, x.UserIDs...) - } - case MessageActionGroupAddUser: - x := &msg.MessageActionGroupAddUser{} - err := x.Unmarshal(data) - if err == nil { - res = append(res, x.UserIDs...) - } - case MessageActionGroupDeleteUser: - x := &msg.MessageActionGroupDeleteUser{} - err := x.Unmarshal(data) - if err == nil { - res = append(res, x.UserIDs...) - } - case MessageActionGroupTitleChanged: - // TODO:: implement it - case MessageActionClearHistory: - // TODO:: implement it - } + res := make([]int64, 0) + switch act { + case MessageActionNope: + case MessageActionContactRegistered: + case MessageActionGroupCreated: + x := &msg.MessageActionGroupCreated{} + err := x.Unmarshal(data) + if err == nil { + res = append(res, x.UserIDs...) + } + case MessageActionGroupAddUser: + x := &msg.MessageActionGroupAddUser{} + err := x.Unmarshal(data) + if err == nil { + res = append(res, x.UserIDs...) + } + case MessageActionGroupDeleteUser: + x := &msg.MessageActionGroupDeleteUser{} + err := x.Unmarshal(data) + if err == nil { + res = append(res, x.UserIDs...) + } + case MessageActionGroupTitleChanged: + // TODO:: implement it + case MessageActionClearHistory: + // TODO:: implement it + } - return res + return res } diff --git a/internal/domain/statics.go b/internal/domain/statics.go index 4ba60489..074ee5f6 100644 --- a/internal/domain/statics.go +++ b/internal/domain/statics.go @@ -1,154 +1,155 @@ package domain import ( - "bufio" - "bytes" - "crypto/aes" - "crypto/cipher" - "crypto/sha256" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "github.com/nyaruka/phonenumbers" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" - "hash/crc32" - "io" - "log" - "math" - "math/big" - "math/rand" - "os" - "regexp" - "sort" - "strings" - "sync/atomic" - "time" + "bufio" + "bytes" + "crypto/aes" + "crypto/cipher" + "crypto/sha256" + "fmt" + "hash/crc32" + "io" + "log" + "math" + "math/big" + "math/rand" + "os" + "regexp" + "sort" + "strings" + "sync/atomic" + "time" + + "github.com/nyaruka/phonenumbers" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) func init() { - rand.Seed(time.Now().UnixNano()) + rand.Seed(time.Now().UnixNano()) } var ( - WindowLog func(txt string) - StartTime time.Time - TimeDelta time.Duration - uniqueCounter int64 - _RegExPhone *regexp.Regexp + WindowLog func(txt string) + StartTime time.Time + TimeDelta time.Duration + uniqueCounter int64 + _RegExPhone *regexp.Regexp ) const ( - ALPHANUMERICS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + ALPHANUMERICS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ) func init() { - exp, err := regexp.Compile(`^\d*$`) - if err != nil { - log.Fatal(err.Error()) - } - WindowLog = func(txt string) {} - _RegExPhone = exp - rand.Seed(time.Now().UnixNano()) + exp, err := regexp.Compile(`^\d*$`) + if err != nil { + log.Fatal(err.Error()) + } + WindowLog = func(txt string) {} + _RegExPhone = exp + rand.Seed(time.Now().UnixNano()) } // SplitPQ ... // This function used for proof of work to splits PQ to two prime numbers P and Q func SplitPQ(pq *big.Int) (p1, p2 *big.Int) { - value0 := big.NewInt(0) - value1 := big.NewInt(1) - value15 := big.NewInt(15) - value17 := big.NewInt(17) - rndMax := big.NewInt(0).SetBit(big.NewInt(0), 64, 1) - - what := big.NewInt(0).Set(pq) - rnd := rand.New(rand.NewSource(time.Now().UnixNano())) - g := big.NewInt(0) - i := 0 - for !(g.Cmp(value1) == 1 && g.Cmp(what) == -1) { - q := big.NewInt(0).Rand(rnd, rndMax) - q = q.And(q, value15) - q = q.Add(q, value17) - q = q.Mod(q, what) - - x := big.NewInt(0).Rand(rnd, rndMax) - whatNext := big.NewInt(0).Sub(what, value1) - x = x.Mod(x, whatNext) - x = x.Add(x, value1) - - y := big.NewInt(0).Set(x) - lim := 1 << (uint(i) + 18) - j := 1 - flag := true - - for j < lim && flag { - a := big.NewInt(0).Set(x) - b := big.NewInt(0).Set(x) - c := big.NewInt(0).Set(q) - - for b.Cmp(value0) == 1 { - b2 := big.NewInt(0) - if b2.And(b, value1).Cmp(value0) == 1 { - c.Add(c, a) - if c.Cmp(what) >= 0 { - c.Sub(c, what) - } - } - a.Add(a, a) - if a.Cmp(what) >= 0 { - a.Sub(a, what) - } - b.Rsh(b, 1) - } - x.Set(c) - - z := big.NewInt(0) - if x.Cmp(y) == -1 { - z.Add(what, x) - z.Sub(z, y) - } else { - z.Sub(x, y) - } - g.GCD(nil, nil, z, what) - - if (j & (j - 1)) == 0 { - y.Set(x) - } - j = j + 1 - - if g.Cmp(value1) != 0 { - flag = false - } - } - i = i + 1 - } - - p1 = big.NewInt(0).Set(g) - p2 = big.NewInt(0).Div(what, g) - - if p1.Cmp(p2) == 1 { - p1, p2 = p2, p1 - } - - return + value0 := big.NewInt(0) + value1 := big.NewInt(1) + value15 := big.NewInt(15) + value17 := big.NewInt(17) + rndMax := big.NewInt(0).SetBit(big.NewInt(0), 64, 1) + + what := big.NewInt(0).Set(pq) + rnd := rand.New(rand.NewSource(time.Now().UnixNano())) + g := big.NewInt(0) + i := 0 + for !(g.Cmp(value1) == 1 && g.Cmp(what) == -1) { + q := big.NewInt(0).Rand(rnd, rndMax) + q = q.And(q, value15) + q = q.Add(q, value17) + q = q.Mod(q, what) + + x := big.NewInt(0).Rand(rnd, rndMax) + whatNext := big.NewInt(0).Sub(what, value1) + x = x.Mod(x, whatNext) + x = x.Add(x, value1) + + y := big.NewInt(0).Set(x) + lim := 1 << (uint(i) + 18) + j := 1 + flag := true + + for j < lim && flag { + a := big.NewInt(0).Set(x) + b := big.NewInt(0).Set(x) + c := big.NewInt(0).Set(q) + + for b.Cmp(value0) == 1 { + b2 := big.NewInt(0) + if b2.And(b, value1).Cmp(value0) == 1 { + c.Add(c, a) + if c.Cmp(what) >= 0 { + c.Sub(c, what) + } + } + a.Add(a, a) + if a.Cmp(what) >= 0 { + a.Sub(a, what) + } + b.Rsh(b, 1) + } + x.Set(c) + + z := big.NewInt(0) + if x.Cmp(y) == -1 { + z.Add(what, x) + z.Sub(z, y) + } else { + z.Sub(x, y) + } + g.GCD(nil, nil, z, what) + + if (j & (j - 1)) == 0 { + y.Set(x) + } + j = j + 1 + + if g.Cmp(value1) != 0 { + flag = false + } + } + i = i + 1 + } + + p1 = big.NewInt(0).Set(g) + p2 = big.NewInt(0).Div(what, g) + + if p1.Cmp(p2) == 1 { + p1, p2 = p2, p1 + } + + return } // GenerateMessageKey ... // Message Key is: _Sha512(DHKey[100:140], InternalHeader, Payload)[32:64] func GenerateMessageKey(dhKey, plain []byte) []byte { - // Message Key is: _Sha512(DHKey[100:140], InternalHeader, Payload)[32:64] - msgKey := make([]byte, 32) - keyBuffer := pools.Bytes.GetLen(40 + len(plain)) - defer pools.Bytes.Put(keyBuffer) - - copy(keyBuffer, dhKey[100:140]) - copy(keyBuffer[40:], plain) - var sh512 [64]byte - err := tools.Sha512(keyBuffer, sh512[:0]) - if err != nil { - return nil - } - copy(msgKey, sh512[32:64]) - return msgKey + // Message Key is: _Sha512(DHKey[100:140], InternalHeader, Payload)[32:64] + msgKey := make([]byte, 32) + keyBuffer := pools.Bytes.GetLen(40 + len(plain)) + defer pools.Bytes.Put(keyBuffer) + + copy(keyBuffer, dhKey[100:140]) + copy(keyBuffer[40:], plain) + var sh512 [64]byte + err := tools.Sha512(keyBuffer, sh512[:0]) + if err != nil { + return nil + } + copy(msgKey, sh512[32:64]) + return msgKey } // Encrypt ... @@ -157,50 +158,50 @@ func GenerateMessageKey(dhKey, plain []byte) []byte { // 2. AES IV: _Sha512 (dhKey[180:220], MessageKey)[:32] // 3. AES KEY: _Sha512 (MessageKey, dhKey[170:210])[:32] func Encrypt(dhKey, plain []byte) (encrypted []byte, err error) { - // Message Key is: _Sha512(DHKey[100:140], InternalHeader, Payload)[32:64] - msgKey := GenerateMessageKey(dhKey, plain) - var ( - iv, key [72]byte - aesIV, aesKey [64]byte - ) - - // AES IV: _Sha512 (DHKey[180:220], MessageKey)[:32] - copy(iv[:], dhKey[180:220]) - copy(iv[40:], msgKey) - err = tools.Sha512(iv[:], aesIV[:0]) - if err != nil { - return nil, err - } - - // AES KEY: _Sha512 (MessageKey, DHKey[170:210])[:32] - copy(key[:], msgKey) - copy(key[32:], dhKey[170:210]) - err = tools.Sha512(key[:], aesKey[:0]) - if err != nil { - return nil, err - } - - return aes256GCMEncrypt( - aesKey[:32], - aesIV[:12], - plain, - ) + // Message Key is: _Sha512(DHKey[100:140], InternalHeader, Payload)[32:64] + msgKey := GenerateMessageKey(dhKey, plain) + var ( + iv, key [72]byte + aesIV, aesKey [64]byte + ) + + // AES IV: _Sha512 (DHKey[180:220], MessageKey)[:32] + copy(iv[:], dhKey[180:220]) + copy(iv[40:], msgKey) + err = tools.Sha512(iv[:], aesIV[:0]) + if err != nil { + return nil, err + } + + // AES KEY: _Sha512 (MessageKey, DHKey[170:210])[:32] + copy(key[:], msgKey) + copy(key[32:], dhKey[170:210]) + err = tools.Sha512(key[:], aesKey[:0]) + if err != nil { + return nil, err + } + + return aes256GCMEncrypt( + aesKey[:32], + aesIV[:12], + plain, + ) } func aes256GCMEncrypt(key, iv []byte, msg []byte) ([]byte, error) { - var block cipher.Block - if b, err := aes.NewCipher(key); err != nil { - return nil, err - } else { - block = b - } - - aesGCM, err := cipher.NewGCM(block) - if err != nil { - return nil, err - } - encrypted := pools.Bytes.GetCap(len(msg) + aesGCM.Overhead()) - encrypted = aesGCM.Seal(encrypted[:0], iv, msg, nil) - return encrypted, nil + var block cipher.Block + if b, err := aes.NewCipher(key); err != nil { + return nil, err + } else { + block = b + } + + aesGCM, err := cipher.NewGCM(block) + if err != nil { + return nil, err + } + encrypted := pools.Bytes.GetCap(len(msg) + aesGCM.Overhead()) + encrypted = aesGCM.Seal(encrypted[:0], iv, msg, nil) + return encrypted, nil } // Decrypt ... @@ -208,242 +209,242 @@ func aes256GCMEncrypt(key, iv []byte, msg []byte) ([]byte, error) { // 1. AES IV: _Sha512 (dhKey[180:220], MessageKey)[:12] // 2. AES KEY: _Sha512 (MessageKey, dhKey[170:210])[:32] func Decrypt(dhKey, msgKey, encrypted []byte) (plain []byte, err error) { - var ( - iv, key [72]byte - aesIV, aesKey [64]byte - ) - - // AES IV: _Sha512 (DHKey[180:220], MessageKey)[:32] - copy(iv[:], dhKey[180:220]) - copy(iv[40:], msgKey) - err = tools.Sha512(iv[:], aesIV[:0]) - if err != nil { - return nil, err - } - - // AES KEY: _Sha512 (MessageKey, DHKey[170:210])[:32] - copy(key[:], msgKey) - copy(key[32:], dhKey[170:210]) - err = tools.Sha512(key[:], aesKey[:0]) - if err != nil { - return nil, err - } - - return aes256GCMDecrypt( - aesKey[:32], - aesIV[:12], - encrypted, - ) + var ( + iv, key [72]byte + aesIV, aesKey [64]byte + ) + + // AES IV: _Sha512 (DHKey[180:220], MessageKey)[:32] + copy(iv[:], dhKey[180:220]) + copy(iv[40:], msgKey) + err = tools.Sha512(iv[:], aesIV[:0]) + if err != nil { + return nil, err + } + + // AES KEY: _Sha512 (MessageKey, DHKey[170:210])[:32] + copy(key[:], msgKey) + copy(key[32:], dhKey[170:210]) + err = tools.Sha512(key[:], aesKey[:0]) + if err != nil { + return nil, err + } + + return aes256GCMDecrypt( + aesKey[:32], + aesIV[:12], + encrypted, + ) } func aes256GCMDecrypt(key, iv []byte, msg []byte) ([]byte, error) { - var block cipher.Block - if b, err := aes.NewCipher(key); err != nil { - return nil, err - } else { - block = b - } - - aesGCM, err := cipher.NewGCM(block) - if err != nil { - return nil, err - } - decrypted := pools.Bytes.GetCap(len(msg)) - decrypted, err = aesGCM.Open(decrypted[:0], iv, msg, nil) - if err != nil { - return nil, err - } - - return decrypted, nil + var block cipher.Block + if b, err := aes.NewCipher(key); err != nil { + return nil, err + } else { + block = b + } + + aesGCM, err := cipher.NewGCM(block) + if err != nil { + return nil, err + } + decrypted := pools.Bytes.GetCap(len(msg)) + decrypted, err = aesGCM.Open(decrypted[:0], iv, msg, nil) + if err != nil { + return nil, err + } + + return decrypted, nil } // RandomUint64 produces a pseudo-random unsigned number func RandomUint64() uint64 { - return rand.Uint64() + return rand.Uint64() } func RandomInt64(n int64) (x int64) { - if n <= 0 { - return rand.Int63() - } else { - return rand.Int63n(n) - } + if n <= 0 { + return rand.Int63() + } else { + return rand.Int63n(n) + } } func RandomInt(n int) (x int) { - return rand.Intn(n) + return rand.Intn(n) } // RandomInt63 produces a pseudo-random signed number func RandomInt63() int64 { - return rand.Int63() + return rand.Int63() } // RandomID generates a pseudo-random string with length 'n' which characters are alphanumerics. func RandomID(n int) string { - b := make([]byte, n) - for i := range b { - b[i] = ALPHANUMERICS[rand.Intn(len(ALPHANUMERICS))] - } - return string(b) + b := make([]byte, n) + for i := range b { + b[i] = ALPHANUMERICS[rand.Intn(len(ALPHANUMERICS))] + } + return string(b) } // SequentialUniqueID generate sequential and unique int64 with UnixNano time for sequential and atomic counter for uniqueness func SequentialUniqueID() int64 { - counter := atomic.AddInt64(&uniqueCounter, 1) - nanoTime := time.Now().UnixNano() - res := nanoTime + counter - - // reset counter we need counter only for requests that created in same nano second - if counter > 16384 { - atomic.StoreInt64(&uniqueCounter, 0) - } - return res + counter := atomic.AddInt64(&uniqueCounter, 1) + nanoTime := time.Now().UnixNano() + res := nanoTime + counter + + // reset counter we need counter only for requests that created in same nano second + if counter > 16384 { + atomic.StoreInt64(&uniqueCounter, 0) + } + return res } func NextRequestID() uint64 { - return uint64(SequentialUniqueID()) + return uint64(SequentialUniqueID()) } // CalculateContactsImportHash crc32 of phones func CalculateContactsImportHash(req *msg.ContactsImport) uint64 { - phoneContacts := make(map[string]*msg.PhoneContact) - for _, c := range req.Contacts { - phoneContacts[c.Phone] = c - } - phones := make([]*msg.PhoneContact, 0) - for _, p := range phoneContacts { - phones = append(phones, p) - } - sort.Slice(phones, func(i, j int) bool { return phones[i].Phone < phones[j].Phone }) - count := len(phones) - bb := bytes.Buffer{} - for idx := 0; idx < count; idx++ { - bb.Write(tools.StrToByte(phones[idx].Phone)) - bb.Write(tools.StrToByte(phones[idx].FirstName)) - bb.Write(tools.StrToByte(phones[idx].LastName)) - } - crc32Hash := crc32.ChecksumIEEE(bb.Bytes()) - return uint64(crc32Hash) + phoneContacts := make(map[string]*msg.PhoneContact) + for _, c := range req.Contacts { + phoneContacts[c.Phone] = c + } + phones := make([]*msg.PhoneContact, 0) + for _, p := range phoneContacts { + phones = append(phones, p) + } + sort.Slice(phones, func(i, j int) bool { return phones[i].Phone < phones[j].Phone }) + count := len(phones) + bb := bytes.Buffer{} + for idx := 0; idx < count; idx++ { + bb.Write(tools.StrToByte(phones[idx].Phone)) + bb.Write(tools.StrToByte(phones[idx].FirstName)) + bb.Write(tools.StrToByte(phones[idx].LastName)) + } + crc32Hash := crc32.ChecksumIEEE(bb.Bytes()) + return uint64(crc32Hash) } // ExtractsContactsDifference remove items from newContacts that already exist in oldContacts func ExtractsContactsDifference(oldContacts, newContacts []*msg.PhoneContact) []*msg.PhoneContact { - mapOld := make(map[string]*msg.PhoneContact, len(oldContacts)) - mapNew := make(map[string]*msg.PhoneContact, len(newContacts)) - for _, c := range oldContacts { - c.Phone = SanitizePhone(c.Phone) - mapOld[c.Phone] = c - } - for _, c := range newContacts { - c.Phone = SanitizePhone(c.Phone) - mapNew[c.Phone] = c - } - - for key, oldContact := range mapOld { - newContact, ok := mapNew[key] - if ok { - if newContact.LastName == oldContact.LastName && newContact.FirstName == oldContact.FirstName { - delete(mapNew, key) - } - } - } - - result := make([]*msg.PhoneContact, 0, len(mapNew)) - for _, v := range mapNew { - result = append(result, v) - } - return result + mapOld := make(map[string]*msg.PhoneContact, len(oldContacts)) + mapNew := make(map[string]*msg.PhoneContact, len(newContacts)) + for _, c := range oldContacts { + c.Phone = SanitizePhone(c.Phone) + mapOld[c.Phone] = c + } + for _, c := range newContacts { + c.Phone = SanitizePhone(c.Phone) + mapNew[c.Phone] = c + } + + for key, oldContact := range mapOld { + newContact, ok := mapNew[key] + if ok { + if newContact.LastName == oldContact.LastName && newContact.FirstName == oldContact.FirstName { + delete(mapNew, key) + } + } + } + + result := make([]*msg.PhoneContact, 0, len(mapNew)) + for _, v := range mapNew { + result = append(result, v) + } + return result } // SanitizePhone copy of server side function func SanitizePhone(phoneNumber string) string { - phoneNumber = strings.TrimLeft(phoneNumber, " +0") - if !_RegExPhone.MatchString(phoneNumber) { - return "" - } - if strings.HasPrefix(phoneNumber, "237400") { - return phoneNumber - } - phone, err := phonenumbers.Parse(phoneNumber, "IR") - if err != nil { - return phoneNumber - } - return fmt.Sprintf("%d%d", *phone.CountryCode, *phone.NationalNumber) + phoneNumber = strings.TrimLeft(phoneNumber, " +0") + if !_RegExPhone.MatchString(phoneNumber) { + return "" + } + if strings.HasPrefix(phoneNumber, "237400") { + return phoneNumber + } + phone, err := phonenumbers.Parse(phoneNumber, "IR") + if err != nil { + return phoneNumber + } + return fmt.Sprintf("%d%d", *phone.CountryCode, *phone.NationalNumber) } func GetCountryCode(phone string) string { - ph, err := phonenumbers.Parse(phone, "") - if err != nil { - return "" - } - return phonenumbers.GetRegionCodeForNumber(ph) + ph, err := phonenumbers.Parse(phone, "") + if err != nil { + return "" + } + return phonenumbers.GetRegionCodeForNumber(ph) } func Now() time.Time { - return time.Now().Add(TimeDelta) + return time.Now().Add(TimeDelta) } func CopyFile(inPath, outPath string) error { - buf := make([]byte, 1<<13) - src, err := os.Open(inPath) - if err != nil { - return err - } - dst, err := os.Create(outPath) - if err != nil { - return err - } - for { - n, err := src.Read(buf) - if err != nil && err != io.EOF { - return err - } - if n == 0 { - break - } - - if _, err := dst.Write(buf[:n]); err != nil { - return err - } - } - return nil + buf := make([]byte, 1<<13) + src, err := os.Open(inPath) + if err != nil { + return err + } + dst, err := os.Create(outPath) + if err != nil { + return err + } + for { + n, err := src.Read(buf) + if err != nil && err != io.EOF { + return err + } + if n == 0 { + break + } + + if _, err := dst.Write(buf[:n]); err != nil { + return err + } + } + return nil } func GetExponentialTime(min time.Duration, max time.Duration, attempts int) time.Duration { - if min <= 0 { - min = 100 * time.Millisecond - } - if max <= 0 { - max = 10 * time.Second - } - minFloat := float64(min) - napDuration := minFloat * math.Pow(2, float64(attempts-1)) - // add some jitter - napDuration += rand.Float64()*minFloat - (minFloat / 2) - if napDuration > float64(max) { - return max - } - return time.Duration(napDuration) + if min <= 0 { + min = 100 * time.Millisecond + } + if max <= 0 { + max = 10 * time.Second + } + minFloat := float64(min) + napDuration := minFloat * math.Pow(2, float64(attempts-1)) + // add some jitter + napDuration += rand.Float64()*minFloat - (minFloat / 2) + if napDuration > float64(max) { + return max + } + return time.Duration(napDuration) } func CalculateSha256(filePath string) ([]byte, error) { - f, err := os.Open(filePath) - if err != nil { - return nil, err - } - h := sha256.New() - buf := make([]byte, 1<<20) - rd := bufio.NewReader(f) - for { - n, err := rd.Read(buf) - if err != nil { - if err == io.EOF { - break - } - return nil, err - } - h.Write(buf[:n]) - } - return h.Sum(nil), nil + f, err := os.Open(filePath) + if err != nil { + return nil, err + } + h := sha256.New() + buf := make([]byte, 1<<20) + rd := bufio.NewReader(f) + for { + n, err := rd.Read(buf) + if err != nil { + if err == io.EOF { + break + } + return nil, err + } + h.Write(buf[:n]) + } + return h.Sum(nil), nil } diff --git a/internal/hole/hole.go b/internal/hole/hole.go index 10808d06..3a12e5d3 100644 --- a/internal/hole/hole.go +++ b/internal/hole/hole.go @@ -1,356 +1,357 @@ package hole import ( - "encoding/json" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/repo" - "go.uber.org/zap" - "sort" - "strings" - "sync" + "encoding/json" + "fmt" + "sort" + "strings" + "sync" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/repo" + "go.uber.org/zap" ) var ( - logger *logs.Logger + logger *logs.Logger ) func init() { - logger = logs.With("MessageHole") + logger = logs.With("MessageHole") } type BarType int const ( - _ BarType = iota - Hole - Filled + _ BarType = iota + Hole + Filled ) func (v BarType) String() string { - switch v { - case Hole: - return "H" - case Filled: - return "F" - } - return "" + switch v { + case Hole: + return "H" + case Filled: + return "F" + } + return "" } type Bar struct { - Min int64 - Max int64 - Type BarType + Min int64 + Max int64 + Type BarType } type Detector struct { - mtx sync.Mutex - MaxIndex int64 - Bars []Bar + mtx sync.Mutex + MaxIndex int64 + Bars []Bar } func readFromDB(teamID, peerID int64, peerType int32, cat msg.MediaCategory) *Detector { - m := &Detector{} - b := repo.MessagesExtra.GetHoles(teamID, peerID, peerType, cat) - _ = json.Unmarshal(b, &m.Bars) - m.MaxIndex = 0 - for idx := range m.Bars { - if m.Bars[idx].Max > m.MaxIndex { - m.MaxIndex = m.Bars[idx].Max - } - } - return m + m := &Detector{} + b := repo.MessagesExtra.GetHoles(teamID, peerID, peerType, cat) + _ = json.Unmarshal(b, &m.Bars) + m.MaxIndex = 0 + for idx := range m.Bars { + if m.Bars[idx].Max > m.MaxIndex { + m.MaxIndex = m.Bars[idx].Max + } + } + return m } func writeToDB(teamID, peerID int64, peerType int32, cat msg.MediaCategory, hm *Detector) { - b, err := json.Marshal(hm.Bars) - if err != nil { - logger.Error("got error on marshalling hole", zap.Error(err)) - return - } - repo.MessagesExtra.SaveHoles(teamID, peerID, peerType, cat, b) + b, err := json.Marshal(hm.Bars) + if err != nil { + logger.Error("got error on marshalling hole", zap.Error(err)) + return + } + repo.MessagesExtra.SaveHoles(teamID, peerID, peerType, cat, b) } func load(teamID, peerID int64, peerType int32, cat msg.MediaCategory) *Detector { - keyID := fmt.Sprintf("%d.%d.%d.%d", teamID, peerID, peerType, cat) - cache.mtx.Lock() - defer cache.mtx.Unlock() - hm, ok := cache.list[keyID] - if !ok { - hm = readFromDB(teamID, peerID, peerType, cat) - cache.list[keyID] = hm - } - - if !hm.Valid() { - logger.Error("load invalid data, we reset hole", - zap.Int64("TeamID", teamID), - zap.Int64("PeerID", peerID), - zap.String("Dump", hm.String()), - ) - hm = &Detector{} - b, _ := json.Marshal(hm) - repo.MessagesExtra.SaveHoles(teamID, peerID, peerType, cat, b) - cache.list[keyID] = hm - } - return hm + keyID := fmt.Sprintf("%d.%d.%d.%d", teamID, peerID, peerType, cat) + cache.mtx.Lock() + defer cache.mtx.Unlock() + hm, ok := cache.list[keyID] + if !ok { + hm = readFromDB(teamID, peerID, peerType, cat) + cache.list[keyID] = hm + } + + if !hm.Valid() { + logger.Error("load invalid data, we reset hole", + zap.Int64("TeamID", teamID), + zap.Int64("PeerID", peerID), + zap.String("Dump", hm.String()), + ) + hm = &Detector{} + b, _ := json.Marshal(hm) + repo.MessagesExtra.SaveHoles(teamID, peerID, peerType, cat, b) + cache.list[keyID] = hm + } + return hm } func (m *Detector) InsertBar(b Bar) { - m.mtx.Lock() - defer m.mtx.Unlock() - - // If it is the first bar - if len(m.Bars) == 0 { - if b.Min > 0 { - m.Bars = append(m.Bars, Bar{Min: 0, Max: b.Min - 1, Type: Hole}) - } - m.MaxIndex = b.Max - m.Bars = append(m.Bars, b) - return - } - - // We sort the bar to find the max point, if b.Max is larger than biggest index, then we have to - // insert a hole to increase the domain - // TODO:: We must make sure that Bars are sorted all the time then we don't need to sort every time - sort.Slice(m.Bars, func(i, j int) bool { - return m.Bars[i].Min < m.Bars[j].Min - }) - maxIndex := m.Bars[len(m.Bars)-1].Max - if b.Max > maxIndex { - m.Bars = append(m.Bars, Bar{Min: maxIndex + 1, Max: b.Max, Type: Hole}) - } - - currentBars := m.Bars - m.Bars = make([]Bar, 0, len(currentBars)+1) - - // Initially the biggest index is b.Max. We will update the MaxIndex during the range over Bars if - // necessary. In the first loop (InsertLoop) we go until we can insert the new bar into the list - idx := 0 - m.MaxIndex = b.Max + m.mtx.Lock() + defer m.mtx.Unlock() + + // If it is the first bar + if len(m.Bars) == 0 { + if b.Min > 0 { + m.Bars = append(m.Bars, Bar{Min: 0, Max: b.Min - 1, Type: Hole}) + } + m.MaxIndex = b.Max + m.Bars = append(m.Bars, b) + return + } + + // We sort the bar to find the max point, if b.Max is larger than biggest index, then we have to + // insert a hole to increase the domain + // TODO:: We must make sure that Bars are sorted all the time then we don't need to sort every time + sort.Slice(m.Bars, func(i, j int) bool { + return m.Bars[i].Min < m.Bars[j].Min + }) + maxIndex := m.Bars[len(m.Bars)-1].Max + if b.Max > maxIndex { + m.Bars = append(m.Bars, Bar{Min: maxIndex + 1, Max: b.Max, Type: Hole}) + } + + currentBars := m.Bars + m.Bars = make([]Bar, 0, len(currentBars)+1) + + // Initially the biggest index is b.Max. We will update the MaxIndex during the range over Bars if + // necessary. In the first loop (InsertLoop) we go until we can insert the new bar into the list + idx := 0 + m.MaxIndex = b.Max InsertLoop: - for idx := 0; idx < len(currentBars); idx++ { - switch { - case b.Min > currentBars[idx].Max: - m.appendBar(currentBars[idx]) - case b.Min > currentBars[idx].Min: - switch { - case b.Max < currentBars[idx].Max: - m.appendBar( - Bar{Min: currentBars[idx].Min, Max: b.Min - 1, Type: currentBars[idx].Type}, - b, - Bar{Min: b.Max + 1, Max: currentBars[idx].Max, Type: currentBars[idx].Type}, - ) - m.MaxIndex = currentBars[idx].Max - case b.Max == currentBars[idx].Max: - m.appendBar( - Bar{Min: currentBars[idx].Min, Max: b.Min - 1, Type: currentBars[idx].Type}, - b, - ) - case b.Max > currentBars[idx].Max: - m.appendBar( - Bar{Min: currentBars[idx].Min, Max: b.Min - 1, Type: currentBars[idx].Type}, - b, - ) - } - break InsertLoop - case b.Min == currentBars[idx].Min: - switch { - case b.Max < currentBars[idx].Max: - m.appendBar( - Bar{Min: b.Min, Max: b.Max, Type: b.Type}, - Bar{Min: b.Max + 1, Max: currentBars[idx].Max, Type: currentBars[idx].Type}, - ) - m.MaxIndex = currentBars[idx].Max - default: - m.appendBar(b) - } - break InsertLoop - } - } - - // In this loop, we are assured that the new bar has been already added, we try to append the remaining - // Bars to the list - for ; idx < len(currentBars); idx++ { - switch { - case currentBars[idx].Min < m.MaxIndex: - switch { - case currentBars[idx].Max > m.MaxIndex: - m.appendBar(Bar{Min: m.MaxIndex + 1, Max: currentBars[idx].Max, Type: currentBars[idx].Type}) - m.MaxIndex = currentBars[idx].Max - } - case currentBars[idx].Min == m.MaxIndex: - if currentBars[idx].Max > currentBars[idx].Min { - m.appendBar(Bar{Min: currentBars[idx].Min + 1, Max: currentBars[idx].Max, Type: currentBars[idx].Type}) - m.MaxIndex = currentBars[idx].Max - } - default: - m.appendBar(currentBars[idx]) - m.MaxIndex = currentBars[idx].Max - } - } + for idx := 0; idx < len(currentBars); idx++ { + switch { + case b.Min > currentBars[idx].Max: + m.appendBar(currentBars[idx]) + case b.Min > currentBars[idx].Min: + switch { + case b.Max < currentBars[idx].Max: + m.appendBar( + Bar{Min: currentBars[idx].Min, Max: b.Min - 1, Type: currentBars[idx].Type}, + b, + Bar{Min: b.Max + 1, Max: currentBars[idx].Max, Type: currentBars[idx].Type}, + ) + m.MaxIndex = currentBars[idx].Max + case b.Max == currentBars[idx].Max: + m.appendBar( + Bar{Min: currentBars[idx].Min, Max: b.Min - 1, Type: currentBars[idx].Type}, + b, + ) + case b.Max > currentBars[idx].Max: + m.appendBar( + Bar{Min: currentBars[idx].Min, Max: b.Min - 1, Type: currentBars[idx].Type}, + b, + ) + } + break InsertLoop + case b.Min == currentBars[idx].Min: + switch { + case b.Max < currentBars[idx].Max: + m.appendBar( + Bar{Min: b.Min, Max: b.Max, Type: b.Type}, + Bar{Min: b.Max + 1, Max: currentBars[idx].Max, Type: currentBars[idx].Type}, + ) + m.MaxIndex = currentBars[idx].Max + default: + m.appendBar(b) + } + break InsertLoop + } + } + + // In this loop, we are assured that the new bar has been already added, we try to append the remaining + // Bars to the list + for ; idx < len(currentBars); idx++ { + switch { + case currentBars[idx].Min < m.MaxIndex: + switch { + case currentBars[idx].Max > m.MaxIndex: + m.appendBar(Bar{Min: m.MaxIndex + 1, Max: currentBars[idx].Max, Type: currentBars[idx].Type}) + m.MaxIndex = currentBars[idx].Max + } + case currentBars[idx].Min == m.MaxIndex: + if currentBars[idx].Max > currentBars[idx].Min { + m.appendBar(Bar{Min: currentBars[idx].Min + 1, Max: currentBars[idx].Max, Type: currentBars[idx].Type}) + m.MaxIndex = currentBars[idx].Max + } + default: + m.appendBar(currentBars[idx]) + m.MaxIndex = currentBars[idx].Max + } + } } func (m *Detector) appendBar(bars ...Bar) { - for _, b := range bars { - lastIndex := len(m.Bars) - 1 - if lastIndex >= 0 && m.Bars[lastIndex].Type == b.Type { - m.Bars[lastIndex].Max = b.Max - } else { - m.Bars = append(m.Bars, b) - } - } + for _, b := range bars { + lastIndex := len(m.Bars) - 1 + if lastIndex >= 0 && m.Bars[lastIndex].Type == b.Type { + m.Bars[lastIndex].Max = b.Max + } else { + m.Bars = append(m.Bars, b) + } + } } func (m *Detector) IsRangeFilled(min, max int64) bool { - m.mtx.Lock() - defer m.mtx.Unlock() - for idx := range m.Bars { - if m.Bars[idx].Type == Hole { - continue - } - if min >= m.Bars[idx].Min && max <= m.Bars[idx].Max { - return true - } - } - return false + m.mtx.Lock() + defer m.mtx.Unlock() + for idx := range m.Bars { + if m.Bars[idx].Type == Hole { + continue + } + if min >= m.Bars[idx].Min && max <= m.Bars[idx].Max { + return true + } + } + return false } func (m *Detector) IsPointHole(pt int64) bool { - m.mtx.Lock() - defer m.mtx.Unlock() - for idx := range m.Bars { - if pt >= m.Bars[idx].Min && pt <= m.Bars[idx].Max { - switch m.Bars[idx].Type { - case Filled: - return false - case Hole: - return true - } - } - } - return true + m.mtx.Lock() + defer m.mtx.Unlock() + for idx := range m.Bars { + if pt >= m.Bars[idx].Min && pt <= m.Bars[idx].Max { + switch m.Bars[idx].Type { + case Filled: + return false + case Hole: + return true + } + } + } + return true } func (m *Detector) GetUpperFilled(pt int64) (bool, Bar) { - m.mtx.Lock() - defer m.mtx.Unlock() - for idx := range m.Bars { - if pt >= m.Bars[idx].Min && pt <= m.Bars[idx].Max { - switch m.Bars[idx].Type { - case Filled: - return true, Bar{Min: pt, Max: m.Bars[idx].Max, Type: Filled} - case Hole: - return false, Bar{} - } - } - } - return false, Bar{} + m.mtx.Lock() + defer m.mtx.Unlock() + for idx := range m.Bars { + if pt >= m.Bars[idx].Min && pt <= m.Bars[idx].Max { + switch m.Bars[idx].Type { + case Filled: + return true, Bar{Min: pt, Max: m.Bars[idx].Max, Type: Filled} + case Hole: + return false, Bar{} + } + } + } + return false, Bar{} } func (m *Detector) GetLowerFilled(pt int64) (bool, Bar) { - m.mtx.Lock() - defer m.mtx.Unlock() - for idx := range m.Bars { - if pt >= m.Bars[idx].Min && pt <= m.Bars[idx].Max { - switch m.Bars[idx].Type { - case Filled: - return true, Bar{Min: m.Bars[idx].Min, Max: pt, Type: Filled} - case Hole: - return false, Bar{} - } - } - } - return false, Bar{} + m.mtx.Lock() + defer m.mtx.Unlock() + for idx := range m.Bars { + if pt >= m.Bars[idx].Min && pt <= m.Bars[idx].Max { + switch m.Bars[idx].Type { + case Filled: + return true, Bar{Min: m.Bars[idx].Min, Max: pt, Type: Filled} + case Hole: + return false, Bar{} + } + } + } + return false, Bar{} } func (m *Detector) SetUpperFilled(pt int64) bool { - if pt <= m.MaxIndex { - return false - } - m.InsertBar(Bar{Type: Filled, Min: m.MaxIndex + 1, Max: pt}) - return true + if pt <= m.MaxIndex { + return false + } + m.InsertBar(Bar{Type: Filled, Min: m.MaxIndex + 1, Max: pt}) + return true } func (m *Detector) SetLowerFilled() { - for _, b := range m.Bars { - if b.Type == Filled { - if b.Min != 0 { - m.InsertBar(Bar{Min: 0, Max: b.Min, Type: Filled}) - } - } - } + for _, b := range m.Bars { + if b.Type == Filled { + if b.Min != 0 { + m.InsertBar(Bar{Min: 0, Max: b.Min, Type: Filled}) + } + } + } } func (m *Detector) String() string { - sb := strings.Builder{} - for _, bar := range m.Bars { - sb.WriteString(fmt.Sprintf("[%s: %d - %d]", bar.Type.String(), bar.Min, bar.Max)) - } - return sb.String() + sb := strings.Builder{} + for _, bar := range m.Bars { + sb.WriteString(fmt.Sprintf("[%s: %d - %d]", bar.Type.String(), bar.Min, bar.Max)) + } + return sb.String() } func (m *Detector) Valid() bool { - m.mtx.Lock() - defer m.mtx.Unlock() - idx := int64(-1) - for _, bar := range m.Bars { - if bar.Min > bar.Max { - return false - } - if bar.Min <= idx { - return false - } - idx = bar.Max - } - return true + m.mtx.Lock() + defer m.mtx.Unlock() + idx := int64(-1) + for _, bar := range m.Bars { + if bar.Min > bar.Max { + return false + } + if bar.Min <= idx { + return false + } + idx = bar.Max + } + return true } var cache = struct { - mtx sync.Mutex - list map[string]*Detector + mtx sync.Mutex + list map[string]*Detector }{ - list: make(map[string]*Detector), + list: make(map[string]*Detector), } func Init() { - cache.list = make(map[string]*Detector) + cache.list = make(map[string]*Detector) } func InsertFill(teamID, peerID int64, peerType int32, cat msg.MediaCategory, minID, maxID int64) { - if minID > maxID { - return - } - hm := load(teamID, peerID, peerType, cat) - hm.InsertBar(Bar{Type: Filled, Min: minID, Max: maxID}) - writeToDB(teamID, peerID, peerType, cat, hm) + if minID > maxID { + return + } + hm := load(teamID, peerID, peerType, cat) + hm.InsertBar(Bar{Type: Filled, Min: minID, Max: maxID}) + writeToDB(teamID, peerID, peerType, cat, hm) } // IsHole Checks if there is any hole in the range [minID-maxID]. func IsHole(teamID, peerID int64, peerType int32, cat msg.MediaCategory, minID, maxID int64) bool { - hm := load(teamID, peerID, peerType, cat) - return hm.IsRangeFilled(minID, maxID) + hm := load(teamID, peerID, peerType, cat) + return hm.IsRangeFilled(minID, maxID) } // GetUpperFilled It returns a LabelBar starts from minID to the highest possible index, // which makes a continuous Filled section, otherwise it returns false. func GetUpperFilled(teamID, peerID int64, peerType int32, cat msg.MediaCategory, minID int64) (bool, Bar) { - hm := load(teamID, peerID, peerType, cat) - return hm.GetUpperFilled(minID) + hm := load(teamID, peerID, peerType, cat) + return hm.GetUpperFilled(minID) } // GetLowerFilled It returns a LabelBar starts from the lowest possible index to maxID, // which makes a continuous Filled section, otherwise it returns false. func GetLowerFilled(teamID, peerID int64, peerType int32, cat msg.MediaCategory, maxID int64) (bool, Bar) { - hm := load(teamID, peerID, peerType, cat) - return hm.GetLowerFilled(maxID) + hm := load(teamID, peerID, peerType, cat) + return hm.GetLowerFilled(maxID) } func PrintHole(teamID, peerID int64, peerType int32, cat msg.MediaCategory) string { - hm := load(teamID, peerID, peerType, cat) - sb := strings.Builder{} - for _, bar := range hm.Bars { - sb.WriteString(fmt.Sprintf("[%s: %d - %d]", bar.Type.String(), bar.Min, bar.Max)) - } - return sb.String() + hm := load(teamID, peerID, peerType, cat) + sb := strings.Builder{} + for _, bar := range hm.Bars { + sb.WriteString(fmt.Sprintf("[%s: %d - %d]", bar.Type.String(), bar.Min, bar.Max)) + } + return sb.String() } diff --git a/internal/hole/hole_test.go b/internal/hole/hole_test.go index 52020168..c1f7a832 100644 --- a/internal/hole/hole_test.go +++ b/internal/hole/hole_test.go @@ -1,109 +1,110 @@ package hole import ( - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony/tools" - . "github.com/smartystreets/goconvey/convey" - "testing" + "testing" + + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony/tools" + . "github.com/smartystreets/goconvey/convey" ) func init() { - repo.MustInit("./_data", false) + repo.MustInit("./_data", false) } func TestHole(t *testing.T) { - Convey("Hole", t, func(c C) { - peerID := tools.RandomInt64(0) - peerType := int32(1) + Convey("Hole", t, func(c C) { + peerID := tools.RandomInt64(0) + peerType := int32(1) - Convey("Test 1", func(c C) { - // Test 1 - peerID = tools.RandomInt64(0) - InsertFill(0, peerID, peerType, 0, 10, 11) - InsertFill(0, peerID, peerType, 0, 11, 13) - InsertFill(0, peerID, peerType, 0, 15, 16) - InsertFill(0, peerID, peerType, 0, 17, 19) - c.So(IsHole(0, peerID, peerType, 0, 10, 14), ShouldBeFalse) - fill, r := GetLowerFilled(0, peerID, peerType, 0, 16) - c.So(fill, ShouldBeTrue) - c.So(r.Min, ShouldEqual, 15) - c.So(r.Max, ShouldEqual, 16) - // _ ,_ = c.Println(PrintHole(0, peerID, peerType)) - }) + Convey("Test 1", func(c C) { + // Test 1 + peerID = tools.RandomInt64(0) + InsertFill(0, peerID, peerType, 0, 10, 11) + InsertFill(0, peerID, peerType, 0, 11, 13) + InsertFill(0, peerID, peerType, 0, 15, 16) + InsertFill(0, peerID, peerType, 0, 17, 19) + c.So(IsHole(0, peerID, peerType, 0, 10, 14), ShouldBeFalse) + fill, r := GetLowerFilled(0, peerID, peerType, 0, 16) + c.So(fill, ShouldBeTrue) + c.So(r.Min, ShouldEqual, 15) + c.So(r.Max, ShouldEqual, 16) + // _ ,_ = c.Println(PrintHole(0, peerID, peerType)) + }) - Convey("Test 2", func(c C) { - peerID = tools.RandomInt64(0) - InsertFill(0, peerID, peerType, 0, 6, 8) - InsertFill(0, peerID, peerType, 0, 19, 20) - InsertFill(0, peerID, peerType, 0, 12, 12) - InsertFill(0, peerID, peerType, 0, 12, 12) - InsertFill(0, peerID, peerType, 0, 15, 15) - InsertFill(0, peerID, peerType, 0, 13, 14) - // _, _ = c.Println(PrintHole(0, peerID, peerType)) - fill, _ := GetLowerFilled(0, peerID, peerType, 0, 21) - c.So(fill, ShouldBeFalse) - fill, r := GetUpperFilled(0, peerID, peerType, 0, 12) - c.So(fill, ShouldBeTrue) - c.So(r.Min, ShouldEqual, 12) - c.So(r.Max, ShouldEqual, 15) + Convey("Test 2", func(c C) { + peerID = tools.RandomInt64(0) + InsertFill(0, peerID, peerType, 0, 6, 8) + InsertFill(0, peerID, peerType, 0, 19, 20) + InsertFill(0, peerID, peerType, 0, 12, 12) + InsertFill(0, peerID, peerType, 0, 12, 12) + InsertFill(0, peerID, peerType, 0, 15, 15) + InsertFill(0, peerID, peerType, 0, 13, 14) + // _, _ = c.Println(PrintHole(0, peerID, peerType)) + fill, _ := GetLowerFilled(0, peerID, peerType, 0, 21) + c.So(fill, ShouldBeFalse) + fill, r := GetUpperFilled(0, peerID, peerType, 0, 12) + c.So(fill, ShouldBeTrue) + c.So(r.Min, ShouldEqual, 12) + c.So(r.Max, ShouldEqual, 15) - }) + }) - Convey("Test 3", func(c C) { - // Test 3 - peerID = tools.RandomInt64(0) - InsertFill(0, peerID, peerType, 0, 12, 12) - InsertFill(0, peerID, peerType, 0, 101, 120) - InsertFill(0, peerID, peerType, 0, 110, 120) - InsertFill(0, peerID, peerType, 0, 140, 141) - InsertFill(0, peerID, peerType, 0, 141, 142) - InsertFill(0, peerID, peerType, 0, 143, 143) - // _, _ = c.Println(PrintHole(0, peerID, peerType)) - fill, r := GetLowerFilled(0, peerID, peerType, 0, 141) - c.So(fill, ShouldBeTrue) - c.So(r.Max, ShouldEqual, 141) - c.So(r.Min, ShouldEqual, 140) - fill, r = GetUpperFilled(0, peerID, peerType, 0, 120) - c.So(fill, ShouldBeTrue) - c.So(r.Max, ShouldEqual, 120) - c.So(r.Min, ShouldEqual, 120) + Convey("Test 3", func(c C) { + // Test 3 + peerID = tools.RandomInt64(0) + InsertFill(0, peerID, peerType, 0, 12, 12) + InsertFill(0, peerID, peerType, 0, 101, 120) + InsertFill(0, peerID, peerType, 0, 110, 120) + InsertFill(0, peerID, peerType, 0, 140, 141) + InsertFill(0, peerID, peerType, 0, 141, 142) + InsertFill(0, peerID, peerType, 0, 143, 143) + // _, _ = c.Println(PrintHole(0, peerID, peerType)) + fill, r := GetLowerFilled(0, peerID, peerType, 0, 141) + c.So(fill, ShouldBeTrue) + c.So(r.Max, ShouldEqual, 141) + c.So(r.Min, ShouldEqual, 140) + fill, r = GetUpperFilled(0, peerID, peerType, 0, 120) + c.So(fill, ShouldBeTrue) + c.So(r.Max, ShouldEqual, 120) + c.So(r.Min, ShouldEqual, 120) - }) + }) - Convey("Test 4", func(c C) { - peerID = tools.RandomInt64(0) - InsertFill(0, peerID, peerType, 0, 1001, 1001) - InsertFill(0, peerID, peerType, 0, 800, 900) - InsertFill(0, peerID, peerType, 0, 700, 850) - InsertFill(0, peerID, peerType, 0, 700, 799) - InsertFill(0, peerID, peerType, 0, 701, 799) - InsertFill(0, peerID, peerType, 0, 701, 801) - InsertFill(0, peerID, peerType, 0, 100, 699) - // _, _ = c.Println(PrintHole(0, peerID, peerType)) - fill, r := GetUpperFilled(0, peerID, peerType, 0, 700) - c.So(fill, ShouldBeTrue) - c.So(r.Min, ShouldEqual, 700) - c.So(r.Max, ShouldEqual, 900) + Convey("Test 4", func(c C) { + peerID = tools.RandomInt64(0) + InsertFill(0, peerID, peerType, 0, 1001, 1001) + InsertFill(0, peerID, peerType, 0, 800, 900) + InsertFill(0, peerID, peerType, 0, 700, 850) + InsertFill(0, peerID, peerType, 0, 700, 799) + InsertFill(0, peerID, peerType, 0, 701, 799) + InsertFill(0, peerID, peerType, 0, 701, 801) + InsertFill(0, peerID, peerType, 0, 100, 699) + // _, _ = c.Println(PrintHole(0, peerID, peerType)) + fill, r := GetUpperFilled(0, peerID, peerType, 0, 700) + c.So(fill, ShouldBeTrue) + c.So(r.Min, ShouldEqual, 700) + c.So(r.Max, ShouldEqual, 900) - fill, r = GetUpperFilled(0, peerID, peerType, 0, 699) - c.So(fill, ShouldBeTrue) - c.So(r.Min, ShouldEqual, 699) - c.So(r.Max, ShouldEqual, 900) - }) + fill, r = GetUpperFilled(0, peerID, peerType, 0, 699) + c.So(fill, ShouldBeTrue) + c.So(r.Min, ShouldEqual, 699) + c.So(r.Max, ShouldEqual, 900) + }) - Convey("Test 5", func(c C) { - peerID = tools.RandomInt64(0) - InsertFill(0, peerID, peerType, 0, 1001, 1001) - InsertFill(0, peerID, peerType, 0, 400, 500) - InsertFill(0, peerID, peerType, 0, 600, 700) - InsertFill(0, peerID, peerType, 0, 399, 699) - // _, _ = c.Println(PrintHole(0, peerID, peerType)) + Convey("Test 5", func(c C) { + peerID = tools.RandomInt64(0) + InsertFill(0, peerID, peerType, 0, 1001, 1001) + InsertFill(0, peerID, peerType, 0, 400, 500) + InsertFill(0, peerID, peerType, 0, 600, 700) + InsertFill(0, peerID, peerType, 0, 399, 699) + // _, _ = c.Println(PrintHole(0, peerID, peerType)) - fill, r := GetUpperFilled(0, peerID, peerType, 0, 699) - c.So(fill, ShouldBeTrue) - c.So(r.Min, ShouldEqual, 699) - c.So(r.Max, ShouldEqual, 700) - }) + fill, r := GetUpperFilled(0, peerID, peerType, 0, 699) + c.So(fill, ShouldBeTrue) + c.So(r.Min, ShouldEqual, 699) + c.So(r.Max, ShouldEqual, 700) + }) - }) + }) } diff --git a/internal/logs/sentry.go b/internal/logs/sentry.go index 90508db1..a851c0db 100644 --- a/internal/logs/sentry.go +++ b/internal/logs/sentry.go @@ -1,11 +1,12 @@ package logs import ( - "fmt" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/getsentry/sentry-go" - "go.uber.org/zap/zapcore" - "time" + "fmt" + "time" + + "github.com/getsentry/sentry-go" + "github.com/ronaksoft/river-sdk/internal/domain" + "go.uber.org/zap/zapcore" ) /* @@ -18,96 +19,96 @@ import ( */ type sentryCore struct { - zapcore.LevelEnabler - hub *sentry.Hub - tags map[string]string + zapcore.LevelEnabler + hub *sentry.Hub + tags map[string]string } func NewSentryCore(level zapcore.Level, dsn string, userID int64, tags map[string]string) (zapcore.Core, error) { - client, err := sentry.NewClient(sentry.ClientOptions{ - Dsn: dsn, - Release: domain.SDKVersion, - }) - if err != nil { - return zapcore.NewNopCore(), err - } + client, err := sentry.NewClient(sentry.ClientOptions{ + Dsn: dsn, + Release: domain.SDKVersion, + }) + if err != nil { + return zapcore.NewNopCore(), err + } - sentryScope := sentry.NewScope() - sentryScope.SetUser(sentry.User{ - ID: fmt.Sprintf("%d", userID), - }) - sentryHub := sentry.NewHub(client, sentryScope) - return &sentryCore{ - hub: sentryHub, - tags: tags, - LevelEnabler: level, - }, nil + sentryScope := sentry.NewScope() + sentryScope.SetUser(sentry.User{ + ID: fmt.Sprintf("%d", userID), + }) + sentryHub := sentry.NewHub(client, sentryScope) + return &sentryCore{ + hub: sentryHub, + tags: tags, + LevelEnabler: level, + }, nil } func (c *sentryCore) With(fs []zapcore.Field) zapcore.Core { - return &sentryCore{ - hub: c.hub, - tags: c.tags, - LevelEnabler: c.LevelEnabler, - } + return &sentryCore{ + hub: c.hub, + tags: c.tags, + LevelEnabler: c.LevelEnabler, + } } func (c *sentryCore) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry { - if c.LevelEnabler.Enabled(ent.Level) { - return ce.AddCore(ent, c) - } - return ce + if c.LevelEnabler.Enabled(ent.Level) { + return ce.AddCore(ent, c) + } + return ce } func (c *sentryCore) Write(ent zapcore.Entry, fs []zapcore.Field) error { - m := make(map[string]interface{}, len(fs)) - enc := zapcore.NewMapObjectEncoder() - for _, f := range fs { - f.AddTo(enc) - } - for k, v := range enc.Fields { - m[k] = v - } + m := make(map[string]interface{}, len(fs)) + enc := zapcore.NewMapObjectEncoder() + for _, f := range fs { + f.AddTo(enc) + } + for k, v := range enc.Fields { + m[k] = v + } - event := sentry.NewEvent() - event.Message = ent.Message - event.Timestamp = ent.Time - event.Level = sentryLevel(ent.Level) - event.Platform = "go" - event.Extra = m - event.Tags = c.tags - c.hub.CaptureEvent(event) + event := sentry.NewEvent() + event.Message = ent.Message + event.Timestamp = ent.Time + event.Level = sentryLevel(ent.Level) + event.Platform = "go" + event.Extra = m + event.Tags = c.tags + c.hub.CaptureEvent(event) - // We may be crashing the program, so should flush any buffered events. - if ent.Level > zapcore.ErrorLevel { - c.hub.Flush(time.Second) - } - return nil + // We may be crashing the program, so should flush any buffered events. + if ent.Level > zapcore.ErrorLevel { + c.hub.Flush(time.Second) + } + return nil } func (c *sentryCore) Sync() error { - c.hub.Flush(time.Second * 3) - return nil + c.hub.Flush(time.Second * 3) + return nil } func sentryLevel(lvl zapcore.Level) sentry.Level { - switch lvl { - case zapcore.DebugLevel: - return sentry.LevelDebug - case zapcore.InfoLevel: - return sentry.LevelInfo - case zapcore.WarnLevel: - return sentry.LevelWarning - case zapcore.ErrorLevel: - return sentry.LevelError - case zapcore.DPanicLevel: - return sentry.LevelFatal - case zapcore.PanicLevel: - return sentry.LevelFatal - case zapcore.FatalLevel: - return sentry.LevelFatal - default: - // Unrecognized levels are fatal. - return sentry.LevelFatal - } + switch lvl { + case zapcore.DebugLevel: + return sentry.LevelDebug + case zapcore.InfoLevel: + return sentry.LevelInfo + case zapcore.WarnLevel: + return sentry.LevelWarning + case zapcore.ErrorLevel: + return sentry.LevelError + case zapcore.DPanicLevel: + return sentry.LevelFatal + case zapcore.PanicLevel: + return sentry.LevelFatal + case zapcore.FatalLevel: + return sentry.LevelFatal + default: + // Unrecognized levels are fatal. + return sentry.LevelFatal + } } diff --git a/internal/minirepo/dialogs.go b/internal/minirepo/dialogs.go index 15350e3f..2d0f3c42 100644 --- a/internal/minirepo/dialogs.go +++ b/internal/minirepo/dialogs.go @@ -1,13 +1,14 @@ package minirepo import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/boltdb/bolt" - "github.com/ronaksoft/rony/tools" - "github.com/tidwall/buntdb" - "strings" + "fmt" + "strings" + + "github.com/boltdb/bolt" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony/tools" + "github.com/tidwall/buntdb" ) /* @@ -20,128 +21,128 @@ import ( */ const ( - prefixDialogs = "DLG" - indexDialogs + prefixDialogs = "DLG" + indexDialogs ) var ( - bucketDialogs = []byte("DLG") + bucketDialogs = []byte("DLG") ) type repoDialogs struct { - *repository + *repository } func newDialog(r *repository) *repoDialogs { - rd := &repoDialogs{ - repository: r, - } - return rd + rd := &repoDialogs{ + repository: r, + } + return rd } func (d *repoDialogs) Save(dialogs ...*msg.Dialog) error { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - - return d.db.Update(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketDialogs) - for _, dialog := range dialogs { - err := b.Put( - alloc.Gen(dialog.TeamID, dialog.PeerID, dialog.PeerType), - alloc.Marshal(dialog), - ) - if err != nil { - return err - } - err = d.index.Update(func(tx *buntdb.Tx) error { - _, _, err := tx.Set( - fmt.Sprintf("%s.%d.%d.%d", prefixDialogs, dialog.TeamID, dialog.PeerID, dialog.PeerType), - tools.Int64ToStr(dialog.TopMessageID), - nil, - ) - return err - }) - if err != nil { - return err - } - } - return nil - }) + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + + return d.db.Update(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketDialogs) + for _, dialog := range dialogs { + err := b.Put( + alloc.Gen(dialog.TeamID, dialog.PeerID, dialog.PeerType), + alloc.Marshal(dialog), + ) + if err != nil { + return err + } + err = d.index.Update(func(tx *buntdb.Tx) error { + _, _, err := tx.Set( + fmt.Sprintf("%s.%d.%d.%d", prefixDialogs, dialog.TeamID, dialog.PeerID, dialog.PeerType), + tools.Int64ToStr(dialog.TopMessageID), + nil, + ) + return err + }) + if err != nil { + return err + } + } + return nil + }) } func (d *repoDialogs) Delete(teamID int64, peerID int64, peerType int32) error { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - - return d.db.Update(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketDialogs) - err := b.Delete(alloc.Gen(teamID, peerID, peerType)) - if err != nil { - return err - } - return d.index.Update(func(tx *buntdb.Tx) error { - _, _ = tx.Delete(fmt.Sprintf("%s.%d.%d.%d", prefixDialogs, teamID, peerID, peerType)) - return nil - }) - }) + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + + return d.db.Update(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketDialogs) + err := b.Delete(alloc.Gen(teamID, peerID, peerType)) + if err != nil { + return err + } + return d.index.Update(func(tx *buntdb.Tx) error { + _, _ = tx.Delete(fmt.Sprintf("%s.%d.%d.%d", prefixDialogs, teamID, peerID, peerType)) + return nil + }) + }) } func (d *repoDialogs) Read(teamID int64, peerID int64, peerType int32) (*msg.Dialog, error) { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - - dialog := &msg.Dialog{} - - err := d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketDialogs) - v := b.Get(alloc.Gen(teamID, peerID, peerType)) - if len(v) > 0 { - return dialog.Unmarshal(v) - } - return domain.ErrNotFound - }) - if err != nil { - return nil, err - } - return dialog, nil + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + + dialog := &msg.Dialog{} + + err := d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketDialogs) + v := b.Get(alloc.Gen(teamID, peerID, peerType)) + if len(v) > 0 { + return dialog.Unmarshal(v) + } + return domain.ErrNotFound + }) + if err != nil { + return nil, err + } + return dialog, nil } func (d *repoDialogs) List(teamID int64, offset, limit int32) ([]*msg.Dialog, error) { - dialogs := make([]*msg.Dialog, 0, limit) - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - - err := d.index.View(func(tx *buntdb.Tx) error { - return tx.Descend(indexDialogs, func(key, value string) bool { - parts := strings.Split(key, ".") - if tools.StrToInt64(parts[1]) != teamID { - return true - } - if offset--; offset >= 0 { - return true - } - if limit--; limit < 0 { - return false - } - - peerID := tools.StrToInt64(parts[2]) - peerType := tools.StrToInt32(parts[3]) - _ = d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketDialogs) - v := b.Get(alloc.Gen(teamID, peerID, peerType)) - if len(v) > 0 { - dialog := &msg.Dialog{} - _ = dialog.Unmarshal(v) - dialogs = append(dialogs, dialog) - } - return nil - }) - return true - }) - }) - - if err != nil { - return nil, err - } - return dialogs, nil + dialogs := make([]*msg.Dialog, 0, limit) + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + + err := d.index.View(func(tx *buntdb.Tx) error { + return tx.Descend(indexDialogs, func(key, value string) bool { + parts := strings.Split(key, ".") + if tools.StrToInt64(parts[1]) != teamID { + return true + } + if offset--; offset >= 0 { + return true + } + if limit--; limit < 0 { + return false + } + + peerID := tools.StrToInt64(parts[2]) + peerType := tools.StrToInt32(parts[3]) + _ = d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketDialogs) + v := b.Get(alloc.Gen(teamID, peerID, peerType)) + if len(v) > 0 { + dialog := &msg.Dialog{} + _ = dialog.Unmarshal(v) + dialogs = append(dialogs, dialog) + } + return nil + }) + return true + }) + }) + + if err != nil { + return nil, err + } + return dialogs, nil } diff --git a/internal/minirepo/dialogs_test.go b/internal/minirepo/dialogs_test.go index 36c9a0b3..bc134620 100644 --- a/internal/minirepo/dialogs_test.go +++ b/internal/minirepo/dialogs_test.go @@ -1,11 +1,12 @@ package minirepo_test import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/minirepo" - "github.com/ronaksoft/rony/tools" - . "github.com/smartystreets/goconvey/convey" - "testing" + "testing" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/minirepo" + "github.com/ronaksoft/rony/tools" + . "github.com/smartystreets/goconvey/convey" ) /* @@ -18,32 +19,32 @@ import ( */ func TestRepoDialogs(t *testing.T) { - Convey("MiniRepo Dialogs", t, func(c C) { - for i := 0; i < 10; i++ { - err := minirepo.Dialogs.Save(&msg.Dialog{ - TeamID: 0, - PeerID: tools.RandomInt64(0), - PeerType: int32(tools.RandomInt(2)) + 1, - TopMessageID: tools.RandomInt64(100000), - }) - c.So(err, ShouldBeNil) - } - dialogs, err := minirepo.Dialogs.List(0, 0, 10) - c.So(err, ShouldBeNil) - c.So(dialogs, ShouldHaveLength, 10) - teamID := tools.RandomInt64(0) - for i := 0; i < 10; i++ { - err := minirepo.Dialogs.Save(&msg.Dialog{ - TeamID: teamID, - PeerID: tools.RandomInt64(0), - PeerType: int32(tools.RandomInt(2)) + 1, - TopMessageID: tools.RandomInt64(100000), - }) - c.So(err, ShouldBeNil) - } - dialogs, err = minirepo.Dialogs.List(0, 0, 10) - c.So(err, ShouldBeNil) - c.So(dialogs, ShouldHaveLength, 10) - }) + Convey("MiniRepo Dialogs", t, func(c C) { + for i := 0; i < 10; i++ { + err := minirepo.Dialogs.Save(&msg.Dialog{ + TeamID: 0, + PeerID: tools.RandomInt64(0), + PeerType: int32(tools.RandomInt(2)) + 1, + TopMessageID: tools.RandomInt64(100000), + }) + c.So(err, ShouldBeNil) + } + dialogs, err := minirepo.Dialogs.List(0, 0, 10) + c.So(err, ShouldBeNil) + c.So(dialogs, ShouldHaveLength, 10) + teamID := tools.RandomInt64(0) + for i := 0; i < 10; i++ { + err := minirepo.Dialogs.Save(&msg.Dialog{ + TeamID: teamID, + PeerID: tools.RandomInt64(0), + PeerType: int32(tools.RandomInt(2)) + 1, + TopMessageID: tools.RandomInt64(100000), + }) + c.So(err, ShouldBeNil) + } + dialogs, err = minirepo.Dialogs.List(0, 0, 10) + c.So(err, ShouldBeNil) + c.So(dialogs, ShouldHaveLength, 10) + }) } diff --git a/internal/minirepo/groups.go b/internal/minirepo/groups.go index bbcbf46e..6520fb97 100644 --- a/internal/minirepo/groups.go +++ b/internal/minirepo/groups.go @@ -1,11 +1,12 @@ package minirepo import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/boltdb/bolt" - "github.com/ronaksoft/rony/tools" - "strings" + "strings" + + "github.com/boltdb/bolt" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony/tools" ) /* @@ -18,118 +19,118 @@ import ( */ var ( - bucketGroups = []byte("GRP") + bucketGroups = []byte("GRP") ) type repoGroups struct { - *repository + *repository } func newGroup(r *repository) *repoGroups { - rd := &repoGroups{ - repository: r, - } - return rd + rd := &repoGroups{ + repository: r, + } + return rd } func (d *repoGroups) Save(groups ...*msg.Group) error { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - - return d.db.Update(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketGroups) - for _, group := range groups { - err := b.Put( - alloc.Gen(group.TeamID, group.ID), - alloc.Marshal(group), - ) - if err != nil { - return err - } - } - return nil - }) + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + + return d.db.Update(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketGroups) + for _, group := range groups { + err := b.Put( + alloc.Gen(group.TeamID, group.ID), + alloc.Marshal(group), + ) + if err != nil { + return err + } + } + return nil + }) } func (d *repoGroups) Delete(teamID int64, groupID int64) error { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - - return d.db.Update(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketGroups) - err := b.Delete(alloc.Gen(teamID, groupID)) - if err != nil { - return err - } - return nil - }) + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + + return d.db.Update(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketGroups) + err := b.Delete(alloc.Gen(teamID, groupID)) + if err != nil { + return err + } + return nil + }) } func (d *repoGroups) Read(teamID int64, groupID int64) (*msg.Group, error) { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - - group := &msg.Group{} - err := d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketGroups) - v := b.Get(alloc.Gen(teamID, groupID)) - if len(v) > 0 { - return group.Unmarshal(v) - } - return domain.ErrNotFound - }) - if err != nil { - return nil, err - } - return group, nil + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + + group := &msg.Group{} + err := d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketGroups) + v := b.Get(alloc.Gen(teamID, groupID)) + if len(v) > 0 { + return group.Unmarshal(v) + } + return domain.ErrNotFound + }) + if err != nil { + return nil, err + } + return group, nil } func (d *repoGroups) ReadMany(teamID int64, groupIDs ...int64) ([]*msg.Group, error) { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - - groups := make([]*msg.Group, 0, len(groupIDs)) - err := d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketGroups) - for _, groupID := range groupIDs { - group := &msg.Group{} - v := b.Get(alloc.Gen(teamID, groupID)) - if len(v) > 0 { - _ = group.Unmarshal(v) - groups = append(groups, group) - } - } - return nil - }) - if err != nil { - return nil, err - } - return groups, nil + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + + groups := make([]*msg.Group, 0, len(groupIDs)) + err := d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketGroups) + for _, groupID := range groupIDs { + group := &msg.Group{} + v := b.Get(alloc.Gen(teamID, groupID)) + if len(v) > 0 { + _ = group.Unmarshal(v) + groups = append(groups, group) + } + } + return nil + }) + if err != nil { + return nil, err + } + return groups, nil } func (d *repoGroups) Search(teamID int64, phrase string, limit int) []*msg.Group { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - - groups := make([]*msg.Group, 0, limit) - _ = d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketGroups) - _ = b.ForEach(func(k, v []byte) error { - g := &msg.Group{} - _ = g.Unmarshal(v) - if g.TeamID != teamID { - return nil - } - if strings.Contains(strings.ToLower(g.Title), phrase) { - groups = append(groups, g) - limit-- - } - if limit < 0 { - return domain.ErrLimitReached - } - return nil - }) - return nil - }) - return groups + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + + groups := make([]*msg.Group, 0, limit) + _ = d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketGroups) + _ = b.ForEach(func(k, v []byte) error { + g := &msg.Group{} + _ = g.Unmarshal(v) + if g.TeamID != teamID { + return nil + } + if strings.Contains(strings.ToLower(g.Title), phrase) { + groups = append(groups, g) + limit-- + } + if limit < 0 { + return domain.ErrLimitReached + } + return nil + }) + return nil + }) + return groups } diff --git a/internal/minirepo/repo.go b/internal/minirepo/repo.go index d9e07bf5..85e5fd99 100644 --- a/internal/minirepo/repo.go +++ b/internal/minirepo/repo.go @@ -1,13 +1,14 @@ package minirepo import ( - "fmt" - "git.ronaksoft.com/river/sdk/internal/logs" - "github.com/boltdb/bolt" - "github.com/tidwall/buntdb" - "go.uber.org/zap" - "os" - "path/filepath" + "fmt" + "os" + "path/filepath" + + "github.com/boltdb/bolt" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/tidwall/buntdb" + "go.uber.org/zap" ) /* @@ -20,77 +21,77 @@ import ( */ var ( - r *repository - Dialogs *repoDialogs - Users *repoUsers - Groups *repoGroups - General *repoGenerals - Teams *repoTeams - logger *logs.Logger + r *repository + Dialogs *repoDialogs + Users *repoUsers + Groups *repoGroups + General *repoGenerals + Teams *repoTeams + logger *logs.Logger ) type repository struct { - db *bolt.DB - index *buntdb.DB + db *bolt.DB + index *buntdb.DB } func init() { - logger = logs.With("MiniREPO") + logger = logs.With("MiniREPO") } func MustInit(dbPath string) { - err := Init(dbPath) - if err != nil { - panic(err) - } + err := Init(dbPath) + if err != nil { + panic(err) + } } func Init(dbPath string) (err error) { - if r != nil { - return nil - } + if r != nil { + return nil + } - r = &repository{} + r = &repository{} - boltPath := filepath.Join(dbPath, "bolt") - _ = os.MkdirAll(boltPath, os.ModePerm) - if boldDB, err := bolt.Open(filepath.Join(boltPath, "db.dat"), 0666, bolt.DefaultOptions); err != nil { - return err - } else { - r.db = boldDB - } - _ = r.db.Update(func(tx *bolt.Tx) error { - buckets := [][]byte{ - bucketGroups, bucketUsers, bucketGenerals, bucketContacts, bucketDialogs, bucketTeams, - } - for _, b := range buckets { - _, err = tx.CreateBucketIfNotExists(b) - if err != nil { - logger.Error("MiniRepo got error on creating bucket", zap.Error(err)) - } - } - return nil - }) + boltPath := filepath.Join(dbPath, "bolt") + _ = os.MkdirAll(boltPath, os.ModePerm) + if boldDB, err := bolt.Open(filepath.Join(boltPath, "db.dat"), 0666, bolt.DefaultOptions); err != nil { + return err + } else { + r.db = boldDB + } + _ = r.db.Update(func(tx *bolt.Tx) error { + buckets := [][]byte{ + bucketGroups, bucketUsers, bucketGenerals, bucketContacts, bucketDialogs, bucketTeams, + } + for _, b := range buckets { + _, err = tx.CreateBucketIfNotExists(b) + if err != nil { + logger.Error("MiniRepo got error on creating bucket", zap.Error(err)) + } + } + return nil + }) - // Initialize BuntDB Indexer - buntPath := filepath.Join(dbPath, "bunty") - _ = os.MkdirAll(buntPath, os.ModePerm) - if buntIndex, err := buntdb.Open(filepath.Join(buntPath, "mini.dat")); err != nil { - return err - } else { - r.index = buntIndex - } + // Initialize BuntDB Indexer + buntPath := filepath.Join(dbPath, "bunty") + _ = os.MkdirAll(buntPath, os.ModePerm) + if buntIndex, err := buntdb.Open(filepath.Join(buntPath, "mini.dat")); err != nil { + return err + } else { + r.index = buntIndex + } - _ = r.index.Update(func(tx *buntdb.Tx) error { - _ = tx.CreateIndex(indexDialogs, fmt.Sprintf("%s.*", prefixDialogs), buntdb.IndexBinary) - _ = tx.CreateIndex(indexContacts, fmt.Sprintf("%s.*", prefixContacts), buntdb.IndexBinary) - return nil - }) + _ = r.index.Update(func(tx *buntdb.Tx) error { + _ = tx.CreateIndex(indexDialogs, fmt.Sprintf("%s.*", prefixDialogs), buntdb.IndexBinary) + _ = tx.CreateIndex(indexContacts, fmt.Sprintf("%s.*", prefixContacts), buntdb.IndexBinary) + return nil + }) - Dialogs = newDialog(r) - Users = newUser(r) - Groups = newGroup(r) - General = newGeneral(r) - Teams = newTeam(r) - return + Dialogs = newDialog(r) + Users = newUser(r) + Groups = newGroup(r) + General = newGeneral(r) + Teams = newTeam(r) + return } diff --git a/internal/minirepo/repo_test.go b/internal/minirepo/repo_test.go index 46d9f69f..86f4fa42 100644 --- a/internal/minirepo/repo_test.go +++ b/internal/minirepo/repo_test.go @@ -1,7 +1,7 @@ package minirepo_test import ( - "git.ronaksoft.com/river/sdk/internal/minirepo" + "github.com/ronaksoft/river-sdk/internal/minirepo" ) /* @@ -14,5 +14,5 @@ import ( */ func init() { - minirepo.MustInit("./_hdd") + minirepo.MustInit("./_hdd") } diff --git a/internal/minirepo/teams.go b/internal/minirepo/teams.go index 5303adf3..b9d7209c 100644 --- a/internal/minirepo/teams.go +++ b/internal/minirepo/teams.go @@ -1,10 +1,10 @@ package minirepo import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/boltdb/bolt" - "github.com/ronaksoft/rony/tools" + "github.com/boltdb/bolt" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony/tools" ) /* @@ -17,85 +17,85 @@ import ( */ var ( - bucketTeams = []byte("TEAM") + bucketTeams = []byte("TEAM") ) type repoTeams struct { - *repository + *repository } func newTeam(r *repository) *repoTeams { - rd := &repoTeams{ - repository: r, - } - return rd + rd := &repoTeams{ + repository: r, + } + return rd } func (d *repoTeams) Save(teams ...*msg.Team) error { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() - return d.db.Update(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketTeams) - for _, team := range teams { - err := b.Put( - alloc.Gen(team.ID), - alloc.Marshal(team), - ) - if err != nil { - return err - } - } - return nil - }) + return d.db.Update(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketTeams) + for _, team := range teams { + err := b.Put( + alloc.Gen(team.ID), + alloc.Marshal(team), + ) + if err != nil { + return err + } + } + return nil + }) } func (d *repoTeams) Delete(teamID int64) error { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() - return d.db.Update(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketTeams) - return b.Delete(alloc.Gen(teamID)) - }) + return d.db.Update(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketTeams) + return b.Delete(alloc.Gen(teamID)) + }) } func (d *repoTeams) Read(teamID int64) (*msg.Team, error) { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() - team := &msg.Team{} - err := d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketTeams) - v := b.Get(alloc.Gen(teamID)) - if len(v) > 0 { - return team.Unmarshal(v) - } - return domain.ErrNotFound - }) - if err != nil { - return nil, err - } - return team, nil + team := &msg.Team{} + err := d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketTeams) + v := b.Get(alloc.Gen(teamID)) + if len(v) > 0 { + return team.Unmarshal(v) + } + return domain.ErrNotFound + }) + if err != nil { + return nil, err + } + return team, nil } func (d *repoTeams) List() ([]*msg.Team, error) { - teams := make([]*msg.Team, 0, 10) - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() + teams := make([]*msg.Team, 0, 10) + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() - err := d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketTeams) - return b.ForEach(func(k, v []byte) error { - team := &msg.Team{} - _ = team.Unmarshal(v) - teams = append(teams, team) - return nil - }) - }) + err := d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketTeams) + return b.ForEach(func(k, v []byte) error { + team := &msg.Team{} + _ = team.Unmarshal(v) + teams = append(teams, team) + return nil + }) + }) - if err != nil { - return nil, err - } - return teams, nil + if err != nil { + return nil, err + } + return teams, nil } diff --git a/internal/minirepo/users.go b/internal/minirepo/users.go index b97c6689..a3ae663e 100644 --- a/internal/minirepo/users.go +++ b/internal/minirepo/users.go @@ -1,14 +1,15 @@ package minirepo import ( - "encoding/binary" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/boltdb/bolt" - "github.com/ronaksoft/rony/tools" - "github.com/tidwall/buntdb" - "strings" + "encoding/binary" + "fmt" + "strings" + + "github.com/boltdb/bolt" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony/tools" + "github.com/tidwall/buntdb" ) /* @@ -21,260 +22,260 @@ import ( */ const ( - prefixUsers = "USERS" - indexUsers - prefixContacts = "CONTACTS" - indexContacts + prefixUsers = "USERS" + indexUsers + prefixContacts = "CONTACTS" + indexContacts ) var ( - bucketContacts = []byte("CNTC") - bucketUsers = []byte("USR") + bucketContacts = []byte("CNTC") + bucketUsers = []byte("USR") ) type repoUsers struct { - *repository + *repository } func newUser(r *repository) *repoUsers { - rd := &repoUsers{ - repository: r, - } - return rd + rd := &repoUsers{ + repository: r, + } + return rd } func (d *repoUsers) getUser(alloc *tools.Allocator, b *bolt.Bucket, userID int64) (*msg.User, error) { - v := b.Get(alloc.Gen(userID)) - if len(v) == 0 { - return nil, domain.ErrNotFound - } - u := &msg.User{} - _ = u.Unmarshal(v) - return u, nil + v := b.Get(alloc.Gen(userID)) + if len(v) == 0 { + return nil, domain.ErrNotFound + } + u := &msg.User{} + _ = u.Unmarshal(v) + return u, nil } func (d *repoUsers) saveContact(alloc *tools.Allocator, tx *bolt.Tx, teamID int64, contact *msg.ContactUser, lastSeen int64) error { - b := tx.Bucket(bucketContacts) - err := b.Put( - alloc.Gen(teamID, contact.ID), - alloc.Marshal(contact), - ) - if err != nil { - return err - } - err = d.index.Update(func(tx *buntdb.Tx) error { - _, _, err := tx.Set( - fmt.Sprintf("%s.%d.%d", prefixContacts, teamID, contact.ID), - tools.Int64ToStr(lastSeen), - nil, - ) - return err - }) - if err != nil { - return err - } - return nil + b := tx.Bucket(bucketContacts) + err := b.Put( + alloc.Gen(teamID, contact.ID), + alloc.Marshal(contact), + ) + if err != nil { + return err + } + err = d.index.Update(func(tx *buntdb.Tx) error { + _, _, err := tx.Set( + fmt.Sprintf("%s.%d.%d", prefixContacts, teamID, contact.ID), + tools.Int64ToStr(lastSeen), + nil, + ) + return err + }) + if err != nil { + return err + } + return nil } func (d *repoUsers) DeleteContact(teamID int64, userID int64) { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() - _ = d.db.Update(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketContacts) - _ = b.Delete(alloc.Gen(teamID, userID)) - _ = d.index.Update(func(tx *buntdb.Tx) error { - _, err := tx.Delete(fmt.Sprintf("%s.%d.%d", prefixContacts, teamID, userID)) - return err - }) - return nil - }) + _ = d.db.Update(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketContacts) + _ = b.Delete(alloc.Gen(teamID, userID)) + _ = d.index.Update(func(tx *buntdb.Tx) error { + _, err := tx.Delete(fmt.Sprintf("%s.%d.%d", prefixContacts, teamID, userID)) + return err + }) + return nil + }) } func (d *repoUsers) SaveUser(users ...*msg.User) error { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() - return d.db.Update(func(tx *bolt.Tx) error { - b1 := tx.Bucket(bucketUsers) - for _, user := range users { - err := b1.Put(alloc.Gen(user.ID), alloc.Marshal(user)) - if err != nil { - return err - } - } - return nil - }) + return d.db.Update(func(tx *bolt.Tx) error { + b1 := tx.Bucket(bucketUsers) + for _, user := range users { + err := b1.Put(alloc.Gen(user.ID), alloc.Marshal(user)) + if err != nil { + return err + } + } + return nil + }) } func (d *repoUsers) SaveAllContacts(teamID int64, newContacts *msg.ContactsMany) error { - if !newContacts.Modified { - return nil - } - newContactsMap := make(map[int64]int64, len(newContacts.ContactUsers)) - for idx := range newContacts.Users { - newContactsMap[newContacts.ContactUsers[idx].ID] = newContacts.Users[idx].LastSeen - } - oldContacts, err := d.ReadAllContacts(teamID) - if err == nil { - oldContactsMap := make(map[int64]bool, len(oldContacts.ContactUsers)) - for idx := range oldContacts.ContactUsers { - oldContactsMap[oldContacts.ContactUsers[idx].ID] = true - } - for userID := range oldContactsMap { - if _, ok := newContactsMap[userID]; !ok { - d.DeleteContact(teamID, userID) - } - } - } + if !newContacts.Modified { + return nil + } + newContactsMap := make(map[int64]int64, len(newContacts.ContactUsers)) + for idx := range newContacts.Users { + newContactsMap[newContacts.ContactUsers[idx].ID] = newContacts.Users[idx].LastSeen + } + oldContacts, err := d.ReadAllContacts(teamID) + if err == nil { + oldContactsMap := make(map[int64]bool, len(oldContacts.ContactUsers)) + for idx := range oldContacts.ContactUsers { + oldContactsMap[oldContacts.ContactUsers[idx].ID] = true + } + for userID := range oldContactsMap { + if _, ok := newContactsMap[userID]; !ok { + d.DeleteContact(teamID, userID) + } + } + } - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() - err = d.db.Update(func(tx *bolt.Tx) error { - for _, cu := range newContacts.ContactUsers { - err = d.saveContact(alloc, tx, teamID, cu, newContactsMap[cu.ID]) - } - return nil - }) - return nil + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() + err = d.db.Update(func(tx *bolt.Tx) error { + for _, cu := range newContacts.ContactUsers { + err = d.saveContact(alloc, tx, teamID, cu, newContactsMap[cu.ID]) + } + return nil + }) + return nil } func (d *repoUsers) ReadAllContacts(teamID int64) (*msg.ContactsMany, error) { - res := &msg.ContactsMany{} + res := &msg.ContactsMany{} - err := d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketContacts) - _ = b.ForEach(func(k, v []byte) error { - if binary.BigEndian.Uint64(k[1:9]) != uint64(teamID) { - return nil - } + err := d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketContacts) + _ = b.ForEach(func(k, v []byte) error { + if binary.BigEndian.Uint64(k[1:9]) != uint64(teamID) { + return nil + } - c := &msg.ContactUser{} - _ = c.Unmarshal(v) - res.ContactUsers = append(res.ContactUsers, c) - if c.Phone != "" { - res.Contacts = append(res.Contacts, &msg.PhoneContact{ - ClientID: c.ClientID, - FirstName: c.FirstName, - LastName: c.LastName, - Phone: c.Phone, - }) - } - return nil - }) - return nil - }) - if err != nil { - return nil, err - } + c := &msg.ContactUser{} + _ = c.Unmarshal(v) + res.ContactUsers = append(res.ContactUsers, c) + if c.Phone != "" { + res.Contacts = append(res.Contacts, &msg.PhoneContact{ + ClientID: c.ClientID, + FirstName: c.FirstName, + LastName: c.LastName, + Phone: c.Phone, + }) + } + return nil + }) + return nil + }) + if err != nil { + return nil, err + } - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() - for _, c := range res.ContactUsers { - _ = d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketUsers) - u, _ := d.getUser(alloc, b, c.ID) - if u != nil { - res.Users = append(res.Users, u) - } - return nil - }) - } - return res, nil + for _, c := range res.ContactUsers { + _ = d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketUsers) + u, _ := d.getUser(alloc, b, c.ID) + if u != nil { + res.Users = append(res.Users, u) + } + return nil + }) + } + return res, nil } func (d *repoUsers) ReadUser(userID int64) (*msg.User, error) { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() - var ( - u *msg.User - err error - ) - err = d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketUsers) - u, err = d.getUser(alloc, b, userID) - return err - }) - if err != nil { - return nil, err - } - return u, nil + var ( + u *msg.User + err error + ) + err = d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketUsers) + u, err = d.getUser(alloc, b, userID) + return err + }) + if err != nil { + return nil, err + } + return u, nil } func (d *repoUsers) ReadMany(userIDs ...int64) ([]*msg.User, error) { - alloc := tools.NewAllocator() - defer alloc.ReleaseAll() + alloc := tools.NewAllocator() + defer alloc.ReleaseAll() - var ( - users = make([]*msg.User, 0, len(userIDs)) - err error - ) - err = d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketUsers) - for _, userID := range userIDs { - u, _ := d.getUser(alloc, b, userID) - if u != nil { - users = append(users, u) - } - } - return nil - }) - if err != nil { - return nil, err - } - return users, nil + var ( + users = make([]*msg.User, 0, len(userIDs)) + err error + ) + err = d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketUsers) + for _, userID := range userIDs { + u, _ := d.getUser(alloc, b, userID) + if u != nil { + users = append(users, u) + } + } + return nil + }) + if err != nil { + return nil, err + } + return users, nil } func (d *repoUsers) Search(phrase string, limit int) []*msg.User { - users := make([]*msg.User, 0, limit) - _ = d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketUsers) - _ = b.ForEach(func(k, v []byte) error { - u := &msg.User{} - _ = u.Unmarshal(v) + users := make([]*msg.User, 0, limit) + _ = d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketUsers) + _ = b.ForEach(func(k, v []byte) error { + u := &msg.User{} + _ = u.Unmarshal(v) - if strings.Contains(strings.ToLower(u.FirstName), phrase) || - strings.Contains(strings.ToLower(u.LastName), phrase) || - strings.Contains(strings.ToLower(u.Username), phrase) { - users = append(users, u) - limit-- - } - if limit < 0 { - return domain.ErrLimitReached - } - return nil - }) - return nil - }) - return users + if strings.Contains(strings.ToLower(u.FirstName), phrase) || + strings.Contains(strings.ToLower(u.LastName), phrase) || + strings.Contains(strings.ToLower(u.Username), phrase) { + users = append(users, u) + limit-- + } + if limit < 0 { + return domain.ErrLimitReached + } + return nil + }) + return nil + }) + return users } func (d *repoUsers) SearchContacts(teamID int64, phrase string, limit int) []*msg.ContactUser { - contacts := make([]*msg.ContactUser, 0, limit) - _ = d.db.View(func(tx *bolt.Tx) error { - b := tx.Bucket(bucketContacts) - _ = b.ForEach(func(k, v []byte) error { - if binary.BigEndian.Uint64(k[1:9]) != uint64(teamID) { - return nil - } + contacts := make([]*msg.ContactUser, 0, limit) + _ = d.db.View(func(tx *bolt.Tx) error { + b := tx.Bucket(bucketContacts) + _ = b.ForEach(func(k, v []byte) error { + if binary.BigEndian.Uint64(k[1:9]) != uint64(teamID) { + return nil + } - c := &msg.ContactUser{} - _ = c.Unmarshal(v) - if strings.Contains(strings.ToLower(c.FirstName), phrase) || - strings.Contains(strings.ToLower(c.LastName), phrase) || - strings.Contains(strings.ToLower(c.Username), phrase) { - contacts = append(contacts, c) - limit-- - } - if limit < 0 { - return domain.ErrLimitReached - } - return nil - }) - return nil - }) - return contacts + c := &msg.ContactUser{} + _ = c.Unmarshal(v) + if strings.Contains(strings.ToLower(c.FirstName), phrase) || + strings.Contains(strings.ToLower(c.LastName), phrase) || + strings.Contains(strings.ToLower(c.Username), phrase) { + contacts = append(contacts, c) + limit-- + } + if limit < 0 { + return domain.ErrLimitReached + } + return nil + }) + return nil + }) + return contacts } diff --git a/internal/monitoring/monitoring.go b/internal/monitoring/monitoring.go index 6b98dc0c..3b831618 100644 --- a/internal/monitoring/monitoring.go +++ b/internal/monitoring/monitoring.go @@ -1,13 +1,14 @@ package mon import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony/registry" - "go.uber.org/zap" - "sync" - "time" + "sync" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony/registry" + "go.uber.org/zap" ) /* @@ -20,170 +21,170 @@ import ( */ var ( - logger *logs.Logger - Stats stats + logger *logs.Logger + Stats stats ) const ( - serverLongThreshold = 2 * time.Second + serverLongThreshold = 2 * time.Second ) type stats struct { - mtx *sync.RWMutex - StartTime time.Time - LastForegroundTime time.Time - - TotalServerRequests int64 - AvgResponseTime int64 - TotalUploadBytes int64 - TotalDownloadBytes int64 - SentMessages int64 - ReceivedMessages int64 - SentMedia int64 - ReceivedMedia int64 - ForegroundTime int64 - - // File DataTransferRate - totalBytes int - dataTransferPeriod time.Duration - lastDataTransfer time.Time + mtx *sync.RWMutex + StartTime time.Time + LastForegroundTime time.Time + + TotalServerRequests int64 + AvgResponseTime int64 + TotalUploadBytes int64 + TotalDownloadBytes int64 + SentMessages int64 + ReceivedMessages int64 + SentMedia int64 + ReceivedMedia int64 + ForegroundTime int64 + + // File DataTransferRate + totalBytes int + dataTransferPeriod time.Duration + lastDataTransfer time.Time } func init() { - Stats.StartTime = time.Now() - Stats.mtx = &sync.RWMutex{} + Stats.StartTime = time.Now() + Stats.mtx = &sync.RWMutex{} - logger = logs.With("Monitoring") + logger = logs.With("Monitoring") } func DataTransfer(totalUploadBytes, totalDownloadBytes int, d time.Duration) { - Stats.mtx.Lock() - Stats.TotalDownloadBytes += int64(totalDownloadBytes) - Stats.TotalUploadBytes += int64(totalUploadBytes) - if time.Since(Stats.lastDataTransfer) > time.Second*30 { - Stats.totalBytes = totalDownloadBytes + totalUploadBytes - Stats.dataTransferPeriod = d - } else { - Stats.totalBytes += totalDownloadBytes + totalUploadBytes - Stats.dataTransferPeriod += d - } - Stats.lastDataTransfer = time.Now() - Stats.mtx.Unlock() + Stats.mtx.Lock() + Stats.TotalDownloadBytes += int64(totalDownloadBytes) + Stats.TotalUploadBytes += int64(totalUploadBytes) + if time.Since(Stats.lastDataTransfer) > time.Second*30 { + Stats.totalBytes = totalDownloadBytes + totalUploadBytes + Stats.dataTransferPeriod = d + } else { + Stats.totalBytes += totalDownloadBytes + totalUploadBytes + Stats.dataTransferPeriod += d + } + Stats.lastDataTransfer = time.Now() + Stats.mtx.Unlock() } func GetDataTransferRate() int32 { - Stats.mtx.RLock() - rate := int32(Stats.totalBytes / int(Stats.dataTransferPeriod/time.Millisecond+1)) - Stats.mtx.RUnlock() - return rate + Stats.mtx.RLock() + rate := int32(Stats.totalBytes / int(Stats.dataTransferPeriod/time.Millisecond+1)) + Stats.mtx.RUnlock() + return rate } func ServerResponseTime(reqConstructor, resConstructor int64, t time.Duration) { - if t > serverLongThreshold { - logger.Warn("Too Long ServerResponse", - zap.Duration("T", t), - zap.String("ResConstructor", registry.ConstructorName(resConstructor)), - zap.String("ReqConstructor", registry.ConstructorName(reqConstructor)), - ) - } - ts := t.Milliseconds() - Stats.mtx.Lock() - Stats.TotalServerRequests += 1 - Stats.AvgResponseTime = (Stats.AvgResponseTime*(Stats.TotalServerRequests-1) + ts) / (Stats.TotalServerRequests) - Stats.mtx.Unlock() + if t > serverLongThreshold { + logger.Warn("Too Long ServerResponse", + zap.Duration("T", t), + zap.String("ResConstructor", registry.ConstructorName(resConstructor)), + zap.String("ReqConstructor", registry.ConstructorName(reqConstructor)), + ) + } + ts := t.Milliseconds() + Stats.mtx.Lock() + Stats.TotalServerRequests += 1 + Stats.AvgResponseTime = (Stats.AvgResponseTime*(Stats.TotalServerRequests-1) + ts) / (Stats.TotalServerRequests) + Stats.mtx.Unlock() } func IncMessageSent() { - Stats.mtx.Lock() - Stats.SentMessages += 1 - Stats.mtx.Unlock() + Stats.mtx.Lock() + Stats.SentMessages += 1 + Stats.mtx.Unlock() } func IncMediaSent() { - Stats.mtx.Lock() - Stats.SentMedia += 1 - Stats.mtx.Unlock() + Stats.mtx.Lock() + Stats.SentMedia += 1 + Stats.mtx.Unlock() } func IncMessageReceived() { - Stats.mtx.Lock() - Stats.ReceivedMessages += 1 - Stats.mtx.Unlock() + Stats.mtx.Lock() + Stats.ReceivedMessages += 1 + Stats.mtx.Unlock() } func IncMediaReceived() { - Stats.mtx.Lock() - Stats.ReceivedMedia += 1 - Stats.mtx.Unlock() + Stats.mtx.Lock() + Stats.ReceivedMedia += 1 + Stats.mtx.Unlock() } func SetForegroundTime() { - Stats.mtx.Lock() - Stats.LastForegroundTime = time.Now() - Stats.mtx.Unlock() + Stats.mtx.Lock() + Stats.LastForegroundTime = time.Now() + Stats.mtx.Unlock() } func IncForegroundTime() { - Stats.mtx.Lock() - if Stats.LastForegroundTime.Unix() != 0 { - Stats.ForegroundTime += int64(time.Since(Stats.LastForegroundTime).Seconds()) - } - Stats.mtx.Unlock() + Stats.mtx.Lock() + if Stats.LastForegroundTime.Unix() != 0 { + Stats.ForegroundTime += int64(time.Since(Stats.LastForegroundTime).Seconds()) + } + Stats.mtx.Unlock() } func LoadUsage() { - now := time.Now() - cu := &msg.ClientUsage{} - b, err := repo.System.LoadBytes("ClientUsage") - if err == nil { - err = cu.Unmarshal(b) - } - if err != nil { - cu.Year = int32(now.Year()) - cu.Month = int32(now.Month()) - cu.Day = int32(now.Day()) - } - Stats.mtx.Lock() - Stats.ForegroundTime = cu.ForegroundTime - Stats.ReceivedMessages = cu.ReceivedMessages - Stats.ReceivedMedia = cu.ReceivedMedia - Stats.SentMedia = cu.SentMedia - Stats.SentMessages = cu.SentMessages - Stats.AvgResponseTime = cu.AvgResponseTime - Stats.TotalServerRequests = cu.TotalRequests - Stats.mtx.Unlock() + now := time.Now() + cu := &msg.ClientUsage{} + b, err := repo.System.LoadBytes("ClientUsage") + if err == nil { + err = cu.Unmarshal(b) + } + if err != nil { + cu.Year = int32(now.Year()) + cu.Month = int32(now.Month()) + cu.Day = int32(now.Day()) + } + Stats.mtx.Lock() + Stats.ForegroundTime = cu.ForegroundTime + Stats.ReceivedMessages = cu.ReceivedMessages + Stats.ReceivedMedia = cu.ReceivedMedia + Stats.SentMedia = cu.SentMedia + Stats.SentMessages = cu.SentMessages + Stats.AvgResponseTime = cu.AvgResponseTime + Stats.TotalServerRequests = cu.TotalRequests + Stats.mtx.Unlock() } func SaveUsage() { - cu := &msg.ClientUsage{} - Stats.mtx.Lock() - cu.ForegroundTime = Stats.ForegroundTime - cu.ReceivedMedia = Stats.ReceivedMedia - cu.ReceivedMessages = Stats.ReceivedMessages - cu.SentMedia = Stats.SentMedia - cu.SentMessages = Stats.SentMessages - cu.AvgResponseTime = Stats.AvgResponseTime - cu.TotalRequests = Stats.TotalServerRequests - Stats.mtx.Unlock() - b, err := cu.Marshal() - if err == nil { - err = repo.System.SaveBytes("ClientUsage", b) - if err != nil { - logger.Warn("got error on saving ClientUsage into the db", zap.Error(err)) - } - } + cu := &msg.ClientUsage{} + Stats.mtx.Lock() + cu.ForegroundTime = Stats.ForegroundTime + cu.ReceivedMedia = Stats.ReceivedMedia + cu.ReceivedMessages = Stats.ReceivedMessages + cu.SentMedia = Stats.SentMedia + cu.SentMessages = Stats.SentMessages + cu.AvgResponseTime = Stats.AvgResponseTime + cu.TotalRequests = Stats.TotalServerRequests + Stats.mtx.Unlock() + b, err := cu.Marshal() + if err == nil { + err = repo.System.SaveBytes("ClientUsage", b) + if err != nil { + logger.Warn("got error on saving ClientUsage into the db", zap.Error(err)) + } + } } func ResetUsage() { - _ = repo.System.Delete("ClientUsage") - Stats.mtx.Lock() - Stats.ForegroundTime = 0 - Stats.ReceivedMessages = 0 - Stats.ReceivedMedia = 0 - Stats.SentMedia = 0 - Stats.SentMessages = 0 - Stats.AvgResponseTime = 0 - Stats.TotalServerRequests = 0 - Stats.mtx.Unlock() - SaveUsage() + _ = repo.System.Delete("ClientUsage") + Stats.mtx.Lock() + Stats.ForegroundTime = 0 + Stats.ReceivedMessages = 0 + Stats.ReceivedMedia = 0 + Stats.SentMedia = 0 + Stats.SentMessages = 0 + Stats.AvgResponseTime = 0 + Stats.TotalServerRequests = 0 + Stats.mtx.Unlock() + SaveUsage() } diff --git a/internal/repo/account.go b/internal/repo/account.go index 65115fd5..64576381 100644 --- a/internal/repo/account.go +++ b/internal/repo/account.go @@ -1,55 +1,56 @@ package repo import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/tools" + "fmt" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/rony/tools" ) const ( - prefixAccount = "ACCOUNT" + prefixAccount = "ACCOUNT" ) type repoAccount struct { - *repository + *repository } func (r *repoAccount) SetPrivacy(key msg.PrivacyKey, rules []*msg.PrivacyRule) error { - accountPrivacyRules := &msg.AccountPrivacyRules{} - accountPrivacyRules.Rules = rules - - bytes, _ := accountPrivacyRules.Marshal() - err := badgerUpdate(func(txn *badger.Txn) error { - return txn.SetEntry(badger.NewEntry( - tools.StrToByte(fmt.Sprintf("%s.%s", prefixAccount, key)), - bytes, - )) - }) - return err + accountPrivacyRules := &msg.AccountPrivacyRules{} + accountPrivacyRules.Rules = rules + + bytes, _ := accountPrivacyRules.Marshal() + err := badgerUpdate(func(txn *badger.Txn) error { + return txn.SetEntry(badger.NewEntry( + tools.StrToByte(fmt.Sprintf("%s.%s", prefixAccount, key)), + bytes, + )) + }) + return err } func (r *repoAccount) GetPrivacy(key msg.PrivacyKey) (*msg.AccountPrivacyRules, error) { - var rulesBytes []byte - err := badgerView(func(txn *badger.Txn) error { - item, err := txn.Get(tools.StrToByte(fmt.Sprintf("%s.%s", prefixAccount, key))) - if err != nil { - return err - } - rulesBytes, err = item.ValueCopy(nil) - if err != nil { - return err - } - return nil - }) - if err != nil { - return nil, err - } - - accountPrivacyRules := &msg.AccountPrivacyRules{} - err = accountPrivacyRules.Unmarshal(rulesBytes) - if err != nil { - return nil, err - } - return accountPrivacyRules, nil + var rulesBytes []byte + err := badgerView(func(txn *badger.Txn) error { + item, err := txn.Get(tools.StrToByte(fmt.Sprintf("%s.%s", prefixAccount, key))) + if err != nil { + return err + } + rulesBytes, err = item.ValueCopy(nil) + if err != nil { + return err + } + return nil + }) + if err != nil { + return nil, err + } + + accountPrivacyRules := &msg.AccountPrivacyRules{} + err = accountPrivacyRules.Unmarshal(rulesBytes) + if err != nil { + return nil, err + } + return accountPrivacyRules, nil } diff --git a/internal/repo/dialogs.go b/internal/repo/dialogs.go index 0d94eca0..d4ebd773 100644 --- a/internal/repo/dialogs.go +++ b/internal/repo/dialogs.go @@ -1,368 +1,369 @@ package repo import ( - "context" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" - "github.com/tidwall/buntdb" - "strings" - "sync/atomic" + "context" + "fmt" + "strings" + "sync/atomic" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" + "github.com/tidwall/buntdb" ) const ( - prefixDialogs = "DLG" - prefixPinnedDialogs = "PDLG" - indexDialogs = prefixDialogs + prefixDialogs = "DLG" + prefixPinnedDialogs = "PDLG" + indexDialogs = prefixDialogs ) type repoDialogs struct { - *repository + *repository } func getDialogKey(teamID int64, peerID int64, peerType int32) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixDialogs) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - z.AppendStrInt64(sb, peerID) - z.AppendStrInt32(sb, peerType) - id := []byte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixDialogs) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + z.AppendStrInt64(sb, peerID) + z.AppendStrInt32(sb, peerType) + id := []byte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getDialogPrefix(teamID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixDialogs) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - id := []byte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixDialogs) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + id := []byte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getPinnedDialogKey(teamID int64, peerID int64, peerType int32) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixPinnedDialogs) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - z.AppendStrInt64(sb, peerID) - z.AppendStrInt32(sb, peerType) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixPinnedDialogs) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + z.AppendStrInt64(sb, peerID) + z.AppendStrInt32(sb, peerType) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getDialogPeerFromIndexKey(key string) (int64, *msg.Peer) { - parts := strings.Split(key, ".") - if len(parts) != 4 { - return 0, nil - } - return tools.StrToInt64(parts[1]), &msg.Peer{ - ID: tools.StrToInt64(parts[2]), - Type: tools.StrToInt32(parts[3]), - } + parts := strings.Split(key, ".") + if len(parts) != 4 { + return 0, nil + } + return tools.StrToInt64(parts[1]), &msg.Peer{ + ID: tools.StrToInt64(parts[2]), + Type: tools.StrToInt32(parts[3]), + } } func saveDialog(txn *badger.Txn, dialog *msg.Dialog) error { - dialogBytes, _ := dialog.Marshal() - err := txn.SetEntry(badger.NewEntry( - getDialogKey(dialog.TeamID, dialog.PeerID, dialog.PeerType), - dialogBytes, - )) - if err != nil { - return err - } - if dialog.Pinned { - return txn.SetEntry(badger.NewEntry( - getPinnedDialogKey(dialog.TeamID, dialog.PeerID, dialog.PeerType), - dialogBytes, - )) - } else { - return txn.Delete(getPinnedDialogKey(dialog.TeamID, dialog.PeerID, dialog.PeerType)) - } + dialogBytes, _ := dialog.Marshal() + err := txn.SetEntry(badger.NewEntry( + getDialogKey(dialog.TeamID, dialog.PeerID, dialog.PeerType), + dialogBytes, + )) + if err != nil { + return err + } + if dialog.Pinned { + return txn.SetEntry(badger.NewEntry( + getPinnedDialogKey(dialog.TeamID, dialog.PeerID, dialog.PeerType), + dialogBytes, + )) + } else { + return txn.Delete(getPinnedDialogKey(dialog.TeamID, dialog.PeerID, dialog.PeerType)) + } } func getDialog(txn *badger.Txn, teamID, peerID int64, peerType int32) (*msg.Dialog, error) { - return getDialogByKey(txn, getDialogKey(teamID, peerID, peerType)) + return getDialogByKey(txn, getDialogKey(teamID, peerID, peerType)) } func getDialogByKey(txn *badger.Txn, key []byte) (*msg.Dialog, error) { - dialog := &msg.Dialog{} - item, err := txn.Get(key) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return dialog.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return dialog, nil + dialog := &msg.Dialog{} + item, err := txn.Get(key) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return dialog.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return dialog, nil } func countDialogUnread(txn *badger.Txn, teamID, peerID int64, peerType int32, userID, maxID int64) (unread, mentioned int32, err error) { - opts := badger.DefaultIteratorOptions - opts.Prefix = getMessagePrefix(teamID, peerID, peerType) - opts.Reverse = false - it := txn.NewIterator(opts) - for it.Seek(getMessageKey(teamID, peerID, peerType, maxID)); it.ValidForPrefix(opts.Prefix); it.Next() { - _ = it.Item().Value(func(val []byte) error { - userMessage := &msg.UserMessage{} - _ = userMessage.Unmarshal(val) - if userMessage.SenderID != userID { - unread++ - } - for _, entity := range userMessage.Entities { - switch { - case entity.Type == msg.MessageEntityType_MessageEntityTypeMention && entity.UserID == userID: - fallthrough - case entity.Type == msg.MessageEntityType_MessageEntityTypeMentionAll && userMessage.SenderID != userID: - mentioned++ - } - } - return nil - }) - } - it.Close() - return + opts := badger.DefaultIteratorOptions + opts.Prefix = getMessagePrefix(teamID, peerID, peerType) + opts.Reverse = false + it := txn.NewIterator(opts) + for it.Seek(getMessageKey(teamID, peerID, peerType, maxID)); it.ValidForPrefix(opts.Prefix); it.Next() { + _ = it.Item().Value(func(val []byte) error { + userMessage := &msg.UserMessage{} + _ = userMessage.Unmarshal(val) + if userMessage.SenderID != userID { + unread++ + } + for _, entity := range userMessage.Entities { + switch { + case entity.Type == msg.MessageEntityType_MessageEntityTypeMention && entity.UserID == userID: + fallthrough + case entity.Type == msg.MessageEntityType_MessageEntityTypeMentionAll && userMessage.SenderID != userID: + mentioned++ + } + } + return nil + }) + } + it.Close() + return } func updateDialogLastUpdate(teamID int64, peerID int64, peerType int32, lastUpdate int64) error { - return r.bunt.Update(func(tx *buntdb.Tx) error { - _, _, err := tx.Set( - fmt.Sprintf("%s.%d.%d.%d", indexDialogs, teamID, peerID, peerType), - fmt.Sprintf("%021d", lastUpdate), - nil, - ) - return err - }) + return r.bunt.Update(func(tx *buntdb.Tx) error { + _, _, err := tx.Set( + fmt.Sprintf("%s.%d.%d.%d", indexDialogs, teamID, peerID, peerType), + fmt.Sprintf("%021d", lastUpdate), + nil, + ) + return err + }) } func (r *repoDialogs) Get(teamID, peerID int64, peerType int32) (dialog *msg.Dialog, err error) { - err = badgerView(func(txn *badger.Txn) error { - dialog, err = getDialog(txn, teamID, peerID, peerType) - return err - }) - return + err = badgerView(func(txn *badger.Txn) error { + dialog, err = getDialog(txn, teamID, peerID, peerType) + return err + }) + return } func (r *repoDialogs) SaveNew(dialog *msg.Dialog, lastUpdate int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - err := saveDialog(txn, dialog) - if err != nil { - return err - } - return updateDialogLastUpdate(dialog.TeamID, dialog.PeerID, dialog.PeerType, lastUpdate) - }) + return badgerUpdate(func(txn *badger.Txn) error { + err := saveDialog(txn, dialog) + if err != nil { + return err + } + return updateDialogLastUpdate(dialog.TeamID, dialog.PeerID, dialog.PeerType, lastUpdate) + }) } func (r *repoDialogs) Save(dialog *msg.Dialog) error { - if dialog == nil { - return nil - } - return badgerUpdate(func(txn *badger.Txn) error { - err := saveDialog(txn, dialog) - if err != nil { - return err - } - return nil - }) + if dialog == nil { + return nil + } + return badgerUpdate(func(txn *badger.Txn) error { + err := saveDialog(txn, dialog) + if err != nil { + return err + } + return nil + }) } func (r *repoDialogs) UpdateReadInboxMaxID(userID, teamID, peerID int64, peerType int32, maxID int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - dialog, err := getDialog(txn, teamID, peerID, peerType) - if err != nil { - return err - } - // current maxID is newer so skip updating dialog unread counts - if dialog.ReadInboxMaxID > maxID || maxID > dialog.TopMessageID { - return nil - } - dialog.ReadInboxMaxID = maxID - dialog.UnreadCount, dialog.MentionedCount, err = countDialogUnread(txn, teamID, peerID, peerType, userID, maxID+1) - if err != nil { - return err - } - return saveDialog(txn, dialog) - }) + return badgerUpdate(func(txn *badger.Txn) error { + dialog, err := getDialog(txn, teamID, peerID, peerType) + if err != nil { + return err + } + // current maxID is newer so skip updating dialog unread counts + if dialog.ReadInboxMaxID > maxID || maxID > dialog.TopMessageID { + return nil + } + dialog.ReadInboxMaxID = maxID + dialog.UnreadCount, dialog.MentionedCount, err = countDialogUnread(txn, teamID, peerID, peerType, userID, maxID+1) + if err != nil { + return err + } + return saveDialog(txn, dialog) + }) } func (r *repoDialogs) UpdateReadOutboxMaxID(teamID, peerID int64, peerType int32, maxID int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - dialog, err := getDialog(txn, teamID, peerID, peerType) - if err != nil { - return err - } - // current maxID is newer so skip updating dialog unread counts - if dialog.ReadOutboxMaxID > maxID || maxID > dialog.TopMessageID { - return nil - } - dialog.ReadOutboxMaxID = maxID - return saveDialog(txn, dialog) - }) + return badgerUpdate(func(txn *badger.Txn) error { + dialog, err := getDialog(txn, teamID, peerID, peerType) + if err != nil { + return err + } + // current maxID is newer so skip updating dialog unread counts + if dialog.ReadOutboxMaxID > maxID || maxID > dialog.TopMessageID { + return nil + } + dialog.ReadOutboxMaxID = maxID + return saveDialog(txn, dialog) + }) } func (r *repoDialogs) UpdateNotifySetting(teamID, peerID int64, peerType int32, notifySettings *msg.PeerNotifySettings) error { - return badgerUpdate(func(txn *badger.Txn) error { - dialog, err := getDialog(txn, teamID, peerID, peerType) - if err != nil { - return err - } - dialog.NotifySettings = notifySettings - return saveDialog(txn, dialog) - }) + return badgerUpdate(func(txn *badger.Txn) error { + dialog, err := getDialog(txn, teamID, peerID, peerType) + if err != nil { + return err + } + dialog.NotifySettings = notifySettings + return saveDialog(txn, dialog) + }) } func (r *repoDialogs) UpdatePinned(in *msg.UpdateDialogPinned) error { - return badgerUpdate(func(txn *badger.Txn) error { - dialog, err := getDialog(txn, in.TeamID, in.Peer.ID, in.Peer.Type) - if err != nil { - return err - } - dialog.Pinned = in.Pinned - return saveDialog(txn, dialog) - }) + return badgerUpdate(func(txn *badger.Txn) error { + dialog, err := getDialog(txn, in.TeamID, in.Peer.ID, in.Peer.Type) + if err != nil { + return err + } + dialog.Pinned = in.Pinned + return saveDialog(txn, dialog) + }) } func (r *repoDialogs) UpdateCallStarted(in *msg.UpdatePhoneCallStarted) error { - return badgerUpdate(func(txn *badger.Txn) error { - dialog, err := getDialog(txn, in.TeamID, in.Peer.ID, in.Peer.Type) - if err != nil { - return err - } - dialog.ActiveCallID = in.CallId - return saveDialog(txn, dialog) - }) + return badgerUpdate(func(txn *badger.Txn) error { + dialog, err := getDialog(txn, in.TeamID, in.Peer.ID, in.Peer.Type) + if err != nil { + return err + } + dialog.ActiveCallID = in.CallId + return saveDialog(txn, dialog) + }) } func (r *repoDialogs) UpdateCallEnded(in *msg.UpdatePhoneCallEnded) error { - return badgerUpdate(func(txn *badger.Txn) error { - dialog, err := getDialog(txn, in.TeamID, in.Peer.ID, in.Peer.Type) - if err != nil { - return err - } - dialog.ActiveCallID = 0 - return saveDialog(txn, dialog) - }) + return badgerUpdate(func(txn *badger.Txn) error { + dialog, err := getDialog(txn, in.TeamID, in.Peer.ID, in.Peer.Type) + if err != nil { + return err + } + dialog.ActiveCallID = 0 + return saveDialog(txn, dialog) + }) } func (r *repoDialogs) UpdatePinMessageID(teamID int64, peerID int64, peerType int32, messageID int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - dialog, err := getDialog(txn, teamID, peerID, peerType) - if err != nil { - return err - } - dialog.PinnedMessageID = messageID - return saveDialog(txn, dialog) - }) + return badgerUpdate(func(txn *badger.Txn) error { + dialog, err := getDialog(txn, teamID, peerID, peerType) + if err != nil { + return err + } + dialog.PinnedMessageID = messageID + return saveDialog(txn, dialog) + }) } func (r *repoDialogs) Delete(teamID, peerID int64, peerType int32) error { - return badgerUpdate(func(txn *badger.Txn) error { - return txn.Delete(getDialogKey(teamID, peerID, peerType)) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return txn.Delete(getDialogKey(teamID, peerID, peerType)) + }) } func (r *repoDialogs) List(teamID int64, offset, limit int32) ([]*msg.Dialog, error) { - dialogs := make([]*msg.Dialog, 0, limit) - err := badgerView(func(txn *badger.Txn) error { - return r.bunt.View(func(tx *buntdb.Tx) error { - return tx.Descend(indexDialogs, func(key, value string) bool { - if offset--; offset >= 0 { - return true - } - if limit--; limit < 0 { - return false - } - tID, peer := getDialogPeerFromIndexKey(key) - if tID != teamID { - return true - } - dialog, err := getDialog(txn, teamID, peer.ID, peer.Type) - if err == nil && dialog != nil { - dialogs = append(dialogs, dialog) - } - return true - }) - }) - }) - if err != nil { - return nil, err - } - return dialogs, nil + dialogs := make([]*msg.Dialog, 0, limit) + err := badgerView(func(txn *badger.Txn) error { + return r.bunt.View(func(tx *buntdb.Tx) error { + return tx.Descend(indexDialogs, func(key, value string) bool { + if offset--; offset >= 0 { + return true + } + if limit--; limit < 0 { + return false + } + tID, peer := getDialogPeerFromIndexKey(key) + if tID != teamID { + return true + } + dialog, err := getDialog(txn, teamID, peer.ID, peer.Type) + if err == nil && dialog != nil { + dialogs = append(dialogs, dialog) + } + return true + }) + }) + }) + if err != nil { + return nil, err + } + return dialogs, nil } func (r *repoDialogs) CountDialogs(teamID int64) int32 { - var cnt int32 - st := r.badger.NewStream() - st.Prefix = getDialogPrefix(teamID) - st.ChooseKey = func(item *badger.Item) bool { - atomic.AddInt32(&cnt, 1) - return false - } - _ = st.Orchestrate(context.Background()) - return cnt + var cnt int32 + st := r.badger.NewStream() + st.Prefix = getDialogPrefix(teamID) + st.ChooseKey = func(item *badger.Item) bool { + atomic.AddInt32(&cnt, 1) + return false + } + _ = st.Orchestrate(context.Background()) + return cnt } func (r *repoDialogs) GetPinnedDialogs() []*msg.Dialog { - dialogs := make([]*msg.Dialog, 0, 7) - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(prefixDialogs) - opts.Reverse = true - it := txn.NewIterator(opts) - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - dialog := &msg.Dialog{} - _ = it.Item().Value(func(val []byte) error { - err := dialog.Unmarshal(val) - if err != nil { - return err - } - if dialog.Pinned { - dialogs = append(dialogs, dialog) - } - return nil - }) - } - it.Close() - return nil - }) + dialogs := make([]*msg.Dialog, 0, 7) + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(prefixDialogs) + opts.Reverse = true + it := txn.NewIterator(opts) + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + dialog := &msg.Dialog{} + _ = it.Item().Value(func(val []byte) error { + err := dialog.Unmarshal(val) + if err != nil { + return err + } + if dialog.Pinned { + dialogs = append(dialogs, dialog) + } + return nil + }) + } + it.Close() + return nil + }) - return dialogs + return dialogs } func (r *repoDialogs) CountAllUnread(userID, teamID int64, mutes bool) (unread, mentioned int32, err error) { - err = badgerView(func(txn *badger.Txn) error { - st := r.badger.NewStream() - st.Prefix = getDialogPrefix(teamID) - st.ChooseKey = func(item *badger.Item) bool { - d, err := getDialogByKey(txn, item.Key()) - if err != nil { - return false - } - u, m, err := countDialogUnread(txn, d.TeamID, d.PeerID, d.PeerType, userID, d.ReadInboxMaxID+1) - if err != nil { - return false - } - if mutes || (d.NotifySettings != nil && d.NotifySettings.MuteUntil < domain.Now().Unix()) { - atomic.AddInt32(&unread, u) - } - atomic.AddInt32(&mentioned, m) - return false - } - st.Send = func(list *badger.KVList) error { - return nil - } - return st.Orchestrate(context.Background()) - }) + err = badgerView(func(txn *badger.Txn) error { + st := r.badger.NewStream() + st.Prefix = getDialogPrefix(teamID) + st.ChooseKey = func(item *badger.Item) bool { + d, err := getDialogByKey(txn, item.Key()) + if err != nil { + return false + } + u, m, err := countDialogUnread(txn, d.TeamID, d.PeerID, d.PeerType, userID, d.ReadInboxMaxID+1) + if err != nil { + return false + } + if mutes || (d.NotifySettings != nil && d.NotifySettings.MuteUntil < domain.Now().Unix()) { + atomic.AddInt32(&unread, u) + } + atomic.AddInt32(&mentioned, m) + return false + } + st.Send = func(list *badger.KVList) error { + return nil + } + return st.Orchestrate(context.Background()) + }) - return + return } diff --git a/internal/repo/files.go b/internal/repo/files.go index 2a1e0461..430220c9 100644 --- a/internal/repo/files.go +++ b/internal/repo/files.go @@ -1,19 +1,20 @@ package repo import ( - "context" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/dgraph-io/badger/v2" - "github.com/dgraph-io/badger/v2/pb" - "github.com/ronaksoft/rony/tools" - "mime" - "os" - "path" - "path/filepath" - "strings" - "sync" + "context" + "fmt" + "mime" + "os" + "path" + "path/filepath" + "strings" + "sync" + + "github.com/dgraph-io/badger/v2" + "github.com/dgraph-io/badger/v2/pb" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony/tools" ) /* @@ -26,730 +27,730 @@ import ( */ const ( - prefixFiles = "FILES" - prefixFilesRequests = "FILES_REQ" + prefixFiles = "FILES" + prefixFilesRequests = "FILES_REQ" ) type repoFiles struct { - *repository + *repository } func getFileKey(clusterID int32, fileID int64, accessHash uint64) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%012d.%021d.%021d", prefixFiles, clusterID, fileID, accessHash)) + return tools.StrToByte(fmt.Sprintf("%s.%012d.%021d.%021d", prefixFiles, clusterID, fileID, accessHash)) } func getFile(txn *badger.Txn, clusterID int32, fileID int64, accessHash uint64) (*msg.ClientFile, error) { - file := &msg.ClientFile{} - item, err := txn.Get(getFileKey(clusterID, fileID, accessHash)) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return file.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return file, nil + file := &msg.ClientFile{} + item, err := txn.Get(getFileKey(clusterID, fileID, accessHash)) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return file.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return file, nil } func saveFile(txn *badger.Txn, file *msg.ClientFile) error { - fileBytes, _ := file.Marshal() - return txn.SetEntry(badger.NewEntry( - getFileKey(file.ClusterID, file.FileID, file.AccessHash), - fileBytes, - )) + fileBytes, _ := file.Marshal() + return txn.SetEntry(badger.NewEntry( + getFileKey(file.ClusterID, file.FileID, file.AccessHash), + fileBytes, + )) } func saveUserPhotos(txn *badger.Txn, userID int64, photos ...*msg.UserPhoto) error { - for _, photo := range photos { - if photo == nil { - continue - } - if photo.PhotoBig != nil { - err := saveFile(txn, &msg.ClientFile{ - ClusterID: photo.PhotoBig.ClusterID, - FileID: photo.PhotoBig.FileID, - AccessHash: photo.PhotoBig.AccessHash, - Type: msg.ClientFileType_AccountProfilePhoto, - MimeType: "", - UserID: userID, - GroupID: 0, - FileSize: 0, - MessageID: 0, - PeerID: userID, - PeerType: int32(msg.PeerType_PeerUser), - Version: 0, - }) - if err != nil { - return err - } - } - if photo.PhotoSmall != nil { - err := saveFile(txn, &msg.ClientFile{ - ClusterID: photo.PhotoSmall.ClusterID, - FileID: photo.PhotoSmall.FileID, - AccessHash: photo.PhotoSmall.AccessHash, - Type: msg.ClientFileType_Thumbnail, - MimeType: "", - UserID: userID, - GroupID: 0, - FileSize: 0, - MessageID: 0, - PeerID: userID, - PeerType: int32(msg.PeerType_PeerUser), - Version: 0, - }) - if err != nil { - return err - } - } - - bytes, _ := photo.Marshal() - err := txn.SetEntry(badger.NewEntry(getUserPhotoGalleryKey(userID, photo.PhotoID), bytes)) - if err != nil { - return err - } - } - return nil + for _, photo := range photos { + if photo == nil { + continue + } + if photo.PhotoBig != nil { + err := saveFile(txn, &msg.ClientFile{ + ClusterID: photo.PhotoBig.ClusterID, + FileID: photo.PhotoBig.FileID, + AccessHash: photo.PhotoBig.AccessHash, + Type: msg.ClientFileType_AccountProfilePhoto, + MimeType: "", + UserID: userID, + GroupID: 0, + FileSize: 0, + MessageID: 0, + PeerID: userID, + PeerType: int32(msg.PeerType_PeerUser), + Version: 0, + }) + if err != nil { + return err + } + } + if photo.PhotoSmall != nil { + err := saveFile(txn, &msg.ClientFile{ + ClusterID: photo.PhotoSmall.ClusterID, + FileID: photo.PhotoSmall.FileID, + AccessHash: photo.PhotoSmall.AccessHash, + Type: msg.ClientFileType_Thumbnail, + MimeType: "", + UserID: userID, + GroupID: 0, + FileSize: 0, + MessageID: 0, + PeerID: userID, + PeerType: int32(msg.PeerType_PeerUser), + Version: 0, + }) + if err != nil { + return err + } + } + + bytes, _ := photo.Marshal() + err := txn.SetEntry(badger.NewEntry(getUserPhotoGalleryKey(userID, photo.PhotoID), bytes)) + if err != nil { + return err + } + } + return nil } func deleteAllUserPhotos(txn *badger.Txn, userID int64) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getUserPhotoGalleryPrefix(userID) - it := txn.NewIterator(opts) - for it.Rewind(); it.Valid(); it.Next() { - _ = txn.Delete(it.Item().KeyCopy(nil)) - } - it.Close() - return nil + opts := badger.DefaultIteratorOptions + opts.Prefix = getUserPhotoGalleryPrefix(userID) + it := txn.NewIterator(opts) + for it.Rewind(); it.Valid(); it.Next() { + _ = txn.Delete(it.Item().KeyCopy(nil)) + } + it.Close() + return nil } func saveGroupPhotos(txn *badger.Txn, groupID int64, photos ...*msg.GroupPhoto) error { - for _, photo := range photos { - if photo != nil { - if photo.PhotoBig != nil { - err := saveFile(txn, &msg.ClientFile{ - ClusterID: photo.PhotoBig.ClusterID, - FileID: photo.PhotoBig.FileID, - AccessHash: photo.PhotoBig.AccessHash, - Type: msg.ClientFileType_GroupProfilePhoto, - MimeType: "", - UserID: 0, - GroupID: groupID, - FileSize: 0, - MessageID: 0, - PeerID: groupID, - PeerType: int32(msg.PeerType_PeerGroup), - Version: 0, - }) - if err != nil { - return err - } - } - if photo.PhotoSmall != nil { - err := saveFile(txn, &msg.ClientFile{ - ClusterID: photo.PhotoSmall.ClusterID, - FileID: photo.PhotoSmall.FileID, - AccessHash: photo.PhotoSmall.AccessHash, - Type: msg.ClientFileType_Thumbnail, - MimeType: "", - UserID: 0, - GroupID: groupID, - FileSize: 0, - MessageID: 0, - PeerID: groupID, - PeerType: int32(msg.PeerType_PeerGroup), - Version: 0, - }) - if err != nil { - return err - } - } - bytes, _ := photo.Marshal() - err := txn.SetEntry(badger.NewEntry(getGroupPhotoGalleryKey(groupID, photo.PhotoID), bytes)) - if err != nil { - return err - } - } - } - return nil + for _, photo := range photos { + if photo != nil { + if photo.PhotoBig != nil { + err := saveFile(txn, &msg.ClientFile{ + ClusterID: photo.PhotoBig.ClusterID, + FileID: photo.PhotoBig.FileID, + AccessHash: photo.PhotoBig.AccessHash, + Type: msg.ClientFileType_GroupProfilePhoto, + MimeType: "", + UserID: 0, + GroupID: groupID, + FileSize: 0, + MessageID: 0, + PeerID: groupID, + PeerType: int32(msg.PeerType_PeerGroup), + Version: 0, + }) + if err != nil { + return err + } + } + if photo.PhotoSmall != nil { + err := saveFile(txn, &msg.ClientFile{ + ClusterID: photo.PhotoSmall.ClusterID, + FileID: photo.PhotoSmall.FileID, + AccessHash: photo.PhotoSmall.AccessHash, + Type: msg.ClientFileType_Thumbnail, + MimeType: "", + UserID: 0, + GroupID: groupID, + FileSize: 0, + MessageID: 0, + PeerID: groupID, + PeerType: int32(msg.PeerType_PeerGroup), + Version: 0, + }) + if err != nil { + return err + } + } + bytes, _ := photo.Marshal() + err := txn.SetEntry(badger.NewEntry(getGroupPhotoGalleryKey(groupID, photo.PhotoID), bytes)) + if err != nil { + return err + } + } + } + return nil } func saveMessageMedia(txn *badger.Txn, m *msg.UserMessage) error { - switch m.MediaType { - case msg.MediaType_MediaTypeDocument: - md := new(msg.MediaDocument) - err := md.Unmarshal(m.Media) - if err != nil { - return err - } - - fileExt := "" - for _, attr := range md.Doc.Attributes { - if attr.Type == msg.DocumentAttributeType_AttributeTypeFile { - x := &msg.DocumentAttributeFile{} - _ = x.Unmarshal(attr.Data) - fileExt = filepath.Ext(x.Filename) - } - } - - err = saveFile(txn, &msg.ClientFile{ - ClusterID: md.Doc.ClusterID, - FileID: md.Doc.ID, - AccessHash: md.Doc.AccessHash, - Type: msg.ClientFileType_Message, - MimeType: md.Doc.MimeType, - Extension: fileExt, - UserID: 0, - GroupID: 0, - FileSize: int64(md.Doc.FileSize), - MessageID: m.ID, - PeerID: m.PeerID, - PeerType: m.PeerType, - Version: md.Doc.Version, - MD5Checksum: md.Doc.MD5Checksum, - Attributes: md.Doc.Attributes, - }) - if err != nil { - return err - } - - if md.Doc.Thumbnail != nil { - err = saveFile(txn, &msg.ClientFile{ - ClusterID: md.Doc.Thumbnail.ClusterID, - FileID: md.Doc.Thumbnail.FileID, - AccessHash: md.Doc.Thumbnail.AccessHash, - Type: msg.ClientFileType_Thumbnail, - MimeType: "jpeg", - UserID: 0, - GroupID: 0, - FileSize: 0, - MessageID: m.ID, - PeerID: m.PeerID, - PeerType: m.PeerType, - Version: 0, - }) - return err - } - } - return nil + switch m.MediaType { + case msg.MediaType_MediaTypeDocument: + md := new(msg.MediaDocument) + err := md.Unmarshal(m.Media) + if err != nil { + return err + } + + fileExt := "" + for _, attr := range md.Doc.Attributes { + if attr.Type == msg.DocumentAttributeType_AttributeTypeFile { + x := &msg.DocumentAttributeFile{} + _ = x.Unmarshal(attr.Data) + fileExt = filepath.Ext(x.Filename) + } + } + + err = saveFile(txn, &msg.ClientFile{ + ClusterID: md.Doc.ClusterID, + FileID: md.Doc.ID, + AccessHash: md.Doc.AccessHash, + Type: msg.ClientFileType_Message, + MimeType: md.Doc.MimeType, + Extension: fileExt, + UserID: 0, + GroupID: 0, + FileSize: int64(md.Doc.FileSize), + MessageID: m.ID, + PeerID: m.PeerID, + PeerType: m.PeerType, + Version: md.Doc.Version, + MD5Checksum: md.Doc.MD5Checksum, + Attributes: md.Doc.Attributes, + }) + if err != nil { + return err + } + + if md.Doc.Thumbnail != nil { + err = saveFile(txn, &msg.ClientFile{ + ClusterID: md.Doc.Thumbnail.ClusterID, + FileID: md.Doc.Thumbnail.FileID, + AccessHash: md.Doc.Thumbnail.AccessHash, + Type: msg.ClientFileType_Thumbnail, + MimeType: "jpeg", + UserID: 0, + GroupID: 0, + FileSize: 0, + MessageID: m.ID, + PeerID: m.PeerID, + PeerType: m.PeerType, + Version: 0, + }) + return err + } + } + return nil } func (r *repoFiles) SaveMessageMediaDocument(md *msg.MediaDocument) error { - return badgerUpdate(func(txn *badger.Txn) error { - return r.saveMessageMediaDocument(txn, md) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return r.saveMessageMediaDocument(txn, md) + }) } func (r *repoFiles) saveMessageMediaDocument(txn *badger.Txn, md *msg.MediaDocument) error { - fileExt := "" - for _, attr := range md.Doc.Attributes { - if attr.Type == msg.DocumentAttributeType_AttributeTypeFile { - x := &msg.DocumentAttributeFile{} - _ = x.Unmarshal(attr.Data) - fileExt = filepath.Ext(x.Filename) - } - } - - err := saveFile(txn, &msg.ClientFile{ - ClusterID: md.Doc.ClusterID, - FileID: md.Doc.ID, - AccessHash: md.Doc.AccessHash, - Type: msg.ClientFileType_Message, - MimeType: md.Doc.MimeType, - Extension: fileExt, - UserID: 0, - GroupID: 0, - FileSize: int64(md.Doc.FileSize), - Version: md.Doc.Version, - MD5Checksum: md.Doc.MD5Checksum, - Attributes: md.Doc.Attributes, - }) - if err != nil { - return err - } - - if md.Doc.Thumbnail != nil { - err = saveFile(txn, &msg.ClientFile{ - ClusterID: md.Doc.Thumbnail.ClusterID, - FileID: md.Doc.Thumbnail.FileID, - AccessHash: md.Doc.Thumbnail.AccessHash, - Type: msg.ClientFileType_Thumbnail, - MimeType: "jpeg", - UserID: 0, - GroupID: 0, - FileSize: 0, - Version: 0, - }) - return err - } - return nil + fileExt := "" + for _, attr := range md.Doc.Attributes { + if attr.Type == msg.DocumentAttributeType_AttributeTypeFile { + x := &msg.DocumentAttributeFile{} + _ = x.Unmarshal(attr.Data) + fileExt = filepath.Ext(x.Filename) + } + } + + err := saveFile(txn, &msg.ClientFile{ + ClusterID: md.Doc.ClusterID, + FileID: md.Doc.ID, + AccessHash: md.Doc.AccessHash, + Type: msg.ClientFileType_Message, + MimeType: md.Doc.MimeType, + Extension: fileExt, + UserID: 0, + GroupID: 0, + FileSize: int64(md.Doc.FileSize), + Version: md.Doc.Version, + MD5Checksum: md.Doc.MD5Checksum, + Attributes: md.Doc.Attributes, + }) + if err != nil { + return err + } + + if md.Doc.Thumbnail != nil { + err = saveFile(txn, &msg.ClientFile{ + ClusterID: md.Doc.Thumbnail.ClusterID, + FileID: md.Doc.Thumbnail.FileID, + AccessHash: md.Doc.Thumbnail.AccessHash, + Type: msg.ClientFileType_Thumbnail, + MimeType: "jpeg", + UserID: 0, + GroupID: 0, + FileSize: 0, + Version: 0, + }) + return err + } + return nil } func (r *repoFiles) SaveWallpaper(txn *badger.Txn, wallpaper *msg.WallPaper) error { - if wallpaper.Document == nil { - return nil - } - - fileExt := "" - for _, attr := range wallpaper.Document.Attributes { - if attr.Type == msg.DocumentAttributeType_AttributeTypeFile { - x := &msg.DocumentAttributeFile{} - _ = x.Unmarshal(attr.Data) - fileExt = filepath.Ext(x.Filename) - } - } - - err := saveFile(txn, &msg.ClientFile{ - ClusterID: wallpaper.Document.ClusterID, - FileID: wallpaper.Document.ID, - AccessHash: wallpaper.Document.AccessHash, - Type: msg.ClientFileType_Wallpaper, - MimeType: wallpaper.Document.MimeType, - Extension: fileExt, - UserID: 0, - GroupID: 0, - FileSize: int64(wallpaper.Document.FileSize), - WallpaperID: wallpaper.ID, - Version: wallpaper.Document.Version, - MD5Checksum: wallpaper.Document.MD5Checksum, - }) - - if err != nil { - return err - } - - if wallpaper.Document.Thumbnail != nil { - err = saveFile(txn, &msg.ClientFile{ - ClusterID: wallpaper.Document.Thumbnail.ClusterID, - FileID: wallpaper.Document.Thumbnail.FileID, - AccessHash: wallpaper.Document.Thumbnail.AccessHash, - Type: msg.ClientFileType_Thumbnail, - MimeType: "jpeg", - UserID: 0, - GroupID: 0, - FileSize: 0, - WallpaperID: wallpaper.ID, - Version: 0, - }) - return err - } - - return nil + if wallpaper.Document == nil { + return nil + } + + fileExt := "" + for _, attr := range wallpaper.Document.Attributes { + if attr.Type == msg.DocumentAttributeType_AttributeTypeFile { + x := &msg.DocumentAttributeFile{} + _ = x.Unmarshal(attr.Data) + fileExt = filepath.Ext(x.Filename) + } + } + + err := saveFile(txn, &msg.ClientFile{ + ClusterID: wallpaper.Document.ClusterID, + FileID: wallpaper.Document.ID, + AccessHash: wallpaper.Document.AccessHash, + Type: msg.ClientFileType_Wallpaper, + MimeType: wallpaper.Document.MimeType, + Extension: fileExt, + UserID: 0, + GroupID: 0, + FileSize: int64(wallpaper.Document.FileSize), + WallpaperID: wallpaper.ID, + Version: wallpaper.Document.Version, + MD5Checksum: wallpaper.Document.MD5Checksum, + }) + + if err != nil { + return err + } + + if wallpaper.Document.Thumbnail != nil { + err = saveFile(txn, &msg.ClientFile{ + ClusterID: wallpaper.Document.Thumbnail.ClusterID, + FileID: wallpaper.Document.Thumbnail.FileID, + AccessHash: wallpaper.Document.Thumbnail.AccessHash, + Type: msg.ClientFileType_Thumbnail, + MimeType: "jpeg", + UserID: 0, + GroupID: 0, + FileSize: 0, + WallpaperID: wallpaper.ID, + Version: 0, + }) + return err + } + + return nil } func (r *repoFiles) SaveGif(mediaDocument *msg.MediaDocument) error { - if mediaDocument == nil || mediaDocument.Doc == nil { - return nil - } - - fileExt := "" - for _, attr := range mediaDocument.Doc.Attributes { - if attr.Type == msg.DocumentAttributeType_AttributeTypeFile { - x := &msg.DocumentAttributeFile{} - _ = x.Unmarshal(attr.Data) - fileExt = filepath.Ext(x.Filename) - } - } - - err := badgerUpdate(func(txn *badger.Txn) error { - err := saveFile(txn, &msg.ClientFile{ - ClusterID: mediaDocument.Doc.ClusterID, - FileID: mediaDocument.Doc.ID, - AccessHash: mediaDocument.Doc.AccessHash, - Type: msg.ClientFileType_Gif, - MimeType: mediaDocument.Doc.MimeType, - Extension: fileExt, - UserID: 0, - GroupID: 0, - FileSize: int64(mediaDocument.Doc.FileSize), - WallpaperID: 0, - Version: mediaDocument.Doc.Version, - MD5Checksum: mediaDocument.Doc.MD5Checksum, - }) - - if err != nil { - return err - } - - if mediaDocument.Doc.Thumbnail != nil { - err = saveFile(txn, &msg.ClientFile{ - ClusterID: mediaDocument.Doc.Thumbnail.ClusterID, - FileID: mediaDocument.Doc.Thumbnail.FileID, - AccessHash: mediaDocument.Doc.Thumbnail.AccessHash, - Type: msg.ClientFileType_Thumbnail, - MimeType: "jpeg", - UserID: 0, - GroupID: 0, - FileSize: 0, - WallpaperID: 0, - Version: 0, - }) - return err - } - - return nil - }) - - return err + if mediaDocument == nil || mediaDocument.Doc == nil { + return nil + } + + fileExt := "" + for _, attr := range mediaDocument.Doc.Attributes { + if attr.Type == msg.DocumentAttributeType_AttributeTypeFile { + x := &msg.DocumentAttributeFile{} + _ = x.Unmarshal(attr.Data) + fileExt = filepath.Ext(x.Filename) + } + } + + err := badgerUpdate(func(txn *badger.Txn) error { + err := saveFile(txn, &msg.ClientFile{ + ClusterID: mediaDocument.Doc.ClusterID, + FileID: mediaDocument.Doc.ID, + AccessHash: mediaDocument.Doc.AccessHash, + Type: msg.ClientFileType_Gif, + MimeType: mediaDocument.Doc.MimeType, + Extension: fileExt, + UserID: 0, + GroupID: 0, + FileSize: int64(mediaDocument.Doc.FileSize), + WallpaperID: 0, + Version: mediaDocument.Doc.Version, + MD5Checksum: mediaDocument.Doc.MD5Checksum, + }) + + if err != nil { + return err + } + + if mediaDocument.Doc.Thumbnail != nil { + err = saveFile(txn, &msg.ClientFile{ + ClusterID: mediaDocument.Doc.Thumbnail.ClusterID, + FileID: mediaDocument.Doc.Thumbnail.FileID, + AccessHash: mediaDocument.Doc.Thumbnail.AccessHash, + Type: msg.ClientFileType_Thumbnail, + MimeType: "jpeg", + UserID: 0, + GroupID: 0, + FileSize: 0, + WallpaperID: 0, + Version: 0, + }) + return err + } + + return nil + }) + + return err } func (r *repoFiles) Get(clusterID int32, fileID int64, accessHash uint64) (file *msg.ClientFile, err error) { - err = badgerView(func(txn *badger.Txn) error { - file, err = getFile(txn, clusterID, fileID, accessHash) - return err - }) - return + err = badgerView(func(txn *badger.Txn) error { + file, err = getFile(txn, clusterID, fileID, accessHash) + return err + }) + return } func (r *repoFiles) GetMediaDocument(m *msg.UserMessage) (*msg.ClientFile, error) { - md := &msg.MediaDocument{} - _ = md.Unmarshal(m.Media) - return r.Get(md.Doc.ClusterID, md.Doc.ID, md.Doc.AccessHash) + md := &msg.MediaDocument{} + _ = md.Unmarshal(m.Media) + return r.Get(md.Doc.ClusterID, md.Doc.ID, md.Doc.AccessHash) } func (r *repoFiles) Save(file *msg.ClientFile) error { - if file == nil { - return nil - } - return badgerUpdate(func(txn *badger.Txn) error { - return saveFile(txn, file) - }) + if file == nil { + return nil + } + return badgerUpdate(func(txn *badger.Txn) error { + return saveFile(txn, file) + }) } func (r *repoFiles) Delete(clusterID int32, fileID int64, accessHash uint64) error { - return badgerUpdate(func(txn *badger.Txn) error { - return txn.Delete(getFileKey(clusterID, fileID, accessHash)) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return txn.Delete(getFileKey(clusterID, fileID, accessHash)) + }) } func (r *repoFiles) GetCachedMedia(teamID int64) *msg.ClientCachedMediaInfo { - userMediaInfo := make(map[int64]map[msg.ClientMediaType]int64, 128) - groupMediaInfo := make(map[int64]map[msg.ClientMediaType]int64, 128) - userMtx := sync.Mutex{} - groupMtx := sync.Mutex{} - - stream := r.badger.NewStream() - stream.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixMessages)) - stream.ChooseKey = func(item *badger.Item) bool { - m := &msg.UserMessage{} - err := item.Value(func(val []byte) error { - return m.Unmarshal(val) - }) - if err != nil { - return false - } - if m.TeamID != teamID { - return false - } - switch m.MediaType { - case msg.MediaType_MediaTypeDocument: - d := msg.MediaDocument{} - err = d.Unmarshal(m.Media) - if err != nil { - return false - } - - f, err := r.Get(d.Doc.ClusterID, d.Doc.ID, d.Doc.AccessHash) - if err != nil { - return false - } else if _, err = os.Stat(r.GetFilePath(f)); os.IsNotExist(err) { - return false - } - - switch msg.PeerType(m.PeerType) { - case msg.PeerType_PeerUser: - userMtx.Lock() - if _, ok := userMediaInfo[m.PeerID]; !ok { - userMediaInfo[m.PeerID] = make(map[msg.ClientMediaType]int64, 5) - } - userMediaInfo[m.PeerID][msg.ClientMediaType(item.UserMeta())] += int64(d.Doc.FileSize) - userMtx.Unlock() - case msg.PeerType_PeerGroup: - groupMtx.Lock() - if _, ok := groupMediaInfo[m.PeerID]; !ok { - groupMediaInfo[m.PeerID] = make(map[msg.ClientMediaType]int64, 5) - } - groupMediaInfo[m.PeerID][msg.ClientMediaType(item.UserMeta())] += int64(d.Doc.FileSize) - - groupMtx.Unlock() - } - default: - return false - } - return true - } - stream.Send = func(list *pb.KVList) error { - return nil - } - - _ = stream.Orchestrate(context.Background()) - - cachedMediaInfo := &msg.ClientCachedMediaInfo{} - for peerID, mi := range userMediaInfo { - peerInfo := &msg.ClientPeerMediaInfo{ - PeerID: peerID, - PeerType: msg.PeerType_PeerUser, - } - for mType, mSize := range mi { - peerInfo.Media = append(peerInfo.Media, &msg.ClientMediaSize{ - MediaType: mType, - TotalSize: mSize, - }) - } - cachedMediaInfo.MediaInfo = append(cachedMediaInfo.MediaInfo, peerInfo) - } - for peerID, mi := range groupMediaInfo { - peerInfo := &msg.ClientPeerMediaInfo{ - PeerID: peerID, - PeerType: msg.PeerType_PeerGroup, - } - for mType, mSize := range mi { - peerInfo.Media = append(peerInfo.Media, &msg.ClientMediaSize{ - MediaType: mType, - TotalSize: mSize, - }) - } - cachedMediaInfo.MediaInfo = append(cachedMediaInfo.MediaInfo, peerInfo) - } - return cachedMediaInfo + userMediaInfo := make(map[int64]map[msg.ClientMediaType]int64, 128) + groupMediaInfo := make(map[int64]map[msg.ClientMediaType]int64, 128) + userMtx := sync.Mutex{} + groupMtx := sync.Mutex{} + + stream := r.badger.NewStream() + stream.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixMessages)) + stream.ChooseKey = func(item *badger.Item) bool { + m := &msg.UserMessage{} + err := item.Value(func(val []byte) error { + return m.Unmarshal(val) + }) + if err != nil { + return false + } + if m.TeamID != teamID { + return false + } + switch m.MediaType { + case msg.MediaType_MediaTypeDocument: + d := msg.MediaDocument{} + err = d.Unmarshal(m.Media) + if err != nil { + return false + } + + f, err := r.Get(d.Doc.ClusterID, d.Doc.ID, d.Doc.AccessHash) + if err != nil { + return false + } else if _, err = os.Stat(r.GetFilePath(f)); os.IsNotExist(err) { + return false + } + + switch msg.PeerType(m.PeerType) { + case msg.PeerType_PeerUser: + userMtx.Lock() + if _, ok := userMediaInfo[m.PeerID]; !ok { + userMediaInfo[m.PeerID] = make(map[msg.ClientMediaType]int64, 5) + } + userMediaInfo[m.PeerID][msg.ClientMediaType(item.UserMeta())] += int64(d.Doc.FileSize) + userMtx.Unlock() + case msg.PeerType_PeerGroup: + groupMtx.Lock() + if _, ok := groupMediaInfo[m.PeerID]; !ok { + groupMediaInfo[m.PeerID] = make(map[msg.ClientMediaType]int64, 5) + } + groupMediaInfo[m.PeerID][msg.ClientMediaType(item.UserMeta())] += int64(d.Doc.FileSize) + + groupMtx.Unlock() + } + default: + return false + } + return true + } + stream.Send = func(list *pb.KVList) error { + return nil + } + + _ = stream.Orchestrate(context.Background()) + + cachedMediaInfo := &msg.ClientCachedMediaInfo{} + for peerID, mi := range userMediaInfo { + peerInfo := &msg.ClientPeerMediaInfo{ + PeerID: peerID, + PeerType: msg.PeerType_PeerUser, + } + for mType, mSize := range mi { + peerInfo.Media = append(peerInfo.Media, &msg.ClientMediaSize{ + MediaType: mType, + TotalSize: mSize, + }) + } + cachedMediaInfo.MediaInfo = append(cachedMediaInfo.MediaInfo, peerInfo) + } + for peerID, mi := range groupMediaInfo { + peerInfo := &msg.ClientPeerMediaInfo{ + PeerID: peerID, + PeerType: msg.PeerType_PeerGroup, + } + for mType, mSize := range mi { + peerInfo.Media = append(peerInfo.Media, &msg.ClientMediaSize{ + MediaType: mType, + TotalSize: mSize, + }) + } + cachedMediaInfo.MediaInfo = append(cachedMediaInfo.MediaInfo, peerInfo) + } + return cachedMediaInfo } func (r *repoFiles) DeleteCachedMediaByPeer(teamID, peerID int64, peerType int32, mediaTypes []msg.ClientMediaType) { - stream := r.badger.NewStream() - - stream.Prefix = getMessagePrefix(teamID, peerID, peerType) - stream.ChooseKey = func(item *badger.Item) bool { - m := &msg.UserMessage{} - err := item.Value(func(val []byte) error { - return m.Unmarshal(val) - }) - if err != nil { - return false - } - switch m.MediaType { - case msg.MediaType_MediaTypeDocument: - d := msg.MediaDocument{} - err = d.Unmarshal(m.Media) - if err != nil { - return false - } - for _, mt := range mediaTypes { - if msg.ClientMediaType(item.UserMeta()) == mt { - f, err := r.Get(d.Doc.ClusterID, d.Doc.ID, d.Doc.AccessHash) - if err != nil { - return false - } - _ = os.Remove(r.GetFilePath(f)) - return true - } - } - - default: - return false - } - return true - } - stream.Send = func(list *pb.KVList) error { - return nil - } - - _ = stream.Orchestrate(context.Background()) + stream := r.badger.NewStream() + + stream.Prefix = getMessagePrefix(teamID, peerID, peerType) + stream.ChooseKey = func(item *badger.Item) bool { + m := &msg.UserMessage{} + err := item.Value(func(val []byte) error { + return m.Unmarshal(val) + }) + if err != nil { + return false + } + switch m.MediaType { + case msg.MediaType_MediaTypeDocument: + d := msg.MediaDocument{} + err = d.Unmarshal(m.Media) + if err != nil { + return false + } + for _, mt := range mediaTypes { + if msg.ClientMediaType(item.UserMeta()) == mt { + f, err := r.Get(d.Doc.ClusterID, d.Doc.ID, d.Doc.AccessHash) + if err != nil { + return false + } + _ = os.Remove(r.GetFilePath(f)) + return true + } + } + + default: + return false + } + return true + } + stream.Send = func(list *pb.KVList) error { + return nil + } + + _ = stream.Orchestrate(context.Background()) } func (r *repoFiles) DeleteCachedMediaByMediaType(teamID int64, mediaTypes []msg.ClientMediaType) { - stream := r.badger.NewStream() - - stream.Prefix = []byte(fmt.Sprintf("%s.", prefixMessages)) - stream.ChooseKey = func(item *badger.Item) bool { - m := &msg.UserMessage{} - err := item.Value(func(val []byte) error { - return m.Unmarshal(val) - }) - if err != nil { - return false - } - if m.TeamID != teamID { - return false - } - switch m.MediaType { - case msg.MediaType_MediaTypeDocument: - d := msg.MediaDocument{} - err = d.Unmarshal(m.Media) - if err != nil { - return false - } - for _, mt := range mediaTypes { - if msg.ClientMediaType(item.UserMeta()) == mt { - f, err := r.Get(d.Doc.ClusterID, d.Doc.ID, d.Doc.AccessHash) - if err != nil { - return false - } - _ = os.Remove(r.GetFilePath(f)) - return true - } - } - - default: - return false - } - return true - } - stream.Send = func(list *pb.KVList) error { - return nil - } - - _ = stream.Orchestrate(context.Background()) + stream := r.badger.NewStream() + + stream.Prefix = []byte(fmt.Sprintf("%s.", prefixMessages)) + stream.ChooseKey = func(item *badger.Item) bool { + m := &msg.UserMessage{} + err := item.Value(func(val []byte) error { + return m.Unmarshal(val) + }) + if err != nil { + return false + } + if m.TeamID != teamID { + return false + } + switch m.MediaType { + case msg.MediaType_MediaTypeDocument: + d := msg.MediaDocument{} + err = d.Unmarshal(m.Media) + if err != nil { + return false + } + for _, mt := range mediaTypes { + if msg.ClientMediaType(item.UserMeta()) == mt { + f, err := r.Get(d.Doc.ClusterID, d.Doc.ID, d.Doc.AccessHash) + if err != nil { + return false + } + _ = os.Remove(r.GetFilePath(f)) + return true + } + } + + default: + return false + } + return true + } + stream.Send = func(list *pb.KVList) error { + return nil + } + + _ = stream.Orchestrate(context.Background()) } func (r *repoFiles) ClearCache() { - dirs := []string{ - DirAudio, DirFile, DirPhoto, DirVideo, DirCache, - } - for _, dir := range dirs { - _ = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { - if info.IsDir() { - return nil - } - _ = os.Remove(path) - return nil - }) - } + dirs := []string{ + DirAudio, DirFile, DirPhoto, DirVideo, DirCache, + } + for _, dir := range dirs { + _ = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if info.IsDir() { + return nil + } + _ = os.Remove(path) + return nil + }) + } } func (r *repoFiles) GetFilePath(clientFile *msg.ClientFile) string { - switch clientFile.Type { - case msg.ClientFileType_Gif: - fallthrough - case msg.ClientFileType_Message: - return getMessageFilePath(clientFile.MimeType, clientFile.FileID, clientFile.Extension) - case msg.ClientFileType_AccountProfilePhoto: - return getAccountProfilePath(clientFile.UserID, clientFile.FileID) - case msg.ClientFileType_GroupProfilePhoto: - return getGroupProfilePath(clientFile.GroupID, clientFile.FileID) - case msg.ClientFileType_Thumbnail: - return getThumbnailPath(clientFile.FileID, clientFile.ClusterID) - case msg.ClientFileType_Wallpaper: - return getWallpaperPath(clientFile.FileID, clientFile.ClusterID) - } - return "" + switch clientFile.Type { + case msg.ClientFileType_Gif: + fallthrough + case msg.ClientFileType_Message: + return getMessageFilePath(clientFile.MimeType, clientFile.FileID, clientFile.Extension) + case msg.ClientFileType_AccountProfilePhoto: + return getAccountProfilePath(clientFile.UserID, clientFile.FileID) + case msg.ClientFileType_GroupProfilePhoto: + return getGroupProfilePath(clientFile.GroupID, clientFile.FileID) + case msg.ClientFileType_Thumbnail: + return getThumbnailPath(clientFile.FileID, clientFile.ClusterID) + case msg.ClientFileType_Wallpaper: + return getWallpaperPath(clientFile.FileID, clientFile.ClusterID) + } + return "" } func getMessageFilePath(mimeType string, docID int64, ext string) string { - mimeType = strings.ToLower(mimeType) - if ext == "" { - exts, _ := mime.ExtensionsByType(mimeType) - if len(exts) > 0 { - ext = exts[len(exts)-1] - } - } - - // if the file is opus type, - // means its voice file so it should be saved in cache folder - // so user could not access to it by file manager - switch { - case mimeType == "audio/ogg": - ext = ".ogg" - return path.Join(DirCache, fmt.Sprintf("%d%s", docID, ext)) - case strings.HasPrefix(mimeType, "video/"): - return path.Join(DirVideo, fmt.Sprintf("%d%s", docID, ext)) - case strings.HasPrefix(mimeType, "audio/"): - return path.Join(DirAudio, fmt.Sprintf("%d%s", docID, ext)) - case strings.HasPrefix(mimeType, "image/"): - return path.Join(DirPhoto, fmt.Sprintf("%d%s", docID, ext)) - default: - return path.Join(DirFile, fmt.Sprintf("%d%s", docID, ext)) - } + mimeType = strings.ToLower(mimeType) + if ext == "" { + exts, _ := mime.ExtensionsByType(mimeType) + if len(exts) > 0 { + ext = exts[len(exts)-1] + } + } + + // if the file is opus type, + // means its voice file so it should be saved in cache folder + // so user could not access to it by file manager + switch { + case mimeType == "audio/ogg": + ext = ".ogg" + return path.Join(DirCache, fmt.Sprintf("%d%s", docID, ext)) + case strings.HasPrefix(mimeType, "video/"): + return path.Join(DirVideo, fmt.Sprintf("%d%s", docID, ext)) + case strings.HasPrefix(mimeType, "audio/"): + return path.Join(DirAudio, fmt.Sprintf("%d%s", docID, ext)) + case strings.HasPrefix(mimeType, "image/"): + return path.Join(DirPhoto, fmt.Sprintf("%d%s", docID, ext)) + default: + return path.Join(DirFile, fmt.Sprintf("%d%s", docID, ext)) + } } func getThumbnailPath(fileID int64, clusterID int32) string { - return path.Join(DirCache, fmt.Sprintf("%d%d%s", fileID, clusterID, ".jpg")) + return path.Join(DirCache, fmt.Sprintf("%d%d%s", fileID, clusterID, ".jpg")) } func getWallpaperPath(fileID int64, clusterID int32) string { - return path.Join(DirPhoto, fmt.Sprintf("%s_%d%d%s", "Wallpaper", fileID, clusterID, ".jpg")) + return path.Join(DirPhoto, fmt.Sprintf("%s_%d%d%s", "Wallpaper", fileID, clusterID, ".jpg")) } func getAccountProfilePath(userID int64, fileID int64) string { - return path.Join(DirCache, fmt.Sprintf("u%d_%d%s", userID, fileID, ".jpg")) + return path.Join(DirCache, fmt.Sprintf("u%d_%d%s", userID, fileID, ".jpg")) } func getGroupProfilePath(groupID int64, fileID int64) string { - return path.Join(DirCache, fmt.Sprintf("g%d_%d%s", groupID, fileID, ".jpg")) + return path.Join(DirCache, fmt.Sprintf("g%d_%d%s", groupID, fileID, ".jpg")) } func (r *repoFiles) SaveFileRequest(reqID string, req *msg.ClientFileRequest, overwriteOnly bool) (bool, error) { - var saved bool - err := badgerUpdate(func(txn *badger.Txn) error { - key := tools.StrToByte(fmt.Sprintf("%s.%s", prefixFilesRequests, reqID)) - if overwriteOnly { - _, err := txn.Get(key) - if err != nil { - return nil - } - } - reqBytes, _ := req.Marshal() - err := txn.Set(key, reqBytes) - if err != nil { - return err - } - saved = true - return nil - }) - return saved, err + var saved bool + err := badgerUpdate(func(txn *badger.Txn) error { + key := tools.StrToByte(fmt.Sprintf("%s.%s", prefixFilesRequests, reqID)) + if overwriteOnly { + _, err := txn.Get(key) + if err != nil { + return nil + } + } + reqBytes, _ := req.Marshal() + err := txn.Set(key, reqBytes) + if err != nil { + return err + } + saved = true + return nil + }) + return saved, err } func (r *repoFiles) DeleteFileRequest(reqID string) error { - return badgerUpdate(func(txn *badger.Txn) error { - return txn.Delete( - tools.StrToByte(fmt.Sprintf("%s.%s", prefixFilesRequests, reqID)), - ) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return txn.Delete( + tools.StrToByte(fmt.Sprintf("%s.%s", prefixFilesRequests, reqID)), + ) + }) } func (r *repoFiles) GetFileRequest(reqID string) (*msg.ClientFileRequest, error) { - req := &msg.ClientFileRequest{} - err := badgerView(func(txn *badger.Txn) error { - item, err := txn.Get( - tools.StrToByte(fmt.Sprintf("%s.%s", prefixFilesRequests, reqID)), - ) - switch err { - case nil: - case badger.ErrKeyNotFound: - return domain.ErrNotFound - default: - return err - - } - return item.Value(func(val []byte) error { - return req.Unmarshal(val) - }) - }) - return req, err + req := &msg.ClientFileRequest{} + err := badgerView(func(txn *badger.Txn) error { + item, err := txn.Get( + tools.StrToByte(fmt.Sprintf("%s.%s", prefixFilesRequests, reqID)), + ) + switch err { + case nil: + case badger.ErrKeyNotFound: + return domain.ErrNotFound + default: + return err + + } + return item.Value(func(val []byte) error { + return req.Unmarshal(val) + }) + }) + return req, err } func (r *repoFiles) GetAllFileRequests() ([]*msg.ClientFileRequest, error) { - reqs := make([]*msg.ClientFileRequest, 0, 8) - st := r.badger.NewStream() - st.Prefix = tools.StrToByte(prefixFilesRequests) - st.ChooseKey = func(item *badger.Item) bool { - return true - } - st.Send = func(list *badger.KVList) error { - for _, kv := range list.Kv { - req := &msg.ClientFileRequest{} - err := req.Unmarshal(kv.Value) - if err != nil { - return err - } - reqs = append(reqs, req) - } - return nil - } - err := st.Orchestrate(context.Background()) - if err != nil { - return nil, err - } - return reqs, nil + reqs := make([]*msg.ClientFileRequest, 0, 8) + st := r.badger.NewStream() + st.Prefix = tools.StrToByte(prefixFilesRequests) + st.ChooseKey = func(item *badger.Item) bool { + return true + } + st.Send = func(list *badger.KVList) error { + for _, kv := range list.Kv { + req := &msg.ClientFileRequest{} + err := req.Unmarshal(kv.Value) + if err != nil { + return err + } + reqs = append(reqs, req) + } + return nil + } + err := st.Orchestrate(context.Background()) + if err != nil { + return nil, err + } + return reqs, nil } diff --git a/internal/repo/gif.go b/internal/repo/gif.go index a7621aa9..1ecd1416 100644 --- a/internal/repo/gif.go +++ b/internal/repo/gif.go @@ -1,12 +1,13 @@ package repo import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/tools" - "github.com/tidwall/buntdb" - "strings" + "fmt" + "strings" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/rony/tools" + "github.com/tidwall/buntdb" ) /* @@ -19,141 +20,141 @@ import ( */ const ( - prefixGif = "GIF" - indexGif = "GIF" + prefixGif = "GIF" + indexGif = "GIF" ) type repoGifs struct { - *repository + *repository } func getGifKey(clusterID int32, docID int64) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%012d.%021d", prefixGif, clusterID, docID)) + return tools.StrToByte(fmt.Sprintf("%s.%012d.%021d", prefixGif, clusterID, docID)) } func getGifByID(txn *badger.Txn, clusterID int32, docID int64) (*msg.MediaDocument, error) { - return getGifByKey(txn, getGifKey(clusterID, docID)) + return getGifByKey(txn, getGifKey(clusterID, docID)) } func getGifByKey(txn *badger.Txn, key []byte) (*msg.MediaDocument, error) { - md := &msg.MediaDocument{} - item, err := txn.Get(key) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return md.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return md, nil + md := &msg.MediaDocument{} + item, err := txn.Get(key) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return md.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return md, nil } func getGifFromIndexKey(key string) (clusterID int32, docID int64) { - parts := strings.Split(key, ".") - if len(parts) != 3 { - return 0, 0 - } - return tools.StrToInt32(parts[1]), tools.StrToInt64(parts[2]) + parts := strings.Split(key, ".") + if len(parts) != 3 { + return 0, 0 + } + return tools.StrToInt32(parts[1]), tools.StrToInt64(parts[2]) } func saveGif(txn *badger.Txn, md *msg.MediaDocument) error { - mdBytes, _ := md.Marshal() - err := txn.SetEntry(badger.NewEntry( - getGifKey(md.Doc.ClusterID, md.Doc.ID), - mdBytes, - )) - return err + mdBytes, _ := md.Marshal() + err := txn.SetEntry(badger.NewEntry( + getGifKey(md.Doc.ClusterID, md.Doc.ID), + mdBytes, + )) + return err } func deleteGif(txn *badger.Txn, clusterID int32, docID int64) error { - return txn.Delete(getGifKey(clusterID, docID)) + return txn.Delete(getGifKey(clusterID, docID)) } func (r *repoGifs) UpdateLastAccess(clusterID int32, docID int64, accessTime int64) error { - if !r.IsSaved(clusterID, docID) { - return nil - } - return r.bunt.Update(func(tx *buntdb.Tx) error { - _, _, err := tx.Set( - fmt.Sprintf("%s.%d.%d", indexGif, clusterID, docID), - fmt.Sprintf("%021d", accessTime), - nil, - ) - return err - }) + if !r.IsSaved(clusterID, docID) { + return nil + } + return r.bunt.Update(func(tx *buntdb.Tx) error { + _, _, err := tx.Set( + fmt.Sprintf("%s.%d.%d", indexGif, clusterID, docID), + fmt.Sprintf("%021d", accessTime), + nil, + ) + return err + }) } func (r *repoGifs) Get(clusterID int32, docID int64) (gif *msg.MediaDocument, err error) { - err = badgerView(func(txn *badger.Txn) error { - gif, err = getGifByID(txn, clusterID, docID) - return err - }) - return + err = badgerView(func(txn *badger.Txn) error { + gif, err = getGifByID(txn, clusterID, docID) + return err + }) + return } func (r *repoGifs) IsSaved(clusterID int32, docID int64) (found bool) { - _ = badgerView(func(txn *badger.Txn) error { - _, err := getGifByID(txn, clusterID, docID) - switch err { - case nil: - found = true - return nil - case badger.ErrKeyNotFound: - found = false - return nil - } - return err - }) - return + _ = badgerView(func(txn *badger.Txn) error { + _, err := getGifByID(txn, clusterID, docID) + switch err { + case nil: + found = true + return nil + case badger.ErrKeyNotFound: + found = false + return nil + } + return err + }) + return } func (r *repoGifs) Save(cf *msg.MediaDocument) error { - return badgerUpdate(func(txn *badger.Txn) error { - return saveGif(txn, cf) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return saveGif(txn, cf) + }) } func (r *repoGifs) GetSaved() (*msg.SavedGifs, error) { - savedGifs := make([]*msg.MediaDocument, 0, 20) - err := badgerView(func(txn *badger.Txn) error { - return r.bunt.View(func(tx *buntdb.Tx) error { - return tx.Descend(indexGif, func(key, value string) bool { - clusterID, docID := getGifFromIndexKey(key) - if clusterID == 0 || docID == 0 { - return true - } - md, err := getGifByID(txn, clusterID, docID) - if err != nil { - return false - } - savedGifs = append(savedGifs, md) - return true - }) - }) - }) - - if err != nil { - return nil, err - } - return &msg.SavedGifs{ - Docs: savedGifs, - NotModified: false, - }, nil + savedGifs := make([]*msg.MediaDocument, 0, 20) + err := badgerView(func(txn *badger.Txn) error { + return r.bunt.View(func(tx *buntdb.Tx) error { + return tx.Descend(indexGif, func(key, value string) bool { + clusterID, docID := getGifFromIndexKey(key) + if clusterID == 0 || docID == 0 { + return true + } + md, err := getGifByID(txn, clusterID, docID) + if err != nil { + return false + } + savedGifs = append(savedGifs, md) + return true + }) + }) + }) + + if err != nil { + return nil, err + } + return &msg.SavedGifs{ + Docs: savedGifs, + NotModified: false, + }, nil } func (r *repoGifs) Delete(clusterID int32, docID int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - err := deleteGif(txn, clusterID, docID) - switch err { - case nil, badger.ErrKeyNotFound: - default: - return err - } - return r.bunt.Update(func(tx *buntdb.Tx) error { - _, err := tx.Delete(fmt.Sprintf("%s.%d.%d", indexGif, clusterID, docID)) - return err - }) - }) + return badgerUpdate(func(txn *badger.Txn) error { + err := deleteGif(txn, clusterID, docID) + switch err { + case nil, badger.ErrKeyNotFound: + default: + return err + } + return r.bunt.Update(func(tx *buntdb.Tx) error { + _, err := tx.Delete(fmt.Sprintf("%s.%d.%d", indexGif, clusterID, docID)) + return err + }) + }) } diff --git a/internal/repo/gif_test.go b/internal/repo/gif_test.go index 80a883db..86df9c09 100644 --- a/internal/repo/gif_test.go +++ b/internal/repo/gif_test.go @@ -1,11 +1,12 @@ package repo_test import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - . "github.com/smartystreets/goconvey/convey" - "testing" + "testing" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + . "github.com/smartystreets/goconvey/convey" ) /* @@ -18,34 +19,34 @@ import ( */ func TestGif(t *testing.T) { - Convey("Testing GIFs", t, func(c C) { - Convey("Save GIF", func(c C) { - for i := 0; i < 10; i++ { - clusterID := int32(domain.RandomInt64(100)) - docID := domain.RandomInt64(0) - doc := &msg.Document{ - ID: docID, - ClusterID: clusterID, - AccessHash: 100, - FileSize: 0, - } - md := &msg.MediaDocument{ - Doc: doc, - Caption: "", - TTLinSeconds: 0, - } - err := repo.Gifs.Save(md) - c.So(err, ShouldBeNil) - err = repo.Gifs.UpdateLastAccess(clusterID, docID, domain.Now().Unix()) - c.So(err, ShouldBeNil) - found := repo.Gifs.IsSaved(clusterID, docID) - c.So(found, ShouldBeTrue) - } + Convey("Testing GIFs", t, func(c C) { + Convey("Save GIF", func(c C) { + for i := 0; i < 10; i++ { + clusterID := int32(domain.RandomInt64(100)) + docID := domain.RandomInt64(0) + doc := &msg.Document{ + ID: docID, + ClusterID: clusterID, + AccessHash: 100, + FileSize: 0, + } + md := &msg.MediaDocument{ + Doc: doc, + Caption: "", + TTLinSeconds: 0, + } + err := repo.Gifs.Save(md) + c.So(err, ShouldBeNil) + err = repo.Gifs.UpdateLastAccess(clusterID, docID, domain.Now().Unix()) + c.So(err, ShouldBeNil) + found := repo.Gifs.IsSaved(clusterID, docID) + c.So(found, ShouldBeTrue) + } - savedGifs, err := repo.Gifs.GetSaved() - c.So(err, ShouldBeNil) - c.So(len(savedGifs.Docs), ShouldBeGreaterThan, 0) - }) + savedGifs, err := repo.Gifs.GetSaved() + c.So(err, ShouldBeNil) + c.So(len(savedGifs.Docs), ShouldBeGreaterThan, 0) + }) - }) + }) } diff --git a/internal/repo/groups.go b/internal/repo/groups.go index 0e88ac55..092b8734 100644 --- a/internal/repo/groups.go +++ b/internal/repo/groups.go @@ -1,532 +1,533 @@ package repo import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/search/query" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" - "strings" - "time" + "fmt" + "strings" + "time" + + "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/search/query" + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) const ( - prefixGroups = "GRP" - prefixGroupsFull = "GRP_F" - prefixGroupsParticipants = "GRP_P" - prefixGroupsPhotoGallery = "GRP_PHG" + prefixGroups = "GRP" + prefixGroupsFull = "GRP_F" + prefixGroupsParticipants = "GRP_P" + prefixGroupsPhotoGallery = "GRP_PHG" ) type repoGroups struct { - *repository + *repository } func getGroupKey(groupID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixGroups) - sb.WriteRune('.') - z.AppendStrInt64(sb, groupID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixGroups) + sb.WriteRune('.') + z.AppendStrInt64(sb, groupID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getGroupFullKey(groupID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixGroupsFull) - sb.WriteRune('.') - z.AppendStrInt64(sb, groupID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixGroupsFull) + sb.WriteRune('.') + z.AppendStrInt64(sb, groupID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getGroupByKey(txn *badger.Txn, groupKey []byte) (*msg.Group, error) { - group := &msg.Group{} - item, err := txn.Get(groupKey) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return group.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return group, nil + group := &msg.Group{} + item, err := txn.Get(groupKey) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return group.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return group, nil } func getGroupFullByKey(txn *badger.Txn, groupFullKey []byte) (*msg.GroupFull, error) { - groupFull := &msg.GroupFull{} - item, err := txn.Get(groupFullKey) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return groupFull.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return groupFull, nil + groupFull := &msg.GroupFull{} + item, err := txn.Get(groupFullKey) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return groupFull.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return groupFull, nil } func getGroupParticipantKey(groupID, memberID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixGroupsParticipants) - sb.WriteRune('.') - z.AppendStrInt64(sb, groupID) - z.AppendStrInt64(sb, memberID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixGroupsParticipants) + sb.WriteRune('.') + z.AppendStrInt64(sb, groupID) + z.AppendStrInt64(sb, memberID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getGroupPhotoGalleryKey(groupID, photoID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixGroupsPhotoGallery) - sb.WriteRune('.') - z.AppendStrInt64(sb, groupID) - z.AppendStrInt64(sb, photoID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixGroupsPhotoGallery) + sb.WriteRune('.') + z.AppendStrInt64(sb, groupID) + z.AppendStrInt64(sb, photoID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getGroupPhotoGalleryPrefix(groupID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixGroupsPhotoGallery) - sb.WriteRune('.') - z.AppendStrInt64(sb, groupID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixGroupsPhotoGallery) + sb.WriteRune('.') + z.AppendStrInt64(sb, groupID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func saveGroup(txn *badger.Txn, group *msg.Group) error { - groupKey := getGroupKey(group.ID) - groupBytes, _ := group.Marshal() - err := txn.SetEntry(badger.NewEntry( - groupKey, groupBytes, - )) - if err != nil { - return err - } - - indexPeer( - tools.ByteToStr(groupKey), - GroupSearch{ - Type: "group", - Title: group.Title, - PeerID: group.ID, - TeamID: fmt.Sprintf("%d", group.TeamID), - }, - ) - - err = saveGroupPhotos(txn, group.ID, group.Photo) - if err != nil { - return err - } - - groupFull, _ := getGroupFullByKey(txn, getGroupFullKey(group.ID)) - if groupFull != nil { - groupFull.Group = group - err = saveGroupFull(txn, groupFull) - if err != nil { - return err - } - } - - return nil + groupKey := getGroupKey(group.ID) + groupBytes, _ := group.Marshal() + err := txn.SetEntry(badger.NewEntry( + groupKey, groupBytes, + )) + if err != nil { + return err + } + + indexPeer( + tools.ByteToStr(groupKey), + GroupSearch{ + Type: "group", + Title: group.Title, + PeerID: group.ID, + TeamID: fmt.Sprintf("%d", group.TeamID), + }, + ) + + err = saveGroupPhotos(txn, group.ID, group.Photo) + if err != nil { + return err + } + + groupFull, _ := getGroupFullByKey(txn, getGroupFullKey(group.ID)) + if groupFull != nil { + groupFull.Group = group + err = saveGroupFull(txn, groupFull) + if err != nil { + return err + } + } + + return nil } func saveGroupFull(txn *badger.Txn, groupFull *msg.GroupFull) error { - groupKey := getGroupFullKey(groupFull.Group.ID) - groupBytes, _ := groupFull.Marshal() - err := txn.SetEntry(badger.NewEntry( - groupKey, groupBytes, - )) - if err != nil { - return err - } - - indexPeer( - tools.ByteToStr(groupKey), - GroupSearch{ - Type: "group", - Title: groupFull.Group.Title, - PeerID: groupFull.Group.ID, - TeamID: fmt.Sprintf("%d", groupFull.Group.TeamID), - }, - ) - - err = saveGroupPhotos(txn, groupFull.Group.ID, groupFull.Group.Photo) - if err != nil { - return err - } - return nil + groupKey := getGroupFullKey(groupFull.Group.ID) + groupBytes, _ := groupFull.Marshal() + err := txn.SetEntry(badger.NewEntry( + groupKey, groupBytes, + )) + if err != nil { + return err + } + + indexPeer( + tools.ByteToStr(groupKey), + GroupSearch{ + Type: "group", + Title: groupFull.Group.Title, + PeerID: groupFull.Group.ID, + TeamID: fmt.Sprintf("%d", groupFull.Group.TeamID), + }, + ) + + err = saveGroupPhotos(txn, groupFull.Group.ID, groupFull.Group.Photo) + if err != nil { + return err + } + return nil } func removeGroupPhotoGallery(txn *badger.Txn, groupID int64, photoIDs ...int64) error { - for _, photoID := range photoIDs { - err := txn.Delete(getGroupPhotoGalleryKey(groupID, photoID)) - if err != nil && err != badger.ErrKeyNotFound { - return err - } - } - return nil + for _, photoID := range photoIDs { + err := txn.Delete(getGroupPhotoGalleryKey(groupID, photoID)) + if err != nil && err != badger.ErrKeyNotFound { + return err + } + } + return nil } func (r *repoGroups) Save(groups ...*msg.Group) error { - groupIDs := domain.MInt64B{} - for _, v := range groups { - groupIDs[v.ID] = true - } - - return badgerUpdate(func(txn *badger.Txn) error { - for _, group := range groups { - err := saveGroup(txn, group) - if err != nil { - return err - } - } - return nil - }) + groupIDs := domain.MInt64B{} + for _, v := range groups { + groupIDs[v.ID] = true + } + + return badgerUpdate(func(txn *badger.Txn) error { + for _, group := range groups { + err := saveGroup(txn, group) + if err != nil { + return err + } + } + return nil + }) } func (r *repoGroups) SaveFull(group *msg.GroupFull) error { - return badgerUpdate(func(txn *badger.Txn) error { - return saveGroupFull(txn, group) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return saveGroupFull(txn, group) + }) } func (r *repoGroups) GetMany(groupIDs []int64) ([]*msg.Group, error) { - groups := make([]*msg.Group, 0, len(groupIDs)) - err := badgerView(func(txn *badger.Txn) error { - for _, groupID := range groupIDs { - if groupID == 0 { - continue - } - group, err := getGroupByKey(txn, getGroupKey(groupID)) - switch err { - case nil, badger.ErrKeyNotFound: - default: - return err - } - if group != nil { - groups = append(groups, group) - } - } - return nil - }) - return groups, err + groups := make([]*msg.Group, 0, len(groupIDs)) + err := badgerView(func(txn *badger.Txn) error { + for _, groupID := range groupIDs { + if groupID == 0 { + continue + } + group, err := getGroupByKey(txn, getGroupKey(groupID)) + switch err { + case nil, badger.ErrKeyNotFound: + default: + return err + } + if group != nil { + groups = append(groups, group) + } + } + return nil + }) + return groups, err } func (r *repoGroups) Get(groupID int64) (group *msg.Group, err error) { - err = badgerView(func(txn *badger.Txn) error { - group, err = getGroupByKey(txn, getGroupKey(groupID)) - if err != nil { - return err - } - return nil - }) - return + err = badgerView(func(txn *badger.Txn) error { + group, err = getGroupByKey(txn, getGroupKey(groupID)) + if err != nil { + return err + } + return nil + }) + return } func (r *repoGroups) GetFull(groupID int64) (groupFull *msg.GroupFull, err error) { - err = badgerView(func(txn *badger.Txn) error { - groupFull, err = getGroupFullByKey(txn, getGroupFullKey(groupID)) - return err - }) - return + err = badgerView(func(txn *badger.Txn) error { + groupFull, err = getGroupFullByKey(txn, getGroupFullKey(groupID)) + return err + }) + return } func (r *repoGroups) AddParticipant(groupID int64, p *msg.GroupParticipant) error { - return badgerUpdate(func(txn *badger.Txn) error { - groupFull, err := getGroupFullByKey(txn, getGroupFullKey(groupID)) - if err != nil { - return err - } - groupFull.Participants = append(groupFull.Participants, p) - groupFull.Group.Participants = int32(len(groupFull.Participants)) - - err = saveGroupFull(txn, groupFull) - if err != nil { - return err - } - - return saveGroup(txn, groupFull.Group) - }) + return badgerUpdate(func(txn *badger.Txn) error { + groupFull, err := getGroupFullByKey(txn, getGroupFullKey(groupID)) + if err != nil { + return err + } + groupFull.Participants = append(groupFull.Participants, p) + groupFull.Group.Participants = int32(len(groupFull.Participants)) + + err = saveGroupFull(txn, groupFull) + if err != nil { + return err + } + + return saveGroup(txn, groupFull.Group) + }) } func (r *repoGroups) RemoveParticipant(groupID int64, UserIDs ...int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - groupFull, err := getGroupFullByKey(txn, getGroupFullKey(groupID)) - if err != nil { - return err - } - pm := make(map[int64]*msg.GroupParticipant, len(groupFull.Participants)) - for _, p := range groupFull.Participants { - pm[p.UserID] = p - } - for _, userID := range UserIDs { - delete(pm, userID) - } - - groupFull.Participants = groupFull.Participants[:0] - for _, p := range pm { - groupFull.Participants = append(groupFull.Participants, p) - } - groupFull.Group.Participants = int32(len(groupFull.Participants)) - err = saveGroupFull(txn, groupFull) - if err != nil { - return err - } - - return saveGroup(txn, groupFull.Group) - }) + return badgerUpdate(func(txn *badger.Txn) error { + groupFull, err := getGroupFullByKey(txn, getGroupFullKey(groupID)) + if err != nil { + return err + } + pm := make(map[int64]*msg.GroupParticipant, len(groupFull.Participants)) + for _, p := range groupFull.Participants { + pm[p.UserID] = p + } + for _, userID := range UserIDs { + delete(pm, userID) + } + + groupFull.Participants = groupFull.Participants[:0] + for _, p := range pm { + groupFull.Participants = append(groupFull.Participants, p) + } + groupFull.Group.Participants = int32(len(groupFull.Participants)) + err = saveGroupFull(txn, groupFull) + if err != nil { + return err + } + + return saveGroup(txn, groupFull.Group) + }) } func (r *repoGroups) Delete(groupID int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - err := txn.Delete(getGroupKey(groupID)) - switch err { - case nil, badger.ErrKeyNotFound: - default: - return err - } - err = txn.Delete(getGroupFullKey(groupID)) - switch err { - case nil, badger.ErrKeyNotFound: - default: - return err - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + err := txn.Delete(getGroupKey(groupID)) + switch err { + case nil, badger.ErrKeyNotFound: + default: + return err + } + err = txn.Delete(getGroupFullKey(groupID)) + switch err { + case nil, badger.ErrKeyNotFound: + default: + return err + } + return nil + }) } func (r *repoGroups) UpdatePhoto(groupID int64, groupPhoto *msg.GroupPhoto) error { - return badgerUpdate(func(txn *badger.Txn) error { - group, err := getGroupByKey(txn, getGroupKey(groupID)) - if err != nil { - return err - } - group.Photo = groupPhoto - return saveGroup(txn, group) - }) + return badgerUpdate(func(txn *badger.Txn) error { + group, err := getGroupByKey(txn, getGroupKey(groupID)) + if err != nil { + return err + } + group.Photo = groupPhoto + return saveGroup(txn, group) + }) } func (r *repoGroups) RemovePhoto(groupID int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - group, err := getGroupByKey(txn, getGroupKey(groupID)) - if err != nil { - return err - } - group.Photo = nil - - err = removeGroupPhotoGallery(txn, groupID, group.Photo.PhotoID) - if err != nil { - return err - } - return saveGroup(txn, group) - }) + return badgerUpdate(func(txn *badger.Txn) error { + group, err := getGroupByKey(txn, getGroupKey(groupID)) + if err != nil { + return err + } + group.Photo = nil + + err = removeGroupPhotoGallery(txn, groupID, group.Photo.PhotoID) + if err != nil { + return err + } + return saveGroup(txn, group) + }) } func (r *repoGroups) SavePhotoGallery(groupID int64, photos ...*msg.GroupPhoto) error { - return badgerUpdate(func(txn *badger.Txn) error { - return saveGroupPhotos(txn, groupID, photos...) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return saveGroupPhotos(txn, groupID, photos...) + }) } func (r *repoGroups) RemovePhotoGallery(groupID int64, photoIDs ...int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - return removeGroupPhotoGallery(txn, groupID, photoIDs...) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return removeGroupPhotoGallery(txn, groupID, photoIDs...) + }) } func (r *repoGroups) GetPhotoGallery(groupID int64) ([]*msg.GroupPhoto, error) { - photos := make([]*msg.GroupPhoto, 0, 5) - err := badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getGroupPhotoGalleryPrefix(groupID) - it := txn.NewIterator(opts) - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - _ = it.Item().Value(func(val []byte) error { - groupPhoto := new(msg.GroupPhoto) - err := groupPhoto.Unmarshal(val) - if err != nil { - return err - } - photos = append(photos, groupPhoto) - return nil - }) - } - it.Close() - return nil - }) - return photos, err + photos := make([]*msg.GroupPhoto, 0, 5) + err := badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getGroupPhotoGalleryPrefix(groupID) + it := txn.NewIterator(opts) + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + _ = it.Item().Value(func(val []byte) error { + groupPhoto := new(msg.GroupPhoto) + err := groupPhoto.Unmarshal(val) + if err != nil { + return err + } + photos = append(photos, groupPhoto) + return nil + }) + } + it.Close() + return nil + }) + return photos, err } func (r *repoGroups) UpdateTitle(groupID int64, title string) error { - return badgerUpdate(func(txn *badger.Txn) error { - group, err := getGroupByKey(txn, getGroupKey(groupID)) - if err != nil { - return err - } - group.Title = title - return saveGroup(txn, group) - }) + return badgerUpdate(func(txn *badger.Txn) error { + group, err := getGroupByKey(txn, getGroupKey(groupID)) + if err != nil { + return err + } + group.Title = title + return saveGroup(txn, group) + }) } func (r *repoGroups) UpdateMemberType(groupID, userID int64, isAdmin bool) error { - return badgerUpdate(func(txn *badger.Txn) error { - group, err := getGroupByKey(txn, getGroupKey(groupID)) - if err != nil { - return err - } - flags := make([]msg.GroupFlags, 0, len(group.Flags)) - for _, f := range group.Flags { - if f != msg.GroupFlags_GroupFlagsAdmin { - flags = append(flags, f) - } - } - gp := new(msg.GroupParticipant) - item, err := txn.Get(getGroupParticipantKey(groupID, userID)) - if err != nil { - return err - } - err = item.Value(func(val []byte) error { - return gp.Unmarshal(val) - }) - if err != nil { - return err - } - if isAdmin { - flags = append(flags, msg.GroupFlags_GroupFlagsAdmin) - gp.Type = msg.ParticipantType_ParticipantTypeAdmin - } else { - gp.Type = msg.ParticipantType_ParticipantTypeMember - } - group.Flags = flags - groupParticipantKey := getGroupParticipantKey(groupID, gp.UserID) - participantBytes, _ := gp.Marshal() - err = txn.SetEntry(badger.NewEntry( - groupParticipantKey, participantBytes, - )) - if err != nil { - return err - } - - return saveGroup(txn, group) - }) + return badgerUpdate(func(txn *badger.Txn) error { + group, err := getGroupByKey(txn, getGroupKey(groupID)) + if err != nil { + return err + } + flags := make([]msg.GroupFlags, 0, len(group.Flags)) + for _, f := range group.Flags { + if f != msg.GroupFlags_GroupFlagsAdmin { + flags = append(flags, f) + } + } + gp := new(msg.GroupParticipant) + item, err := txn.Get(getGroupParticipantKey(groupID, userID)) + if err != nil { + return err + } + err = item.Value(func(val []byte) error { + return gp.Unmarshal(val) + }) + if err != nil { + return err + } + if isAdmin { + flags = append(flags, msg.GroupFlags_GroupFlagsAdmin) + gp.Type = msg.ParticipantType_ParticipantTypeAdmin + } else { + gp.Type = msg.ParticipantType_ParticipantTypeMember + } + group.Flags = flags + groupParticipantKey := getGroupParticipantKey(groupID, gp.UserID) + participantBytes, _ := gp.Marshal() + err = txn.SetEntry(badger.NewEntry( + groupParticipantKey, participantBytes, + )) + if err != nil { + return err + } + + return saveGroup(txn, group) + }) } func (r *repoGroups) ToggleAdmins(groupID int64, adminEnable bool) error { - return badgerUpdate(func(txn *badger.Txn) error { - group, err := getGroupByKey(txn, getGroupKey(groupID)) - if err != nil { - return err - } - - if adminEnable { - for _, f := range group.Flags { - if f == msg.GroupFlags_GroupFlagsAdminsEnabled { - return nil - } - } - group.Flags = append(group.Flags, msg.GroupFlags_GroupFlagsAdminsEnabled) - } else { - for idx, f := range group.Flags { - if f == msg.GroupFlags_GroupFlagsAdminsEnabled { - group.Flags[idx] = group.Flags[len(group.Flags)-1] - group.Flags = group.Flags[:len(group.Flags)-1] - } - } - } - - return saveGroup(txn, group) - }) + return badgerUpdate(func(txn *badger.Txn) error { + group, err := getGroupByKey(txn, getGroupKey(groupID)) + if err != nil { + return err + } + + if adminEnable { + for _, f := range group.Flags { + if f == msg.GroupFlags_GroupFlagsAdminsEnabled { + return nil + } + } + group.Flags = append(group.Flags, msg.GroupFlags_GroupFlagsAdminsEnabled) + } else { + for idx, f := range group.Flags { + if f == msg.GroupFlags_GroupFlagsAdminsEnabled { + group.Flags[idx] = group.Flags[len(group.Flags)-1] + group.Flags = group.Flags[:len(group.Flags)-1] + } + } + } + + return saveGroup(txn, group) + }) } func (r *repoGroups) Search(teamID int64, searchPhrase string) []*msg.Group { - groups := make([]*msg.Group, 0, 100) - if r.peerSearch == nil { - return groups - } - t1 := bleve.NewTermQuery("group") - t1.SetField("type") - terms := strings.Fields(searchPhrase) - qs := make([]query.Query, 0) - for _, term := range terms { - qs = append(qs, bleve.NewPrefixQuery(term), bleve.NewMatchQuery(term), bleve.NewFuzzyQuery(term)) - } - t2 := bleve.NewDisjunctionQuery(qs...) - t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) - t3.SetField("team_id") - searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3)) - searchResult, _ := r.peerSearch.Search(searchRequest) - _ = badgerView(func(txn *badger.Txn) error { - for _, hit := range searchResult.Hits { - group, _ := getGroupByKey(txn, tools.StrToByte(hit.ID)) - if group != nil { - groups = append(groups, group) - } - } - return nil - }) - - return groups + groups := make([]*msg.Group, 0, 100) + if r.peerSearch == nil { + return groups + } + t1 := bleve.NewTermQuery("group") + t1.SetField("type") + terms := strings.Fields(searchPhrase) + qs := make([]query.Query, 0) + for _, term := range terms { + qs = append(qs, bleve.NewPrefixQuery(term), bleve.NewMatchQuery(term), bleve.NewFuzzyQuery(term)) + } + t2 := bleve.NewDisjunctionQuery(qs...) + t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) + t3.SetField("team_id") + searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3)) + searchResult, _ := r.peerSearch.Search(searchRequest) + _ = badgerView(func(txn *badger.Txn) error { + for _, hit := range searchResult.Hits { + group, _ := getGroupByKey(txn, tools.StrToByte(hit.ID)) + if group != nil { + groups = append(groups, group) + } + } + return nil + }) + + return groups } func (r *repoGroups) ReIndex() error { - err := tools.Try(10, time.Second, func() error { - if r.peerSearch == nil { - return domain.ErrDoesNotExists - } - return nil - }) - if err != nil { - return err - } - return badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(prefixGroups) - it := txn.NewIterator(opts) - for it.Rewind(); it.Valid(); it.Next() { - _ = it.Item().Value(func(val []byte) error { - group := new(msg.Group) - _ = group.Unmarshal(val) - groupKey := tools.ByteToStr(getGroupKey(group.ID)) - if d, _ := r.peerSearch.Document(groupKey); d == nil { - indexPeer( - groupKey, - GroupSearch{ - Type: "group", - Title: group.Title, - PeerID: group.ID, - TeamID: fmt.Sprintf("%d", group.TeamID), - }, - ) - } - return nil - }) - } - it.Close() - return nil - }) + err := tools.Try(10, time.Second, func() error { + if r.peerSearch == nil { + return domain.ErrDoesNotExists + } + return nil + }) + if err != nil { + return err + } + return badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(prefixGroups) + it := txn.NewIterator(opts) + for it.Rewind(); it.Valid(); it.Next() { + _ = it.Item().Value(func(val []byte) error { + group := new(msg.Group) + _ = group.Unmarshal(val) + groupKey := tools.ByteToStr(getGroupKey(group.ID)) + if d, _ := r.peerSearch.Document(groupKey); d == nil { + indexPeer( + groupKey, + GroupSearch{ + Type: "group", + Title: group.Title, + PeerID: group.ID, + TeamID: fmt.Sprintf("%d", group.TeamID), + }, + ) + } + return nil + }) + } + it.Close() + return nil + }) } func (r *repoGroups) HasFlag(flags []msg.GroupFlags, flag msg.GroupFlags) bool { - for _, f := range flags { - if f == flag { - return true - } - } - return false + for _, f := range flags { + if f == flag { + return true + } + } + return false } diff --git a/internal/repo/labels.go b/internal/repo/labels.go index b2cc3750..796984f9 100644 --- a/internal/repo/labels.go +++ b/internal/repo/labels.go @@ -1,18 +1,19 @@ package repo import ( - "context" - "encoding/binary" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/dgraph-io/badger/v2" - "github.com/dgraph-io/badger/v2/pb" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" - "sort" - "strings" + "context" + "encoding/binary" + "fmt" + "sort" + "strings" + + "github.com/dgraph-io/badger/v2" + "github.com/dgraph-io/badger/v2/pb" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) /* @@ -25,500 +26,502 @@ import ( */ const ( - prefixLabel = "LBLL" - prefixLabelMessages = "LBLM" - prefixLabelFill = "LBLF" - prefixLabelCount = "LBLC" + prefixLabel = "LBLL" + prefixLabelMessages = "LBLM" + prefixLabelFill = "LBLF" + prefixLabelCount = "LBLC" ) type repoLabels struct { - *repository + *repository } func getLabelKey(labelID int32) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixLabel) - sb.WriteRune('.') - z.AppendStrInt32(sb, labelID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixLabel) + sb.WriteRune('.') + z.AppendStrInt32(sb, labelID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getLabelCountKey(teamID int64, labelID int32) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixLabelCount) - sb.WriteRune('.') - z.AppendStrInt32(sb, labelID) - z.AppendStrInt64(sb, teamID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixLabelCount) + sb.WriteRune('.') + z.AppendStrInt32(sb, labelID) + z.AppendStrInt64(sb, teamID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getLabelCountPrefix(labelID int32) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixLabelCount) - sb.WriteRune('.') - z.AppendStrInt32(sb, labelID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixLabelCount) + sb.WriteRune('.') + z.AppendStrInt32(sb, labelID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getLabelMessageKey(labelID int32, msgID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixLabelMessages) - sb.WriteRune('.') - z.AppendStrInt32(sb, labelID) - z.AppendStrInt64(sb, msgID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixLabelMessages) + sb.WriteRune('.') + z.AppendStrInt32(sb, labelID) + z.AppendStrInt64(sb, msgID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getLabelMessagePrefix(labelID int32) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixLabelMessages) - sb.WriteRune('.') - z.AppendStrInt32(sb, labelID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixLabelMessages) + sb.WriteRune('.') + z.AppendStrInt32(sb, labelID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getLabelByID(txn *badger.Txn, teamID int64, labelID int32) (*msg.Label, error) { - l, err := getLabelByKey(txn, getLabelKey(labelID)) - if err != nil { - return nil, err - } - l.Count = getLabelCount(txn, teamID, labelID) - return l, nil + l, err := getLabelByKey(txn, getLabelKey(labelID)) + if err != nil { + return nil, err + } + l.Count = getLabelCount(txn, teamID, labelID) + return l, nil } func getLabelByKey(txn *badger.Txn, key []byte) (*msg.Label, error) { - label := &msg.Label{} - item, err := txn.Get(key) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return label.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return label, nil + label := &msg.Label{} + item, err := txn.Get(key) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return label.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return label, nil } func saveLabel(txn *badger.Txn, label *msg.Label) error { - labelBytes, _ := label.Marshal() - err := txn.SetEntry(badger.NewEntry( - getLabelKey(label.ID), - labelBytes, - )) - return err + labelBytes, _ := label.Marshal() + err := txn.SetEntry(badger.NewEntry( + getLabelKey(label.ID), + labelBytes, + )) + return err } func saveLabelCount(txn *badger.Txn, teamID int64, labelID int32, cnt int32) error { - b := make([]byte, 4) - binary.BigEndian.PutUint32(b, uint32(cnt)) - return txn.Set(getLabelCountKey(teamID, labelID), b) + b := make([]byte, 4) + binary.BigEndian.PutUint32(b, uint32(cnt)) + return txn.Set(getLabelCountKey(teamID, labelID), b) } func getLabelCount(txn *badger.Txn, teamID int64, labelID int32) int32 { - var cnt int32 - item, err := txn.Get(getLabelCountKey(teamID, labelID)) - if err != nil { - return 0 - } - _ = item.Value(func(val []byte) error { - cnt = int32(binary.BigEndian.Uint32(val)) - return nil - }) - return cnt + var cnt int32 + item, err := txn.Get(getLabelCountKey(teamID, labelID)) + if err != nil { + return 0 + } + _ = item.Value(func(val []byte) error { + cnt = int32(binary.BigEndian.Uint32(val)) + return nil + }) + return cnt } func deleteLabel(txn *badger.Txn, labelID int32) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getLabelCountPrefix(labelID) - it := txn.NewIterator(opts) - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - _ = txn.Delete(it.Item().KeyCopy(nil)) - } - it.Close() - _ = txn.Delete(getLabelKey(labelID)) - return nil + opts := badger.DefaultIteratorOptions + opts.Prefix = getLabelCountPrefix(labelID) + it := txn.NewIterator(opts) + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + _ = txn.Delete(it.Item().KeyCopy(nil)) + } + it.Close() + _ = txn.Delete(getLabelKey(labelID)) + return nil } func addLabelToMessage(txn *badger.Txn, labelID int32, peerType int32, peerID int64, msgID int64) error { - err := txn.SetEntry(badger.NewEntry( - getLabelMessageKey(labelID, msgID), - tools.StrToByte(fmt.Sprintf("%d.%d.%d", peerType, peerID, msgID)), - )) - return err + err := txn.SetEntry(badger.NewEntry( + getLabelMessageKey(labelID, msgID), + tools.StrToByte(fmt.Sprintf("%d.%d.%d", peerType, peerID, msgID)), + )) + return err } func removeLabelFromMessage(txn *badger.Txn, labelID int32, msgID int64) error { - err := txn.Delete(getLabelMessageKey(labelID, msgID)) - switch err { - case badger.ErrKeyNotFound: - return nil - } - return err + err := txn.Delete(getLabelMessageKey(labelID, msgID)) + switch err { + case badger.ErrKeyNotFound: + return nil + } + return err } func decreaseLabelItemCount(txn *badger.Txn, teamID int64, labelID int32) error { - cnt := getLabelCount(txn, teamID, labelID) - if cnt == 0 { - return nil - } - cnt-- - return saveLabelCount(txn, teamID, labelID, cnt) + cnt := getLabelCount(txn, teamID, labelID) + if cnt == 0 { + return nil + } + cnt-- + return saveLabelCount(txn, teamID, labelID, cnt) } func (r *repoLabels) Set(labels ...*msg.Label) error { - err := badgerUpdate(func(txn *badger.Txn) error { - for _, l := range labels { - err := saveLabel(txn, l) - if err != nil { - return err - } - } - return nil - }) - return err + err := badgerUpdate(func(txn *badger.Txn) error { + for _, l := range labels { + err := saveLabel(txn, l) + if err != nil { + return err + } + } + return nil + }) + return err } func (r *repoLabels) Save(teamID int64, labels ...*msg.Label) error { - err := badgerUpdate(func(txn *badger.Txn) error { - for _, l := range labels { - err := saveLabel(txn, l) - if err != nil { - return err - } - err = saveLabelCount(txn, teamID, l.ID, l.Count) - if err != nil { - return err - } - } - return nil - }) - return err + err := badgerUpdate(func(txn *badger.Txn) error { + for _, l := range labels { + err := saveLabel(txn, l) + if err != nil { + return err + } + err = saveLabelCount(txn, teamID, l.ID, l.Count) + if err != nil { + return err + } + } + return nil + }) + return err } func (r *repoLabels) Delete(labelIDs ...int32) error { - err := badgerUpdate(func(txn *badger.Txn) error { - for _, labelID := range labelIDs { - err := deleteLabel(txn, labelID) - if err != nil { - return err - } - stream := r.badger.NewStream() - stream.Prefix = getLabelMessagePrefix(labelID) - stream.Send = func(list *pb.KVList) error { - for _, kv := range list.Kv { - parts := strings.Split(tools.ByteToStr(kv.Value), ".") - if len(parts) != 3 { - return domain.ErrInvalidData - } - msgID := tools.StrToInt64(parts[2]) - _ = removeLabelFromMessage(txn, labelID, msgID) - } - return nil - } - err = stream.Orchestrate(context.Background()) - if err != nil { - return err - } - } - return nil - }) - return err + err := badgerUpdate(func(txn *badger.Txn) error { + for _, labelID := range labelIDs { + err := deleteLabel(txn, labelID) + if err != nil { + return err + } + stream := r.badger.NewStream() + stream.Prefix = getLabelMessagePrefix(labelID) + stream.Send = func(list *pb.KVList) error { + for _, kv := range list.Kv { + parts := strings.Split(tools.ByteToStr(kv.Value), ".") + if len(parts) != 3 { + return domain.ErrInvalidData + } + msgID := tools.StrToInt64(parts[2]) + _ = removeLabelFromMessage(txn, labelID, msgID) + } + return nil + } + err = stream.Orchestrate(context.Background()) + if err != nil { + return err + } + } + return nil + }) + return err } func (r *repoLabels) GetMany(teamID int64, labelIDs ...int32) []*msg.Label { - labels := make([]*msg.Label, 0, len(labelIDs)) - _ = badgerView(func(txn *badger.Txn) error { - for _, labelID := range labelIDs { - l, err := getLabelByID(txn, teamID, labelID) - if err == nil { - labels = append(labels, l) - } - } - return nil - }) - return labels + labels := make([]*msg.Label, 0, len(labelIDs)) + _ = badgerView(func(txn *badger.Txn) error { + for _, labelID := range labelIDs { + l, err := getLabelByID(txn, teamID, labelID) + if err == nil { + labels = append(labels, l) + } + } + return nil + }) + return labels } func (r *repoLabels) GetAll(teamID int64) ([]*msg.Label, error) { - labels := make([]*msg.Label, 0, 20) - err := badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(prefixLabel) - it := txn.NewIterator(opts) - defer it.Close() - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - _ = it.Item().Value(func(val []byte) error { - l := &msg.Label{} - err := l.Unmarshal(val) - if err != nil { - return err - } - - l.Count = getLabelCount(txn, teamID, l.ID) - labels = append(labels, l) - return nil - }) - } - - return nil - }) - if err != nil { - return nil, err - } - return labels, nil + labels := make([]*msg.Label, 0, 20) + err := badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(prefixLabel) + it := txn.NewIterator(opts) + defer it.Close() + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + _ = it.Item().Value(func(val []byte) error { + l := &msg.Label{} + err := l.Unmarshal(val) + if err != nil { + return err + } + + l.Count = getLabelCount(txn, teamID, l.ID) + labels = append(labels, l) + return nil + }) + } + + return nil + }) + if err != nil { + return nil, err + } + return labels, nil } -func (r *repoLabels) ListMessages(labelID int32, teamID int64, limit int32, minID, maxID int64) ([]*msg.UserMessage, []*msg.User, []*msg.Group) { - userMessages := make([]*msg.UserMessage, 0, limit) - userIDs := make(domain.MInt64B, limit) - groupIDs := make(domain.MInt64B, limit) - - opts := badger.DefaultIteratorOptions - opts.Prefix = getLabelMessagePrefix(labelID) - switch { - case maxID == 0 && minID == 0: - fallthrough - case maxID > 0: - if maxID > 0 { - opts.Reverse = true - } - _ = badgerView(func(txn *badger.Txn) error { - it := txn.NewIterator(opts) - defer it.Close() - if maxID > 0 { - it.Seek(getLabelMessageKey(labelID, maxID)) - } else { - it.Rewind() - } - for ; it.ValidForPrefix(opts.Prefix); it.Next() { - if limit--; limit < 0 { - break - } - _ = it.Item().Value(func(val []byte) error { - return extractMessage(txn, val, teamID, &userMessages, userIDs, groupIDs) - }) - } - return nil - }) - case minID > 0: - _ = badgerView(func(txn *badger.Txn) error { - it := txn.NewIterator(opts) - defer it.Close() - it.Seek(getLabelMessageKey(labelID, minID)) - for ; it.ValidForPrefix(opts.Prefix); it.Next() { - if limit--; limit < 0 { - break - } - _ = it.Item().Value(func(val []byte) error { - fmt.Println(val) - return extractMessage(txn, val, teamID, &userMessages, userIDs, groupIDs) - }) - } - return nil - }) - - default: - } - sort.Slice(userMessages, func(i, j int) bool { - return userMessages[i].ID < userMessages[j].ID - }) - users, _ := Users.GetMany(userIDs.ToArray()) - groups, _ := Groups.GetMany(groupIDs.ToArray()) - return userMessages, users, groups +func (r *repoLabels) ListMessages(labelID int32, teamID int64, limit int32, minID, maxID int64) ([]*msg.UserMessage, []*msg.User, + []*msg.Group, +) { + userMessages := make([]*msg.UserMessage, 0, limit) + userIDs := make(domain.MInt64B, limit) + groupIDs := make(domain.MInt64B, limit) + + opts := badger.DefaultIteratorOptions + opts.Prefix = getLabelMessagePrefix(labelID) + switch { + case maxID == 0 && minID == 0: + fallthrough + case maxID > 0: + if maxID > 0 { + opts.Reverse = true + } + _ = badgerView(func(txn *badger.Txn) error { + it := txn.NewIterator(opts) + defer it.Close() + if maxID > 0 { + it.Seek(getLabelMessageKey(labelID, maxID)) + } else { + it.Rewind() + } + for ; it.ValidForPrefix(opts.Prefix); it.Next() { + if limit--; limit < 0 { + break + } + _ = it.Item().Value(func(val []byte) error { + return extractMessage(txn, val, teamID, &userMessages, userIDs, groupIDs) + }) + } + return nil + }) + case minID > 0: + _ = badgerView(func(txn *badger.Txn) error { + it := txn.NewIterator(opts) + defer it.Close() + it.Seek(getLabelMessageKey(labelID, minID)) + for ; it.ValidForPrefix(opts.Prefix); it.Next() { + if limit--; limit < 0 { + break + } + _ = it.Item().Value(func(val []byte) error { + fmt.Println(val) + return extractMessage(txn, val, teamID, &userMessages, userIDs, groupIDs) + }) + } + return nil + }) + + default: + } + sort.Slice(userMessages, func(i, j int) bool { + return userMessages[i].ID < userMessages[j].ID + }) + users, _ := Users.GetMany(userIDs.ToArray()) + groups, _ := Groups.GetMany(groupIDs.ToArray()) + return userMessages, users, groups } func extractMessage(txn *badger.Txn, val []byte, teamID int64, userMessages *[]*msg.UserMessage, userIDs, groupIDs domain.MInt64B) error { - parts := strings.Split(tools.ByteToStr(val), ".") - if len(parts) != 3 { - return domain.ErrInvalidData - } - msgID := tools.StrToInt64(parts[2]) - - um, err := getMessageByID(txn, msgID) - if err != nil { - return err - } - if um.TeamID != teamID { - return nil - } - userIDs.Add(um.SenderID) - if um.FwdSenderID != 0 { - userIDs.Add(um.FwdSenderID) - } - switch msg.PeerType(um.PeerType) { - case msg.PeerType_PeerUser: - userIDs.Add(um.PeerID) - case msg.PeerType_PeerGroup: - groupIDs.Add(um.PeerID) - } - - userIDs.Add(domain.ExtractActionUserIDs(um.MessageAction, um.MessageActionData)...) - - *userMessages = append(*userMessages, um) - return nil + parts := strings.Split(tools.ByteToStr(val), ".") + if len(parts) != 3 { + return domain.ErrInvalidData + } + msgID := tools.StrToInt64(parts[2]) + + um, err := getMessageByID(txn, msgID) + if err != nil { + return err + } + if um.TeamID != teamID { + return nil + } + userIDs.Add(um.SenderID) + if um.FwdSenderID != 0 { + userIDs.Add(um.FwdSenderID) + } + switch msg.PeerType(um.PeerType) { + case msg.PeerType_PeerUser: + userIDs.Add(um.PeerID) + case msg.PeerType_PeerGroup: + groupIDs.Add(um.PeerID) + } + + userIDs.Add(domain.ExtractActionUserIDs(um.MessageAction, um.MessageActionData)...) + + *userMessages = append(*userMessages, um) + return nil } func (r *repoLabels) AddLabelsToMessages(labelIDs []int32, teamID, peerID int64, peerType int32, msgIDs []int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, labelID := range labelIDs { - for _, msgID := range msgIDs { - err := addLabelToMessage(txn, labelID, peerType, peerID, msgID) - if err != nil { - return err - } - } - } - for _, msgID := range msgIDs { - um, err := getMessageByKey(txn, getMessageKey(teamID, peerID, peerType, msgID)) - if err != nil { - switch err { - case badger.ErrKeyNotFound: - continue - default: - return err - } - } - m := domain.MInt32B{} - m.Add(um.LabelIDs...) - m.Add(labelIDs...) - um.LabelIDs = m.ToArray() - err = saveMessage(txn, um) - if err != nil { - return err - } - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, labelID := range labelIDs { + for _, msgID := range msgIDs { + err := addLabelToMessage(txn, labelID, peerType, peerID, msgID) + if err != nil { + return err + } + } + } + for _, msgID := range msgIDs { + um, err := getMessageByKey(txn, getMessageKey(teamID, peerID, peerType, msgID)) + if err != nil { + switch err { + case badger.ErrKeyNotFound: + continue + default: + return err + } + } + m := domain.MInt32B{} + m.Add(um.LabelIDs...) + m.Add(labelIDs...) + um.LabelIDs = m.ToArray() + err = saveMessage(txn, um) + if err != nil { + return err + } + } + return nil + }) } func (r *repoLabels) RemoveLabelsFromMessages(labelIDs []int32, teamID, peerID int64, peerType int32, msgIDs []int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, labelID := range labelIDs { - for _, msgID := range msgIDs { - err := removeLabelFromMessage(txn, labelID, msgID) - if err != nil { - return err - } - } - } - for _, msgID := range msgIDs { - um, err := getMessageByKey(txn, getMessageKey(teamID, peerID, peerType, msgID)) - if err != nil { - switch err { - case badger.ErrKeyNotFound: - continue - default: - return err - } - } - m := domain.MInt32B{} - m.Add(um.LabelIDs...) - m.Remove(labelIDs...) - um.LabelIDs = m.ToArray() - err = saveMessage(txn, um) - if err != nil { - return err - } - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, labelID := range labelIDs { + for _, msgID := range msgIDs { + err := removeLabelFromMessage(txn, labelID, msgID) + if err != nil { + return err + } + } + } + for _, msgID := range msgIDs { + um, err := getMessageByKey(txn, getMessageKey(teamID, peerID, peerType, msgID)) + if err != nil { + switch err { + case badger.ErrKeyNotFound: + continue + default: + return err + } + } + m := domain.MInt32B{} + m.Add(um.LabelIDs...) + m.Remove(labelIDs...) + um.LabelIDs = m.ToArray() + err = saveMessage(txn, um) + if err != nil { + return err + } + } + return nil + }) } type LabelBar struct { - MinID int64 - MaxID int64 + MinID int64 + MaxID int64 } func getLabelBarMaxKey(teamID int64, labelID int32) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%021d.03%d.MAXID", prefixLabelFill, teamID, labelID)) + return tools.StrToByte(fmt.Sprintf("%s.%021d.03%d.MAXID", prefixLabelFill, teamID, labelID)) } func getLabelBarMinKey(teamID int64, labelID int32) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%021d.03%d.MINID", prefixLabelFill, teamID, labelID)) + return tools.StrToByte(fmt.Sprintf("%s.%021d.03%d.MINID", prefixLabelFill, teamID, labelID)) } func (r *repoLabels) Fill(teamID int64, labelID int32, minID, maxID int64) error { - var minIDb, maxIDb [8]byte - binary.BigEndian.PutUint64(minIDb[:], uint64(minID)) - binary.BigEndian.PutUint64(maxIDb[:], uint64(maxID)) - bar := r.GetFilled(teamID, labelID) - if maxID > bar.MaxID { - _ = badgerUpdate(func(txn *badger.Txn) error { - return txn.SetEntry(badger.NewEntry( - getLabelBarMaxKey(teamID, labelID), - maxIDb[:], - )) - }) - } - - if bar.MinID == 0 || minID < bar.MinID { - _ = badgerUpdate(func(txn *badger.Txn) error { - return txn.SetEntry(badger.NewEntry( - getLabelBarMinKey(teamID, labelID), - minIDb[:], - )) - }) - } - - return nil + var minIDb, maxIDb [8]byte + binary.BigEndian.PutUint64(minIDb[:], uint64(minID)) + binary.BigEndian.PutUint64(maxIDb[:], uint64(maxID)) + bar := r.GetFilled(teamID, labelID) + if maxID > bar.MaxID { + _ = badgerUpdate(func(txn *badger.Txn) error { + return txn.SetEntry(badger.NewEntry( + getLabelBarMaxKey(teamID, labelID), + maxIDb[:], + )) + }) + } + + if bar.MinID == 0 || minID < bar.MinID { + _ = badgerUpdate(func(txn *badger.Txn) error { + return txn.SetEntry(badger.NewEntry( + getLabelBarMinKey(teamID, labelID), + minIDb[:], + )) + }) + } + + return nil } func (r *repoLabels) GetFilled(teamID int64, labelID int32) LabelBar { - bar := LabelBar{} - _ = badgerView(func(txn *badger.Txn) error { - minIDItem, err := txn.Get(getLabelBarMinKey(teamID, labelID)) - if err != nil { - return err - } - _ = minIDItem.Value(func(val []byte) error { - bar.MinID = int64(binary.BigEndian.Uint64(val)) - return nil - }) - maxIDItem, err := txn.Get(getLabelBarMaxKey(teamID, labelID)) - if err != nil { - return err - } - _ = maxIDItem.Value(func(val []byte) error { - bar.MaxID = int64(binary.BigEndian.Uint64(val)) - return nil - }) - return nil - }) - return bar + bar := LabelBar{} + _ = badgerView(func(txn *badger.Txn) error { + minIDItem, err := txn.Get(getLabelBarMinKey(teamID, labelID)) + if err != nil { + return err + } + _ = minIDItem.Value(func(val []byte) error { + bar.MinID = int64(binary.BigEndian.Uint64(val)) + return nil + }) + maxIDItem, err := txn.Get(getLabelBarMaxKey(teamID, labelID)) + if err != nil { + return err + } + _ = maxIDItem.Value(func(val []byte) error { + bar.MaxID = int64(binary.BigEndian.Uint64(val)) + return nil + }) + return nil + }) + return bar } func (r *repoLabels) GetLowerFilled(teamID int64, labelID int32, maxID int64) (bool, LabelBar) { - b := r.GetFilled(teamID, labelID) - if b.MinID == 0 && b.MaxID == 0 { - return false, b - } - if maxID > b.MaxID || maxID < b.MinID { - return false, b - } - b.MaxID = maxID - return true, b + b := r.GetFilled(teamID, labelID) + if b.MinID == 0 && b.MaxID == 0 { + return false, b + } + if maxID > b.MaxID || maxID < b.MinID { + return false, b + } + b.MaxID = maxID + return true, b } func (r *repoLabels) GetUpperFilled(teamID int64, labelID int32, minID int64) (bool, LabelBar) { - b := r.GetFilled(teamID, labelID) - if b.MinID == 0 && b.MaxID == 0 { - return false, b - } - if minID < b.MinID || minID > b.MaxID { - return false, b - } - b.MinID = minID - return true, b + b := r.GetFilled(teamID, labelID) + if b.MinID == 0 && b.MaxID == 0 { + return false, b + } + if minID < b.MinID || minID > b.MaxID { + return false, b + } + b.MinID = minID + return true, b } diff --git a/internal/repo/labels_test.go b/internal/repo/labels_test.go index 9522da63..5b77e914 100644 --- a/internal/repo/labels_test.go +++ b/internal/repo/labels_test.go @@ -1,13 +1,14 @@ package repo_test import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony/tools" - . "github.com/smartystreets/goconvey/convey" - "testing" + "fmt" + "testing" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony/tools" + . "github.com/smartystreets/goconvey/convey" ) /* @@ -20,166 +21,166 @@ import ( */ func TestLabel(t *testing.T) { - Convey("Testing Labels", t, func(c C) { - Convey("Save Labels", func(c C) { - err := repo.Labels.Save( - 0, - &msg.Label{ - ID: 1, - Name: "Label1", - Colour: "#FF0000", - }, - &msg.Label{ - ID: 2, - Name: "Label 2", - Colour: "#00FF00", - }, - ) - c.So(err, ShouldBeNil) - labels, err := repo.Labels.GetAll(0) - c.So(err, ShouldBeNil) - c.So(labels, ShouldHaveLength, 2) - }) - Convey("Add Label To Message", func(c C) { - peerID := tools.RandomInt64(0) - // Save 10 new message for peerID - for i := 1; i <= 10; i++ { - repo.Messages.Save(&msg.UserMessage{ - ID: int64(i), - PeerID: peerID, - PeerType: 0, - CreatedOn: 0, - EditedOn: 0, - FwdSenderID: 0, - FwdChannelID: 0, - FwdChannelMessageID: 0, - Flags: 0, - MessageType: 0, - Body: fmt.Sprintf("Test %d", i), - SenderID: 0, - ContentRead: false, - Inbox: false, - ReplyTo: 0, - MessageAction: 0, - MessageActionData: nil, - Entities: nil, - MediaType: 0, - Media: nil, - ReplyMarkup: 0, - ReplyMarkupData: nil, - LabelIDs: nil, - }) - } + Convey("Testing Labels", t, func(c C) { + Convey("Save Labels", func(c C) { + err := repo.Labels.Save( + 0, + &msg.Label{ + ID: 1, + Name: "Label1", + Colour: "#FF0000", + }, + &msg.Label{ + ID: 2, + Name: "Label 2", + Colour: "#00FF00", + }, + ) + c.So(err, ShouldBeNil) + labels, err := repo.Labels.GetAll(0) + c.So(err, ShouldBeNil) + c.So(labels, ShouldHaveLength, 2) + }) + Convey("Add Label To Message", func(c C) { + peerID := tools.RandomInt64(0) + // Save 10 new message for peerID + for i := 1; i <= 10; i++ { + repo.Messages.Save(&msg.UserMessage{ + ID: int64(i), + PeerID: peerID, + PeerType: 0, + CreatedOn: 0, + EditedOn: 0, + FwdSenderID: 0, + FwdChannelID: 0, + FwdChannelMessageID: 0, + Flags: 0, + MessageType: 0, + Body: fmt.Sprintf("Test %d", i), + SenderID: 0, + ContentRead: false, + Inbox: false, + ReplyTo: 0, + MessageAction: 0, + MessageActionData: nil, + Entities: nil, + MediaType: 0, + Media: nil, + ReplyMarkup: 0, + ReplyMarkupData: nil, + LabelIDs: nil, + }) + } - ums, _, _ := repo.Labels.ListMessages(1, 0, 100, 0, 0) - for _, um := range ums { - err := repo.Labels.RemoveLabelsFromMessages([]int32{1}, 0, um.PeerID, um.PeerType, []int64{um.ID}) - c.So(err, ShouldBeNil) - } + ums, _, _ := repo.Labels.ListMessages(1, 0, 100, 0, 0) + for _, um := range ums { + err := repo.Labels.RemoveLabelsFromMessages([]int32{1}, 0, um.PeerID, um.PeerType, []int64{um.ID}) + c.So(err, ShouldBeNil) + } - err := repo.Labels.AddLabelsToMessages([]int32{1}, 0, peerID, 1, []int64{1, 2, 3, 6, 8, 9, 10}) - c.So(err, ShouldBeNil) - }) - Convey("List Messages", func(c C) { - ums, _, _ := repo.Labels.ListMessages(1, 0, 3, 0, 0) - c.So(ums, ShouldHaveLength, 3) - c.So(ums[0].ID, ShouldEqual, 1) - c.So(ums[1].ID, ShouldEqual, 2) - c.So(ums[2].ID, ShouldEqual, 3) + err := repo.Labels.AddLabelsToMessages([]int32{1}, 0, peerID, 1, []int64{1, 2, 3, 6, 8, 9, 10}) + c.So(err, ShouldBeNil) + }) + Convey("List Messages", func(c C) { + ums, _, _ := repo.Labels.ListMessages(1, 0, 3, 0, 0) + c.So(ums, ShouldHaveLength, 3) + c.So(ums[0].ID, ShouldEqual, 1) + c.So(ums[1].ID, ShouldEqual, 2) + c.So(ums[2].ID, ShouldEqual, 3) - ums, _, _ = repo.Labels.ListMessages(1, 0, 2, 6, 0) - c.So(ums, ShouldHaveLength, 2) - c.So(ums[0].ID, ShouldEqual, 6) - c.So(ums[1].ID, ShouldEqual, 8) + ums, _, _ = repo.Labels.ListMessages(1, 0, 2, 6, 0) + c.So(ums, ShouldHaveLength, 2) + c.So(ums[0].ID, ShouldEqual, 6) + c.So(ums[1].ID, ShouldEqual, 8) - ums, _, _ = repo.Labels.ListMessages(1, 0, 3, 0, 9) - c.So(ums, ShouldHaveLength, 3) - c.So(ums[0].ID, ShouldEqual, 6) - c.So(ums[1].ID, ShouldEqual, 8) - c.So(ums[2].ID, ShouldEqual, 9) + ums, _, _ = repo.Labels.ListMessages(1, 0, 3, 0, 9) + c.So(ums, ShouldHaveLength, 3) + c.So(ums[0].ID, ShouldEqual, 6) + c.So(ums[1].ID, ShouldEqual, 8) + c.So(ums[2].ID, ShouldEqual, 9) - ums, _, _ = repo.Labels.ListMessages(1, 0, 3, 0, 5) - c.So(ums, ShouldHaveLength, 3) - c.So(ums[0].ID, ShouldEqual, 1) - c.So(ums[1].ID, ShouldEqual, 2) - c.So(ums[2].ID, ShouldEqual, 3) + ums, _, _ = repo.Labels.ListMessages(1, 0, 3, 0, 5) + c.So(ums, ShouldHaveLength, 3) + c.So(ums[0].ID, ShouldEqual, 1) + c.So(ums[1].ID, ShouldEqual, 2) + c.So(ums[2].ID, ShouldEqual, 3) - ums, _, _ = repo.Labels.ListMessages(1, 0, 3, 5, 0) - c.So(ums, ShouldHaveLength, 3) - c.So(ums[0].ID, ShouldEqual, 6) - c.So(ums[1].ID, ShouldEqual, 8) - c.So(ums[2].ID, ShouldEqual, 9) - }) - Convey("Label Hole", func(c C) { - b, _ := repo.Labels.GetLowerFilled(0, 10, 100) - c.So(b, ShouldBeFalse) + ums, _, _ = repo.Labels.ListMessages(1, 0, 3, 5, 0) + c.So(ums, ShouldHaveLength, 3) + c.So(ums[0].ID, ShouldEqual, 6) + c.So(ums[1].ID, ShouldEqual, 8) + c.So(ums[2].ID, ShouldEqual, 9) + }) + Convey("Label Hole", func(c C) { + b, _ := repo.Labels.GetLowerFilled(0, 10, 100) + c.So(b, ShouldBeFalse) - err := repo.Labels.Fill(0, 1, 10, 100) - c.So(err, ShouldBeNil) + err := repo.Labels.Fill(0, 1, 10, 100) + c.So(err, ShouldBeNil) - bar := repo.Labels.GetFilled(0, 1) - c.So(bar.MinID, ShouldEqual, 10) - c.So(bar.MaxID, ShouldEqual, 100) + bar := repo.Labels.GetFilled(0, 1) + c.So(bar.MinID, ShouldEqual, 10) + c.So(bar.MaxID, ShouldEqual, 100) - b, bar = repo.Labels.GetUpperFilled(0, 1, 90) - c.So(b, ShouldBeTrue) - c.So(bar.MinID, ShouldEqual, 90) - c.So(bar.MaxID, ShouldEqual, 100) + b, bar = repo.Labels.GetUpperFilled(0, 1, 90) + c.So(b, ShouldBeTrue) + c.So(bar.MinID, ShouldEqual, 90) + c.So(bar.MaxID, ShouldEqual, 100) - b, bar = repo.Labels.GetLowerFilled(0, 1, 90) - c.So(b, ShouldBeTrue) - c.So(bar.MinID, ShouldEqual, 10) - c.So(bar.MaxID, ShouldEqual, 90) - }) - Convey("Search By Label", func(c C) { + b, bar = repo.Labels.GetLowerFilled(0, 1, 90) + c.So(b, ShouldBeTrue) + c.So(bar.MinID, ShouldEqual, 10) + c.So(bar.MaxID, ShouldEqual, 90) + }) + Convey("Search By Label", func(c C) { - }) - Convey("List complete test", func(c C) { - peerID := domain.RandomInt64(0) - for i := 1; i <= 10; i++ { - repo.Messages.Save(&msg.UserMessage{ - ID: int64(i), - PeerID: peerID, - PeerType: int32(msg.PeerType_PeerUser), - CreatedOn: 0, - EditedOn: 0, - FwdSenderID: 0, - FwdChannelID: 0, - FwdChannelMessageID: 0, - Flags: 0, - MessageType: 0, - Body: fmt.Sprintf("Test %d", i), - SenderID: 0, - ContentRead: false, - Inbox: false, - ReplyTo: 0, - MessageAction: 0, - MessageActionData: nil, - Entities: nil, - MediaType: 0, - Media: nil, - ReplyMarkup: 0, - ReplyMarkupData: nil, - LabelIDs: nil, - }) - } - ums, _, _ := repo.Labels.ListMessages(1, 0, 100, 0, 0) - for _, um := range ums { - err := repo.Labels.RemoveLabelsFromMessages([]int32{1}, 0, um.PeerID, um.PeerType, []int64{um.ID}) - c.So(err, ShouldBeNil) - } - err := repo.Labels.AddLabelsToMessages([]int32{1}, 0, peerID, int32(msg.PeerType_PeerUser), []int64{1, 2, 3}) - c.So(err, ShouldBeNil) - ums, _, _ = repo.Labels.ListMessages(1, 0, 100, 0, 0) - c.So(ums, ShouldHaveLength, 3) - err = repo.Labels.AddLabelsToMessages([]int32{1}, 0, peerID, int32(msg.PeerType_PeerUser), []int64{8}) - c.So(err, ShouldBeNil) - ums, _, _ = repo.Labels.ListMessages(1, 0, 100, 0, 0) - c.So(ums, ShouldHaveLength, 4) - err = repo.Labels.AddLabelsToMessages([]int32{1}, 0, peerID, int32(msg.PeerType_PeerUser), []int64{7}) - c.So(err, ShouldBeNil) - ums, _, _ = repo.Labels.ListMessages(1, 0, 100, 0, 0) - c.So(ums, ShouldHaveLength, 5) - }) - }) + }) + Convey("List complete test", func(c C) { + peerID := domain.RandomInt64(0) + for i := 1; i <= 10; i++ { + repo.Messages.Save(&msg.UserMessage{ + ID: int64(i), + PeerID: peerID, + PeerType: int32(msg.PeerType_PeerUser), + CreatedOn: 0, + EditedOn: 0, + FwdSenderID: 0, + FwdChannelID: 0, + FwdChannelMessageID: 0, + Flags: 0, + MessageType: 0, + Body: fmt.Sprintf("Test %d", i), + SenderID: 0, + ContentRead: false, + Inbox: false, + ReplyTo: 0, + MessageAction: 0, + MessageActionData: nil, + Entities: nil, + MediaType: 0, + Media: nil, + ReplyMarkup: 0, + ReplyMarkupData: nil, + LabelIDs: nil, + }) + } + ums, _, _ := repo.Labels.ListMessages(1, 0, 100, 0, 0) + for _, um := range ums { + err := repo.Labels.RemoveLabelsFromMessages([]int32{1}, 0, um.PeerID, um.PeerType, []int64{um.ID}) + c.So(err, ShouldBeNil) + } + err := repo.Labels.AddLabelsToMessages([]int32{1}, 0, peerID, int32(msg.PeerType_PeerUser), []int64{1, 2, 3}) + c.So(err, ShouldBeNil) + ums, _, _ = repo.Labels.ListMessages(1, 0, 100, 0, 0) + c.So(ums, ShouldHaveLength, 3) + err = repo.Labels.AddLabelsToMessages([]int32{1}, 0, peerID, int32(msg.PeerType_PeerUser), []int64{8}) + c.So(err, ShouldBeNil) + ums, _, _ = repo.Labels.ListMessages(1, 0, 100, 0, 0) + c.So(ums, ShouldHaveLength, 4) + err = repo.Labels.AddLabelsToMessages([]int32{1}, 0, peerID, int32(msg.PeerType_PeerUser), []int64{7}) + c.So(err, ShouldBeNil) + ums, _, _ = repo.Labels.ListMessages(1, 0, 100, 0, 0) + c.So(ums, ShouldHaveLength, 5) + }) + }) } diff --git a/internal/repo/messages.go b/internal/repo/messages.go index 6f8641a7..54b398d9 100644 --- a/internal/repo/messages.go +++ b/internal/repo/messages.go @@ -1,978 +1,979 @@ package repo import ( - "bytes" - "context" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/search/query" - "github.com/dgraph-io/badger/v2" - "github.com/dgraph-io/badger/v2/pb" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" - "sort" - "strings" - "sync" - "time" + "bytes" + "context" + "fmt" + "sort" + "strings" + "sync" + "time" + + "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/search/query" + "github.com/dgraph-io/badger/v2" + "github.com/dgraph-io/badger/v2/pb" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) const ( - prefixMessages = "MSG" - prefixUserMessages = "UMSG" + prefixMessages = "MSG" + prefixUserMessages = "UMSG" ) type repoMessages struct { - *repository + *repository } func getMessageKey(teamID, peerID int64, peerType int32, msgID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixMessages) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - z.AppendStrInt64(sb, peerID) - z.AppendStrInt32(sb, peerType) - z.AppendStrInt64(sb, msgID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixMessages) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + z.AppendStrInt64(sb, peerID) + z.AppendStrInt32(sb, peerType) + z.AppendStrInt64(sb, msgID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getMessagePrefix(teamID, peerID int64, peerType int32) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixMessages) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - z.AppendStrInt64(sb, peerID) - z.AppendStrInt32(sb, peerType) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixMessages) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + z.AppendStrInt64(sb, peerID) + z.AppendStrInt32(sb, peerType) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getUserMessageKey(msgID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixUserMessages) - sb.WriteRune('.') - z.AppendStrInt64(sb, msgID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixUserMessages) + sb.WriteRune('.') + z.AppendStrInt64(sb, msgID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getMessageByID(txn *badger.Txn, msgID int64) (*msg.UserMessage, error) { - message := new(msg.UserMessage) - item, err := txn.Get(getUserMessageKey(msgID)) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - parts := strings.Split(tools.ByteToStr(val), ".") - if len(parts) != 3 { - return domain.ErrInvalidUserMessageKey - } - itemMessage, err := txn.Get(getMessageKey(tools.StrToInt64(parts[0]), tools.StrToInt64(parts[1]), tools.StrToInt32(parts[2]), msgID)) - if err != nil { - return err - } - return itemMessage.Value(func(val []byte) error { - return message.Unmarshal(val) - }) - }) - - if err != nil { - return nil, err - } - return message, nil + message := new(msg.UserMessage) + item, err := txn.Get(getUserMessageKey(msgID)) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + parts := strings.Split(tools.ByteToStr(val), ".") + if len(parts) != 3 { + return domain.ErrInvalidUserMessageKey + } + itemMessage, err := txn.Get(getMessageKey(tools.StrToInt64(parts[0]), tools.StrToInt64(parts[1]), tools.StrToInt32(parts[2]), msgID)) + if err != nil { + return err + } + return itemMessage.Value(func(val []byte) error { + return message.Unmarshal(val) + }) + }) + + if err != nil { + return nil, err + } + return message, nil } func getMessageByKey(txn *badger.Txn, msgKey []byte) (*msg.UserMessage, error) { - message := &msg.UserMessage{} - item, err := txn.Get(msgKey) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return message.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return message, nil + message := &msg.UserMessage{} + item, err := txn.Get(msgKey) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return message.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return message, nil } func saveMessage(txn *badger.Txn, message *msg.UserMessage) error { - messageBytes, _ := message.Marshal() - docType := msg.ClientMediaType_ClientMediaNone - - switch message.MediaType { - case msg.MediaType_MediaTypeDocument: - doc := &msg.MediaDocument{} - _ = doc.Unmarshal(message.Media) - if doc.Doc == nil { - return nil - } - for _, da := range doc.Doc.Attributes { - if docType == msg.ClientMediaType_ClientMediaGif { - break - } - switch da.Type { - case msg.DocumentAttributeType_AttributeTypeAudio: - a := &msg.DocumentAttributeAudio{} - _ = a.Unmarshal(da.Data) - if a.Voice { - docType = msg.ClientMediaType_ClientMediaVoice - } else { - docType = msg.ClientMediaType_ClientMediaAudio - } - case msg.DocumentAttributeType_AttributeTypeVideo, msg.DocumentAttributeType_AttributeTypePhoto: - docType = msg.ClientMediaType_ClientMediaMedia - case msg.DocumentAttributeType_AttributeTypeAnimated: - docType = msg.ClientMediaType_ClientMediaGif - case msg.DocumentAttributeType_AttributeTypeFile: - if docType == msg.ClientMediaType_ClientMediaNone { - docType = msg.ClientMediaType_ClientMediaFile - } - } - } - case msg.MediaType_MediaTypeWebDocument: - webDoc := &msg.MediaWebDocument{} - for _, da := range webDoc.Attributes { - if docType == msg.ClientMediaType_ClientMediaGif { - break - } - switch da.Type { - case msg.DocumentAttributeType_AttributeTypeAudio: - a := new(msg.DocumentAttributeAudio) - _ = a.Unmarshal(da.Data) - if a.Voice { - docType = msg.ClientMediaType_ClientMediaVoice - } else { - docType = msg.ClientMediaType_ClientMediaAudio - } - case msg.DocumentAttributeType_AttributeTypeVideo, msg.DocumentAttributeType_AttributeTypePhoto: - docType = msg.ClientMediaType_ClientMediaMedia - case msg.DocumentAttributeType_AttributeTypeAnimated: - docType = msg.ClientMediaType_ClientMediaGif - case msg.DocumentAttributeType_AttributeTypeFile: - if docType == msg.ClientMediaType_ClientMediaNone { - docType = msg.ClientMediaType_ClientMediaFile - } - } - } - default: - // Do nothing - } - - // 1. Write Message - err := txn.SetEntry( - badger.NewEntry( - getMessageKey(message.TeamID, message.PeerID, message.PeerType, message.ID), - messageBytes, - ).WithMeta(byte(docType)), - ) - if err != nil { - return err - } - - // 2. Write UserMessage - err = txn.SetEntry( - badger.NewEntry( - getUserMessageKey(message.ID), - tools.StrToByte(fmt.Sprintf("%d.%d.%d", message.TeamID, message.PeerID, message.PeerType)), - ).WithMeta(byte(docType)), - ) - if err != nil { - return err - } - - indexMessage( - tools.ByteToStr(getMessageKey(message.TeamID, message.PeerID, message.PeerType, message.ID)), - MessageSearch{ - Type: "msg", - Body: message.Body, - PeerID: fmt.Sprintf("%d", message.PeerID), - SenderID: fmt.Sprintf("%d", message.SenderID), - TeamID: fmt.Sprintf("%d", message.TeamID), - }, - ) - - return nil + messageBytes, _ := message.Marshal() + docType := msg.ClientMediaType_ClientMediaNone + + switch message.MediaType { + case msg.MediaType_MediaTypeDocument: + doc := &msg.MediaDocument{} + _ = doc.Unmarshal(message.Media) + if doc.Doc == nil { + return nil + } + for _, da := range doc.Doc.Attributes { + if docType == msg.ClientMediaType_ClientMediaGif { + break + } + switch da.Type { + case msg.DocumentAttributeType_AttributeTypeAudio: + a := &msg.DocumentAttributeAudio{} + _ = a.Unmarshal(da.Data) + if a.Voice { + docType = msg.ClientMediaType_ClientMediaVoice + } else { + docType = msg.ClientMediaType_ClientMediaAudio + } + case msg.DocumentAttributeType_AttributeTypeVideo, msg.DocumentAttributeType_AttributeTypePhoto: + docType = msg.ClientMediaType_ClientMediaMedia + case msg.DocumentAttributeType_AttributeTypeAnimated: + docType = msg.ClientMediaType_ClientMediaGif + case msg.DocumentAttributeType_AttributeTypeFile: + if docType == msg.ClientMediaType_ClientMediaNone { + docType = msg.ClientMediaType_ClientMediaFile + } + } + } + case msg.MediaType_MediaTypeWebDocument: + webDoc := &msg.MediaWebDocument{} + for _, da := range webDoc.Attributes { + if docType == msg.ClientMediaType_ClientMediaGif { + break + } + switch da.Type { + case msg.DocumentAttributeType_AttributeTypeAudio: + a := new(msg.DocumentAttributeAudio) + _ = a.Unmarshal(da.Data) + if a.Voice { + docType = msg.ClientMediaType_ClientMediaVoice + } else { + docType = msg.ClientMediaType_ClientMediaAudio + } + case msg.DocumentAttributeType_AttributeTypeVideo, msg.DocumentAttributeType_AttributeTypePhoto: + docType = msg.ClientMediaType_ClientMediaMedia + case msg.DocumentAttributeType_AttributeTypeAnimated: + docType = msg.ClientMediaType_ClientMediaGif + case msg.DocumentAttributeType_AttributeTypeFile: + if docType == msg.ClientMediaType_ClientMediaNone { + docType = msg.ClientMediaType_ClientMediaFile + } + } + } + default: + // Do nothing + } + + // 1. Write Message + err := txn.SetEntry( + badger.NewEntry( + getMessageKey(message.TeamID, message.PeerID, message.PeerType, message.ID), + messageBytes, + ).WithMeta(byte(docType)), + ) + if err != nil { + return err + } + + // 2. Write UserMessage + err = txn.SetEntry( + badger.NewEntry( + getUserMessageKey(message.ID), + tools.StrToByte(fmt.Sprintf("%d.%d.%d", message.TeamID, message.PeerID, message.PeerType)), + ).WithMeta(byte(docType)), + ) + if err != nil { + return err + } + + indexMessage( + tools.ByteToStr(getMessageKey(message.TeamID, message.PeerID, message.PeerType, message.ID)), + MessageSearch{ + Type: "msg", + Body: message.Body, + PeerID: fmt.Sprintf("%d", message.PeerID), + SenderID: fmt.Sprintf("%d", message.SenderID), + TeamID: fmt.Sprintf("%d", message.TeamID), + }, + ) + + return nil } func (r *repoMessages) Get(messageID int64) (um *msg.UserMessage, err error) { - err = badgerView(func(txn *badger.Txn) error { - um, err = getMessageByID(txn, messageID) - return err - }) - return + err = badgerView(func(txn *badger.Txn) error { + um, err = getMessageByID(txn, messageID) + return err + }) + return } func (r *repoMessages) GetMany(messageIDs []int64) ([]*msg.UserMessage, error) { - userMessages := make([]*msg.UserMessage, 0, len(messageIDs)) - err := badgerView(func(txn *badger.Txn) error { - for _, messageID := range messageIDs { - userMessage, err := getMessageByID(txn, messageID) - if err != nil { - switch err { - case badger.ErrKeyNotFound: - default: - } - } - if err == nil { - userMessages = append(userMessages, userMessage) - } - } - return nil - }) - return userMessages, err + userMessages := make([]*msg.UserMessage, 0, len(messageIDs)) + err := badgerView(func(txn *badger.Txn) error { + for _, messageID := range messageIDs { + userMessage, err := getMessageByID(txn, messageID) + if err != nil { + switch err { + case badger.ErrKeyNotFound: + default: + } + } + if err == nil { + userMessages = append(userMessages, userMessage) + } + } + return nil + }) + return userMessages, err } func (r *repoMessages) SaveNew(message *msg.UserMessage, userID int64) error { - if message == nil { - return nil - } - err := badgerUpdate(func(txn *badger.Txn) error { - err := saveMessage(txn, message) - if err != nil { - return err - } - - err = saveMessageMedia(txn, message) - if err != nil { - return err - } - - dialog, err := getDialog(txn, message.TeamID, message.PeerID, message.PeerType) - switch err { - case nil: - case badger.ErrKeyNotFound: - return nil - default: - return err - - } - if message.ID > dialog.TopMessageID { - dialog.TopMessageID = message.ID - if !dialog.Pinned { - _ = updateDialogLastUpdate(message.TeamID, message.PeerID, message.PeerType, message.CreatedOn) - } - // Update counters if necessary - if message.SenderID != userID { - dialog.UnreadCount += 1 - for _, entity := range message.Entities { - if (entity.Type == msg.MessageEntityType_MessageEntityTypeMention && entity.UserID == userID) || - (entity.Type == msg.MessageEntityType_MessageEntityTypeMentionAll) { - dialog.MentionedCount += 1 - } - } - } - } - return saveDialog(txn, dialog) - }) - - return err + if message == nil { + return nil + } + err := badgerUpdate(func(txn *badger.Txn) error { + err := saveMessage(txn, message) + if err != nil { + return err + } + + err = saveMessageMedia(txn, message) + if err != nil { + return err + } + + dialog, err := getDialog(txn, message.TeamID, message.PeerID, message.PeerType) + switch err { + case nil: + case badger.ErrKeyNotFound: + return nil + default: + return err + + } + if message.ID > dialog.TopMessageID { + dialog.TopMessageID = message.ID + if !dialog.Pinned { + _ = updateDialogLastUpdate(message.TeamID, message.PeerID, message.PeerType, message.CreatedOn) + } + // Update counters if necessary + if message.SenderID != userID { + dialog.UnreadCount += 1 + for _, entity := range message.Entities { + if (entity.Type == msg.MessageEntityType_MessageEntityTypeMention && entity.UserID == userID) || + (entity.Type == msg.MessageEntityType_MessageEntityTypeMentionAll) { + dialog.MentionedCount += 1 + } + } + } + } + return saveDialog(txn, dialog) + }) + + return err } func (r *repoMessages) Save(messages ...*msg.UserMessage) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, message := range messages { - err := saveMessage(txn, message) - if err != nil { - return err - } - err = saveMessageMedia(txn, message) - if err != nil { - return err - } - - for _, labelID := range message.LabelIDs { - err = addLabelToMessage(txn, labelID, message.PeerType, message.PeerID, message.ID) - if err != nil { - return err - } - } - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, message := range messages { + err := saveMessage(txn, message) + if err != nil { + return err + } + err = saveMessageMedia(txn, message) + if err != nil { + return err + } + + for _, labelID := range message.LabelIDs { + err = addLabelToMessage(txn, labelID, message.PeerType, message.PeerID, message.ID) + if err != nil { + return err + } + } + } + return nil + }) } func (r *repoMessages) UpdateReactionCounter(messageID int64, reactions []*msg.ReactionCounter, yourReactions []string) error { - return badgerUpdate(func(txn *badger.Txn) error { - um, err := getMessageByID(txn, messageID) - if err != nil { - return nil - } - um.Reactions = reactions - um.YourReactions = yourReactions - - return saveMessage(txn, um) - }) + return badgerUpdate(func(txn *badger.Txn) error { + um, err := getMessageByID(txn, messageID) + if err != nil { + return nil + } + um.Reactions = reactions + um.YourReactions = yourReactions + + return saveMessage(txn, um) + }) } func (r *repoMessages) GetMessageHistory( - teamID, peerID int64, peerType int32, minID, maxID int64, limit int32, filters ...msg.ClientMediaType, + teamID, peerID int64, peerType int32, minID, maxID int64, limit int32, filters ...msg.ClientMediaType, ) (userMessages []*msg.UserMessage, users []*msg.User, groups []*msg.Group) { - userMessages = make([]*msg.UserMessage, 0, limit) - switch { - case maxID == 0 && minID == 0: - dialog, err := Dialogs.Get(teamID, peerID, peerType) - if err != nil { - return - } - maxID = dialog.TopMessageID - fallthrough - case maxID != 0 && minID == 0: - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getMessagePrefix(teamID, peerID, peerType) - opts.Reverse = true - it := txn.NewIterator(opts) - it.Seek(getMessageKey(teamID, peerID, peerType, maxID)) - for ; it.ValidForPrefix(opts.Prefix); it.Next() { - if limit--; limit < 0 { - break - } - _ = it.Item().Value(func(val []byte) error { - userMessage := &msg.UserMessage{} - err := userMessage.Unmarshal(val) - if err != nil { - return err - } - if len(filters) > 0 { - if bypassFilter(it.Item().UserMeta(), filters...) { - // increase the limit counter since we are not going to use this message - limit++ - return nil - } - } - userMessages = append(userMessages, userMessage) - return nil - }) - } - it.Close() - return nil - }) - case maxID == 0 && minID != 0: - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getMessagePrefix(teamID, peerID, peerType) - opts.Reverse = false - it := txn.NewIterator(opts) - it.Seek(getMessageKey(teamID, peerID, peerType, minID)) - for ; it.ValidForPrefix(opts.Prefix); it.Next() { - if limit--; limit < 0 { - break - } - _ = it.Item().Value(func(val []byte) error { - userMessage := new(msg.UserMessage) - err := userMessage.Unmarshal(val) - if err != nil { - return err - } - if len(filters) > 0 { - if bypassFilter(it.Item().UserMeta(), filters...) { - // increase the limit counter since we are not going to use this message - limit++ - return nil - } - } - userMessages = append(userMessages, userMessage) - return nil - }) - } - it.Close() - sort.Slice(userMessages, func(i, j int) bool { - return userMessages[i].ID > userMessages[j].ID - }) - return nil - }) - default: - - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getMessagePrefix(teamID, peerID, peerType) - opts.Reverse = true - it := txn.NewIterator(opts) - it.Seek(getMessageKey(teamID, peerID, peerType, maxID)) - for ; it.ValidForPrefix(opts.Prefix); it.Next() { - if limit--; limit < 0 { - break - } - _ = it.Item().Value(func(val []byte) error { - userMessage := new(msg.UserMessage) - err := userMessage.Unmarshal(val) - if err != nil { - return err - } - if len(filters) > 0 { - if bypassFilter(it.Item().UserMeta(), filters...) { - // increase the limit counter since we are not going to use this message - limit++ - return nil - } - } - userMessages = append(userMessages, userMessage) - if userMessage.ID <= minID { - limit = 0 - } - return nil - }) - } - it.Close() - return nil - }) - - } - - users, groups = extractMessages(userMessages...) - return + userMessages = make([]*msg.UserMessage, 0, limit) + switch { + case maxID == 0 && minID == 0: + dialog, err := Dialogs.Get(teamID, peerID, peerType) + if err != nil { + return + } + maxID = dialog.TopMessageID + fallthrough + case maxID != 0 && minID == 0: + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getMessagePrefix(teamID, peerID, peerType) + opts.Reverse = true + it := txn.NewIterator(opts) + it.Seek(getMessageKey(teamID, peerID, peerType, maxID)) + for ; it.ValidForPrefix(opts.Prefix); it.Next() { + if limit--; limit < 0 { + break + } + _ = it.Item().Value(func(val []byte) error { + userMessage := &msg.UserMessage{} + err := userMessage.Unmarshal(val) + if err != nil { + return err + } + if len(filters) > 0 { + if bypassFilter(it.Item().UserMeta(), filters...) { + // increase the limit counter since we are not going to use this message + limit++ + return nil + } + } + userMessages = append(userMessages, userMessage) + return nil + }) + } + it.Close() + return nil + }) + case maxID == 0 && minID != 0: + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getMessagePrefix(teamID, peerID, peerType) + opts.Reverse = false + it := txn.NewIterator(opts) + it.Seek(getMessageKey(teamID, peerID, peerType, minID)) + for ; it.ValidForPrefix(opts.Prefix); it.Next() { + if limit--; limit < 0 { + break + } + _ = it.Item().Value(func(val []byte) error { + userMessage := new(msg.UserMessage) + err := userMessage.Unmarshal(val) + if err != nil { + return err + } + if len(filters) > 0 { + if bypassFilter(it.Item().UserMeta(), filters...) { + // increase the limit counter since we are not going to use this message + limit++ + return nil + } + } + userMessages = append(userMessages, userMessage) + return nil + }) + } + it.Close() + sort.Slice(userMessages, func(i, j int) bool { + return userMessages[i].ID > userMessages[j].ID + }) + return nil + }) + default: + + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getMessagePrefix(teamID, peerID, peerType) + opts.Reverse = true + it := txn.NewIterator(opts) + it.Seek(getMessageKey(teamID, peerID, peerType, maxID)) + for ; it.ValidForPrefix(opts.Prefix); it.Next() { + if limit--; limit < 0 { + break + } + _ = it.Item().Value(func(val []byte) error { + userMessage := new(msg.UserMessage) + err := userMessage.Unmarshal(val) + if err != nil { + return err + } + if len(filters) > 0 { + if bypassFilter(it.Item().UserMeta(), filters...) { + // increase the limit counter since we are not going to use this message + limit++ + return nil + } + } + userMessages = append(userMessages, userMessage) + if userMessage.ID <= minID { + limit = 0 + } + return nil + }) + } + it.Close() + return nil + }) + + } + + users, groups = extractMessages(userMessages...) + return } func bypassFilter(userMeta byte, filters ...msg.ClientMediaType) bool { - byPass := true - for _, f := range filters { - if userMeta == byte(f) { - byPass = false - break - } - } - return byPass + byPass := true + for _, f := range filters { + if userMeta == byte(f) { + byPass = false + break + } + } + return byPass } func extractMessages(msgs ...*msg.UserMessage) (users []*msg.User, groups []*msg.Group) { - userIDs := domain.MInt64B{} - groupIDs := domain.MInt64B{} - for _, m := range msgs { - if m.PeerType == int32(msg.PeerType_PeerSelf) || m.PeerType == int32(msg.PeerType_PeerUser) { - userIDs[m.PeerID] = true - } - if m.PeerType == int32(msg.PeerType_PeerGroup) { - groupIDs[m.PeerID] = true - } - if m.SenderID > 0 { - userIDs[m.SenderID] = true - } - if m.FwdSenderID > 0 { - userIDs[m.FwdSenderID] = true - } - for _, userID := range domain.ExtractActionUserIDs(m.MessageAction, m.MessageActionData) { - userIDs[userID] = true - } - } - users, _ = Users.GetMany(userIDs.ToArray()) - groups, _ = Groups.GetMany(groupIDs.ToArray()) - return + userIDs := domain.MInt64B{} + groupIDs := domain.MInt64B{} + for _, m := range msgs { + if m.PeerType == int32(msg.PeerType_PeerSelf) || m.PeerType == int32(msg.PeerType_PeerUser) { + userIDs[m.PeerID] = true + } + if m.PeerType == int32(msg.PeerType_PeerGroup) { + groupIDs[m.PeerID] = true + } + if m.SenderID > 0 { + userIDs[m.SenderID] = true + } + if m.FwdSenderID > 0 { + userIDs[m.FwdSenderID] = true + } + for _, userID := range domain.ExtractActionUserIDs(m.MessageAction, m.MessageActionData) { + userIDs[userID] = true + } + } + users, _ = Users.GetMany(userIDs.ToArray()) + groups, _ = Groups.GetMany(groupIDs.ToArray()) + return } func (r *repoMessages) GetMediaMessageHistory( - teamID, peerID int64, peerType int32, minID, maxID int64, limit int32, cat msg.MediaCategory, + teamID, peerID int64, peerType int32, minID, maxID int64, limit int32, cat msg.MediaCategory, ) (userMessages []*msg.UserMessage, users []*msg.User, groups []*msg.Group) { - userMessages = make([]*msg.UserMessage, 0, limit) - switch { - case maxID == 0 && minID == 0: - dialog, err := Dialogs.Get(teamID, peerID, peerType) - if err != nil { - return - } - maxID = dialog.TopMessageID - fallthrough - case maxID > 0 && minID == 0: - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getMessagePrefix(teamID, peerID, peerType) - opts.Reverse = true - it := txn.NewIterator(opts) - it.Seek(getMessageKey(teamID, peerID, peerType, maxID)) - for ; it.ValidForPrefix(opts.Prefix); it.Next() { - if limit--; limit < 0 { - break - } - _ = it.Item().Value(func(val []byte) error { - userMessage := &msg.UserMessage{} - err := userMessage.Unmarshal(val) - if err != nil { - return err - } - - if userMessage.MediaCat == cat { - userMessages = append(userMessages, userMessage) - } else { - limit++ - } - - return nil - }) - } - it.Close() - return nil - }) - case minID > 0: - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getMessagePrefix(teamID, peerID, peerType) - it := txn.NewIterator(opts) - it.Seek(getMessageKey(teamID, peerID, peerType, minID)) - for ; it.ValidForPrefix(opts.Prefix); it.Next() { - if limit--; limit < 0 { - break - } - _ = it.Item().Value(func(val []byte) error { - userMessage := &msg.UserMessage{} - err := userMessage.Unmarshal(val) - if err != nil { - return err - } - - if userMessage.MediaCat == cat { - userMessages = append(userMessages, userMessage) - } else { - limit++ - } - - return nil - }) - } - it.Close() - return nil - }) - default: - - } - - users, groups = extractMessages(userMessages...) - return + userMessages = make([]*msg.UserMessage, 0, limit) + switch { + case maxID == 0 && minID == 0: + dialog, err := Dialogs.Get(teamID, peerID, peerType) + if err != nil { + return + } + maxID = dialog.TopMessageID + fallthrough + case maxID > 0 && minID == 0: + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getMessagePrefix(teamID, peerID, peerType) + opts.Reverse = true + it := txn.NewIterator(opts) + it.Seek(getMessageKey(teamID, peerID, peerType, maxID)) + for ; it.ValidForPrefix(opts.Prefix); it.Next() { + if limit--; limit < 0 { + break + } + _ = it.Item().Value(func(val []byte) error { + userMessage := &msg.UserMessage{} + err := userMessage.Unmarshal(val) + if err != nil { + return err + } + + if userMessage.MediaCat == cat { + userMessages = append(userMessages, userMessage) + } else { + limit++ + } + + return nil + }) + } + it.Close() + return nil + }) + case minID > 0: + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getMessagePrefix(teamID, peerID, peerType) + it := txn.NewIterator(opts) + it.Seek(getMessageKey(teamID, peerID, peerType, minID)) + for ; it.ValidForPrefix(opts.Prefix); it.Next() { + if limit--; limit < 0 { + break + } + _ = it.Item().Value(func(val []byte) error { + userMessage := &msg.UserMessage{} + err := userMessage.Unmarshal(val) + if err != nil { + return err + } + + if userMessage.MediaCat == cat { + userMessages = append(userMessages, userMessage) + } else { + limit++ + } + + return nil + }) + } + it.Close() + return nil + }) + default: + + } + + users, groups = extractMessages(userMessages...) + return } func (r *repoMessages) Delete(userID int64, teamID, peerID int64, peerType int32, msgIDs ...int64) { - sort.Slice(msgIDs, func(i, j int) bool { - return msgIDs[i] < msgIDs[j] - }) - _ = badgerUpdate(func(txn *badger.Txn) error { - // Update the Dialog if necessary - dialog, err := getDialog(txn, teamID, peerID, peerType) - if err != nil { - return err - } - - for _, msgID := range msgIDs { - if m, _ := getMessageByID(txn, msgID); m != nil { - for _, labelID := range m.LabelIDs { - _ = removeLabelFromMessage(txn, labelID, msgID) - _ = decreaseLabelItemCount(txn, teamID, labelID) - } - } - - // delete from messages - _ = txn.Delete(getMessageKey(teamID, peerID, peerType, msgID)) - - // delete from user messages - _ = txn.Delete(getUserMessageKey(msgID)) - } - - msgID := msgIDs[len(msgIDs)-1] - if dialog.TopMessageID == msgID { - opts := badger.DefaultIteratorOptions - opts.Prefix = getMessagePrefix(dialog.TeamID, dialog.PeerID, dialog.PeerType) - opts.Reverse = true - it := txn.NewIterator(opts) - it.Seek(getMessageKey(dialog.TeamID, dialog.PeerID, dialog.PeerType, dialog.TopMessageID)) - if it.ValidForPrefix(opts.Prefix) { - userMessage := new(msg.UserMessage) - _ = it.Item().Value(func(val []byte) error { - return userMessage.Unmarshal(val) - }) - dialog.TopMessageID = userMessage.ID - } - it.Close() - if dialog.TopMessageID == msgID { - // We used to delete dialog in this case but we are not deleting the dialog on last message anymore - // _ = txn.Delete(getDialogKey(teamID, peerID, peerType)) - indexMessageRemove(tools.ByteToStr(getMessageKey(teamID, peerID, peerType, msgID))) - return nil - } - } - - dialog.UnreadCount, dialog.MentionedCount, err = countDialogUnread(txn, dialog.TeamID, dialog.PeerID, dialog.PeerType, userID, dialog.ReadInboxMaxID+1) - if err != nil { - return err - } - err = saveDialog(txn, dialog) - if err != nil { - return err - } - - indexMessageRemove(tools.ByteToStr(getMessageKey(teamID, peerID, peerType, msgID))) - return nil - }) + sort.Slice(msgIDs, func(i, j int) bool { + return msgIDs[i] < msgIDs[j] + }) + _ = badgerUpdate(func(txn *badger.Txn) error { + // Update the Dialog if necessary + dialog, err := getDialog(txn, teamID, peerID, peerType) + if err != nil { + return err + } + + for _, msgID := range msgIDs { + if m, _ := getMessageByID(txn, msgID); m != nil { + for _, labelID := range m.LabelIDs { + _ = removeLabelFromMessage(txn, labelID, msgID) + _ = decreaseLabelItemCount(txn, teamID, labelID) + } + } + + // delete from messages + _ = txn.Delete(getMessageKey(teamID, peerID, peerType, msgID)) + + // delete from user messages + _ = txn.Delete(getUserMessageKey(msgID)) + } + + msgID := msgIDs[len(msgIDs)-1] + if dialog.TopMessageID == msgID { + opts := badger.DefaultIteratorOptions + opts.Prefix = getMessagePrefix(dialog.TeamID, dialog.PeerID, dialog.PeerType) + opts.Reverse = true + it := txn.NewIterator(opts) + it.Seek(getMessageKey(dialog.TeamID, dialog.PeerID, dialog.PeerType, dialog.TopMessageID)) + if it.ValidForPrefix(opts.Prefix) { + userMessage := new(msg.UserMessage) + _ = it.Item().Value(func(val []byte) error { + return userMessage.Unmarshal(val) + }) + dialog.TopMessageID = userMessage.ID + } + it.Close() + if dialog.TopMessageID == msgID { + // We used to delete dialog in this case but we are not deleting the dialog on last message anymore + // _ = txn.Delete(getDialogKey(teamID, peerID, peerType)) + indexMessageRemove(tools.ByteToStr(getMessageKey(teamID, peerID, peerType, msgID))) + return nil + } + } + + dialog.UnreadCount, dialog.MentionedCount, err = countDialogUnread(txn, dialog.TeamID, dialog.PeerID, dialog.PeerType, userID, dialog.ReadInboxMaxID+1) + if err != nil { + return err + } + err = saveDialog(txn, dialog) + if err != nil { + return err + } + + indexMessageRemove(tools.ByteToStr(getMessageKey(teamID, peerID, peerType, msgID))) + return nil + }) } func (r *repoMessages) ClearHistory(userID int64, teamID, peerID int64, peerType int32, maxID int64) error { - err := badgerUpdate(func(txn *badger.Txn) error { - st := r.badger.NewStream() - st.Prefix = getMessagePrefix(teamID, peerID, peerType) - st.NumGo = 10 - maxKey := getMessageKey(teamID, peerID, peerType, maxID) - st.ChooseKey = func(item *badger.Item) bool { - return bytes.Compare(item.Key(), maxKey) <= 0 - } - st.Send = func(kvList *pb.KVList) error { - for _, kv := range kvList.Kv { - um, _ := getMessageByKey(txn, kv.Key) - if um != nil { - for _, labelID := range um.LabelIDs { - _ = removeLabelFromMessage(txn, labelID, um.ID) - _ = decreaseLabelItemCount(txn, teamID, labelID) - } - } - _ = txn.Delete(kv.Key) - } - return nil - } - err := st.Orchestrate(context.Background()) - if err != nil { - return err - } - dialog, err := getDialog(txn, teamID, peerID, peerType) - if err != nil { - return err - } - dialog.UnreadCount, dialog.MentionedCount, err = countDialogUnread(txn, teamID, peerID, peerType, userID, maxID) - if err != nil { - return err - } - return saveDialog(txn, dialog) - }) - return err + err := badgerUpdate(func(txn *badger.Txn) error { + st := r.badger.NewStream() + st.Prefix = getMessagePrefix(teamID, peerID, peerType) + st.NumGo = 10 + maxKey := getMessageKey(teamID, peerID, peerType, maxID) + st.ChooseKey = func(item *badger.Item) bool { + return bytes.Compare(item.Key(), maxKey) <= 0 + } + st.Send = func(kvList *pb.KVList) error { + for _, kv := range kvList.Kv { + um, _ := getMessageByKey(txn, kv.Key) + if um != nil { + for _, labelID := range um.LabelIDs { + _ = removeLabelFromMessage(txn, labelID, um.ID) + _ = decreaseLabelItemCount(txn, teamID, labelID) + } + } + _ = txn.Delete(kv.Key) + } + return nil + } + err := st.Orchestrate(context.Background()) + if err != nil { + return err + } + dialog, err := getDialog(txn, teamID, peerID, peerType) + if err != nil { + return err + } + dialog.UnreadCount, dialog.MentionedCount, err = countDialogUnread(txn, teamID, peerID, peerType, userID, maxID) + if err != nil { + return err + } + return saveDialog(txn, dialog) + }) + return err } func (r *repoMessages) SetContentRead(peerID int64, peerType int32, messageIDs []int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, msgID := range messageIDs { - userMessage, err := getMessageByID(txn, msgID) - if err != nil { - return err - } - userMessage.ContentRead = true - err = saveMessage(txn, userMessage) - if err != nil { - return err - } - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, msgID := range messageIDs { + userMessage, err := getMessageByID(txn, msgID) + if err != nil { + return err + } + userMessage.ContentRead = true + err = saveMessage(txn, userMessage) + if err != nil { + return err + } + } + return nil + }) } func (r *repoMessages) GetTopMessageID(teamID, peerID int64, peerType int32) (int64, error) { - topMessageID := int64(0) - err := badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getMessagePrefix(teamID, peerID, peerType) - opts.Reverse = true - it := txn.NewIterator(opts) - it.Seek(getMessageKey(teamID, peerID, peerType, 2<<31)) - if it.ValidForPrefix(opts.Prefix) { - userMessage := new(msg.UserMessage) - _ = it.Item().Value(func(val []byte) error { - return userMessage.Unmarshal(val) - }) - topMessageID = userMessage.ID - } - it.Close() - return nil - }) - return topMessageID, err + topMessageID := int64(0) + err := badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getMessagePrefix(teamID, peerID, peerType) + opts.Reverse = true + it := txn.NewIterator(opts) + it.Seek(getMessageKey(teamID, peerID, peerType, 2<<31)) + if it.ValidForPrefix(opts.Prefix) { + userMessage := new(msg.UserMessage) + _ = it.Item().Value(func(val []byte) error { + return userMessage.Unmarshal(val) + }) + topMessageID = userMessage.ID + } + it.Close() + return nil + }) + return topMessageID, err } func (r *repoMessages) SearchText(teamID int64, text string, limit int32) []*msg.UserMessage { - userMessages := make([]*msg.UserMessage, 0, limit) - if r.msgSearch == nil { - return userMessages - } - t1 := bleve.NewTermQuery("msg") - t1.SetField("type") - qs := make([]query.Query, 0) - for _, term := range strings.Fields(text) { - qs = append(qs, bleve.NewMatchQuery(term), bleve.NewPrefixQuery(term), bleve.NewFuzzyQuery(term)) - } - t2 := bleve.NewDisjunctionQuery(qs...) - t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) - t3.SetField("team_id") - searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3)) - searchResult, _ := r.msgSearch.Search(searchRequest) - searchRequest.Size = int(limit) - _ = badgerView(func(txn *badger.Txn) error { - for _, hit := range searchResult.Hits { - userMessage, _ := getMessageByKey(txn, tools.StrToByte(hit.ID)) - if userMessage != nil && userMessage.TeamID == teamID { - userMessages = append(userMessages, userMessage) - } - } - return nil - }) - if len(userMessages) > int(limit) { - userMessages = userMessages[:limit] - } - return userMessages + userMessages := make([]*msg.UserMessage, 0, limit) + if r.msgSearch == nil { + return userMessages + } + t1 := bleve.NewTermQuery("msg") + t1.SetField("type") + qs := make([]query.Query, 0) + for _, term := range strings.Fields(text) { + qs = append(qs, bleve.NewMatchQuery(term), bleve.NewPrefixQuery(term), bleve.NewFuzzyQuery(term)) + } + t2 := bleve.NewDisjunctionQuery(qs...) + t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) + t3.SetField("team_id") + searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3)) + searchResult, _ := r.msgSearch.Search(searchRequest) + searchRequest.Size = int(limit) + _ = badgerView(func(txn *badger.Txn) error { + for _, hit := range searchResult.Hits { + userMessage, _ := getMessageByKey(txn, tools.StrToByte(hit.ID)) + if userMessage != nil && userMessage.TeamID == teamID { + userMessages = append(userMessages, userMessage) + } + } + return nil + }) + if len(userMessages) > int(limit) { + userMessages = userMessages[:limit] + } + return userMessages } func (r *repoMessages) SearchTextByPeerID(teamID int64, text string, peerID int64, limit int32) []*msg.UserMessage { - userMessages := make([]*msg.UserMessage, 0, limit) - if r.msgSearch == nil { - return userMessages - } - - t1 := bleve.NewTermQuery("msg") - t1.SetField("type") - qs := make([]query.Query, 0) - for _, term := range strings.Fields(text) { - qs = append(qs, bleve.NewMatchQuery(term), bleve.NewPrefixQuery(term), bleve.NewFuzzyQuery(term)) - } - t2 := bleve.NewDisjunctionQuery(qs...) - t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(peerID))) - t3.SetField("peer_id") - t4 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) - t4.SetField("team_id") - searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3, t4)) - searchResult, _ := r.msgSearch.Search(searchRequest) - _ = badgerView(func(txn *badger.Txn) error { - for _, hit := range searchResult.Hits { - userMessage, _ := getMessageByKey(txn, tools.StrToByte(hit.ID)) - if userMessage != nil && userMessage.TeamID == teamID { - userMessages = append(userMessages, userMessage) - } - } - return nil - }) - - if len(userMessages) > int(limit) { - userMessages = userMessages[:limit] - } - return userMessages + userMessages := make([]*msg.UserMessage, 0, limit) + if r.msgSearch == nil { + return userMessages + } + + t1 := bleve.NewTermQuery("msg") + t1.SetField("type") + qs := make([]query.Query, 0) + for _, term := range strings.Fields(text) { + qs = append(qs, bleve.NewMatchQuery(term), bleve.NewPrefixQuery(term), bleve.NewFuzzyQuery(term)) + } + t2 := bleve.NewDisjunctionQuery(qs...) + t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(peerID))) + t3.SetField("peer_id") + t4 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) + t4.SetField("team_id") + searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3, t4)) + searchResult, _ := r.msgSearch.Search(searchRequest) + _ = badgerView(func(txn *badger.Txn) error { + for _, hit := range searchResult.Hits { + userMessage, _ := getMessageByKey(txn, tools.StrToByte(hit.ID)) + if userMessage != nil && userMessage.TeamID == teamID { + userMessages = append(userMessages, userMessage) + } + } + return nil + }) + + if len(userMessages) > int(limit) { + userMessages = userMessages[:limit] + } + return userMessages } func (r *repoMessages) SearchByLabels(teamID int64, labelIDs []int32, peerID int64, limit int32) []*msg.UserMessage { - userMessages := make([]*msg.UserMessage, 0, limit) - _ = badgerView(func(txn *badger.Txn) error { - st := r.badger.NewStream() - st.Prefix = tools.StrToByte(prefixMessages) - st.ChooseKey = func(item *badger.Item) bool { - m := &msg.UserMessage{} - err := item.Value(func(val []byte) error { - return m.Unmarshal(val) - }) - if err != nil { - return false - } - if m.TeamID != teamID { - return false - } - if len(m.LabelIDs) < len(labelIDs) { - return false - } - var found bool - for _, li := range labelIDs { - found = false - for _, lj := range m.LabelIDs { - if li == lj { - found = true - break - } - } - if !found { - return false - } - } - return true - } - st.Send = func(list *pb.KVList) error { - if int32(len(userMessages)) > limit { - return nil - } - for _, kv := range list.Kv { - m := &msg.UserMessage{} - if err := m.Unmarshal(kv.Value); err == nil { - if peerID == 0 { - userMessages = append(userMessages, m) - } else if m.PeerID == peerID { - userMessages = append(userMessages, m) - } - } - } - return nil - } - return st.Orchestrate(context.Background()) - }) - return userMessages + userMessages := make([]*msg.UserMessage, 0, limit) + _ = badgerView(func(txn *badger.Txn) error { + st := r.badger.NewStream() + st.Prefix = tools.StrToByte(prefixMessages) + st.ChooseKey = func(item *badger.Item) bool { + m := &msg.UserMessage{} + err := item.Value(func(val []byte) error { + return m.Unmarshal(val) + }) + if err != nil { + return false + } + if m.TeamID != teamID { + return false + } + if len(m.LabelIDs) < len(labelIDs) { + return false + } + var found bool + for _, li := range labelIDs { + found = false + for _, lj := range m.LabelIDs { + if li == lj { + found = true + break + } + } + if !found { + return false + } + } + return true + } + st.Send = func(list *pb.KVList) error { + if int32(len(userMessages)) > limit { + return nil + } + for _, kv := range list.Kv { + m := &msg.UserMessage{} + if err := m.Unmarshal(kv.Value); err == nil { + if peerID == 0 { + userMessages = append(userMessages, m) + } else if m.PeerID == peerID { + userMessages = append(userMessages, m) + } + } + } + return nil + } + return st.Orchestrate(context.Background()) + }) + return userMessages } func (r *repoMessages) GetAllMedia(documentType msg.ClientMediaType) ([]*msg.UserMessage, error) { - limit := 500 - msgMtx := sync.Mutex{} - userMessages := make([]*msg.UserMessage, 0, limit) - - stream := r.badger.NewStream() - stream.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixMessages)) - stream.ChooseKey = func(item *badger.Item) bool { - if item.UserMeta() == byte(documentType) { - m := &msg.UserMessage{} - err := item.Value(func(val []byte) error { - return m.Unmarshal(val) - }) - if err != nil { - return false - } - - msgMtx.Lock() - userMessages = append(userMessages, m) - msgMtx.Unlock() - return true - } - - return false - } - - stream.Send = func(list *pb.KVList) error { - return nil - } - - _ = stream.Orchestrate(context.Background()) - - return userMessages, nil + limit := 500 + msgMtx := sync.Mutex{} + userMessages := make([]*msg.UserMessage, 0, limit) + + stream := r.badger.NewStream() + stream.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixMessages)) + stream.ChooseKey = func(item *badger.Item) bool { + if item.UserMeta() == byte(documentType) { + m := &msg.UserMessage{} + err := item.Value(func(val []byte) error { + return m.Unmarshal(val) + }) + if err != nil { + return false + } + + msgMtx.Lock() + userMessages = append(userMessages, m) + msgMtx.Unlock() + return true + } + + return false + } + + stream.Send = func(list *pb.KVList) error { + return nil + } + + _ = stream.Orchestrate(context.Background()) + + return userMessages, nil } func (r *repoMessages) SearchBySender(teamID int64, text string, senderID int64, peerID int64, limit int32) []*msg.UserMessage { - userMessages := make([]*msg.UserMessage, 0, limit) - - if r.msgSearch == nil { - return userMessages - } - - t1 := bleve.NewTermQuery("msg") - t1.SetField("type") - - var t2 *query.DisjunctionQuery - if len(text) != 0 { - qs := make([]query.Query, 0) - for _, term := range strings.Fields(text) { - qs = append(qs, bleve.NewMatchQuery(term), bleve.NewPrefixQuery(term), bleve.NewFuzzyQuery(term)) - } - t2 = bleve.NewDisjunctionQuery(qs...) - } - - t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(peerID))) - t3.SetField("peer_id") - - t4 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(senderID))) - t4.SetField("sender_id") - - t5 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) - t5.SetField("team_id") - - var searchRequest *bleve.SearchRequest - if t2 != nil { - searchRequest = bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3, t4, t5)) - } else { - searchRequest = bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t3, t4, t5)) - } - - searchRequest.Size = int(limit) - searchRequest.SortBy([]string{"_id"}) - searchResult, _ := r.msgSearch.Search(searchRequest) - _ = badgerView(func(txn *badger.Txn) error { - for _, hit := range searchResult.Hits { - userMessage, _ := getMessageByKey(txn, tools.StrToByte(hit.ID)) - if userMessage != nil && userMessage.TeamID == teamID { - userMessages = append(userMessages, userMessage) - } - } - return nil - }) - - if len(userMessages) > int(limit) { - userMessages = userMessages[:limit] - } - return userMessages + userMessages := make([]*msg.UserMessage, 0, limit) + + if r.msgSearch == nil { + return userMessages + } + + t1 := bleve.NewTermQuery("msg") + t1.SetField("type") + + var t2 *query.DisjunctionQuery + if len(text) != 0 { + qs := make([]query.Query, 0) + for _, term := range strings.Fields(text) { + qs = append(qs, bleve.NewMatchQuery(term), bleve.NewPrefixQuery(term), bleve.NewFuzzyQuery(term)) + } + t2 = bleve.NewDisjunctionQuery(qs...) + } + + t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(peerID))) + t3.SetField("peer_id") + + t4 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(senderID))) + t4.SetField("sender_id") + + t5 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) + t5.SetField("team_id") + + var searchRequest *bleve.SearchRequest + if t2 != nil { + searchRequest = bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3, t4, t5)) + } else { + searchRequest = bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t3, t4, t5)) + } + + searchRequest.Size = int(limit) + searchRequest.SortBy([]string{"_id"}) + searchResult, _ := r.msgSearch.Search(searchRequest) + _ = badgerView(func(txn *badger.Txn) error { + for _, hit := range searchResult.Hits { + userMessage, _ := getMessageByKey(txn, tools.StrToByte(hit.ID)) + if userMessage != nil && userMessage.TeamID == teamID { + userMessages = append(userMessages, userMessage) + } + } + return nil + }) + + if len(userMessages) > int(limit) { + userMessages = userMessages[:limit] + } + return userMessages } func (r *repoMessages) GetLastBotKeyboard(teamID, peerID int64, peerType int32) (*msg.UserMessage, error) { - limit := 1000 - - var keyboardMessage *msg.UserMessage - stop := false - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.PrefetchValues = false - opts.Prefix = getMessagePrefix(teamID, peerID, peerType) - opts.Reverse = true - it := txn.NewIterator(opts) - for it.Seek(getMessageKey(teamID, peerID, peerType, 1<<31)); it.ValidForPrefix(opts.Prefix); it.Next() { - if limit--; limit < 0 || stop { - break - } - - _ = it.Item().Value(func(val []byte) error { - userMessage := new(msg.UserMessage) - err := userMessage.Unmarshal(val) - if err != nil { - return err - } - - if userMessage.SenderID == userMessage.PeerID { - if userMessage.ReplyMarkup == msg.C_ReplyKeyboardMarkup || userMessage.ReplyMarkup == msg.C_ReplyKeyboardForceReply { - keyboardMessage = userMessage - } - stop = true - } - return nil - }) - } - it.Close() - return nil - }) - - return keyboardMessage, nil + limit := 1000 + + var keyboardMessage *msg.UserMessage + stop := false + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.PrefetchValues = false + opts.Prefix = getMessagePrefix(teamID, peerID, peerType) + opts.Reverse = true + it := txn.NewIterator(opts) + for it.Seek(getMessageKey(teamID, peerID, peerType, 1<<31)); it.ValidForPrefix(opts.Prefix); it.Next() { + if limit--; limit < 0 || stop { + break + } + + _ = it.Item().Value(func(val []byte) error { + userMessage := new(msg.UserMessage) + err := userMessage.Unmarshal(val) + if err != nil { + return err + } + + if userMessage.SenderID == userMessage.PeerID { + if userMessage.ReplyMarkup == msg.C_ReplyKeyboardMarkup || userMessage.ReplyMarkup == msg.C_ReplyKeyboardForceReply { + keyboardMessage = userMessage + } + stop = true + } + return nil + }) + } + it.Close() + return nil + }) + + return keyboardMessage, nil } func (r *repoMessages) ReIndex() error { - err := tools.Try(10, time.Second, func() error { - if r.msgSearch == nil { - return domain.ErrDoesNotExists - } - return nil - }) - if err != nil { - return err - } - return badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(prefixMessages) - it := txn.NewIterator(opts) - for it.Rewind(); it.Valid(); it.Next() { - _ = it.Item().Value(func(val []byte) error { - message := &msg.UserMessage{} - _ = message.Unmarshal(val) - msgKey := tools.ByteToStr(getMessageKey(message.TeamID, message.PeerID, message.PeerType, message.ID)) - if d, _ := r.msgSearch.Document(msgKey); d == nil { - indexMessage( - msgKey, - MessageSearch{ - Type: "msg", - Body: message.Body, - PeerID: fmt.Sprintf("%d", message.PeerID), - SenderID: fmt.Sprintf("%d", message.SenderID), - TeamID: fmt.Sprintf("%d", message.TeamID), - }, - ) - } - return nil - }) - } - it.Close() - return nil - }) + err := tools.Try(10, time.Second, func() error { + if r.msgSearch == nil { + return domain.ErrDoesNotExists + } + return nil + }) + if err != nil { + return err + } + return badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(prefixMessages) + it := txn.NewIterator(opts) + for it.Rewind(); it.Valid(); it.Next() { + _ = it.Item().Value(func(val []byte) error { + message := &msg.UserMessage{} + _ = message.Unmarshal(val) + msgKey := tools.ByteToStr(getMessageKey(message.TeamID, message.PeerID, message.PeerType, message.ID)) + if d, _ := r.msgSearch.Document(msgKey); d == nil { + indexMessage( + msgKey, + MessageSearch{ + Type: "msg", + Body: message.Body, + PeerID: fmt.Sprintf("%d", message.PeerID), + SenderID: fmt.Sprintf("%d", message.SenderID), + TeamID: fmt.Sprintf("%d", message.TeamID), + }, + ) + } + return nil + }) + } + it.Close() + return nil + }) } diff --git a/internal/repo/messages_extra.go b/internal/repo/messages_extra.go index c2ce9fa2..9dffa305 100644 --- a/internal/repo/messages_extra.go +++ b/internal/repo/messages_extra.go @@ -1,95 +1,96 @@ package repo import ( - "encoding/json" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" + "encoding/json" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) const ( - prefixMessageExtra = "MSG_EX" + prefixMessageExtra = "MSG_EX" ) type MessagesExtraItem struct { - PeerID int64 `json:"PeerID"` - PeerType int32 `json:"PeerType"` - ScrollID int64 `json:"ScrollID"` - Holes []byte `json:"Holes"` + PeerID int64 `json:"PeerID"` + PeerType int32 `json:"PeerType"` + ScrollID int64 `json:"ScrollID"` + Holes []byte `json:"Holes"` } type repoMessagesExtra struct { - *repository + *repository } func (r *repoMessagesExtra) getKey(teamID, peerID int64, peerType int32, cat msg.MediaCategory) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixMessageExtra) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - z.AppendStrInt64(sb, peerID) - z.AppendStrInt32(sb, peerType) - z.AppendStrInt32(sb, int32(cat)) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixMessageExtra) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + z.AppendStrInt64(sb, peerID) + z.AppendStrInt32(sb, peerType) + z.AppendStrInt32(sb, int32(cat)) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func (r *repoMessagesExtra) get(teamID, peerID int64, peerType int32, cat msg.MediaCategory) *MessagesExtraItem { - message := &MessagesExtraItem{} - _ = badgerView(func(txn *badger.Txn) error { - item, err := txn.Get(r.getKey(teamID, peerID, peerType, cat)) - if err != nil { - return err - } - return item.Value(func(val []byte) error { - return json.Unmarshal(val, message) - }) - }) - return message + message := &MessagesExtraItem{} + _ = badgerView(func(txn *badger.Txn) error { + item, err := txn.Get(r.getKey(teamID, peerID, peerType, cat)) + if err != nil { + return err + } + return item.Value(func(val []byte) error { + return json.Unmarshal(val, message) + }) + }) + return message } func (r *repoMessagesExtra) save(key []byte, m *MessagesExtraItem) { - bytes, _ := json.Marshal(m) - _ = badgerUpdate(func(txn *badger.Txn) error { - return txn.SetEntry(badger.NewEntry(key, bytes)) - }) + bytes, _ := json.Marshal(m) + _ = badgerUpdate(func(txn *badger.Txn) error { + return txn.SetEntry(badger.NewEntry(key, bytes)) + }) } func (r *repoMessagesExtra) SaveScrollID(teamID, peerID int64, peerType int32, cat msg.MediaCategory, msgID int64) { - key := r.getKey(teamID, peerID, peerType, cat) - m := r.get(teamID, peerID, peerType, cat) - if m == nil { - return - } - m.ScrollID = msgID - r.save(key, m) + key := r.getKey(teamID, peerID, peerType, cat) + m := r.get(teamID, peerID, peerType, cat) + if m == nil { + return + } + m.ScrollID = msgID + r.save(key, m) } func (r *repoMessagesExtra) GetScrollID(teamID, peerID int64, peerType int32, cat msg.MediaCategory) int64 { - m := r.get(teamID, peerID, peerType, cat) - if m == nil { - return 0 - } - return m.ScrollID + m := r.get(teamID, peerID, peerType, cat) + if m == nil { + return 0 + } + return m.ScrollID } func (r *repoMessagesExtra) SaveHoles(teamID, peerID int64, peerType int32, cat msg.MediaCategory, data []byte) { - key := r.getKey(teamID, peerID, peerType, cat) - m := r.get(teamID, peerID, peerType, cat) - if m == nil { - return - } - m.Holes = data - r.save(key, m) + key := r.getKey(teamID, peerID, peerType, cat) + m := r.get(teamID, peerID, peerType, cat) + if m == nil { + return + } + m.Holes = data + r.save(key, m) } func (r *repoMessagesExtra) GetHoles(teamID, peerID int64, peerType int32, cat msg.MediaCategory) []byte { - m := r.get(teamID, peerID, peerType, cat) - if m == nil { - return nil - } - return m.Holes + m := r.get(teamID, peerID, peerType, cat) + if m == nil { + return nil + } + return m.Holes } diff --git a/internal/repo/messages_pending.go b/internal/repo/messages_pending.go index 7e581a14..f6b75b35 100644 --- a/internal/repo/messages_pending.go +++ b/internal/repo/messages_pending.go @@ -1,576 +1,579 @@ package repo import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" - "time" + "fmt" + "time" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) const ( - prefixPMessagesByID = "PMSG_ID" - prefixPMessagesByRandomID = "PMSG_RND" - prefixPMessagesByRealID = "PMSG_RID" + prefixPMessagesByID = "PMSG_ID" + prefixPMessagesByRandomID = "PMSG_RND" + prefixPMessagesByRealID = "PMSG_RID" ) type repoMessagesPending struct { - *repository + *repository } func getPendingMessageKey(msgID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixPMessagesByID) - sb.WriteRune('.') - z.AppendStrInt64(sb, z.AbsInt64(msgID)) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixPMessagesByID) + sb.WriteRune('.') + z.AppendStrInt64(sb, z.AbsInt64(msgID)) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getPendingMessageRandomKey(randomID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixPMessagesByRandomID) - sb.WriteRune('.') - z.AppendStrInt64(sb, z.AbsInt64(randomID)) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixPMessagesByRandomID) + sb.WriteRune('.') + z.AppendStrInt64(sb, z.AbsInt64(randomID)) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getPendingMessageRealKey(msgID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixPMessagesByRealID) - sb.WriteRune('.') - z.AppendStrInt64(sb, msgID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixPMessagesByRealID) + sb.WriteRune('.') + z.AppendStrInt64(sb, msgID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getPendingMessageByID(txn *badger.Txn, msgID int64) (*msg.ClientPendingMessage, error) { - pm := &msg.ClientPendingMessage{} - item, err := txn.Get(getPendingMessageKey(msgID)) - switch err { - case nil: - case badger.ErrKeyNotFound: - return nil, domain.ErrNotFound - default: - return nil, err - - } - - err = item.Value(func(val []byte) error { - return pm.Unmarshal(val) - }) - if err != nil { - return nil, err - } - - return pm, nil + pm := &msg.ClientPendingMessage{} + item, err := txn.Get(getPendingMessageKey(msgID)) + switch err { + case nil: + case badger.ErrKeyNotFound: + return nil, domain.ErrNotFound + default: + return nil, err + + } + + err = item.Value(func(val []byte) error { + return pm.Unmarshal(val) + }) + if err != nil { + return nil, err + } + + return pm, nil } func deletePendingMessage(txn *badger.Txn, msgID int64) error { - pm, err := getPendingMessageByID(txn, msgID) - if err != nil { - return err - } - err = txn.Delete(getPendingMessageKey(pm.ID)) - if err != nil { - return err - } - err = txn.Delete(getPendingMessageRandomKey(pm.RequestID)) - return err + pm, err := getPendingMessageByID(txn, msgID) + if err != nil { + return err + } + err = txn.Delete(getPendingMessageKey(pm.ID)) + if err != nil { + return err + } + err = txn.Delete(getPendingMessageRandomKey(pm.RequestID)) + return err } func (r *repoMessagesPending) Save( - teamID int64, teamAccess uint64, msgID int64, senderID int64, message *msg.MessagesSend, + teamID int64, teamAccess uint64, msgID int64, senderID int64, message *msg.MessagesSend, ) (*msg.ClientPendingMessage, error) { - if message == nil { - return nil, domain.ErrNotFound - } - pm := &msg.ClientPendingMessage{ - TeamID: teamID, - TeamAccessHash: teamAccess, - AccessHash: message.Peer.AccessHash, - Body: message.Body, - PeerID: message.Peer.ID, - PeerType: int32(message.Peer.Type), - ReplyTo: message.ReplyTo, - RequestID: message.RandomID, - Entities: message.Entities, - ClearDraft: message.ClearDraft, - // Filled by SDK - CreatedOn: domain.Now().Unix(), - SenderID: senderID, - ID: msgID, - } - - bytes, _ := pm.Marshal() - _ = badgerUpdate(func(txn *badger.Txn) error { - err := txn.SetEntry(badger.NewEntry( - getPendingMessageKey(pm.ID), bytes), - ) - if err != nil { - return err - } - return txn.SetEntry(badger.NewEntry( - getPendingMessageRandomKey(pm.RequestID), bytes), - ) - }) - - _ = updateDialogLastUpdate(pm.TeamID, pm.PeerID, pm.PeerType, pm.CreatedOn) - - return pm, nil + if message == nil { + return nil, domain.ErrNotFound + } + pm := &msg.ClientPendingMessage{ + TeamID: teamID, + TeamAccessHash: teamAccess, + AccessHash: message.Peer.AccessHash, + Body: message.Body, + PeerID: message.Peer.ID, + PeerType: int32(message.Peer.Type), + ReplyTo: message.ReplyTo, + RequestID: message.RandomID, + Entities: message.Entities, + ClearDraft: message.ClearDraft, + // Filled by SDK + CreatedOn: domain.Now().Unix(), + SenderID: senderID, + ID: msgID, + } + + bytes, _ := pm.Marshal() + _ = badgerUpdate(func(txn *badger.Txn) error { + err := txn.SetEntry(badger.NewEntry( + getPendingMessageKey(pm.ID), bytes), + ) + if err != nil { + return err + } + return txn.SetEntry(badger.NewEntry( + getPendingMessageRandomKey(pm.RequestID), bytes), + ) + }) + + _ = updateDialogLastUpdate(pm.TeamID, pm.PeerID, pm.PeerType, pm.CreatedOn) + + return pm, nil } func (r *repoMessagesPending) SaveClientMessageMedia( - teamID int64, teamAccess uint64, - msgID, senderID, requestID, fileID, thumbID int64, msgMedia *msg.ClientSendMessageMedia, fileSha256 []byte, + teamID int64, teamAccess uint64, + msgID, senderID, requestID, fileID, thumbID int64, msgMedia *msg.ClientSendMessageMedia, fileSha256 []byte, ) (*msg.ClientPendingMessage, error) { - if msgMedia == nil { - return nil, domain.ErrNotFound - } - - msgMedia.FileTotalParts = 0 - - pm := &msg.ClientPendingMessage{ - ID: msgID, - TeamID: teamID, - TeamAccessHash: teamAccess, - PeerID: msgMedia.Peer.ID, - PeerType: int32(msgMedia.Peer.Type), - AccessHash: msgMedia.Peer.AccessHash, - Body: msgMedia.Caption, - ReplyTo: msgMedia.ReplyTo, - ClearDraft: msgMedia.ClearDraft, - MediaType: msgMedia.MediaType, - SenderID: senderID, - CreatedOn: domain.Now().Unix(), - RequestID: requestID, - FileUploadID: fmt.Sprintf("%d", fileID), - FileID: fileID, - Sha256: fileSha256, - TinyThumb: msgMedia.TinyThumb, - } - pm.Media, _ = msgMedia.Marshal() - - if thumbID > 0 { - pm.ThumbID = thumbID - pm.ThumbUploadID = fmt.Sprintf("%d", thumbID) - } - - bytes, _ := pm.Marshal() - err := badgerUpdate(func(txn *badger.Txn) error { - // 1. Save PendingMessage by ID - err := txn.SetEntry(badger.NewEntry( - getPendingMessageKey(pm.ID), bytes), - ) - if err != nil { - return err - } - - // 2. Save PendingMessage by RequestID/RandomID - return txn.SetEntry(badger.NewEntry( - getPendingMessageRandomKey(pm.RequestID), bytes), - ) - }) - - if err != nil { - return nil, err - } - - _ = updateDialogLastUpdate(pm.TeamID, pm.PeerID, pm.PeerType, pm.CreatedOn) - - return pm, nil + if msgMedia == nil { + return nil, domain.ErrNotFound + } + + msgMedia.FileTotalParts = 0 + + pm := &msg.ClientPendingMessage{ + ID: msgID, + TeamID: teamID, + TeamAccessHash: teamAccess, + PeerID: msgMedia.Peer.ID, + PeerType: int32(msgMedia.Peer.Type), + AccessHash: msgMedia.Peer.AccessHash, + Body: msgMedia.Caption, + ReplyTo: msgMedia.ReplyTo, + ClearDraft: msgMedia.ClearDraft, + MediaType: msgMedia.MediaType, + SenderID: senderID, + CreatedOn: domain.Now().Unix(), + RequestID: requestID, + FileUploadID: fmt.Sprintf("%d", fileID), + FileID: fileID, + Sha256: fileSha256, + TinyThumb: msgMedia.TinyThumb, + } + pm.Media, _ = msgMedia.Marshal() + + if thumbID > 0 { + pm.ThumbID = thumbID + pm.ThumbUploadID = fmt.Sprintf("%d", thumbID) + } + + bytes, _ := pm.Marshal() + err := badgerUpdate(func(txn *badger.Txn) error { + // 1. Save PendingMessage by ID + err := txn.SetEntry(badger.NewEntry( + getPendingMessageKey(pm.ID), bytes), + ) + if err != nil { + return err + } + + // 2. Save PendingMessage by RequestID/RandomID + return txn.SetEntry(badger.NewEntry( + getPendingMessageRandomKey(pm.RequestID), bytes), + ) + }) + + if err != nil { + return nil, err + } + + _ = updateDialogLastUpdate(pm.TeamID, pm.PeerID, pm.PeerType, pm.CreatedOn) + + return pm, nil } -func (r *repoMessagesPending) UpdateClientMessageMedia(pm *msg.ClientPendingMessage, totalParts int32, mediaType msg.InputMediaType, fileLocation *msg.FileLocation) error { - csmm := new(msg.ClientSendMessageMedia) - _ = csmm.Unmarshal(pm.Media) - csmm.FileTotalParts = totalParts - pm.Media, _ = csmm.Marshal() - pm.ServerFile = fileLocation - pm.MediaType = mediaType - - bytes, _ := pm.Marshal() - return badgerUpdate(func(txn *badger.Txn) error { - err := txn.SetEntry(badger.NewEntry( - getPendingMessageKey(pm.ID), bytes), - ) - if err != nil { - return err - } - return txn.SetEntry(badger.NewEntry( - getPendingMessageRandomKey(pm.RequestID), bytes), - ) - }) +func (r *repoMessagesPending) UpdateClientMessageMedia( + pm *msg.ClientPendingMessage, totalParts int32, mediaType msg.InputMediaType, fileLocation *msg.FileLocation, +) error { + csmm := new(msg.ClientSendMessageMedia) + _ = csmm.Unmarshal(pm.Media) + csmm.FileTotalParts = totalParts + pm.Media, _ = csmm.Marshal() + pm.ServerFile = fileLocation + pm.MediaType = mediaType + + bytes, _ := pm.Marshal() + return badgerUpdate(func(txn *badger.Txn) error { + err := txn.SetEntry(badger.NewEntry( + getPendingMessageKey(pm.ID), bytes), + ) + if err != nil { + return err + } + return txn.SetEntry(badger.NewEntry( + getPendingMessageRandomKey(pm.RequestID), bytes), + ) + }) } func (r *repoMessagesPending) SaveMessageMedia( - teamID int64, teamAccess uint64, msgID int64, senderID int64, msgMedia *msg.MessagesSendMedia, + teamID int64, teamAccess uint64, msgID int64, senderID int64, msgMedia *msg.MessagesSendMedia, ) (*msg.ClientPendingMessage, error) { - if msgMedia == nil { - return nil, domain.ErrNotFound - } - - pm := &msg.ClientPendingMessage{ - PeerID: msgMedia.Peer.ID, - PeerType: int32(msgMedia.Peer.Type), - AccessHash: msgMedia.Peer.AccessHash, - ReplyTo: msgMedia.ReplyTo, - ClearDraft: msgMedia.ClearDraft, - MediaType: msgMedia.MediaType, - Media: msgMedia.MediaData, - ID: msgID, - TeamID: teamID, - TeamAccessHash: teamAccess, - SenderID: senderID, - CreatedOn: time.Now().Unix(), - RequestID: msgMedia.RandomID, - } - - bytes, _ := pm.Marshal() - _ = badgerUpdate(func(txn *badger.Txn) error { - err := txn.SetEntry(badger.NewEntry( - getPendingMessageKey(pm.ID), bytes), - ) - if err != nil { - return err - } - return txn.SetEntry(badger.NewEntry( - getPendingMessageRandomKey(pm.RequestID), bytes), - ) - }) - - _ = updateDialogLastUpdate(pm.TeamID, pm.PeerID, pm.PeerType, pm.CreatedOn) - - return pm, nil + if msgMedia == nil { + return nil, domain.ErrNotFound + } + + pm := &msg.ClientPendingMessage{ + PeerID: msgMedia.Peer.ID, + PeerType: int32(msgMedia.Peer.Type), + AccessHash: msgMedia.Peer.AccessHash, + ReplyTo: msgMedia.ReplyTo, + ClearDraft: msgMedia.ClearDraft, + MediaType: msgMedia.MediaType, + Media: msgMedia.MediaData, + ID: msgID, + TeamID: teamID, + TeamAccessHash: teamAccess, + SenderID: senderID, + CreatedOn: time.Now().Unix(), + RequestID: msgMedia.RandomID, + } + + bytes, _ := pm.Marshal() + _ = badgerUpdate(func(txn *badger.Txn) error { + err := txn.SetEntry(badger.NewEntry( + getPendingMessageKey(pm.ID), bytes), + ) + if err != nil { + return err + } + return txn.SetEntry(badger.NewEntry( + getPendingMessageRandomKey(pm.RequestID), bytes), + ) + }) + + _ = updateDialogLastUpdate(pm.TeamID, pm.PeerID, pm.PeerType, pm.CreatedOn) + + return pm, nil } func (r *repoMessagesPending) GetByRealID(msgID int64) *msg.ClientPendingMessage { - pm := new(msg.ClientPendingMessage) - err := badgerView(func(txn *badger.Txn) error { - item, err := txn.Get(getPendingMessageRealKey(msgID)) - if err != nil { - return err - } - return item.Value(func(val []byte) error { - return pm.Unmarshal(val) - }) - }) - if err != nil { - return nil - } - return pm + pm := new(msg.ClientPendingMessage) + err := badgerView(func(txn *badger.Txn) error { + item, err := txn.Get(getPendingMessageRealKey(msgID)) + if err != nil { + return err + } + return item.Value(func(val []byte) error { + return pm.Unmarshal(val) + }) + }) + if err != nil { + return nil + } + return pm } func (r *repoMessagesPending) GetByRandomID(randomID int64) (*msg.ClientPendingMessage, error) { - pm := new(msg.ClientPendingMessage) - err := badgerView(func(txn *badger.Txn) error { - item, err := txn.Get(getPendingMessageRandomKey(randomID)) - if err != nil { - return err - } - return item.Value(func(val []byte) error { - return pm.Unmarshal(val) - }) - }) - if err != nil { - return nil, err - } - - return pm, nil + pm := new(msg.ClientPendingMessage) + err := badgerView(func(txn *badger.Txn) error { + item, err := txn.Get(getPendingMessageRandomKey(randomID)) + if err != nil { + return err + } + return item.Value(func(val []byte) error { + return pm.Unmarshal(val) + }) + }) + if err != nil { + return nil, err + } + + return pm, nil } func (r *repoMessagesPending) GetByID(msgID int64) (pm *msg.ClientPendingMessage, err error) { - err = badgerView(func(txn *badger.Txn) error { - pm, err = getPendingMessageByID(txn, msgID) - return err - }) - return + err = badgerView(func(txn *badger.Txn) error { + pm, err = getPendingMessageByID(txn, msgID) + return err + }) + return } func (r *repoMessagesPending) GetMany(messageIDs []int64) []*msg.UserMessage { - userMessages := make([]*msg.UserMessage, 0, len(messageIDs)) - _ = badgerView(func(txn *badger.Txn) error { - for _, msgID := range messageIDs { - pm, _ := getPendingMessageByID(txn, msgID) - if pm != nil { - userMessages = append(userMessages, r.ToUserMessage(pm)) - } - } - return nil - }) - return userMessages + userMessages := make([]*msg.UserMessage, 0, len(messageIDs)) + _ = badgerView(func(txn *badger.Txn) error { + for _, msgID := range messageIDs { + pm, _ := getPendingMessageByID(txn, msgID) + if pm != nil { + userMessages = append(userMessages, r.ToUserMessage(pm)) + } + } + return nil + }) + return userMessages } func (r *repoMessagesPending) GetByPeer(teamID int64, peerID int64, peerType int32) []*msg.UserMessage { - userMessages := make([]*msg.UserMessage, 0, 10) - _ = badgerUpdate(func(txn *badger.Txn) error { - opt := badger.DefaultIteratorOptions - opt.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPMessagesByID)) - it := txn.NewIterator(opt) - for it.Rewind(); it.Valid(); it.Next() { - _ = it.Item().Value(func(val []byte) error { - pm := new(msg.ClientPendingMessage) - _ = pm.Unmarshal(val) - if pm.PeerID == peerID && pm.PeerType == peerType && pm.TeamID == teamID { - userMessages = append(userMessages, r.ToUserMessage(pm)) - } - return nil - }) - } - it.Close() - return nil - }) - return userMessages + userMessages := make([]*msg.UserMessage, 0, 10) + _ = badgerUpdate(func(txn *badger.Txn) error { + opt := badger.DefaultIteratorOptions + opt.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPMessagesByID)) + it := txn.NewIterator(opt) + for it.Rewind(); it.Valid(); it.Next() { + _ = it.Item().Value(func(val []byte) error { + pm := new(msg.ClientPendingMessage) + _ = pm.Unmarshal(val) + if pm.PeerID == peerID && pm.PeerType == peerType && pm.TeamID == teamID { + userMessages = append(userMessages, r.ToUserMessage(pm)) + } + return nil + }) + } + it.Close() + return nil + }) + return userMessages } func (r *repoMessagesPending) GetAndConvertAll() []*msg.UserMessage { - userMessages := make([]*msg.UserMessage, 0, 10) - _ = badgerUpdate(func(txn *badger.Txn) error { - opt := badger.DefaultIteratorOptions - opt.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPMessagesByID)) - it := txn.NewIterator(opt) - for it.Rewind(); it.Valid(); it.Next() { - _ = it.Item().Value(func(val []byte) error { - pm := new(msg.ClientPendingMessage) - _ = pm.Unmarshal(val) - userMessages = append(userMessages, r.ToUserMessage(pm)) - return nil - }) - } - it.Close() - return nil - }) - return userMessages + userMessages := make([]*msg.UserMessage, 0, 10) + _ = badgerUpdate(func(txn *badger.Txn) error { + opt := badger.DefaultIteratorOptions + opt.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPMessagesByID)) + it := txn.NewIterator(opt) + for it.Rewind(); it.Valid(); it.Next() { + _ = it.Item().Value(func(val []byte) error { + pm := new(msg.ClientPendingMessage) + _ = pm.Unmarshal(val) + userMessages = append(userMessages, r.ToUserMessage(pm)) + return nil + }) + } + it.Close() + return nil + }) + return userMessages } func (r *repoMessagesPending) GetAll() []*msg.ClientPendingMessage { - pendingMessages := make([]*msg.ClientPendingMessage, 0, 10) - _ = badgerUpdate(func(txn *badger.Txn) error { - opt := badger.DefaultIteratorOptions - opt.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPMessagesByID)) - it := txn.NewIterator(opt) - for it.Rewind(); it.Valid(); it.Next() { - _ = it.Item().Value(func(val []byte) error { - pm := new(msg.ClientPendingMessage) - _ = pm.Unmarshal(val) - pendingMessages = append(pendingMessages, pm) - return nil - }) - } - it.Close() - return nil - }) - return pendingMessages + pendingMessages := make([]*msg.ClientPendingMessage, 0, 10) + _ = badgerUpdate(func(txn *badger.Txn) error { + opt := badger.DefaultIteratorOptions + opt.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPMessagesByID)) + it := txn.NewIterator(opt) + for it.Rewind(); it.Valid(); it.Next() { + _ = it.Item().Value(func(val []byte) error { + pm := new(msg.ClientPendingMessage) + _ = pm.Unmarshal(val) + pendingMessages = append(pendingMessages, pm) + return nil + }) + } + it.Close() + return nil + }) + return pendingMessages } func (r *repoMessagesPending) Delete(msgID int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - return deletePendingMessage(txn, msgID) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return deletePendingMessage(txn, msgID) + }) } func (r *repoMessagesPending) DeleteByRealID(msgID int64) { - _ = badgerUpdate(func(txn *badger.Txn) error { - _ = txn.Delete(getPendingMessageRealKey(msgID)) - return nil - }) + _ = badgerUpdate(func(txn *badger.Txn) error { + _ = txn.Delete(getPendingMessageRealKey(msgID)) + return nil + }) } func (r *repoMessagesPending) DeleteMany(msgIDs []int64) { - _ = badgerUpdate(func(txn *badger.Txn) error { - for _, msgID := range msgIDs { - _ = deletePendingMessage(txn, msgID) - } - return nil - }) + _ = badgerUpdate(func(txn *badger.Txn) error { + for _, msgID := range msgIDs { + _ = deletePendingMessage(txn, msgID) + } + return nil + }) } func (r *repoMessagesPending) GetManyRequestIDs(msgIDs []int64) []int64 { - requestIDs := make([]int64, 0, len(msgIDs)) - for _, msgID := range msgIDs { - pm, _ := r.GetByID(msgID) - if pm == nil { - continue - } - requestIDs = append(requestIDs, pm.RequestID) - } - return requestIDs + requestIDs := make([]int64, 0, len(msgIDs)) + for _, msgID := range msgIDs { + pm, _ := r.GetByID(msgID) + if pm == nil { + continue + } + requestIDs = append(requestIDs, pm.RequestID) + } + return requestIDs } func (r *repoMessagesPending) DeletePeerAllMessages(peerID int64, peerType int32) *msg.ClientUpdateMessagesDeleted { - res := new(msg.ClientUpdateMessagesDeleted) - res.PeerID = peerID - res.PeerType = peerType - res.MessageIDs = make([]int64, 0) - _ = badgerUpdate(func(txn *badger.Txn) error { - opt := badger.DefaultIteratorOptions - opt.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPMessagesByID)) - it := txn.NewIterator(opt) - for it.Rewind(); it.Valid(); it.Next() { - _ = it.Item().Value(func(val []byte) error { - pm := new(msg.ClientPendingMessage) - _ = pm.Unmarshal(val) - if pm.PeerID == peerID && pm.PeerType == peerType { - res.MessageIDs = append(res.MessageIDs, pm.ID) - _ = r.Delete(pm.ID) - } - return nil - }) - } - it.Close() - return nil - }) - - return res + res := new(msg.ClientUpdateMessagesDeleted) + res.PeerID = peerID + res.PeerType = peerType + res.MessageIDs = make([]int64, 0) + _ = badgerUpdate(func(txn *badger.Txn) error { + opt := badger.DefaultIteratorOptions + opt.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPMessagesByID)) + it := txn.NewIterator(opt) + for it.Rewind(); it.Valid(); it.Next() { + _ = it.Item().Value(func(val []byte) error { + pm := new(msg.ClientPendingMessage) + _ = pm.Unmarshal(val) + if pm.PeerID == peerID && pm.PeerType == peerType { + res.MessageIDs = append(res.MessageIDs, pm.ID) + _ = r.Delete(pm.ID) + } + return nil + }) + } + it.Close() + return nil + }) + + return res } func (r *repoMessagesPending) SaveByRealID(randomID, realMsgID int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - pm := new(msg.ClientPendingMessage) - item, err := txn.Get(getPendingMessageRandomKey(randomID)) - if err != nil { - return err - } - err = item.Value(func(val []byte) error { - return pm.Unmarshal(val) - }) - if err != nil { - return err - } - bytes, _ := pm.Marshal() - return txn.SetEntry(badger.NewEntry(getPendingMessageRealKey(realMsgID), bytes)) - }) + return badgerUpdate(func(txn *badger.Txn) error { + pm := new(msg.ClientPendingMessage) + item, err := txn.Get(getPendingMessageRandomKey(randomID)) + if err != nil { + return err + } + err = item.Value(func(val []byte) error { + return pm.Unmarshal(val) + }) + if err != nil { + return err + } + bytes, _ := pm.Marshal() + return txn.SetEntry(badger.NewEntry(getPendingMessageRealKey(realMsgID), bytes)) + }) } const ( - _ClientSendMessageMediaType = -1 - _ClientSendMessageContactType = -2 - _ClientSendMessageGeoLocationType = -3 - _ClientSendMessageInputMessageType = -4 + _ClientSendMessageMediaType = -1 + _ClientSendMessageContactType = -2 + _ClientSendMessageGeoLocationType = -3 + _ClientSendMessageInputMessageType = -4 ) func (r *repoMessagesPending) ToUserMessage(m *msg.ClientPendingMessage) *msg.UserMessage { - v := new(msg.UserMessage) - v.ID = m.ID - v.PeerID = m.PeerID - v.PeerType = m.PeerType - v.CreatedOn = m.CreatedOn - v.Body = m.Body - v.SenderID = m.SenderID - v.ReplyTo = m.ReplyTo - v.Entities = m.Entities - switch m.MediaType { - case msg.InputMediaType_InputMediaTypeUploadedDocument: - v.MessageType = _ClientSendMessageMediaType - case msg.InputMediaType_InputMediaTypeContact: - v.MessageType = _ClientSendMessageContactType - case msg.InputMediaType_InputMediaTypeGeoLocation: - v.MessageType = _ClientSendMessageGeoLocationType - case msg.InputMediaType_InputMediaTypeMessageDocument: - v.MessageType = _ClientSendMessageInputMessageType - } - v.MediaType = msg.MediaType(m.MediaType) - v.Media = m.Media - return v + v := new(msg.UserMessage) + v.ID = m.ID + v.PeerID = m.PeerID + v.PeerType = m.PeerType + v.CreatedOn = m.CreatedOn + v.Body = m.Body + v.SenderID = m.SenderID + v.ReplyTo = m.ReplyTo + v.Entities = m.Entities + switch m.MediaType { + case msg.InputMediaType_InputMediaTypeUploadedDocument: + v.MessageType = _ClientSendMessageMediaType + case msg.InputMediaType_InputMediaTypeContact: + v.MessageType = _ClientSendMessageContactType + case msg.InputMediaType_InputMediaTypeGeoLocation: + v.MessageType = _ClientSendMessageGeoLocationType + case msg.InputMediaType_InputMediaTypeMessageDocument: + v.MessageType = _ClientSendMessageInputMessageType + } + v.MediaType = msg.MediaType(m.MediaType) + v.Media = m.Media + return v } func (r *repoMessagesPending) ToMessagesSend(m *msg.ClientPendingMessage) *msg.MessagesSend { - v := new(msg.MessagesSend) - v.RandomID = m.RequestID - v.Body = m.Body - v.Peer = &msg.InputPeer{ - ID: m.PeerID, - Type: msg.PeerType(m.PeerType), - AccessHash: m.AccessHash, - } - v.ClearDraft = m.ClearDraft - v.Entities = m.Entities - v.ReplyTo = m.ReplyTo - return v + v := new(msg.MessagesSend) + v.RandomID = m.RequestID + v.Body = m.Body + v.Peer = &msg.InputPeer{ + ID: m.PeerID, + Type: msg.PeerType(m.PeerType), + AccessHash: m.AccessHash, + } + v.ClearDraft = m.ClearDraft + v.Entities = m.Entities + v.ReplyTo = m.ReplyTo + return v } func (r *repoMessagesPending) ToMessagesSendMedia(m *msg.ClientPendingMessage) *msg.MessagesSendMedia { - v := &msg.MessagesSendMedia{ - RandomID: m.RequestID, - Peer: &msg.InputPeer{ - ID: m.PeerID, - Type: msg.PeerType(m.PeerType), - AccessHash: m.AccessHash, - }, - ClearDraft: m.ClearDraft, - ReplyTo: m.ReplyTo, - MediaType: m.MediaType, - } - - switch m.MediaType { - case msg.InputMediaType_InputMediaTypeUploadedDocument: - csmm := new(msg.ClientSendMessageMedia) - _ = csmm.Unmarshal(m.Media) - - if csmm.FileTotalParts == 0 { - // If FileTotalParts is still zero it means we have not upload the document yet - return nil - } - - uploadedDocument := &msg.InputMediaUploadedDocument{ - File: &msg.InputFile{ - FileID: csmm.FileID, - TotalParts: csmm.FileTotalParts, - FileName: csmm.FileName, - MD5Checksum: "", - }, - Thumbnail: nil, - MimeType: csmm.FileMIME, - Caption: csmm.Caption, - Stickers: nil, - Attributes: csmm.Attributes, - Entities: nil, - } - - if csmm.ThumbID != 0 { - uploadedDocument.Thumbnail = &msg.InputFile{ - FileID: csmm.ThumbID, - TotalParts: 0, - FileName: "", - MD5Checksum: "", - } - } - v.MediaData, _ = uploadedDocument.Marshal() - case msg.InputMediaType_InputMediaTypeDocument: - csmm := new(msg.ClientSendMessageMedia) - _ = csmm.Unmarshal(m.Media) - doc := &msg.InputMediaDocument{ - Caption: csmm.Caption, - Attributes: csmm.Attributes, - Document: &msg.InputDocument{ - ID: m.ServerFile.FileID, - AccessHash: m.ServerFile.AccessHash, - ClusterID: m.ServerFile.ClusterID, - }, - } - if csmm.ThumbID != 0 { - doc.Thumbnail = &msg.InputFile{ - FileID: csmm.ThumbID, - TotalParts: 0, - FileName: "", - MD5Checksum: "", - } - } - v.MediaData, _ = doc.Marshal() - default: - v.MediaData = m.Media - } - - return v + v := &msg.MessagesSendMedia{ + RandomID: m.RequestID, + Peer: &msg.InputPeer{ + ID: m.PeerID, + Type: msg.PeerType(m.PeerType), + AccessHash: m.AccessHash, + }, + ClearDraft: m.ClearDraft, + ReplyTo: m.ReplyTo, + MediaType: m.MediaType, + } + + switch m.MediaType { + case msg.InputMediaType_InputMediaTypeUploadedDocument: + csmm := new(msg.ClientSendMessageMedia) + _ = csmm.Unmarshal(m.Media) + + if csmm.FileTotalParts == 0 { + // If FileTotalParts is still zero it means we have not upload the document yet + return nil + } + + uploadedDocument := &msg.InputMediaUploadedDocument{ + File: &msg.InputFile{ + FileID: csmm.FileID, + TotalParts: csmm.FileTotalParts, + FileName: csmm.FileName, + MD5Checksum: "", + }, + Thumbnail: nil, + MimeType: csmm.FileMIME, + Caption: csmm.Caption, + Stickers: nil, + Attributes: csmm.Attributes, + Entities: nil, + } + + if csmm.ThumbID != 0 { + uploadedDocument.Thumbnail = &msg.InputFile{ + FileID: csmm.ThumbID, + TotalParts: 0, + FileName: "", + MD5Checksum: "", + } + } + v.MediaData, _ = uploadedDocument.Marshal() + case msg.InputMediaType_InputMediaTypeDocument: + csmm := new(msg.ClientSendMessageMedia) + _ = csmm.Unmarshal(m.Media) + doc := &msg.InputMediaDocument{ + Caption: csmm.Caption, + Attributes: csmm.Attributes, + Document: &msg.InputDocument{ + ID: m.ServerFile.FileID, + AccessHash: m.ServerFile.AccessHash, + ClusterID: m.ServerFile.ClusterID, + }, + } + if csmm.ThumbID != 0 { + doc.Thumbnail = &msg.InputFile{ + FileID: csmm.ThumbID, + TotalParts: 0, + FileName: "", + MD5Checksum: "", + } + } + v.MediaData, _ = doc.Marshal() + default: + v.MediaData = m.Media + } + + return v } diff --git a/internal/repo/messages_test.go b/internal/repo/messages_test.go index a59191ee..d876dc92 100644 --- a/internal/repo/messages_test.go +++ b/internal/repo/messages_test.go @@ -1,12 +1,13 @@ package repo_test import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony/tools" - . "github.com/smartystreets/goconvey/convey" - "testing" + "testing" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony/tools" + . "github.com/smartystreets/goconvey/convey" ) /* @@ -19,60 +20,60 @@ import ( */ func TestMessagesSearch(t *testing.T) { - peerID := tools.RandomInt64(0) - for i := 1; i < 100; i++ { - repo.Messages.Save(createMessage(int64(i), peerID, domain.RandomID(32), []int32{int32(i % 5)})) - } - Convey("Messages Search", t, func() { - Convey("Search By Label", func(c C) { - msgs := repo.Messages.SearchByLabels(0, []int32{1}, peerID, 100) - c.So(msgs, ShouldHaveLength, 20) - }) - }) + peerID := tools.RandomInt64(0) + for i := 1; i < 100; i++ { + repo.Messages.Save(createMessage(int64(i), peerID, domain.RandomID(32), []int32{int32(i % 5)})) + } + Convey("Messages Search", t, func() { + Convey("Search By Label", func(c C) { + msgs := repo.Messages.SearchByLabels(0, []int32{1}, peerID, 100) + c.So(msgs, ShouldHaveLength, 20) + }) + }) } func TestGetMediaMessageHistory(t *testing.T) { - Convey("GetMediaHistory", t, func(c C) { - teamID := tools.RandomInt64(0) - peerID := tools.RandomInt64(0) - userID := tools.RandomInt64(0) - err := repo.Dialogs.SaveNew(&msg.Dialog{ - TeamID: teamID, - PeerID: peerID, - PeerType: 1, - TopMessageID: 0, - }, tools.TimeUnix()) - c.So(err, ShouldBeNil) + Convey("GetMediaHistory", t, func(c C) { + teamID := tools.RandomInt64(0) + peerID := tools.RandomInt64(0) + userID := tools.RandomInt64(0) + err := repo.Dialogs.SaveNew(&msg.Dialog{ + TeamID: teamID, + PeerID: peerID, + PeerType: 1, + TopMessageID: 0, + }, tools.TimeUnix()) + c.So(err, ShouldBeNil) - for i := int64(1); i <= 100; i++ { - err = repo.Messages.SaveNew(&msg.UserMessage{ - TeamID: teamID, - PeerID: peerID, - PeerType: 1, - ID: i, - MediaCat: msg.MediaCategory_MediaCategoryAudio, - SenderID: peerID, - }, userID) - c.So(err, ShouldBeNil) - } + for i := int64(1); i <= 100; i++ { + err = repo.Messages.SaveNew(&msg.UserMessage{ + TeamID: teamID, + PeerID: peerID, + PeerType: 1, + ID: i, + MediaCat: msg.MediaCategory_MediaCategoryAudio, + SenderID: peerID, + }, userID) + c.So(err, ShouldBeNil) + } - Convey("Load With MaxID = 0 and MinID = 0", func(c C) { - ums, _, _ := repo.Messages.GetMediaMessageHistory(teamID, peerID, 1, 0, 0, 10, msg.MediaCategory_MediaCategoryAudio) - c.So(ums, ShouldHaveLength, 10) - c.So(ums[0].ID, ShouldEqual, 100) - c.So(ums[9].ID, ShouldEqual, 91) - }) - Convey("Load With MaxID > 0", func(c C) { - ums, _, _ := repo.Messages.GetMediaMessageHistory(teamID, peerID, 1, 0, 50, 10, msg.MediaCategory_MediaCategoryAudio) - c.So(ums, ShouldHaveLength, 10) - c.So(ums[0].ID, ShouldEqual, 50) - c.So(ums[9].ID, ShouldEqual, 41) - }) - Convey("Load With MinID > 0", func(c C) { - ums, _, _ := repo.Messages.GetMediaMessageHistory(teamID, peerID, 1, 30, 0, 10, msg.MediaCategory_MediaCategoryAudio) - c.So(ums, ShouldHaveLength, 10) - c.So(ums[0].ID, ShouldEqual, 30) - c.So(ums[9].ID, ShouldEqual, 39) - }) - }) + Convey("Load With MaxID = 0 and MinID = 0", func(c C) { + ums, _, _ := repo.Messages.GetMediaMessageHistory(teamID, peerID, 1, 0, 0, 10, msg.MediaCategory_MediaCategoryAudio) + c.So(ums, ShouldHaveLength, 10) + c.So(ums[0].ID, ShouldEqual, 100) + c.So(ums[9].ID, ShouldEqual, 91) + }) + Convey("Load With MaxID > 0", func(c C) { + ums, _, _ := repo.Messages.GetMediaMessageHistory(teamID, peerID, 1, 0, 50, 10, msg.MediaCategory_MediaCategoryAudio) + c.So(ums, ShouldHaveLength, 10) + c.So(ums[0].ID, ShouldEqual, 50) + c.So(ums[9].ID, ShouldEqual, 41) + }) + Convey("Load With MinID > 0", func(c C) { + ums, _, _ := repo.Messages.GetMediaMessageHistory(teamID, peerID, 1, 30, 0, 10, msg.MediaCategory_MediaCategoryAudio) + c.So(ums, ShouldHaveLength, 10) + c.So(ums[0].ID, ShouldEqual, 30) + c.So(ums[9].ID, ShouldEqual, 39) + }) + }) } diff --git a/internal/repo/notifications.go b/internal/repo/notifications.go index a5ddaf2d..de17ade1 100644 --- a/internal/repo/notifications.go +++ b/internal/repo/notifications.go @@ -1,11 +1,11 @@ package repo import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) /** @@ -15,54 +15,54 @@ import ( */ const ( - prefixNotifications = "NOTIFICATIONS" + prefixNotifications = "NOTIFICATIONS" ) type repoNotifications struct { - *repository + *repository } func (r *repoNotifications) getKey(teamID int64, peer *msg.InputPeer) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixNotifications) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - z.AppendStrInt64(sb, peer.ID) - z.AppendStrInt32(sb, int32(peer.Type)) - sb.WriteRune('.') - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixNotifications) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + z.AppendStrInt64(sb, peer.ID) + z.AppendStrInt32(sb, int32(peer.Type)) + sb.WriteRune('.') + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func (r *repoNotifications) SetNotificationDismissTime(teamID int64, peer *msg.InputPeer, ts int64) error { - err := badgerUpdate(func(txn *badger.Txn) error { - tsBytes := tools.StrToByte(tools.Int64ToStr(ts)) - key := r.getKey(teamID, peer) + err := badgerUpdate(func(txn *badger.Txn) error { + tsBytes := tools.StrToByte(tools.Int64ToStr(ts)) + key := r.getKey(teamID, peer) - err := txn.SetEntry(badger.NewEntry( - key, tsBytes, - )) + err := txn.SetEntry(badger.NewEntry( + key, tsBytes, + )) - return err - }) + return err + }) - return err + return err } func (r *repoNotifications) GetNotificationDismissTime(teamID int64, peer *msg.InputPeer) (int64, error) { - var ts int64 - err := badgerView(func(txn *badger.Txn) error { - item, err := txn.Get(r.getKey(teamID, peer)) - if err != nil { - return err - } - err = item.Value(func(val []byte) error { - ts = tools.StrToInt64(tools.B2S(val)) - return nil - }) - return err - }) + var ts int64 + err := badgerView(func(txn *badger.Txn) error { + item, err := txn.Get(r.getKey(teamID, peer)) + if err != nil { + return err + } + err = item.Value(func(val []byte) error { + ts = tools.StrToInt64(tools.B2S(val)) + return nil + }) + return err + }) - return ts, err + return ts, err } diff --git a/internal/repo/reactions.go b/internal/repo/reactions.go index c6104a7d..03aece98 100644 --- a/internal/repo/reactions.go +++ b/internal/repo/reactions.go @@ -1,10 +1,10 @@ package repo import ( - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) /** @@ -14,68 +14,68 @@ import ( */ type repoReactions struct { - *repository + *repository } const ( - prefixReactionsUseCount = "REACTIONS_USE_CNT" + prefixReactionsUseCount = "REACTIONS_USE_CNT" ) func getReactionUseCountKey(reaction string) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixReactionsUseCount) - sb.WriteRune('.') - sb.WriteString(reaction) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixReactionsUseCount) + sb.WriteRune('.') + sb.WriteString(reaction) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getReactionUseCount(txn *badger.Txn, reaction string) (uint32, error) { - var useCount uint32 - item, err := txn.Get(getReactionUseCountKey(reaction)) - switch err { - case nil: - case badger.ErrKeyNotFound: - return 0, nil - default: - return 0, err - } + var useCount uint32 + item, err := txn.Get(getReactionUseCountKey(reaction)) + switch err { + case nil: + case badger.ErrKeyNotFound: + return 0, nil + default: + return 0, err + } - err = item.Value(func(val []byte) error { - useCount = z.ByteToUInt32(val) - return nil - }) - return useCount, err + err = item.Value(func(val []byte) error { + useCount = z.ByteToUInt32(val) + return nil + }) + return useCount, err } func saveReactionUseCount(txn *badger.Txn, reaction string, useCount uint32) error { - return txn.SetEntry(badger.NewEntry( - getReactionUseCountKey(reaction), - z.UInt32ToByte(useCount), - )) + return txn.SetEntry(badger.NewEntry( + getReactionUseCountKey(reaction), + z.UInt32ToByte(useCount), + )) } func (r *repoReactions) GetReactionUseCount(reaction string) (useCount uint32, err error) { - err = badgerView(func(txn *badger.Txn) error { - useCount, err = getReactionUseCount(txn, reaction) - return err - }) - return + err = badgerView(func(txn *badger.Txn) error { + useCount, err = getReactionUseCount(txn, reaction) + return err + }) + return } func (r *repoReactions) IncrementReactionUseCount(reaction string, cnt int32) error { - err := badgerUpdate(func(txn *badger.Txn) error { - useCount, err := getReactionUseCount(txn, reaction) - if err != nil { - return err - } - if cnt < 0 { - useCount -= uint32(z.AbsInt32(cnt)) - } else { - useCount += uint32(z.AbsInt32(cnt)) - } - return saveReactionUseCount(txn, reaction, useCount) - }) - return err + err := badgerUpdate(func(txn *badger.Txn) error { + useCount, err := getReactionUseCount(txn, reaction) + if err != nil { + return err + } + if cnt < 0 { + useCount -= uint32(z.AbsInt32(cnt)) + } else { + useCount += uint32(z.AbsInt32(cnt)) + } + return saveReactionUseCount(txn, reaction, useCount) + }) + return err } diff --git a/internal/repo/recent_searches.go b/internal/repo/recent_searches.go index a65fbb91..d3aa38f0 100644 --- a/internal/repo/recent_searches.go +++ b/internal/repo/recent_searches.go @@ -1,11 +1,11 @@ package repo import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) /** @@ -15,98 +15,98 @@ import ( */ type repoRecentSearches struct { - *repository + *repository } const ( - prefixRecentSearch = "RECENT_SEARCH" + prefixRecentSearch = "RECENT_SEARCH" ) func getRecentSearchKey(teamID, peerID int64, peerType int32) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixRecentSearch) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - z.AppendStrInt64(sb, peerID) - z.AppendStrInt32(sb, peerType) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixRecentSearch) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + z.AppendStrInt64(sb, peerID) + z.AppendStrInt32(sb, peerType) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func getRecentSearchPrefix(teamID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixRecentSearch) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixRecentSearch) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func (r *repoRecentSearches) List(teamID int64, limit int32) []*msg.ClientRecentSearch { - recentSearches := make([]*msg.ClientRecentSearch, 0, limit) - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getRecentSearchPrefix(teamID) - it := txn.NewIterator(opts) + recentSearches := make([]*msg.ClientRecentSearch, 0, limit) + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getRecentSearchPrefix(teamID) + it := txn.NewIterator(opts) - defer it.Close() - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - _ = it.Item().Value(func(val []byte) error { - r := &msg.ClientRecentSearch{} - err := r.Unmarshal(val) - if err != nil { - return err - } - recentSearches = append(recentSearches, r) - return nil - }) - } + defer it.Close() + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + _ = it.Item().Value(func(val []byte) error { + r := &msg.ClientRecentSearch{} + err := r.Unmarshal(val) + if err != nil { + return err + } + recentSearches = append(recentSearches, r) + return nil + }) + } - return nil - }) + return nil + }) - return recentSearches + return recentSearches } func (r *repoRecentSearches) Put(teamID int64, recentSearch *msg.ClientRecentSearch) error { - err := badgerUpdate(func(txn *badger.Txn) error { - recentSearchBytes, _ := recentSearch.Marshal() - recentSearchKey := getRecentSearchKey(teamID, recentSearch.Peer.ID, recentSearch.Peer.Type) - err := txn.SetEntry(badger.NewEntry( - recentSearchKey, recentSearchBytes, - )) + err := badgerUpdate(func(txn *badger.Txn) error { + recentSearchBytes, _ := recentSearch.Marshal() + recentSearchKey := getRecentSearchKey(teamID, recentSearch.Peer.ID, recentSearch.Peer.Type) + err := txn.SetEntry(badger.NewEntry( + recentSearchKey, recentSearchBytes, + )) - return err - }) - return err + return err + }) + return err } func (r *repoRecentSearches) Delete(teamID int64, peer *msg.InputPeer) error { - err := badgerUpdate(func(txn *badger.Txn) error { - recentSearchKey := getRecentSearchKey(teamID, peer.ID, int32(peer.Type)) - err := txn.Delete(recentSearchKey) - return err - }) - return err + err := badgerUpdate(func(txn *badger.Txn) error { + recentSearchKey := getRecentSearchKey(teamID, peer.ID, int32(peer.Type)) + err := txn.Delete(recentSearchKey) + return err + }) + return err } func (r *repoRecentSearches) Clear(teamID int64) error { - err := badgerUpdate(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getRecentSearchPrefix(teamID) - opts.PrefetchValues = false - it := txn.NewIterator(opts) - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - err := txn.Delete(it.Item().KeyCopy(nil)) - if err != nil { - return err - } - } - it.Close() + err := badgerUpdate(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getRecentSearchPrefix(teamID) + opts.PrefetchValues = false + it := txn.NewIterator(opts) + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + err := txn.Delete(it.Item().KeyCopy(nil)) + if err != nil { + return err + } + } + it.Close() - return nil - }) - return err + return nil + }) + return err } diff --git a/internal/repo/recent_searches_test.go b/internal/repo/recent_searches_test.go index ede5f3c6..0eca02e1 100644 --- a/internal/repo/recent_searches_test.go +++ b/internal/repo/recent_searches_test.go @@ -1,11 +1,12 @@ package repo_test import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - . "github.com/smartystreets/goconvey/convey" - "testing" - "time" + "testing" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + . "github.com/smartystreets/goconvey/convey" ) /** @@ -15,36 +16,36 @@ import ( */ func TestRepoRecentSearches(t *testing.T) { - Convey("RecentSearch Repo", t, func() { - Convey("Put, List and Clear", func(c C) { - err := repo.RecentSearches.Clear(0) - c.So(err, ShouldBeNil) - err = repo.RecentSearches.Put(0, &msg.ClientRecentSearch{ - Peer: &msg.Peer{ - ID: 101, - Type: 1, - AccessHash: 1010, - }, - Date: int32(time.Now().Unix()), - }) - c.So(err, ShouldBeNil) - searches := repo.RecentSearches.List(0, 1) - c.So(searches, ShouldHaveLength, 1) - err = repo.RecentSearches.Put(0, &msg.ClientRecentSearch{ - Peer: &msg.Peer{ - ID: 102, - Type: 1, - AccessHash: 1020, - }, - Date: int32(time.Now().Unix()), - }) - c.So(err, ShouldBeNil) - searches = repo.RecentSearches.List(0, 2) - c.So(searches, ShouldHaveLength, 2) - err = repo.RecentSearches.Clear(0) - c.So(err, ShouldBeNil) - searches = repo.RecentSearches.List(0, 2) - c.So(searches, ShouldHaveLength, 0) - }) - }) + Convey("RecentSearch Repo", t, func() { + Convey("Put, List and Clear", func(c C) { + err := repo.RecentSearches.Clear(0) + c.So(err, ShouldBeNil) + err = repo.RecentSearches.Put(0, &msg.ClientRecentSearch{ + Peer: &msg.Peer{ + ID: 101, + Type: 1, + AccessHash: 1010, + }, + Date: int32(time.Now().Unix()), + }) + c.So(err, ShouldBeNil) + searches := repo.RecentSearches.List(0, 1) + c.So(searches, ShouldHaveLength, 1) + err = repo.RecentSearches.Put(0, &msg.ClientRecentSearch{ + Peer: &msg.Peer{ + ID: 102, + Type: 1, + AccessHash: 1020, + }, + Date: int32(time.Now().Unix()), + }) + c.So(err, ShouldBeNil) + searches = repo.RecentSearches.List(0, 2) + c.So(searches, ShouldHaveLength, 2) + err = repo.RecentSearches.Clear(0) + c.So(err, ShouldBeNil) + searches = repo.RecentSearches.List(0, 2) + c.So(searches, ShouldHaveLength, 0) + }) + }) } diff --git a/internal/repo/repo.go b/internal/repo/repo.go index c04871a2..31638c98 100644 --- a/internal/repo/repo.go +++ b/internal/repo/repo.go @@ -1,399 +1,400 @@ package repo import ( - "fmt" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/analysis/analyzer/keyword" - "github.com/blevesearch/bleve/analysis/lang/en" - "github.com/blevesearch/bleve/mapping" - "github.com/dgraph-io/badger/v2/options" - "github.com/pkg/errors" - "github.com/ronaksoft/rony/tools" - "github.com/tidwall/buntdb" - "os" - "path/filepath" - "strings" - "sync" - "time" - - "git.ronaksoft.com/river/sdk/internal/logs" - "github.com/dgraph-io/badger/v2" - "go.uber.org/zap" + "fmt" + "os" + "path/filepath" + "strings" + "sync" + "time" + + "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/analysis/analyzer/keyword" + "github.com/blevesearch/bleve/analysis/lang/en" + "github.com/blevesearch/bleve/mapping" + "github.com/dgraph-io/badger/v2/options" + "github.com/pkg/errors" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony/tools" + "github.com/tidwall/buntdb" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-sdk/internal/logs" + "go.uber.org/zap" ) var ( - ctx *Context - r *repository - singleton sync.Mutex - logger *logs.Logger - - Account *repoAccount - Dialogs *repoDialogs - Messages *repoMessages - PendingMessages *repoMessagesPending - MessagesExtra *repoMessagesExtra - System *repoSystem - Users *repoUsers - Gifs *repoGifs - Groups *repoGroups - Files *repoFiles - Labels *repoLabels - TopPeers *repoTopPeers - Wallpapers *repoWallpapers - RecentSearches *repoRecentSearches - Teams *repoTeams - Reactions *repoReactions - Notifications *repoNotifications + ctx *Context + r *repository + singleton sync.Mutex + logger *logs.Logger + + Account *repoAccount + Dialogs *repoDialogs + Messages *repoMessages + PendingMessages *repoMessagesPending + MessagesExtra *repoMessagesExtra + System *repoSystem + Users *repoUsers + Gifs *repoGifs + Groups *repoGroups + Files *repoFiles + Labels *repoLabels + TopPeers *repoTopPeers + Wallpapers *repoWallpapers + RecentSearches *repoRecentSearches + Teams *repoTeams + Reactions *repoReactions + Notifications *repoNotifications ) // Context container of repo type Context struct { - DBPath string + DBPath string } type repository struct { - badger *badger.DB - selfUserID int64 - bunt *buntdb.DB - msgSearch bleve.Index - peerSearch bleve.Index + badger *badger.DB + selfUserID int64 + bunt *buntdb.DB + msgSearch bleve.Index + peerSearch bleve.Index } func MustInit(dbPath string, lowMemory bool) { - err := Init(dbPath, lowMemory) - if err != nil { - panic(err) - } + err := Init(dbPath, lowMemory) + if err != nil { + panic(err) + } } // Init initialize repo singleton func Init(dbPath string, lowMemory bool) error { - if ctx == nil { - singleton.Lock() - err := repoSetDB(dbPath, lowMemory) - if err != nil { - return err - } - - logger = logs.With("REPO") - ctx = &Context{ - DBPath: dbPath, - } - Account = &repoAccount{repository: r} - Dialogs = &repoDialogs{repository: r} - Messages = &repoMessages{repository: r} - PendingMessages = &repoMessagesPending{repository: r} - MessagesExtra = &repoMessagesExtra{repository: r} - System = &repoSystem{repository: r} - Users = &repoUsers{repository: r} - Groups = &repoGroups{repository: r} - Gifs = &repoGifs{repository: r} - Files = &repoFiles{repository: r} - Labels = &repoLabels{repository: r} - TopPeers = &repoTopPeers{repository: r} - Wallpapers = &repoWallpapers{repository: r} - RecentSearches = &repoRecentSearches{repository: r} - Teams = &repoTeams{repository: r} - Reactions = &repoReactions{repository: r} - Notifications = &repoNotifications{repository: r} - singleton.Unlock() - } - return nil + if ctx == nil { + singleton.Lock() + err := repoSetDB(dbPath, lowMemory) + if err != nil { + return err + } + + logger = logs.With("REPO") + ctx = &Context{ + DBPath: dbPath, + } + Account = &repoAccount{repository: r} + Dialogs = &repoDialogs{repository: r} + Messages = &repoMessages{repository: r} + PendingMessages = &repoMessagesPending{repository: r} + MessagesExtra = &repoMessagesExtra{repository: r} + System = &repoSystem{repository: r} + Users = &repoUsers{repository: r} + Groups = &repoGroups{repository: r} + Gifs = &repoGifs{repository: r} + Files = &repoFiles{repository: r} + Labels = &repoLabels{repository: r} + TopPeers = &repoTopPeers{repository: r} + Wallpapers = &repoWallpapers{repository: r} + RecentSearches = &repoRecentSearches{repository: r} + Teams = &repoTeams{repository: r} + Reactions = &repoReactions{repository: r} + Notifications = &repoNotifications{repository: r} + singleton.Unlock() + } + return nil } func repoSetDB(dbPath string, lowMemory bool) error { - r = new(repository) - - _ = os.MkdirAll(dbPath, os.ModePerm) - // Initialize BadgerDB - badgerPath := filepath.Join(dbPath, "badger") - _ = os.MkdirAll(badgerPath, os.ModePerm) - badgerOpts := badger.DefaultOptions(badgerPath). - WithLogger(nil). - WithTruncate(true) - if lowMemory { - badgerOpts = badgerOpts. - WithTableLoadingMode(options.FileIO). - WithValueLogLoadingMode(options.FileIO). - WithNumMemtables(2). - WithNumLevelZeroTables(2). - WithNumLevelZeroTablesStall(4). - WithMaxTableSize(1 << 22). // 4MB - WithValueLogFileSize(1 << 22). // 4MB - WithBypassLockGuard(true) - } else { - badgerOpts = badgerOpts. - WithTableLoadingMode(options.FileIO). - WithValueLogLoadingMode(options.FileIO). - WithBypassLockGuard(true) - - } - if badgerDB, err := badger.Open(badgerOpts); err != nil { - return errors.Wrap(err, "Badger") - } else { - r.badger = badgerDB - } - - // Initialize BuntDB Indexer - buntPath := filepath.Join(dbPath, "bunty") - _ = os.MkdirAll(buntPath, os.ModePerm) - if buntIndex, err := buntdb.Open(fmt.Sprintf("%s/bunty/dialogs.db", strings.TrimRight(dbPath, "/"))); err != nil { - return err - } else { - r.bunt = buntIndex - } - - _ = r.bunt.Update(func(tx *buntdb.Tx) error { - _ = tx.CreateIndex(indexDialogs, fmt.Sprintf("%s.*", prefixDialogs), buntdb.IndexBinary) - _ = tx.CreateIndex(indexTopPeersUser, fmt.Sprintf("%s.*", indexTopPeersUser), buntdb.IndexFloat) - _ = tx.CreateIndex(indexTopPeersGroup, fmt.Sprintf("%s.*", indexTopPeersGroup), buntdb.IndexFloat) - _ = tx.CreateIndex(indexTopPeersForward, fmt.Sprintf("%s.*", indexTopPeersForward), buntdb.IndexFloat) - _ = tx.CreateIndex(indexTopPeersBotMessage, fmt.Sprintf("%s.*", indexTopPeersBotMessage), buntdb.IndexFloat) - _ = tx.CreateIndex(indexTopPeersBotInline, fmt.Sprintf("%s.*", indexTopPeersBotInline), buntdb.IndexFloat) - _ = tx.CreateIndex(indexGif, fmt.Sprintf("%s.*", prefixGif), buntdb.IndexBinary) - - return nil - }) - - // Initialize Search - go func() { - // 1. Messages Search - _ = tools.Try(10, time.Millisecond*100, func() error { - searchDbPath := fmt.Sprintf("%s/searchdb/msg", strings.TrimRight(dbPath, "/")) - if msgSearch, err := bleve.Open(searchDbPath); err != nil { - switch err { - case bleve.ErrorIndexPathDoesNotExist: - // create a mapping - r.msgSearch, err = bleve.New(searchDbPath, indexMapForMessages()) - if err != nil { - _ = os.RemoveAll(searchDbPath) - return err - } - default: - _ = os.RemoveAll(searchDbPath) - return err - } - } else { - r.msgSearch = msgSearch - } - return nil - }) - }() - go func() { - // 2. Peer Search - _ = tools.Try(10, 100*time.Millisecond, func() error { - peerDbPath := fmt.Sprintf("%s/searchdb/peer", strings.TrimRight(dbPath, "/")) - if peerSearch, err := bleve.Open(peerDbPath); err != nil { - switch err { - case bleve.ErrorIndexPathDoesNotExist: - // create a mapping - r.peerSearch, err = bleve.New(peerDbPath, indexMapForPeers()) - if err != nil { - _ = os.RemoveAll(peerDbPath) - return err - } - default: - _ = os.RemoveAll(peerDbPath) - return err - } - } else { - r.peerSearch = peerSearch - } - return nil - }) - }() - - return nil + r = new(repository) + + _ = os.MkdirAll(dbPath, os.ModePerm) + // Initialize BadgerDB + badgerPath := filepath.Join(dbPath, "badger") + _ = os.MkdirAll(badgerPath, os.ModePerm) + badgerOpts := badger.DefaultOptions(badgerPath). + WithLogger(nil). + WithTruncate(true) + if lowMemory { + badgerOpts = badgerOpts. + WithTableLoadingMode(options.FileIO). + WithValueLogLoadingMode(options.FileIO). + WithNumMemtables(2). + WithNumLevelZeroTables(2). + WithNumLevelZeroTablesStall(4). + WithMaxTableSize(1 << 22). // 4MB + WithValueLogFileSize(1 << 22). // 4MB + WithBypassLockGuard(true) + } else { + badgerOpts = badgerOpts. + WithTableLoadingMode(options.FileIO). + WithValueLogLoadingMode(options.FileIO). + WithBypassLockGuard(true) + + } + if badgerDB, err := badger.Open(badgerOpts); err != nil { + return errors.Wrap(err, "Badger") + } else { + r.badger = badgerDB + } + + // Initialize BuntDB Indexer + buntPath := filepath.Join(dbPath, "bunty") + _ = os.MkdirAll(buntPath, os.ModePerm) + if buntIndex, err := buntdb.Open(fmt.Sprintf("%s/bunty/dialogs.db", strings.TrimRight(dbPath, "/"))); err != nil { + return err + } else { + r.bunt = buntIndex + } + + _ = r.bunt.Update(func(tx *buntdb.Tx) error { + _ = tx.CreateIndex(indexDialogs, fmt.Sprintf("%s.*", prefixDialogs), buntdb.IndexBinary) + _ = tx.CreateIndex(indexTopPeersUser, fmt.Sprintf("%s.*", indexTopPeersUser), buntdb.IndexFloat) + _ = tx.CreateIndex(indexTopPeersGroup, fmt.Sprintf("%s.*", indexTopPeersGroup), buntdb.IndexFloat) + _ = tx.CreateIndex(indexTopPeersForward, fmt.Sprintf("%s.*", indexTopPeersForward), buntdb.IndexFloat) + _ = tx.CreateIndex(indexTopPeersBotMessage, fmt.Sprintf("%s.*", indexTopPeersBotMessage), buntdb.IndexFloat) + _ = tx.CreateIndex(indexTopPeersBotInline, fmt.Sprintf("%s.*", indexTopPeersBotInline), buntdb.IndexFloat) + _ = tx.CreateIndex(indexGif, fmt.Sprintf("%s.*", prefixGif), buntdb.IndexBinary) + + return nil + }) + + // Initialize Search + go func() { + // 1. Messages Search + _ = tools.Try(10, time.Millisecond*100, func() error { + searchDbPath := fmt.Sprintf("%s/searchdb/msg", strings.TrimRight(dbPath, "/")) + if msgSearch, err := bleve.Open(searchDbPath); err != nil { + switch err { + case bleve.ErrorIndexPathDoesNotExist: + // create a mapping + r.msgSearch, err = bleve.New(searchDbPath, indexMapForMessages()) + if err != nil { + _ = os.RemoveAll(searchDbPath) + return err + } + default: + _ = os.RemoveAll(searchDbPath) + return err + } + } else { + r.msgSearch = msgSearch + } + return nil + }) + }() + go func() { + // 2. Peer Search + _ = tools.Try(10, 100*time.Millisecond, func() error { + peerDbPath := fmt.Sprintf("%s/searchdb/peer", strings.TrimRight(dbPath, "/")) + if peerSearch, err := bleve.Open(peerDbPath); err != nil { + switch err { + case bleve.ErrorIndexPathDoesNotExist: + // create a mapping + r.peerSearch, err = bleve.New(peerDbPath, indexMapForPeers()) + if err != nil { + _ = os.RemoveAll(peerDbPath) + return err + } + default: + _ = os.RemoveAll(peerDbPath) + return err + } + } else { + r.peerSearch = peerSearch + } + return nil + }) + }() + + return nil } func indexMapForMessages() mapping.IndexMapping { - // a generic reusable mapping for english text - textFieldMapping := bleve.NewTextFieldMapping() - textFieldMapping.Analyzer = en.AnalyzerName - textFieldMapping.Store = false - textFieldMapping.IncludeTermVectors = true - textFieldMapping.DocValues = false - keywordFieldMapping := bleve.NewTextFieldMapping() - keywordFieldMapping.Analyzer = keyword.Name - - // Message - messageMapping := bleve.NewDocumentStaticMapping() - messageMapping.AddFieldMappingsAt("body", textFieldMapping) - messageMapping.AddFieldMappingsAt("peer_id", keywordFieldMapping) - - indexMapping := bleve.NewIndexMapping() - indexMapping.AddDocumentMapping("msg", messageMapping) - - indexMapping.TypeField = "type" - indexMapping.DefaultAnalyzer = en.AnalyzerName - - return indexMapping + // a generic reusable mapping for english text + textFieldMapping := bleve.NewTextFieldMapping() + textFieldMapping.Analyzer = en.AnalyzerName + textFieldMapping.Store = false + textFieldMapping.IncludeTermVectors = true + textFieldMapping.DocValues = false + keywordFieldMapping := bleve.NewTextFieldMapping() + keywordFieldMapping.Analyzer = keyword.Name + + // Message + messageMapping := bleve.NewDocumentStaticMapping() + messageMapping.AddFieldMappingsAt("body", textFieldMapping) + messageMapping.AddFieldMappingsAt("peer_id", keywordFieldMapping) + + indexMapping := bleve.NewIndexMapping() + indexMapping.AddDocumentMapping("msg", messageMapping) + + indexMapping.TypeField = "type" + indexMapping.DefaultAnalyzer = en.AnalyzerName + + return indexMapping } func indexMapForPeers() mapping.IndexMapping { - // a generic reusable mapping for english text - textFieldMapping := bleve.NewTextFieldMapping() - textFieldMapping.Store = false - textFieldMapping.IncludeTermVectors = true - textFieldMapping.DocValues = false - keywordFieldMapping := bleve.NewTextFieldMapping() - keywordFieldMapping.Analyzer = keyword.Name - - // User - userMapping := bleve.NewDocumentStaticMapping() - userMapping.AddFieldMappingsAt("fn", textFieldMapping) - userMapping.AddFieldMappingsAt("ln", textFieldMapping) - userMapping.AddFieldMappingsAt("un", keywordFieldMapping) - userMapping.AddFieldMappingsAt("phone", keywordFieldMapping) - - // GroupSearch - groupMapping := bleve.NewDocumentStaticMapping() - groupMapping.AddFieldMappingsAt("title", textFieldMapping) - - // Contact - contactMapping := bleve.NewDocumentStaticMapping() - contactMapping.AddFieldMappingsAt("fn", textFieldMapping) - contactMapping.AddFieldMappingsAt("ln", textFieldMapping) - contactMapping.AddFieldMappingsAt("un", keywordFieldMapping) - contactMapping.AddFieldMappingsAt("phone", keywordFieldMapping) - - indexMapping := bleve.NewIndexMapping() - indexMapping.AddDocumentMapping("user", userMapping) - indexMapping.AddDocumentMapping("group", groupMapping) - indexMapping.AddDocumentMapping("contact", contactMapping) - - indexMapping.TypeField = "type" - indexMapping.DefaultAnalyzer = en.AnalyzerName - - return indexMapping + // a generic reusable mapping for english text + textFieldMapping := bleve.NewTextFieldMapping() + textFieldMapping.Store = false + textFieldMapping.IncludeTermVectors = true + textFieldMapping.DocValues = false + keywordFieldMapping := bleve.NewTextFieldMapping() + keywordFieldMapping.Analyzer = keyword.Name + + // User + userMapping := bleve.NewDocumentStaticMapping() + userMapping.AddFieldMappingsAt("fn", textFieldMapping) + userMapping.AddFieldMappingsAt("ln", textFieldMapping) + userMapping.AddFieldMappingsAt("un", keywordFieldMapping) + userMapping.AddFieldMappingsAt("phone", keywordFieldMapping) + + // GroupSearch + groupMapping := bleve.NewDocumentStaticMapping() + groupMapping.AddFieldMappingsAt("title", textFieldMapping) + + // Contact + contactMapping := bleve.NewDocumentStaticMapping() + contactMapping.AddFieldMappingsAt("fn", textFieldMapping) + contactMapping.AddFieldMappingsAt("ln", textFieldMapping) + contactMapping.AddFieldMappingsAt("un", keywordFieldMapping) + contactMapping.AddFieldMappingsAt("phone", keywordFieldMapping) + + indexMapping := bleve.NewIndexMapping() + indexMapping.AddDocumentMapping("user", userMapping) + indexMapping.AddDocumentMapping("group", groupMapping) + indexMapping.AddDocumentMapping("contact", contactMapping) + + indexMapping.TypeField = "type" + indexMapping.DefaultAnalyzer = en.AnalyzerName + + return indexMapping } func SetSelfUserID(value int64) { - r.selfUserID = value + r.selfUserID = value } func DropAll() { - SetSelfUserID(0) - _ = r.bunt.Close() - _ = r.badger.Close() - _ = r.msgSearch.Close() - _ = r.peerSearch.Close() - for os.RemoveAll(ctx.DBPath) != nil { - time.Sleep(time.Millisecond * 100) - } - ctx = nil + SetSelfUserID(0) + _ = r.bunt.Close() + _ = r.badger.Close() + _ = r.msgSearch.Close() + _ = r.peerSearch.Close() + for os.RemoveAll(ctx.DBPath) != nil { + time.Sleep(time.Millisecond * 100) + } + ctx = nil } func GC() { - _ = r.bunt.Shrink() - for r.badger.RunValueLogGC(0.7) == nil { - logger.Info("Badger ValueLog GC executed") - } + _ = r.bunt.Shrink() + for r.badger.RunValueLogGC(0.7) == nil { + logger.Info("Badger ValueLog GC executed") + } } func DbSize() (int64, int64) { - return r.badger.Size() + return r.badger.Size() } func badgerUpdate(fn func(txn *badger.Txn) error) (err error) { - for retry := 100; retry > 0; retry-- { - err = r.badger.Update(fn) - switch err { - case nil: - return nil - case badger.ErrConflict: - default: - return - } - time.Sleep(time.Duration(domain.RandomInt(10000)) * time.Microsecond) - } - return + for retry := 100; retry > 0; retry-- { + err = r.badger.Update(fn) + switch err { + case nil: + return nil + case badger.ErrConflict: + default: + return + } + time.Sleep(time.Duration(domain.RandomInt(10000)) * time.Microsecond) + } + return } func badgerView(fn func(txn *badger.Txn) error) (err error) { - for retry := 100; retry > 0; retry-- { - err = r.badger.View(fn) - switch err { - case nil: - return nil - case badger.ErrConflict: - default: - return - } - time.Sleep(time.Duration(domain.RandomInt(10000)) * time.Microsecond) - } - return + for retry := 100; retry > 0; retry-- { + err = r.badger.View(fn) + switch err { + case nil: + return nil + case badger.ErrConflict: + default: + return + } + time.Sleep(time.Duration(domain.RandomInt(10000)) * time.Microsecond) + } + return } type keyValue struct { - Key interface{} - Value interface{} + Key interface{} + Value interface{} } func indexMessage(key, value interface{}) { - msgIndexer.Enter("", tools.NewEntry(&keyValue{ - Key: key, - Value: value, - })) + msgIndexer.Enter("", tools.NewEntry(&keyValue{ + Key: key, + Value: value, + })) } var msgIndexer = tools.NewFlusherPool(10, 1000, func(targetID string, entries []tools.FlushEntry) { - _ = tools.Try(100, time.Second, func() error { - if r.msgSearch == nil { - return domain.ErrDoesNotExists - } - return nil - }) - b := r.msgSearch.NewBatch() - for _, item := range entries { - kv := item.Value().(*keyValue) - _ = b.Index(kv.Key.(string), kv.Value) - } - err := r.msgSearch.Batch(b) - if err != nil { - logger.Warn("got error MessageIndexer", zap.Error(err)) - } + _ = tools.Try(100, time.Second, func() error { + if r.msgSearch == nil { + return domain.ErrDoesNotExists + } + return nil + }) + b := r.msgSearch.NewBatch() + for _, item := range entries { + kv := item.Value().(*keyValue) + _ = b.Index(kv.Key.(string), kv.Value) + } + err := r.msgSearch.Batch(b) + if err != nil { + logger.Warn("got error MessageIndexer", zap.Error(err)) + } }) func indexMessageRemove(key string) { - msgIndexRemover.Enter("", tools.NewEntry(key)) + msgIndexRemover.Enter("", tools.NewEntry(key)) } var msgIndexRemover = tools.NewFlusherPool(10, 1000, func(targetID string, entries []tools.FlushEntry) { - _ = tools.Try(100, time.Second, func() error { - if r.msgSearch == nil { - return domain.ErrDoesNotExists - } - return nil - }) - for _, item := range entries { - _ = r.msgSearch.Delete(item.Value().(string)) - - } + _ = tools.Try(100, time.Second, func() error { + if r.msgSearch == nil { + return domain.ErrDoesNotExists + } + return nil + }) + for _, item := range entries { + _ = r.msgSearch.Delete(item.Value().(string)) + + } }) func indexPeer(key, value interface{}) { - peerIndexer.Enter("", tools.NewEntry(&keyValue{ - Key: key, - Value: value, - })) + peerIndexer.Enter("", tools.NewEntry(&keyValue{ + Key: key, + Value: value, + })) } var peerIndexer = tools.NewFlusherPool(10, 1000, func(targetID string, entries []tools.FlushEntry) { - _ = tools.Try(100, time.Second, func() error { - if r.peerSearch == nil { - return domain.ErrDoesNotExists - } - return nil - }) - b := r.peerSearch.NewBatch() - for _, item := range entries { - kv := item.Value().(*keyValue) - _ = b.Index(kv.Key.(string), kv.Value) - } - err := r.peerSearch.Batch(b) - if err != nil { - logger.Warn("PeerIndexer got error", zap.Error(err)) - } + _ = tools.Try(100, time.Second, func() error { + if r.peerSearch == nil { + return domain.ErrDoesNotExists + } + return nil + }) + b := r.peerSearch.NewBatch() + for _, item := range entries { + kv := item.Value().(*keyValue) + _ = b.Index(kv.Key.(string), kv.Value) + } + err := r.peerSearch.Batch(b) + if err != nil { + logger.Warn("PeerIndexer got error", zap.Error(err)) + } }) diff --git a/internal/repo/repo_test.go b/internal/repo/repo_test.go index ac30e756..fef3abfe 100644 --- a/internal/repo/repo_test.go +++ b/internal/repo/repo_test.go @@ -1,17 +1,18 @@ package repo_test import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/testenv" - "github.com/ronaksoft/rony/tools" - . "github.com/smartystreets/goconvey/convey" - "go.uber.org/zap" - "sync" - "testing" - "time" + "fmt" + "sync" + "testing" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/testenv" + "github.com/ronaksoft/rony/tools" + . "github.com/smartystreets/goconvey/convey" + "go.uber.org/zap" ) /* @@ -24,427 +25,427 @@ import ( */ func init() { - repo.MustInit("./_data", false) - testenv.Log().SetLogLevel(2) + repo.MustInit("./_data", false) + testenv.Log().SetLogLevel(2) } func createMediaMessage(body string, filename string, labelIDs []int32) *msg.UserMessage { - userID := domain.RandomInt63() - attrFile, _ := (&msg.DocumentAttributeFile{Filename: filename}).Marshal() - media, _ := (&msg.MediaDocument{ - Caption: "This is caption", - TTLinSeconds: 0, - Doc: &msg.Document{ - ID: domain.RandomInt63(), - AccessHash: domain.RandomUint64(), - Date: time.Now().Unix(), - MimeType: "", - FileSize: 1243, - Version: 0, - ClusterID: 1, - Attributes: []*msg.DocumentAttribute{ - { - Type: msg.DocumentAttributeType_AttributeTypeFile, - Data: attrFile, - }, - }, - Thumbnail: nil, - MD5Checksum: "", - }, - }).Marshal() - return &msg.UserMessage{ - ID: userID, - PeerID: domain.RandomInt63(), - PeerType: 1, - CreatedOn: time.Now().Unix(), - EditedOn: 0, - FwdSenderID: 0, - FwdChannelID: 0, - FwdChannelMessageID: 0, - Flags: 0, - MessageType: 0, - Body: body, - SenderID: userID, - ContentRead: false, - Inbox: false, - ReplyTo: 0, - MessageAction: 0, - MessageActionData: nil, - Entities: nil, - MediaType: msg.MediaType_MediaTypeDocument, - Media: media, - ReplyMarkup: 0, - ReplyMarkupData: nil, - LabelIDs: labelIDs, - } + userID := domain.RandomInt63() + attrFile, _ := (&msg.DocumentAttributeFile{Filename: filename}).Marshal() + media, _ := (&msg.MediaDocument{ + Caption: "This is caption", + TTLinSeconds: 0, + Doc: &msg.Document{ + ID: domain.RandomInt63(), + AccessHash: domain.RandomUint64(), + Date: time.Now().Unix(), + MimeType: "", + FileSize: 1243, + Version: 0, + ClusterID: 1, + Attributes: []*msg.DocumentAttribute{ + { + Type: msg.DocumentAttributeType_AttributeTypeFile, + Data: attrFile, + }, + }, + Thumbnail: nil, + MD5Checksum: "", + }, + }).Marshal() + return &msg.UserMessage{ + ID: userID, + PeerID: domain.RandomInt63(), + PeerType: 1, + CreatedOn: time.Now().Unix(), + EditedOn: 0, + FwdSenderID: 0, + FwdChannelID: 0, + FwdChannelMessageID: 0, + Flags: 0, + MessageType: 0, + Body: body, + SenderID: userID, + ContentRead: false, + Inbox: false, + ReplyTo: 0, + MessageAction: 0, + MessageActionData: nil, + Entities: nil, + MediaType: msg.MediaType_MediaTypeDocument, + Media: media, + ReplyMarkup: 0, + ReplyMarkupData: nil, + LabelIDs: labelIDs, + } } func createMessage(id int64, peerID int64, body string, labelIDs []int32) *msg.UserMessage { - userID := domain.RandomInt63() - - return &msg.UserMessage{ - ID: id, - PeerID: peerID, - PeerType: 1, - CreatedOn: time.Now().Unix(), - EditedOn: 0, - FwdSenderID: 0, - FwdChannelID: 0, - FwdChannelMessageID: 0, - Flags: 0, - MessageType: 0, - Body: body, - SenderID: userID, - ContentRead: false, - Inbox: false, - ReplyTo: 0, - MessageAction: 0, - MessageActionData: nil, - Entities: nil, - MediaType: msg.MediaType_MediaTypeEmpty, - Media: nil, - ReplyMarkup: 0, - ReplyMarkupData: nil, - LabelIDs: labelIDs, - } + userID := domain.RandomInt63() + + return &msg.UserMessage{ + ID: id, + PeerID: peerID, + PeerType: 1, + CreatedOn: time.Now().Unix(), + EditedOn: 0, + FwdSenderID: 0, + FwdChannelID: 0, + FwdChannelMessageID: 0, + Flags: 0, + MessageType: 0, + Body: body, + SenderID: userID, + ContentRead: false, + Inbox: false, + ReplyTo: 0, + MessageAction: 0, + MessageActionData: nil, + Entities: nil, + MediaType: msg.MediaType_MediaTypeEmpty, + Media: nil, + ReplyMarkup: 0, + ReplyMarkupData: nil, + LabelIDs: labelIDs, + } } func TestRepoDialogs(t *testing.T) { - dialog := new(msg.Dialog) - dialog.PeerID = 100 - dialog.PeerType = 1 - dialog.TopMessageID = 1000 - dialog.ReadOutboxMaxID = 900 - dialog.ReadInboxMaxID = 901 - // err := repo.Dialogs.save(dialog) - // if err != nil { - // t.Fatal(err) - // } - repo.Dialogs.SaveNew(dialog, time.Now().Unix()) - - d, _ := repo.Dialogs.Get(0, 100, 1) - t.Log(dialog) - t.Log(d) + dialog := new(msg.Dialog) + dialog.PeerID = 100 + dialog.PeerType = 1 + dialog.TopMessageID = 1000 + dialog.ReadOutboxMaxID = 900 + dialog.ReadInboxMaxID = 901 + // err := repo.Dialogs.save(dialog) + // if err != nil { + // t.Fatal(err) + // } + repo.Dialogs.SaveNew(dialog, time.Now().Unix()) + + d, _ := repo.Dialogs.Get(0, 100, 1) + t.Log(dialog) + t.Log(d) } func TestRepoMessagesExtra(t *testing.T) { - repo.MessagesExtra.SaveScrollID(0, 11, 1, 0, 101) - x := repo.MessagesExtra.GetScrollID(0, 11, 1, 0) - fmt.Println(x) + repo.MessagesExtra.SaveScrollID(0, 11, 1, 0, 101) + x := repo.MessagesExtra.GetScrollID(0, 11, 1, 0) + fmt.Println(x) } func TestPending(t *testing.T) { - pm := new(msg.ClientSendMessageMedia) - pm.Peer = new(msg.InputPeer) - _, err := repo.PendingMessages.SaveClientMessageMedia(0, 0, 10, 1, 11, 20, 21, pm, nil) - if err != nil { - t.Error(err) - } - pm1, _ := repo.PendingMessages.GetByID(10) - fmt.Println(pm1) - - _ = repo.PendingMessages.Delete(10) - pm2, _ := repo.PendingMessages.GetByID(10) - fmt.Println(pm2) + pm := new(msg.ClientSendMessageMedia) + pm.Peer = new(msg.InputPeer) + _, err := repo.PendingMessages.SaveClientMessageMedia(0, 0, 10, 1, 11, 20, 21, pm, nil) + if err != nil { + t.Error(err) + } + pm1, _ := repo.PendingMessages.GetByID(10) + fmt.Println(pm1) + + _ = repo.PendingMessages.Delete(10) + pm2, _ := repo.PendingMessages.GetByID(10) + fmt.Println(pm2) } func TestRepoDeleteMessage(t *testing.T) { - Convey("RepoDeleteMessage", t, func(c C) { - userID := tools.RandomInt64(0) - peerID := tools.RandomInt64(0) - peerType := int32(1) - - d, _ := repo.Dialogs.Get(0, peerID, peerType) - if d == nil { - d = new(msg.Dialog) - d.PeerID = peerID - d.PeerType = peerType - err := repo.Dialogs.Save(d) - c.So(err, ShouldBeNil) - } - - for i := int64(10); i < 20; i++ { - m := new(msg.UserMessage) - m.ID = i - m.PeerID = peerID - m.PeerType = peerType - m.SenderID = peerID - m.Body = fmt.Sprintf("Text %d", i) - err := repo.Messages.SaveNew(m, userID) - c.So(err, ShouldBeNil) - } - - d, _ = repo.Dialogs.Get(0, peerID, peerType) - c.So(d.TopMessageID, ShouldEqual, 19) - - repo.Messages.Delete(userID, 0, peerID, peerType, 19) - d, _ = repo.Dialogs.Get(0, peerID, peerType) - c.So(d.TopMessageID, ShouldEqual, 18) - - msgs, _, _ := repo.Messages.GetMessageHistory(0, peerID, peerType, 0, 0, 5) - c.So(msgs, ShouldHaveLength, 5) - c.So(msgs[0].ID, ShouldEqual, 18) - c.So(msgs[4].ID, ShouldEqual, 14) - }) + Convey("RepoDeleteMessage", t, func(c C) { + userID := tools.RandomInt64(0) + peerID := tools.RandomInt64(0) + peerType := int32(1) + + d, _ := repo.Dialogs.Get(0, peerID, peerType) + if d == nil { + d = new(msg.Dialog) + d.PeerID = peerID + d.PeerType = peerType + err := repo.Dialogs.Save(d) + c.So(err, ShouldBeNil) + } + + for i := int64(10); i < 20; i++ { + m := new(msg.UserMessage) + m.ID = i + m.PeerID = peerID + m.PeerType = peerType + m.SenderID = peerID + m.Body = fmt.Sprintf("Text %d", i) + err := repo.Messages.SaveNew(m, userID) + c.So(err, ShouldBeNil) + } + + d, _ = repo.Dialogs.Get(0, peerID, peerType) + c.So(d.TopMessageID, ShouldEqual, 19) + + repo.Messages.Delete(userID, 0, peerID, peerType, 19) + d, _ = repo.Dialogs.Get(0, peerID, peerType) + c.So(d.TopMessageID, ShouldEqual, 18) + + msgs, _, _ := repo.Messages.GetMessageHistory(0, peerID, peerType, 0, 0, 5) + c.So(msgs, ShouldHaveLength, 5) + c.So(msgs[0].ID, ShouldEqual, 18) + c.So(msgs[4].ID, ShouldEqual, 14) + }) } func TestConcurrent(t *testing.T) { - waitGroup := sync.WaitGroup{} - for i := int64(1); i < 10000; i++ { - waitGroup.Add(1) - go func(i int64) { - _, err := repo.PendingMessages.SaveMessageMedia(0, 0, i, 1001, &msg.MessagesSendMedia{ - RandomID: domain.RandomInt63(), - Peer: &msg.InputPeer{ - ID: i, - Type: msg.PeerType_PeerUser, - AccessHash: 0, - }, - MediaType: 0, - MediaData: nil, - ReplyTo: 0, - ClearDraft: false, - }) - waitGroup.Done() - if err != nil { - testenv.Log().Fatal("Error On Save Pending", zap.Error(err)) - } - }(i) - waitGroup.Add(1) - go func(i int64) { - _ = repo.PendingMessages.Delete(i) - waitGroup.Done() - }(i) - } - waitGroup.Wait() + waitGroup := sync.WaitGroup{} + for i := int64(1); i < 10000; i++ { + waitGroup.Add(1) + go func(i int64) { + _, err := repo.PendingMessages.SaveMessageMedia(0, 0, i, 1001, &msg.MessagesSendMedia{ + RandomID: domain.RandomInt63(), + Peer: &msg.InputPeer{ + ID: i, + Type: msg.PeerType_PeerUser, + AccessHash: 0, + }, + MediaType: 0, + MediaData: nil, + ReplyTo: 0, + ClearDraft: false, + }) + waitGroup.Done() + if err != nil { + testenv.Log().Fatal("Error On Save Pending", zap.Error(err)) + } + }(i) + waitGroup.Add(1) + go func(i int64) { + _ = repo.PendingMessages.Delete(i) + waitGroup.Done() + }(i) + } + waitGroup.Wait() } func TestClearHistory(t *testing.T) { - Convey("ClearHistory", t, func(c C) { - peerID := tools.RandomInt64(0) - userID := tools.RandomInt64(0) - dialog := &msg.Dialog{ - TeamID: 0, - PeerID: peerID, - PeerType: 1, - TopMessageID: 1, - UnreadCount: 0, - MentionedCount: 0, - AccessHash: 0, - } - err := repo.Dialogs.SaveNew(dialog, tools.TimeUnix()) - c.So(err, ShouldBeNil) - - for i := 1; i < 1000; i++ { - err := repo.Messages.SaveNew(&msg.UserMessage{ - ID: int64(i), - PeerID: peerID, - PeerType: 1, - CreatedOn: time.Now().Unix(), - EditedOn: 0, - FwdSenderID: 0, - FwdChannelID: 0, - FwdChannelMessageID: 0, - Flags: 0, - MessageType: 0, - Body: fmt.Sprintf("Hello %d", i), - SenderID: peerID, - ContentRead: false, - Inbox: false, - ReplyTo: 0, - MessageAction: 0, - MessageActionData: nil, - Entities: nil, - MediaType: 0, - Media: nil, - }, userID) - c.So(err, ShouldBeNil) - } - - err = repo.Messages.ClearHistory(userID, 0, peerID, 1, 995) - c.So(err, ShouldBeNil) - - d, err := repo.Dialogs.Get(0, peerID, 1) - c.So(err, ShouldBeNil) - c.So(d.TopMessageID, ShouldEqual, 999) - - ums, users, groups := repo.Messages.GetMessageHistory(0, peerID, 1, 0, 0, 100) - c.So(users, ShouldNotBeNil) - c.So(groups, ShouldNotBeNil) - c.So(ums, ShouldHaveLength, 4) - - repo.Messages.Delete(userID, 0, peerID, 1, 999) - d, err = repo.Dialogs.Get(0, peerID, 1) - c.So(err, ShouldBeNil) - c.So(d.TopMessageID, ShouldEqual, 998) - }) + Convey("ClearHistory", t, func(c C) { + peerID := tools.RandomInt64(0) + userID := tools.RandomInt64(0) + dialog := &msg.Dialog{ + TeamID: 0, + PeerID: peerID, + PeerType: 1, + TopMessageID: 1, + UnreadCount: 0, + MentionedCount: 0, + AccessHash: 0, + } + err := repo.Dialogs.SaveNew(dialog, tools.TimeUnix()) + c.So(err, ShouldBeNil) + + for i := 1; i < 1000; i++ { + err := repo.Messages.SaveNew(&msg.UserMessage{ + ID: int64(i), + PeerID: peerID, + PeerType: 1, + CreatedOn: time.Now().Unix(), + EditedOn: 0, + FwdSenderID: 0, + FwdChannelID: 0, + FwdChannelMessageID: 0, + Flags: 0, + MessageType: 0, + Body: fmt.Sprintf("Hello %d", i), + SenderID: peerID, + ContentRead: false, + Inbox: false, + ReplyTo: 0, + MessageAction: 0, + MessageActionData: nil, + Entities: nil, + MediaType: 0, + Media: nil, + }, userID) + c.So(err, ShouldBeNil) + } + + err = repo.Messages.ClearHistory(userID, 0, peerID, 1, 995) + c.So(err, ShouldBeNil) + + d, err := repo.Dialogs.Get(0, peerID, 1) + c.So(err, ShouldBeNil) + c.So(d.TopMessageID, ShouldEqual, 999) + + ums, users, groups := repo.Messages.GetMessageHistory(0, peerID, 1, 0, 0, 100) + c.So(users, ShouldNotBeNil) + c.So(groups, ShouldNotBeNil) + c.So(ums, ShouldHaveLength, 4) + + repo.Messages.Delete(userID, 0, peerID, 1, 999) + d, err = repo.Dialogs.Get(0, peerID, 1) + c.So(err, ShouldBeNil) + c.So(d.TopMessageID, ShouldEqual, 998) + }) } func TestSearch(t *testing.T) { - m := make([]*msg.UserMessage, 0, 10) - for i := 1; i < 100; i++ { - peerID := int64(i%10 + 1) - peerType := int32(msg.PeerType_PeerUser) - if i%2 == 0 { - peerID = -peerID - peerType = int32(msg.PeerType_PeerGroup) - } - m = append(m, &msg.UserMessage{ - ID: int64(i), - PeerID: peerID, - PeerType: peerType, - CreatedOn: time.Now().Unix(), - EditedOn: 0, - FwdSenderID: 0, - FwdChannelID: 0, - FwdChannelMessageID: 0, - Flags: 0, - MessageType: 0, - Body: fmt.Sprintf("Hello %d %d", i, peerType), - SenderID: 100, - ContentRead: false, - Inbox: false, - ReplyTo: 0, - MessageAction: 0, - MessageActionData: nil, - Entities: nil, - MediaType: 0, - Media: nil, - }) - } - repo.Messages.Save(m...) - - _ = repo.Messages.SearchTextByPeerID(0, "H", 6, 100) - _ = repo.Messages.SearchTextByPeerID(0, "H", -7, 100) + m := make([]*msg.UserMessage, 0, 10) + for i := 1; i < 100; i++ { + peerID := int64(i%10 + 1) + peerType := int32(msg.PeerType_PeerUser) + if i%2 == 0 { + peerID = -peerID + peerType = int32(msg.PeerType_PeerGroup) + } + m = append(m, &msg.UserMessage{ + ID: int64(i), + PeerID: peerID, + PeerType: peerType, + CreatedOn: time.Now().Unix(), + EditedOn: 0, + FwdSenderID: 0, + FwdChannelID: 0, + FwdChannelMessageID: 0, + Flags: 0, + MessageType: 0, + Body: fmt.Sprintf("Hello %d %d", i, peerType), + SenderID: 100, + ContentRead: false, + Inbox: false, + ReplyTo: 0, + MessageAction: 0, + MessageActionData: nil, + Entities: nil, + MediaType: 0, + Media: nil, + }) + } + repo.Messages.Save(m...) + + _ = repo.Messages.SearchTextByPeerID(0, "H", 6, 100) + _ = repo.Messages.SearchTextByPeerID(0, "H", -7, 100) } func TestUserPhotoGallery(t *testing.T) { - Convey("UserPhotoGallery", t, func(c C) { - userID := tools.RandomInt64(0) - photo1 := &msg.UserPhoto{ - PhotoBig: &msg.FileLocation{ - ClusterID: 100, - FileID: 200, - AccessHash: 300, - }, - PhotoSmall: &msg.FileLocation{ - ClusterID: 10, - FileID: 20, - AccessHash: 30, - }, - PhotoID: 1, - } - photo2 := &msg.UserPhoto{ - PhotoBig: &msg.FileLocation{ - ClusterID: 101, - FileID: 201, - AccessHash: 301, - }, - PhotoSmall: &msg.FileLocation{ - ClusterID: 11, - FileID: 21, - AccessHash: 31, - }, - PhotoID: 2, - } - user := &msg.User{ - ID: userID, - FirstName: "Ehsan", - LastName: "Noureddin Moosa", - Username: "", - Status: 0, - Restricted: false, - AccessHash: 0, - Photo: photo1, - Bio: "", - Phone: "", - LastSeen: 0, - PhotoGallery: nil, - IsBot: false, - } - repo.Users.Save(user) - - _, err := repo.Users.Get(userID) - c.So(err, ShouldBeNil) - - user.PhotoGallery = []*msg.UserPhoto{photo1, photo2} - repo.Users.Save(user) - _, err = repo.Users.Get(userID) - c.So(err, ShouldBeNil) - - phGallery := repo.Users.GetPhotoGallery(userID) - c.So(phGallery, ShouldHaveLength, 2) - c.So(phGallery[0].PhotoID, ShouldEqual, 1) - c.So(phGallery[1].PhotoID, ShouldEqual, 2) - }) + Convey("UserPhotoGallery", t, func(c C) { + userID := tools.RandomInt64(0) + photo1 := &msg.UserPhoto{ + PhotoBig: &msg.FileLocation{ + ClusterID: 100, + FileID: 200, + AccessHash: 300, + }, + PhotoSmall: &msg.FileLocation{ + ClusterID: 10, + FileID: 20, + AccessHash: 30, + }, + PhotoID: 1, + } + photo2 := &msg.UserPhoto{ + PhotoBig: &msg.FileLocation{ + ClusterID: 101, + FileID: 201, + AccessHash: 301, + }, + PhotoSmall: &msg.FileLocation{ + ClusterID: 11, + FileID: 21, + AccessHash: 31, + }, + PhotoID: 2, + } + user := &msg.User{ + ID: userID, + FirstName: "Ehsan", + LastName: "Noureddin Moosa", + Username: "", + Status: 0, + Restricted: false, + AccessHash: 0, + Photo: photo1, + Bio: "", + Phone: "", + LastSeen: 0, + PhotoGallery: nil, + IsBot: false, + } + repo.Users.Save(user) + + _, err := repo.Users.Get(userID) + c.So(err, ShouldBeNil) + + user.PhotoGallery = []*msg.UserPhoto{photo1, photo2} + repo.Users.Save(user) + _, err = repo.Users.Get(userID) + c.So(err, ShouldBeNil) + + phGallery := repo.Users.GetPhotoGallery(userID) + c.So(phGallery, ShouldHaveLength, 2) + c.So(phGallery[0].PhotoID, ShouldEqual, 1) + c.So(phGallery[1].PhotoID, ShouldEqual, 2) + }) } func TestGroupPhotoGallery(t *testing.T) { - Convey("GroupPhotoGallery", t, func(c C) { - groupID := -tools.RandomInt64(0) - photo1 := &msg.GroupPhoto{ - PhotoBig: &msg.FileLocation{ - ClusterID: 100, - FileID: 200, - AccessHash: 300, - }, - PhotoSmall: &msg.FileLocation{ - ClusterID: 10, - FileID: 20, - AccessHash: 30, - }, - PhotoID: 1, - } - photo2 := &msg.GroupPhoto{ - PhotoBig: &msg.FileLocation{ - ClusterID: 101, - FileID: 201, - AccessHash: 301, - }, - PhotoSmall: &msg.FileLocation{ - ClusterID: 11, - FileID: 21, - AccessHash: 31, - }, - PhotoID: 2, - } - group := &msg.GroupFull{ - Group: &msg.Group{ - ID: groupID, - Title: "Test Group", - CreatedOn: 0, - Participants: 0, - EditedOn: 0, - Flags: nil, - Photo: photo1, - }, - Users: nil, - Participants: nil, - NotifySettings: nil, - PhotoGallery: []*msg.GroupPhoto{photo1, photo2}, - } - - repo.Groups.Save(group.Group) - repo.Groups.SavePhotoGallery(group.Group.ID, group.PhotoGallery...) - - phGallery, err := repo.Groups.GetPhotoGallery(groupID) - c.So(err, ShouldBeNil) - c.So(phGallery, ShouldHaveLength, 2) - }) + Convey("GroupPhotoGallery", t, func(c C) { + groupID := -tools.RandomInt64(0) + photo1 := &msg.GroupPhoto{ + PhotoBig: &msg.FileLocation{ + ClusterID: 100, + FileID: 200, + AccessHash: 300, + }, + PhotoSmall: &msg.FileLocation{ + ClusterID: 10, + FileID: 20, + AccessHash: 30, + }, + PhotoID: 1, + } + photo2 := &msg.GroupPhoto{ + PhotoBig: &msg.FileLocation{ + ClusterID: 101, + FileID: 201, + AccessHash: 301, + }, + PhotoSmall: &msg.FileLocation{ + ClusterID: 11, + FileID: 21, + AccessHash: 31, + }, + PhotoID: 2, + } + group := &msg.GroupFull{ + Group: &msg.Group{ + ID: groupID, + Title: "Test Group", + CreatedOn: 0, + Participants: 0, + EditedOn: 0, + Flags: nil, + Photo: photo1, + }, + Users: nil, + Participants: nil, + NotifySettings: nil, + PhotoGallery: []*msg.GroupPhoto{photo1, photo2}, + } + + repo.Groups.Save(group.Group) + repo.Groups.SavePhotoGallery(group.Group.ID, group.PhotoGallery...) + + phGallery, err := repo.Groups.GetPhotoGallery(groupID) + c.So(err, ShouldBeNil) + c.So(phGallery, ShouldHaveLength, 2) + }) } func TestMessagesSave(t *testing.T) { - Convey("MessageSave", t, func(c C) { - m := createMediaMessage("Hello", "file.txt", nil) - repo.Messages.Save(m) - media := &msg.MediaDocument{} - err := media.Unmarshal(m.Media) - c.So(err, ShouldBeNil) - clientFile, err := repo.Files.Get(media.Doc.ClusterID, media.Doc.ID, media.Doc.AccessHash) - c.So(err, ShouldBeNil) - c.So(clientFile.MessageID, ShouldEqual, m.ID) - }) + Convey("MessageSave", t, func(c C) { + m := createMediaMessage("Hello", "file.txt", nil) + repo.Messages.Save(m) + media := &msg.MediaDocument{} + err := media.Unmarshal(m.Media) + c.So(err, ShouldBeNil) + clientFile, err := repo.Files.Get(media.Doc.ClusterID, media.Doc.ID, media.Doc.AccessHash) + c.So(err, ShouldBeNil) + c.So(clientFile.MessageID, ShouldEqual, m.ID) + }) } diff --git a/internal/repo/teams.go b/internal/repo/teams.go index 7d1e436d..360b157b 100644 --- a/internal/repo/teams.go +++ b/internal/repo/teams.go @@ -1,12 +1,13 @@ package repo import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" + "fmt" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" ) /** @@ -16,112 +17,112 @@ import ( */ type repoTeams struct { - *repository + *repository } const ( - prefixTeams = "TEAMS" + prefixTeams = "TEAMS" ) func getTeamKey(teamID int64) []byte { - sb := pools.AcquireStringsBuilder() - sb.WriteString(prefixTeams) - sb.WriteRune('.') - z.AppendStrInt64(sb, teamID) - id := tools.StrToByte(sb.String()) - pools.ReleaseStringsBuilder(sb) - return id + sb := pools.AcquireStringsBuilder() + sb.WriteString(prefixTeams) + sb.WriteRune('.') + z.AppendStrInt64(sb, teamID) + id := tools.StrToByte(sb.String()) + pools.ReleaseStringsBuilder(sb) + return id } func (r *repoTeams) List() []*msg.Team { - teamList := make([]*msg.Team, 0, 10) - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixTeams)) - it := txn.NewIterator(opts) + teamList := make([]*msg.Team, 0, 10) + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixTeams)) + it := txn.NewIterator(opts) - defer it.Close() - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - _ = it.Item().Value(func(val []byte) error { - t := &msg.Team{} - err := t.Unmarshal(val) - if err != nil { - return err - } - teamList = append(teamList, t) - return nil - }) - } + defer it.Close() + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + _ = it.Item().Value(func(val []byte) error { + t := &msg.Team{} + err := t.Unmarshal(val) + if err != nil { + return err + } + teamList = append(teamList, t) + return nil + }) + } - return nil - }) - return teamList + return nil + }) + return teamList } func (r *repoTeams) Get(teamID int64) (team *msg.Team, err error) { - err = badgerView(func(txn *badger.Txn) error { - team, err = r.get(txn, teamID) - return err - }) - return + err = badgerView(func(txn *badger.Txn) error { + team, err = r.get(txn, teamID) + return err + }) + return } func (r *repoTeams) get(txn *badger.Txn, teamID int64) (*msg.Team, error) { - team := &msg.Team{} - item, err := txn.Get(getTeamKey(teamID)) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return team.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return team, nil + team := &msg.Team{} + item, err := txn.Get(getTeamKey(teamID)) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return team.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return team, nil } func (r *repoTeams) Save(teams ...*msg.Team) error { - err := badgerUpdate(func(txn *badger.Txn) error { - for _, team := range teams { - teamBytes, _ := team.Marshal() - recentSearchKey := getTeamKey(team.ID) - err := txn.SetEntry(badger.NewEntry( - recentSearchKey, teamBytes, - )) - if err != nil { - return err - } - } - return nil - }) - return err + err := badgerUpdate(func(txn *badger.Txn) error { + for _, team := range teams { + teamBytes, _ := team.Marshal() + recentSearchKey := getTeamKey(team.ID) + err := txn.SetEntry(badger.NewEntry( + recentSearchKey, teamBytes, + )) + if err != nil { + return err + } + } + return nil + }) + return err } func (r *repoTeams) Delete(teamID int64) error { - err := badgerUpdate(func(txn *badger.Txn) error { - teamKey := getTeamKey(teamID) - err := txn.Delete(teamKey) - return err - }) - return err + err := badgerUpdate(func(txn *badger.Txn) error { + teamKey := getTeamKey(teamID) + err := txn.Delete(teamKey) + return err + }) + return err } func (r *repoTeams) Clear() error { - err := badgerUpdate(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixTeams)) - opts.PrefetchValues = false - it := txn.NewIterator(opts) - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - err := txn.Delete(it.Item().KeyCopy(nil)) - if err != nil { - return err - } - } - it.Close() + err := badgerUpdate(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixTeams)) + opts.PrefetchValues = false + it := txn.NewIterator(opts) + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + err := txn.Delete(it.Item().KeyCopy(nil)) + if err != nil { + return err + } + } + it.Close() - return nil - }) - return err + return nil + }) + return err } diff --git a/internal/repo/top_peers.go b/internal/repo/top_peers.go index bef87862..dea394b2 100644 --- a/internal/repo/top_peers.go +++ b/internal/repo/top_peers.go @@ -1,15 +1,16 @@ package repo import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/tools" - "github.com/tidwall/buntdb" - "go.uber.org/zap" - "math" - "strings" + "fmt" + "math" + "strings" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony/tools" + "github.com/tidwall/buntdb" + "go.uber.org/zap" ) /* @@ -22,214 +23,214 @@ import ( */ type repoTopPeers struct { - *repository + *repository } const ( - indexTopPeersUser = "T_PEER_U" - indexTopPeersGroup = "T_PEER_G" - indexTopPeersForward = "T_PEER_F" - indexTopPeersBotMessage = "T_PEER_BM" - indexTopPeersBotInline = "T_PEER_BI" + indexTopPeersUser = "T_PEER_U" + indexTopPeersGroup = "T_PEER_G" + indexTopPeersForward = "T_PEER_F" + indexTopPeersBotMessage = "T_PEER_BM" + indexTopPeersBotInline = "T_PEER_BI" ) func getTopPeerFromIndexKey(key string) (int64, *msg.Peer) { - parts := strings.Split(key, ".") - if len(parts) != 4 { - return 0, nil - } - return tools.StrToInt64(parts[1]), &msg.Peer{ - ID: tools.StrToInt64(parts[2]), - Type: tools.StrToInt32(parts[3]), - } + parts := strings.Split(key, ".") + if len(parts) != 4 { + return 0, nil + } + return tools.StrToInt64(parts[1]), &msg.Peer{ + ID: tools.StrToInt64(parts[2]), + Type: tools.StrToInt32(parts[3]), + } } func getTopPeerKey(cat msg.TopPeerCategory, teamID, peerID int64, peerType int32) []byte { - var indexName string - switch cat { - case msg.TopPeerCategory_Users: - indexName = indexTopPeersUser - case msg.TopPeerCategory_Groups: - indexName = indexTopPeersGroup - case msg.TopPeerCategory_Forwards: - indexName = indexTopPeersForward - case msg.TopPeerCategory_BotsMessage: - indexName = indexTopPeersBotMessage - case msg.TopPeerCategory_BotsInline: - indexName = indexTopPeersBotInline - default: - panic("BUG! we dont support the top peer category") - } - - return tools.StrToByte(fmt.Sprintf("%s.%021d.%021d.%04d", indexName, teamID, peerID, peerType)) + var indexName string + switch cat { + case msg.TopPeerCategory_Users: + indexName = indexTopPeersUser + case msg.TopPeerCategory_Groups: + indexName = indexTopPeersGroup + case msg.TopPeerCategory_Forwards: + indexName = indexTopPeersForward + case msg.TopPeerCategory_BotsMessage: + indexName = indexTopPeersBotMessage + case msg.TopPeerCategory_BotsInline: + indexName = indexTopPeersBotInline + default: + panic("BUG! we dont support the top peer category") + } + + return tools.StrToByte(fmt.Sprintf("%s.%021d.%021d.%04d", indexName, teamID, peerID, peerType)) } func saveTopPeer(txn *badger.Txn, cat msg.TopPeerCategory, teamID int64, tp *msg.TopPeer) error { - if tp.Peer == nil { - logger.Warn("Could not save top peer, peer is nit", zap.Any("TP", tp)) - return domain.ErrDoesNotExists - } - b, _ := tp.Marshal() - logger.Debug("SaveTopPeer", - zap.ByteString("Key", getTopPeerKey(cat, teamID, tp.Peer.ID, tp.Peer.Type)), - zap.Float32("Rate", tp.Rate), - ) - return txn.SetEntry(badger.NewEntry( - getTopPeerKey(cat, teamID, tp.Peer.ID, tp.Peer.Type), - b, - )) + if tp.Peer == nil { + logger.Warn("Could not save top peer, peer is nit", zap.Any("TP", tp)) + return domain.ErrDoesNotExists + } + b, _ := tp.Marshal() + logger.Debug("SaveTopPeer", + zap.ByteString("Key", getTopPeerKey(cat, teamID, tp.Peer.ID, tp.Peer.Type)), + zap.Float32("Rate", tp.Rate), + ) + return txn.SetEntry(badger.NewEntry( + getTopPeerKey(cat, teamID, tp.Peer.ID, tp.Peer.Type), + b, + )) } func getTopPeer(txn *badger.Txn, cat msg.TopPeerCategory, teamID, peerID int64, peerType int32) (*msg.TopPeer, error) { - item, err := txn.Get(getTopPeerKey(cat, teamID, peerID, peerType)) - switch err { - case nil: - case badger.ErrKeyNotFound: - return nil, nil - default: - return nil, err - } - - tp := &msg.TopPeer{} - err = item.Value(func(val []byte) error { - return tp.Unmarshal(val) - }) - return tp, err + item, err := txn.Get(getTopPeerKey(cat, teamID, peerID, peerType)) + switch err { + case nil: + case badger.ErrKeyNotFound: + return nil, nil + default: + return nil, err + } + + tp := &msg.TopPeer{} + err = item.Value(func(val []byte) error { + return tp.Unmarshal(val) + }) + return tp, err } func deleteTopPeer(txn *badger.Txn, cat msg.TopPeerCategory, teamID, peerID int64, peerType int32) error { - err := txn.Delete(getTopPeerKey(cat, teamID, peerID, peerType)) - switch err { - case nil, badger.ErrKeyNotFound: - return nil - default: - return err - } + err := txn.Delete(getTopPeerKey(cat, teamID, peerID, peerType)) + switch err { + case nil, badger.ErrKeyNotFound: + return nil + default: + return err + } } func (r *repoTopPeers) updateIndex(cat msg.TopPeerCategory, teamID, peerID int64, peerType int32, rate float32) error { - return r.bunt.Update(func(tx *buntdb.Tx) error { - _, _, err := tx.Set( - tools.ByteToStr(getTopPeerKey(cat, teamID, peerID, peerType)), - fmt.Sprintf("%f", rate), - nil, - ) - return err - }) + return r.bunt.Update(func(tx *buntdb.Tx) error { + _, _, err := tx.Set( + tools.ByteToStr(getTopPeerKey(cat, teamID, peerID, peerType)), + fmt.Sprintf("%f", rate), + nil, + ) + return err + }) } func (r *repoTopPeers) Save(cat msg.TopPeerCategory, userID, teamID int64, tps ...*msg.TopPeer) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, tp := range tps { - if tp.Peer != nil && tp.Peer.ID == userID { - continue - } - err := saveTopPeer(txn, cat, teamID, tp) - if err != nil { - return err - } - err = r.updateIndex(cat, teamID, tp.Peer.ID, tp.Peer.Type, tp.Rate) - if err != nil { - return err - } - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, tp := range tps { + if tp.Peer != nil && tp.Peer.ID == userID { + continue + } + err := saveTopPeer(txn, cat, teamID, tp) + if err != nil { + return err + } + err = r.updateIndex(cat, teamID, tp.Peer.ID, tp.Peer.Type, tp.Rate) + if err != nil { + return err + } + } + return nil + }) } func (r *repoTopPeers) Delete(cat msg.TopPeerCategory, teamID, peerID int64, peerType int32) error { - return badgerUpdate(func(txn *badger.Txn) error { - return deleteTopPeer(txn, cat, teamID, peerID, peerType) - }) + return badgerUpdate(func(txn *badger.Txn) error { + return deleteTopPeer(txn, cat, teamID, peerID, peerType) + }) } func (r *repoTopPeers) Update(cat msg.TopPeerCategory, userID, teamID, peerID int64, peerType int32) error { - if peerID == userID { - return nil - } - return badgerUpdate(func(txn *badger.Txn) error { - accessTime := domain.Now().Unix() - tp, _ := getTopPeer(txn, cat, teamID, peerID, peerType) - if tp == nil { - switch msg.PeerType(peerType) { - case msg.PeerType_PeerUser: - p, err := getUserByKey(txn, getUserKey(peerID)) - if err != nil { - return err - } - tp = &msg.TopPeer{ - Peer: &msg.Peer{ - ID: p.ID, - Type: peerType, - AccessHash: p.AccessHash, - }, - } - case msg.PeerType_PeerGroup: - p, err := getGroupByKey(txn, getGroupKey(peerID)) - if err != nil { - return err - } - tp = &msg.TopPeer{ - Peer: &msg.Peer{ - ID: p.ID, - Type: peerType, - }, - } - default: - return domain.ErrNotFound - } - } - tp.Rate += float32(math.Min(math.Exp(float64(float32(accessTime-tp.LastUpdate)/domain.SysConfig.TopPeerDecayRate)), float64(domain.SysConfig.TopPeerMaxStep))) - tp.LastUpdate = accessTime - err := saveTopPeer(txn, cat, teamID, tp) - if err != nil { - return err - } - - return r.updateIndex(cat, teamID, peerID, peerType, tp.Rate) - }) + if peerID == userID { + return nil + } + return badgerUpdate(func(txn *badger.Txn) error { + accessTime := domain.Now().Unix() + tp, _ := getTopPeer(txn, cat, teamID, peerID, peerType) + if tp == nil { + switch msg.PeerType(peerType) { + case msg.PeerType_PeerUser: + p, err := getUserByKey(txn, getUserKey(peerID)) + if err != nil { + return err + } + tp = &msg.TopPeer{ + Peer: &msg.Peer{ + ID: p.ID, + Type: peerType, + AccessHash: p.AccessHash, + }, + } + case msg.PeerType_PeerGroup: + p, err := getGroupByKey(txn, getGroupKey(peerID)) + if err != nil { + return err + } + tp = &msg.TopPeer{ + Peer: &msg.Peer{ + ID: p.ID, + Type: peerType, + }, + } + default: + return domain.ErrNotFound + } + } + tp.Rate += float32(math.Min(math.Exp(float64(float32(accessTime-tp.LastUpdate)/domain.SysConfig.TopPeerDecayRate)), float64(domain.SysConfig.TopPeerMaxStep))) + tp.LastUpdate = accessTime + err := saveTopPeer(txn, cat, teamID, tp) + if err != nil { + return err + } + + return r.updateIndex(cat, teamID, peerID, peerType, tp.Rate) + }) } func (r *repoTopPeers) List(teamID int64, cat msg.TopPeerCategory, offset, limit int32) ([]*msg.TopPeer, error) { - var ( - topPeers = make([]*msg.TopPeer, 0, limit) - indexName = "" - ) - switch cat { - case msg.TopPeerCategory_Users: - indexName = indexTopPeersUser - case msg.TopPeerCategory_Groups: - indexName = indexTopPeersGroup - case msg.TopPeerCategory_Forwards: - indexName = indexTopPeersForward - case msg.TopPeerCategory_BotsMessage: - indexName = indexTopPeersBotMessage - case msg.TopPeerCategory_BotsInline: - indexName = indexTopPeersBotInline - default: - panic("BUG! we dont support the top peer category") - } - - err := badgerView(func(txn *badger.Txn) error { - return r.bunt.View(func(tx *buntdb.Tx) error { - return tx.Descend(indexName, func(key, value string) bool { - if offset--; offset >= 0 { - return true - } - if limit--; limit < 0 { - return false - } - peerTeamID, peer := getTopPeerFromIndexKey(key) - if peerTeamID != teamID { - return true - } - topPeer, err := getTopPeer(txn, cat, peerTeamID, peer.ID, peer.Type) - if err == nil && topPeer != nil { - topPeers = append(topPeers, topPeer) - } - return true - }) - }) - }) - return topPeers, err + var ( + topPeers = make([]*msg.TopPeer, 0, limit) + indexName = "" + ) + switch cat { + case msg.TopPeerCategory_Users: + indexName = indexTopPeersUser + case msg.TopPeerCategory_Groups: + indexName = indexTopPeersGroup + case msg.TopPeerCategory_Forwards: + indexName = indexTopPeersForward + case msg.TopPeerCategory_BotsMessage: + indexName = indexTopPeersBotMessage + case msg.TopPeerCategory_BotsInline: + indexName = indexTopPeersBotInline + default: + panic("BUG! we dont support the top peer category") + } + + err := badgerView(func(txn *badger.Txn) error { + return r.bunt.View(func(tx *buntdb.Tx) error { + return tx.Descend(indexName, func(key, value string) bool { + if offset--; offset >= 0 { + return true + } + if limit--; limit < 0 { + return false + } + peerTeamID, peer := getTopPeerFromIndexKey(key) + if peerTeamID != teamID { + return true + } + topPeer, err := getTopPeer(txn, cat, peerTeamID, peer.ID, peer.Type) + if err == nil && topPeer != nil { + topPeers = append(topPeers, topPeer) + } + return true + }) + }) + }) + return topPeers, err } diff --git a/internal/repo/top_peers_test.go b/internal/repo/top_peers_test.go index 4425123c..1147eb50 100644 --- a/internal/repo/top_peers_test.go +++ b/internal/repo/top_peers_test.go @@ -1,13 +1,14 @@ package repo_test import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony/tools" - . "github.com/smartystreets/goconvey/convey" - "testing" - "time" + "fmt" + "testing" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony/tools" + . "github.com/smartystreets/goconvey/convey" ) /* @@ -20,50 +21,50 @@ import ( */ func TestTopPeer(t *testing.T) { - Convey("Testing TopPeers", t, func(c C) { - Convey("Save TopPeer", func(c C) { - userID := tools.RandomInt64(0) - teamID := int64(0) - var topPeers []*msg.TopPeer - for i := 0; i < 10; i++ { - peerID := tools.RandomInt64(0) - topPeers = append(topPeers, &msg.TopPeer{ - TeamID: teamID, - Peer: &msg.Peer{ - ID: peerID, - Type: 1, - AccessHash: 0, - }, - Rate: 1.0 / float32(i), - LastUpdate: time.Now().Unix(), - }) - _ = repo.Users.Save(&msg.User{ - ID: peerID, - FirstName: fmt.Sprintf("User%d", i), - }) - } + Convey("Testing TopPeers", t, func(c C) { + Convey("Save TopPeer", func(c C) { + userID := tools.RandomInt64(0) + teamID := int64(0) + var topPeers []*msg.TopPeer + for i := 0; i < 10; i++ { + peerID := tools.RandomInt64(0) + topPeers = append(topPeers, &msg.TopPeer{ + TeamID: teamID, + Peer: &msg.Peer{ + ID: peerID, + Type: 1, + AccessHash: 0, + }, + Rate: 1.0 / float32(i), + LastUpdate: time.Now().Unix(), + }) + _ = repo.Users.Save(&msg.User{ + ID: peerID, + FirstName: fmt.Sprintf("User%d", i), + }) + } - for i := 0; i < 10; i++ { - for _, tp := range topPeers { - err := repo.TopPeers.Update(msg.TopPeerCategory_Forwards, userID, teamID, tp.Peer.ID, tp.Peer.Type) - c.So(err, ShouldBeNil) - err = repo.TopPeers.Update(msg.TopPeerCategory_Users, userID, teamID, tp.Peer.ID, tp.Peer.Type) - c.So(err, ShouldBeNil) - } - time.Sleep(time.Second) - for _, tp := range topPeers { - err := repo.TopPeers.Update(msg.TopPeerCategory_Forwards, userID, teamID, tp.Peer.ID, tp.Peer.Type) - c.So(err, ShouldBeNil) - err = repo.TopPeers.Update(msg.TopPeerCategory_Users, userID, teamID, tp.Peer.ID, tp.Peer.Type) - c.So(err, ShouldBeNil) - } + for i := 0; i < 10; i++ { + for _, tp := range topPeers { + err := repo.TopPeers.Update(msg.TopPeerCategory_Forwards, userID, teamID, tp.Peer.ID, tp.Peer.Type) + c.So(err, ShouldBeNil) + err = repo.TopPeers.Update(msg.TopPeerCategory_Users, userID, teamID, tp.Peer.ID, tp.Peer.Type) + c.So(err, ShouldBeNil) + } + time.Sleep(time.Second) + for _, tp := range topPeers { + err := repo.TopPeers.Update(msg.TopPeerCategory_Forwards, userID, teamID, tp.Peer.ID, tp.Peer.Type) + c.So(err, ShouldBeNil) + err = repo.TopPeers.Update(msg.TopPeerCategory_Users, userID, teamID, tp.Peer.ID, tp.Peer.Type) + c.So(err, ShouldBeNil) + } - list, err := repo.TopPeers.List(teamID, msg.TopPeerCategory_Forwards, 0, 10) - c.So(err, ShouldBeNil) - c.So(list, ShouldHaveLength, len(topPeers)) + list, err := repo.TopPeers.List(teamID, msg.TopPeerCategory_Forwards, 0, 10) + c.So(err, ShouldBeNil) + c.So(list, ShouldHaveLength, len(topPeers)) - } - }) + } + }) - }) + }) } diff --git a/internal/repo/users.go b/internal/repo/users.go index c7b80840..371b6072 100644 --- a/internal/repo/users.go +++ b/internal/repo/users.go @@ -1,709 +1,710 @@ package repo import ( - "encoding/binary" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/z" - "github.com/blevesearch/bleve" - "github.com/blevesearch/bleve/search/query" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/tools" - "strings" - "time" + "encoding/binary" + "fmt" + "strings" + "time" + + "github.com/blevesearch/bleve" + "github.com/blevesearch/bleve/search/query" + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/z" + "github.com/ronaksoft/rony/tools" ) const ( - prefixUsers = "USERS" - prefixUsersLastUpdate = "ULU" - prefixContacts = "CONTACTS" - prefixPhoneContacts = "PH_CONTACTS" - prefixUsersPhotoGallery = "USERS_PHG" + prefixUsers = "USERS" + prefixUsersLastUpdate = "ULU" + prefixContacts = "CONTACTS" + prefixPhoneContacts = "PH_CONTACTS" + prefixUsersPhotoGallery = "USERS_PHG" ) type repoUsers struct { - *repository + *repository } func getUserKey(userID int64) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%021d", prefixUsers, userID)) + return tools.StrToByte(fmt.Sprintf("%s.%021d", prefixUsers, userID)) } func getUserByKey(txn *badger.Txn, userKey []byte) (*msg.User, error) { - user := new(msg.User) - item, err := txn.Get(userKey) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return user.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return user, nil + user := new(msg.User) + item, err := txn.Get(userKey) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return user.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return user, nil } func getUserLastUpdateKey(userID int64) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%021d", prefixUsersLastUpdate, userID)) + return tools.StrToByte(fmt.Sprintf("%s.%021d", prefixUsersLastUpdate, userID)) } func getUserLastUpdate(txn *badger.Txn, userID int64) int64 { - var ts int64 - item, err := txn.Get(getUserLastUpdateKey(userID)) - if err != nil { - return 0 - } - _ = item.Value(func(val []byte) error { - ts = int64(binary.BigEndian.Uint64(val)) - return nil - }) - return ts + var ts int64 + item, err := txn.Get(getUserLastUpdateKey(userID)) + if err != nil { + return 0 + } + _ = item.Value(func(val []byte) error { + ts = int64(binary.BigEndian.Uint64(val)) + return nil + }) + return ts } func getContactKey(teamID, userID int64) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%021d.%021d", prefixContacts, teamID, userID)) + return tools.StrToByte(fmt.Sprintf("%s.%021d.%021d", prefixContacts, teamID, userID)) } func getContactByKey(txn *badger.Txn, contactKey []byte) (*msg.ContactUser, error) { - contactUser := new(msg.ContactUser) - item, err := txn.Get(contactKey) - if err != nil { - return nil, err - } - err = item.Value(func(val []byte) error { - return contactUser.Unmarshal(val) - }) - if err != nil { - return nil, err - } - return contactUser, nil + contactUser := new(msg.ContactUser) + item, err := txn.Get(contactKey) + if err != nil { + return nil, err + } + err = item.Value(func(val []byte) error { + return contactUser.Unmarshal(val) + }) + if err != nil { + return nil, err + } + return contactUser, nil } func getPhoneContactKey(phone string) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%s", prefixPhoneContacts, phone)) + return tools.StrToByte(fmt.Sprintf("%s.%s", prefixPhoneContacts, phone)) } func getUserPhotoGalleryKey(userID, photoID int64) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%021d.%021d", prefixUsersPhotoGallery, userID, photoID)) + return tools.StrToByte(fmt.Sprintf("%s.%021d.%021d", prefixUsersPhotoGallery, userID, photoID)) } func getUserPhotoGalleryPrefix(userID int64) []byte { - return tools.StrToByte(fmt.Sprintf("%s.%021d.", prefixUsersPhotoGallery, userID)) + return tools.StrToByte(fmt.Sprintf("%s.%021d.", prefixUsersPhotoGallery, userID)) } func saveUser(txn *badger.Txn, user *msg.User) error { - userKey := getUserKey(user.ID) - if user.Photo == nil { - _ = deleteAllUserPhotos(txn, user.ID) - } else if user.Photo != nil && len(user.PhotoGallery) == 0 { - // then it not full object - currentUser, _ := getUserByKey(txn, userKey) - if currentUser != nil && len(currentUser.PhotoGallery) > 0 { - user.PhotoGallery = currentUser.PhotoGallery - } - err := saveUserPhotos(txn, user.ID, user.Photo) - if err != nil { - return err - } - } else if len(user.PhotoGallery) > 0 { - err := saveUserPhotos(txn, user.ID, user.PhotoGallery...) - if err != nil { - return err - } - } - - userBytes, _ := user.Marshal() - err := txn.SetEntry(badger.NewEntry(userKey, userBytes)) - if err != nil { - return err - } - - var b [8]byte - binary.BigEndian.PutUint64(b[:], uint64(tools.TimeUnix())) - _ = txn.SetEntry(badger.NewEntry(getUserLastUpdateKey(user.ID), b[:])) - - if user.ID == r.selfUserID { - indexPeer( - tools.ByteToStr(userKey), - UserSearch{ - Type: "user", - FirstName: "Saved", - LastName: "Messages", - PeerID: user.ID, - Username: "savedmessages", - }, - ) - } else { - indexPeer( - tools.ByteToStr(userKey), - UserSearch{ - Type: "user", - FirstName: user.FirstName, - LastName: user.LastName, - PeerID: user.ID, - Username: user.Username, - }, - ) - } - - return nil + userKey := getUserKey(user.ID) + if user.Photo == nil { + _ = deleteAllUserPhotos(txn, user.ID) + } else if user.Photo != nil && len(user.PhotoGallery) == 0 { + // then it not full object + currentUser, _ := getUserByKey(txn, userKey) + if currentUser != nil && len(currentUser.PhotoGallery) > 0 { + user.PhotoGallery = currentUser.PhotoGallery + } + err := saveUserPhotos(txn, user.ID, user.Photo) + if err != nil { + return err + } + } else if len(user.PhotoGallery) > 0 { + err := saveUserPhotos(txn, user.ID, user.PhotoGallery...) + if err != nil { + return err + } + } + + userBytes, _ := user.Marshal() + err := txn.SetEntry(badger.NewEntry(userKey, userBytes)) + if err != nil { + return err + } + + var b [8]byte + binary.BigEndian.PutUint64(b[:], uint64(tools.TimeUnix())) + _ = txn.SetEntry(badger.NewEntry(getUserLastUpdateKey(user.ID), b[:])) + + if user.ID == r.selfUserID { + indexPeer( + tools.ByteToStr(userKey), + UserSearch{ + Type: "user", + FirstName: "Saved", + LastName: "Messages", + PeerID: user.ID, + Username: "savedmessages", + }, + ) + } else { + indexPeer( + tools.ByteToStr(userKey), + UserSearch{ + Type: "user", + FirstName: user.FirstName, + LastName: user.LastName, + PeerID: user.ID, + Username: user.Username, + }, + ) + } + + return nil } func saveContact(txn *badger.Txn, teamID int64, contactUser *msg.ContactUser) error { - userBytes, _ := contactUser.Marshal() - contactKey := getContactKey(teamID, contactUser.ID) - err := txn.SetEntry(badger.NewEntry( - contactKey, userBytes, - )) - if err != nil { - return err - } - indexPeer( - tools.ByteToStr(contactKey), - ContactSearch{ - Type: "contact", - FirstName: contactUser.FirstName, - LastName: contactUser.LastName, - Username: contactUser.Username, - Phone: contactUser.Phone, - TeamID: fmt.Sprintf("%d", teamID), - }, - ) - err = saveUserPhotos(txn, contactUser.ID, contactUser.Photo) - if err != nil { - return err - } - return nil + userBytes, _ := contactUser.Marshal() + contactKey := getContactKey(teamID, contactUser.ID) + err := txn.SetEntry(badger.NewEntry( + contactKey, userBytes, + )) + if err != nil { + return err + } + indexPeer( + tools.ByteToStr(contactKey), + ContactSearch{ + Type: "contact", + FirstName: contactUser.FirstName, + LastName: contactUser.LastName, + Username: contactUser.Username, + Phone: contactUser.Phone, + TeamID: fmt.Sprintf("%d", teamID), + }, + ) + err = saveUserPhotos(txn, contactUser.ID, contactUser.Photo) + if err != nil { + return err + } + return nil } func savePhoneContact(txn *badger.Txn, phoneContact *msg.PhoneContact) error { - bytes, _ := phoneContact.Marshal() - dbKey := getPhoneContactKey(phoneContact.Phone) - err := txn.SetEntry(badger.NewEntry( - dbKey, bytes, - )) - if err != nil { - return err - } - return nil + bytes, _ := phoneContact.Marshal() + dbKey := getPhoneContactKey(phoneContact.Phone) + err := txn.SetEntry(badger.NewEntry( + dbKey, bytes, + )) + if err != nil { + return err + } + return nil } func (r *repoUsers) Get(userID int64) (user *msg.User, err error) { - err = badgerView(func(txn *badger.Txn) error { - user, err = getUserByKey(txn, getUserKey(userID)) - if err != nil { - return err - } - updateStatus(user) - return nil - }) - return + err = badgerView(func(txn *badger.Txn) error { + user, err = getUserByKey(txn, getUserKey(userID)) + if err != nil { + return err + } + updateStatus(user) + return nil + }) + return } func (r *repoUsers) GetMany(userIDs []int64) ([]*msg.User, error) { - users := make([]*msg.User, 0, len(userIDs)) - err := badgerView(func(txn *badger.Txn) error { - for _, userID := range userIDs { - if userID == 0 { - continue - } - user, err := getUserByKey(txn, getUserKey(userID)) - switch err { - case nil: - case badger.ErrKeyNotFound: - continue - default: - return err - } - updateStatus(user) - users = append(users, user) - } - return nil - }) - return users, err + users := make([]*msg.User, 0, len(userIDs)) + err := badgerView(func(txn *badger.Txn) error { + for _, userID := range userIDs { + if userID == 0 { + continue + } + user, err := getUserByKey(txn, getUserKey(userID)) + switch err { + case nil: + case badger.ErrKeyNotFound: + continue + default: + return err + } + updateStatus(user) + users = append(users, user) + } + return nil + }) + return users, err } func (r *repoUsers) GetManyWithOutdated(userIDs []int64) ([]*msg.User, []*msg.User, error) { - users := make([]*msg.User, 0, len(userIDs)) - usersOutdated := make([]*msg.User, 0, len(userIDs)) - err := badgerView(func(txn *badger.Txn) error { - for _, userID := range userIDs { - if userID == 0 { - continue - } - user, err := getUserByKey(txn, getUserKey(userID)) - switch err { - case nil: - case badger.ErrKeyNotFound: - continue - default: - return err - } - updateStatus(user) - users = append(users, user) - - if tools.TimeUnix()-getUserLastUpdate(txn, userID) > 30 { - usersOutdated = append(usersOutdated, user) - } - } - return nil - }) - return users, usersOutdated, err + users := make([]*msg.User, 0, len(userIDs)) + usersOutdated := make([]*msg.User, 0, len(userIDs)) + err := badgerView(func(txn *badger.Txn) error { + for _, userID := range userIDs { + if userID == 0 { + continue + } + user, err := getUserByKey(txn, getUserKey(userID)) + switch err { + case nil: + case badger.ErrKeyNotFound: + continue + default: + return err + } + updateStatus(user) + users = append(users, user) + + if tools.TimeUnix()-getUserLastUpdate(txn, userID) > 30 { + usersOutdated = append(usersOutdated, user) + } + } + return nil + }) + return users, usersOutdated, err } func updateStatus(u *msg.User) { - delta := tools.TimeUnix() - u.LastSeen - switch u.Status { - case msg.UserStatus_UserStatusOnline: - if delta < int64(domain.SysConfig.OnlineUpdatePeriodInSec) { - return - } - u.Status = msg.UserStatus_UserStatusRecently - case msg.UserStatus_UserStatusRecently: - case msg.UserStatus_UserStatusOffline: - } + delta := tools.TimeUnix() - u.LastSeen + switch u.Status { + case msg.UserStatus_UserStatusOnline: + if delta < int64(domain.SysConfig.OnlineUpdatePeriodInSec) { + return + } + u.Status = msg.UserStatus_UserStatusRecently + case msg.UserStatus_UserStatusRecently: + case msg.UserStatus_UserStatusOffline: + } } func (r *repoUsers) Save(users ...*msg.User) error { - return badgerUpdate(func(txn *badger.Txn) error { - for idx := range users { - if strings.TrimSpace(users[idx].FirstName) == "" && strings.TrimSpace(users[idx].LastName) == "" { - continue - } - err := saveUser(txn, users[idx]) - if err != nil { - return err - } - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for idx := range users { + if strings.TrimSpace(users[idx].FirstName) == "" && strings.TrimSpace(users[idx].LastName) == "" { + continue + } + err := saveUser(txn, users[idx]) + if err != nil { + return err + } + } + return nil + }) } func (r *repoUsers) UpdateBlocked(peerID int64, blocked bool) error { - return badgerUpdate(func(txn *badger.Txn) error { - user, err := getUserByKey(txn, getUserKey(peerID)) - switch err { - case nil: - case badger.ErrKeyNotFound: - return nil - default: - return err - } - user.Blocked = blocked - return saveUser(txn, user) - }) + return badgerUpdate(func(txn *badger.Txn) error { + user, err := getUserByKey(txn, getUserKey(peerID)) + switch err { + case nil: + case badger.ErrKeyNotFound: + return nil + default: + return err + } + user.Blocked = blocked + return saveUser(txn, user) + }) } func (r *repoUsers) GetAccessHash(userID int64) (accessHash uint64, err error) { - err = badgerView(func(txn *badger.Txn) error { - user, err := getUserByKey(txn, getUserKey(userID)) - if err != nil { - return err - } - if user != nil { - accessHash = user.AccessHash - } - return nil - }) - return + err = badgerView(func(txn *badger.Txn) error { + user, err := getUserByKey(txn, getUserKey(userID)) + if err != nil { + return err + } + if user != nil { + accessHash = user.AccessHash + } + return nil + }) + return } func (r *repoUsers) UpdateProfile(userID int64, firstName, lastName, username, bio, phone string) error { - return badgerUpdate(func(txn *badger.Txn) error { - user, err := getUserByKey(txn, getUserKey(userID)) - switch err { - case nil: - case badger.ErrKeyNotFound: - return nil - default: - return err - } - user.FirstName = firstName - user.LastName = lastName - user.Username = username - user.Phone = phone - user.Bio = bio - return saveUser(txn, user) - }) + return badgerUpdate(func(txn *badger.Txn) error { + user, err := getUserByKey(txn, getUserKey(userID)) + switch err { + case nil: + case badger.ErrKeyNotFound: + return nil + default: + return err + } + user.FirstName = firstName + user.LastName = lastName + user.Username = username + user.Phone = phone + user.Bio = bio + return saveUser(txn, user) + }) } func (r *repoUsers) SearchUsers(searchPhrase string) []*msg.User { - users := make([]*msg.User, 0, 100) - if r.peerSearch == nil { - return users - } - t1 := bleve.NewTermQuery("user") - t1.SetField("type") - qs := make([]query.Query, 0) - for _, term := range strings.Fields(searchPhrase) { - qs = append(qs, bleve.NewPrefixQuery(term), bleve.NewMatchQuery(term)) - } - t2 := bleve.NewDisjunctionQuery(qs...) - searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2)) - searchResult, _ := r.peerSearch.Search(searchRequest) - - _ = badgerView(func(txn *badger.Txn) error { - for _, hit := range searchResult.Hits { - user, err := getUserByKey(txn, tools.StrToByte(hit.ID)) - if err == nil && user != nil { - users = append(users, user) - } - } - return nil - }) - return users + users := make([]*msg.User, 0, 100) + if r.peerSearch == nil { + return users + } + t1 := bleve.NewTermQuery("user") + t1.SetField("type") + qs := make([]query.Query, 0) + for _, term := range strings.Fields(searchPhrase) { + qs = append(qs, bleve.NewPrefixQuery(term), bleve.NewMatchQuery(term)) + } + t2 := bleve.NewDisjunctionQuery(qs...) + searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2)) + searchResult, _ := r.peerSearch.Search(searchRequest) + + _ = badgerView(func(txn *badger.Txn) error { + for _, hit := range searchResult.Hits { + user, err := getUserByKey(txn, tools.StrToByte(hit.ID)) + if err == nil && user != nil { + users = append(users, user) + } + } + return nil + }) + return users } func (r *repoUsers) GetContact(teamID, userID int64) (*msg.ContactUser, error) { - contactUser := new(msg.ContactUser) - err := badgerView(func(txn *badger.Txn) error { - item, err := txn.Get(getContactKey(teamID, userID)) - if err != nil { - return err - } - return item.Value(func(val []byte) error { - return contactUser.Unmarshal(val) - }) - }) + contactUser := new(msg.ContactUser) + err := badgerView(func(txn *badger.Txn) error { + item, err := txn.Get(getContactKey(teamID, userID)) + if err != nil { + return err + } + return item.Value(func(val []byte) error { + return contactUser.Unmarshal(val) + }) + }) - return contactUser, err + return contactUser, err } func (r *repoUsers) GetContacts(teamID int64) ([]*msg.ContactUser, []*msg.PhoneContact) { - contactUsers := make([]*msg.ContactUser, 0, 100) - phoneContacts := make([]*msg.PhoneContact, 0, 100) - - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.%021d.", prefixContacts, teamID)) - it := txn.NewIterator(opts) - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - contactUser := &msg.ContactUser{} - phoneContact := &msg.PhoneContact{} - _ = it.Item().Value(func(val []byte) error { - err := contactUser.Unmarshal(val) - if err != nil { - return err - } - return nil - }) - user, _ := getUserByKey(txn, getUserKey(contactUser.ID)) - if user != nil { - contactUser.Photo = user.Photo - } - contactUsers = append(contactUsers, contactUser) - phoneContact.FirstName = contactUser.FirstName - phoneContact.LastName = contactUser.LastName - phoneContact.Phone = contactUser.Phone - phoneContact.ClientID = contactUser.ClientID - phoneContacts = append(phoneContacts, phoneContact) - } - it.Close() - return nil - }) - - return contactUsers, phoneContacts + contactUsers := make([]*msg.ContactUser, 0, 100) + phoneContacts := make([]*msg.PhoneContact, 0, 100) + + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.%021d.", prefixContacts, teamID)) + it := txn.NewIterator(opts) + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + contactUser := &msg.ContactUser{} + phoneContact := &msg.PhoneContact{} + _ = it.Item().Value(func(val []byte) error { + err := contactUser.Unmarshal(val) + if err != nil { + return err + } + return nil + }) + user, _ := getUserByKey(txn, getUserKey(contactUser.ID)) + if user != nil { + contactUser.Photo = user.Photo + } + contactUsers = append(contactUsers, contactUser) + phoneContact.FirstName = contactUser.FirstName + phoneContact.LastName = contactUser.LastName + phoneContact.Phone = contactUser.Phone + phoneContact.ClientID = contactUser.ClientID + phoneContacts = append(phoneContacts, phoneContact) + } + it.Close() + return nil + }) + + return contactUsers, phoneContacts } func (r *repoUsers) SearchContacts(teamID int64, searchPhrase string) ([]*msg.ContactUser, []*msg.PhoneContact) { - contactUsers := make([]*msg.ContactUser, 0, 100) - phoneContacts := make([]*msg.PhoneContact, 0, 100) - if r.peerSearch == nil { - return contactUsers, phoneContacts - } - t1 := bleve.NewTermQuery("contact") - t1.SetField("type") - qs := make([]query.Query, 0, 2) - for _, term := range strings.Fields(searchPhrase) { - qs = append(qs, bleve.NewPrefixQuery(term), bleve.NewMatchQuery(term)) - } - t2 := bleve.NewDisjunctionQuery(qs...) - t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) - t3.SetField("team_id") - searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3)) - searchResult, _ := r.peerSearch.Search(searchRequest) - - _ = badgerView(func(txn *badger.Txn) error { - for _, hit := range searchResult.Hits { - contactUser, err := getContactByKey(txn, tools.StrToByte(hit.ID)) - if err == nil && contactUser != nil { - phoneContacts = append(phoneContacts, &msg.PhoneContact{ - ClientID: contactUser.ClientID, - FirstName: contactUser.FirstName, - LastName: contactUser.LastName, - Phone: contactUser.Phone, - }) - contactUsers = append(contactUsers, contactUser) - } - } - return nil - }) - return contactUsers, phoneContacts + contactUsers := make([]*msg.ContactUser, 0, 100) + phoneContacts := make([]*msg.PhoneContact, 0, 100) + if r.peerSearch == nil { + return contactUsers, phoneContacts + } + t1 := bleve.NewTermQuery("contact") + t1.SetField("type") + qs := make([]query.Query, 0, 2) + for _, term := range strings.Fields(searchPhrase) { + qs = append(qs, bleve.NewPrefixQuery(term), bleve.NewMatchQuery(term)) + } + t2 := bleve.NewDisjunctionQuery(qs...) + t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) + t3.SetField("team_id") + searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3)) + searchResult, _ := r.peerSearch.Search(searchRequest) + + _ = badgerView(func(txn *badger.Txn) error { + for _, hit := range searchResult.Hits { + contactUser, err := getContactByKey(txn, tools.StrToByte(hit.ID)) + if err == nil && contactUser != nil { + phoneContacts = append(phoneContacts, &msg.PhoneContact{ + ClientID: contactUser.ClientID, + FirstName: contactUser.FirstName, + LastName: contactUser.LastName, + Phone: contactUser.Phone, + }) + contactUsers = append(contactUsers, contactUser) + } + } + return nil + }) + return contactUsers, phoneContacts } func (r *repoUsers) SearchNonContacts(teamID int64, searchPhrase string) []*msg.ContactUser { - contactUsers := make([]*msg.ContactUser, 0, 100) - if r.peerSearch == nil { - return contactUsers - } - t1 := bleve.NewTermQuery("user") - t1.SetField("type") - qs := make([]query.Query, 0) - for _, term := range strings.Fields(searchPhrase) { - qs = append(qs, bleve.NewPrefixQuery(term), bleve.NewMatchQuery(term)) - } - t2 := bleve.NewDisjunctionQuery(qs...) - t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) - t3.SetField("team_id") - searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3)) - searchResult, _ := r.peerSearch.Search(searchRequest) - - _ = badgerView(func(txn *badger.Txn) error { - for _, hit := range searchResult.Hits { - user, _ := getUserByKey(txn, tools.StrToByte(hit.ID)) - if user != nil { - contactUsers = append(contactUsers, &msg.ContactUser{ - ID: user.ID, - FirstName: user.FirstName, - LastName: user.LastName, - Username: user.Username, - }) - } - } - return nil - }) - return contactUsers + contactUsers := make([]*msg.ContactUser, 0, 100) + if r.peerSearch == nil { + return contactUsers + } + t1 := bleve.NewTermQuery("user") + t1.SetField("type") + qs := make([]query.Query, 0) + for _, term := range strings.Fields(searchPhrase) { + qs = append(qs, bleve.NewPrefixQuery(term), bleve.NewMatchQuery(term)) + } + t2 := bleve.NewDisjunctionQuery(qs...) + t3 := bleve.NewTermQuery(fmt.Sprintf("%d", z.AbsInt64(teamID))) + t3.SetField("team_id") + searchRequest := bleve.NewSearchRequest(bleve.NewConjunctionQuery(t1, t2, t3)) + searchResult, _ := r.peerSearch.Search(searchRequest) + + _ = badgerView(func(txn *badger.Txn) error { + for _, hit := range searchResult.Hits { + user, _ := getUserByKey(txn, tools.StrToByte(hit.ID)) + if user != nil { + contactUsers = append(contactUsers, &msg.ContactUser{ + ID: user.ID, + FirstName: user.FirstName, + LastName: user.LastName, + Username: user.Username, + }) + } + } + return nil + }) + return contactUsers } func (r *repoUsers) UpdateContactInfo(teamID int64, userID int64, firstName, lastName string) error { - return badgerUpdate(func(txn *badger.Txn) error { - contact, err := getContactByKey(txn, getContactKey(teamID, userID)) - if err != nil { - return err - } - contact.FirstName = firstName - contact.LastName = lastName - return saveContact(txn, teamID, contact) - }) + return badgerUpdate(func(txn *badger.Txn) error { + contact, err := getContactByKey(txn, getContactKey(teamID, userID)) + if err != nil { + return err + } + contact.FirstName = firstName + contact.LastName = lastName + return saveContact(txn, teamID, contact) + }) } func (r *repoUsers) SaveContact(teamID int64, contactUsers ...*msg.ContactUser) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, contactUser := range contactUsers { - err := saveContact(txn, teamID, contactUser) - if err != nil { - return err - } - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, contactUser := range contactUsers { + err := saveContact(txn, teamID, contactUser) + if err != nil { + return err + } + } + return nil + }) } func (r *repoUsers) SavePhoneContact(phoneContacts ...*msg.PhoneContact) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, phoneContact := range phoneContacts { - err := savePhoneContact(txn, phoneContact) - if err != nil { - return err - } - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, phoneContact := range phoneContacts { + err := savePhoneContact(txn, phoneContact) + if err != nil { + return err + } + } + return nil + }) } func (r *repoUsers) DeletePhoneContact(phoneContacts ...*msg.PhoneContact) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, phoneContact := range phoneContacts { - _ = txn.Delete(getPhoneContactKey(phoneContact.Phone)) - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, phoneContact := range phoneContacts { + _ = txn.Delete(getPhoneContactKey(phoneContact.Phone)) + } + return nil + }) } func (r *repoUsers) GetPhoneContacts(limit int) ([]*msg.PhoneContact, error) { - phoneContacts := make([]*msg.PhoneContact, 0, limit) - err := badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPhoneContacts)) - it := txn.NewIterator(opts) - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - if limit <= 0 { - break - } - limit-- - phoneContact := &msg.PhoneContact{} - _ = it.Item().Value(func(val []byte) error { - err := phoneContact.Unmarshal(val) - if err != nil { - return err - } - return nil - }) - phoneContacts = append(phoneContacts, phoneContact) - } - it.Close() - return nil - }) - return phoneContacts, err + phoneContacts := make([]*msg.PhoneContact, 0, limit) + err := badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.", prefixPhoneContacts)) + it := txn.NewIterator(opts) + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + if limit <= 0 { + break + } + limit-- + phoneContact := &msg.PhoneContact{} + _ = it.Item().Value(func(val []byte) error { + err := phoneContact.Unmarshal(val) + if err != nil { + return err + } + return nil + }) + phoneContacts = append(phoneContacts, phoneContact) + } + it.Close() + return nil + }) + return phoneContacts, err } func (r *repoUsers) DeleteContact(teamID int64, contactIDs ...int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, contactID := range contactIDs { - _ = txn.Delete(getContactKey(teamID, contactID)) - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, contactID := range contactIDs { + _ = txn.Delete(getContactKey(teamID, contactID)) + } + return nil + }) } func (r *repoUsers) DeleteAllContacts(teamID int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.%021d.", prefixContacts, teamID)) - it := txn.NewIterator(opts) - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - _ = txn.Delete(it.Item().KeyCopy(nil)) - } - it.Close() - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(fmt.Sprintf("%s.%021d.", prefixContacts, teamID)) + it := txn.NewIterator(opts) + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + _ = txn.Delete(it.Item().KeyCopy(nil)) + } + it.Close() + return nil + }) } func (r *repoUsers) UpdatePhoto(userID int64, userPhoto *msg.UserPhoto) error { - return badgerUpdate(func(txn *badger.Txn) error { - user, err := getUserByKey(txn, getUserKey(userID)) - switch err { - case nil: - case badger.ErrKeyNotFound: - return nil - default: - return err - } - user.Photo = userPhoto - return saveUser(txn, user) - }) + return badgerUpdate(func(txn *badger.Txn) error { + user, err := getUserByKey(txn, getUserKey(userID)) + switch err { + case nil: + case badger.ErrKeyNotFound: + return nil + default: + return err + } + user.Photo = userPhoto + return saveUser(txn, user) + }) } func (r *repoUsers) SavePhotoGallery(userID int64, photos ...*msg.UserPhoto) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, photo := range photos { - if photo != nil { - key := getUserPhotoGalleryKey(userID, photo.PhotoID) - bytes, _ := photo.Marshal() - _ = txn.SetEntry(badger.NewEntry(key, bytes)) - } - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, photo := range photos { + if photo != nil { + key := getUserPhotoGalleryKey(userID, photo.PhotoID) + bytes, _ := photo.Marshal() + _ = txn.SetEntry(badger.NewEntry(key, bytes)) + } + } + return nil + }) } func (r *repoUsers) RemovePhotoGallery(userID int64, photoIDs ...int64) error { - return badgerUpdate(func(txn *badger.Txn) error { - for _, photoID := range photoIDs { - _ = txn.Delete(getUserPhotoGalleryKey(userID, photoID)) - } - return nil - }) + return badgerUpdate(func(txn *badger.Txn) error { + for _, photoID := range photoIDs { + _ = txn.Delete(getUserPhotoGalleryKey(userID, photoID)) + } + return nil + }) } func (r *repoUsers) GetPhotoGallery(userID int64) []*msg.UserPhoto { - photoGallery := make([]*msg.UserPhoto, 0, 4) - _ = badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = getUserPhotoGalleryPrefix(userID) - it := txn.NewIterator(opts) - for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { - _ = it.Item().Value(func(val []byte) error { - userPhoto := new(msg.UserPhoto) - err := userPhoto.Unmarshal(val) - if err != nil { - return err - } - photoGallery = append(photoGallery, userPhoto) - return nil - }) - } - it.Close() - return nil - }) - return photoGallery + photoGallery := make([]*msg.UserPhoto, 0, 4) + _ = badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = getUserPhotoGalleryPrefix(userID) + it := txn.NewIterator(opts) + for it.Rewind(); it.ValidForPrefix(opts.Prefix); it.Next() { + _ = it.Item().Value(func(val []byte) error { + userPhoto := new(msg.UserPhoto) + err := userPhoto.Unmarshal(val) + if err != nil { + return err + } + photoGallery = append(photoGallery, userPhoto) + return nil + }) + } + it.Close() + return nil + }) + return photoGallery } func (r *repoUsers) ReIndex(teamID int64) error { - err := tools.Try(10, time.Second, func() error { - if r.peerSearch == nil { - return domain.ErrDoesNotExists - } - return nil - }) - if err != nil { - return err - } - - return badgerView(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(prefixUsers) - it := txn.NewIterator(opts) - for it.Rewind(); it.Valid(); it.Next() { - _ = it.Item().Value(func(val []byte) error { - user := new(msg.User) - _ = user.Unmarshal(val) - key := tools.ByteToStr(getUserKey(user.ID)) - if d, _ := r.peerSearch.Document(key); d == nil { - if user.ID == r.repository.selfUserID { - indexPeer( - key, - UserSearch{ - Type: "user", - FirstName: "Saved", - LastName: "Messages", - PeerID: user.ID, - Username: "savedmessages", - }, - ) - } else { - indexPeer( - key, - UserSearch{ - Type: "user", - FirstName: user.FirstName, - LastName: user.LastName, - PeerID: user.ID, - Username: user.Username, - }, - ) - } - } - - return nil - }) - } - it.Close() - - opts = badger.DefaultIteratorOptions - opts.Prefix = tools.StrToByte(prefixContacts) - it = txn.NewIterator(opts) - for it.Rewind(); it.Valid(); it.Next() { - _ = it.Item().Value(func(val []byte) error { - contactUser := new(msg.ContactUser) - _ = contactUser.Unmarshal(val) - indexPeer( - tools.ByteToStr(getContactKey(teamID, contactUser.ID)), - ContactSearch{ - Type: "contact", - FirstName: contactUser.FirstName, - LastName: contactUser.LastName, - Username: contactUser.Username, - TeamID: fmt.Sprintf("%d", teamID), - }, - ) - return nil - }) - } - it.Close() - return nil - }) + err := tools.Try(10, time.Second, func() error { + if r.peerSearch == nil { + return domain.ErrDoesNotExists + } + return nil + }) + if err != nil { + return err + } + + return badgerView(func(txn *badger.Txn) error { + opts := badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(prefixUsers) + it := txn.NewIterator(opts) + for it.Rewind(); it.Valid(); it.Next() { + _ = it.Item().Value(func(val []byte) error { + user := new(msg.User) + _ = user.Unmarshal(val) + key := tools.ByteToStr(getUserKey(user.ID)) + if d, _ := r.peerSearch.Document(key); d == nil { + if user.ID == r.repository.selfUserID { + indexPeer( + key, + UserSearch{ + Type: "user", + FirstName: "Saved", + LastName: "Messages", + PeerID: user.ID, + Username: "savedmessages", + }, + ) + } else { + indexPeer( + key, + UserSearch{ + Type: "user", + FirstName: user.FirstName, + LastName: user.LastName, + PeerID: user.ID, + Username: user.Username, + }, + ) + } + } + + return nil + }) + } + it.Close() + + opts = badger.DefaultIteratorOptions + opts.Prefix = tools.StrToByte(prefixContacts) + it = txn.NewIterator(opts) + for it.Rewind(); it.Valid(); it.Next() { + _ = it.Item().Value(func(val []byte) error { + contactUser := new(msg.ContactUser) + _ = contactUser.Unmarshal(val) + indexPeer( + tools.ByteToStr(getContactKey(teamID, contactUser.ID)), + ContactSearch{ + Type: "contact", + FirstName: contactUser.FirstName, + LastName: contactUser.LastName, + Username: contactUser.Username, + TeamID: fmt.Sprintf("%d", teamID), + }, + ) + return nil + }) + } + it.Close() + return nil + }) } diff --git a/internal/repo/wallpapers.go b/internal/repo/wallpapers.go index 5fd5c4aa..108aa295 100644 --- a/internal/repo/wallpapers.go +++ b/internal/repo/wallpapers.go @@ -1,29 +1,29 @@ package repo import ( - "git.ronaksoft.com/river/msg/go/msg" - "github.com/dgraph-io/badger/v2" + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" ) type repoWallpapers struct { - *repository + *repository } func (r *repoWallpapers) SaveWallpapers(wallpapers *msg.WallPapersMany) error { - if len(wallpapers.WallPapers) == 0 { - return nil - } + if len(wallpapers.WallPapers) == 0 { + return nil + } - err := badgerUpdate(func(txn *badger.Txn) error { - for _, o := range wallpapers.WallPapers { - err := Files.SaveWallpaper(txn, o) - if err != nil { - return err - } - } + err := badgerUpdate(func(txn *badger.Txn) error { + for _, o := range wallpapers.WallPapers { + err := Files.SaveWallpaper(txn, o) + if err != nil { + return err + } + } - return nil - }) + return nil + }) - return err + return err } diff --git a/internal/request/callback.go b/internal/request/callback.go index f42d41aa..5beb9221 100644 --- a/internal/request/callback.go +++ b/internal/request/callback.go @@ -1,18 +1,19 @@ package request import ( - "encoding/json" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/uiexec" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" - "github.com/ronaksoft/rony/registry" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "google.golang.org/protobuf/proto" - "sync" - "time" + "encoding/json" + "sync" + "time" + + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/uiexec" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" + "github.com/ronaksoft/rony/registry" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" ) /* @@ -25,309 +26,309 @@ import ( */ type Unmarshaller interface { - Unmarshal(data []byte) error + Unmarshal(data []byte) error } type Callback interface { - Constructor() int64 - CreatedOn() int64 - Discard() - Envelope() *rony.MessageEnvelope - Flags() DelegateFlag - Marshal() ([]byte, error) - OnComplete(m *rony.MessageEnvelope) - OnProgress(percent int64) - OnTimeout() - SetPreComplete(h domain.MessageHandler) - SetPreTimeout(h domain.TimeoutCallback) - RequestData(req Unmarshaller) error - RequestID() uint64 - ResponseChan() chan *rony.MessageEnvelope - Response(constructor int64, proto proto.Message) - SentOn() int64 - TeamAccess() uint64 - TeamID() int64 - Timeout() time.Duration - UI() bool + Constructor() int64 + CreatedOn() int64 + Discard() + Envelope() *rony.MessageEnvelope + Flags() DelegateFlag + Marshal() ([]byte, error) + OnComplete(m *rony.MessageEnvelope) + OnProgress(percent int64) + OnTimeout() + SetPreComplete(h domain.MessageHandler) + SetPreTimeout(h domain.TimeoutCallback) + RequestData(req Unmarshaller) error + RequestID() uint64 + ResponseChan() chan *rony.MessageEnvelope + Response(constructor int64, proto proto.Message) + SentOn() int64 + TeamAccess() uint64 + TeamID() int64 + Timeout() time.Duration + UI() bool } // serialized type serializedCallback struct { - Timeout time.Duration `json:"timeout"` - MessageEnvelope *rony.MessageEnvelope `json:"message_envelope"` - SerializedOn int64 `json:"serialized_on"` - CreatedOn int64 `json:"created_on"` - UI bool `json:"ui"` - Flags DelegateFlag `json:"flags"` + Timeout time.Duration `json:"timeout"` + MessageEnvelope *rony.MessageEnvelope `json:"message_envelope"` + SerializedOn int64 `json:"serialized_on"` + CreatedOn int64 `json:"created_on"` + UI bool `json:"ui"` + Flags DelegateFlag `json:"flags"` } type callback struct { - envelope *rony.MessageEnvelope - preComplete domain.MessageHandler - onComplete domain.MessageHandler - preTimeout domain.TimeoutCallback - onTimeout domain.TimeoutCallback - onProgress func(percent int64) - ui bool - createdOn int64 - sentOn int64 - flags DelegateFlag - timeout time.Duration - resChan chan *rony.MessageEnvelope + envelope *rony.MessageEnvelope + preComplete domain.MessageHandler + onComplete domain.MessageHandler + preTimeout domain.TimeoutCallback + onTimeout domain.TimeoutCallback + onProgress func(percent int64) + ui bool + createdOn int64 + sentOn int64 + flags DelegateFlag + timeout time.Duration + resChan chan *rony.MessageEnvelope } func (c *callback) Flags() DelegateFlag { - return c.flags + return c.flags } func (c *callback) TeamID() int64 { - return domain.GetTeamID(c.envelope) + return domain.GetTeamID(c.envelope) } func (c *callback) TeamAccess() uint64 { - return domain.GetTeamAccess(c.envelope) + return domain.GetTeamAccess(c.envelope) } func (c *callback) RequestID() uint64 { - return c.envelope.RequestID + return c.envelope.RequestID } func (c *callback) Constructor() int64 { - return c.envelope.Constructor + return c.envelope.Constructor } func (c *callback) OnComplete(m *rony.MessageEnvelope) { - fields := []logs.Field{ - zap.Uint64("ReqID", c.envelope.RequestID), - zap.String("ReqC", registry.ConstructorName(c.envelope.Constructor)), - zap.String("ResC", registry.ConstructorName(m.Constructor)), - zap.Duration("D", time.Duration(tools.NanoTime()-c.createdOn)), - } - if c.createdOn != c.sentOn { - fields = append(fields, - zap.Duration("D-FLY", time.Duration(tools.NanoTime()-c.sentOn)), - ) - } - logger.Info("onComplete", fields...) - unregister(c.envelope.RequestID) - if c.preComplete != nil { - c.preComplete(m) - } - if c.onComplete == nil { - return - } - if c.ui { - uiexec.ExecCompleteCB(c.onComplete, m) - } else { - c.onComplete(m) - } + fields := []logs.Field{ + zap.Uint64("ReqID", c.envelope.RequestID), + zap.String("ReqC", registry.ConstructorName(c.envelope.Constructor)), + zap.String("ResC", registry.ConstructorName(m.Constructor)), + zap.Duration("D", time.Duration(tools.NanoTime()-c.createdOn)), + } + if c.createdOn != c.sentOn { + fields = append(fields, + zap.Duration("D-FLY", time.Duration(tools.NanoTime()-c.sentOn)), + ) + } + logger.Info("onComplete", fields...) + unregister(c.envelope.RequestID) + if c.preComplete != nil { + c.preComplete(m) + } + if c.onComplete == nil { + return + } + if c.ui { + uiexec.ExecCompleteCB(c.onComplete, m) + } else { + c.onComplete(m) + } } func (c *callback) OnTimeout() { - fields := []logs.Field{ - zap.Uint64("ReqID", c.envelope.RequestID), - zap.String("ReqC", registry.ConstructorName(c.envelope.Constructor)), - zap.Duration("D", time.Duration(tools.NanoTime()-c.createdOn)), - } - if c.createdOn != c.sentOn { - fields = append(fields, - zap.Duration("D-FLY", time.Duration(tools.NanoTime()-c.sentOn)), - ) - } - logger.Info("onTimeout", fields...) - unregister(c.envelope.RequestID) - if c.preTimeout != nil { - c.preTimeout() - } - if c.onTimeout == nil { - return - } - if c.ui { - uiexec.ExecTimeoutCB(c.onTimeout) - } else { - c.onTimeout() - } + fields := []logs.Field{ + zap.Uint64("ReqID", c.envelope.RequestID), + zap.String("ReqC", registry.ConstructorName(c.envelope.Constructor)), + zap.Duration("D", time.Duration(tools.NanoTime()-c.createdOn)), + } + if c.createdOn != c.sentOn { + fields = append(fields, + zap.Duration("D-FLY", time.Duration(tools.NanoTime()-c.sentOn)), + ) + } + logger.Info("onTimeout", fields...) + unregister(c.envelope.RequestID) + if c.preTimeout != nil { + c.preTimeout() + } + if c.onTimeout == nil { + return + } + if c.ui { + uiexec.ExecTimeoutCB(c.onTimeout) + } else { + c.onTimeout() + } } func (c *callback) OnProgress(percent int64) { - if c.onProgress == nil { - return - } - c.onProgress(percent) + if c.onProgress == nil { + return + } + c.onProgress(percent) } func (c *callback) UI() bool { - return c.ui + return c.ui } func (c *callback) Timeout() time.Duration { - if c.timeout == 0 { - return domain.WebsocketRequestTimeout - } - return c.timeout + if c.timeout == 0 { + return domain.WebsocketRequestTimeout + } + return c.timeout } func (c *callback) Envelope() *rony.MessageEnvelope { - return c.envelope + return c.envelope } func (c *callback) Marshal() ([]byte, error) { - scb := &serializedCallback{ - Timeout: c.timeout, - MessageEnvelope: c.envelope.Clone(), - SerializedOn: tools.TimeUnix(), - CreatedOn: c.createdOn, - UI: c.ui, - Flags: c.flags, - } - return json.Marshal(scb) + scb := &serializedCallback{ + Timeout: c.timeout, + MessageEnvelope: c.envelope.Clone(), + SerializedOn: tools.TimeUnix(), + CreatedOn: c.createdOn, + UI: c.ui, + Flags: c.flags, + } + return json.Marshal(scb) } func (c *callback) ResponseChan() chan *rony.MessageEnvelope { - return c.resChan + return c.resChan } func (c *callback) Discard() { - unregister(c.envelope.RequestID) + unregister(c.envelope.RequestID) } func (c *callback) CreatedOn() int64 { - return c.createdOn + return c.createdOn } func (c *callback) SentOn() int64 { - return c.sentOn + return c.sentOn } func (c *callback) SetPreComplete(h domain.MessageHandler) { - c.preComplete = h + c.preComplete = h } func (c *callback) SetPreTimeout(h domain.TimeoutCallback) { - c.preTimeout = h + c.preTimeout = h } func (c *callback) RequestData(u Unmarshaller) error { - err := u.Unmarshal(c.envelope.Message) - if err != nil { - me := &rony.MessageEnvelope{} - me.Fill(c.envelope.RequestID, rony.C_Error, errors.New(errors.Internal, err.Error()), c.envelope.Header...) - c.OnComplete(me) - } - return err + err := u.Unmarshal(c.envelope.Message) + if err != nil { + me := &rony.MessageEnvelope{} + me.Fill(c.envelope.RequestID, rony.C_Error, errors.New(errors.Internal, err.Error()), c.envelope.Header...) + c.OnComplete(me) + } + return err } func (c *callback) Response(constructor int64, proto proto.Message) { - res := &rony.MessageEnvelope{} - res.Fill(c.envelope.RequestID, constructor, proto, c.envelope.Header...) - c.OnComplete(res) + res := &rony.MessageEnvelope{} + res.Fill(c.envelope.RequestID, constructor, proto, c.envelope.Header...) + c.OnComplete(res) } func NewCallback( - teamID int64, teamAccess uint64, - reqID uint64, constructor int64, req proto.Message, - onTimeout domain.TimeoutCallback, onComplete domain.MessageHandler, onProgress func(int64), - ui bool, flags DelegateFlag, timeout time.Duration, + teamID int64, teamAccess uint64, + reqID uint64, constructor int64, req proto.Message, + onTimeout domain.TimeoutCallback, onComplete domain.MessageHandler, onProgress func(int64), + ui bool, flags DelegateFlag, timeout time.Duration, ) *callback { - t := tools.NanoTime() - cb := &callback{ - envelope: &rony.MessageEnvelope{}, - onComplete: onComplete, - onTimeout: onTimeout, - onProgress: onProgress, - ui: ui, - createdOn: t, - sentOn: t, - flags: flags, - timeout: timeout, - resChan: make(chan *rony.MessageEnvelope, 1), - } - cb.envelope.Fill(reqID, constructor, req, domain.TeamHeader(teamID, teamAccess)...) - register(cb) - return cb + t := tools.NanoTime() + cb := &callback{ + envelope: &rony.MessageEnvelope{}, + onComplete: onComplete, + onTimeout: onTimeout, + onProgress: onProgress, + ui: ui, + createdOn: t, + sentOn: t, + flags: flags, + timeout: timeout, + resChan: make(chan *rony.MessageEnvelope, 1), + } + cb.envelope.Fill(reqID, constructor, req, domain.TeamHeader(teamID, teamAccess)...) + register(cb) + return cb } func NewCallbackFromBytes( - teamID int64, teamAccess uint64, - reqID uint64, constructor int64, reqBytes []byte, - onTimeout domain.TimeoutCallback, onComplete domain.MessageHandler, onProgress func(int64), - ui bool, flags DelegateFlag, timeout time.Duration, + teamID int64, teamAccess uint64, + reqID uint64, constructor int64, reqBytes []byte, + onTimeout domain.TimeoutCallback, onComplete domain.MessageHandler, onProgress func(int64), + ui bool, flags DelegateFlag, timeout time.Duration, ) *callback { - t := tools.NanoTime() - cb := &callback{ - envelope: &rony.MessageEnvelope{ - RequestID: reqID, - Constructor: constructor, - Header: domain.TeamHeader(teamID, teamAccess), - }, - onComplete: onComplete, - onTimeout: onTimeout, - onProgress: onProgress, - ui: ui, - createdOn: t, - sentOn: t, - flags: flags, - timeout: timeout, - resChan: make(chan *rony.MessageEnvelope, 1), - } - cb.envelope.Message = append(cb.envelope.Message, reqBytes...) - register(cb) - return cb + t := tools.NanoTime() + cb := &callback{ + envelope: &rony.MessageEnvelope{ + RequestID: reqID, + Constructor: constructor, + Header: domain.TeamHeader(teamID, teamAccess), + }, + onComplete: onComplete, + onTimeout: onTimeout, + onProgress: onProgress, + ui: ui, + createdOn: t, + sentOn: t, + flags: flags, + timeout: timeout, + resChan: make(chan *rony.MessageEnvelope, 1), + } + cb.envelope.Message = append(cb.envelope.Message, reqBytes...) + register(cb) + return cb } func UnmarshalCallback(data []byte) (*callback, error) { - scb := &serializedCallback{} - err := json.Unmarshal(data, scb) - if err != nil { - return nil, err - } - callbacksMtx.Lock() - cb := requestCallbacks[scb.MessageEnvelope.RequestID] - callbacksMtx.Unlock() - if cb != nil { - return cb, nil - } - cb = &callback{ - envelope: scb.MessageEnvelope.Clone(), - onProgress: nil, - ui: scb.UI, - createdOn: scb.CreatedOn, - sentOn: tools.NanoTime(), - flags: scb.Flags, - timeout: scb.Timeout, - resChan: make(chan *rony.MessageEnvelope, 1), - } - register(cb) - return cb, nil + scb := &serializedCallback{} + err := json.Unmarshal(data, scb) + if err != nil { + return nil, err + } + callbacksMtx.Lock() + cb := requestCallbacks[scb.MessageEnvelope.RequestID] + callbacksMtx.Unlock() + if cb != nil { + return cb, nil + } + cb = &callback{ + envelope: scb.MessageEnvelope.Clone(), + onProgress: nil, + ui: scb.UI, + createdOn: scb.CreatedOn, + sentOn: tools.NanoTime(), + flags: scb.Flags, + timeout: scb.Timeout, + resChan: make(chan *rony.MessageEnvelope, 1), + } + register(cb) + return cb, nil } var ( - callbacksMtx sync.Mutex - requestCallbacks map[uint64]*callback + callbacksMtx sync.Mutex + requestCallbacks map[uint64]*callback ) func init() { - requestCallbacks = make(map[uint64]*callback, 100) + requestCallbacks = make(map[uint64]*callback, 100) } func register(cb *callback) { - callbacksMtx.Lock() - requestCallbacks[cb.RequestID()] = cb - callbacksMtx.Unlock() + callbacksMtx.Lock() + requestCallbacks[cb.RequestID()] = cb + callbacksMtx.Unlock() } func unregister(reqID uint64) { - callbacksMtx.Lock() - delete(requestCallbacks, reqID) - callbacksMtx.Unlock() + callbacksMtx.Lock() + delete(requestCallbacks, reqID) + callbacksMtx.Unlock() } func GetCallback(reqID uint64) Callback { - callbacksMtx.Lock() - cb := requestCallbacks[reqID] - callbacksMtx.Unlock() - if cb == nil { - return nil - } - return cb + callbacksMtx.Lock() + cb := requestCallbacks[reqID] + callbacksMtx.Unlock() + if cb == nil { + return nil + } + return cb } diff --git a/internal/request/callback_test.go b/internal/request/callback_test.go index f03653fd..3127bb8d 100644 --- a/internal/request/callback_test.go +++ b/internal/request/callback_test.go @@ -1,13 +1,14 @@ package request_test import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/tools" - . "github.com/smartystreets/goconvey/convey" - "sync" - "testing" + "sync" + "testing" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/tools" + . "github.com/smartystreets/goconvey/convey" ) /* @@ -20,50 +21,50 @@ import ( */ func TestNewCallback(t *testing.T) { - Convey("Callback", t, func(c C) { + Convey("Callback", t, func(c C) { - reqID := tools.RandomUint64(0) - Convey("Test OnComplete", func(c C) { - waitGroup := &sync.WaitGroup{} - waitGroup.Add(1) - cb := request.NewCallback( - 0, 0, reqID, - msg.C_TestRequest, &msg.TestRequest{Hash: tools.S2B(tools.RandomID(10))}, - func() {}, - func(m *rony.MessageEnvelope) { - c.So(m.Constructor, ShouldEqual, msg.C_TestResponse) - c.So(m.RequestID, ShouldEqual, reqID) - waitGroup.Done() - }, - nil, true, 0, 0, - ) - me := &rony.MessageEnvelope{} - me.Fill(reqID, msg.C_TestResponse, &msg.TestResponse{}) - cb.OnComplete(me) - waitGroup.Wait() - }) - Convey("Test OnComplete with Replace", func(c C) { - waitGroup := &sync.WaitGroup{} - waitGroup.Add(1) - cb := request.NewCallback( - 0, 0, reqID, - msg.C_TestRequest, &msg.TestRequest{Hash: tools.S2B(tools.RandomID(10))}, - func() {}, - func(m *rony.MessageEnvelope) { - c.So(m.Constructor, ShouldEqual, msg.C_TestResponse) - c.So(m.RequestID, ShouldEqual, reqID+1) - waitGroup.Done() - }, - nil, true, 0, 0, - ) - me := &rony.MessageEnvelope{} - me.Fill(reqID, msg.C_TestResponse, &msg.TestResponse{}) - cb.SetPreComplete(func(m *rony.MessageEnvelope) { - m.RequestID = m.RequestID + 1 - }) - cb.OnComplete(me) - waitGroup.Wait() - }) + reqID := tools.RandomUint64(0) + Convey("Test OnComplete", func(c C) { + waitGroup := &sync.WaitGroup{} + waitGroup.Add(1) + cb := request.NewCallback( + 0, 0, reqID, + msg.C_TestRequest, &msg.TestRequest{Hash: tools.S2B(tools.RandomID(10))}, + func() {}, + func(m *rony.MessageEnvelope) { + c.So(m.Constructor, ShouldEqual, msg.C_TestResponse) + c.So(m.RequestID, ShouldEqual, reqID) + waitGroup.Done() + }, + nil, true, 0, 0, + ) + me := &rony.MessageEnvelope{} + me.Fill(reqID, msg.C_TestResponse, &msg.TestResponse{}) + cb.OnComplete(me) + waitGroup.Wait() + }) + Convey("Test OnComplete with Replace", func(c C) { + waitGroup := &sync.WaitGroup{} + waitGroup.Add(1) + cb := request.NewCallback( + 0, 0, reqID, + msg.C_TestRequest, &msg.TestRequest{Hash: tools.S2B(tools.RandomID(10))}, + func() {}, + func(m *rony.MessageEnvelope) { + c.So(m.Constructor, ShouldEqual, msg.C_TestResponse) + c.So(m.RequestID, ShouldEqual, reqID+1) + waitGroup.Done() + }, + nil, true, 0, 0, + ) + me := &rony.MessageEnvelope{} + me.Fill(reqID, msg.C_TestResponse, &msg.TestResponse{}) + cb.SetPreComplete(func(m *rony.MessageEnvelope) { + m.RequestID = m.RequestID + 1 + }) + cb.OnComplete(me) + waitGroup.Wait() + }) - }) + }) } diff --git a/internal/request/delegate.go b/internal/request/delegate.go index f6407c63..b0d4dd92 100644 --- a/internal/request/delegate.go +++ b/internal/request/delegate.go @@ -1,10 +1,11 @@ package request import ( - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/pools" - "strings" + "strings" + + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/pools" ) /* @@ -19,85 +20,85 @@ import ( type DelegateFlag = int32 func DelegateFlagToString(rdf DelegateFlag) string { - sb := strings.Builder{} - if rdf&ServerForced == ServerForced { - sb.WriteString("|ServerForced") - } - if rdf&Blocking == Blocking { - sb.WriteString("|Blocking") - } - if rdf&SkipWaitForNetwork == SkipWaitForNetwork { - sb.WriteString("|SkipWaitNetwork") - } - if rdf&SkipFlusher == SkipFlusher { - sb.WriteString("|SkipFlusher") - } - if rdf&Realtime == Realtime { - sb.WriteString("|Realtime") - } - if rdf&Batch == Batch { - sb.WriteString("|Batch") - } - if rdf&RetryUntilCanceled == RetryUntilCanceled { - sb.WriteString("|RetryUntilCancel") - } - if rdf > 0 { - sb.WriteRune('|') - } - return sb.String() + sb := strings.Builder{} + if rdf&ServerForced == ServerForced { + sb.WriteString("|ServerForced") + } + if rdf&Blocking == Blocking { + sb.WriteString("|Blocking") + } + if rdf&SkipWaitForNetwork == SkipWaitForNetwork { + sb.WriteString("|SkipWaitNetwork") + } + if rdf&SkipFlusher == SkipFlusher { + sb.WriteString("|SkipFlusher") + } + if rdf&Realtime == Realtime { + sb.WriteString("|Realtime") + } + if rdf&Batch == Batch { + sb.WriteString("|Batch") + } + if rdf&RetryUntilCanceled == RetryUntilCanceled { + sb.WriteString("|RetryUntilCancel") + } + if rdf > 0 { + sb.WriteRune('|') + } + return sb.String() } // Request Flags const ( - // ServerForced sends the request to the server even if there is a local handler registered for it. - ServerForced DelegateFlag = 1 << iota - // Blocking blocks the caller until response arrived from the server - Blocking - // SkipWaitForNetwork starts the timeout timer right after submitting the request, and does not - // wait until network connection is established. - SkipWaitForNetwork - // SkipFlusher prevents sending the request in a container. - SkipFlusher - // Realtime sends the request directly to the network and skips the persistent queue. Such requests - // are forgotten after app restart. - Realtime - // Batch waits longer than usual. This is good for burst request. i.e. Call module uses this flag to prevent - // flooding server with individual updates. - Batch - // RetryUntilCanceled makes the request to be retried in case of timeout. - RetryUntilCanceled + // ServerForced sends the request to the server even if there is a local handler registered for it. + ServerForced DelegateFlag = 1 << iota + // Blocking blocks the caller until response arrived from the server + Blocking + // SkipWaitForNetwork starts the timeout timer right after submitting the request, and does not + // wait until network connection is established. + SkipWaitForNetwork + // SkipFlusher prevents sending the request in a container. + SkipFlusher + // Realtime sends the request directly to the network and skips the persistent queue. Such requests + // are forgotten after app restart. + Realtime + // Batch waits longer than usual. This is good for burst request. i.e. Call module uses this flag to prevent + // flooding server with individual updates. + Batch + // RetryUntilCanceled makes the request to be retried in case of timeout. + RetryUntilCanceled ) type Delegate interface { - OnComplete(b []byte) - OnTimeout(err error) - Flags() DelegateFlag + OnComplete(b []byte) + OnTimeout(err error) + Flags() DelegateFlag } func DelegateAdapter( - teamID int64, teamAccess uint64, reqID uint64, constructor int64, reqBytes []byte, d Delegate, progressFunc func(int64), + teamID int64, teamAccess uint64, reqID uint64, constructor int64, reqBytes []byte, d Delegate, progressFunc func(int64), ) *callback { - onTimeout := func() {} - onComplete := func(m *rony.MessageEnvelope) {} - onProgress := func(progress int64) {} - flags := DelegateFlag(0) - if d != nil { - onTimeout = func() { - d.OnTimeout(domain.ErrRequestTimeout) - } - onComplete = func(m *rony.MessageEnvelope) { - buf := pools.Buffer.FromProto(m) - d.OnComplete(*buf.Bytes()) - pools.Buffer.Put(buf) - } - flags = d.Flags() - } - if progressFunc != nil { - onProgress = progressFunc - } - return NewCallbackFromBytes( - teamID, teamAccess, reqID, constructor, reqBytes, - onTimeout, onComplete, onProgress, true, flags, - domain.WebsocketRequestTimeout, - ) + onTimeout := func() {} + onComplete := func(m *rony.MessageEnvelope) {} + onProgress := func(progress int64) {} + flags := DelegateFlag(0) + if d != nil { + onTimeout = func() { + d.OnTimeout(domain.ErrRequestTimeout) + } + onComplete = func(m *rony.MessageEnvelope) { + buf := pools.Buffer.FromProto(m) + d.OnComplete(*buf.Bytes()) + pools.Buffer.Put(buf) + } + flags = d.Flags() + } + if progressFunc != nil { + onProgress = progressFunc + } + return NewCallbackFromBytes( + teamID, teamAccess, reqID, constructor, reqBytes, + onTimeout, onComplete, onProgress, true, flags, + domain.WebsocketRequestTimeout, + ) } diff --git a/internal/request/request.go b/internal/request/request.go index 644019c2..cceb35d1 100644 --- a/internal/request/request.go +++ b/internal/request/request.go @@ -1,7 +1,7 @@ package request import ( - "git.ronaksoft.com/river/sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/logs" ) /* @@ -14,11 +14,11 @@ import ( */ var ( - logger *logs.Logger + logger *logs.Logger ) func init() { - logger = logs.With("Request") + logger = logs.With("Request") } // LocalHandler SDK commands that handle user request from client cache diff --git a/internal/salt/salt.go b/internal/salt/salt.go index 972d7ec1..e61ad1bb 100644 --- a/internal/salt/salt.go +++ b/internal/salt/salt.go @@ -1,16 +1,17 @@ package salt import ( - "encoding/json" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/dgraph-io/badger/v2" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "sort" - "time" + "encoding/json" + "sort" + "time" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) /* @@ -23,100 +24,100 @@ import ( */ var ( - salts []domain.Slt - curSalt int64 - logger *logs.Logger + salts []domain.Slt + curSalt int64 + logger *logs.Logger ) func init() { - logger = logs.With("SALT") + logger = logs.With("SALT") } func Get() int64 { - return curSalt + return curSalt } func Reset() { - _ = repo.System.Delete(domain.SkSystemSalts) - curSalt = 0 - UpdateSalt() + _ = repo.System.Delete(domain.SkSystemSalts) + curSalt = 0 + UpdateSalt() } func UpdateSalt() bool { - // 1st try to load from already stored salts - saltString, err := repo.System.LoadString(domain.SkSystemSalts) - if err != nil { - switch err { - case badger.ErrKeyNotFound: - logger.Warn("UpdateSalt did not find salt key in the db") - default: - logger.Warn("UpdateSalt got error on load salt from db", zap.Error(err)) + // 1st try to load from already stored salts + saltString, err := repo.System.LoadString(domain.SkSystemSalts) + if err != nil { + switch err { + case badger.ErrKeyNotFound: + logger.Warn("UpdateSalt did not find salt key in the db") + default: + logger.Warn("UpdateSalt got error on load salt from db", zap.Error(err)) - } - return false - } + } + return false + } - var sysSalts []domain.Slt - err = json.Unmarshal([]byte(saltString), &sysSalts) - if err != nil { - logger.Warn("UpdateSalt got error on unmarshal salt from db", zap.Error(err)) - return false - } + var sysSalts []domain.Slt + err = json.Unmarshal([]byte(saltString), &sysSalts) + if err != nil { + logger.Warn("UpdateSalt got error on unmarshal salt from db", zap.Error(err)) + return false + } - if len(sysSalts) > 0 { - sort.Slice(sysSalts, func(i, j int) bool { - return sysSalts[i].Timestamp < sysSalts[j].Timestamp - }) + if len(sysSalts) > 0 { + sort.Slice(sysSalts, func(i, j int) bool { + return sysSalts[i].Timestamp < sysSalts[j].Timestamp + }) - saltFound := false - for idx, s := range sysSalts { - validUntil := s.Timestamp + int64(time.Hour/time.Second) - domain.Now().Unix() - if validUntil <= 0 { - logger.Debug("did not match", zap.Any("salt timestamp", s.Timestamp)) - continue - } - curSalt = s.Value - salts = sysSalts[idx:] - b, _ := json.Marshal(sysSalts[idx:]) - err = repo.System.SaveString(domain.SkSystemSalts, string(b)) - if err != nil { - logger.Warn("UpdateSalt got error on save salt to db", - zap.Error(err), - zap.String("Salts", tools.ByteToStr(b)), - ) - } - saltFound = true - break - } - if !saltFound { - logger.Warn("UpdateSalt could not find salt") - return false - } - return true - } else { - logger.Warn("UpdateSalt could not find salt (length is zero)") - return false - } + saltFound := false + for idx, s := range sysSalts { + validUntil := s.Timestamp + int64(time.Hour/time.Second) - domain.Now().Unix() + if validUntil <= 0 { + logger.Debug("did not match", zap.Any("salt timestamp", s.Timestamp)) + continue + } + curSalt = s.Value + salts = sysSalts[idx:] + b, _ := json.Marshal(sysSalts[idx:]) + err = repo.System.SaveString(domain.SkSystemSalts, string(b)) + if err != nil { + logger.Warn("UpdateSalt got error on save salt to db", + zap.Error(err), + zap.String("Salts", tools.ByteToStr(b)), + ) + } + saltFound = true + break + } + if !saltFound { + logger.Warn("UpdateSalt could not find salt") + return false + } + return true + } else { + logger.Warn("UpdateSalt could not find salt (length is zero)") + return false + } } func Set(s *msg.SystemSalts) { - var saltArray []domain.Slt - for idx, saltValue := range s.Salts { - slt := domain.Slt{} - slt.Timestamp = s.StartsFrom + (s.Duration/int64(time.Second))*int64(idx) - slt.Value = saltValue - saltArray = append(saltArray, slt) - } - b, _ := json.Marshal(saltArray) - err := repo.System.SaveString(domain.SkSystemSalts, string(b)) - if err != nil { - logger.Error("couldn't save SystemSalts in the db", zap.Error(err)) - return - } - UpdateSalt() + var saltArray []domain.Slt + for idx, saltValue := range s.Salts { + slt := domain.Slt{} + slt.Timestamp = s.StartsFrom + (s.Duration/int64(time.Second))*int64(idx) + slt.Value = saltValue + saltArray = append(saltArray, slt) + } + b, _ := json.Marshal(saltArray) + err := repo.System.SaveString(domain.SkSystemSalts, string(b)) + if err != nil { + logger.Error("couldn't save SystemSalts in the db", zap.Error(err)) + return + } + UpdateSalt() } func Count() int { - return len(salts) + return len(salts) } diff --git a/internal/testenv/testenv.go b/internal/testenv/testenv.go index da38f4ce..6966bd60 100644 --- a/internal/testenv/testenv.go +++ b/internal/testenv/testenv.go @@ -1,7 +1,7 @@ package testenv import ( - "git.ronaksoft.com/river/sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/logs" ) /* @@ -16,9 +16,9 @@ import ( var logger *logs.Logger func init() { - logger = logs.With("TEST") + logger = logs.With("TEST") } func Log() *logs.Logger { - return logger + return logger } diff --git a/internal/uiexec/uiexec.go b/internal/uiexec/uiexec.go index b1e0b66b..876ca916 100644 --- a/internal/uiexec/uiexec.go +++ b/internal/uiexec/uiexec.go @@ -1,151 +1,152 @@ package uiexec import ( - "context" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/registry" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "google.golang.org/protobuf/proto" - "time" + "context" + "time" + + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/registry" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" + "google.golang.org/protobuf/proto" ) const ( - maxDelay = time.Millisecond * 500 + maxDelay = time.Millisecond * 500 ) var ( - updateCB domain.UpdateReceivedCallback - dataSyncedCB domain.DataSyncedCallback - callbackChan = make(chan execItem, 128) - rateLimit = make(chan struct{}, 5) - logger *logs.Logger + updateCB domain.UpdateReceivedCallback + dataSyncedCB domain.DataSyncedCallback + callbackChan = make(chan execItem, 128) + rateLimit = make(chan struct{}, 5) + logger *logs.Logger ) type kind int64 const ( - update kind = iota - completeCB - timeoutCB + update kind = iota + completeCB + timeoutCB ) func (k kind) String() string { - switch k { - case update: - return "Update" - case completeCB: - return "CompleteCB" - case timeoutCB: - return "TimeoutCB" - } - panic("invalid ui-exec kind") + switch k { + case update: + return "Update" + case completeCB: + return "CompleteCB" + case timeoutCB: + return "TimeoutCB" + } + panic("invalid ui-exec kind") } type execItem struct { - insertTime int64 - constructor int64 - kind kind - fn func() + insertTime int64 + constructor int64 + kind kind + fn func() } func init() { - logger = logs.With("UIExec") - updateCB = func(constructor int64, msg []byte) {} - dataSyncedCB = func(dialogs, contacts, gifs bool) {} - go executor() + logger = logs.With("UIExec") + updateCB = func(constructor int64, msg []byte) {} + dataSyncedCB = func(dialogs, contacts, gifs bool) {} + go executor() } func executor() { - for it := range callbackChan { - rateLimit <- struct{}{} - go func(it execItem) { - defer func() { - <-rateLimit - }() - startTime := tools.NanoTime() - ctx, cf := context.WithTimeout(context.Background(), time.Second) - doneChan := make(chan struct{}) - go func() { - it.fn() - doneChan <- struct{}{} - }() - select { - case <-doneChan: - case <-ctx.Done(): - logger.Error("timeout waiting for UI-Exec to return", - zap.String("C", registry.ConstructorName(it.constructor)), - zap.String("Kind", it.kind.String()), - ) - } - cf() // Cancel func - endTime := tools.NanoTime() - if d := time.Duration(endTime - it.insertTime); d > maxDelay { - logger.Error("Too Long UIExec", - zap.String("C", registry.ConstructorName(it.constructor)), - zap.String("Kind", it.kind.String()), - zap.Duration("ExecT", time.Duration(endTime-startTime)), - zap.Duration("WaitT", time.Duration(endTime-it.insertTime)), - ) - } - }(it) - - } + for it := range callbackChan { + rateLimit <- struct{}{} + go func(it execItem) { + defer func() { + <-rateLimit + }() + startTime := tools.NanoTime() + ctx, cf := context.WithTimeout(context.Background(), time.Second) + doneChan := make(chan struct{}) + go func() { + it.fn() + doneChan <- struct{}{} + }() + select { + case <-doneChan: + case <-ctx.Done(): + logger.Error("timeout waiting for UI-Exec to return", + zap.String("C", registry.ConstructorName(it.constructor)), + zap.String("Kind", it.kind.String()), + ) + } + cf() // Cancel func + endTime := tools.NanoTime() + if d := time.Duration(endTime - it.insertTime); d > maxDelay { + logger.Error("Too Long UIExec", + zap.String("C", registry.ConstructorName(it.constructor)), + zap.String("Kind", it.kind.String()), + zap.Duration("ExecT", time.Duration(endTime-startTime)), + zap.Duration("WaitT", time.Duration(endTime-it.insertTime)), + ) + } + }(it) + + } } func Init(updateReceived domain.UpdateReceivedCallback, dataSynced domain.DataSyncedCallback) { - updateCB = updateReceived - dataSyncedCB = dataSynced + updateCB = updateReceived + dataSyncedCB = dataSynced } func ExecCompleteCB(handler domain.MessageHandler, out *rony.MessageEnvelope) { - if handler == nil { - return - } - exec(completeCB, out.Constructor, func() { - handler(out) - }) + if handler == nil { + return + } + exec(completeCB, out.Constructor, func() { + handler(out) + }) } func ExecTimeoutCB(h domain.TimeoutCallback) { - if h == nil { - return - } - exec(timeoutCB, 0, func() { - h() - }) + if h == nil { + return + } + exec(timeoutCB, 0, func() { + h() + }) } func ExecUpdate(constructor int64, m proto.Message) { - buf := pools.Buffer.FromProto(m) - exec(update, constructor, func() { - updateCB(constructor, *buf.Bytes()) - pools.Buffer.Put(buf) - }) + buf := pools.Buffer.FromProto(m) + exec(update, constructor, func() { + updateCB(constructor, *buf.Bytes()) + pools.Buffer.Put(buf) + }) } func ExecDataSynced(dialogs, contacts, gifs bool) { - dataSyncedCB(dialogs, contacts, gifs) + dataSyncedCB(dialogs, contacts, gifs) } // Exec pass given function to UIExecutor buffered channel func exec(kind kind, constructor int64, fn func()) { - select { - case callbackChan <- execItem{ - kind: kind, - fn: fn, - insertTime: tools.NanoTime(), - constructor: constructor, - }: - default: - logger.Error("func channel is full we discard item", - zap.String("Kind", kind.String()), - zap.String("C", registry.ConstructorName(constructor)), - ) - } + select { + case callbackChan <- execItem{ + kind: kind, + fn: fn, + insertTime: tools.NanoTime(), + constructor: constructor, + }: + default: + logger.Error("func channel is full we discard item", + zap.String("Kind", kind.String()), + zap.String("C", registry.ConstructorName(constructor)), + ) + } } diff --git a/module/account/account.go b/module/account/account.go index 086991ab..b79b1c10 100644 --- a/module/account/account.go +++ b/module/account/account.go @@ -1,10 +1,10 @@ package account import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -17,28 +17,28 @@ import ( */ type account struct { - module.Base + module.Base } func New() *account { - r := &account{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_AccountGetTeams: r.accountsGetTeams, - msg.C_AccountRegisterDevice: r.accountRegisterDevice, - msg.C_AccountRemovePhoto: r.accountRemovePhoto, - msg.C_AccountSetNotifySettings: r.accountSetNotifySettings, - msg.C_AccountUnregisterDevice: r.accountUnregisterDevice, - msg.C_AccountUpdateProfile: r.accountUpdateProfile, - msg.C_AccountUpdateUsername: r.accountUpdateUsername, - }, - ) - r.RegisterUpdateAppliers(map[int64]domain.UpdateApplier{ - msg.C_UpdateAccountPrivacy: r.updateAccountPrivacy, - }) - return r + r := &account{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_AccountGetTeams: r.accountsGetTeams, + msg.C_AccountRegisterDevice: r.accountRegisterDevice, + msg.C_AccountRemovePhoto: r.accountRemovePhoto, + msg.C_AccountSetNotifySettings: r.accountSetNotifySettings, + msg.C_AccountUnregisterDevice: r.accountUnregisterDevice, + msg.C_AccountUpdateProfile: r.accountUpdateProfile, + msg.C_AccountUpdateUsername: r.accountUpdateUsername, + }, + ) + r.RegisterUpdateAppliers(map[int64]domain.UpdateApplier{ + msg.C_UpdateAccountPrivacy: r.updateAccountPrivacy, + }) + return r } func (r *account) Name() string { - return module.Account + return module.Account } diff --git a/module/account/handlers.go b/module/account/handlers.go index 5202b73a..9bf45320 100644 --- a/module/account/handlers.go +++ b/module/account/handlers.go @@ -1,12 +1,13 @@ package account import ( - "encoding/json" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "go.uber.org/zap" + "encoding/json" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "go.uber.org/zap" ) /* @@ -19,141 +20,141 @@ import ( */ func (r *account) accountUpdateUsername(da request.Callback) { - req := &msg.AccountUpdateUsername{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.AccountUpdateUsername{} + if err := da.RequestData(req); err != nil { + return + } - r.SDK().GetConnInfo().ChangeUsername(req.Username) - r.SDK().GetConnInfo().Save() + r.SDK().GetConnInfo().ChangeUsername(req.Username) + r.SDK().GetConnInfo().Save() - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *account) accountRegisterDevice(da request.Callback) { - req := &msg.AccountRegisterDevice{} - if err := da.RequestData(req); err != nil { - return - } - - val, err := json.Marshal(req) - if err != nil { - r.Log().Error("AccountModule::accountRegisterDevice()-> Json Marshal()", zap.Error(err)) - return - } - err = repo.System.SaveString(domain.SkDeviceToken, string(val)) - if err != nil { - r.Log().Error("AccountModule::accountRegisterDevice()-> SaveString()", zap.Error(err)) - return - } - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.AccountRegisterDevice{} + if err := da.RequestData(req); err != nil { + return + } + + val, err := json.Marshal(req) + if err != nil { + r.Log().Error("AccountModule::accountRegisterDevice()-> Json Marshal()", zap.Error(err)) + return + } + err = repo.System.SaveString(domain.SkDeviceToken, string(val)) + if err != nil { + r.Log().Error("AccountModule::accountRegisterDevice()-> SaveString()", zap.Error(err)) + return + } + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *account) accountUnregisterDevice(da request.Callback) { - req := &msg.AccountUnregisterDevice{} - if err := da.RequestData(req); err != nil { - return - } - - val, err := json.Marshal(&msg.AccountRegisterDevice{}) - if err != nil { - r.Log().Error("AccountModule::accountUnregisterDevice()-> Json Marshal()", zap.Error(err)) - return - } - err = repo.System.SaveString(domain.SkDeviceToken, string(val)) - if err != nil { - r.Log().Error("AccountModule::accountUnregisterDevice()-> SaveString()", zap.Error(err)) - return - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.AccountUnregisterDevice{} + if err := da.RequestData(req); err != nil { + return + } + + val, err := json.Marshal(&msg.AccountRegisterDevice{}) + if err != nil { + r.Log().Error("AccountModule::accountUnregisterDevice()-> Json Marshal()", zap.Error(err)) + return + } + err = repo.System.SaveString(domain.SkDeviceToken, string(val)) + if err != nil { + r.Log().Error("AccountModule::accountUnregisterDevice()-> SaveString()", zap.Error(err)) + return + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *account) accountSetNotifySettings(da request.Callback) { - req := &msg.AccountSetNotifySettings{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.AccountSetNotifySettings{} + if err := da.RequestData(req); err != nil { + return + } - dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if dialog == nil { - return - } + dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if dialog == nil { + return + } - dialog.NotifySettings = req.Settings - _ = repo.Dialogs.Save(dialog) + dialog.NotifySettings = req.Settings + _ = repo.Dialogs.Save(dialog) - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *account) accountRemovePhoto(da request.Callback) { - req := &msg.AccountRemovePhoto{} - if err := da.RequestData(req); err != nil { - return - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) - - user, err := repo.Users.Get(r.SDK().GetConnInfo().PickupUserID()) - if err != nil { - return - } - - if user.Photo != nil && user.Photo.PhotoID == req.PhotoID { - _ = repo.Users.UpdatePhoto(r.SDK().GetConnInfo().PickupUserID(), &msg.UserPhoto{ - PhotoBig: &msg.FileLocation{}, - PhotoSmall: &msg.FileLocation{}, - PhotoBigWeb: &msg.WebLocation{}, - PhotoSmallWeb: &msg.WebLocation{}, - PhotoID: 0, - }) - } - - _ = repo.Users.RemovePhotoGallery(r.SDK().GetConnInfo().PickupUserID(), req.PhotoID) + req := &msg.AccountRemovePhoto{} + if err := da.RequestData(req); err != nil { + return + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) + + user, err := repo.Users.Get(r.SDK().GetConnInfo().PickupUserID()) + if err != nil { + return + } + + if user.Photo != nil && user.Photo.PhotoID == req.PhotoID { + _ = repo.Users.UpdatePhoto(r.SDK().GetConnInfo().PickupUserID(), &msg.UserPhoto{ + PhotoBig: &msg.FileLocation{}, + PhotoSmall: &msg.FileLocation{}, + PhotoBigWeb: &msg.WebLocation{}, + PhotoSmallWeb: &msg.WebLocation{}, + PhotoID: 0, + }) + } + + _ = repo.Users.RemovePhotoGallery(r.SDK().GetConnInfo().PickupUserID(), req.PhotoID) } func (r *account) accountUpdateProfile(da request.Callback) { - req := &msg.AccountUpdateProfile{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.AccountUpdateProfile{} + if err := da.RequestData(req); err != nil { + return + } - // TODO : add connInfo Bio and save it too - r.SDK().GetConnInfo().ChangeFirstName(req.FirstName) - r.SDK().GetConnInfo().ChangeLastName(req.LastName) - r.SDK().GetConnInfo().ChangeBio(req.Bio) + // TODO : add connInfo Bio and save it too + r.SDK().GetConnInfo().ChangeFirstName(req.FirstName) + r.SDK().GetConnInfo().ChangeLastName(req.LastName) + r.SDK().GetConnInfo().ChangeBio(req.Bio) - r.SDK().GetConnInfo().Save() + r.SDK().GetConnInfo().Save() - _ = repo.Users.UpdateProfile(r.SDK().GetConnInfo().PickupUserID(), - req.FirstName, req.LastName, r.SDK().GetConnInfo().PickupUsername(), req.Bio, r.SDK().GetConnInfo().PickupPhone(), - ) + _ = repo.Users.UpdateProfile(r.SDK().GetConnInfo().PickupUserID(), + req.FirstName, req.LastName, r.SDK().GetConnInfo().PickupUsername(), req.Bio, r.SDK().GetConnInfo().PickupPhone(), + ) - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *account) accountsGetTeams(da request.Callback) { - req := &msg.AccountGetTeams{} - if err := da.RequestData(req); err != nil { - return - } - - teams := repo.Teams.List() - - if len(teams) > 0 { - teamsMany := &msg.TeamsMany{ - Teams: teams, - } - da.Response(msg.C_TeamsMany, teamsMany) - return - } - - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.AccountGetTeams{} + if err := da.RequestData(req); err != nil { + return + } + + teams := repo.Teams.List() + + if len(teams) > 0 { + teamsMany := &msg.TeamsMany{ + Teams: teams, + } + da.Response(msg.C_TeamsMany, teamsMany) + return + } + + r.SDK().QueueCtrl().EnqueueCommand(da) } diff --git a/module/account/update_appliers.go b/module/account/update_appliers.go index 0a5beafe..40d06eaf 100644 --- a/module/account/update_appliers.go +++ b/module/account/update_appliers.go @@ -1,9 +1,9 @@ package account import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "go.uber.org/zap" ) /* @@ -16,43 +16,43 @@ import ( */ func (r *account) updateAccountPrivacy(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateAccountPrivacy) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateAccountPrivacy", - zap.Int64("UpdateID", x.UpdateID), - ) - - err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyChatInvite, x.ChatInvite) - if err != nil { - r.Log().Error("got error on set privacy (ChatInvite)", zap.Error(err)) - } - - err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyLastSeen, x.LastSeen) - if err != nil { - r.Log().Error("got error on set privacy (LastSeen)", zap.Error(err)) - } - - err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyPhoneNumber, x.PhoneNumber) - if err != nil { - r.Log().Error("got error on set privacy (PhoneNumber)", zap.Error(err)) - } - - err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyProfilePhoto, x.ProfilePhoto) - if err != nil { - r.Log().Error("got error on set privacy (ProfilePhoto)", zap.Error(err)) - } - - err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyForwardedMessage, x.ForwardedMessage) - if err != nil { - r.Log().Error("got error on set privacy (ForwardedMessage)", zap.Error(err)) - } - - err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyCall, x.Call) - r.Log().Error("got error on set privacy (Call)", zap.Error(err)) - res := []*msg.UpdateEnvelope{u} - return res, nil + x := new(msg.UpdateAccountPrivacy) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateAccountPrivacy", + zap.Int64("UpdateID", x.UpdateID), + ) + + err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyChatInvite, x.ChatInvite) + if err != nil { + r.Log().Error("got error on set privacy (ChatInvite)", zap.Error(err)) + } + + err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyLastSeen, x.LastSeen) + if err != nil { + r.Log().Error("got error on set privacy (LastSeen)", zap.Error(err)) + } + + err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyPhoneNumber, x.PhoneNumber) + if err != nil { + r.Log().Error("got error on set privacy (PhoneNumber)", zap.Error(err)) + } + + err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyProfilePhoto, x.ProfilePhoto) + if err != nil { + r.Log().Error("got error on set privacy (ProfilePhoto)", zap.Error(err)) + } + + err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyForwardedMessage, x.ForwardedMessage) + if err != nil { + r.Log().Error("got error on set privacy (ForwardedMessage)", zap.Error(err)) + } + + err = repo.Account.SetPrivacy(msg.PrivacyKey_PrivacyKeyCall, x.Call) + r.Log().Error("got error on set privacy (Call)", zap.Error(err)) + res := []*msg.UpdateEnvelope{u} + return res, nil } diff --git a/module/auth/auth.go b/module/auth/auth.go index fab0ea0a..9b522160 100644 --- a/module/auth/auth.go +++ b/module/auth/auth.go @@ -1,12 +1,12 @@ package auth import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/module" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/module" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -19,64 +19,64 @@ import ( */ type auth struct { - module.Base + module.Base } func New() *auth { - r := &auth{} - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_AuthAuthorization: r.authAuthorization, - msg.C_AuthSentCode: r.authSentCode, - }, - ) - return r + r := &auth{} + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_AuthAuthorization: r.authAuthorization, + msg.C_AuthSentCode: r.authSentCode, + }, + ) + return r } func (r *auth) Name() string { - return module.Auth + return module.Auth } func (r *auth) authAuthorization(e *rony.MessageEnvelope) { - x := new(msg.AuthAuthorization) - if err := x.Unmarshal(e.Message); err != nil { - r.Log().Error("AuthModule couldn't unmarshal AuthAuthorization", zap.Error(err)) - return - } - r.Log().Debug("AuthModule applies AuthAuthorization", - zap.String("FirstName", x.User.FirstName), - zap.String("LastName", x.User.LastName), - zap.Int64("UserID", x.User.ID), - zap.String("Bio", x.User.Bio), - zap.String("Username", x.User.Username), - ) + x := new(msg.AuthAuthorization) + if err := x.Unmarshal(e.Message); err != nil { + r.Log().Error("AuthModule couldn't unmarshal AuthAuthorization", zap.Error(err)) + return + } + r.Log().Debug("AuthModule applies AuthAuthorization", + zap.String("FirstName", x.User.FirstName), + zap.String("LastName", x.User.LastName), + zap.Int64("UserID", x.User.ID), + zap.String("Bio", x.User.Bio), + zap.String("Username", x.User.Username), + ) - r.SDK().GetConnInfo().ChangeFirstName(x.User.FirstName) - r.SDK().GetConnInfo().ChangeLastName(x.User.LastName) - r.SDK().GetConnInfo().ChangeUserID(x.User.ID) - r.SDK().GetConnInfo().ChangeBio(x.User.Bio) - r.SDK().GetConnInfo().ChangeUsername(x.User.Username) - if x.User.Phone != "" { - r.SDK().GetConnInfo().ChangePhone(x.User.Phone) - } - r.SDK().GetConnInfo().Save() - r.SDK().SyncCtrl().SetUserID(x.User.ID) + r.SDK().GetConnInfo().ChangeFirstName(x.User.FirstName) + r.SDK().GetConnInfo().ChangeLastName(x.User.LastName) + r.SDK().GetConnInfo().ChangeUserID(x.User.ID) + r.SDK().GetConnInfo().ChangeBio(x.User.Bio) + r.SDK().GetConnInfo().ChangeUsername(x.User.Username) + if x.User.Phone != "" { + r.SDK().GetConnInfo().ChangePhone(x.User.Phone) + } + r.SDK().GetConnInfo().Save() + r.SDK().SyncCtrl().SetUserID(x.User.ID) - repo.SetSelfUserID(x.User.ID) + repo.SetSelfUserID(x.User.ID) - go func() { - r.SDK().SyncCtrl().Sync() - }() + go func() { + r.SDK().SyncCtrl().Sync() + }() } func (r *auth) authSentCode(e *rony.MessageEnvelope) { - x := new(msg.AuthSentCode) - if err := x.Unmarshal(e.Message); err != nil { - r.Log().Error("AuthModule couldn't unmarshal AuthSentCode", zap.Error(err)) - return - } + x := new(msg.AuthSentCode) + if err := x.Unmarshal(e.Message); err != nil { + r.Log().Error("AuthModule couldn't unmarshal AuthSentCode", zap.Error(err)) + return + } - r.Log().Debug("AuthModule applies AuthSentCode") + r.Log().Debug("AuthModule applies AuthSentCode") - r.SDK().GetConnInfo().ChangePhone(x.Phone) + r.SDK().GetConnInfo().ChangePhone(x.Phone) } diff --git a/module/bot/bot.go b/module/bot/bot.go index f729d3f9..3212bc16 100644 --- a/module/bot/bot.go +++ b/module/bot/bot.go @@ -1,12 +1,12 @@ package bot import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/module" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/module" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -19,47 +19,47 @@ import ( */ type bot struct { - module.Base + module.Base } func New() *bot { - r := &bot{} - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_BotResults: r.botResults, - }, - ) - return r + r := &bot{} + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_BotResults: r.botResults, + }, + ) + return r } func (r *bot) Name() string { - return module.Bot + return module.Bot } func (r *bot) botResults(e *rony.MessageEnvelope) { - br := &msg.BotResults{} - err := br.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal BotResults", zap.Error(err)) - return - } + br := &msg.BotResults{} + err := br.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal BotResults", zap.Error(err)) + return + } - for _, m := range br.Results { - if m == nil || m.Message == nil || m.Type != msg.MediaType_MediaTypeDocument || m.Message.MediaData == nil { - r.Log().Info("botResults message or media is nil or not mediaDocument", zap.Error(err)) - continue - } + for _, m := range br.Results { + if m == nil || m.Message == nil || m.Type != msg.MediaType_MediaTypeDocument || m.Message.MediaData == nil { + r.Log().Info("botResults message or media is nil or not mediaDocument", zap.Error(err)) + continue + } - md := &msg.MediaDocument{} - err := md.Unmarshal(m.Message.MediaData) - if err != nil { - r.Log().Error("couldn't unmarshal BotResults MediaDocument", zap.Error(err)) - continue - } + md := &msg.MediaDocument{} + err := md.Unmarshal(m.Message.MediaData) + if err != nil { + r.Log().Error("couldn't unmarshal BotResults MediaDocument", zap.Error(err)) + continue + } - err = repo.Files.SaveMessageMediaDocument(md) + err = repo.Files.SaveMessageMediaDocument(md) - if err != nil { - r.Log().Error("couldn't save botResults media document", zap.Error(err)) - } - } + if err != nil { + r.Log().Error("couldn't save botResults media document", zap.Error(err)) + } + } } diff --git a/module/call/api.go b/module/call/api.go index cfe80d78..8d67a155 100644 --- a/module/call/api.go +++ b/module/call/api.go @@ -1,14 +1,15 @@ package call import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/registry" - "go.uber.org/zap" - "sync" - "time" + "sync" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/registry" + "go.uber.org/zap" ) /* @@ -21,540 +22,546 @@ import ( */ type teamInput struct { - teamID int64 - teamAccess uint64 + teamID int64 + teamAccess uint64 } func (c *call) apiInit(peer *msg.InputPeer, callID int64) (res *msg.PhoneInit, err error) { - req := msg.PhoneInitCall{ - Peer: peer, - CallID: callID, - } - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_PhoneInit: - xx := &msg.PhoneInit{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneInitCall", zap.Error(err)) - } - if xx.Code == "E02" && xx.Items == "CALL" { - err = domain.ErrInvalidCall - } else { - err = domain.ErrInvalidData - } - default: - c.Log().Warn("received unknown response for PhoneInitCall", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneInitCall, reqBytes, timeoutCallback, successCallback, true, callID) - - return + req := msg.PhoneInitCall{ + Peer: peer, + CallID: callID, + } + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_PhoneInit: + xx := &msg.PhoneInit{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneInitCall", zap.Error(err)) + } + if xx.Code == "E02" && xx.Items == "CALL" { + err = domain.ErrInvalidCall + } else { + err = domain.ErrInvalidData + } + default: + c.Log().Warn("received unknown response for PhoneInitCall", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneInitCall, reqBytes, timeoutCallback, successCallback, true, callID) + + return } -func (c *call) apiRequest(peer *msg.InputPeer, randomID int64, initiator bool, participants []*msg.PhoneParticipantSDP, callID int64, video, batch bool) (res *msg.PhoneCall, err error) { - req := msg.PhoneRequestCall{ - Peer: peer, - RandomID: randomID, - Initiator: initiator, - Participants: participants, - CallID: callID, - DeviceType: c.deviceType, - Video: video, - } - - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_PhoneCall: - xx := &msg.PhoneCall{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneRequestCall", zap.Error(err)) - } - err = xx - default: - c.Log().Warn("received unknown response for PhoneRequestCall", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneRequestCall, reqBytes, timeoutCallback, successCallback, !batch, callID) - return +func (c *call) apiRequest( + peer *msg.InputPeer, randomID int64, initiator bool, participants []*msg.PhoneParticipantSDP, callID int64, video, batch bool, +) (res *msg.PhoneCall, err error) { + req := msg.PhoneRequestCall{ + Peer: peer, + RandomID: randomID, + Initiator: initiator, + Participants: participants, + CallID: callID, + DeviceType: c.deviceType, + Video: video, + } + + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_PhoneCall: + xx := &msg.PhoneCall{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneRequestCall", zap.Error(err)) + } + err = xx + default: + c.Log().Warn("received unknown response for PhoneRequestCall", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneRequestCall, reqBytes, timeoutCallback, successCallback, !batch, callID) + return } func (c *call) apiAccept(peer *msg.InputPeer, callID int64, participants []*msg.PhoneParticipantSDP) (res *msg.PhoneCall, err error) { - req := msg.PhoneAcceptCall{ - Peer: peer, - Participants: participants, - CallID: callID, - DeviceType: c.deviceType, - } - - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_PhoneCall: - xx := &msg.PhoneCall{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneAcceptCall", zap.Error(err)) - } - err = xx - default: - c.Log().Warn("received unknown response for PhoneAcceptCall", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneAcceptCall, reqBytes, timeoutCallback, successCallback, true, callID) - return + req := msg.PhoneAcceptCall{ + Peer: peer, + Participants: participants, + CallID: callID, + DeviceType: c.deviceType, + } + + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_PhoneCall: + xx := &msg.PhoneCall{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneAcceptCall", zap.Error(err)) + } + err = xx + default: + c.Log().Warn("received unknown response for PhoneAcceptCall", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneAcceptCall, reqBytes, timeoutCallback, successCallback, true, callID) + return } func (c *call) apiReject(peer *msg.InputPeer, callID int64, reason msg.DiscardReason, duration int32) (res *msg.Bool, err error) { - req := msg.PhoneDiscardCall{ - Peer: peer, - CallID: callID, - Duration: duration, - Reason: reason, - } - - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_Bool: - xx := &msg.Bool{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneDiscardCall", zap.Error(err)) - } - err = xx - default: - c.Log().Warn("received unknown response for PhoneDiscardCall", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneDiscardCall, reqBytes, timeoutCallback, successCallback, true, callID) - return + req := msg.PhoneDiscardCall{ + Peer: peer, + CallID: callID, + Duration: duration, + Reason: reason, + } + + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_Bool: + xx := &msg.Bool{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneDiscardCall", zap.Error(err)) + } + err = xx + default: + c.Log().Warn("received unknown response for PhoneDiscardCall", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneDiscardCall, reqBytes, timeoutCallback, successCallback, true, callID) + return } func (c *call) apiJoin(peer *msg.InputPeer, callID int64) (res *msg.PhoneParticipants, err error) { - req := msg.PhoneJoinCall{ - Peer: peer, - CallID: callID, - } - - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_PhoneParticipants: - xx := &msg.PhoneParticipants{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneJoinCall", zap.Error(err)) - } - err = xx - default: - c.Log().Warn("received unknown response for PhoneJoinCall", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneJoinCall, reqBytes, timeoutCallback, successCallback, true, callID) - return + req := msg.PhoneJoinCall{ + Peer: peer, + CallID: callID, + } + + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_PhoneParticipants: + xx := &msg.PhoneParticipants{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneJoinCall", zap.Error(err)) + } + err = xx + default: + c.Log().Warn("received unknown response for PhoneJoinCall", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneJoinCall, reqBytes, timeoutCallback, successCallback, true, callID) + return } func (c *call) apiAddParticipant(peer *msg.InputPeer, callID int64, participants []*msg.InputUser) (res *msg.PhoneParticipants, err error) { - req := msg.PhoneAddParticipant{ - Peer: peer, - CallID: callID, - Participants: participants, - } - - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_PhoneParticipants: - xx := &msg.PhoneParticipants{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneAddParticipant", zap.Error(err)) - } - err = xx - default: - c.Log().Warn("received unknown response for PhoneAddParticipant", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneAddParticipant, reqBytes, timeoutCallback, successCallback, true, callID) - return + req := msg.PhoneAddParticipant{ + Peer: peer, + CallID: callID, + Participants: participants, + } + + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_PhoneParticipants: + xx := &msg.PhoneParticipants{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneAddParticipant", zap.Error(err)) + } + err = xx + default: + c.Log().Warn("received unknown response for PhoneAddParticipant", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneAddParticipant, reqBytes, timeoutCallback, successCallback, true, callID) + return } -func (c *call) apiRemoveParticipant(peer *msg.InputPeer, callID int64, participants []*msg.InputUser, isTimout bool) (res *msg.Bool, err error) { - req := msg.PhoneRemoveParticipant{ - Peer: peer, - CallID: callID, - Participants: participants, - Timeout: isTimout, - } - - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_Bool: - xx := &msg.Bool{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneRemoveParticipant", zap.Error(err)) - } - err = xx - default: - c.Log().Warn("received unknown response for PhoneRemoveParticipants", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneRemoveParticipant, reqBytes, timeoutCallback, successCallback, true, callID) - return +func (c *call) apiRemoveParticipant(peer *msg.InputPeer, callID int64, participants []*msg.InputUser, isTimout bool) (res *msg.Bool, + err error, +) { + req := msg.PhoneRemoveParticipant{ + Peer: peer, + CallID: callID, + Participants: participants, + Timeout: isTimout, + } + + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_Bool: + xx := &msg.Bool{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneRemoveParticipant", zap.Error(err)) + } + err = xx + default: + c.Log().Warn("received unknown response for PhoneRemoveParticipants", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneRemoveParticipant, reqBytes, timeoutCallback, successCallback, true, callID) + return } func (c *call) apiGetParticipant(peer *msg.InputPeer, callID int64) (res *msg.PhoneParticipants, err error) { - req := msg.PhoneGetParticipants{ - Peer: peer, - CallID: callID, - } - - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_PhoneParticipants: - xx := &msg.PhoneParticipants{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneGetParticipants", zap.Error(err)) - } - err = xx - default: - c.Log().Warn("received unknown response for PhoneGetParticipants", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneGetParticipants, reqBytes, timeoutCallback, successCallback, true, callID) - - return + req := msg.PhoneGetParticipants{ + Peer: peer, + CallID: callID, + } + + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_PhoneParticipants: + xx := &msg.PhoneParticipants{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneGetParticipants", zap.Error(err)) + } + err = xx + default: + c.Log().Warn("received unknown response for PhoneGetParticipants", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneGetParticipants, reqBytes, timeoutCallback, successCallback, true, callID) + + return } func (c *call) apiUpdateAdmin(peer *msg.InputPeer, callID int64, inputUser *msg.InputUser, admin bool) (res *msg.Bool, err error) { - req := msg.PhoneUpdateAdmin{ - Peer: peer, - CallID: callID, - User: inputUser, - Admin: admin, - } - - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_Bool: - xx := &msg.Bool{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneUpdateAdmin", zap.Error(err)) - } - err = xx - default: - c.Log().Warn("received unknown response for PhoneUpdateAdmin", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneUpdateAdmin, reqBytes, timeoutCallback, successCallback, true, callID) - - return + req := msg.PhoneUpdateAdmin{ + Peer: peer, + CallID: callID, + User: inputUser, + Admin: admin, + } + + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_Bool: + xx := &msg.Bool{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneUpdateAdmin", zap.Error(err)) + } + err = xx + default: + c.Log().Warn("received unknown response for PhoneUpdateAdmin", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneUpdateAdmin, reqBytes, timeoutCallback, successCallback, true, callID) + + return } -func (c *call) apiSendUpdate(peer *msg.InputPeer, callID int64, participants []*msg.InputUser, action msg.PhoneCallAction, actionData []byte, instant bool) (res *msg.Bool, err error) { - req := msg.PhoneUpdateCall{ - Peer: peer, - CallID: callID, - Participants: participants, - Action: action, - ActionData: actionData, - } - - reqBytes, err := req.Marshal() - if err != nil { - return - } - - // Timeout Callback - timeoutCallback := func() { - err = domain.ErrRequestTimeout - } - - // Success Callback - successCallback := func(x *rony.MessageEnvelope) { - switch x.Constructor { - case msg.C_Bool: - xx := &msg.Bool{} - innerErr := xx.Unmarshal(x.Message) - if innerErr != nil { - err = innerErr - } else { - res = xx - } - case rony.C_Error: - xx := &rony.Error{} - innerErr := xx.Unmarshal(x.Message) - if innerErr == nil { - c.Log().Warn("got error on server request PhoneUpdateCall", zap.Error(err)) - } - err = xx - default: - c.Log().Warn("received unknown response for PhoneUpdateCall", zap.String("C", registry.ConstructorName(x.Constructor))) - err = domain.ErrInvalidData - } - } - - c.executeRemoteCommand(msg.C_PhoneUpdateCall, reqBytes, timeoutCallback, successCallback, instant, callID) - return +func (c *call) apiSendUpdate( + peer *msg.InputPeer, callID int64, participants []*msg.InputUser, action msg.PhoneCallAction, actionData []byte, instant bool, +) (res *msg.Bool, err error) { + req := msg.PhoneUpdateCall{ + Peer: peer, + CallID: callID, + Participants: participants, + Action: action, + ActionData: actionData, + } + + reqBytes, err := req.Marshal() + if err != nil { + return + } + + // Timeout Callback + timeoutCallback := func() { + err = domain.ErrRequestTimeout + } + + // Success Callback + successCallback := func(x *rony.MessageEnvelope) { + switch x.Constructor { + case msg.C_Bool: + xx := &msg.Bool{} + innerErr := xx.Unmarshal(x.Message) + if innerErr != nil { + err = innerErr + } else { + res = xx + } + case rony.C_Error: + xx := &rony.Error{} + innerErr := xx.Unmarshal(x.Message) + if innerErr == nil { + c.Log().Warn("got error on server request PhoneUpdateCall", zap.Error(err)) + } + err = xx + default: + c.Log().Warn("received unknown response for PhoneUpdateCall", zap.String("C", registry.ConstructorName(x.Constructor))) + err = domain.ErrInvalidData + } + } + + c.executeRemoteCommand(msg.C_PhoneUpdateCall, reqBytes, timeoutCallback, successCallback, instant, callID) + return } func (c *call) setTeamInput(teamId int64, teamAccess uint64) { - c.teamInput = teamInput{ - teamID: teamId, - teamAccess: teamAccess, - } + c.teamInput = teamInput{ + teamID: teamId, + teamAccess: teamAccess, + } } func (c *call) executeRemoteCommand( - constructor int64, commandBytes []byte, - timeoutCB domain.TimeoutCallback, successCB domain.MessageHandler, - instant bool, callID int64, + constructor int64, commandBytes []byte, + timeoutCB domain.TimeoutCallback, successCB domain.MessageHandler, + instant bool, callID int64, ) { - c.Log().Debug("Execute command", - zap.String("C", registry.ConstructorName(constructor)), - zap.Bool("Instant", instant), - zap.Int64("CallID", callID), - ) - - rdt := request.Realtime - if instant { - rdt |= request.SkipFlusher - } else { - rdt |= request.Batch - } - - wg := sync.WaitGroup{} - - retry := 0 - var innerTimeoutCB domain.TimeoutCallback - var innerSuccessCB domain.MessageHandler - var executeFn func() - - innerTimeoutCB = func() { - if retry < 1 { - go func() { - time.Sleep(time.Duration(1) * time.Second) - executeFn() - }() - } else { - timeoutCB() - wg.Done() - } - } - - innerSuccessCB = func(m *rony.MessageEnvelope) { - successCB(m.Clone()) - c.removeCallRequestID(callID, int64(m.RequestID)) - wg.Done() - } - - executeFn = func() { - reqID := domain.NextRequestID() - cb := request.NewCallbackFromBytes( - c.teamInput.teamID, - c.teamInput.teamAccess, - reqID, constructor, commandBytes, innerTimeoutCB, innerSuccessCB, nil, false, - rdt, 10*time.Second, - ) - - retry++ - err := c.SDK().Execute(cb) - if err == nil { - c.appendCallRequestID(callID, int64(reqID)) - } - } - - wg.Add(1) - executeFn() - wg.Wait() + c.Log().Debug("Execute command", + zap.String("C", registry.ConstructorName(constructor)), + zap.Bool("Instant", instant), + zap.Int64("CallID", callID), + ) + + rdt := request.Realtime + if instant { + rdt |= request.SkipFlusher + } else { + rdt |= request.Batch + } + + wg := sync.WaitGroup{} + + retry := 0 + var innerTimeoutCB domain.TimeoutCallback + var innerSuccessCB domain.MessageHandler + var executeFn func() + + innerTimeoutCB = func() { + if retry < 1 { + go func() { + time.Sleep(time.Duration(1) * time.Second) + executeFn() + }() + } else { + timeoutCB() + wg.Done() + } + } + + innerSuccessCB = func(m *rony.MessageEnvelope) { + successCB(m.Clone()) + c.removeCallRequestID(callID, int64(m.RequestID)) + wg.Done() + } + + executeFn = func() { + reqID := domain.NextRequestID() + cb := request.NewCallbackFromBytes( + c.teamInput.teamID, + c.teamInput.teamAccess, + reqID, constructor, commandBytes, innerTimeoutCB, innerSuccessCB, nil, false, + rdt, 10*time.Second, + ) + + retry++ + err := c.SDK().Execute(cb) + if err == nil { + c.appendCallRequestID(callID, int64(reqID)) + } + } + + wg.Add(1) + executeFn() + wg.Wait() } diff --git a/module/call/call.go b/module/call/call.go index 44a2044c..db64feab 100644 --- a/module/call/call.go +++ b/module/call/call.go @@ -1,11 +1,12 @@ package call import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" - "sync" + "sync" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -18,105 +19,105 @@ import ( */ const ( - RetryInterval = 10 - RetryLimit = 6 - ReconnectTry = 3 - ReconnectTimeout = 15 + RetryInterval = 10 + RetryLimit = 6 + ReconnectTry = 3 + ReconnectTimeout = 15 - TempCallID = int64(-27001) + TempCallID = int64(-27001) ) type Config struct { - TeamID int64 - TeamAccess uint64 - UserID int64 - DeviceType msg.CallDeviceType - Callback *Callback + TeamID int64 + TeamAccess uint64 + UserID int64 + DeviceType msg.CallDeviceType + Callback *Callback } type call struct { - module.Base + module.Base - mu *sync.RWMutex - peerConnections map[int32]*Connection - peer *msg.InputPeer - activeCallID int64 - callInfo map[int64]*Info - callDuration map[int64]*Duration - rejectedCallIDs []int64 + mu *sync.RWMutex + peerConnections map[int32]*Connection + peer *msg.InputPeer + activeCallID int64 + callInfo map[int64]*Info + callDuration map[int64]*Duration + rejectedCallIDs []int64 - iceServer []*msg.IceServer - userID int64 + iceServer []*msg.IceServer + userID int64 - teamInput teamInput - deviceType msg.CallDeviceType + teamInput teamInput + deviceType msg.CallDeviceType - callback *Callback + callback *Callback } func New(config *Config) *call { - c := &call{ - mu: &sync.RWMutex{}, - peerConnections: make(map[int32]*Connection), - peer: nil, - activeCallID: 0, - callInfo: make(map[int64]*Info), - callDuration: make(map[int64]*Duration), - rejectedCallIDs: nil, - iceServer: nil, - userID: config.UserID, - teamInput: teamInput{ - teamID: config.TeamID, - teamAccess: config.TeamAccess, - }, - deviceType: config.DeviceType, - callback: config.Callback, - } - - /* - C_ClientCallSendIceCandidate - C_ClientCallStart - C_ClientCallSendMediaSettings - C_ClientCallDestroy - C_ClientCallReject - C_ClientCallAccept - */ - c.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_ClientCallToggleVideo: c.toggleVideoHandler, - msg.C_ClientCallToggleAudio: c.toggleAudioHandler, - msg.C_ClientCallTryReconnect: c.tryReconnectHandler, - msg.C_ClientCallDestroy: c.destroyHandler, - msg.C_ClientCallAreAllAudio: c.areAllAudioHandler, - msg.C_ClientCallGetDuration: c.durationHandler, - msg.C_ClientCallSendIceCandidate: c.iceCandidateHandler, - msg.C_ClientCallSendIceConnectionStatus: c.iceConnectionStatusChangeHandler, - msg.C_ClientCallSendMediaSettings: c.mediaSettingsChangeHandler, - msg.C_ClientCallSendTrack: c.trackUpdateHandler, - msg.C_ClientCallSendAck: c.ackHandler, - msg.C_ClientCallStart: c.startHandler, - msg.C_ClientCallJoin: c.joinHandler, - msg.C_ClientCallAccept: c.acceptHandler, - msg.C_ClientCallReject: c.rejectHandler, - msg.C_ClientCallGetParticipantByUserID: c.getParticipantByUserIDHandler, - msg.C_ClientCallGetParticipantByConnId: c.getParticipantByConnIdHandler, - msg.C_ClientCallGetParticipantList: c.getParticipantListHandler, - msg.C_ClientCallMuteParticipant: c.muteParticipantHandler, - msg.C_ClientCallGroupAddParticipant: c.groupAddParticipantHandler, - msg.C_ClientCallGroupRemoveParticipant: c.groupRemoveParticipantHandler, - msg.C_ClientCallGroupUpdateAdmin: c.groupUpdateAdminHandler, - }, - ) - - c.RegisterUpdateAppliers(map[int64]domain.UpdateApplier{ - msg.C_UpdatePhoneCall: c.updatePhoneCall, - msg.C_UpdatePhoneCallStarted: c.updatePhoneCallStarted, - msg.C_UpdatePhoneCallEnded: c.updatePhoneCallEnded, - }) - - return c + c := &call{ + mu: &sync.RWMutex{}, + peerConnections: make(map[int32]*Connection), + peer: nil, + activeCallID: 0, + callInfo: make(map[int64]*Info), + callDuration: make(map[int64]*Duration), + rejectedCallIDs: nil, + iceServer: nil, + userID: config.UserID, + teamInput: teamInput{ + teamID: config.TeamID, + teamAccess: config.TeamAccess, + }, + deviceType: config.DeviceType, + callback: config.Callback, + } + + /* + C_ClientCallSendIceCandidate + C_ClientCallStart + C_ClientCallSendMediaSettings + C_ClientCallDestroy + C_ClientCallReject + C_ClientCallAccept + */ + c.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_ClientCallToggleVideo: c.toggleVideoHandler, + msg.C_ClientCallToggleAudio: c.toggleAudioHandler, + msg.C_ClientCallTryReconnect: c.tryReconnectHandler, + msg.C_ClientCallDestroy: c.destroyHandler, + msg.C_ClientCallAreAllAudio: c.areAllAudioHandler, + msg.C_ClientCallGetDuration: c.durationHandler, + msg.C_ClientCallSendIceCandidate: c.iceCandidateHandler, + msg.C_ClientCallSendIceConnectionStatus: c.iceConnectionStatusChangeHandler, + msg.C_ClientCallSendMediaSettings: c.mediaSettingsChangeHandler, + msg.C_ClientCallSendTrack: c.trackUpdateHandler, + msg.C_ClientCallSendAck: c.ackHandler, + msg.C_ClientCallStart: c.startHandler, + msg.C_ClientCallJoin: c.joinHandler, + msg.C_ClientCallAccept: c.acceptHandler, + msg.C_ClientCallReject: c.rejectHandler, + msg.C_ClientCallGetParticipantByUserID: c.getParticipantByUserIDHandler, + msg.C_ClientCallGetParticipantByConnId: c.getParticipantByConnIdHandler, + msg.C_ClientCallGetParticipantList: c.getParticipantListHandler, + msg.C_ClientCallMuteParticipant: c.muteParticipantHandler, + msg.C_ClientCallGroupAddParticipant: c.groupAddParticipantHandler, + msg.C_ClientCallGroupRemoveParticipant: c.groupRemoveParticipantHandler, + msg.C_ClientCallGroupUpdateAdmin: c.groupUpdateAdminHandler, + }, + ) + + c.RegisterUpdateAppliers(map[int64]domain.UpdateApplier{ + msg.C_UpdatePhoneCall: c.updatePhoneCall, + msg.C_UpdatePhoneCallStarted: c.updatePhoneCallStarted, + msg.C_UpdatePhoneCallEnded: c.updatePhoneCallEnded, + }) + + return c } func (c *call) Name() string { - return module.Call + return module.Call } diff --git a/module/call/callbacks.go b/module/call/callbacks.go index e5d031c5..81bcf13f 100644 --- a/module/call/callbacks.go +++ b/module/call/callbacks.go @@ -1,9 +1,10 @@ package call import ( - "errors" - "git.ronaksoft.com/river/msg/go/msg" - "github.com/ronaksoft/rony" + "errors" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/rony" ) /* @@ -16,169 +17,171 @@ import ( */ type Callback struct { - OnUpdate func(updateType int32, b []byte) - InitStream func(audio, video bool) bool - InitConnection func(connId int32, b []byte) int64 - CloseConnection func(connId int32) bool - GetOfferSDP func(connId int32) (out []byte) - SetOfferGetAnswerSDP func(connId int32, req []byte) (out []byte) - SetAnswerSDP func(connId int32, b []byte) bool - AddIceCandidate func(connId int32, b []byte) bool + OnUpdate func(updateType int32, b []byte) + InitStream func(audio, video bool) bool + InitConnection func(connId int32, b []byte) int64 + CloseConnection func(connId int32) bool + GetOfferSDP func(connId int32) (out []byte) + SetOfferGetAnswerSDP func(connId int32, req []byte) (out []byte) + SetAnswerSDP func(connId int32, b []byte) bool + AddIceCandidate func(connId int32, b []byte) bool } func (c *call) CallbackInitConnection(connId int32, initData *msg.PhoneInit) int64 { - if c.callback.InitConnection == nil { - c.Log().Error("callbacks are not initialized") - return -1 - } - - phoneInitByte, err := initData.Marshal() - if err != nil { - return -1 - } - - inMe := &rony.MessageEnvelope{ - Constructor: msg.C_PhoneInit, - RequestID: 0, - Message: phoneInitByte, - } - - inMeByte, err := inMe.Marshal() - if err != nil { - return -1 - } - - return c.callback.InitConnection(connId, inMeByte) + if c.callback.InitConnection == nil { + c.Log().Error("callbacks are not initialized") + return -1 + } + + phoneInitByte, err := initData.Marshal() + if err != nil { + return -1 + } + + inMe := &rony.MessageEnvelope{ + Constructor: msg.C_PhoneInit, + RequestID: 0, + Message: phoneInitByte, + } + + inMeByte, err := inMe.Marshal() + if err != nil { + return -1 + } + + return c.callback.InitConnection(connId, inMeByte) } func (c *call) CallbackGetOfferSDP(connId int32) (offerSdp *msg.PhoneActionSDPOffer, err error) { - if c.callback.GetOfferSDP == nil { - err = ErrCallbacksAreNotInitialized - return - } - - res := c.callback.GetOfferSDP(connId) - me := &rony.MessageEnvelope{} - err = me.Unmarshal(res) - if err != nil { - return - } - - switch me.Constructor { - case msg.C_PhoneActionSDPOffer: - offerSdp = &msg.PhoneActionSDPOffer{} - err = offerSdp.Unmarshal(me.Message) - if err != nil { - return - } - case msg.C_ClientError: - errObj := &msg.ClientError{} - err = errObj.Unmarshal(me.Message) - if err != nil { - return - } - err = errors.New(errObj.Error) - default: - err = ErrInvalidResponse - } - return + if c.callback.GetOfferSDP == nil { + err = ErrCallbacksAreNotInitialized + return + } + + res := c.callback.GetOfferSDP(connId) + me := &rony.MessageEnvelope{} + err = me.Unmarshal(res) + if err != nil { + return + } + + switch me.Constructor { + case msg.C_PhoneActionSDPOffer: + offerSdp = &msg.PhoneActionSDPOffer{} + err = offerSdp.Unmarshal(me.Message) + if err != nil { + return + } + case msg.C_ClientError: + errObj := &msg.ClientError{} + err = errObj.Unmarshal(me.Message) + if err != nil { + return + } + err = errors.New(errObj.Error) + default: + err = ErrInvalidResponse + } + return } -func (c *call) CallbackSetOfferGetAnswerSDP(connId int32, offerSdp *msg.PhoneActionSDPOffer) (answerSdp *msg.PhoneActionSDPAnswer, err error) { - if c.callback.SetOfferGetAnswerSDP == nil { - err = ErrCallbacksAreNotInitialized - return - } - - offerSdpByte, err := offerSdp.Marshal() - if err != nil { - return - } - - inMe := &rony.MessageEnvelope{ - Constructor: msg.C_PhoneActionSDPOffer, - RequestID: 0, - Message: offerSdpByte, - } - - inMeByte, err := inMe.Marshal() - if err != nil { - return - } - - res := c.callback.SetOfferGetAnswerSDP(connId, inMeByte) - me := &rony.MessageEnvelope{} - err = me.Unmarshal(res) - if err != nil { - return - } - - switch me.Constructor { - case msg.C_PhoneActionSDPAnswer: - answerSdp = &msg.PhoneActionSDPAnswer{} - err = answerSdp.Unmarshal(me.Message) - if err != nil { - return - } - case msg.C_ClientError: - errObj := &msg.ClientError{} - err = errObj.Unmarshal(me.Message) - if err != nil { - return - } - err = errors.New(errObj.Error) - default: - err = ErrInvalidResponse - } - return +func (c *call) CallbackSetOfferGetAnswerSDP(connId int32, offerSdp *msg.PhoneActionSDPOffer) (answerSdp *msg.PhoneActionSDPAnswer, + err error, +) { + if c.callback.SetOfferGetAnswerSDP == nil { + err = ErrCallbacksAreNotInitialized + return + } + + offerSdpByte, err := offerSdp.Marshal() + if err != nil { + return + } + + inMe := &rony.MessageEnvelope{ + Constructor: msg.C_PhoneActionSDPOffer, + RequestID: 0, + Message: offerSdpByte, + } + + inMeByte, err := inMe.Marshal() + if err != nil { + return + } + + res := c.callback.SetOfferGetAnswerSDP(connId, inMeByte) + me := &rony.MessageEnvelope{} + err = me.Unmarshal(res) + if err != nil { + return + } + + switch me.Constructor { + case msg.C_PhoneActionSDPAnswer: + answerSdp = &msg.PhoneActionSDPAnswer{} + err = answerSdp.Unmarshal(me.Message) + if err != nil { + return + } + case msg.C_ClientError: + errObj := &msg.ClientError{} + err = errObj.Unmarshal(me.Message) + if err != nil { + return + } + err = errors.New(errObj.Error) + default: + err = ErrInvalidResponse + } + return } func (c *call) CallbackSetAnswerSDP(connId int32, answerSdp *msg.PhoneActionSDPAnswer) bool { - if c.callback.SetAnswerSDP == nil { - c.Log().Error("callbacks are not initialized") - return false - } - - answerSdpByte, err := answerSdp.Marshal() - if err != nil { - return false - } - - inMe := &rony.MessageEnvelope{ - Constructor: msg.C_PhoneActionSDPAnswer, - RequestID: 0, - Message: answerSdpByte, - } - - inMeByte, err := inMe.Marshal() - if err != nil { - return false - } - - return c.callback.SetAnswerSDP(connId, inMeByte) + if c.callback.SetAnswerSDP == nil { + c.Log().Error("callbacks are not initialized") + return false + } + + answerSdpByte, err := answerSdp.Marshal() + if err != nil { + return false + } + + inMe := &rony.MessageEnvelope{ + Constructor: msg.C_PhoneActionSDPAnswer, + RequestID: 0, + Message: answerSdpByte, + } + + inMeByte, err := inMe.Marshal() + if err != nil { + return false + } + + return c.callback.SetAnswerSDP(connId, inMeByte) } func (c *call) CallbackAddIceCandidate(connId int32, candidate *msg.CallRTCIceCandidate) bool { - if c.callback.AddIceCandidate == nil { - c.Log().Error("callbacks are not initialized") - return false - } - - candidateByte, err := candidate.Marshal() - if err != nil { - return false - } - - inMe := &rony.MessageEnvelope{ - Constructor: msg.C_CallRTCIceCandidate, - RequestID: 0, - Message: candidateByte, - } - - inMeByte, err := inMe.Marshal() - if err != nil { - return false - } - - return c.callback.AddIceCandidate(connId, inMeByte) + if c.callback.AddIceCandidate == nil { + c.Log().Error("callbacks are not initialized") + return false + } + + candidateByte, err := candidate.Marshal() + if err != nil { + return false + } + + inMe := &rony.MessageEnvelope{ + Constructor: msg.C_CallRTCIceCandidate, + RequestID: 0, + Message: candidateByte, + } + + inMeByte, err := inMe.Marshal() + if err != nil { + return false + } + + return c.callback.AddIceCandidate(connId, inMeByte) } diff --git a/module/call/handlers.go b/module/call/handlers.go index 643b8852..ba2861ab 100644 --- a/module/call/handlers.go +++ b/module/call/handlers.go @@ -1,10 +1,10 @@ package call import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" ) /* @@ -17,330 +17,330 @@ import ( */ func (c *call) toggleVideoHandler(da request.Callback) { - req := &msg.ClientCallToggleVideo{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.toggleVideo(req.Video) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallToggleVideo{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.toggleVideo(req.Video) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) toggleAudioHandler(da request.Callback) { - req := &msg.ClientCallToggleAudio{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.toggleAudio(req.Audio) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallToggleAudio{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.toggleAudio(req.Audio) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) tryReconnectHandler(da request.Callback) { - req := &msg.ClientCallTryReconnect{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.tryReconnect(req.ConnId) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallTryReconnect{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.tryReconnect(req.ConnId) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) destroyHandler(da request.Callback) { - req := &msg.ClientCallDestroy{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.ClientCallDestroy{} + if err := da.RequestData(req); err != nil { + return + } - c.destroy(req.CallID) + c.destroy(req.CallID) - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) areAllAudioHandler(da request.Callback) { - req := &msg.ClientCallAreAllAudio{} - if err := da.RequestData(req); err != nil { - return - } - - ok, err := c.areAllAudio() - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: ok}) + req := &msg.ClientCallAreAllAudio{} + if err := da.RequestData(req); err != nil { + return + } + + ok, err := c.areAllAudio() + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: ok}) } func (c *call) durationHandler(da request.Callback) { - req := &msg.ClientCallGetDuration{} - if err := da.RequestData(req); err != nil { - return - } - - duration, err := c.duration(req.CallID) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_ClientCallDuration, &msg.ClientCallDuration{Duration: duration}) + req := &msg.ClientCallGetDuration{} + if err := da.RequestData(req); err != nil { + return + } + + duration, err := c.duration(req.CallID) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_ClientCallDuration, &msg.ClientCallDuration{Duration: duration}) } func (c *call) iceCandidateHandler(da request.Callback) { - req := &msg.ClientCallSendIceCandidate{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.iceCandidate(req.ConnId, req.Candidate) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallSendIceCandidate{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.iceCandidate(req.ConnId, req.Candidate) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) iceConnectionStatusChangeHandler(da request.Callback) { - req := &msg.ClientCallSendIceConnectionStatus{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.iceConnectionStatusChange(req.ConnId, req.State, req.HasIceError) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallSendIceConnectionStatus{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.iceConnectionStatusChange(req.ConnId, req.State, req.HasIceError) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) trackUpdateHandler(da request.Callback) { - req := &msg.ClientCallSendTrack{} - if err := da.RequestData(req); err != nil { - return - } - - // TODO: (@hamidrezakk) - err := c.trackUpdate(req.ConnId, req.StreamID) - if err = da.RequestData(req); err != nil { - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallSendTrack{} + if err := da.RequestData(req); err != nil { + return + } + + // TODO: (@hamidrezakk) + err := c.trackUpdate(req.ConnId, req.StreamID) + if err = da.RequestData(req); err != nil { + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) ackHandler(da request.Callback) { - req := &msg.ClientCallSendAck{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.ClientCallSendAck{} + if err := da.RequestData(req); err != nil { + return + } - c.ack(req.CallID) + c.ack(req.CallID) - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) mediaSettingsChangeHandler(da request.Callback) { - req := &msg.ClientCallSendMediaSettings{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.mediaSettingsChange(req.MediaSettings) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallSendMediaSettings{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.mediaSettingsChange(req.MediaSettings) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) startHandler(da request.Callback) { - req := &msg.ClientCallStart{} - if err := da.RequestData(req); err != nil { - return - } - - callID, err := c.start(req.Peer, req.InputUsers, req.Video, req.CallID) - if err != nil { - if err == domain.ErrInvalidCall { - da.Response(rony.C_Error, &rony.Error{Code: "E02", Items: "CALL"}) - } else { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - } - return - } - - da.Response(msg.C_ClientCallStarted, &msg.ClientCallStarted{CallID: callID}) + req := &msg.ClientCallStart{} + if err := da.RequestData(req); err != nil { + return + } + + callID, err := c.start(req.Peer, req.InputUsers, req.Video, req.CallID) + if err != nil { + if err == domain.ErrInvalidCall { + da.Response(rony.C_Error, &rony.Error{Code: "E02", Items: "CALL"}) + } else { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + } + return + } + + da.Response(msg.C_ClientCallStarted, &msg.ClientCallStarted{CallID: callID}) } func (c *call) joinHandler(da request.Callback) { - req := &msg.ClientCallJoin{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.join(req.Peer, req.CallID) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallJoin{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.join(req.Peer, req.CallID) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) acceptHandler(da request.Callback) { - req := &msg.ClientCallAccept{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.accept(req.CallID, req.Video) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallAccept{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.accept(req.CallID, req.Video) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) rejectHandler(da request.Callback) { - req := &msg.ClientCallReject{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.reject(req.CallID, req.Duration, req.Reason, req.TargetPeer, req.Force) - if err != nil { - //da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - //return - c.Log().WarnOnErr("ClientCallReject", err) - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallReject{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.reject(req.CallID, req.Duration, req.Reason, req.TargetPeer, req.Force) + if err != nil { + //da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + //return + c.Log().WarnOnErr("ClientCallReject", err) + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) getParticipantByUserIDHandler(da request.Callback) { - req := &msg.ClientCallGetParticipantByUserID{} - if err := da.RequestData(req); err != nil { - return - } - - participant, err := c.getParticipantByUserID(req.CallID, req.UserID) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_CallParticipant, participant) + req := &msg.ClientCallGetParticipantByUserID{} + if err := da.RequestData(req); err != nil { + return + } + + participant, err := c.getParticipantByUserID(req.CallID, req.UserID) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_CallParticipant, participant) } func (c *call) getParticipantByConnIdHandler(da request.Callback) { - req := &msg.ClientCallGetParticipantByConnId{} - if err := da.RequestData(req); err != nil { - return - } - - participant, err := c.getParticipantByConnId(req.ConnId) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_CallParticipant, participant) + req := &msg.ClientCallGetParticipantByConnId{} + if err := da.RequestData(req); err != nil { + return + } + + participant, err := c.getParticipantByConnId(req.ConnId) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_CallParticipant, participant) } func (c *call) getParticipantListHandler(da request.Callback) { - req := &msg.ClientCallGetParticipantList{} - if err := da.RequestData(req); err != nil { - return - } - - participants, err := c.getParticipantList(req.CallID, req.ExcludeCurrent) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_CallParticipants, &msg.CallParticipants{ - CallParticipants: participants, - }) + req := &msg.ClientCallGetParticipantList{} + if err := da.RequestData(req); err != nil { + return + } + + participants, err := c.getParticipantList(req.CallID, req.ExcludeCurrent) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_CallParticipants, &msg.CallParticipants{ + CallParticipants: participants, + }) } func (c *call) muteParticipantHandler(da request.Callback) { - req := &msg.ClientCallMuteParticipant{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.muteParticipant(req.UserID, req.Muted) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallMuteParticipant{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.muteParticipant(req.UserID, req.Muted) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) groupAddParticipantHandler(da request.Callback) { - req := &msg.ClientCallGroupAddParticipant{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.groupAddParticipant(req.CallID, req.Participants) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallGroupAddParticipant{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.groupAddParticipant(req.CallID, req.Participants) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) groupRemoveParticipantHandler(da request.Callback) { - req := &msg.ClientCallGroupRemoveParticipant{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.groupRemoveParticipant(req.CallID, req.UserIDs, req.Timeout) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallGroupRemoveParticipant{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.groupRemoveParticipant(req.CallID, req.UserIDs, req.Timeout) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (c *call) groupUpdateAdminHandler(da request.Callback) { - req := &msg.ClientCallGroupUpdateAdmin{} - if err := da.RequestData(req); err != nil { - return - } - - err := c.groupUpdateAdmin(req.CallID, req.UserID, req.Admin) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) - return - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientCallGroupUpdateAdmin{} + if err := da.RequestData(req); err != nil { + return + } + + err := c.groupUpdateAdmin(req.CallID, req.UserID, req.Admin) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "E00", Items: err.Error()}) + return + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } diff --git a/module/call/methods.go b/module/call/methods.go index 6595dc15..e50b8087 100644 --- a/module/call/methods.go +++ b/module/call/methods.go @@ -1,12 +1,13 @@ package call import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "go.uber.org/zap" - "sync" - "time" + "sync" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "go.uber.org/zap" ) /* @@ -19,2303 +20,2313 @@ import ( */ func (c *call) toggleVideo(enable bool) (err error) { - c.propagateMediaSettings(MediaSettingsIn{ - Video: &enable, - }, false) + c.propagateMediaSettings(MediaSettingsIn{ + Video: &enable, + }, false) - return c.modifyMediaStream(enable) + return c.modifyMediaStream(enable) } func (c *call) toggleAudio(enable bool) (err error) { - c.propagateMediaSettings(MediaSettingsIn{ - Audio: &enable, - }, false) - return + c.propagateMediaSettings(MediaSettingsIn{ + Audio: &enable, + }, false) + return } func (c *call) tryReconnect(connId int32) (err error) { - _ = c.checkDisconnection(connId, "disconnected", false) - return + _ = c.checkDisconnection(connId, "disconnected", false) + return } func (c *call) destroy(callID int64) { - closeFn := func(conn *Connection) { - if c.callback.CloseConnection == nil { - c.Log().Error("callbacks are not initialized") - return - } - _ = c.callback.CloseConnection(conn.ConnId) - if conn.connectTicker != nil { - conn.connectTicker.Stop() - } - if conn.reconnectTimout != nil { - conn.reconnectTimout.Stop() - } - } - c.mu.RLock() - for _, conn := range c.peerConnections { - closeFn(conn) - } - c.mu.RUnlock() - c.mu.Lock() - c.peerConnections = make(map[int32]*Connection) - if info, ok := c.callInfo[callID]; ok { - for reqID := range info.requestMap { - c.SDK().QueueCtrl().CancelRequest(uint64(reqID)) - } - } - delete(c.callInfo, callID) - - update := msg.CallUpdateDestroyed{} - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_Destroyed, updateData) - } - - if d, ok := c.callDuration[callID]; ok { - if d.Stop == 0 { - c.callDuration[callID].Stop = time.Now().Unix() - } - } - - c.activeCallID = 0 - c.peer = nil - c.mu.Unlock() + closeFn := func(conn *Connection) { + if c.callback.CloseConnection == nil { + c.Log().Error("callbacks are not initialized") + return + } + _ = c.callback.CloseConnection(conn.ConnId) + if conn.connectTicker != nil { + conn.connectTicker.Stop() + } + if conn.reconnectTimout != nil { + conn.reconnectTimout.Stop() + } + } + c.mu.RLock() + for _, conn := range c.peerConnections { + closeFn(conn) + } + c.mu.RUnlock() + c.mu.Lock() + c.peerConnections = make(map[int32]*Connection) + if info, ok := c.callInfo[callID]; ok { + for reqID := range info.requestMap { + c.SDK().QueueCtrl().CancelRequest(uint64(reqID)) + } + } + delete(c.callInfo, callID) + + update := msg.CallUpdateDestroyed{} + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_Destroyed, updateData) + } + + if d, ok := c.callDuration[callID]; ok { + if d.Stop == 0 { + c.callDuration[callID].Stop = time.Now().Unix() + } + } + + c.activeCallID = 0 + c.peer = nil + c.mu.Unlock() } func (c *call) areAllAudio() (ok bool, err error) { - streamState, err := c.getMediaSettings() - if err != nil { - return - } + streamState, err := c.getMediaSettings() + if err != nil { + return + } - if streamState.Video { - ok = false - return - } + if streamState.Video { + ok = false + return + } - ok = true - participants, err := c.getParticipantList(c.activeCallID, true) - if err != nil { - return - } + ok = true + participants, err := c.getParticipantList(c.activeCallID, true) + if err != nil { + return + } - for _, participant := range participants { - if participant.MediaSettings.Video { - ok = false - break - } - } + for _, participant := range participants { + if participant.MediaSettings.Video { + ok = false + break + } + } - return + return } func (c *call) duration(callID int64) (duration int64, err error) { - c.mu.RLock() - dur, ok := c.callDuration[callID] - c.mu.RUnlock() + c.mu.RLock() + dur, ok := c.callDuration[callID] + c.mu.RUnlock() - if !ok { - err = ErrInvalidCallID - return - } + if !ok { + err = ErrInvalidCallID + return + } - if dur.Start == 0 { - duration = 0 - return - } + if dur.Start == 0 { + duration = 0 + return + } - if dur.Stop == 0 { - duration = time.Now().Unix() - dur.Start - return - } + if dur.Stop == 0 { + duration = time.Now().Unix() - dur.Start + return + } - duration = dur.Stop - dur.Start - return + duration = dur.Stop - dur.Start + return } // Client should listen to icecandidate and send it to SDK func (c *call) iceCandidate(connId int32, candidate *msg.CallRTCIceCandidate) (err error) { - err = c.sendIceCandidate(c.activeCallID, connId, candidate) - return + err = c.sendIceCandidate(c.activeCallID, connId, candidate) + return } // Client should listen to iceconnectionstatechange and send it to SDK // Client should listen to icecandidateerror and send it to SDK func (c *call) iceConnectionStatusChange(connId int32, state string, hasIceError bool) (err error) { - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } - - conn, hasConn := c.peerConnections[connId] - if !hasConn { - err = ErrInvalidConnId - return - } - - conn.mu.Lock() - conn.IceConnectionState = state - conn.mu.Unlock() - - if !hasIceError { - update := msg.CallUpdateConnectionStatusChanged{ - ConnectionID: connId, - State: state, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_ConnectionStatusChanged, updateData) - } - c.checkAllConnected() - } - err = c.checkDisconnection(connId, state, hasIceError) - return + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } + + conn, hasConn := c.peerConnections[connId] + if !hasConn { + err = ErrInvalidConnId + return + } + + conn.mu.Lock() + conn.IceConnectionState = state + conn.mu.Unlock() + + if !hasIceError { + update := msg.CallUpdateConnectionStatusChanged{ + ConnectionID: connId, + State: state, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_ConnectionStatusChanged, updateData) + } + c.checkAllConnected() + } + err = c.checkDisconnection(connId, state, hasIceError) + return } // Client should listen to track and send it to SDK func (c *call) trackUpdate(connId int32, streamID string) (err error) { - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } - - c.mu.Lock() - if _, ok := c.callDuration[c.activeCallID]; !ok { - c.callDuration[c.activeCallID] = &Duration{ - Start: time.Now().Unix(), - Stop: 0, - } - } - c.mu.Unlock() - - conn, hasConn := c.peerConnections[connId] - if !hasConn { - err = ErrInvalidConnId - return - } - - conn.mu.Lock() - conn.Init = true - conn.Reconnecting = false - conn.ReconnectingTry = 0 - conn.StreamID = streamID - // clear reconnect timeout - if conn.connectTicker != nil { - conn.connectTicker.Stop() - } - conn.mu.Unlock() - - c.changeStatus(connId, msg.CallStatus_Connected) - return + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } + + c.mu.Lock() + if _, ok := c.callDuration[c.activeCallID]; !ok { + c.callDuration[c.activeCallID] = &Duration{ + Start: time.Now().Unix(), + Stop: 0, + } + } + c.mu.Unlock() + + conn, hasConn := c.peerConnections[connId] + if !hasConn { + err = ErrInvalidConnId + return + } + + conn.mu.Lock() + conn.Init = true + conn.Reconnecting = false + conn.ReconnectingTry = 0 + conn.StreamID = streamID + // clear reconnect timeout + if conn.connectTicker != nil { + conn.connectTicker.Stop() + } + conn.mu.Unlock() + + c.changeStatus(connId, msg.CallStatus_Connected) + return } func (c *call) mediaSettingsChange(mediaSettings *msg.CallMediaSettings) (err error) { - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } - info := c.getCallInfo(c.activeCallID) - if info == nil { - err = ErrInvalidCallID - return - } + info := c.getCallInfo(c.activeCallID) + if info == nil { + err = ErrInvalidCallID + return + } - info.mu.Lock() - info.mediaSettings = mediaSettings - info.mu.Unlock() - return + info.mu.Lock() + info.mediaSettings = mediaSettings + info.mu.Unlock() + return } func (c *call) start(peer *msg.InputPeer, participants []*msg.InputUser, video bool, callID int64) (id int64, err error) { - c.peer = peer - initRes, err := c.apiInit(peer, callID) - if err != nil { - c.Log().WarnOnErr("Init", err) - return - } - - if c.callback.InitStream == nil { - err = ErrCallbacksAreNotInitialized - return - } - - ok := c.callback.InitStream(true, video) - if !ok { - err = ErrCannotInitStream - return - } - - c.iceServer = initRes.IceServers - if callID != 0 { - c.activeCallID = callID - var joinRes *msg.PhoneParticipants - joinRes, err = c.apiJoin(peer, c.activeCallID) - if err != nil { - return - } - - c.initParticipants(c.activeCallID, joinRes.Participants, true) - _, err = c.initManyConnections(peer, c.activeCallID, false, video, nil) - if err != nil { - c.Log().WarnOnErr("initManyConnections", err) - return - } - } else { - c.activeCallID = 0 - c.initCallParticipants(TempCallID, participants) - _, err = c.initManyConnections(peer, TempCallID, true, video, nil) - if err != nil { - c.Log().WarnOnErr("initManyConnections", err) - return - } - - c.swapTempInfo(c.activeCallID) - } - id = c.activeCallID - return + c.peer = peer + initRes, err := c.apiInit(peer, callID) + if err != nil { + c.Log().WarnOnErr("Init", err) + return + } + + if c.callback.InitStream == nil { + err = ErrCallbacksAreNotInitialized + return + } + + ok := c.callback.InitStream(true, video) + if !ok { + err = ErrCannotInitStream + return + } + + c.iceServer = initRes.IceServers + if callID != 0 { + c.activeCallID = callID + var joinRes *msg.PhoneParticipants + joinRes, err = c.apiJoin(peer, c.activeCallID) + if err != nil { + return + } + + c.initParticipants(c.activeCallID, joinRes.Participants, true) + _, err = c.initManyConnections(peer, c.activeCallID, false, video, nil) + if err != nil { + c.Log().WarnOnErr("initManyConnections", err) + return + } + } else { + c.activeCallID = 0 + c.initCallParticipants(TempCallID, participants) + _, err = c.initManyConnections(peer, TempCallID, true, video, nil) + if err != nil { + c.Log().WarnOnErr("initManyConnections", err) + return + } + + c.swapTempInfo(c.activeCallID) + } + id = c.activeCallID + return } func (c *call) join(peer *msg.InputPeer, callID int64) (err error) { - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } - c.activeCallID = callID - update := msg.CallUpdateCallPreview{ - CallID: callID, - Peer: peer, - } - updateData, err := update.Marshal() - if err != nil { - return - } + c.activeCallID = callID + update := msg.CallUpdateCallPreview{ + CallID: callID, + Peer: peer, + } + updateData, err := update.Marshal() + if err != nil { + return + } - c.callUpdate(msg.CallUpdate_CallPreview, updateData) - return + c.callUpdate(msg.CallUpdate_CallPreview, updateData) + return } func (c *call) accept(callID int64, video bool) (err error) { - if c.peer == nil { - err = ErrInvalidPeerInput - return - } - - initRes, err := c.apiInit(c.peer, callID) - if err != nil { - return - } - - c.mu.Lock() - c.activeCallID = callID - c.iceServer = initRes.IceServers - c.mu.Unlock() - - info := c.getCallInfo(callID) - if info == nil { - err = ErrInvalidCallRequest - return - } - - if len(info.requests) == 0 { - err = ErrNoCallRequest - return - } - - initFn := func() error { - wg := sync.WaitGroup{} - for idx := len(info.requests) - 1; idx >= 0; idx-- { - request := info.requests[idx] - - wg.Add(1) - go func(req *UpdatePhoneCall) { - defer wg.Done() - _, innerErr := c.initManyConnections(c.peer, callID, false, video, req) - if innerErr != nil { - c.Log().WarnOnErr("initManyConnections", err) - return - } - - time.AfterFunc(time.Duration(255)*time.Millisecond, func() { - streamState, innerErr := c.getMediaSettings() - if innerErr != nil { - return - } - - c.mediaSettingsInit(streamState) - c.propagateMediaSettings(MediaSettingsIn{ - Audio: &streamState.Audio, - ScreenShare: &streamState.ScreenShare, - Video: &streamState.Video, - }, true) - }) - }(request) - } - wg.Wait() - - return nil - } - - if !info.dialed { - if c.callback.InitStream == nil { - err = ErrCallbacksAreNotInitialized - return - } - - ok := c.callback.InitStream(true, video) - if !ok { - err = ErrCannotInitStream - return - } - - return initFn() - } - - return initFn() + if c.peer == nil { + err = ErrInvalidPeerInput + return + } + + initRes, err := c.apiInit(c.peer, callID) + if err != nil { + return + } + + c.mu.Lock() + c.activeCallID = callID + c.iceServer = initRes.IceServers + c.mu.Unlock() + + info := c.getCallInfo(callID) + if info == nil { + err = ErrInvalidCallRequest + return + } + + if len(info.requests) == 0 { + err = ErrNoCallRequest + return + } + + initFn := func() error { + wg := sync.WaitGroup{} + for idx := len(info.requests) - 1; idx >= 0; idx-- { + request := info.requests[idx] + + wg.Add(1) + go func(req *UpdatePhoneCall) { + defer wg.Done() + _, innerErr := c.initManyConnections(c.peer, callID, false, video, req) + if innerErr != nil { + c.Log().WarnOnErr("initManyConnections", err) + return + } + + time.AfterFunc(time.Duration(255)*time.Millisecond, func() { + streamState, innerErr := c.getMediaSettings() + if innerErr != nil { + return + } + + c.mediaSettingsInit(streamState) + c.propagateMediaSettings(MediaSettingsIn{ + Audio: &streamState.Audio, + ScreenShare: &streamState.ScreenShare, + Video: &streamState.Video, + }, true) + }) + }(request) + } + wg.Wait() + + return nil + } + + if !info.dialed { + if c.callback.InitStream == nil { + err = ErrCallbacksAreNotInitialized + return + } + + ok := c.callback.InitStream(true, video) + if !ok { + err = ErrCannotInitStream + return + } + + return initFn() + } + + return initFn() } func (c *call) reject(callID int64, duration int32, reason msg.DiscardReason, targetPeer *msg.InputPeer, force bool) (err error) { - peer := c.peer - if targetPeer != nil { - peer = targetPeer - } - - if peer == nil { - err = ErrInvalidPeerInput - return - } - - c.pushToRejectedCallIds(callID) - - c.mu.Lock() - if d, ok := c.callDuration[callID]; ok { - if d.Stop == 0 { - c.callDuration[callID].Stop = time.Now().Unix() - } - } - c.mu.Unlock() - - if force { - _ = repo.Dialogs.UpdateCallEnded(&msg.UpdatePhoneCallEnded{ - UCount: 0, - UpdateID: 0, - TeamID: 0, - Peer: &msg.Peer{ - ID: peer.ID, - Type: int32(peer.Type), - AccessHash: peer.AccessHash, - }, - }) - } - - _, err = c.apiReject(peer, callID, reason, duration) - return + peer := c.peer + if targetPeer != nil { + peer = targetPeer + } + + if peer == nil { + err = ErrInvalidPeerInput + return + } + + c.pushToRejectedCallIds(callID) + + c.mu.Lock() + if d, ok := c.callDuration[callID]; ok { + if d.Stop == 0 { + c.callDuration[callID].Stop = time.Now().Unix() + } + } + c.mu.Unlock() + + if force { + _ = repo.Dialogs.UpdateCallEnded(&msg.UpdatePhoneCallEnded{ + UCount: 0, + UpdateID: 0, + TeamID: 0, + Peer: &msg.Peer{ + ID: peer.ID, + Type: int32(peer.Type), + AccessHash: peer.AccessHash, + }, + }) + } + + _, err = c.apiReject(peer, callID, reason, duration) + return } func (c *call) getParticipantByUserID(callID int64, userID int64) (participant *msg.CallParticipant, err error) { - connId, info, valid := c.getConnId(callID, userID) - if !valid { - err = ErrInvalidCallID - return - } + connId, info, valid := c.getConnId(callID, userID) + if !valid { + err = ErrInvalidCallID + return + } - info.mu.RLock() - participant = info.participants[connId] - info.mu.RUnlock() - return + info.mu.RLock() + participant = info.participants[connId] + info.mu.RUnlock() + return } func (c *call) getParticipantByConnId(connId int32) (participant *msg.CallParticipant, err error) { - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } - info := c.getCallInfo(c.activeCallID) - if info == nil { - err = ErrInvalidCallID - return - } + info := c.getCallInfo(c.activeCallID) + if info == nil { + err = ErrInvalidCallID + return + } - info.mu.RLock() - participant = info.participants[connId] - info.mu.RUnlock() - return + info.mu.RLock() + participant = info.participants[connId] + info.mu.RUnlock() + return } func (c *call) getParticipantList(callID int64, excludeCurrent bool) (participants []*msg.CallParticipant, err error) { - info := c.getCallInfo(callID) - if info == nil { - err = ErrInvalidCallID - return - } - - c.mu.RLock() - for _, participant := range info.participants { - if !excludeCurrent || participant.PhoneParticipant.Peer.UserID == c.userID { - if conn, ok := c.peerConnections[participant.PhoneParticipant.ConnectionId]; ok && conn.StreamID != "" { - participant.Started = true - } - participants = append(participants, participant) - } - } - c.mu.RUnlock() - - return + info := c.getCallInfo(callID) + if info == nil { + err = ErrInvalidCallID + return + } + + c.mu.RLock() + for _, participant := range info.participants { + if !excludeCurrent || participant.PhoneParticipant.Peer.UserID == c.userID { + if conn, ok := c.peerConnections[participant.PhoneParticipant.ConnectionId]; ok && conn.StreamID != "" { + participant.Started = true + } + participants = append(participants, participant) + } + } + c.mu.RUnlock() + + return } func (c *call) muteParticipant(userID int64, muted bool) (err error) { - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } - - connId, info, valid := c.getConnId(c.activeCallID, userID) - if !valid { - err = ErrInvalidCallID - return - } - - info.mu.Lock() - info.participants[connId].Muted = muted - info.mu.Unlock() - - update := msg.CallUpdateParticipantMuted{ - ConnectionID: connId, - Muted: muted, - UserID: userID, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_ParticipantMuted, updateData) - } - - return + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } + + connId, info, valid := c.getConnId(c.activeCallID, userID) + if !valid { + err = ErrInvalidCallID + return + } + + info.mu.Lock() + info.participants[connId].Muted = muted + info.mu.Unlock() + + update := msg.CallUpdateParticipantMuted{ + ConnectionID: connId, + Muted: muted, + UserID: userID, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_ParticipantMuted, updateData) + } + + return } func (c *call) groupAddParticipant(callID int64, participants []*msg.InputUser) (err error) { - if c.peer == nil { - err = ErrInvalidPeerInput - return - } + if c.peer == nil { + err = ErrInvalidPeerInput + return + } - _, err = c.apiAddParticipant(c.peer, callID, participants) - return + _, err = c.apiAddParticipant(c.peer, callID, participants) + return } func (c *call) groupRemoveParticipant(callID int64, userIDs []int64, timeout bool) (err error) { - if c.peer == nil { - err = ErrInvalidPeerInput - return - } - - inputUsers := c.getInputUserByUserIDs(callID, userIDs) - if len(inputUsers) == 0 { - err = ErrInvalidCallID - return - } - - _, err = c.apiRemoveParticipant(c.peer, callID, inputUsers, timeout) - if err != nil { - return - } - - for _, userID := range userIDs { - c.removeParticipant(userID, nil) - } - - update := msg.CallUpdateParticipantRemoved{ - UserIDs: userIDs, - Timeout: timeout, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_ParticipantRemoved, updateData) - } - - return + if c.peer == nil { + err = ErrInvalidPeerInput + return + } + + inputUsers := c.getInputUserByUserIDs(callID, userIDs) + if len(inputUsers) == 0 { + err = ErrInvalidCallID + return + } + + _, err = c.apiRemoveParticipant(c.peer, callID, inputUsers, timeout) + if err != nil { + return + } + + for _, userID := range userIDs { + c.removeParticipant(userID, nil) + } + + update := msg.CallUpdateParticipantRemoved{ + UserIDs: userIDs, + Timeout: timeout, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_ParticipantRemoved, updateData) + } + + return } func (c *call) groupUpdateAdmin(callID int64, userID int64, admin bool) (err error) { - if c.peer == nil { - err = ErrInvalidPeerInput - return - } + if c.peer == nil { + err = ErrInvalidPeerInput + return + } - inputUsers := c.getInputUserByUserIDs(callID, []int64{userID}) - if len(inputUsers) == 0 { - err = ErrInvalidCallID - return - } + inputUsers := c.getInputUserByUserIDs(callID, []int64{userID}) + if len(inputUsers) == 0 { + err = ErrInvalidCallID + return + } - _, err = c.apiUpdateAdmin(c.peer, callID, inputUsers[0], admin) - if err != nil { - return - } + _, err = c.apiUpdateAdmin(c.peer, callID, inputUsers[0], admin) + if err != nil { + return + } - c.updateAdmin(userID, admin) + c.updateAdmin(userID, admin) - update := msg.CallUpdateParticipantAdminUpdated{ - UserID: userID, - Admin: admin, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_ParticipantAdminUpdated, updateData) - } + update := msg.CallUpdateParticipantAdminUpdated{ + UserID: userID, + Admin: admin, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_ParticipantAdminUpdated, updateData) + } - return + return } func (c *call) getMediaSettings() (ms *msg.CallMediaSettings, err error) { - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } - info := c.getCallInfo(c.activeCallID) - if info == nil { - err = ErrInvalidCallID - return - } + info := c.getCallInfo(c.activeCallID) + if info == nil { + err = ErrInvalidCallID + return + } - c.mu.RLock() - ms = info.mediaSettings - c.mu.RUnlock() - return + c.mu.RLock() + ms = info.mediaSettings + c.mu.RUnlock() + return } func (c *call) initCallParticipants(callID int64, participants []*msg.InputUser) { - participants = append([]*msg.InputUser{{ - UserID: c.userID, - AccessHash: 0, - }}, participants...) - callParticipants := make(map[int32]*msg.CallParticipant) - callParticipantMap := make(map[int64]int32) - for i, participant := range participants { - idx := int32(i) - callParticipants[idx] = &msg.CallParticipant{ - PhoneParticipant: &msg.PhoneParticipant{ - ConnectionId: idx, - Peer: participant, - Initiator: idx == 0, - Admin: idx == 0, - }, - DeviceType: msg.CallDeviceType_CallDeviceUnknown, - MediaSettings: &msg.CallMediaSettings{ - Audio: true, - ScreenShare: false, - Video: true, - }, - Started: false, - Muted: false, - } - callParticipantMap[participant.UserID] = idx - } - - c.mu.Lock() - c.callInfo[callID] = &Info{ - acceptedParticipantIds: nil, - acceptedParticipants: nil, - allConnected: false, - dialed: false, - mediaSettings: &msg.CallMediaSettings{ - Audio: false, - ScreenShare: false, - Video: false, - }, - participantMap: callParticipantMap, - participants: callParticipants, - requestParticipantIds: nil, - requests: nil, - iceServer: nil, - requestMap: make(map[int64]struct{}), - mu: &sync.RWMutex{}, - } - c.mu.Unlock() + participants = append([]*msg.InputUser{ + { + UserID: c.userID, + AccessHash: 0, + }, + }, participants...) + callParticipants := make(map[int32]*msg.CallParticipant) + callParticipantMap := make(map[int64]int32) + for i, participant := range participants { + idx := int32(i) + callParticipants[idx] = &msg.CallParticipant{ + PhoneParticipant: &msg.PhoneParticipant{ + ConnectionId: idx, + Peer: participant, + Initiator: idx == 0, + Admin: idx == 0, + }, + DeviceType: msg.CallDeviceType_CallDeviceUnknown, + MediaSettings: &msg.CallMediaSettings{ + Audio: true, + ScreenShare: false, + Video: true, + }, + Started: false, + Muted: false, + } + callParticipantMap[participant.UserID] = idx + } + + c.mu.Lock() + c.callInfo[callID] = &Info{ + acceptedParticipantIds: nil, + acceptedParticipants: nil, + allConnected: false, + dialed: false, + mediaSettings: &msg.CallMediaSettings{ + Audio: false, + ScreenShare: false, + Video: false, + }, + participantMap: callParticipantMap, + participants: callParticipants, + requestParticipantIds: nil, + requests: nil, + iceServer: nil, + requestMap: make(map[int64]struct{}), + mu: &sync.RWMutex{}, + } + c.mu.Unlock() } func (c *call) initParticipants(callID int64, participants []*msg.PhoneParticipant, bootstrap bool) { - fn := func(callParticipants map[int32]*msg.CallParticipant, callParticipantMap map[int64]int32) (map[int32]*msg.CallParticipant, map[int64]int32) { - for _, participant := range participants { - callParticipants[participant.ConnectionId] = &msg.CallParticipant{ - PhoneParticipant: &msg.PhoneParticipant{ - ConnectionId: participant.ConnectionId, - Peer: participant.Peer, - Initiator: participant.Initiator, - Admin: participant.Admin, - }, - DeviceType: msg.CallDeviceType_CallDeviceUnknown, - MediaSettings: &msg.CallMediaSettings{ - Audio: true, - ScreenShare: false, - Video: true, - }, - Started: false, - Muted: false, - } - callParticipantMap[participant.Peer.UserID] = participant.ConnectionId - } - return callParticipants, callParticipantMap - } - - if info, ok := c.callInfo[callID]; !ok { - if bootstrap { - callParticipants, callParticipantMap := fn(make(map[int32]*msg.CallParticipant), make(map[int64]int32)) - c.mu.Lock() - c.callInfo[callID] = &Info{ - acceptedParticipantIds: nil, - acceptedParticipants: nil, - allConnected: false, - dialed: false, - mediaSettings: &msg.CallMediaSettings{ - Audio: false, - ScreenShare: false, - Video: false, - }, - participantMap: callParticipantMap, - participants: callParticipants, - requestParticipantIds: nil, - requests: nil, - iceServer: nil, - requestMap: make(map[int64]struct{}), - mu: &sync.RWMutex{}, - } - c.mu.Unlock() - } - } else { - info.mu.RLock() - callParticipants, callParticipantMap := fn(info.participants, info.participantMap) - info.mu.RUnlock() - - info.mu.Lock() - info.participantMap = callParticipantMap - info.participants = callParticipants - info.mu.Unlock() - } + fn := func(callParticipants map[int32]*msg.CallParticipant, callParticipantMap map[int64]int32) (map[int32]*msg.CallParticipant, + map[int64]int32, + ) { + for _, participant := range participants { + callParticipants[participant.ConnectionId] = &msg.CallParticipant{ + PhoneParticipant: &msg.PhoneParticipant{ + ConnectionId: participant.ConnectionId, + Peer: participant.Peer, + Initiator: participant.Initiator, + Admin: participant.Admin, + }, + DeviceType: msg.CallDeviceType_CallDeviceUnknown, + MediaSettings: &msg.CallMediaSettings{ + Audio: true, + ScreenShare: false, + Video: true, + }, + Started: false, + Muted: false, + } + callParticipantMap[participant.Peer.UserID] = participant.ConnectionId + } + return callParticipants, callParticipantMap + } + + if info, ok := c.callInfo[callID]; !ok { + if bootstrap { + callParticipants, callParticipantMap := fn(make(map[int32]*msg.CallParticipant), make(map[int64]int32)) + c.mu.Lock() + c.callInfo[callID] = &Info{ + acceptedParticipantIds: nil, + acceptedParticipants: nil, + allConnected: false, + dialed: false, + mediaSettings: &msg.CallMediaSettings{ + Audio: false, + ScreenShare: false, + Video: false, + }, + participantMap: callParticipantMap, + participants: callParticipants, + requestParticipantIds: nil, + requests: nil, + iceServer: nil, + requestMap: make(map[int64]struct{}), + mu: &sync.RWMutex{}, + } + c.mu.Unlock() + } + } else { + info.mu.RLock() + callParticipants, callParticipantMap := fn(info.participants, info.participantMap) + info.mu.RUnlock() + + info.mu.Lock() + info.participantMap = callParticipantMap + info.participants = callParticipants + info.mu.Unlock() + } } func (c *call) initCallRequest(in *UpdatePhoneCall, sdpData *msg.PhoneActionRequested) { - info := c.getCallInfo(in.CallID) - if info != nil { - hasReq := false - info.mu.RLock() - for idx := range info.requestParticipantIds { - if info.requestParticipantIds[idx] == in.UserID { - hasReq = true - break - } - } - info.mu.RUnlock() - - if !hasReq { - info.mu.Lock() - info.requests = append(info.requests, in) - info.requestParticipantIds = append(info.requestParticipantIds, in.UserID) - info.mu.Unlock() - c.Log().Info("[webrtc] request from", zap.Int64("UserID", in.UserID)) - } - return - } - - c.Log().Info("[webrtc] request from", zap.Int64("UserID", in.UserID)) - callParticipants := make(map[int32]*msg.CallParticipant) - callParticipantMap := make(map[int64]int32) - for _, participant := range sdpData.Participants { - deviceType := msg.CallDeviceType_CallDeviceUnknown - if in.UserID == participant.Peer.UserID { - deviceType = sdpData.DeviceType - } - callParticipants[participant.ConnectionId] = &msg.CallParticipant{ - PhoneParticipant: &msg.PhoneParticipant{ - ConnectionId: participant.ConnectionId, - Peer: participant.Peer, - Initiator: participant.Initiator, - Admin: participant.Admin, - }, - DeviceType: deviceType, - MediaSettings: &msg.CallMediaSettings{ - Audio: true, - ScreenShare: false, - Video: true, - }, - Started: false, - Muted: false, - } - callParticipantMap[participant.Peer.UserID] = participant.ConnectionId - } - - c.mu.Lock() - c.callInfo[in.CallID] = &Info{ - acceptedParticipantIds: nil, - acceptedParticipants: nil, - allConnected: false, - dialed: false, - mediaSettings: &msg.CallMediaSettings{ - Audio: false, - ScreenShare: false, - Video: false, - }, - participantMap: callParticipantMap, - participants: callParticipants, - requestParticipantIds: []int64{in.UserID}, - requests: []*UpdatePhoneCall{in}, - iceServer: nil, - requestMap: make(map[int64]struct{}), - mu: &sync.RWMutex{}, - } - c.mu.Unlock() -} - -func (c *call) initManyConnections(peer *msg.InputPeer, callID int64, initiator, video bool, request *UpdatePhoneCall) (res *msg.PhoneCall, err error) { - currentUserConnId, callInfo, valid := c.getConnId(callID, c.userID) - if !valid { - err = ErrInvalidCallID - return - } - - wg := &sync.WaitGroup{} - mu := &sync.RWMutex{} - - var callResults []*msg.PhoneParticipantSDP - var acceptResults []*msg.PhoneCall - - sdp := &msg.PhoneActionSDPOffer{} - requestConnId := int32(-1024) - - initAnswerConnection := func(connId int32) (res *msg.PhoneCall, innerErr error) { - sdpOffer, innerErr := c.initConnection(true, connId, sdp) - if innerErr != nil { - return - } - - callInfo.mu.RLock() - p := callInfo.participants[connId] - callInfo.mu.RUnlock() - phoneParticipant := &msg.PhoneParticipantSDP{ - ConnectionId: p.PhoneParticipant.ConnectionId, - Peer: p.PhoneParticipant.Peer, - SDP: sdpOffer.SDP, - Type: sdpOffer.Type, - } - - c.Log().Info("Execute Accept", zap.Int64("PeerID", peer.ID), zap.Int64("ParticipantUserID", p.PhoneParticipant.Peer.UserID)) - res, innerErr = c.apiAccept(peer, callID, []*msg.PhoneParticipantSDP{phoneParticipant}) - return - } - - if request != nil { - sdpData := request.Data.(*msg.PhoneActionRequested) - sdp.SDP = sdpData.SDP - sdp.Type = sdpData.Type - requestConnId, _, valid = c.getConnId(callID, request.UserID) - if valid && callInfo.dialed { - return initAnswerConnection(requestConnId) - } - } - - shouldCall := !callInfo.dialed - if shouldCall { - c.setCallInfoDialed(callID) - } - - for _, participant := range callInfo.participants { - // Initialize connections only for greater connId, - // full mesh initialization will take place here - if requestConnId == participant.PhoneParticipant.ConnectionId { - wg.Add(1) - go func() { - phoneCall, innerErr := initAnswerConnection(requestConnId) - if innerErr == nil { - mu.Lock() - acceptResults = append(acceptResults, phoneCall) - mu.Unlock() - } else { - c.Log().Debug("initAnswerConnection", zap.Error(innerErr)) - } - wg.Done() - }() - } else if shouldCall && currentUserConnId < participant.PhoneParticipant.ConnectionId { - wg.Add(1) - go func(pConnId int32) { - sdpRes, innerErr := c.initConnection(false, pConnId, nil) - if innerErr == nil { - mu.Lock() - if participant, ok := callInfo.participants[pConnId]; ok { - callResults = append(callResults, &msg.PhoneParticipantSDP{ - ConnectionId: participant.PhoneParticipant.ConnectionId, - Peer: participant.PhoneParticipant.Peer, - SDP: sdpRes.SDP, - Type: sdpRes.Type, - }) - } - mu.Unlock() - } - wg.Done() - }(participant.PhoneParticipant.ConnectionId) - } - } - - wg.Wait() - - if len(callResults) > 0 { - for _, participantSDP := range callResults { - // retry each connection - if pc, ok := c.peerConnections[participantSDP.ConnectionId]; ok { - pc.connectTicker = time.NewTicker(time.Duration(RetryInterval) * time.Second) - go func(participant *msg.PhoneParticipantSDP) { - select { - case <-pc.connectTicker.C: - if pc, ok := c.peerConnections[participant.ConnectionId]; ok { - pc.mu.Lock() - pc.Try++ - pc.mu.Unlock() - _, innerErr := c.callUserSingle(peer, participant, c.activeCallID, video) - if innerErr != nil { - c.Log().WarnOnErr("callUserSingle", innerErr) - } - if pc.Try >= RetryLimit { - if pc.connectTicker != nil { - pc.connectTicker.Stop() - } - if initiator { - c.checkCallTimeout(participant.ConnectionId) - } - } - } - } - }(participantSDP) - } - } - _, err = c.callUser(peer, initiator, callResults, c.activeCallID, video) - if err != nil { - c.Log().WarnOnErr("callUser", err) - } - } - return + info := c.getCallInfo(in.CallID) + if info != nil { + hasReq := false + info.mu.RLock() + for idx := range info.requestParticipantIds { + if info.requestParticipantIds[idx] == in.UserID { + hasReq = true + break + } + } + info.mu.RUnlock() + + if !hasReq { + info.mu.Lock() + info.requests = append(info.requests, in) + info.requestParticipantIds = append(info.requestParticipantIds, in.UserID) + info.mu.Unlock() + c.Log().Info("[webrtc] request from", zap.Int64("UserID", in.UserID)) + } + return + } + + c.Log().Info("[webrtc] request from", zap.Int64("UserID", in.UserID)) + callParticipants := make(map[int32]*msg.CallParticipant) + callParticipantMap := make(map[int64]int32) + for _, participant := range sdpData.Participants { + deviceType := msg.CallDeviceType_CallDeviceUnknown + if in.UserID == participant.Peer.UserID { + deviceType = sdpData.DeviceType + } + callParticipants[participant.ConnectionId] = &msg.CallParticipant{ + PhoneParticipant: &msg.PhoneParticipant{ + ConnectionId: participant.ConnectionId, + Peer: participant.Peer, + Initiator: participant.Initiator, + Admin: participant.Admin, + }, + DeviceType: deviceType, + MediaSettings: &msg.CallMediaSettings{ + Audio: true, + ScreenShare: false, + Video: true, + }, + Started: false, + Muted: false, + } + callParticipantMap[participant.Peer.UserID] = participant.ConnectionId + } + + c.mu.Lock() + c.callInfo[in.CallID] = &Info{ + acceptedParticipantIds: nil, + acceptedParticipants: nil, + allConnected: false, + dialed: false, + mediaSettings: &msg.CallMediaSettings{ + Audio: false, + ScreenShare: false, + Video: false, + }, + participantMap: callParticipantMap, + participants: callParticipants, + requestParticipantIds: []int64{in.UserID}, + requests: []*UpdatePhoneCall{in}, + iceServer: nil, + requestMap: make(map[int64]struct{}), + mu: &sync.RWMutex{}, + } + c.mu.Unlock() +} + +func (c *call) initManyConnections(peer *msg.InputPeer, callID int64, initiator, video bool, request *UpdatePhoneCall) (res *msg.PhoneCall, + err error, +) { + currentUserConnId, callInfo, valid := c.getConnId(callID, c.userID) + if !valid { + err = ErrInvalidCallID + return + } + + wg := &sync.WaitGroup{} + mu := &sync.RWMutex{} + + var callResults []*msg.PhoneParticipantSDP + var acceptResults []*msg.PhoneCall + + sdp := &msg.PhoneActionSDPOffer{} + requestConnId := int32(-1024) + + initAnswerConnection := func(connId int32) (res *msg.PhoneCall, innerErr error) { + sdpOffer, innerErr := c.initConnection(true, connId, sdp) + if innerErr != nil { + return + } + + callInfo.mu.RLock() + p := callInfo.participants[connId] + callInfo.mu.RUnlock() + phoneParticipant := &msg.PhoneParticipantSDP{ + ConnectionId: p.PhoneParticipant.ConnectionId, + Peer: p.PhoneParticipant.Peer, + SDP: sdpOffer.SDP, + Type: sdpOffer.Type, + } + + c.Log().Info("Execute Accept", zap.Int64("PeerID", peer.ID), zap.Int64("ParticipantUserID", p.PhoneParticipant.Peer.UserID)) + res, innerErr = c.apiAccept(peer, callID, []*msg.PhoneParticipantSDP{phoneParticipant}) + return + } + + if request != nil { + sdpData := request.Data.(*msg.PhoneActionRequested) + sdp.SDP = sdpData.SDP + sdp.Type = sdpData.Type + requestConnId, _, valid = c.getConnId(callID, request.UserID) + if valid && callInfo.dialed { + return initAnswerConnection(requestConnId) + } + } + + shouldCall := !callInfo.dialed + if shouldCall { + c.setCallInfoDialed(callID) + } + + for _, participant := range callInfo.participants { + // Initialize connections only for greater connId, + // full mesh initialization will take place here + if requestConnId == participant.PhoneParticipant.ConnectionId { + wg.Add(1) + go func() { + phoneCall, innerErr := initAnswerConnection(requestConnId) + if innerErr == nil { + mu.Lock() + acceptResults = append(acceptResults, phoneCall) + mu.Unlock() + } else { + c.Log().Debug("initAnswerConnection", zap.Error(innerErr)) + } + wg.Done() + }() + } else if shouldCall && currentUserConnId < participant.PhoneParticipant.ConnectionId { + wg.Add(1) + go func(pConnId int32) { + sdpRes, innerErr := c.initConnection(false, pConnId, nil) + if innerErr == nil { + mu.Lock() + if participant, ok := callInfo.participants[pConnId]; ok { + callResults = append(callResults, &msg.PhoneParticipantSDP{ + ConnectionId: participant.PhoneParticipant.ConnectionId, + Peer: participant.PhoneParticipant.Peer, + SDP: sdpRes.SDP, + Type: sdpRes.Type, + }) + } + mu.Unlock() + } + wg.Done() + }(participant.PhoneParticipant.ConnectionId) + } + } + + wg.Wait() + + if len(callResults) > 0 { + for _, participantSDP := range callResults { + // retry each connection + if pc, ok := c.peerConnections[participantSDP.ConnectionId]; ok { + pc.connectTicker = time.NewTicker(time.Duration(RetryInterval) * time.Second) + go func(participant *msg.PhoneParticipantSDP) { + select { + case <-pc.connectTicker.C: + if pc, ok := c.peerConnections[participant.ConnectionId]; ok { + pc.mu.Lock() + pc.Try++ + pc.mu.Unlock() + _, innerErr := c.callUserSingle(peer, participant, c.activeCallID, video) + if innerErr != nil { + c.Log().WarnOnErr("callUserSingle", innerErr) + } + if pc.Try >= RetryLimit { + if pc.connectTicker != nil { + pc.connectTicker.Stop() + } + if initiator { + c.checkCallTimeout(participant.ConnectionId) + } + } + } + } + }(participantSDP) + } + } + _, err = c.callUser(peer, initiator, callResults, c.activeCallID, video) + if err != nil { + c.Log().WarnOnErr("callUser", err) + } + } + return } func (c *call) initConnection(remote bool, connId int32, sdp *msg.PhoneActionSDPOffer) (sdpAnswer *msg.PhoneActionSDPAnswer, err error) { - c.Log().Debug("[webrtc] init connection", zap.Int32("connId", connId)) - // Client should check local stream - // otherwise panic - - // Use MediaSteam to mix video and audio track - // You can use main MediaStream if no shared screen media is present - - iceServer := c.iceServer - if pc, ok := c.peerConnections[connId]; ok { - iceServer = pc.IceServers - } - - // Client should initiate RTCPeerConnection with given server config - callInitReq := &msg.PhoneInit{ - IceServers: iceServer, - } - - rtcConnId := c.CallbackInitConnection(connId, callInitReq) - if rtcConnId == -1 { - err = ErrCannotInitConnection - return - } - - conn := &Connection{ - CallConnection: msg.CallConnection{ - Accepted: remote, - ConnId: connId, - RTCPeerConnectionID: rtcConnId, - IceConnectionState: "", - IceQueue: nil, - IceServers: nil, - Init: false, - Reconnecting: false, - ReconnectingTry: 0, - ScreenShareStreamID: 0, - StreamID: "", - IntervalID: 0, - Try: 0, - }, - mu: &sync.RWMutex{}, - connectTicker: nil, - reconnectTimout: nil, - } - - conn.RTCPeerConnectionID = rtcConnId - if pc, ok := c.peerConnections[connId]; !ok { - c.peerConnections[connId] = conn - } else { - conn = pc - conn.RTCPeerConnectionID = rtcConnId - } - - if remote { - if sdp != nil { - // Client should setRemoteDescription(sdp) - // Client should create answer - // Client should setLocalDescription and pass it to SDK - offerSDP := &msg.PhoneActionSDPOffer{ - SDP: sdp.SDP, - Type: sdp.Type, - } - - sdpAnswer, err = c.CallbackSetOfferGetAnswerSDP(connId, offerSDP) - if err != nil { - return - } - } else { - err = ErrNoSDP - return - } - } else { - // Client should create offer - // Client should setLocalDescription and pass the offer to SDK - var sdpOffer *msg.PhoneActionSDPOffer - sdpOffer, err = c.CallbackGetOfferSDP(connId) - if err != nil { - return - } - - sdpAnswer = &msg.PhoneActionSDPAnswer{ - SDP: sdpOffer.SDP, - Type: sdpOffer.Type, - } - } - return -} - -func (c *call) callUser(peer *msg.InputPeer, initiator bool, phoneParticipants []*msg.PhoneParticipantSDP, callID int64, video bool) (res *msg.PhoneCall, err error) { - randomID := domain.RandomInt64(0) - res, err = c.apiRequest(peer, randomID, initiator, phoneParticipants, callID, video, false) - if err == nil && callID == 0 { - c.mu.Lock() - c.activeCallID = res.ID - c.mu.Unlock() - } - return -} - -func (c *call) callUserSingle(peer *msg.InputPeer, phoneParticipant *msg.PhoneParticipantSDP, callID int64, video bool) (res *msg.PhoneCall, err error) { - randomID := domain.RandomInt64(0) - res, err = c.apiRequest(peer, randomID, false, []*msg.PhoneParticipantSDP{phoneParticipant}, callID, video, false) - return + c.Log().Debug("[webrtc] init connection", zap.Int32("connId", connId)) + // Client should check local stream + // otherwise panic + + // Use MediaSteam to mix video and audio track + // You can use main MediaStream if no shared screen media is present + + iceServer := c.iceServer + if pc, ok := c.peerConnections[connId]; ok { + iceServer = pc.IceServers + } + + // Client should initiate RTCPeerConnection with given server config + callInitReq := &msg.PhoneInit{ + IceServers: iceServer, + } + + rtcConnId := c.CallbackInitConnection(connId, callInitReq) + if rtcConnId == -1 { + err = ErrCannotInitConnection + return + } + + conn := &Connection{ + CallConnection: msg.CallConnection{ + Accepted: remote, + ConnId: connId, + RTCPeerConnectionID: rtcConnId, + IceConnectionState: "", + IceQueue: nil, + IceServers: nil, + Init: false, + Reconnecting: false, + ReconnectingTry: 0, + ScreenShareStreamID: 0, + StreamID: "", + IntervalID: 0, + Try: 0, + }, + mu: &sync.RWMutex{}, + connectTicker: nil, + reconnectTimout: nil, + } + + conn.RTCPeerConnectionID = rtcConnId + if pc, ok := c.peerConnections[connId]; !ok { + c.peerConnections[connId] = conn + } else { + conn = pc + conn.RTCPeerConnectionID = rtcConnId + } + + if remote { + if sdp != nil { + // Client should setRemoteDescription(sdp) + // Client should create answer + // Client should setLocalDescription and pass it to SDK + offerSDP := &msg.PhoneActionSDPOffer{ + SDP: sdp.SDP, + Type: sdp.Type, + } + + sdpAnswer, err = c.CallbackSetOfferGetAnswerSDP(connId, offerSDP) + if err != nil { + return + } + } else { + err = ErrNoSDP + return + } + } else { + // Client should create offer + // Client should setLocalDescription and pass the offer to SDK + var sdpOffer *msg.PhoneActionSDPOffer + sdpOffer, err = c.CallbackGetOfferSDP(connId) + if err != nil { + return + } + + sdpAnswer = &msg.PhoneActionSDPAnswer{ + SDP: sdpOffer.SDP, + Type: sdpOffer.Type, + } + } + return +} + +func (c *call) callUser( + peer *msg.InputPeer, initiator bool, phoneParticipants []*msg.PhoneParticipantSDP, callID int64, video bool, +) (res *msg.PhoneCall, err error) { + randomID := domain.RandomInt64(0) + res, err = c.apiRequest(peer, randomID, initiator, phoneParticipants, callID, video, false) + if err == nil && callID == 0 { + c.mu.Lock() + c.activeCallID = res.ID + c.mu.Unlock() + } + return +} + +func (c *call) callUserSingle(peer *msg.InputPeer, phoneParticipant *msg.PhoneParticipantSDP, callID int64, video bool) (res *msg.PhoneCall, + err error, +) { + randomID := domain.RandomInt64(0) + res, err = c.apiRequest(peer, randomID, false, []*msg.PhoneParticipantSDP{phoneParticipant}, callID, video, false) + return } func (c *call) sendIceCandidate(callID int64, connId int32, candidate *msg.CallRTCIceCandidate) (err error) { - if candidate == nil { - return nil - } - - conn, hasConn := c.peerConnections[connId] - if !hasConn { - err = ErrInvalidConnId - return - } - - if !conn.Accepted { - conn.IceQueue = append(conn.IceQueue, candidate) - return - } - - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } - - if c.peer == nil { - err = ErrInvalidPeerInput - return - } - - inputUser := c.getInputUserByConnId(callID, connId) - if inputUser == nil { - err = ErrInvalidConnId - return - } - - action := &msg.PhoneActionIceExchange{ - Candidate: candidate.Candidate, - SdpMLineIndex: candidate.SdpMLineIndex, - SdpMid: candidate.SdpMid, - UsernameFragment: candidate.UsernameFragment, - } - - actionData, err := action.Marshal() - if err != nil { - return - } - - _, err = c.apiSendUpdate(c.peer, callID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallIceExchange, actionData, false) - return + if candidate == nil { + return nil + } + + conn, hasConn := c.peerConnections[connId] + if !hasConn { + err = ErrInvalidConnId + return + } + + if !conn.Accepted { + conn.IceQueue = append(conn.IceQueue, candidate) + return + } + + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } + + if c.peer == nil { + err = ErrInvalidPeerInput + return + } + + inputUser := c.getInputUserByConnId(callID, connId) + if inputUser == nil { + err = ErrInvalidConnId + return + } + + action := &msg.PhoneActionIceExchange{ + Candidate: candidate.Candidate, + SdpMLineIndex: candidate.SdpMLineIndex, + SdpMid: candidate.SdpMid, + UsernameFragment: candidate.UsernameFragment, + } + + actionData, err := action.Marshal() + if err != nil { + return + } + + _, err = c.apiSendUpdate(c.peer, callID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallIceExchange, actionData, false) + return } func (c *call) flushIceCandidates(callID int64, connId int32) { - c.mu.RLock() - conn, ok := c.peerConnections[connId] - c.mu.RUnlock() + c.mu.RLock() + conn, ok := c.peerConnections[connId] + c.mu.RUnlock() - if !ok { - return - } + if !ok { + return + } - for _, candidate := range conn.IceQueue { - go func(ic *msg.CallRTCIceCandidate) { - _ = c.sendIceCandidate(callID, connId, ic) - }(candidate) - } + for _, candidate := range conn.IceQueue { + go func(ic *msg.CallRTCIceCandidate) { + _ = c.sendIceCandidate(callID, connId, ic) + }(candidate) + } } func (c *call) modifyMediaStream(video bool) (err error) { - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } - if c.callback.InitStream == nil { - err = ErrCallbacksAreNotInitialized - return - } + if c.callback.InitStream == nil { + err = ErrCallbacksAreNotInitialized + return + } - ok := c.callback.InitStream(true, video) - if !ok { - err = ErrCannotInitStream - return - } + ok := c.callback.InitStream(true, video) + if !ok { + err = ErrCannotInitStream + return + } - _ = c.upgradeConnection(video) - c.propagateMediaSettings(MediaSettingsIn{ - Video: &video, - }, false) - return + _ = c.upgradeConnection(video) + c.propagateMediaSettings(MediaSettingsIn{ + Video: &video, + }, false) + return } func (c *call) upgradeConnection(video bool) (err error) { - if c.activeCallID == 0 { - return - } - - if c.callback.InitStream == nil { - err = ErrCallbacksAreNotInitialized - return - } - - ok := c.callback.InitStream(true, video) - if !ok { - err = ErrCannotInitStream - return - } - - var connIds []int32 - c.mu.RLock() - for _, pc := range c.peerConnections { - if pc.IceConnectionState == "connected" || pc.IceConnectionState == "completed" { - connIds = append(connIds, pc.ConnId) - } - } - c.mu.RUnlock() - - if len(connIds) == 0 { - return - } - - wg := sync.WaitGroup{} - for _, connId := range connIds { - wg.Add(1) - go func(cid int32) { - offerSDP, innerErr := c.CallbackGetOfferSDP(cid) - if innerErr != nil { - return - } - - c.sendSdpOffer(cid, offerSDP) - wg.Done() - }(connId) - } - - wg.Wait() - return + if c.activeCallID == 0 { + return + } + + if c.callback.InitStream == nil { + err = ErrCallbacksAreNotInitialized + return + } + + ok := c.callback.InitStream(true, video) + if !ok { + err = ErrCannotInitStream + return + } + + var connIds []int32 + c.mu.RLock() + for _, pc := range c.peerConnections { + if pc.IceConnectionState == "connected" || pc.IceConnectionState == "completed" { + connIds = append(connIds, pc.ConnId) + } + } + c.mu.RUnlock() + + if len(connIds) == 0 { + return + } + + wg := sync.WaitGroup{} + for _, connId := range connIds { + wg.Add(1) + go func(cid int32) { + offerSDP, innerErr := c.CallbackGetOfferSDP(cid) + if innerErr != nil { + return + } + + c.sendSdpOffer(cid, offerSDP) + wg.Done() + }(connId) + } + + wg.Wait() + return } func (c *call) propagateMediaSettings(in MediaSettingsIn, force bool) { - if c.activeCallID == 0 { - return - } - - if c.peer == nil { - return - } - - info := c.getCallInfo(c.activeCallID) - if info == nil { - return - } - - shouldPropagate := force - if in.Audio != nil { - if info.mediaSettings.Audio != *in.Audio { - shouldPropagate = true - } - info.mediaSettings.Audio = *in.Audio - } - - if in.Video != nil { - if info.mediaSettings.Video != *in.Video { - shouldPropagate = true - } - info.mediaSettings.Video = *in.Video - } - - if in.ScreenShare != nil { - if info.mediaSettings.ScreenShare != *in.ScreenShare { - shouldPropagate = true - } - info.mediaSettings.ScreenShare = *in.ScreenShare - } - - if !shouldPropagate { - return - } - - update := msg.CallUpdateLocalMediaSettingsUpdated{ - MediaSettings: &msg.CallMediaSettings{ - Video: info.mediaSettings.Video, - Audio: info.mediaSettings.Audio, - ScreenShare: info.mediaSettings.ScreenShare, - }, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_LocalMediaSettingsUpdated, updateData) - } - - action := &msg.PhoneActionMediaSettingsUpdated{ - Video: info.mediaSettings.Video, - Audio: info.mediaSettings.Audio, - ScreenShare: info.mediaSettings.ScreenShare, - } - actionData, err := action.Marshal() - if err != nil { - return - } - - inputUsers := c.getInputUsers(c.activeCallID) - _, err = c.apiSendUpdate(c.peer, c.activeCallID, inputUsers, msg.PhoneCallAction_PhoneCallMediaSettingsChanged, actionData, false) - if err != nil { - c.Log().Info("apiSendUpdate, PhoneCallAction_PhoneCallMediaSettingsChanged", zap.Error(err)) - } + if c.activeCallID == 0 { + return + } + + if c.peer == nil { + return + } + + info := c.getCallInfo(c.activeCallID) + if info == nil { + return + } + + shouldPropagate := force + if in.Audio != nil { + if info.mediaSettings.Audio != *in.Audio { + shouldPropagate = true + } + info.mediaSettings.Audio = *in.Audio + } + + if in.Video != nil { + if info.mediaSettings.Video != *in.Video { + shouldPropagate = true + } + info.mediaSettings.Video = *in.Video + } + + if in.ScreenShare != nil { + if info.mediaSettings.ScreenShare != *in.ScreenShare { + shouldPropagate = true + } + info.mediaSettings.ScreenShare = *in.ScreenShare + } + + if !shouldPropagate { + return + } + + update := msg.CallUpdateLocalMediaSettingsUpdated{ + MediaSettings: &msg.CallMediaSettings{ + Video: info.mediaSettings.Video, + Audio: info.mediaSettings.Audio, + ScreenShare: info.mediaSettings.ScreenShare, + }, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_LocalMediaSettingsUpdated, updateData) + } + + action := &msg.PhoneActionMediaSettingsUpdated{ + Video: info.mediaSettings.Video, + Audio: info.mediaSettings.Audio, + ScreenShare: info.mediaSettings.ScreenShare, + } + actionData, err := action.Marshal() + if err != nil { + return + } + + inputUsers := c.getInputUsers(c.activeCallID) + _, err = c.apiSendUpdate(c.peer, c.activeCallID, inputUsers, msg.PhoneCallAction_PhoneCallMediaSettingsChanged, actionData, false) + if err != nil { + c.Log().Info("apiSendUpdate, PhoneCallAction_PhoneCallMediaSettingsChanged", zap.Error(err)) + } } func (c *call) mediaSettingsInit(in *msg.CallMediaSettings) { - if c.activeCallID == 0 { - return - } - - connId, info, valid := c.getConnId(c.activeCallID, c.userID) - if !valid { - return - } - - info.mu.Lock() - info.participants[connId].MediaSettings.Audio = in.Audio - info.participants[connId].MediaSettings.Video = in.Video - info.participants[connId].MediaSettings.ScreenShare = in.ScreenShare - info.mu.Unlock() - - update := msg.CallUpdateMediaSettingsUpdated{ - ConnectionID: connId, - MediaSettings: &msg.CallMediaSettings{ - Video: in.Video, - Audio: in.Audio, - ScreenShare: in.ScreenShare, - }, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_MediaSettingsUpdated, updateData) - } + if c.activeCallID == 0 { + return + } + + connId, info, valid := c.getConnId(c.activeCallID, c.userID) + if !valid { + return + } + + info.mu.Lock() + info.participants[connId].MediaSettings.Audio = in.Audio + info.participants[connId].MediaSettings.Video = in.Video + info.participants[connId].MediaSettings.ScreenShare = in.ScreenShare + info.mu.Unlock() + + update := msg.CallUpdateMediaSettingsUpdated{ + ConnectionID: connId, + MediaSettings: &msg.CallMediaSettings{ + Video: in.Video, + Audio: in.Audio, + ScreenShare: in.ScreenShare, + }, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_MediaSettingsUpdated, updateData) + } } func (c *call) checkAllConnected() { - if c.activeCallID == 0 { - return - } - if info, ok := c.callInfo[c.activeCallID]; ok { - if info.allConnected { - return - } - - for _, pc := range c.peerConnections { - if !(pc.IceConnectionState == "connected" || pc.IceConnectionState == "completed") { - return - } - } - - c.callInfo[c.activeCallID].allConnected = true - time.AfterFunc(time.Duration(255)*time.Millisecond, func() { - update := msg.CallUpdateAllConnected{} - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_AllConnected, updateData) - } - }) - } + if c.activeCallID == 0 { + return + } + if info, ok := c.callInfo[c.activeCallID]; ok { + if info.allConnected { + return + } + + for _, pc := range c.peerConnections { + if !(pc.IceConnectionState == "connected" || pc.IceConnectionState == "completed") { + return + } + } + + c.callInfo[c.activeCallID].allConnected = true + time.AfterFunc(time.Duration(255)*time.Millisecond, func() { + update := msg.CallUpdateAllConnected{} + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_AllConnected, updateData) + } + }) + } } func (c *call) checkDisconnection(connId int32, state string, isIceError bool) (err error) { - if c.activeCallID == 0 { - return - } - - conn, hasConn := c.peerConnections[connId] - if !hasConn { - return - } - - if !conn.Reconnecting && - ((isIceError && c.peerConnections[connId].Init && (state == "disconnected" || state == "failed" || state == "closed")) || - state == "disconnected") { - if c.callback.CloseConnection == nil { - err = ErrCallbacksAreNotInitialized - return - } - - ok := c.callback.CloseConnection(connId) - if !ok { - err = ErrCannotCloseConnection - return - } - - conn.mu.Lock() - conn.IceQueue = nil - conn.Reconnecting = true - conn.ReconnectingTry++ - if conn.ReconnectingTry <= ReconnectTry { - conn.reconnectTimout = time.AfterFunc(time.Duration(ReconnectTimeout)*time.Second, func() { - if _, ok := c.peerConnections[connId]; ok { - c.peerConnections[connId].Reconnecting = false - } - }) - } - conn.mu.Unlock() - - update := msg.CallUpdateConnectionStatusChanged{ - ConnectionID: connId, - State: "reconnecting", - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_ConnectionStatusChanged, updateData) - } - - c.changeStatus(connId, msg.CallStatus_Reconnecting) - - var initRes *msg.PhoneInit - initRes, err = c.apiInit(c.peer, c.activeCallID) - if err != nil { - return - } - - _, hasConn = c.peerConnections[connId] - if !hasConn { - return - } - - conn.mu.Lock() - conn.IceServers = initRes.IceServers - conn.mu.Unlock() - currentConnId, _, valid := c.getConnId(c.activeCallID, c.userID) - if !valid { - err = ErrInvalidCallID - return - } - - if currentConnId < connId { - _ = c.callSendRestart(connId, true) - } else { - _, _ = c.initConnection(true, connId, nil) - } - } - - return + if c.activeCallID == 0 { + return + } + + conn, hasConn := c.peerConnections[connId] + if !hasConn { + return + } + + if !conn.Reconnecting && + ((isIceError && c.peerConnections[connId].Init && (state == "disconnected" || state == "failed" || state == "closed")) || + state == "disconnected") { + if c.callback.CloseConnection == nil { + err = ErrCallbacksAreNotInitialized + return + } + + ok := c.callback.CloseConnection(connId) + if !ok { + err = ErrCannotCloseConnection + return + } + + conn.mu.Lock() + conn.IceQueue = nil + conn.Reconnecting = true + conn.ReconnectingTry++ + if conn.ReconnectingTry <= ReconnectTry { + conn.reconnectTimout = time.AfterFunc(time.Duration(ReconnectTimeout)*time.Second, func() { + if _, ok := c.peerConnections[connId]; ok { + c.peerConnections[connId].Reconnecting = false + } + }) + } + conn.mu.Unlock() + + update := msg.CallUpdateConnectionStatusChanged{ + ConnectionID: connId, + State: "reconnecting", + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_ConnectionStatusChanged, updateData) + } + + c.changeStatus(connId, msg.CallStatus_Reconnecting) + + var initRes *msg.PhoneInit + initRes, err = c.apiInit(c.peer, c.activeCallID) + if err != nil { + return + } + + _, hasConn = c.peerConnections[connId] + if !hasConn { + return + } + + conn.mu.Lock() + conn.IceServers = initRes.IceServers + conn.mu.Unlock() + currentConnId, _, valid := c.getConnId(c.activeCallID, c.userID) + if !valid { + err = ErrInvalidCallID + return + } + + if currentConnId < connId { + _ = c.callSendRestart(connId, true) + } else { + _, _ = c.initConnection(true, connId, nil) + } + } + + return } func (c *call) callSendRestart(connId int32, sender bool) (err error) { - if c.activeCallID == 0 { - err = ErrNoActiveCall - return - } + if c.activeCallID == 0 { + err = ErrNoActiveCall + return + } - _, hasConn := c.peerConnections[connId] - if !hasConn { - err = ErrInvalidConnId - return - } + _, hasConn := c.peerConnections[connId] + if !hasConn { + err = ErrInvalidConnId + return + } - if c.peer == nil { - err = ErrInvalidPeerInput - return - } + if c.peer == nil { + err = ErrInvalidPeerInput + return + } - inputUser := c.getInputUserByConnId(c.activeCallID, connId) - if inputUser == nil { - err = ErrInvalidConnId - return - } + inputUser := c.getInputUserByConnId(c.activeCallID, connId) + if inputUser == nil { + err = ErrInvalidConnId + return + } - action := &msg.PhoneActionRestarted{ - Sender: sender, - } + action := &msg.PhoneActionRestarted{ + Sender: sender, + } - actionData, err := action.Marshal() - if err != nil { - return - } + actionData, err := action.Marshal() + if err != nil { + return + } - _, err = c.apiSendUpdate(c.peer, c.activeCallID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallRestarted, actionData, true) - return + _, err = c.apiSendUpdate(c.peer, c.activeCallID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallRestarted, actionData, true) + return } func (c *call) getCallInfo(callID int64) *Info { - c.mu.RLock() - info := c.callInfo[callID] - c.mu.RUnlock() - return info + c.mu.RLock() + info := c.callInfo[callID] + c.mu.RUnlock() + return info } func (c *call) getConnId(callID, userID int64) (int32, *Info, bool) { - info := c.getCallInfo(callID) - if info == nil { - return 0, nil, false - } + info := c.getCallInfo(callID) + if info == nil { + return 0, nil, false + } - info.mu.RLock() - connId := info.participantMap[userID] - info.mu.RUnlock() - return connId, info, true + info.mu.RLock() + connId := info.participantMap[userID] + info.mu.RUnlock() + return connId, info, true } func (c *call) getUserIDbyCallID(callID int64, connID int32) *int64 { - info := c.getCallInfo(callID) - if info == nil { - return nil - } + info := c.getCallInfo(callID) + if info == nil { + return nil + } - info.mu.RUnlock() - d, ok := info.participants[connID] - info.mu.RUnlock() - if ok { - return &d.PhoneParticipant.Peer.UserID - } else { - return nil - } + info.mu.RUnlock() + d, ok := info.participants[connID] + info.mu.RUnlock() + if ok { + return &d.PhoneParticipant.Peer.UserID + } else { + return nil + } } func (c *call) getInputUserByConnId(callID int64, connID int32) (inputUser *msg.InputUser) { - info := c.getCallInfo(callID) - if info == nil { - return nil - } + info := c.getCallInfo(callID) + if info == nil { + return nil + } - info.mu.RLock() - d, ok := info.participants[connID] - info.mu.RUnlock() - if ok { - inputUser = d.PhoneParticipant.Peer - } - return + info.mu.RLock() + d, ok := info.participants[connID] + info.mu.RUnlock() + if ok { + inputUser = d.PhoneParticipant.Peer + } + return } func (c *call) getInputUserByUserIDs(callID int64, userIDs []int64) (inputUser []*msg.InputUser) { - info := c.getCallInfo(callID) - if info == nil { - return nil - } - - inputUser = make([]*msg.InputUser, 0, len(userIDs)) - info.mu.RLock() - for _, userID := range userIDs { - if connId, ok := info.participantMap[userID]; ok { - if participant, ok := info.participants[connId]; ok { - inputUser = append(inputUser, participant.PhoneParticipant.Peer) - } - } - } - info.mu.RUnlock() - return + info := c.getCallInfo(callID) + if info == nil { + return nil + } + + inputUser = make([]*msg.InputUser, 0, len(userIDs)) + info.mu.RLock() + for _, userID := range userIDs { + if connId, ok := info.participantMap[userID]; ok { + if participant, ok := info.participants[connId]; ok { + inputUser = append(inputUser, participant.PhoneParticipant.Peer) + } + } + } + info.mu.RUnlock() + return } func (c *call) getInputUsers(callID int64) (inputUser []*msg.InputUser) { - info := c.getCallInfo(callID) - if info == nil { - return nil - } + info := c.getCallInfo(callID) + if info == nil { + return nil + } - inputUser = make([]*msg.InputUser, 0, len(info.participants)) - info.mu.RLock() - for _, participant := range info.participants { - inputUser = append(inputUser, participant.PhoneParticipant.Peer) - } - info.mu.RUnlock() - return + inputUser = make([]*msg.InputUser, 0, len(info.participants)) + info.mu.RLock() + for _, participant := range info.participants { + inputUser = append(inputUser, participant.PhoneParticipant.Peer) + } + info.mu.RUnlock() + return } func (c *call) swapTempInfo(callID int64) { - info := c.getCallInfo(TempCallID) - if info == nil { - return - } + info := c.getCallInfo(TempCallID) + if info == nil { + return + } - c.mu.Lock() - c.callInfo[callID] = info - delete(c.callInfo, TempCallID) - c.mu.Unlock() + c.mu.Lock() + c.callInfo[callID] = info + delete(c.callInfo, TempCallID) + c.mu.Unlock() } func (c *call) setCallInfoDialed(callID int64) { - c.mu.Lock() - if _, ok := c.callInfo[callID]; ok { - c.callInfo[callID].dialed = true - } - c.mu.Unlock() + c.mu.Lock() + if _, ok := c.callInfo[callID]; ok { + c.callInfo[callID].dialed = true + } + c.mu.Unlock() } func (c *call) callBusy(in *UpdatePhoneCall) { - inputPeer := c.getInputUserFromUpdate(in) + inputPeer := c.getInputUserFromUpdate(in) - _, _ = c.apiReject(inputPeer, in.CallID, msg.DiscardReason_DiscardReasonBusy, 0) + _, _ = c.apiReject(inputPeer, in.CallID, msg.DiscardReason_DiscardReasonBusy, 0) } func (c *call) ack(callID int64) { - info := c.getCallInfo(callID) - if info == nil { - return - } - - wg := sync.WaitGroup{} - for _, req := range info.requests { - wg.Add(1) - go func(request *UpdatePhoneCall) { - c.sendCallAck(request) - wg.Done() - }(req) - } - wg.Wait() + info := c.getCallInfo(callID) + if info == nil { + return + } + + wg := sync.WaitGroup{} + for _, req := range info.requests { + wg.Add(1) + go func(request *UpdatePhoneCall) { + c.sendCallAck(request) + wg.Done() + }(req) + } + wg.Wait() } func (c *call) sendCallAck(in *UpdatePhoneCall) { - inputPeer := c.getInputUserFromUpdate(in) + inputPeer := c.getInputUserFromUpdate(in) - inputUser := &msg.InputUser{ - UserID: in.UserID, - AccessHash: in.AccessHash, - } + inputUser := &msg.InputUser{ + UserID: in.UserID, + AccessHash: in.AccessHash, + } - action := &msg.PhoneActionAck{} - actionData, err := action.Marshal() - if err != nil { - return - } + action := &msg.PhoneActionAck{} + actionData, err := action.Marshal() + if err != nil { + return + } - _, _ = c.apiSendUpdate(inputPeer, in.CallID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallAck, actionData, false) + _, _ = c.apiSendUpdate(inputPeer, in.CallID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallAck, actionData, false) } func (c *call) sendSdpAnswer(connId int32, sdp *msg.PhoneActionSDPAnswer) { - if c.activeCallID == 0 || c.peer == nil { - return - } + if c.activeCallID == 0 || c.peer == nil { + return + } - inputUser := c.getInputUserByConnId(c.activeCallID, connId) - actionData, err := sdp.Marshal() - if err != nil { - return - } + inputUser := c.getInputUserByConnId(c.activeCallID, connId) + actionData, err := sdp.Marshal() + if err != nil { + return + } - _, _ = c.apiSendUpdate(c.peer, c.activeCallID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallSDPAnswer, actionData, false) + _, _ = c.apiSendUpdate(c.peer, c.activeCallID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallSDPAnswer, actionData, false) } func (c *call) sendSdpOffer(connId int32, sdp *msg.PhoneActionSDPOffer) { - if c.activeCallID == 0 || c.peer == nil { - return - } + if c.activeCallID == 0 || c.peer == nil { + return + } - inputUser := c.getInputUserByConnId(c.activeCallID, connId) - actionData, err := sdp.Marshal() - if err != nil { - return - } + inputUser := c.getInputUserByConnId(c.activeCallID, connId) + actionData, err := sdp.Marshal() + if err != nil { + return + } - _, _ = c.apiSendUpdate(c.peer, c.activeCallID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallSDPOffer, actionData, false) + _, _ = c.apiSendUpdate(c.peer, c.activeCallID, []*msg.InputUser{inputUser}, msg.PhoneCallAction_PhoneCallSDPOffer, actionData, false) } func (c *call) getInputUserFromUpdate(in *UpdatePhoneCall) *msg.InputPeer { - inputPeer := &msg.InputPeer{ - ID: in.PeerID, - Type: msg.PeerType(in.PeerType), - } - if in.PeerType == int32(msg.PeerType_PeerGroup) { - inputPeer.AccessHash = 0 - } else { - inputPeer.AccessHash = in.AccessHash - } + inputPeer := &msg.InputPeer{ + ID: in.PeerID, + Type: msg.PeerType(in.PeerType), + } + if in.PeerType == int32(msg.PeerType_PeerGroup) { + inputPeer.AccessHash = 0 + } else { + inputPeer.AccessHash = in.AccessHash + } - return inputPeer + return inputPeer } func (c *call) clearRetryInterval(connId int32) { - c.mu.RLock() - pc, ok := c.peerConnections[connId] - c.mu.RUnlock() + c.mu.RLock() + pc, ok := c.peerConnections[connId] + c.mu.RUnlock() - if !ok { - return - } + if !ok { + return + } - if pc.connectTicker != nil { - pc.connectTicker.Stop() - } + if pc.connectTicker != nil { + pc.connectTicker.Stop() + } } func (c *call) appendToAcceptedList(connId int32) { - c.mu.Lock() - if info, ok := c.callInfo[c.activeCallID]; ok { - info.acceptedParticipants = append(info.acceptedParticipants, connId) - } - c.mu.Unlock() + c.mu.Lock() + if info, ok := c.callInfo[c.activeCallID]; ok { + info.acceptedParticipants = append(info.acceptedParticipants, connId) + } + c.mu.Unlock() } func (c *call) removeParticipant(userID int64, callID *int64) bool { - activeCallID := c.activeCallID - if callID != nil { - activeCallID = *callID - } - - if activeCallID == 0 { - return false - } - - connId, info, valid := c.getConnId(activeCallID, userID) - if !valid { - return false - } - - c.mu.RLock() - _, hasConn := c.peerConnections[connId] - c.mu.RUnlock() - if hasConn { - if c.callback.CloseConnection == nil { - return false - } - - _ = c.callback.CloseConnection(connId) - } - - info.mu.Lock() - for idx, id := range info.acceptedParticipantIds { - if id == userID { - info.acceptedParticipantIds = append(info.acceptedParticipantIds[:idx], info.acceptedParticipantIds[idx+1:]...) - break - } - } - - for idx, id := range info.requestParticipantIds { - if id == userID { - info.requestParticipantIds = append(info.requestParticipantIds[:idx], info.requestParticipantIds[idx+1:]...) - break - } - } - - for idx, request := range info.requests { - if request.UserID == userID { - info.requests = append(info.requests[:idx], info.requests[idx+1:]...) - break - } - } - - delete(info.participants, connId) - delete(info.participantMap, userID) - allRemoved := len(info.participants) <= 1 - info.mu.Unlock() - - return allRemoved + activeCallID := c.activeCallID + if callID != nil { + activeCallID = *callID + } + + if activeCallID == 0 { + return false + } + + connId, info, valid := c.getConnId(activeCallID, userID) + if !valid { + return false + } + + c.mu.RLock() + _, hasConn := c.peerConnections[connId] + c.mu.RUnlock() + if hasConn { + if c.callback.CloseConnection == nil { + return false + } + + _ = c.callback.CloseConnection(connId) + } + + info.mu.Lock() + for idx, id := range info.acceptedParticipantIds { + if id == userID { + info.acceptedParticipantIds = append(info.acceptedParticipantIds[:idx], info.acceptedParticipantIds[idx+1:]...) + break + } + } + + for idx, id := range info.requestParticipantIds { + if id == userID { + info.requestParticipantIds = append(info.requestParticipantIds[:idx], info.requestParticipantIds[idx+1:]...) + break + } + } + + for idx, request := range info.requests { + if request.UserID == userID { + info.requests = append(info.requests[:idx], info.requests[idx+1:]...) + break + } + } + + delete(info.participants, connId) + delete(info.participantMap, userID) + allRemoved := len(info.participants) <= 1 + info.mu.Unlock() + + return allRemoved } func (c *call) updateAdmin(userID int64, admin bool) { - if c.activeCallID == 0 { - return - } + if c.activeCallID == 0 { + return + } - connId, info, valid := c.getConnId(c.activeCallID, userID) - if !valid { - return - } + connId, info, valid := c.getConnId(c.activeCallID, userID) + if !valid { + return + } - info.mu.Lock() - info.participants[connId].PhoneParticipant.Admin = admin - info.mu.Unlock() + info.mu.Lock() + info.participants[connId].PhoneParticipant.Admin = admin + info.mu.Unlock() } func (c *call) shouldAccept(in *UpdatePhoneCall) bool { - if c.activeCallID == in.CallID { - return false - } - - if c.peer.GetType() == msg.PeerType_PeerUser { - return false - } - - if _, ok := c.callInfo[c.activeCallID]; !ok { - return false - } - - c.mu.RLock() - info, ok := c.callInfo[c.activeCallID] - c.mu.RUnlock() - - if !ok { - return false - } - - if ok { - info.mu.RLock() - defer info.mu.RUnlock() - for idx := range info.acceptedParticipantIds { - if info.acceptedParticipantIds[idx] == in.UserID { - return false - } - } - } - - info.mu.Lock() - info.acceptedParticipantIds = append(info.acceptedParticipantIds, in.UserID) - info.mu.Unlock() - return true + if c.activeCallID == in.CallID { + return false + } + + if c.peer.GetType() == msg.PeerType_PeerUser { + return false + } + + if _, ok := c.callInfo[c.activeCallID]; !ok { + return false + } + + c.mu.RLock() + info, ok := c.callInfo[c.activeCallID] + c.mu.RUnlock() + + if !ok { + return false + } + + if ok { + info.mu.RLock() + defer info.mu.RUnlock() + for idx := range info.acceptedParticipantIds { + if info.acceptedParticipantIds[idx] == in.UserID { + return false + } + } + } + + info.mu.Lock() + info.acceptedParticipantIds = append(info.acceptedParticipantIds, in.UserID) + info.mu.Unlock() + return true } func (c *call) callRequested(in *UpdatePhoneCall) { - data := in.Data.(*msg.PhoneActionRequested) - if c.activeCallID != 0 && c.activeCallID != in.CallID { - c.callBusy(in) - return - } - - if c.isCallRejected(in.CallID) { - return - } - - // (Disabled due to client state problem) - // Send ack update so callee ringing indicator activates - // c.sendCallAck(in) - if _, ok := c.callInfo[in.CallID]; !ok { - c.initCallRequest(in, data) - - c.mu.Lock() - c.peer = c.getInputUserFromUpdate(in) - c.mu.Unlock() - - update := msg.CallUpdateCallRequested{ - Peer: c.peer, - CallID: in.CallID, - Video: data.Video, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallRequested, updateData) - } - } else { - c.initCallRequest(in, data) - if c.shouldAccept(in) { - video := false - if streamState, err := c.getMediaSettings(); err == nil { - video = streamState.Video - } - _ = c.accept(c.activeCallID, video) - } - } + data := in.Data.(*msg.PhoneActionRequested) + if c.activeCallID != 0 && c.activeCallID != in.CallID { + c.callBusy(in) + return + } + + if c.isCallRejected(in.CallID) { + return + } + + // (Disabled due to client state problem) + // Send ack update so callee ringing indicator activates + // c.sendCallAck(in) + if _, ok := c.callInfo[in.CallID]; !ok { + c.initCallRequest(in, data) + + c.mu.Lock() + c.peer = c.getInputUserFromUpdate(in) + c.mu.Unlock() + + update := msg.CallUpdateCallRequested{ + Peer: c.peer, + CallID: in.CallID, + Video: data.Video, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallRequested, updateData) + } + } else { + c.initCallRequest(in, data) + if c.shouldAccept(in) { + video := false + if streamState, err := c.getMediaSettings(); err == nil { + video = streamState.Video + } + _ = c.accept(c.activeCallID, video) + } + } } func (c *call) callAccepted(in *UpdatePhoneCall) { - if c.activeCallID == 0 { - return - } - - connId, info, valid := c.getConnId(in.CallID, in.UserID) - if !valid { - return - } - - c.mu.RLock() - pc, ok := c.peerConnections[connId] - c.mu.RUnlock() - if !ok { - return - } - - data := in.Data.(*msg.PhoneActionAccepted) - info.mu.Lock() - info.participants[connId].DeviceType = data.DeviceType - info.mu.Unlock() - - answerSdp := &msg.PhoneActionSDPAnswer{ - SDP: data.SDP, - Type: data.Type, - } - - sdpOK := c.CallbackSetAnswerSDP(connId, answerSdp) - if !sdpOK { - return - } - - pc.mu.Lock() - pc.Accepted = true - pc.mu.Unlock() - c.flushIceCandidates(in.CallID, connId) - - time.AfterFunc(time.Duration(255)*time.Millisecond, func() { - streamState, err := c.getMediaSettings() - if err != nil { - return - } - - c.propagateMediaSettings(MediaSettingsIn{ - Audio: &streamState.Audio, - ScreenShare: &streamState.ScreenShare, - Video: &streamState.Video, - }, true) - }) - - c.clearRetryInterval(connId) - c.appendToAcceptedList(connId) - c.Log().Info("[webrtc] accept signal", zap.Int32("connId", connId)) - - update := msg.CallUpdateCallAccepted{ - ConnectionID: connId, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallAccepted, updateData) - } - - c.changeStatus(connId, msg.CallStatus_Connecting) + if c.activeCallID == 0 { + return + } + + connId, info, valid := c.getConnId(in.CallID, in.UserID) + if !valid { + return + } + + c.mu.RLock() + pc, ok := c.peerConnections[connId] + c.mu.RUnlock() + if !ok { + return + } + + data := in.Data.(*msg.PhoneActionAccepted) + info.mu.Lock() + info.participants[connId].DeviceType = data.DeviceType + info.mu.Unlock() + + answerSdp := &msg.PhoneActionSDPAnswer{ + SDP: data.SDP, + Type: data.Type, + } + + sdpOK := c.CallbackSetAnswerSDP(connId, answerSdp) + if !sdpOK { + return + } + + pc.mu.Lock() + pc.Accepted = true + pc.mu.Unlock() + c.flushIceCandidates(in.CallID, connId) + + time.AfterFunc(time.Duration(255)*time.Millisecond, func() { + streamState, err := c.getMediaSettings() + if err != nil { + return + } + + c.propagateMediaSettings(MediaSettingsIn{ + Audio: &streamState.Audio, + ScreenShare: &streamState.ScreenShare, + Video: &streamState.Video, + }, true) + }) + + c.clearRetryInterval(connId) + c.appendToAcceptedList(connId) + c.Log().Info("[webrtc] accept signal", zap.Int32("connId", connId)) + + update := msg.CallUpdateCallAccepted{ + ConnectionID: connId, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallAccepted, updateData) + } + + c.changeStatus(connId, msg.CallStatus_Connecting) } func (c *call) callDiscarded(in *UpdatePhoneCall) { - connId, _, valid := c.getConnId(in.CallID, in.UserID) - if !valid { - return - } - - c.clearRetryInterval(connId) - c.appendToAcceptedList(connId) - - data := in.Data.(*msg.PhoneActionDiscarded) - if in.PeerType == int32(msg.PeerType_PeerUser) || data.Terminate { - if c.activeCallID != 0 { - update := msg.CallUpdateCallRejected{ - CallID: in.CallID, - Reason: data.Reason, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallRejected, updateData) - } - } - c.destroy(in.CallID) - } else { - if c.removeParticipant(in.UserID, &in.CallID) { - if c.activeCallID != 0 { - update := msg.CallUpdateCallRejected{ - CallID: in.CallID, - Reason: data.Reason, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallRejected, updateData) - } - } - c.destroy(in.CallID) - } else { - c.checkAllConnected() - if c.activeCallID != 0 { - update := msg.CallUpdateParticipantLeft{ - UserID: in.UserID, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_ParticipantLeft, updateData) - } - } - } - } + connId, _, valid := c.getConnId(in.CallID, in.UserID) + if !valid { + return + } + + c.clearRetryInterval(connId) + c.appendToAcceptedList(connId) + + data := in.Data.(*msg.PhoneActionDiscarded) + if in.PeerType == int32(msg.PeerType_PeerUser) || data.Terminate { + if c.activeCallID != 0 { + update := msg.CallUpdateCallRejected{ + CallID: in.CallID, + Reason: data.Reason, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallRejected, updateData) + } + } + c.destroy(in.CallID) + } else { + if c.removeParticipant(in.UserID, &in.CallID) { + if c.activeCallID != 0 { + update := msg.CallUpdateCallRejected{ + CallID: in.CallID, + Reason: data.Reason, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallRejected, updateData) + } + } + c.destroy(in.CallID) + } else { + c.checkAllConnected() + if c.activeCallID != 0 { + update := msg.CallUpdateParticipantLeft{ + UserID: in.UserID, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_ParticipantLeft, updateData) + } + } + } + } } func (c *call) iceExchange(in *UpdatePhoneCall) { - connId, _, valid := c.getConnId(in.CallID, in.UserID) - if !valid { - return - } + connId, _, valid := c.getConnId(in.CallID, in.UserID) + if !valid { + return + } - c.mu.RLock() - _, hasConn := c.peerConnections[connId] - c.mu.RUnlock() + c.mu.RLock() + _, hasConn := c.peerConnections[connId] + c.mu.RUnlock() - if !hasConn { - return - } + if !hasConn { + return + } - data := in.Data.(*msg.PhoneActionIceExchange) + data := in.Data.(*msg.PhoneActionIceExchange) - iceCandidate := &msg.CallRTCIceCandidate{ - Candidate: data.Candidate, - SdpMLineIndex: data.SdpMLineIndex, - SdpMid: data.SdpMid, - UsernameFragment: data.UsernameFragment, - } + iceCandidate := &msg.CallRTCIceCandidate{ + Candidate: data.Candidate, + SdpMLineIndex: data.SdpMLineIndex, + SdpMid: data.SdpMid, + UsernameFragment: data.UsernameFragment, + } - _ = c.CallbackAddIceCandidate(connId, iceCandidate) + _ = c.CallbackAddIceCandidate(connId, iceCandidate) } func (c *call) mediaSettingsUpdated(in *UpdatePhoneCall) { - connId, info, valid := c.getConnId(in.CallID, in.UserID) - if !valid { - return - } - - data := in.Data.(*msg.PhoneActionMediaSettingsUpdated) - - info.mu.Lock() - info.participants[connId].MediaSettings.Audio = data.Audio - info.participants[connId].MediaSettings.Video = data.Video - info.participants[connId].MediaSettings.ScreenShare = data.ScreenShare - info.mu.Unlock() - - update := msg.CallUpdateMediaSettingsUpdated{ - ConnectionID: connId, - MediaSettings: &msg.CallMediaSettings{ - Video: data.Video, - Audio: data.Audio, - ScreenShare: data.ScreenShare, - }, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_MediaSettingsUpdated, updateData) - } + connId, info, valid := c.getConnId(in.CallID, in.UserID) + if !valid { + return + } + + data := in.Data.(*msg.PhoneActionMediaSettingsUpdated) + + info.mu.Lock() + info.participants[connId].MediaSettings.Audio = data.Audio + info.participants[connId].MediaSettings.Video = data.Video + info.participants[connId].MediaSettings.ScreenShare = data.ScreenShare + info.mu.Unlock() + + update := msg.CallUpdateMediaSettingsUpdated{ + ConnectionID: connId, + MediaSettings: &msg.CallMediaSettings{ + Video: data.Video, + Audio: data.Audio, + ScreenShare: data.ScreenShare, + }, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_MediaSettingsUpdated, updateData) + } } func (c *call) sdpOfferUpdated(in *UpdatePhoneCall) { - if c.activeCallID != in.CallID { - return - } + if c.activeCallID != in.CallID { + return + } - connId, _, valid := c.getConnId(in.CallID, in.UserID) - if !valid { - return - } + connId, _, valid := c.getConnId(in.CallID, in.UserID) + if !valid { + return + } - c.mu.RLock() - conn, hasConn := c.peerConnections[connId] - c.mu.RUnlock() + c.mu.RLock() + conn, hasConn := c.peerConnections[connId] + c.mu.RUnlock() - if !hasConn { - return - } + if !hasConn { + return + } - offerSDP := in.Data.(*msg.PhoneActionSDPOffer) + offerSDP := in.Data.(*msg.PhoneActionSDPOffer) - sdpAnswer, err := c.CallbackSetOfferGetAnswerSDP(connId, offerSDP) - if err != nil { - return - } + sdpAnswer, err := c.CallbackSetOfferGetAnswerSDP(connId, offerSDP) + if err != nil { + return + } - conn.mu.Lock() - conn.Accepted = true - conn.mu.Unlock() + conn.mu.Lock() + conn.Accepted = true + conn.mu.Unlock() - c.flushIceCandidates(in.CallID, connId) - c.sendSdpAnswer(connId, sdpAnswer) + c.flushIceCandidates(in.CallID, connId) + c.sendSdpAnswer(connId, sdpAnswer) } func (c *call) sdpAnswerUpdated(in *UpdatePhoneCall) { - if c.activeCallID != in.CallID { - return - } + if c.activeCallID != in.CallID { + return + } - connId, _, valid := c.getConnId(in.CallID, in.UserID) - if !valid { - return - } + connId, _, valid := c.getConnId(in.CallID, in.UserID) + if !valid { + return + } - c.mu.RLock() - _, hasConn := c.peerConnections[connId] - c.mu.RUnlock() + c.mu.RLock() + _, hasConn := c.peerConnections[connId] + c.mu.RUnlock() - if !hasConn { - return - } + if !hasConn { + return + } - answerSDP := in.Data.(*msg.PhoneActionSDPAnswer) + answerSDP := in.Data.(*msg.PhoneActionSDPAnswer) - _ = c.CallbackSetAnswerSDP(connId, answerSDP) + _ = c.CallbackSetAnswerSDP(connId, answerSDP) } func (c *call) callAcknowledged(in *UpdatePhoneCall) { - connId, _, valid := c.getConnId(in.CallID, in.UserID) - if !valid { - return - } + connId, _, valid := c.getConnId(in.CallID, in.UserID) + if !valid { + return + } - // c.clearRetryInterval(connId) - update := msg.CallUpdateCallAck{ - ConnectionID: connId, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallAck, updateData) - } + // c.clearRetryInterval(connId) + update := msg.CallUpdateCallAck{ + ConnectionID: connId, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallAck, updateData) + } - c.changeStatus(connId, msg.CallStatus_Ringing) + c.changeStatus(connId, msg.CallStatus_Ringing) } func (c *call) participantAdded(in *UpdatePhoneCall) { - if c.activeCallID != in.CallID { - return - } - - data := in.Data.(*msg.PhoneActionParticipantAdded) - c.initParticipants(c.activeCallID, data.Participants, false) - isNew := true - var userIDs []int64 - for _, participant := range data.Participants { - if participant.Peer.UserID == c.userID { - isNew = false - } - userIDs = append(userIDs, participant.Peer.UserID) - } - - if isNew { - update := msg.CallUpdateParticipantJoined{ - UserIDs: userIDs, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_ParticipantJoined, updateData) - } - } + if c.activeCallID != in.CallID { + return + } + + data := in.Data.(*msg.PhoneActionParticipantAdded) + c.initParticipants(c.activeCallID, data.Participants, false) + isNew := true + var userIDs []int64 + for _, participant := range data.Participants { + if participant.Peer.UserID == c.userID { + isNew = false + } + userIDs = append(userIDs, participant.Peer.UserID) + } + + if isNew { + update := msg.CallUpdateParticipantJoined{ + UserIDs: userIDs, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_ParticipantJoined, updateData) + } + } } func (c *call) participantRemoved(in *UpdatePhoneCall) { - data := in.Data.(*msg.PhoneActionParticipantRemoved) - - for _, userId := range data.UserIDs { - if userId == c.userID { - update := msg.CallUpdateCallCancelled{ - CallID: in.CallID, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallCancelled, updateData) - } - break - } - } - - if c.activeCallID != in.CallID { - for _, userId := range data.UserIDs { - c.removeParticipant(userId, &in.CallID) - } - return - } - - isCurrentRemoved := false - for _, userId := range data.UserIDs { - c.removeParticipant(userId, nil) - if userId == c.userID { - isCurrentRemoved = true - } - } - - update := msg.CallUpdateParticipantRemoved{ - UserIDs: data.UserIDs, - Timeout: data.Timeout, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_ParticipantRemoved, updateData) - } - if isCurrentRemoved { - update := msg.CallUpdateCallRejected{ - CallID: in.CallID, - Reason: msg.DiscardReason_DiscardReasonHangup, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallRejected, updateData) - } - } - - c.checkAllConnected() + data := in.Data.(*msg.PhoneActionParticipantRemoved) + + for _, userId := range data.UserIDs { + if userId == c.userID { + update := msg.CallUpdateCallCancelled{ + CallID: in.CallID, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallCancelled, updateData) + } + break + } + } + + if c.activeCallID != in.CallID { + for _, userId := range data.UserIDs { + c.removeParticipant(userId, &in.CallID) + } + return + } + + isCurrentRemoved := false + for _, userId := range data.UserIDs { + c.removeParticipant(userId, nil) + if userId == c.userID { + isCurrentRemoved = true + } + } + + update := msg.CallUpdateParticipantRemoved{ + UserIDs: data.UserIDs, + Timeout: data.Timeout, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_ParticipantRemoved, updateData) + } + if isCurrentRemoved { + update := msg.CallUpdateCallRejected{ + CallID: in.CallID, + Reason: msg.DiscardReason_DiscardReasonHangup, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallRejected, updateData) + } + } + + c.checkAllConnected() } func (c *call) adminUpdated(in *UpdatePhoneCall) { - if c.activeCallID != in.CallID { - return - } - - data := in.Data.(*msg.PhoneActionAdminUpdated) - c.updateAdmin(data.UserID, data.Admin) - update := msg.CallUpdateParticipantAdminUpdated{ - UserID: data.UserID, - Admin: data.Admin, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_ParticipantAdminUpdated, updateData) - } + if c.activeCallID != in.CallID { + return + } + + data := in.Data.(*msg.PhoneActionAdminUpdated) + c.updateAdmin(data.UserID, data.Admin) + update := msg.CallUpdateParticipantAdminUpdated{ + UserID: data.UserID, + Admin: data.Admin, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_ParticipantAdminUpdated, updateData) + } } func (c *call) joinRequested(in *UpdatePhoneCall) { - data := in.Data.(*msg.PhoneActionJoinRequested) - for _, userId := range data.UserIDs { - if userId == c.userID { - update := msg.CallUpdateCallJoinRequested{ - CallID: in.CallID, - CalleeID: userId, - Peer: &msg.InputPeer{ - ID: in.PeerID, - Type: msg.PeerType(in.PeerType), - AccessHash: 0, - }, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallJoinRequested, updateData) - } - return - } - } + data := in.Data.(*msg.PhoneActionJoinRequested) + for _, userId := range data.UserIDs { + if userId == c.userID { + update := msg.CallUpdateCallJoinRequested{ + CallID: in.CallID, + CalleeID: userId, + Peer: &msg.InputPeer{ + ID: in.PeerID, + Type: msg.PeerType(in.PeerType), + AccessHash: 0, + }, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallJoinRequested, updateData) + } + return + } + } } func (c *call) screenShareUpdated(in *UpdatePhoneCall) { - // data := in.Data.(*msg.PhoneActionScreenShare) - // fmt.Println(data) + // data := in.Data.(*msg.PhoneActionScreenShare) + // fmt.Println(data) } func (c *call) callPicked(in *UpdatePhoneCall) { - data := in.Data.(*msg.PhoneActionPicked) - if data.AuthID != c.SDK().GetConnInfo().PickupAuthID() { - update := msg.CallUpdateCallCancelled{ - CallID: in.CallID, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallCancelled, updateData) - } - } + data := in.Data.(*msg.PhoneActionPicked) + if data.AuthID != c.SDK().GetConnInfo().PickupAuthID() { + update := msg.CallUpdateCallCancelled{ + CallID: in.CallID, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallCancelled, updateData) + } + } } func (c *call) callRestarted(in *UpdatePhoneCall) { - connId, _, valid := c.getConnId(in.CallID, in.UserID) - if !valid { - return - } - data := in.Data.(*msg.PhoneActionRestarted) - if data.Sender { - _ = c.checkDisconnection(connId, "disconnected", false) - _ = c.callSendRestart(connId, false) - } else { - sdp, err := c.initConnection(false, connId, nil) - if err != nil { - return - } - - sdpOffer := &msg.PhoneActionSDPOffer{ - SDP: sdp.SDP, - Type: sdp.Type, - } - c.sendSdpOffer(connId, sdpOffer) - } + connId, _, valid := c.getConnId(in.CallID, in.UserID) + if !valid { + return + } + data := in.Data.(*msg.PhoneActionRestarted) + if data.Sender { + _ = c.checkDisconnection(connId, "disconnected", false) + _ = c.callSendRestart(connId, false) + } else { + sdp, err := c.initConnection(false, connId, nil) + if err != nil { + return + } + + sdpOffer := &msg.PhoneActionSDPOffer{ + SDP: sdp.SDP, + Type: sdp.Type, + } + c.sendSdpOffer(connId, sdpOffer) + } } func (c *call) checkCallTimeout(connId int32) { - if c.activeCallID == 0 { - return - } - - if c.peer == nil { - return - } - - info := c.getCallInfo(c.activeCallID) - if info == nil { - return - } - - if len(info.acceptedParticipants) == 0 { - _ = c.reject(c.activeCallID, 0, msg.DiscardReason_DiscardReasonMissed, nil, false) - update := msg.CallUpdateCallTimeout{} - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallTimeout, updateData) - } - c.Log().Info("[webrtc] call timeout", zap.Int32("ConnId", connId)) - } else if c.peer.GetType() == msg.PeerType_PeerGroup { - var notAnsweringUserIDs []int64 - info.mu.RLock() - for _, conn := range info.participants { - matched := false - for _, connId := range info.acceptedParticipants { - if conn.PhoneParticipant.ConnectionId == connId { - matched = true - break - } - } - if !matched { - notAnsweringUserIDs = append(notAnsweringUserIDs, conn.PhoneParticipant.Peer.UserID) - } - } - info.mu.RUnlock() - if len(notAnsweringUserIDs) > 0 { - _ = c.groupRemoveParticipant(c.activeCallID, notAnsweringUserIDs, true) - } - } + if c.activeCallID == 0 { + return + } + + if c.peer == nil { + return + } + + info := c.getCallInfo(c.activeCallID) + if info == nil { + return + } + + if len(info.acceptedParticipants) == 0 { + _ = c.reject(c.activeCallID, 0, msg.DiscardReason_DiscardReasonMissed, nil, false) + update := msg.CallUpdateCallTimeout{} + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallTimeout, updateData) + } + c.Log().Info("[webrtc] call timeout", zap.Int32("ConnId", connId)) + } else if c.peer.GetType() == msg.PeerType_PeerGroup { + var notAnsweringUserIDs []int64 + info.mu.RLock() + for _, conn := range info.participants { + matched := false + for _, connId := range info.acceptedParticipants { + if conn.PhoneParticipant.ConnectionId == connId { + matched = true + break + } + } + if !matched { + notAnsweringUserIDs = append(notAnsweringUserIDs, conn.PhoneParticipant.Peer.UserID) + } + } + info.mu.RUnlock() + if len(notAnsweringUserIDs) > 0 { + _ = c.groupRemoveParticipant(c.activeCallID, notAnsweringUserIDs, true) + } + } } func (c *call) changeStatus(connId int32, status msg.CallStatus) { - if c.activeCallID == 0 { - return - } - - c.mu.Lock() - conn, ok := c.peerConnections[connId] - c.mu.Unlock() - if !ok { - return - } - - conn.mu.Lock() - defer conn.mu.Unlock() - - if conn.status == msg.CallStatus_Connected && status != msg.CallStatus_Reconnecting { - return - } - conn.status = status - - update := msg.CallUpdateStatusChanged{ - CallID: c.activeCallID, - ConnId: connId, - Status: status, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallStatusChanged, updateData) - } + if c.activeCallID == 0 { + return + } + + c.mu.Lock() + conn, ok := c.peerConnections[connId] + c.mu.Unlock() + if !ok { + return + } + + conn.mu.Lock() + defer conn.mu.Unlock() + + if conn.status == msg.CallStatus_Connected && status != msg.CallStatus_Reconnecting { + return + } + conn.status = status + + update := msg.CallUpdateStatusChanged{ + CallID: c.activeCallID, + ConnId: connId, + Status: status, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallStatusChanged, updateData) + } } func (c *call) callUpdate(action msg.CallUpdate, b []byte) { - if c.callback.OnUpdate == nil { - c.Log().Error("callbacks are not initialized") - return - } + if c.callback.OnUpdate == nil { + c.Log().Error("callbacks are not initialized") + return + } - c.callback.OnUpdate(int32(action), b) + c.callback.OnUpdate(int32(action), b) } func (c *call) appendCallRequestID(callID, reqID int64) { - if callID == 0 { - return - } + if callID == 0 { + return + } - info := c.getCallInfo(callID) - if info != nil { - info.mu.Lock() - info.requestMap[reqID] = struct{}{} - info.mu.Unlock() - } + info := c.getCallInfo(callID) + if info != nil { + info.mu.Lock() + info.requestMap[reqID] = struct{}{} + info.mu.Unlock() + } } func (c *call) pushToRejectedCallIds(callID int64) { - c.mu.Lock() - c.rejectedCallIDs = append(c.rejectedCallIDs, callID) - c.mu.Unlock() - time.AfterFunc(time.Duration(15)*time.Second, func() { - c.mu.Lock() - for idx, id := range c.rejectedCallIDs { - if id == callID { - c.rejectedCallIDs = append(c.rejectedCallIDs[:idx], c.rejectedCallIDs[idx+1:]...) - break - } - } - c.mu.Unlock() - }) + c.mu.Lock() + c.rejectedCallIDs = append(c.rejectedCallIDs, callID) + c.mu.Unlock() + time.AfterFunc(time.Duration(15)*time.Second, func() { + c.mu.Lock() + for idx, id := range c.rejectedCallIDs { + if id == callID { + c.rejectedCallIDs = append(c.rejectedCallIDs[:idx], c.rejectedCallIDs[idx+1:]...) + break + } + } + c.mu.Unlock() + }) } func (c *call) isCallRejected(callID int64) (ok bool) { - ok = false - c.mu.RLock() - for _, id := range c.rejectedCallIDs { - if id == callID { - ok = true - break - } - } - c.mu.RUnlock() - return + ok = false + c.mu.RLock() + for _, id := range c.rejectedCallIDs { + if id == callID { + ok = true + break + } + } + c.mu.RUnlock() + return } func (c *call) removeCallRequestID(callID, reqID int64) { - if callID == 0 { - return - } + if callID == 0 { + return + } - info := c.getCallInfo(callID) - if info != nil { - info.mu.Lock() - delete(info.requestMap, reqID) - info.mu.Unlock() - } + info := c.getCallInfo(callID) + if info != nil { + info.mu.Lock() + delete(info.requestMap, reqID) + info.mu.Unlock() + } } func (c *call) updatePhoneCallStarted(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdatePhoneCallStarted) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } + x := new(msg.UpdatePhoneCallStarted) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } - c.Log().Debug("applies UpdatePhoneCallStarted", - zap.Int64("UpdateID", x.UpdateID), - ) + c.Log().Debug("applies UpdatePhoneCallStarted", + zap.Int64("UpdateID", x.UpdateID), + ) - _ = repo.Dialogs.UpdateCallStarted(x) - res := []*msg.UpdateEnvelope{u} - return res, nil + _ = repo.Dialogs.UpdateCallStarted(x) + res := []*msg.UpdateEnvelope{u} + return res, nil } func (c *call) updatePhoneCallEnded(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdatePhoneCallEnded) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - c.Log().Debug("applies UpdatePhoneCallEnded", - zap.Int64("UpdateID", x.UpdateID), - ) - - _ = repo.Dialogs.UpdateCallEnded(x) - - if c.activeCallID != 0 && c.peer != nil && c.peer.ID == x.Peer.ID && int32(c.peer.Type) == x.Peer.Type { - update := msg.CallUpdateCallRejected{ - CallID: c.activeCallID, - Reason: msg.DiscardReason_DiscardReasonHangup, - } - updateData, uErr := update.Marshal() - if uErr == nil { - c.callUpdate(msg.CallUpdate_CallRejected, updateData) - } - } - - res := []*msg.UpdateEnvelope{u} - return res, nil + x := new(msg.UpdatePhoneCallEnded) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + c.Log().Debug("applies UpdatePhoneCallEnded", + zap.Int64("UpdateID", x.UpdateID), + ) + + _ = repo.Dialogs.UpdateCallEnded(x) + + if c.activeCallID != 0 && c.peer != nil && c.peer.ID == x.Peer.ID && int32(c.peer.Type) == x.Peer.Type { + update := msg.CallUpdateCallRejected{ + CallID: c.activeCallID, + Reason: msg.DiscardReason_DiscardReasonHangup, + } + updateData, uErr := update.Marshal() + if uErr == nil { + c.callUpdate(msg.CallUpdate_CallRejected, updateData) + } + } + + res := []*msg.UpdateEnvelope{u} + return res, nil } diff --git a/module/call/update_appliers.go b/module/call/update_appliers.go index 4d9e4ca3..0fac96f6 100644 --- a/module/call/update_appliers.go +++ b/module/call/update_appliers.go @@ -1,9 +1,9 @@ package call import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "go.uber.org/zap" ) /* @@ -16,71 +16,71 @@ import ( */ func (c *call) updatePhoneCall(u *msg.UpdateEnvelope) (res []*msg.UpdateEnvelope, err error) { - // TODO: Add worker - go func() { - x := &msg.UpdatePhoneCall{} - err = x.Unmarshal(u.Update) - if err != nil { - return - } + // TODO: Add worker + go func() { + x := &msg.UpdatePhoneCall{} + err = x.Unmarshal(u.Update) + if err != nil { + return + } - c.Log().Info("applies UpdatePhoneCall", zap.String("Action", x.Action.String())) + c.Log().Info("applies UpdatePhoneCall", zap.String("Action", x.Action.String())) - now := domain.Now().Unix() - if x.Timestamp != 0 && now-x.Timestamp > 60 { - return - } + now := domain.Now().Unix() + if x.Timestamp != 0 && now-x.Timestamp > 60 { + return + } - data, err := parseCallAction(x.Action, x.ActionData) - if err != nil { - c.Log().Debug("parseCallAction", zap.Error(err)) - return - } + data, err := parseCallAction(x.Action, x.ActionData) + if err != nil { + c.Log().Debug("parseCallAction", zap.Error(err)) + return + } - update := &UpdatePhoneCall{ - UpdatePhoneCall: x, - Data: data, - } + update := &UpdatePhoneCall{ + UpdatePhoneCall: x, + Data: data, + } - if data == nil { - c.Log().Debug("Update data is nil") - return - } + if data == nil { + c.Log().Debug("Update data is nil") + return + } - switch x.Action { - case msg.PhoneCallAction_PhoneCallRequested: - c.callRequested(update) - case msg.PhoneCallAction_PhoneCallAccepted: - c.callAccepted(update) - case msg.PhoneCallAction_PhoneCallDiscarded: - c.callDiscarded(update) - case msg.PhoneCallAction_PhoneCallIceExchange: - c.iceExchange(update) - case msg.PhoneCallAction_PhoneCallMediaSettingsChanged: - c.mediaSettingsUpdated(update) - case msg.PhoneCallAction_PhoneCallSDPOffer: - c.sdpOfferUpdated(update) - case msg.PhoneCallAction_PhoneCallSDPAnswer: - c.sdpAnswerUpdated(update) - case msg.PhoneCallAction_PhoneCallAck: - c.callAcknowledged(update) - case msg.PhoneCallAction_PhoneCallParticipantAdded: - c.participantAdded(update) - case msg.PhoneCallAction_PhoneCallParticipantRemoved: - c.participantRemoved(update) - case msg.PhoneCallAction_PhoneCallAdminUpdated: - c.adminUpdated(update) - case msg.PhoneCallAction_PhoneCallJoinRequested: - c.joinRequested(update) - case msg.PhoneCallAction_PhoneCallScreenShare: - c.screenShareUpdated(update) - case msg.PhoneCallAction_PhoneCallPicked: - c.callPicked(update) - case msg.PhoneCallAction_PhoneCallRestarted: - c.callRestarted(update) - } - }() + switch x.Action { + case msg.PhoneCallAction_PhoneCallRequested: + c.callRequested(update) + case msg.PhoneCallAction_PhoneCallAccepted: + c.callAccepted(update) + case msg.PhoneCallAction_PhoneCallDiscarded: + c.callDiscarded(update) + case msg.PhoneCallAction_PhoneCallIceExchange: + c.iceExchange(update) + case msg.PhoneCallAction_PhoneCallMediaSettingsChanged: + c.mediaSettingsUpdated(update) + case msg.PhoneCallAction_PhoneCallSDPOffer: + c.sdpOfferUpdated(update) + case msg.PhoneCallAction_PhoneCallSDPAnswer: + c.sdpAnswerUpdated(update) + case msg.PhoneCallAction_PhoneCallAck: + c.callAcknowledged(update) + case msg.PhoneCallAction_PhoneCallParticipantAdded: + c.participantAdded(update) + case msg.PhoneCallAction_PhoneCallParticipantRemoved: + c.participantRemoved(update) + case msg.PhoneCallAction_PhoneCallAdminUpdated: + c.adminUpdated(update) + case msg.PhoneCallAction_PhoneCallJoinRequested: + c.joinRequested(update) + case msg.PhoneCallAction_PhoneCallScreenShare: + c.screenShareUpdated(update) + case msg.PhoneCallAction_PhoneCallPicked: + c.callPicked(update) + case msg.PhoneCallAction_PhoneCallRestarted: + c.callRestarted(update) + } + }() - res = []*msg.UpdateEnvelope{u} - return + res = []*msg.UpdateEnvelope{u} + return } diff --git a/module/call/utils.go b/module/call/utils.go index b2382933..5c36e974 100644 --- a/module/call/utils.go +++ b/module/call/utils.go @@ -1,10 +1,11 @@ package call import ( - "errors" - "git.ronaksoft.com/river/msg/go/msg" - "sync" - "time" + "errors" + "sync" + "time" + + "github.com/ronaksoft/river-msg/go/msg" ) /* @@ -17,189 +18,189 @@ import ( */ var ( - ErrActionNotFound = errors.New("action not found") - ErrInvalidCallID = errors.New("invalid call id") - ErrInvalidConnId = errors.New("invalid conn id") - ErrInvalidPeerInput = errors.New("invalid peer input") - ErrInvalidCallRequest = errors.New("invalid call request") - ErrNoActiveCall = errors.New("no active call") - ErrNoSDP = errors.New("no sdp") - ErrCannotSetAnswerSDP = errors.New("cannot set answer sdp") - ErrNoCallRequest = errors.New("no call request") - ErrCannotInitStream = errors.New("cannot init stream") - ErrCannotInitConnection = errors.New("cannot init connection") - ErrCannotCloseConnection = errors.New("cannot close connection") - ErrInvalidRequest = errors.New("invalid request") - ErrInvalidResponse = errors.New("invalid response") - ErrCallbacksAreNotInitialized = errors.New("callbacks are not initialized") + ErrActionNotFound = errors.New("action not found") + ErrInvalidCallID = errors.New("invalid call id") + ErrInvalidConnId = errors.New("invalid conn id") + ErrInvalidPeerInput = errors.New("invalid peer input") + ErrInvalidCallRequest = errors.New("invalid call request") + ErrNoActiveCall = errors.New("no active call") + ErrNoSDP = errors.New("no sdp") + ErrCannotSetAnswerSDP = errors.New("cannot set answer sdp") + ErrNoCallRequest = errors.New("no call request") + ErrCannotInitStream = errors.New("cannot init stream") + ErrCannotInitConnection = errors.New("cannot init connection") + ErrCannotCloseConnection = errors.New("cannot close connection") + ErrInvalidRequest = errors.New("invalid request") + ErrInvalidResponse = errors.New("invalid response") + ErrCallbacksAreNotInitialized = errors.New("callbacks are not initialized") ) type UpdatePhoneCall struct { - *msg.UpdatePhoneCall - Data interface{} + *msg.UpdatePhoneCall + Data interface{} } type Connection struct { - msg.CallConnection - mu *sync.RWMutex - connectTicker *time.Ticker - reconnectTimout *time.Timer - status msg.CallStatus + msg.CallConnection + mu *sync.RWMutex + connectTicker *time.Ticker + reconnectTimout *time.Timer + status msg.CallStatus } type MediaSettingsIn struct { - Audio *bool - ScreenShare *bool - Video *bool + Audio *bool + ScreenShare *bool + Video *bool } type MediaSettings struct { - Audio bool - ScreenShare bool - Video bool + Audio bool + ScreenShare bool + Video bool } type Duration struct { - Start int64 - Stop int64 + Start int64 + Stop int64 } type Info struct { - acceptedParticipantIds []int64 - acceptedParticipants []int32 - allConnected bool - dialed bool - mediaSettings *msg.CallMediaSettings - participantMap map[int64]int32 - participants map[int32]*msg.CallParticipant - requestParticipantIds []int64 - requests []*UpdatePhoneCall - iceServer *msg.IceServer - requestMap map[int64]struct{} - mu *sync.RWMutex + acceptedParticipantIds []int64 + acceptedParticipants []int32 + allConnected bool + dialed bool + mediaSettings *msg.CallMediaSettings + participantMap map[int64]int32 + participants map[int32]*msg.CallParticipant + requestParticipantIds []int64 + requests []*UpdatePhoneCall + iceServer *msg.IceServer + requestMap map[int64]struct{} + mu *sync.RWMutex } func parseCallAction(constructor msg.PhoneCallAction, data []byte) (out interface{}, err error) { - switch constructor { - case msg.PhoneCallAction_PhoneCallRequested: - t1 := &msg.PhoneActionRequested{} - err = t1.Unmarshal(data) - if err != nil { - return - } - return t1, nil - case msg.PhoneCallAction_PhoneCallAccepted: - t2 := &msg.PhoneActionAccepted{} - err = t2.Unmarshal(data) - if err != nil { - return - } - return t2, nil - case msg.PhoneCallAction_PhoneCallDiscarded: - t3 := &msg.PhoneActionDiscarded{} - err = t3.Unmarshal(data) - if err != nil { - return - } - return t3, nil - case msg.PhoneCallAction_PhoneCallCallWaiting: - t4 := &msg.PhoneActionCallWaiting{} - err = t4.Unmarshal(data) - if err != nil { - return - } - return t4, nil - case msg.PhoneCallAction_PhoneCallIceExchange: - t5 := &msg.PhoneActionIceExchange{} - err = t5.Unmarshal(data) - if err != nil { - return - } - return t5, nil - case msg.PhoneCallAction_PhoneCallEmpty: - t6 := &msg.PhoneActionCallEmpty{} - err = t6.Unmarshal(data) - if err != nil { - return - } - return t6, nil - case msg.PhoneCallAction_PhoneCallMediaSettingsChanged: - t7 := &msg.PhoneActionMediaSettingsUpdated{} - err = t7.Unmarshal(data) - if err != nil { - return - } - return t7, nil - case msg.PhoneCallAction_PhoneCallSDPOffer: - t8 := &msg.PhoneActionSDPOffer{} - err = t8.Unmarshal(data) - if err != nil { - return - } - return t8, nil - case msg.PhoneCallAction_PhoneCallSDPAnswer: - t9 := &msg.PhoneActionSDPAnswer{} - err = t9.Unmarshal(data) - if err != nil { - return - } - return t9, nil - case msg.PhoneCallAction_PhoneCallAck: - t10 := &msg.PhoneActionSDPAnswer{} - err = t10.Unmarshal(data) - if err != nil { - return - } - return t10, nil - case msg.PhoneCallAction_PhoneCallParticipantAdded: - t11 := &msg.PhoneActionParticipantAdded{} - err = t11.Unmarshal(data) - if err != nil { - return - } - return t11, nil - case msg.PhoneCallAction_PhoneCallParticipantRemoved: - t12 := &msg.PhoneActionParticipantRemoved{} - err = t12.Unmarshal(data) - if err != nil { - return - } - return t12, nil - case msg.PhoneCallAction_PhoneCallJoinRequested: - t13 := &msg.PhoneActionJoinRequested{} - err = t13.Unmarshal(data) - if err != nil { - return - } - return t13, nil - case msg.PhoneCallAction_PhoneCallAdminUpdated: - t14 := &msg.PhoneActionAdminUpdated{} - err = t14.Unmarshal(data) - if err != nil { - return - } - return t14, nil - case msg.PhoneCallAction_PhoneCallScreenShare: - t15 := &msg.PhoneActionScreenShare{} - err = t15.Unmarshal(data) - if err != nil { - return - } - return t15, nil - case msg.PhoneCallAction_PhoneCallPicked: - t16 := &msg.PhoneActionPicked{} - err = t16.Unmarshal(data) - if err != nil { - return - } - return t16, nil - case msg.PhoneCallAction_PhoneCallRestarted: - t17 := &msg.PhoneActionRestarted{} - err = t17.Unmarshal(data) - if err != nil { - return - } - return t17, nil - } - return nil, ErrActionNotFound + switch constructor { + case msg.PhoneCallAction_PhoneCallRequested: + t1 := &msg.PhoneActionRequested{} + err = t1.Unmarshal(data) + if err != nil { + return + } + return t1, nil + case msg.PhoneCallAction_PhoneCallAccepted: + t2 := &msg.PhoneActionAccepted{} + err = t2.Unmarshal(data) + if err != nil { + return + } + return t2, nil + case msg.PhoneCallAction_PhoneCallDiscarded: + t3 := &msg.PhoneActionDiscarded{} + err = t3.Unmarshal(data) + if err != nil { + return + } + return t3, nil + case msg.PhoneCallAction_PhoneCallCallWaiting: + t4 := &msg.PhoneActionCallWaiting{} + err = t4.Unmarshal(data) + if err != nil { + return + } + return t4, nil + case msg.PhoneCallAction_PhoneCallIceExchange: + t5 := &msg.PhoneActionIceExchange{} + err = t5.Unmarshal(data) + if err != nil { + return + } + return t5, nil + case msg.PhoneCallAction_PhoneCallEmpty: + t6 := &msg.PhoneActionCallEmpty{} + err = t6.Unmarshal(data) + if err != nil { + return + } + return t6, nil + case msg.PhoneCallAction_PhoneCallMediaSettingsChanged: + t7 := &msg.PhoneActionMediaSettingsUpdated{} + err = t7.Unmarshal(data) + if err != nil { + return + } + return t7, nil + case msg.PhoneCallAction_PhoneCallSDPOffer: + t8 := &msg.PhoneActionSDPOffer{} + err = t8.Unmarshal(data) + if err != nil { + return + } + return t8, nil + case msg.PhoneCallAction_PhoneCallSDPAnswer: + t9 := &msg.PhoneActionSDPAnswer{} + err = t9.Unmarshal(data) + if err != nil { + return + } + return t9, nil + case msg.PhoneCallAction_PhoneCallAck: + t10 := &msg.PhoneActionSDPAnswer{} + err = t10.Unmarshal(data) + if err != nil { + return + } + return t10, nil + case msg.PhoneCallAction_PhoneCallParticipantAdded: + t11 := &msg.PhoneActionParticipantAdded{} + err = t11.Unmarshal(data) + if err != nil { + return + } + return t11, nil + case msg.PhoneCallAction_PhoneCallParticipantRemoved: + t12 := &msg.PhoneActionParticipantRemoved{} + err = t12.Unmarshal(data) + if err != nil { + return + } + return t12, nil + case msg.PhoneCallAction_PhoneCallJoinRequested: + t13 := &msg.PhoneActionJoinRequested{} + err = t13.Unmarshal(data) + if err != nil { + return + } + return t13, nil + case msg.PhoneCallAction_PhoneCallAdminUpdated: + t14 := &msg.PhoneActionAdminUpdated{} + err = t14.Unmarshal(data) + if err != nil { + return + } + return t14, nil + case msg.PhoneCallAction_PhoneCallScreenShare: + t15 := &msg.PhoneActionScreenShare{} + err = t15.Unmarshal(data) + if err != nil { + return + } + return t15, nil + case msg.PhoneCallAction_PhoneCallPicked: + t16 := &msg.PhoneActionPicked{} + err = t16.Unmarshal(data) + if err != nil { + return + } + return t16, nil + case msg.PhoneCallAction_PhoneCallRestarted: + t17 := &msg.PhoneActionRestarted{} + err = t17.Unmarshal(data) + if err != nil { + return + } + return t17, nil + } + return nil, ErrActionNotFound } diff --git a/module/contact/contact.go b/module/contact/contact.go index 4c39deab..a77afa59 100644 --- a/module/contact/contact.go +++ b/module/contact/contact.go @@ -1,10 +1,10 @@ package contact import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -17,33 +17,33 @@ import ( */ type contact struct { - module.Base + module.Base } func New() *contact { - r := &contact{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_ContactsAdd: r.contactsAdd, - msg.C_ContactsDelete: r.contactsDelete, - msg.C_ContactsDeleteAll: r.contactsDeleteAll, - msg.C_ContactsGet: r.contactsGet, - msg.C_ContactsGetTopPeers: r.contactsGetTopPeers, - msg.C_ContactsImport: r.contactsImport, - msg.C_ContactsResetTopPeer: r.contactsResetTopPeer, - msg.C_ClientContactSearch: r.clientContactSearch, - }, - ) - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_ContactsImported: r.contactsImported, - msg.C_ContactsMany: r.contactsMany, - msg.C_ContactsTopPeers: r.contactsTopPeers, - }, - ) - return r + r := &contact{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_ContactsAdd: r.contactsAdd, + msg.C_ContactsDelete: r.contactsDelete, + msg.C_ContactsDeleteAll: r.contactsDeleteAll, + msg.C_ContactsGet: r.contactsGet, + msg.C_ContactsGetTopPeers: r.contactsGetTopPeers, + msg.C_ContactsImport: r.contactsImport, + msg.C_ContactsResetTopPeer: r.contactsResetTopPeer, + msg.C_ClientContactSearch: r.clientContactSearch, + }, + ) + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_ContactsImported: r.contactsImported, + msg.C_ContactsMany: r.contactsMany, + msg.C_ContactsTopPeers: r.contactsTopPeers, + }, + ) + return r } func (r *contact) Name() string { - return module.Contact + return module.Contact } diff --git a/module/contact/handlers.go b/module/contact/handlers.go index 3df854c3..b573ecc7 100644 --- a/module/contact/handlers.go +++ b/module/contact/handlers.go @@ -1,14 +1,15 @@ package contact import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" - "go.uber.org/zap" - "strings" + "strings" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" + "go.uber.org/zap" ) /* @@ -21,249 +22,249 @@ import ( */ func (r *contact) contactsGet(da request.Callback) { - req := &msg.ContactsGet{} - if err := da.RequestData(req); err != nil { - return - } - - res := &msg.ContactsMany{} - res.ContactUsers, res.Contacts = repo.Users.GetContacts(da.TeamID()) - - userIDs := make([]int64, 0, len(res.ContactUsers)) - for idx := range res.ContactUsers { - userIDs = append(userIDs, res.ContactUsers[idx].ID) - } - res.Users, _ = repo.Users.GetMany(userIDs) - - r.Log().Info("returned data locally, ContactsGet", - zap.Int("Users", len(res.Users)), - zap.Int("Contacts", len(res.Contacts)), - ) - - da.Response(msg.C_ContactsMany, res) + req := &msg.ContactsGet{} + if err := da.RequestData(req); err != nil { + return + } + + res := &msg.ContactsMany{} + res.ContactUsers, res.Contacts = repo.Users.GetContacts(da.TeamID()) + + userIDs := make([]int64, 0, len(res.ContactUsers)) + for idx := range res.ContactUsers { + userIDs = append(userIDs, res.ContactUsers[idx].ID) + } + res.Users, _ = repo.Users.GetMany(userIDs) + + r.Log().Info("returned data locally, ContactsGet", + zap.Int("Users", len(res.Users)), + zap.Int("Contacts", len(res.Contacts)), + ) + + da.Response(msg.C_ContactsMany, res) } func (r *contact) contactsAdd(da request.Callback) { - req := &msg.ContactsAdd{} - if err := da.RequestData(req); err != nil { - return - } - - if da.TeamID() != 0 { - da.Response(rony.C_Error, &rony.Error{Code: "00", Items: "teams cannot add contact"}) - return - } - - user, _ := repo.Users.Get(req.User.UserID) - if user != nil { - user.FirstName = req.FirstName - user.LastName = req.LastName - user.Phone = req.Phone - _ = repo.Users.SaveContact(da.TeamID(), &msg.ContactUser{ - ID: user.ID, - FirstName: user.FirstName, - LastName: user.LastName, - AccessHash: user.AccessHash, - Phone: user.Phone, - Username: user.Username, - ClientID: 0, - Photo: user.Photo, - }) - _ = repo.Users.Save(user) - } - - // reset contacts hash to update the contacts - _ = repo.System.SaveInt(domain.GetContactsGetHashKey(da.TeamID()), 0) - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.ContactsAdd{} + if err := da.RequestData(req); err != nil { + return + } + + if da.TeamID() != 0 { + da.Response(rony.C_Error, &rony.Error{Code: "00", Items: "teams cannot add contact"}) + return + } + + user, _ := repo.Users.Get(req.User.UserID) + if user != nil { + user.FirstName = req.FirstName + user.LastName = req.LastName + user.Phone = req.Phone + _ = repo.Users.SaveContact(da.TeamID(), &msg.ContactUser{ + ID: user.ID, + FirstName: user.FirstName, + LastName: user.LastName, + AccessHash: user.AccessHash, + Phone: user.Phone, + Username: user.Username, + ClientID: 0, + Photo: user.Photo, + }) + _ = repo.Users.Save(user) + } + + // reset contacts hash to update the contacts + _ = repo.System.SaveInt(domain.GetContactsGetHashKey(da.TeamID()), 0) + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *contact) contactsImport(da request.Callback) { - req := &msg.ContactsImport{} - if err := da.RequestData(req); err != nil { - return - } - - if da.TeamID() != 0 { - da.Response(rony.C_Error, errors.New("00", "teams cannot import contact")) - return - } - - // If only importing one contact then we don't need to calculate contacts hash - if len(req.Contacts) == 1 { - // send request to server - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - - oldHash, err := repo.System.LoadInt(domain.SkContactsImportHash) - if err != nil { - r.Log().Warn("got error on loading ContactsImportHash", zap.Error(err)) - } - // calculate ContactsImportHash and compare with oldHash - newHash := domain.CalculateContactsImportHash(req) - r.Log().Info("returned data locally, ContactsImport", - zap.Uint64("Old", oldHash), - zap.Uint64("New", newHash), - ) - if newHash == oldHash { - res := &msg.ContactsImported{ - ContactUsers: nil, - Users: nil, - Empty: true, - } - da.Response(msg.C_ContactsImported, res) - return - } - - // not equal save it to DB - err = repo.System.SaveInt(domain.SkContactsImportHash, newHash) - if err != nil { - r.Log().Error("got error on saving ContactsImportHash", zap.Error(err)) - } - - // extract differences between existing contacts and new contacts - _, contacts := repo.Users.GetContacts(da.TeamID()) - diffContacts := domain.ExtractsContactsDifference(contacts, req.Contacts) - - err = repo.Users.SavePhoneContact(diffContacts...) - if err != nil { - r.Log().Error("got error on saving phone contacts in to the db", zap.Error(err)) - } - - if len(diffContacts) <= 250 { - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - - // chunk contacts by size of 50 and send them to server - r.SDK().SyncCtrl().ContactsImport(req.Replace, da.OnComplete) + req := &msg.ContactsImport{} + if err := da.RequestData(req); err != nil { + return + } + + if da.TeamID() != 0 { + da.Response(rony.C_Error, errors.New("00", "teams cannot import contact")) + return + } + + // If only importing one contact then we don't need to calculate contacts hash + if len(req.Contacts) == 1 { + // send request to server + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + + oldHash, err := repo.System.LoadInt(domain.SkContactsImportHash) + if err != nil { + r.Log().Warn("got error on loading ContactsImportHash", zap.Error(err)) + } + // calculate ContactsImportHash and compare with oldHash + newHash := domain.CalculateContactsImportHash(req) + r.Log().Info("returned data locally, ContactsImport", + zap.Uint64("Old", oldHash), + zap.Uint64("New", newHash), + ) + if newHash == oldHash { + res := &msg.ContactsImported{ + ContactUsers: nil, + Users: nil, + Empty: true, + } + da.Response(msg.C_ContactsImported, res) + return + } + + // not equal save it to DB + err = repo.System.SaveInt(domain.SkContactsImportHash, newHash) + if err != nil { + r.Log().Error("got error on saving ContactsImportHash", zap.Error(err)) + } + + // extract differences between existing contacts and new contacts + _, contacts := repo.Users.GetContacts(da.TeamID()) + diffContacts := domain.ExtractsContactsDifference(contacts, req.Contacts) + + err = repo.Users.SavePhoneContact(diffContacts...) + if err != nil { + r.Log().Error("got error on saving phone contacts in to the db", zap.Error(err)) + } + + if len(diffContacts) <= 250 { + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + + // chunk contacts by size of 50 and send them to server + r.SDK().SyncCtrl().ContactsImport(req.Replace, da.OnComplete) } func (r *contact) contactsDelete(da request.Callback) { - if da.TeamID() != 0 { - da.Response(rony.C_Error, errors.New("00", "teams cannot delete contact")) - return - } + if da.TeamID() != 0 { + da.Response(rony.C_Error, errors.New("00", "teams cannot delete contact")) + return + } - req := &msg.ContactsDelete{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.ContactsDelete{} + if err := da.RequestData(req); err != nil { + return + } - _ = repo.Users.DeleteContact(da.TeamID(), req.UserIDs...) - _ = repo.System.SaveInt(domain.GetContactsGetHashKey(da.TeamID()), 0) + _ = repo.Users.DeleteContact(da.TeamID(), req.UserIDs...) + _ = repo.System.SaveInt(domain.GetContactsGetHashKey(da.TeamID()), 0) - r.SDK().QueueCtrl().EnqueueCommand(da) + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *contact) contactsDeleteAll(da request.Callback) { - req := &msg.ContactsDeleteAll{} - if err := da.RequestData(req); err != nil { - return - } - - _ = repo.Users.DeleteAllContacts(da.TeamID()) - _ = repo.System.SaveInt(domain.GetContactsGetHashKey(da.TeamID()), 0) - _ = repo.System.SaveInt(domain.SkContactsImportHash, 0) - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.ContactsDeleteAll{} + if err := da.RequestData(req); err != nil { + return + } + + _ = repo.Users.DeleteAllContacts(da.TeamID()) + _ = repo.System.SaveInt(domain.GetContactsGetHashKey(da.TeamID()), 0) + _ = repo.System.SaveInt(domain.SkContactsImportHash, 0) + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *contact) contactsGetTopPeers(da request.Callback) { - req := &msg.ContactsGetTopPeers{} - if err := da.RequestData(req); err != nil { - return - } - - res := &msg.ContactsTopPeers{} - topPeers, _ := repo.TopPeers.List(da.TeamID(), req.Category, req.Offset, req.Limit) - if len(topPeers) == 0 { - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - - res.Category = req.Category - res.Peers = topPeers - res.Count = int32(len(topPeers)) - - mUsers := domain.MInt64B{} - mGroups := domain.MInt64B{} - for _, topPeer := range res.Peers { - switch msg.PeerType(topPeer.Peer.Type) { - case msg.PeerType_PeerUser, msg.PeerType_PeerExternalUser: - mUsers[topPeer.Peer.ID] = true - case msg.PeerType_PeerGroup: - mGroups[topPeer.Peer.ID] = true - } - } - res.Groups, _ = repo.Groups.GetMany(mGroups.ToArray()) - if len(res.Groups) != len(mGroups) { - r.Log().Warn("found unmatched top peers groups", zap.Int("Got", len(res.Groups)), zap.Int("Need", len(mGroups))) - for groupID := range mGroups { - found := false - for _, g := range res.Groups { - if g.ID == groupID { - found = true - break - } - } - if !found { - r.Log().Warn("missed group", zap.Int64("GroupID", groupID)) - } - } - } - - res.Users, _ = repo.Users.GetMany(mUsers.ToArray()) - if len(res.Users) != len(mUsers) { - r.Log().Warn("found unmatched top peers users", zap.Int("Got", len(res.Users)), zap.Int("Need", len(mUsers))) - for userID := range mUsers { - found := false - for _, g := range res.Users { - if g.ID == userID { - found = true - break - } - } - if !found { - r.Log().Warn("missed user", zap.Int64("UserID", userID)) - } - } - } - - da.Response(msg.C_ContactsTopPeers, res) + req := &msg.ContactsGetTopPeers{} + if err := da.RequestData(req); err != nil { + return + } + + res := &msg.ContactsTopPeers{} + topPeers, _ := repo.TopPeers.List(da.TeamID(), req.Category, req.Offset, req.Limit) + if len(topPeers) == 0 { + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + + res.Category = req.Category + res.Peers = topPeers + res.Count = int32(len(topPeers)) + + mUsers := domain.MInt64B{} + mGroups := domain.MInt64B{} + for _, topPeer := range res.Peers { + switch msg.PeerType(topPeer.Peer.Type) { + case msg.PeerType_PeerUser, msg.PeerType_PeerExternalUser: + mUsers[topPeer.Peer.ID] = true + case msg.PeerType_PeerGroup: + mGroups[topPeer.Peer.ID] = true + } + } + res.Groups, _ = repo.Groups.GetMany(mGroups.ToArray()) + if len(res.Groups) != len(mGroups) { + r.Log().Warn("found unmatched top peers groups", zap.Int("Got", len(res.Groups)), zap.Int("Need", len(mGroups))) + for groupID := range mGroups { + found := false + for _, g := range res.Groups { + if g.ID == groupID { + found = true + break + } + } + if !found { + r.Log().Warn("missed group", zap.Int64("GroupID", groupID)) + } + } + } + + res.Users, _ = repo.Users.GetMany(mUsers.ToArray()) + if len(res.Users) != len(mUsers) { + r.Log().Warn("found unmatched top peers users", zap.Int("Got", len(res.Users)), zap.Int("Need", len(mUsers))) + for userID := range mUsers { + found := false + for _, g := range res.Users { + if g.ID == userID { + found = true + break + } + } + if !found { + r.Log().Warn("missed user", zap.Int64("UserID", userID)) + } + } + } + + da.Response(msg.C_ContactsTopPeers, res) } func (r *contact) contactsResetTopPeer(da request.Callback) { - req := &msg.ContactsResetTopPeer{} - if err := da.RequestData(req); err != nil { - return - } - - err := repo.TopPeers.Delete(req.Category, da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } - - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.ContactsResetTopPeer{} + if err := da.RequestData(req); err != nil { + return + } + + err := repo.TopPeers.Delete(req.Category, da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } + + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *contact) clientContactSearch(da request.Callback) { - req := &msg.ClientContactSearch{} - if err := da.RequestData(req); err != nil { - return - } - - searchPhrase := strings.ToLower(req.Text) - r.Log().Info("SearchContacts", zap.String("Phrase", searchPhrase)) - - users := &msg.UsersMany{} - contactUsers, _ := repo.Users.SearchContacts(da.TeamID(), searchPhrase) - userIDs := make([]int64, 0, len(contactUsers)) - for _, contactUser := range contactUsers { - userIDs = append(userIDs, contactUser.ID) - } - users.Users, _ = repo.Users.GetMany(userIDs) - - da.Response(msg.C_UsersMany, users) + req := &msg.ClientContactSearch{} + if err := da.RequestData(req); err != nil { + return + } + + searchPhrase := strings.ToLower(req.Text) + r.Log().Info("SearchContacts", zap.String("Phrase", searchPhrase)) + + users := &msg.UsersMany{} + contactUsers, _ := repo.Users.SearchContacts(da.TeamID(), searchPhrase) + userIDs := make([]int64, 0, len(contactUsers)) + for _, contactUser := range contactUsers { + userIDs = append(userIDs, contactUser.ID) + } + users.Users, _ = repo.Users.GetMany(userIDs) + + da.Response(msg.C_UsersMany, users) } diff --git a/module/contact/message_appliers.go b/module/contact/message_appliers.go index 52cc5c13..69a1832c 100644 --- a/module/contact/message_appliers.go +++ b/module/contact/message_appliers.go @@ -1,16 +1,17 @@ package contact import ( - "bytes" - "encoding/binary" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/uiexec" - "github.com/ronaksoft/rony" - "go.uber.org/zap" - "hash/crc32" - "sort" + "bytes" + "encoding/binary" + "hash/crc32" + "sort" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/uiexec" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -23,70 +24,70 @@ import ( */ func (r *contact) contactsImported(e *rony.MessageEnvelope) { - x := new(msg.ContactsImported) - if err := x.Unmarshal(e.Message); err != nil { - r.Log().Error("couldn't unmarshal ContactsImported", zap.Error(err)) - return - } + x := new(msg.ContactsImported) + if err := x.Unmarshal(e.Message); err != nil { + r.Log().Error("couldn't unmarshal ContactsImported", zap.Error(err)) + return + } - r.Log().Debug("applies contactsImported") + r.Log().Debug("applies contactsImported") - _ = repo.Users.SaveContact(domain.GetTeamID(e), x.ContactUsers...) - _ = repo.Users.Save(x.Users...) + _ = repo.Users.SaveContact(domain.GetTeamID(e), x.ContactUsers...) + _ = repo.Users.Save(x.Users...) } func (r *contact) contactsMany(e *rony.MessageEnvelope) { - x := new(msg.ContactsMany) - if err := x.Unmarshal(e.Message); err != nil { - r.Log().Error("couldn't unmarshal ContactsMany", zap.Error(err)) - return - } - r.Log().Debug("applies contactsMany", - zap.Int("Users", len(x.Users)), - zap.Int("Contacts", len(x.Contacts)), - ) + x := new(msg.ContactsMany) + if err := x.Unmarshal(e.Message); err != nil { + r.Log().Error("couldn't unmarshal ContactsMany", zap.Error(err)) + return + } + r.Log().Debug("applies contactsMany", + zap.Int("Users", len(x.Users)), + zap.Int("Contacts", len(x.Contacts)), + ) - // If contacts are modified in server, then first clear all the contacts and rewrite the new ones - if x.Modified { - _ = repo.Users.DeleteAllContacts(domain.GetTeamID(e)) - } + // If contacts are modified in server, then first clear all the contacts and rewrite the new ones + if x.Modified { + _ = repo.Users.DeleteAllContacts(domain.GetTeamID(e)) + } - // Sort the contact users by their ids - sort.Slice(x.ContactUsers, func(i, j int) bool { return x.ContactUsers[i].ID < x.ContactUsers[j].ID }) + // Sort the contact users by their ids + sort.Slice(x.ContactUsers, func(i, j int) bool { return x.ContactUsers[i].ID < x.ContactUsers[j].ID }) - _ = repo.Users.SaveContact(domain.GetTeamID(e), x.ContactUsers...) - _ = repo.Users.Save(x.Users...) + _ = repo.Users.SaveContact(domain.GetTeamID(e), x.ContactUsers...) + _ = repo.Users.Save(x.Users...) - if len(x.ContactUsers) > 0 { - buff := bytes.Buffer{} - b := make([]byte, 8) - for _, contactUser := range x.ContactUsers { - binary.BigEndian.PutUint64(b, uint64(contactUser.ID)) - buff.Write(b) - } - crc32Hash := crc32.ChecksumIEEE(buff.Bytes()) - err := repo.System.SaveInt(domain.GetContactsGetHashKey(domain.GetTeamID(e)), uint64(crc32Hash)) - if err != nil { - r.Log().Error("couldn't save ContactsHash in to the db", zap.Error(err)) - } - uiexec.ExecDataSynced(false, true, false) - } + if len(x.ContactUsers) > 0 { + buff := bytes.Buffer{} + b := make([]byte, 8) + for _, contactUser := range x.ContactUsers { + binary.BigEndian.PutUint64(b, uint64(contactUser.ID)) + buff.Write(b) + } + crc32Hash := crc32.ChecksumIEEE(buff.Bytes()) + err := repo.System.SaveInt(domain.GetContactsGetHashKey(domain.GetTeamID(e)), uint64(crc32Hash)) + if err != nil { + r.Log().Error("couldn't save ContactsHash in to the db", zap.Error(err)) + } + uiexec.ExecDataSynced(false, true, false) + } } func (r *contact) contactsTopPeers(e *rony.MessageEnvelope) { - u := &msg.ContactsTopPeers{} - err := u.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal ContactsTopPeers", zap.Error(err)) - return - } + u := &msg.ContactsTopPeers{} + err := u.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal ContactsTopPeers", zap.Error(err)) + return + } - r.Log().Debug("applies ContactsTopPeers", - zap.Int("L", len(u.Peers)), - zap.String("Cat", u.Category.String()), - ) - err = repo.TopPeers.Save(u.Category, r.SDK().SyncCtrl().GetUserID(), domain.GetTeamID(e), u.Peers...) - if err != nil { - r.Log().Error("got error on saving ContactsTopPeers", zap.Error(err)) - } + r.Log().Debug("applies ContactsTopPeers", + zap.Int("L", len(u.Peers)), + zap.String("Cat", u.Category.String()), + ) + err = repo.TopPeers.Save(u.Category, r.SDK().SyncCtrl().GetUserID(), domain.GetTeamID(e), u.Peers...) + if err != nil { + r.Log().Error("got error on saving ContactsTopPeers", zap.Error(err)) + } } diff --git a/module/gif/gif.go b/module/gif/gif.go index 9e1c40e6..fe89972a 100644 --- a/module/gif/gif.go +++ b/module/gif/gif.go @@ -1,10 +1,10 @@ package gif import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -17,26 +17,26 @@ import ( */ type gif struct { - module.Base + module.Base } func New() *gif { - r := &gif{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_GifDelete: r.gifDelete, - msg.C_GifGetSaved: r.gifGetSaved, - msg.C_GifSave: r.gifSave, - }, - ) - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_SavedGifs: r.savedGifs, - }, - ) - return r + r := &gif{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_GifDelete: r.gifDelete, + msg.C_GifGetSaved: r.gifGetSaved, + msg.C_GifSave: r.gifSave, + }, + ) + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_SavedGifs: r.savedGifs, + }, + ) + return r } func (r *gif) Name() string { - return module.Gif + return module.Gif } diff --git a/module/gif/handlers.go b/module/gif/handlers.go index cfc26cfe..465fd647 100644 --- a/module/gif/handlers.go +++ b/module/gif/handlers.go @@ -1,12 +1,12 @@ package gif import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -19,78 +19,78 @@ import ( */ func (r *gif) gifSave(da request.Callback) { - req := &msg.GifSave{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.GifSave{} + if err := da.RequestData(req); err != nil { + return + } - cf, err := repo.Files.Get(req.Doc.ClusterID, req.Doc.ID, req.Doc.AccessHash) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "00", Items: err.Error()}) - return - } + cf, err := repo.Files.Get(req.Doc.ClusterID, req.Doc.ID, req.Doc.AccessHash) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "00", Items: err.Error()}) + return + } - r.Log().Info("are saving GIF", - zap.Int64("FileID", cf.FileID), - zap.Uint64("AccessHash", cf.AccessHash), - zap.Int32("ClusterID", cf.ClusterID), - ) - if !repo.Gifs.IsSaved(cf.ClusterID, cf.FileID) { - md := &msg.MediaDocument{ - Doc: &msg.Document{ - ID: cf.FileID, - AccessHash: cf.AccessHash, - Date: 0, - MimeType: cf.MimeType, - FileSize: int32(cf.FileSize), - Version: cf.Version, - ClusterID: cf.ClusterID, - Attributes: req.Attributes, - MD5Checksum: cf.MD5Checksum, - }, - } - err = repo.Gifs.Save(md) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "00", Items: err.Error()}) - return - } - } - _ = repo.Gifs.UpdateLastAccess(cf.ClusterID, cf.FileID, domain.Now().Unix()) + r.Log().Info("are saving GIF", + zap.Int64("FileID", cf.FileID), + zap.Uint64("AccessHash", cf.AccessHash), + zap.Int32("ClusterID", cf.ClusterID), + ) + if !repo.Gifs.IsSaved(cf.ClusterID, cf.FileID) { + md := &msg.MediaDocument{ + Doc: &msg.Document{ + ID: cf.FileID, + AccessHash: cf.AccessHash, + Date: 0, + MimeType: cf.MimeType, + FileSize: int32(cf.FileSize), + Version: cf.Version, + ClusterID: cf.ClusterID, + Attributes: req.Attributes, + MD5Checksum: cf.MD5Checksum, + }, + } + err = repo.Gifs.Save(md) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "00", Items: err.Error()}) + return + } + } + _ = repo.Gifs.UpdateLastAccess(cf.ClusterID, cf.FileID, domain.Now().Unix()) - r.SDK().QueueCtrl().EnqueueCommand(da) + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *gif) gifDelete(da request.Callback) { - req := &msg.GifDelete{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.GifDelete{} + if err := da.RequestData(req); err != nil { + return + } - err := repo.Gifs.Delete(req.Doc.ClusterID, req.Doc.ID) - if err != nil { - r.Log().Warn("got error on deleting GIF document", zap.Error(err)) - } + err := repo.Gifs.Delete(req.Doc.ClusterID, req.Doc.ID) + if err != nil { + r.Log().Warn("got error on deleting GIF document", zap.Error(err)) + } - r.SDK().QueueCtrl().EnqueueCommand(da) + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *gif) gifGetSaved(da request.Callback) { - req := &msg.GifGetSaved{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.GifGetSaved{} + if err := da.RequestData(req); err != nil { + return + } - gifHash, _ := repo.System.LoadInt(domain.SkGifHash) + gifHash, _ := repo.System.LoadInt(domain.SkGifHash) - if gifHash != 0 { - res, err := repo.Gifs.GetSaved() - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "00", Items: err.Error()}) - return - } - da.Response(msg.C_SavedGifs, res) - } + if gifHash != 0 { + res, err := repo.Gifs.GetSaved() + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "00", Items: err.Error()}) + return + } + da.Response(msg.C_SavedGifs, res) + } - // TODO:: set ui to false - r.SDK().QueueCtrl().EnqueueCommand(da) + // TODO:: set ui to false + r.SDK().QueueCtrl().EnqueueCommand(da) } diff --git a/module/gif/message_appliers.go b/module/gif/message_appliers.go index 165cb0ba..09264ce5 100644 --- a/module/gif/message_appliers.go +++ b/module/gif/message_appliers.go @@ -1,12 +1,12 @@ package gif import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/uiexec" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/uiexec" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -19,36 +19,36 @@ import ( */ func (r *gif) savedGifs(e *rony.MessageEnvelope) { - u := &msg.SavedGifs{} - err := u.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal savedGifs", zap.Error(err)) - return - } + u := &msg.SavedGifs{} + err := u.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal savedGifs", zap.Error(err)) + return + } - accessTime := domain.Now().Unix() - for _, d := range u.Docs { - err = repo.Files.SaveGif(d) - if err != nil { - r.Log().Warn("got error on applying SavedGifs (Save File)", zap.Error(err)) - } - if !repo.Gifs.IsSaved(d.Doc.ClusterID, d.Doc.ID) { - err = repo.Gifs.Save(d) - if err != nil { - r.Log().Warn("got error on applying SavedGifs (Save Gif)", zap.Error(err)) - } - err = repo.Gifs.UpdateLastAccess(d.Doc.ClusterID, d.Doc.ID, accessTime) - if err != nil { - r.Log().Warn("got error on applying SavedGifs (Update Access Time)", zap.Error(err)) - } - } - } - oldHash, _ := repo.System.LoadInt(domain.SkGifHash) - err = repo.System.SaveInt(domain.SkGifHash, uint64(u.Hash)) - if err != nil { - r.Log().Warn("got error on saving GifHash", zap.Error(err)) - } - if oldHash != uint64(u.Hash) { - uiexec.ExecDataSynced(false, false, true) - } + accessTime := domain.Now().Unix() + for _, d := range u.Docs { + err = repo.Files.SaveGif(d) + if err != nil { + r.Log().Warn("got error on applying SavedGifs (Save File)", zap.Error(err)) + } + if !repo.Gifs.IsSaved(d.Doc.ClusterID, d.Doc.ID) { + err = repo.Gifs.Save(d) + if err != nil { + r.Log().Warn("got error on applying SavedGifs (Save Gif)", zap.Error(err)) + } + err = repo.Gifs.UpdateLastAccess(d.Doc.ClusterID, d.Doc.ID, accessTime) + if err != nil { + r.Log().Warn("got error on applying SavedGifs (Update Access Time)", zap.Error(err)) + } + } + } + oldHash, _ := repo.System.LoadInt(domain.SkGifHash) + err = repo.System.SaveInt(domain.SkGifHash, uint64(u.Hash)) + if err != nil { + r.Log().Warn("got error on saving GifHash", zap.Error(err)) + } + if oldHash != uint64(u.Hash) { + uiexec.ExecDataSynced(false, false, true) + } } diff --git a/module/group/group.go b/module/group/group.go index 8ee91b45..2cd51ece 100644 --- a/module/group/group.go +++ b/module/group/group.go @@ -1,10 +1,10 @@ package group import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -17,38 +17,38 @@ import ( */ type group struct { - module.Base + module.Base } func New() *group { - r := &group{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_GroupsAddUser: r.groupAddUser, - msg.C_GroupsDeleteUser: r.groupDeleteUser, - msg.C_GroupsEditTitle: r.groupsEditTitle, - msg.C_GroupsGetFull: r.groupsGetFull, - msg.C_GroupsRemovePhoto: r.groupRemovePhoto, - msg.C_GroupsToggleAdmins: r.groupToggleAdmin, - msg.C_GroupsUpdateAdmin: r.groupUpdateAdmin, - }, - ) - r.RegisterUpdateAppliers( - map[int64]domain.UpdateApplier{ - msg.C_UpdateGroupAdmins: r.updateGroupAdmins, - msg.C_UpdateGroupAdminOnly: r.updateGroupAdminOnly, - msg.C_UpdateGroupParticipantAdmin: r.updateGroupParticipantAdmin, - msg.C_UpdateGroupPhoto: r.updateGroupPhoto, - }, - ) - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_GroupFull: r.groupFull, - }, - ) - return r + r := &group{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_GroupsAddUser: r.groupAddUser, + msg.C_GroupsDeleteUser: r.groupDeleteUser, + msg.C_GroupsEditTitle: r.groupsEditTitle, + msg.C_GroupsGetFull: r.groupsGetFull, + msg.C_GroupsRemovePhoto: r.groupRemovePhoto, + msg.C_GroupsToggleAdmins: r.groupToggleAdmin, + msg.C_GroupsUpdateAdmin: r.groupUpdateAdmin, + }, + ) + r.RegisterUpdateAppliers( + map[int64]domain.UpdateApplier{ + msg.C_UpdateGroupAdmins: r.updateGroupAdmins, + msg.C_UpdateGroupAdminOnly: r.updateGroupAdminOnly, + msg.C_UpdateGroupParticipantAdmin: r.updateGroupParticipantAdmin, + msg.C_UpdateGroupPhoto: r.updateGroupPhoto, + }, + ) + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_GroupFull: r.groupFull, + }, + ) + return r } func (r *group) Name() string { - return module.Group + return module.Group } diff --git a/module/group/handlers.go b/module/group/handlers.go index 3f71d973..dc954142 100644 --- a/module/group/handlers.go +++ b/module/group/handlers.go @@ -1,11 +1,11 @@ package group import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "go.uber.org/zap" ) /* @@ -18,144 +18,144 @@ import ( */ func (r *group) groupsEditTitle(da request.Callback) { - req := &msg.GroupsEditTitle{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.GroupsEditTitle{} + if err := da.RequestData(req); err != nil { + return + } - repo.Groups.UpdateTitle(req.GroupID, req.Title) + repo.Groups.UpdateTitle(req.GroupID, req.Title) - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *group) groupAddUser(da request.Callback) { - req := &msg.GroupsAddUser{} - if err := da.RequestData(req); err != nil { - return - } - - user, _ := repo.Users.Get(req.User.UserID) - if user != nil { - gp := &msg.GroupParticipant{ - AccessHash: req.User.AccessHash, - FirstName: user.FirstName, - LastName: user.LastName, - UserID: req.User.UserID, - Type: msg.ParticipantType_ParticipantTypeMember, - } - _ = repo.Groups.AddParticipant(req.GroupID, gp) - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.GroupsAddUser{} + if err := da.RequestData(req); err != nil { + return + } + + user, _ := repo.Users.Get(req.User.UserID) + if user != nil { + gp := &msg.GroupParticipant{ + AccessHash: req.User.AccessHash, + FirstName: user.FirstName, + LastName: user.LastName, + UserID: req.User.UserID, + Type: msg.ParticipantType_ParticipantTypeMember, + } + _ = repo.Groups.AddParticipant(req.GroupID, gp) + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *group) groupDeleteUser(da request.Callback) { - req := &msg.GroupsDeleteUser{} - if err := da.RequestData(req); err != nil { - return - } - - err := repo.Groups.RemoveParticipant(req.GroupID, req.User.UserID) - if err != nil { - r.Log().Error("got error on GroupDeleteUser local handler", zap.Error(err)) - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.GroupsDeleteUser{} + if err := da.RequestData(req); err != nil { + return + } + + err := repo.Groups.RemoveParticipant(req.GroupID, req.User.UserID) + if err != nil { + r.Log().Error("got error on GroupDeleteUser local handler", zap.Error(err)) + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *group) groupsGetFull(da request.Callback) { - req := &msg.GroupsGetFull{} - if err := da.RequestData(req); err != nil { - return - } - - res, err := repo.Groups.GetFull(req.GroupID) - if err != nil { - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - - // NotifySettings - dlg, _ := repo.Dialogs.Get(da.TeamID(), req.GroupID, int32(msg.PeerType_PeerGroup)) - if dlg == nil { - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - res.NotifySettings = dlg.NotifySettings - - // Get Group PhotoGallery - res.PhotoGallery, err = repo.Groups.GetPhotoGallery(req.GroupID) - if err != nil { - r.Log().Error("got error on GetPhotoGallery in local handler", zap.Error(err)) - } - - // Users - userIDs := domain.MInt64B{} - for _, v := range res.Participants { - userIDs[v.UserID] = true - } - users, _ := repo.Users.GetMany(userIDs.ToArray()) - if len(res.Participants) != len(users) { - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - res.Users = users - da.Response(msg.C_GroupFull, res) + req := &msg.GroupsGetFull{} + if err := da.RequestData(req); err != nil { + return + } + + res, err := repo.Groups.GetFull(req.GroupID) + if err != nil { + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + + // NotifySettings + dlg, _ := repo.Dialogs.Get(da.TeamID(), req.GroupID, int32(msg.PeerType_PeerGroup)) + if dlg == nil { + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + res.NotifySettings = dlg.NotifySettings + + // Get Group PhotoGallery + res.PhotoGallery, err = repo.Groups.GetPhotoGallery(req.GroupID) + if err != nil { + r.Log().Error("got error on GetPhotoGallery in local handler", zap.Error(err)) + } + + // Users + userIDs := domain.MInt64B{} + for _, v := range res.Participants { + userIDs[v.UserID] = true + } + users, _ := repo.Users.GetMany(userIDs.ToArray()) + if len(res.Participants) != len(users) { + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + res.Users = users + da.Response(msg.C_GroupFull, res) } func (r *group) groupUpdateAdmin(da request.Callback) { - req := &msg.GroupsUpdateAdmin{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.GroupsUpdateAdmin{} + if err := da.RequestData(req); err != nil { + return + } - repo.Groups.UpdateMemberType(req.GroupID, req.User.UserID, req.Admin) + repo.Groups.UpdateMemberType(req.GroupID, req.User.UserID, req.Admin) - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *group) groupToggleAdmin(da request.Callback) { - req := &msg.GroupsToggleAdmins{} - if err := da.RequestData(req); err != nil { - return - } - - err := repo.Groups.ToggleAdmins(req.GroupID, req.AdminEnabled) - if err != nil { - r.Log().Warn("got error on local handler for GroupToggleAdmin", zap.Error(err)) - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.GroupsToggleAdmins{} + if err := da.RequestData(req); err != nil { + return + } + + err := repo.Groups.ToggleAdmins(req.GroupID, req.AdminEnabled) + if err != nil { + r.Log().Warn("got error on local handler for GroupToggleAdmin", zap.Error(err)) + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *group) groupRemovePhoto(da request.Callback) { - req := &msg.GroupsRemovePhoto{} - if err := da.RequestData(req); err != nil { - return - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) - - group, _ := repo.Groups.Get(req.GroupID) - if group == nil { - return - } - - if group.Photo != nil && group.Photo.PhotoID == req.PhotoID { - _ = repo.Groups.UpdatePhoto(req.GroupID, &msg.GroupPhoto{ - PhotoBig: &msg.FileLocation{}, - PhotoSmall: &msg.FileLocation{}, - PhotoID: 0, - }) - } - - _ = repo.Users.RemovePhotoGallery(r.SDK().GetConnInfo().PickupUserID(), req.PhotoID) + req := &msg.GroupsRemovePhoto{} + if err := da.RequestData(req); err != nil { + return + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) + + group, _ := repo.Groups.Get(req.GroupID) + if group == nil { + return + } + + if group.Photo != nil && group.Photo.PhotoID == req.PhotoID { + _ = repo.Groups.UpdatePhoto(req.GroupID, &msg.GroupPhoto{ + PhotoBig: &msg.FileLocation{}, + PhotoSmall: &msg.FileLocation{}, + PhotoID: 0, + }) + } + + _ = repo.Users.RemovePhotoGallery(r.SDK().GetConnInfo().PickupUserID(), req.PhotoID) } diff --git a/module/group/message_appliers.go b/module/group/message_appliers.go index a115227f..cac1e5ef 100644 --- a/module/group/message_appliers.go +++ b/module/group/message_appliers.go @@ -1,10 +1,10 @@ package group import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -17,28 +17,28 @@ import ( */ func (r *group) groupFull(e *rony.MessageEnvelope) { - u := new(msg.GroupFull) - err := u.Unmarshal(e.Message) - if err != nil { - r.Log().Error(" couldn't unmarshal GroupFull", zap.Error(err)) - return - } - r.Log().Debug(" applies GroupFull", - zap.Int64("GroupID", u.Group.ID), - ) + u := new(msg.GroupFull) + err := u.Unmarshal(e.Message) + if err != nil { + r.Log().Error(" couldn't unmarshal GroupFull", zap.Error(err)) + return + } + r.Log().Debug(" applies GroupFull", + zap.Int64("GroupID", u.Group.ID), + ) - // save GroupSearch - err = repo.Groups.SaveFull(u) - if err != nil { - r.Log().Error(" couldn't save GroupFull", zap.Error(err)) - } - err = repo.Groups.Save(u.Group) - if err != nil { - r.Log().Error(" couldn't save GroupFull's Group", zap.Error(err)) - } + // save GroupSearch + err = repo.Groups.SaveFull(u) + if err != nil { + r.Log().Error(" couldn't save GroupFull", zap.Error(err)) + } + err = repo.Groups.Save(u.Group) + if err != nil { + r.Log().Error(" couldn't save GroupFull's Group", zap.Error(err)) + } - // Save Users, and notify settings - _ = repo.Users.Save(u.Users...) - _ = repo.Groups.SavePhotoGallery(u.Group.ID, u.PhotoGallery...) - _ = repo.Dialogs.UpdateNotifySetting(u.Group.TeamID, u.Group.ID, int32(msg.PeerType_PeerGroup), u.NotifySettings) + // Save Users, and notify settings + _ = repo.Users.Save(u.Users...) + _ = repo.Groups.SavePhotoGallery(u.Group.ID, u.PhotoGallery...) + _ = repo.Dialogs.UpdateNotifySetting(u.Group.TeamID, u.Group.ID, int32(msg.PeerType_PeerGroup), u.NotifySettings) } diff --git a/module/group/update_appliers.go b/module/group/update_appliers.go index 6d3d5406..07228a86 100644 --- a/module/group/update_appliers.go +++ b/module/group/update_appliers.go @@ -1,9 +1,9 @@ package group import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "go.uber.org/zap" ) /* @@ -16,96 +16,96 @@ import ( */ func (r *group) updateGroupParticipantAdmin(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateGroupParticipantAdmin{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateGroupParticipantAdmin", - zap.Int64("UpdateID", x.UpdateID), - ) - - res := []*msg.UpdateEnvelope{u} - repo.Groups.UpdateMemberType(x.GroupID, x.UserID, x.IsAdmin) - return res, nil + x := &msg.UpdateGroupParticipantAdmin{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateGroupParticipantAdmin", + zap.Int64("UpdateID", x.UpdateID), + ) + + res := []*msg.UpdateEnvelope{u} + repo.Groups.UpdateMemberType(x.GroupID, x.UserID, x.IsAdmin) + return res, nil } func (r *group) updateGroupPhoto(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateGroupPhoto) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug(" applies UpdateGroupPhoto", - zap.Int64("GroupID", x.GroupID), - zap.Int64("UpdateID", x.UpdateID), - zap.Int64("PhotoID", x.PhotoID), - ) - - if x.Photo != nil { - _ = repo.Groups.UpdatePhoto(x.GroupID, x.Photo) - } - - if x.PhotoID != 0 { - if x.Photo != nil && x.Photo.PhotoSmall.FileID != 0 { - _ = repo.Groups.SavePhotoGallery(x.GroupID, x.Photo) - } else { - _ = repo.Groups.RemovePhotoGallery(x.GroupID, x.PhotoID) - } - } - - groupFull, _ := repo.Groups.GetFull(x.GroupID) - if groupFull != nil { - group, _ := repo.Groups.Get(x.GroupID) - if group != nil { - groupFull.Group = group - _ = repo.Groups.SaveFull(groupFull) - } - } - - res := []*msg.UpdateEnvelope{u} - return res, nil + x := new(msg.UpdateGroupPhoto) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug(" applies UpdateGroupPhoto", + zap.Int64("GroupID", x.GroupID), + zap.Int64("UpdateID", x.UpdateID), + zap.Int64("PhotoID", x.PhotoID), + ) + + if x.Photo != nil { + _ = repo.Groups.UpdatePhoto(x.GroupID, x.Photo) + } + + if x.PhotoID != 0 { + if x.Photo != nil && x.Photo.PhotoSmall.FileID != 0 { + _ = repo.Groups.SavePhotoGallery(x.GroupID, x.Photo) + } else { + _ = repo.Groups.RemovePhotoGallery(x.GroupID, x.PhotoID) + } + } + + groupFull, _ := repo.Groups.GetFull(x.GroupID) + if groupFull != nil { + group, _ := repo.Groups.Get(x.GroupID) + if group != nil { + groupFull.Group = group + _ = repo.Groups.SaveFull(groupFull) + } + } + + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *group) updateGroupAdmins(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateGroupAdmins{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug(" applies UpdateGroupAdmins", - zap.Int64("GroupID", x.GroupID), - zap.Int64("UpdateID", x.UpdateID), - ) - - res := []*msg.UpdateEnvelope{u} - return res, nil + x := &msg.UpdateGroupAdmins{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug(" applies UpdateGroupAdmins", + zap.Int64("GroupID", x.GroupID), + zap.Int64("UpdateID", x.UpdateID), + ) + + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *group) updateGroupAdminOnly(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateGroupAdminOnly{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug(" applies UpdateGroupAdminOnly", - zap.Int64("GroupID", x.GroupID), - zap.Int64("UpdateID", x.UpdateID), - ) - - group, _ := repo.Groups.Get(x.GroupID) - if group != nil { - dialog, _ := repo.Dialogs.Get(group.TeamID, group.ID, int32(msg.PeerType_PeerGroup)) - if dialog != nil { - dialog.ReadOnly = repo.Groups.HasFlag(group.Flags, msg.GroupFlags_GroupFlagsAdminOnly) && !repo.Groups.HasFlag(group.Flags, msg.GroupFlags_GroupFlagsAdmin) - _ = repo.Dialogs.Save(dialog) - } - } - - res := []*msg.UpdateEnvelope{u} - return res, nil + x := &msg.UpdateGroupAdminOnly{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug(" applies UpdateGroupAdminOnly", + zap.Int64("GroupID", x.GroupID), + zap.Int64("UpdateID", x.UpdateID), + ) + + group, _ := repo.Groups.Get(x.GroupID) + if group != nil { + dialog, _ := repo.Dialogs.Get(group.TeamID, group.ID, int32(msg.PeerType_PeerGroup)) + if dialog != nil { + dialog.ReadOnly = repo.Groups.HasFlag(group.Flags, msg.GroupFlags_GroupFlagsAdminOnly) && !repo.Groups.HasFlag(group.Flags, msg.GroupFlags_GroupFlagsAdmin) + _ = repo.Dialogs.Save(dialog) + } + } + + res := []*msg.UpdateEnvelope{u} + return res, nil } diff --git a/module/label/handlers.go b/module/label/handlers.go index d30cf8a9..584fd25d 100644 --- a/module/label/handlers.go +++ b/module/label/handlers.go @@ -1,14 +1,15 @@ package label import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/registry" - "go.uber.org/zap" - "sort" + "sort" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/registry" + "go.uber.org/zap" ) /* @@ -21,176 +22,176 @@ import ( */ func (r *label) labelsGet(da request.Callback) { - req := &msg.LabelsGet{} - if err := da.RequestData(req); err != nil { - return - } - - r.Log().Info("LabelGet", zap.Int64("TeamID", da.TeamID())) - labels, _ := repo.Labels.GetAll(da.TeamID()) - sort.Slice(labels, func(i, j int) bool { - return labels[i].Count > labels[j].Count - }) - if len(labels) != 0 { - r.Log().Debug("found labels locally", zap.Int("L", len(labels))) - res := &msg.LabelsMany{} - res.Labels = labels - da.Response(msg.C_LabelsMany, res) - return - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.LabelsGet{} + if err := da.RequestData(req); err != nil { + return + } + + r.Log().Info("LabelGet", zap.Int64("TeamID", da.TeamID())) + labels, _ := repo.Labels.GetAll(da.TeamID()) + sort.Slice(labels, func(i, j int) bool { + return labels[i].Count > labels[j].Count + }) + if len(labels) != 0 { + r.Log().Debug("found labels locally", zap.Int("L", len(labels))) + res := &msg.LabelsMany{} + res.Labels = labels + da.Response(msg.C_LabelsMany, res) + return + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *label) labelsDelete(da request.Callback) { - req := &msg.LabelsDelete{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.LabelsDelete{} + if err := da.RequestData(req); err != nil { + return + } - r.Log().Info("LabelsDelete", zap.Int64("TeamID", da.TeamID())) - err := repo.Labels.Delete(req.LabelIDs...) + r.Log().Info("LabelsDelete", zap.Int64("TeamID", da.TeamID())) + err := repo.Labels.Delete(req.LabelIDs...) - r.Log().ErrorOnErr("LabelsDelete", err) + r.Log().ErrorOnErr("LabelsDelete", err) - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *label) labelsListItems(da request.Callback) { - req := &msg.LabelsListItems{} - if err := da.RequestData(req); err != nil { - return - } - - // Offline mode - if !r.SDK().NetCtrl().Connected() { - r.Log().Debug("are offline then load from local db", - zap.Int32("LabelID", req.LabelID), - zap.Int64("MinID", req.MinID), - zap.Int64("MaxID", req.MaxID), - ) - messages, users, groups := repo.Labels.ListMessages(req.LabelID, da.TeamID(), req.Limit, req.MinID, req.MaxID) - fillLabelItems(da, messages, users, groups) - return - } - - da.SetPreComplete(r.getLabelsListItemsCB(da.TeamID(), req.MinID, req.MaxID, req.LabelID)) - switch { - case req.MinID == 0 && req.MaxID == 0: - r.SDK().QueueCtrl().EnqueueCommand(da) - case req.MinID == 0 && req.MaxID != 0: - b, _ := repo.Labels.GetLowerFilled(da.TeamID(), req.LabelID, req.MaxID) - if !b { - r.Log().Info("detected label hole (With MaxID Only)", - zap.Int32("LabelID", req.LabelID), - zap.Int64("MaxID", req.MaxID), - zap.Int64("MinID", req.MinID), - ) - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - messages, users, groups := repo.Labels.ListMessages(req.LabelID, da.TeamID(), req.Limit, 0, req.MaxID) - fillLabelItems(da, messages, users, groups) - case req.MinID != 0 && req.MaxID == 0: - b, _ := repo.Labels.GetUpperFilled(da.TeamID(), req.LabelID, req.MinID) - if !b { - r.Log().Info("detected label hole (With MinID Only)", - zap.Int32("LabelID", req.LabelID), - zap.Int64("MinID", req.MinID), - zap.Int64("MaxID", req.MaxID), - ) - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - messages, users, groups := repo.Labels.ListMessages(req.LabelID, da.TeamID(), req.Limit, req.MinID, 0) - fillLabelItems(da, messages, users, groups) - default: - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } + req := &msg.LabelsListItems{} + if err := da.RequestData(req); err != nil { + return + } + + // Offline mode + if !r.SDK().NetCtrl().Connected() { + r.Log().Debug("are offline then load from local db", + zap.Int32("LabelID", req.LabelID), + zap.Int64("MinID", req.MinID), + zap.Int64("MaxID", req.MaxID), + ) + messages, users, groups := repo.Labels.ListMessages(req.LabelID, da.TeamID(), req.Limit, req.MinID, req.MaxID) + fillLabelItems(da, messages, users, groups) + return + } + + da.SetPreComplete(r.getLabelsListItemsCB(da.TeamID(), req.MinID, req.MaxID, req.LabelID)) + switch { + case req.MinID == 0 && req.MaxID == 0: + r.SDK().QueueCtrl().EnqueueCommand(da) + case req.MinID == 0 && req.MaxID != 0: + b, _ := repo.Labels.GetLowerFilled(da.TeamID(), req.LabelID, req.MaxID) + if !b { + r.Log().Info("detected label hole (With MaxID Only)", + zap.Int32("LabelID", req.LabelID), + zap.Int64("MaxID", req.MaxID), + zap.Int64("MinID", req.MinID), + ) + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + messages, users, groups := repo.Labels.ListMessages(req.LabelID, da.TeamID(), req.Limit, 0, req.MaxID) + fillLabelItems(da, messages, users, groups) + case req.MinID != 0 && req.MaxID == 0: + b, _ := repo.Labels.GetUpperFilled(da.TeamID(), req.LabelID, req.MinID) + if !b { + r.Log().Info("detected label hole (With MinID Only)", + zap.Int32("LabelID", req.LabelID), + zap.Int64("MinID", req.MinID), + zap.Int64("MaxID", req.MaxID), + ) + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + messages, users, groups := repo.Labels.ListMessages(req.LabelID, da.TeamID(), req.Limit, req.MinID, 0) + fillLabelItems(da, messages, users, groups) + default: + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } } func (r *label) getLabelsListItemsCB(teamID int64, minID, maxID int64, labelID int32) domain.MessageHandler { - return func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_LabelItems: - x := &msg.LabelItems{} - err := x.Unmarshal(m.Message) - r.Log().WarnOnErr("Error On Unmarshal LabelItems", err) - - // 1st sort the received messages by id - sort.Slice(x.Messages, func(i, j int) bool { - return x.Messages[i].ID > x.Messages[j].ID - }) - - // Fill Messages Hole - if msgCount := len(x.Messages); msgCount > 0 { - r.Log().Debug("Update Label Range", - zap.Int32("LabelID", x.LabelID), - zap.Int64("MinID", x.Messages[msgCount-1].ID), - zap.Int64("MaxID", x.Messages[0].ID), - ) - - switch { - case minID == 0 && maxID != 0: - _ = repo.Labels.Fill(teamID, labelID, x.Messages[msgCount-1].ID, maxID) - case minID != 0 && maxID == 0: - _ = repo.Labels.Fill(teamID, labelID, minID, x.Messages[0].ID) - case minID == 0 && maxID == 0: - _ = repo.Labels.Fill(teamID, labelID, x.Messages[msgCount-1].ID, x.Messages[0].ID) - } - } - default: - r.Log().Warn("received unexpected response", zap.String("C", registry.ConstructorName(m.Constructor))) - } - } + return func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_LabelItems: + x := &msg.LabelItems{} + err := x.Unmarshal(m.Message) + r.Log().WarnOnErr("Error On Unmarshal LabelItems", err) + + // 1st sort the received messages by id + sort.Slice(x.Messages, func(i, j int) bool { + return x.Messages[i].ID > x.Messages[j].ID + }) + + // Fill Messages Hole + if msgCount := len(x.Messages); msgCount > 0 { + r.Log().Debug("Update Label Range", + zap.Int32("LabelID", x.LabelID), + zap.Int64("MinID", x.Messages[msgCount-1].ID), + zap.Int64("MaxID", x.Messages[0].ID), + ) + + switch { + case minID == 0 && maxID != 0: + _ = repo.Labels.Fill(teamID, labelID, x.Messages[msgCount-1].ID, maxID) + case minID != 0 && maxID == 0: + _ = repo.Labels.Fill(teamID, labelID, minID, x.Messages[0].ID) + case minID == 0 && maxID == 0: + _ = repo.Labels.Fill(teamID, labelID, x.Messages[msgCount-1].ID, x.Messages[0].ID) + } + } + default: + r.Log().Warn("received unexpected response", zap.String("C", registry.ConstructorName(m.Constructor))) + } + } } func (r *label) labelAddToMessage(da request.Callback) { - req := &msg.LabelsAddToMessage{} - if err := da.RequestData(req); err != nil { - return - } - - r.Log().Debug("LabelsAddToMessage local handler called", - zap.Int64s("MsgIDs", req.MessageIDs), - zap.Int32s("LabelIDs", req.LabelIDs), - ) - if len(req.MessageIDs) != 0 { - _ = repo.Labels.AddLabelsToMessages(req.LabelIDs, da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MessageIDs) - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.LabelsAddToMessage{} + if err := da.RequestData(req); err != nil { + return + } + + r.Log().Debug("LabelsAddToMessage local handler called", + zap.Int64s("MsgIDs", req.MessageIDs), + zap.Int32s("LabelIDs", req.LabelIDs), + ) + if len(req.MessageIDs) != 0 { + _ = repo.Labels.AddLabelsToMessages(req.LabelIDs, da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MessageIDs) + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *label) labelRemoveFromMessage(da request.Callback) { - req := &msg.LabelsRemoveFromMessage{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.LabelsRemoveFromMessage{} + if err := da.RequestData(req); err != nil { + return + } - r.Log().Debug("LabelsRemoveFromMessage local handler called", - zap.Int64s("MsgIDs", req.MessageIDs), - zap.Int32s("LabelIDs", req.LabelIDs), - ) + r.Log().Debug("LabelsRemoveFromMessage local handler called", + zap.Int64s("MsgIDs", req.MessageIDs), + zap.Int32s("LabelIDs", req.LabelIDs), + ) - if len(req.MessageIDs) != 0 { - _ = repo.Labels.RemoveLabelsFromMessages(req.LabelIDs, da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MessageIDs) - } + if len(req.MessageIDs) != 0 { + _ = repo.Labels.RemoveLabelsFromMessages(req.LabelIDs, da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MessageIDs) + } - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func fillLabelItems(da request.Callback, messages []*msg.UserMessage, users []*msg.User, groups []*msg.Group) { - res := new(msg.LabelItems) - res.Messages = messages - res.Users = users - res.Groups = groups + res := new(msg.LabelItems) + res.Messages = messages + res.Users = users + res.Groups = groups - da.Response(msg.C_LabelItems, res) + da.Response(msg.C_LabelItems, res) } diff --git a/module/label/label.go b/module/label/label.go index c9613a44..e63ea5a0 100644 --- a/module/label/label.go +++ b/module/label/label.go @@ -1,10 +1,10 @@ package label import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -17,37 +17,37 @@ import ( */ type label struct { - module.Base + module.Base } func New() *label { - r := &label{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_LabelsAddToMessage: r.labelAddToMessage, - msg.C_LabelsDelete: r.labelsDelete, - msg.C_LabelsGet: r.labelsGet, - msg.C_LabelsListItems: r.labelsListItems, - msg.C_LabelsRemoveFromMessage: r.labelRemoveFromMessage, - }, - ) - r.RegisterUpdateAppliers( - map[int64]domain.UpdateApplier{ - msg.C_UpdateLabelDeleted: r.updateLabelDeleted, - msg.C_UpdateLabelItemsAdded: r.updateLabelItemsAdded, - msg.C_UpdateLabelItemsRemoved: r.updateLabelItemsRemoved, - msg.C_UpdateLabelSet: r.updateLabelSet, - }, - ) - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_LabelItems: r.labelItems, - msg.C_LabelsMany: r.labelsMany, - }, - ) - return r + r := &label{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_LabelsAddToMessage: r.labelAddToMessage, + msg.C_LabelsDelete: r.labelsDelete, + msg.C_LabelsGet: r.labelsGet, + msg.C_LabelsListItems: r.labelsListItems, + msg.C_LabelsRemoveFromMessage: r.labelRemoveFromMessage, + }, + ) + r.RegisterUpdateAppliers( + map[int64]domain.UpdateApplier{ + msg.C_UpdateLabelDeleted: r.updateLabelDeleted, + msg.C_UpdateLabelItemsAdded: r.updateLabelItemsAdded, + msg.C_UpdateLabelItemsRemoved: r.updateLabelItemsRemoved, + msg.C_UpdateLabelSet: r.updateLabelSet, + }, + ) + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_LabelItems: r.labelItems, + msg.C_LabelsMany: r.labelsMany, + }, + ) + return r } func (r *label) Name() string { - return module.Label + return module.Label } diff --git a/module/label/message_appliers.go b/module/label/message_appliers.go index a5ac85d9..9c9d715c 100644 --- a/module/label/message_appliers.go +++ b/module/label/message_appliers.go @@ -1,11 +1,11 @@ package label import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -18,30 +18,30 @@ import ( */ func (r *label) labelsMany(e *rony.MessageEnvelope) { - u := &msg.LabelsMany{} - err := u.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal LabelsMany", zap.Error(err)) - return - } + u := &msg.LabelsMany{} + err := u.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal LabelsMany", zap.Error(err)) + return + } - r.Log().Debug("applies LabelsMany", zap.Any("TeamID", e.Get("TeamID", "0"))) + r.Log().Debug("applies LabelsMany", zap.Any("TeamID", e.Get("TeamID", "0"))) - err = repo.Labels.Save(domain.GetTeamID(e), u.Labels...) - r.Log().WarnOnErr("got error on applying LabelsMany", err) + err = repo.Labels.Save(domain.GetTeamID(e), u.Labels...) + r.Log().WarnOnErr("got error on applying LabelsMany", err) } func (r *label) labelItems(e *rony.MessageEnvelope) { - u := &msg.LabelItems{} - err := u.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal LabelItems", zap.Error(err)) - return - } - - r.Log().Debug("applies LabelItems") - - _ = repo.Messages.Save(u.Messages...) - _ = repo.Users.Save(u.Users...) - _ = repo.Groups.Save(u.Groups...) + u := &msg.LabelItems{} + err := u.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal LabelItems", zap.Error(err)) + return + } + + r.Log().Debug("applies LabelItems") + + _ = repo.Messages.Save(u.Messages...) + _ = repo.Users.Save(u.Users...) + _ = repo.Groups.Save(u.Groups...) } diff --git a/module/label/update_appliers.go b/module/label/update_appliers.go index 77e09a0c..46b628f3 100644 --- a/module/label/update_appliers.go +++ b/module/label/update_appliers.go @@ -1,9 +1,9 @@ package label import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "go.uber.org/zap" ) /* @@ -16,92 +16,92 @@ import ( */ func (r *label) updateLabelItemsAdded(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateLabelItemsAdded{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateLabelItemsAdded", - zap.Int64("UpdateID", x.UpdateID), - zap.Int64s("MsgIDs", x.MessageIDs), - zap.Int32s("LabelIDs", x.LabelIDs), - ) - - if len(x.MessageIDs) != 0 { - err := repo.Labels.AddLabelsToMessages(x.LabelIDs, x.TeamID, x.Peer.ID, x.Peer.Type, x.MessageIDs) - if err != nil { - return nil, err - } - } - - err = repo.Labels.Save(x.TeamID, x.Labels...) - if err != nil { - return nil, err - } - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateLabelItemsAdded{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateLabelItemsAdded", + zap.Int64("UpdateID", x.UpdateID), + zap.Int64s("MsgIDs", x.MessageIDs), + zap.Int32s("LabelIDs", x.LabelIDs), + ) + + if len(x.MessageIDs) != 0 { + err := repo.Labels.AddLabelsToMessages(x.LabelIDs, x.TeamID, x.Peer.ID, x.Peer.Type, x.MessageIDs) + if err != nil { + return nil, err + } + } + + err = repo.Labels.Save(x.TeamID, x.Labels...) + if err != nil { + return nil, err + } + return []*msg.UpdateEnvelope{u}, nil } func (r *label) updateLabelItemsRemoved(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateLabelItemsRemoved{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateLabelItemsRemoved", - zap.Int64("UpdateID", x.UpdateID), - zap.Int64s("MsgIDs", x.MessageIDs), - zap.Int32s("LabelIDs", x.LabelIDs), - zap.Int64("TeamID", x.TeamID), - ) - - if len(x.MessageIDs) != 0 { - err := repo.Labels.RemoveLabelsFromMessages(x.LabelIDs, x.TeamID, x.Peer.ID, x.Peer.Type, x.MessageIDs) - if err != nil { - return nil, err - } - } - - err = repo.Labels.Save(x.TeamID, x.Labels...) - if err != nil { - return nil, err - } - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateLabelItemsRemoved{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateLabelItemsRemoved", + zap.Int64("UpdateID", x.UpdateID), + zap.Int64s("MsgIDs", x.MessageIDs), + zap.Int32s("LabelIDs", x.LabelIDs), + zap.Int64("TeamID", x.TeamID), + ) + + if len(x.MessageIDs) != 0 { + err := repo.Labels.RemoveLabelsFromMessages(x.LabelIDs, x.TeamID, x.Peer.ID, x.Peer.Type, x.MessageIDs) + if err != nil { + return nil, err + } + } + + err = repo.Labels.Save(x.TeamID, x.Labels...) + if err != nil { + return nil, err + } + return []*msg.UpdateEnvelope{u}, nil } func (r *label) updateLabelSet(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateLabelSet{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateLabelSet", - zap.Int64("UpdateID", x.UpdateID), - ) - - err = repo.Labels.Set(x.Labels...) - if err != nil { - return nil, err - } - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateLabelSet{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateLabelSet", + zap.Int64("UpdateID", x.UpdateID), + ) + + err = repo.Labels.Set(x.Labels...) + if err != nil { + return nil, err + } + return []*msg.UpdateEnvelope{u}, nil } func (r *label) updateLabelDeleted(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateLabelDeleted{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateLabelDeleted", - zap.Int64("UpdateID", x.UpdateID), - ) - - err = repo.Labels.Delete(x.LabelIDs...) - if err != nil { - return nil, err - } - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateLabelDeleted{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateLabelDeleted", + zap.Int64("UpdateID", x.UpdateID), + ) + + err = repo.Labels.Delete(x.LabelIDs...) + if err != nil { + return nil, err + } + return []*msg.UpdateEnvelope{u}, nil } diff --git a/module/message/handlers.go b/module/message/handlers.go index f31a55ea..d34dd411 100644 --- a/module/message/handlers.go +++ b/module/message/handlers.go @@ -1,33 +1,34 @@ package message import ( - "bytes" - "encoding/json" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/hole" - "git.ronaksoft.com/river/sdk/internal/logs" - mon "git.ronaksoft.com/river/sdk/internal/monitoring" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/internal/salt" - "github.com/dustin/go-humanize" - "github.com/olekukonko/tablewriter" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "io" - "io/ioutil" - "os" - "path" - "path/filepath" - "runtime" - "runtime/pprof" - "sort" - "strings" - "time" + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "os" + "path" + "path/filepath" + "runtime" + "runtime/pprof" + "sort" + "strings" + "time" + + "github.com/dustin/go-humanize" + "github.com/olekukonko/tablewriter" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/hole" + "github.com/ronaksoft/river-sdk/internal/logs" + mon "github.com/ronaksoft/river-sdk/internal/monitoring" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/internal/salt" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) /* @@ -40,1083 +41,1083 @@ import ( */ func (r *message) messagesGetDialogs(da request.Callback) { - req := &msg.MessagesGetDialogs{} - if err := da.RequestData(req); err != nil { - return - } - res := &msg.MessagesDialogs{} - res.Dialogs, _ = repo.Dialogs.List(da.TeamID(), req.Offset, req.Limit) - res.Count = repo.Dialogs.CountDialogs(da.TeamID()) - - // If the localDB had no data send the request to server - if len(res.Dialogs) == 0 { - res.UpdateID = r.SDK().SyncCtrl().GetUpdateID() - da.Response(msg.C_MessagesDialogs, res) - return - } - - pendingMessages := repo.PendingMessages.GetAndConvertAll() - dialogPMs := make(map[string]*msg.UserMessage, len(pendingMessages)) - for _, pm := range pendingMessages { - keyID := fmt.Sprintf("%d.%d", pm.PeerID, pm.PeerType) - v, ok := dialogPMs[keyID] - if !ok { - dialogPMs[keyID] = pm - } else if pm.ID < v.ID { - dialogPMs[keyID] = pm - } - } - mUsers := domain.MInt64B{} - mGroups := domain.MInt64B{} - mMessages := domain.MInt64B{} - for _, dialog := range res.Dialogs { - if dialog.PeerType == int32(msg.PeerType_PeerUser) { - if dialog.PeerID != 0 { - mUsers[dialog.PeerID] = true - } - } - mMessages[dialog.TopMessageID] = true - keyID := fmt.Sprintf("%d.%d", dialog.PeerID, dialog.PeerType) - if pm, ok := dialogPMs[keyID]; ok { - dialog.TopMessageID = pm.ID - } - } - - // Load Messages - res.Messages, _ = repo.Messages.GetMany(mMessages.ToArray()) - - // Load Pending messages - res.Messages = append(res.Messages, pendingMessages...) - for _, m := range res.Messages { - switch msg.PeerType(m.PeerType) { - case msg.PeerType_PeerUser: - mUsers[m.PeerID] = true - case msg.PeerType_PeerGroup: - mGroups[m.PeerID] = true - } - if m.SenderID != 0 { - mUsers[m.SenderID] = true - } - if m.FwdSenderID != 0 { - mUsers[m.FwdSenderID] = true - } - - // load MessageActionData users - actUserIDs := domain.ExtractActionUserIDs(m.MessageAction, m.MessageActionData) - for _, id := range actUserIDs { - if id != 0 { - mUsers[id] = true - } - } - } - res.Groups, _ = repo.Groups.GetMany(mGroups.ToArray()) - if len(res.Groups) != len(mGroups) { - r.Log().Warn("found unmatched dialog groups", zap.Int("Got", len(res.Groups)), zap.Int("Need", len(mGroups))) - for groupID := range mGroups { - found := false - for _, g := range res.Groups { - if g.ID == groupID { - found = true - break - } - } - if !found { - r.Log().Warn("missed group", zap.Int64("GroupID", groupID)) - } - } - } - res.Users, _ = repo.Users.GetMany(mUsers.ToArray()) - if len(res.Users) != len(mUsers) { - r.Log().Warn("found unmatched dialog users", zap.Int("Got", len(res.Users)), zap.Int("Need", len(mUsers))) - for userID := range mUsers { - found := false - for _, g := range res.Users { - if g.ID == userID { - found = true - break - } - } - if !found { - r.Log().Warn("missed user", zap.Int64("UserID", userID)) - } - } - } - - da.Response(msg.C_MessagesDialogs, res) + req := &msg.MessagesGetDialogs{} + if err := da.RequestData(req); err != nil { + return + } + res := &msg.MessagesDialogs{} + res.Dialogs, _ = repo.Dialogs.List(da.TeamID(), req.Offset, req.Limit) + res.Count = repo.Dialogs.CountDialogs(da.TeamID()) + + // If the localDB had no data send the request to server + if len(res.Dialogs) == 0 { + res.UpdateID = r.SDK().SyncCtrl().GetUpdateID() + da.Response(msg.C_MessagesDialogs, res) + return + } + + pendingMessages := repo.PendingMessages.GetAndConvertAll() + dialogPMs := make(map[string]*msg.UserMessage, len(pendingMessages)) + for _, pm := range pendingMessages { + keyID := fmt.Sprintf("%d.%d", pm.PeerID, pm.PeerType) + v, ok := dialogPMs[keyID] + if !ok { + dialogPMs[keyID] = pm + } else if pm.ID < v.ID { + dialogPMs[keyID] = pm + } + } + mUsers := domain.MInt64B{} + mGroups := domain.MInt64B{} + mMessages := domain.MInt64B{} + for _, dialog := range res.Dialogs { + if dialog.PeerType == int32(msg.PeerType_PeerUser) { + if dialog.PeerID != 0 { + mUsers[dialog.PeerID] = true + } + } + mMessages[dialog.TopMessageID] = true + keyID := fmt.Sprintf("%d.%d", dialog.PeerID, dialog.PeerType) + if pm, ok := dialogPMs[keyID]; ok { + dialog.TopMessageID = pm.ID + } + } + + // Load Messages + res.Messages, _ = repo.Messages.GetMany(mMessages.ToArray()) + + // Load Pending messages + res.Messages = append(res.Messages, pendingMessages...) + for _, m := range res.Messages { + switch msg.PeerType(m.PeerType) { + case msg.PeerType_PeerUser: + mUsers[m.PeerID] = true + case msg.PeerType_PeerGroup: + mGroups[m.PeerID] = true + } + if m.SenderID != 0 { + mUsers[m.SenderID] = true + } + if m.FwdSenderID != 0 { + mUsers[m.FwdSenderID] = true + } + + // load MessageActionData users + actUserIDs := domain.ExtractActionUserIDs(m.MessageAction, m.MessageActionData) + for _, id := range actUserIDs { + if id != 0 { + mUsers[id] = true + } + } + } + res.Groups, _ = repo.Groups.GetMany(mGroups.ToArray()) + if len(res.Groups) != len(mGroups) { + r.Log().Warn("found unmatched dialog groups", zap.Int("Got", len(res.Groups)), zap.Int("Need", len(mGroups))) + for groupID := range mGroups { + found := false + for _, g := range res.Groups { + if g.ID == groupID { + found = true + break + } + } + if !found { + r.Log().Warn("missed group", zap.Int64("GroupID", groupID)) + } + } + } + res.Users, _ = repo.Users.GetMany(mUsers.ToArray()) + if len(res.Users) != len(mUsers) { + r.Log().Warn("found unmatched dialog users", zap.Int("Got", len(res.Users)), zap.Int("Need", len(mUsers))) + for userID := range mUsers { + found := false + for _, g := range res.Users { + if g.ID == userID { + found = true + break + } + } + if !found { + r.Log().Warn("missed user", zap.Int64("UserID", userID)) + } + } + } + + da.Response(msg.C_MessagesDialogs, res) } func (r *message) messagesGetDialog(da request.Callback) { - req := &msg.MessagesGetDialog{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.MessagesGetDialog{} + if err := da.RequestData(req); err != nil { + return + } - res, err := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + res, err := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - // if the localDB had no data send the request to server - if err != nil { - r.Log().Warn("got error on repo GetDialog", zap.Error(err), zap.Int64("PeerID", req.Peer.ID)) - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } + // if the localDB had no data send the request to server + if err != nil { + r.Log().Warn("got error on repo GetDialog", zap.Error(err), zap.Int64("PeerID", req.Peer.ID)) + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } - da.Response(msg.C_Dialog, res) + da.Response(msg.C_Dialog, res) } func (r *message) messagesSend(da request.Callback) { - req := &msg.MessagesSend{} - if err := da.RequestData(req); err != nil { - return - } - - // do not allow empty message - if strings.TrimSpace(req.Body) == "" { - e := &rony.Error{ - Code: "n/a", - Items: "empty message is not allowed", - } - da.Response(rony.C_Error, e) - return - } - - // for saved messages we have special cases for debugging purpose - if req.Peer.ID == r.SDK().GetConnInfo().PickupUserID() { - r.handleDebugActions(req.Body) - } - - // this will be used as next requestID - req.RandomID = domain.SequentialUniqueID() - msgID := -req.RandomID - res, err := repo.PendingMessages.Save(da.TeamID(), da.TeamAccess(), msgID, r.SDK().GetConnInfo().PickupUserID(), req) - if err != nil { - e := &rony.Error{ - Code: "n/a", - Items: "Failed to save to pendingMessages : " + err.Error(), - } - da.Response(rony.C_Error, e) - return - } - - // using req randomID as requestID later in queue processing and network controller messageHandler - da.Discard() - r.SDK().QueueCtrl().EnqueueCommand( - request.NewCallback( - da.TeamID(), da.TeamAccess(), uint64(req.RandomID), msg.C_MessagesSend, req, - nil, nil, nil, da.UI(), da.Flags(), da.Timeout(), - ), - ) - - // return to CallBack with pending message data : Done - // later when queue got processed and server returned response we should check if the requestID - // exist in pendingTable we remove it and insert new message with new id to message table - // invoke new OnUpdate with new proto buffer to inform ui that pending message got delivered - da.Response(msg.C_ClientPendingMessage, res) + req := &msg.MessagesSend{} + if err := da.RequestData(req); err != nil { + return + } + + // do not allow empty message + if strings.TrimSpace(req.Body) == "" { + e := &rony.Error{ + Code: "n/a", + Items: "empty message is not allowed", + } + da.Response(rony.C_Error, e) + return + } + + // for saved messages we have special cases for debugging purpose + if req.Peer.ID == r.SDK().GetConnInfo().PickupUserID() { + r.handleDebugActions(req.Body) + } + + // this will be used as next requestID + req.RandomID = domain.SequentialUniqueID() + msgID := -req.RandomID + res, err := repo.PendingMessages.Save(da.TeamID(), da.TeamAccess(), msgID, r.SDK().GetConnInfo().PickupUserID(), req) + if err != nil { + e := &rony.Error{ + Code: "n/a", + Items: "Failed to save to pendingMessages : " + err.Error(), + } + da.Response(rony.C_Error, e) + return + } + + // using req randomID as requestID later in queue processing and network controller messageHandler + da.Discard() + r.SDK().QueueCtrl().EnqueueCommand( + request.NewCallback( + da.TeamID(), da.TeamAccess(), uint64(req.RandomID), msg.C_MessagesSend, req, + nil, nil, nil, da.UI(), da.Flags(), da.Timeout(), + ), + ) + + // return to CallBack with pending message data : Done + // later when queue got processed and server returned response we should check if the requestID + // exist in pendingTable we remove it and insert new message with new id to message table + // invoke new OnUpdate with new proto buffer to inform ui that pending message got delivered + da.Response(msg.C_ClientPendingMessage, res) } func (r *message) handleDebugActions(txt string) { - parts := strings.Fields(strings.ToLower(txt)) - if len(parts) == 0 { - return - } - cmd := parts[0] - args := parts[1:] - switch cmd { - case "//sdk_clear_salt": - r.resetSalt() - case "//sdk_memory_stats": - r.sendToSavedMessage(tools.ByteToStr(r.getMemoryStats())) - case "//sdk_monitor": - txt := tools.ByteToStr(r.getMonitorStats()) - r.sendToSavedMessage( - txt, - &msg.MessageEntity{ - Type: msg.MessageEntityType_MessageEntityTypeCode, - Offset: 0, - Length: int32(len(txt)), - UserID: 0, - }, - ) - case "//sdk_monitor_reset": - mon.ResetUsage() - case "//sdk_live_logger": - username := r.SDK().GetConnInfo().PickupUsername() - if len(args) < 1 { - if username == "" { - r.sendToSavedMessage("//sdk_live_logger ") - } else { - r.liveLogger(fmt.Sprintf("https://livelog.ronaksoftware.com/%s", username)) - } - return - } - - r.liveLogger(args[0]) - case "//sdk_heap_profile": - filePath := r.heapProfile() - if filePath == "" { - r.sendToSavedMessage("something wrong, check sdk logs") - } - r.sendMediaToSaveMessage(filePath, "SdkHeapProfile.out") - case "//sdk_logs_clear": - _ = filepath.Walk(logs.Directory(), func(path string, info os.FileInfo, err error) error { - if strings.HasSuffix(info.Name(), ".log") { - _ = os.Remove(path) - } - return nil - }) - case "//sdk_logs": - r.sendLogs() - case "//sdk_logs_update": - r.sendUpdateLogs() - case "//sdk_export_messages": - if len(args) < 2 { - r.Log().Warn("invalid args: //sdk_export_messages [peerType] [peerID]") - return - } - peerType := tools.StrToInt32(args[0]) - peerID := tools.StrToInt64(args[1]) - r.sendMediaToSaveMessage(r.exportMessages(peerType, peerID), fmt.Sprintf("Messages-%s-%d.txt", msg.PeerType(peerType).String(), peerID)) - case "//sdk_update_state_get": - r.getUpdateState() - case "//sdk_update_state_set": - r.setUpdateState(tools.StrToInt64(args[0])) - } + parts := strings.Fields(strings.ToLower(txt)) + if len(parts) == 0 { + return + } + cmd := parts[0] + args := parts[1:] + switch cmd { + case "//sdk_clear_salt": + r.resetSalt() + case "//sdk_memory_stats": + r.sendToSavedMessage(tools.ByteToStr(r.getMemoryStats())) + case "//sdk_monitor": + txt := tools.ByteToStr(r.getMonitorStats()) + r.sendToSavedMessage( + txt, + &msg.MessageEntity{ + Type: msg.MessageEntityType_MessageEntityTypeCode, + Offset: 0, + Length: int32(len(txt)), + UserID: 0, + }, + ) + case "//sdk_monitor_reset": + mon.ResetUsage() + case "//sdk_live_logger": + username := r.SDK().GetConnInfo().PickupUsername() + if len(args) < 1 { + if username == "" { + r.sendToSavedMessage("//sdk_live_logger ") + } else { + r.liveLogger(fmt.Sprintf("https://livelog.ronaksoftware.com/%s", username)) + } + return + } + + r.liveLogger(args[0]) + case "//sdk_heap_profile": + filePath := r.heapProfile() + if filePath == "" { + r.sendToSavedMessage("something wrong, check sdk logs") + } + r.sendMediaToSaveMessage(filePath, "SdkHeapProfile.out") + case "//sdk_logs_clear": + _ = filepath.Walk(logs.Directory(), func(path string, info os.FileInfo, err error) error { + if strings.HasSuffix(info.Name(), ".log") { + _ = os.Remove(path) + } + return nil + }) + case "//sdk_logs": + r.sendLogs() + case "//sdk_logs_update": + r.sendUpdateLogs() + case "//sdk_export_messages": + if len(args) < 2 { + r.Log().Warn("invalid args: //sdk_export_messages [peerType] [peerID]") + return + } + peerType := tools.StrToInt32(args[0]) + peerID := tools.StrToInt64(args[1]) + r.sendMediaToSaveMessage(r.exportMessages(peerType, peerID), fmt.Sprintf("Messages-%s-%d.txt", msg.PeerType(peerType).String(), peerID)) + case "//sdk_update_state_get": + r.getUpdateState() + case "//sdk_update_state_set": + r.setUpdateState(tools.StrToInt64(args[0])) + } } func (r *message) sendToSavedMessage(body string, entities ...*msg.MessageEntity) { - req := &msg.MessagesSend{ - RandomID: 0, - Peer: &msg.InputPeer{ - ID: r.SDK().GetConnInfo().PickupUserID(), - Type: msg.PeerType_PeerUser, - AccessHash: 0, - }, - Body: body, - ReplyTo: 0, - ClearDraft: true, - Entities: entities, - } - - r.messagesSend( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_MessagesSend, req, - nil, nil, nil, false, 0, 0, - ), - ) + req := &msg.MessagesSend{ + RandomID: 0, + Peer: &msg.InputPeer{ + ID: r.SDK().GetConnInfo().PickupUserID(), + Type: msg.PeerType_PeerUser, + AccessHash: 0, + }, + Body: body, + ReplyTo: 0, + ClearDraft: true, + Entities: entities, + } + + r.messagesSend( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_MessagesSend, req, + nil, nil, nil, false, 0, 0, + ), + ) } func (r *message) sendMediaToSaveMessage(filePath string, filename string) { - attrFile := msg.DocumentAttributeFile{Filename: filename} - attBytes, _ := attrFile.Marshal() - req := &msg.ClientSendMessageMedia{ - Peer: &msg.InputPeer{ - ID: r.SDK().GetConnInfo().PickupUserID(), - Type: msg.PeerType_PeerUser, - AccessHash: 0, - }, - MediaType: msg.InputMediaType_InputMediaTypeUploadedDocument, - Caption: "", - FileName: filename, - FilePath: filePath, - ThumbFilePath: "", - FileMIME: "", - ThumbMIME: "", - ReplyTo: 0, - ClearDraft: false, - Attributes: []*msg.DocumentAttribute{ - {Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attBytes}, - }, - FileUploadID: "", - ThumbUploadID: "", - FileID: 0, - ThumbID: 0, - FileTotalParts: 0, - } - r.clientSendMessageMedia( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_MessagesSend, req, - nil, nil, nil, false, 0, 0, - ), - ) + attrFile := msg.DocumentAttributeFile{Filename: filename} + attBytes, _ := attrFile.Marshal() + req := &msg.ClientSendMessageMedia{ + Peer: &msg.InputPeer{ + ID: r.SDK().GetConnInfo().PickupUserID(), + Type: msg.PeerType_PeerUser, + AccessHash: 0, + }, + MediaType: msg.InputMediaType_InputMediaTypeUploadedDocument, + Caption: "", + FileName: filename, + FilePath: filePath, + ThumbFilePath: "", + FileMIME: "", + ThumbMIME: "", + ReplyTo: 0, + ClearDraft: false, + Attributes: []*msg.DocumentAttribute{ + {Type: msg.DocumentAttributeType_AttributeTypeFile, Data: attBytes}, + }, + FileUploadID: "", + ThumbUploadID: "", + FileID: 0, + ThumbID: 0, + FileTotalParts: 0, + } + r.clientSendMessageMedia( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_MessagesSend, req, + nil, nil, nil, false, 0, 0, + ), + ) } func (r *message) exportMessages(peerType int32, peerID int64) (filePath string) { - filePath = path.Join(repo.DirCache, fmt.Sprintf("Messages-%s-%d.txt", msg.PeerType(peerType).String(), peerID)) - file, err := os.Create(filePath) - if err != nil { - r.Log().Error("Error On Create file", zap.Error(err)) - } - - t := tablewriter.NewWriter(file) - t.SetHeader([]string{"ID", "Date", "Sender", "Body", "Media"}) - maxID, _ := repo.Messages.GetTopMessageID(domain.GetCurrTeamID(), peerID, peerType) - limit := int32(100) - cnt := 0 - for { - ms, us, _ := repo.Messages.GetMessageHistory(domain.GetCurrTeamID(), peerID, peerType, 0, maxID, limit) - usMap := make(map[int64]*msg.User) - for _, u := range us { - usMap[u.ID] = u - } - for _, m := range ms { - b := m.Body - if idx := strings.Index(m.Body, "\n"); idx < 0 { - if len(m.Body) > 100 { - b = m.Body[:100] - } - } else if idx < 100 { - b = m.Body[:idx] - } else { - b = m.Body[:100] - } - t.Append([]string{ - fmt.Sprintf("%d", m.ID), - time.Unix(m.CreatedOn, 0).Format("02 Jan 06 3:04PM"), - fmt.Sprintf("%s %s", usMap[m.SenderID].FirstName, usMap[m.SenderID].LastName), - b, - m.MediaType.String(), - }) - cnt++ - if maxID > m.ID { - maxID = m.ID - } - } - - if int32(len(ms)) < limit { - break - } - } - t.SetFooter([]string{"Total", fmt.Sprintf("%d", cnt), "", "", ""}) - t.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false}) - t.SetCenterSeparator("|") - t.Render() - _, _ = io.WriteString(file, "\n\n") - return + filePath = path.Join(repo.DirCache, fmt.Sprintf("Messages-%s-%d.txt", msg.PeerType(peerType).String(), peerID)) + file, err := os.Create(filePath) + if err != nil { + r.Log().Error("Error On Create file", zap.Error(err)) + } + + t := tablewriter.NewWriter(file) + t.SetHeader([]string{"ID", "Date", "Sender", "Body", "Media"}) + maxID, _ := repo.Messages.GetTopMessageID(domain.GetCurrTeamID(), peerID, peerType) + limit := int32(100) + cnt := 0 + for { + ms, us, _ := repo.Messages.GetMessageHistory(domain.GetCurrTeamID(), peerID, peerType, 0, maxID, limit) + usMap := make(map[int64]*msg.User) + for _, u := range us { + usMap[u.ID] = u + } + for _, m := range ms { + b := m.Body + if idx := strings.Index(m.Body, "\n"); idx < 0 { + if len(m.Body) > 100 { + b = m.Body[:100] + } + } else if idx < 100 { + b = m.Body[:idx] + } else { + b = m.Body[:100] + } + t.Append([]string{ + fmt.Sprintf("%d", m.ID), + time.Unix(m.CreatedOn, 0).Format("02 Jan 06 3:04PM"), + fmt.Sprintf("%s %s", usMap[m.SenderID].FirstName, usMap[m.SenderID].LastName), + b, + m.MediaType.String(), + }) + cnt++ + if maxID > m.ID { + maxID = m.ID + } + } + + if int32(len(ms)) < limit { + break + } + } + t.SetFooter([]string{"Total", fmt.Sprintf("%d", cnt), "", "", ""}) + t.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false}) + t.SetCenterSeparator("|") + t.Render() + _, _ = io.WriteString(file, "\n\n") + return } func (r *message) resetSalt() { - salt.Reset() - r.sendToSavedMessage("SDK salt is cleared") + salt.Reset() + r.sendToSavedMessage("SDK salt is cleared") } func (r *message) getMemoryStats() []byte { - ms := new(runtime.MemStats) - runtime.ReadMemStats(ms) - m := domain.M{ - "HeapAlloc": humanize.Bytes(ms.HeapAlloc), - "HeapInuse": humanize.Bytes(ms.HeapInuse), - "HeapIdle": humanize.Bytes(ms.HeapIdle), - "HeapObjects": ms.HeapObjects, - } - b, _ := json.MarshalIndent(m, "", " ") - r.sendToSavedMessage(tools.ByteToStr(b)) - return b + ms := new(runtime.MemStats) + runtime.ReadMemStats(ms) + m := domain.M{ + "HeapAlloc": humanize.Bytes(ms.HeapAlloc), + "HeapInuse": humanize.Bytes(ms.HeapInuse), + "HeapIdle": humanize.Bytes(ms.HeapIdle), + "HeapObjects": ms.HeapObjects, + } + b, _ := json.MarshalIndent(m, "", " ") + r.sendToSavedMessage(tools.ByteToStr(b)) + return b } func (r *message) getMonitorStats() []byte { - lsmSize, logSize := repo.DbSize() - s := mon.Stats - m := domain.M{ - "ServerAvgTime": (time.Duration(s.AvgResponseTime) * time.Millisecond).String(), - "ServerRequests": s.TotalServerRequests, - "RecordTime": time.Since(s.StartTime).String(), - "ForegroundTime": (time.Duration(s.ForegroundTime) * time.Second).String(), - "SentMessages": s.SentMessages, - "SentMedia": s.SentMedia, - "ReceivedMessages": s.ReceivedMessages, - "ReceivedMedia": s.ReceivedMedia, - "Upload": humanize.Bytes(uint64(s.TotalUploadBytes)), - "Download": humanize.Bytes(uint64(s.TotalDownloadBytes)), - "LsmSize": humanize.Bytes(uint64(lsmSize)), - "LogSize": humanize.Bytes(uint64(logSize)), - "Version": r.SDK().Version(), - } - - b, _ := json.MarshalIndent(m, "", " ") - return b + lsmSize, logSize := repo.DbSize() + s := mon.Stats + m := domain.M{ + "ServerAvgTime": (time.Duration(s.AvgResponseTime) * time.Millisecond).String(), + "ServerRequests": s.TotalServerRequests, + "RecordTime": time.Since(s.StartTime).String(), + "ForegroundTime": (time.Duration(s.ForegroundTime) * time.Second).String(), + "SentMessages": s.SentMessages, + "SentMedia": s.SentMedia, + "ReceivedMessages": s.ReceivedMessages, + "ReceivedMedia": s.ReceivedMedia, + "Upload": humanize.Bytes(uint64(s.TotalUploadBytes)), + "Download": humanize.Bytes(uint64(s.TotalDownloadBytes)), + "LsmSize": humanize.Bytes(uint64(lsmSize)), + "LogSize": humanize.Bytes(uint64(logSize)), + "Version": r.SDK().Version(), + } + + b, _ := json.MarshalIndent(m, "", " ") + return b } func (r *message) liveLogger(url string) { - logs.SetRemoteLog(url) - r.sendToSavedMessage("Live Logger is On") + logs.SetRemoteLog(url) + r.sendToSavedMessage("Live Logger is On") } func (r *message) heapProfile() (filePath string) { - buf := new(bytes.Buffer) - err := pprof.WriteHeapProfile(buf) - if err != nil { - r.Log().Error("got error on getting heap profile", zap.Error(err)) - return "" - } - now := time.Now() - filePath = path.Join(repo.DirCache, fmt.Sprintf("MemHeap-%04d-%02d-%02d.out", now.Year(), now.Month(), now.Day())) - if err := ioutil.WriteFile(filePath, buf.Bytes(), os.ModePerm); err != nil { - r.Log().Warn("got error on creating memory heap file", zap.Error(err)) - return "" - } - return + buf := new(bytes.Buffer) + err := pprof.WriteHeapProfile(buf) + if err != nil { + r.Log().Error("got error on getting heap profile", zap.Error(err)) + return "" + } + now := time.Now() + filePath = path.Join(repo.DirCache, fmt.Sprintf("MemHeap-%04d-%02d-%02d.out", now.Year(), now.Month(), now.Day())) + if err := ioutil.WriteFile(filePath, buf.Bytes(), os.ModePerm); err != nil { + r.Log().Warn("got error on creating memory heap file", zap.Error(err)) + return "" + } + return } func (r *message) sendUpdateLogs() { - _ = filepath.Walk(logs.Directory(), func(path string, info os.FileInfo, err error) error { - if strings.HasPrefix(info.Name(), "UPDT") { - r.sendMediaToSaveMessage(path, info.Name()) - } - return nil - }) + _ = filepath.Walk(logs.Directory(), func(path string, info os.FileInfo, err error) error { + if strings.HasPrefix(info.Name(), "UPDT") { + r.sendMediaToSaveMessage(path, info.Name()) + } + return nil + }) } func (r *message) sendLogs() { - _ = filepath.Walk(logs.Directory(), func(filePath string, info os.FileInfo, err error) error { - if err != nil { - return nil - } - if strings.HasPrefix(info.Name(), "LOG") { - outPath := path.Join(repo.DirCache, info.Name()) - err = domain.CopyFile(filePath, outPath) - if err != nil { - return err - } - r.sendMediaToSaveMessage(outPath, info.Name()) - } - return nil - }) + _ = filepath.Walk(logs.Directory(), func(filePath string, info os.FileInfo, err error) error { + if err != nil { + return nil + } + if strings.HasPrefix(info.Name(), "LOG") { + outPath := path.Join(repo.DirCache, info.Name()) + err = domain.CopyFile(filePath, outPath) + if err != nil { + return err + } + r.sendMediaToSaveMessage(outPath, info.Name()) + } + return nil + }) } func (r *message) getUpdateState() { - r.sendToSavedMessage(fmt.Sprintf("UpdateState is %d", r.SDK().SyncCtrl().GetUpdateID())) + r.sendToSavedMessage(fmt.Sprintf("UpdateState is %d", r.SDK().SyncCtrl().GetUpdateID())) } func (r *message) setUpdateState(updateID int64) { - r.sendToSavedMessage(fmt.Sprintf("UpdateState set to: %d", updateID)) - _ = r.SDK().SyncCtrl().SetUpdateID(updateID) - go r.SDK().SyncCtrl().Sync() + r.sendToSavedMessage(fmt.Sprintf("UpdateState set to: %d", updateID)) + _ = r.SDK().SyncCtrl().SetUpdateID(updateID) + go r.SDK().SyncCtrl().Sync() } func (r *message) messagesSendMedia(da request.Callback) { - req := &msg.MessagesSendMedia{} - if err := da.RequestData(req); err != nil { - return - } - - switch req.MediaType { - case msg.InputMediaType_InputMediaTypeEmpty: - // sending text messages MUST be handled by MessagesSendMedia - da.Response(rony.C_Error, errors.New("00", "USE_MessagesSendMedia")) - return - case msg.InputMediaType_InputMediaTypeUploadedDocument: - // sending uploaded document types MUST be handled by ClientSendMessageMedia - da.Response(rony.C_Error, errors.New("00", "USE_ClientSendMessageMedia")) - return - case msg.InputMediaType_InputMediaTypeContact, msg.InputMediaType_InputMediaTypeGeoLocation, - msg.InputMediaType_InputMediaTypeDocument, msg.InputMediaType_InputMediaTypeMessageDocument: - // This will be used as next requestID - // Insert into pending messages, id is negative nano timestamp and save RandomID too - req.RandomID = domain.SequentialUniqueID() - dbID := -req.RandomID - - res, err := repo.PendingMessages.SaveMessageMedia(da.TeamID(), da.TeamAccess(), dbID, r.SDK().GetConnInfo().PickupUserID(), req) - if err != nil { - e := &rony.Error{ - Code: "n/a", - Items: "Failed to save to pendingMessages : " + err.Error(), - } - da.Response(rony.C_Error, e) - return - } - // return temporary response to the UI until UpdateMessageID/UpdateNewMessage arrived. - da.Response(msg.C_ClientPendingMessage, res) - } - - da.Discard() - r.SDK().QueueCtrl().EnqueueCommand( - request.NewCallback( - da.TeamID(), da.TeamAccess(), uint64(req.RandomID), msg.C_MessagesSendMedia, req, - nil, nil, nil, da.UI(), da.Flags(), da.Timeout(), - ), - ) + req := &msg.MessagesSendMedia{} + if err := da.RequestData(req); err != nil { + return + } + + switch req.MediaType { + case msg.InputMediaType_InputMediaTypeEmpty: + // sending text messages MUST be handled by MessagesSendMedia + da.Response(rony.C_Error, errors.New("00", "USE_MessagesSendMedia")) + return + case msg.InputMediaType_InputMediaTypeUploadedDocument: + // sending uploaded document types MUST be handled by ClientSendMessageMedia + da.Response(rony.C_Error, errors.New("00", "USE_ClientSendMessageMedia")) + return + case msg.InputMediaType_InputMediaTypeContact, msg.InputMediaType_InputMediaTypeGeoLocation, + msg.InputMediaType_InputMediaTypeDocument, msg.InputMediaType_InputMediaTypeMessageDocument: + // This will be used as next requestID + // Insert into pending messages, id is negative nano timestamp and save RandomID too + req.RandomID = domain.SequentialUniqueID() + dbID := -req.RandomID + + res, err := repo.PendingMessages.SaveMessageMedia(da.TeamID(), da.TeamAccess(), dbID, r.SDK().GetConnInfo().PickupUserID(), req) + if err != nil { + e := &rony.Error{ + Code: "n/a", + Items: "Failed to save to pendingMessages : " + err.Error(), + } + da.Response(rony.C_Error, e) + return + } + // return temporary response to the UI until UpdateMessageID/UpdateNewMessage arrived. + da.Response(msg.C_ClientPendingMessage, res) + } + + da.Discard() + r.SDK().QueueCtrl().EnqueueCommand( + request.NewCallback( + da.TeamID(), da.TeamAccess(), uint64(req.RandomID), msg.C_MessagesSendMedia, req, + nil, nil, nil, da.UI(), da.Flags(), da.Timeout(), + ), + ) } func (r *message) messagesReadHistory(da request.Callback) { - req := &msg.MessagesReadHistory{} - if err := da.RequestData(req); err != nil { - return - } - - dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if dialog == nil { - return - } - if dialog.ReadInboxMaxID > req.MaxID { - return - } - - // update read inbox max id - err := repo.Dialogs.UpdateReadInboxMaxID(r.SDK().GetConnInfo().PickupUserID(), da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MaxID) - r.Log().WarnOnErr("could not update read inbox max id", err) - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.MessagesReadHistory{} + if err := da.RequestData(req); err != nil { + return + } + + dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if dialog == nil { + return + } + if dialog.ReadInboxMaxID > req.MaxID { + return + } + + // update read inbox max id + err := repo.Dialogs.UpdateReadInboxMaxID(r.SDK().GetConnInfo().PickupUserID(), da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MaxID) + r.Log().WarnOnErr("could not update read inbox max id", err) + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) messagesGetHistory(da request.Callback) { - req := &msg.MessagesGetHistory{} - if err := da.RequestData(req); err != nil { - return - } - - // Load the dialog - dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if dialog == nil { - fillMessagesMany(da, []*msg.UserMessage{}, []*msg.User{}, []*msg.Group{}) - return - } - - // Prepare the the result before sending back to the client - da.SetPreComplete(r.genGetHistoryCB(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MinID, req.MaxID, dialog.TopMessageID)) - // We are Offline/Disconnected - if !r.SDK().NetCtrl().Connected() { - messages, users, groups := repo.Messages.GetMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MinID, req.MaxID, req.Limit) - if len(messages) > 0 { - pendingMessages := repo.PendingMessages.GetByPeer(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if len(pendingMessages) > 0 { - messages = append(pendingMessages, messages...) - } - fillMessagesMany(da, messages, users, groups) - return - } - } - - // We are Online - switch { - case req.MinID == 0 && req.MaxID == 0: - req.MaxID = dialog.TopMessageID - fallthrough - case req.MinID == 0 && req.MaxID != 0: - b, bar := hole.GetLowerFilled(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, req.MaxID) - if !b { - r.Log().Info("detected hole (With MaxID Only)", - zap.Int64("MaxID", req.MaxID), - zap.Int64("PeerID", req.Peer.ID), - zap.Int64("TopMsgID", dialog.TopMessageID), - zap.String("Holes", hole.PrintHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0)), - ) - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - messages, users, groups := repo.Messages.GetMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), bar.Min, bar.Max, req.Limit) - fillMessagesMany(da, messages, users, groups) - case req.MinID != 0 && req.MaxID == 0: - b, bar := hole.GetUpperFilled(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, req.MinID) - if !b { - r.Log().Info("detected hole (With MinID Only)", - zap.Int64("MinID", req.MinID), - zap.Int64("PeerID", req.Peer.ID), - zap.Int64("TopMsgID", dialog.TopMessageID), - zap.String("Holes", hole.PrintHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0)), - ) - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - messages, users, groups := repo.Messages.GetMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), bar.Min, 0, req.Limit) - fillMessagesMany(da, messages, users, groups) - default: - b := hole.IsHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, req.MinID, req.MaxID) - if b { - r.Log().Info("detected hole (With Min & Max)", - zap.Int64("MinID", req.MinID), - zap.Int64("MaxID", req.MaxID), - zap.Int64("PeerID", req.Peer.ID), - zap.Int64("TopMsgID", dialog.TopMessageID), - ) - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } - messages, users, groups := repo.Messages.GetMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MinID, req.MaxID, req.Limit) - fillMessagesMany(da, messages, users, groups) - } + req := &msg.MessagesGetHistory{} + if err := da.RequestData(req); err != nil { + return + } + + // Load the dialog + dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if dialog == nil { + fillMessagesMany(da, []*msg.UserMessage{}, []*msg.User{}, []*msg.Group{}) + return + } + + // Prepare the the result before sending back to the client + da.SetPreComplete(r.genGetHistoryCB(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MinID, req.MaxID, dialog.TopMessageID)) + // We are Offline/Disconnected + if !r.SDK().NetCtrl().Connected() { + messages, users, groups := repo.Messages.GetMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MinID, req.MaxID, req.Limit) + if len(messages) > 0 { + pendingMessages := repo.PendingMessages.GetByPeer(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if len(pendingMessages) > 0 { + messages = append(pendingMessages, messages...) + } + fillMessagesMany(da, messages, users, groups) + return + } + } + + // We are Online + switch { + case req.MinID == 0 && req.MaxID == 0: + req.MaxID = dialog.TopMessageID + fallthrough + case req.MinID == 0 && req.MaxID != 0: + b, bar := hole.GetLowerFilled(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, req.MaxID) + if !b { + r.Log().Info("detected hole (With MaxID Only)", + zap.Int64("MaxID", req.MaxID), + zap.Int64("PeerID", req.Peer.ID), + zap.Int64("TopMsgID", dialog.TopMessageID), + zap.String("Holes", hole.PrintHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0)), + ) + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + messages, users, groups := repo.Messages.GetMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), bar.Min, bar.Max, req.Limit) + fillMessagesMany(da, messages, users, groups) + case req.MinID != 0 && req.MaxID == 0: + b, bar := hole.GetUpperFilled(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, req.MinID) + if !b { + r.Log().Info("detected hole (With MinID Only)", + zap.Int64("MinID", req.MinID), + zap.Int64("PeerID", req.Peer.ID), + zap.Int64("TopMsgID", dialog.TopMessageID), + zap.String("Holes", hole.PrintHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0)), + ) + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + messages, users, groups := repo.Messages.GetMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), bar.Min, 0, req.Limit) + fillMessagesMany(da, messages, users, groups) + default: + b := hole.IsHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, req.MinID, req.MaxID) + if b { + r.Log().Info("detected hole (With Min & Max)", + zap.Int64("MinID", req.MinID), + zap.Int64("MaxID", req.MaxID), + zap.Int64("PeerID", req.Peer.ID), + zap.Int64("TopMsgID", dialog.TopMessageID), + ) + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } + messages, users, groups := repo.Messages.GetMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MinID, req.MaxID, req.Limit) + fillMessagesMany(da, messages, users, groups) + } } func fillMessagesMany( - da request.Callback, messages []*msg.UserMessage, users []*msg.User, groups []*msg.Group, + da request.Callback, messages []*msg.UserMessage, users []*msg.User, groups []*msg.Group, ) { - da.Response(msg.C_MessagesMany, - &msg.MessagesMany{ - Messages: messages, - Users: users, - Groups: groups, - }, - ) + da.Response(msg.C_MessagesMany, + &msg.MessagesMany{ + Messages: messages, + Users: users, + Groups: groups, + }, + ) } func (r *message) genGetHistoryCB( - teamID, peerID int64, peerType int32, minID, maxID int64, topMessageID int64, + teamID, peerID int64, peerType int32, minID, maxID int64, topMessageID int64, ) domain.MessageHandler { - return func(m *rony.MessageEnvelope) { - pendingMessages := repo.PendingMessages.GetByPeer(teamID, peerID, peerType) - switch m.Constructor { - case msg.C_MessagesMany: - x := &msg.MessagesMany{} - err := x.Unmarshal(m.Message) - r.Log().WarnOnErr("Error On Unmarshal MessagesMany", err) - - // sort the received messages by id - sort.Slice(x.Messages, func(i, j int) bool { - return x.Messages[i].ID > x.Messages[j].ID - }) - - // fill messages hole based on the server response - if msgCount := len(x.Messages); msgCount > 0 { - switch { - case minID == 0 && maxID != 0: - hole.InsertFill(teamID, peerID, peerType, 0, x.Messages[msgCount-1].ID, maxID) - case minID != 0 && maxID == 0: - hole.InsertFill(teamID, peerID, peerType, 0, minID, x.Messages[0].ID) - case minID == 0 && maxID == 0: - hole.InsertFill(teamID, peerID, peerType, 0, x.Messages[msgCount-1].ID, x.Messages[0].ID) - } - } - - if len(pendingMessages) > 0 { - if maxID == 0 || (len(x.Messages) > 0 && x.Messages[len(x.Messages)-1].ID == topMessageID) { - x.Messages = append(pendingMessages, x.Messages...) - } - } - - m.Message, _ = x.Marshal() - case rony.C_Error: - r.Log().Warn("received error on GetHistory", zap.Error(domain.ParseServerError(m.Message))) - default: - } - } + return func(m *rony.MessageEnvelope) { + pendingMessages := repo.PendingMessages.GetByPeer(teamID, peerID, peerType) + switch m.Constructor { + case msg.C_MessagesMany: + x := &msg.MessagesMany{} + err := x.Unmarshal(m.Message) + r.Log().WarnOnErr("Error On Unmarshal MessagesMany", err) + + // sort the received messages by id + sort.Slice(x.Messages, func(i, j int) bool { + return x.Messages[i].ID > x.Messages[j].ID + }) + + // fill messages hole based on the server response + if msgCount := len(x.Messages); msgCount > 0 { + switch { + case minID == 0 && maxID != 0: + hole.InsertFill(teamID, peerID, peerType, 0, x.Messages[msgCount-1].ID, maxID) + case minID != 0 && maxID == 0: + hole.InsertFill(teamID, peerID, peerType, 0, minID, x.Messages[0].ID) + case minID == 0 && maxID == 0: + hole.InsertFill(teamID, peerID, peerType, 0, x.Messages[msgCount-1].ID, x.Messages[0].ID) + } + } + + if len(pendingMessages) > 0 { + if maxID == 0 || (len(x.Messages) > 0 && x.Messages[len(x.Messages)-1].ID == topMessageID) { + x.Messages = append(pendingMessages, x.Messages...) + } + } + + m.Message, _ = x.Marshal() + case rony.C_Error: + r.Log().Warn("received error on GetHistory", zap.Error(domain.ParseServerError(m.Message))) + default: + } + } } func (r *message) messagesGetMediaHistory(da request.Callback) { - req := &msg.MessagesGetMediaHistory{} - if err := da.RequestData(req); err != nil { - return - } - - // Load the dialog - dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if dialog == nil { - fillMessagesMany(da, []*msg.UserMessage{}, []*msg.User{}, []*msg.Group{}) - return - } - - // We are Online - if req.MaxID == 0 { - req.MaxID = dialog.TopMessageID - } - - // We are Offline/Disconnected - if !r.SDK().NetCtrl().Connected() { - messages, users, groups := repo.Messages.GetMediaMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, req.MaxID, req.Limit, req.Cat) - if len(messages) > 0 { - fillMessagesMany(da, messages, users, groups) - return - } - } - - // Prepare the the result before sending back to the client - da.SetPreComplete(r.genGetMediaHistoryCB(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MaxID, req.Cat)) - b, bar := hole.GetLowerFilled(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.Cat, req.MaxID) - if !b { - r.Log().Info("detected hole (With MaxID Only)", - zap.Int64("MaxID", req.MaxID), - zap.Int64("PeerID", req.Peer.ID), - zap.String("PeerType", req.Peer.Type.String()), - zap.String("Cat", req.Cat.String()), - zap.Int64("TopMsgID", dialog.TopMessageID), - zap.String("Holes", hole.PrintHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.Cat)), - ) - r.SDK().QueueCtrl().EnqueueCommand(da) - return - } else { - r.Log().Info("retrieve data locally", - zap.Int64("MaxID", req.MaxID), - zap.Int64("PeerID", req.Peer.ID), - zap.String("PeerType", req.Peer.Type.String()), - zap.String("Cat", req.Cat.String()), - zap.Int64("TopMsgID", dialog.TopMessageID), - zap.String("Holes", hole.PrintHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.Cat)), - ) - } - - messages, users, groups := repo.Messages.GetMediaMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, bar.Max, req.Limit, req.Cat) - fillMessagesMany(da, messages, users, groups) + req := &msg.MessagesGetMediaHistory{} + if err := da.RequestData(req); err != nil { + return + } + + // Load the dialog + dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if dialog == nil { + fillMessagesMany(da, []*msg.UserMessage{}, []*msg.User{}, []*msg.Group{}) + return + } + + // We are Online + if req.MaxID == 0 { + req.MaxID = dialog.TopMessageID + } + + // We are Offline/Disconnected + if !r.SDK().NetCtrl().Connected() { + messages, users, groups := repo.Messages.GetMediaMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, req.MaxID, req.Limit, req.Cat) + if len(messages) > 0 { + fillMessagesMany(da, messages, users, groups) + return + } + } + + // Prepare the the result before sending back to the client + da.SetPreComplete(r.genGetMediaHistoryCB(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MaxID, req.Cat)) + b, bar := hole.GetLowerFilled(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.Cat, req.MaxID) + if !b { + r.Log().Info("detected hole (With MaxID Only)", + zap.Int64("MaxID", req.MaxID), + zap.Int64("PeerID", req.Peer.ID), + zap.String("PeerType", req.Peer.Type.String()), + zap.String("Cat", req.Cat.String()), + zap.Int64("TopMsgID", dialog.TopMessageID), + zap.String("Holes", hole.PrintHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.Cat)), + ) + r.SDK().QueueCtrl().EnqueueCommand(da) + return + } else { + r.Log().Info("retrieve data locally", + zap.Int64("MaxID", req.MaxID), + zap.Int64("PeerID", req.Peer.ID), + zap.String("PeerType", req.Peer.Type.String()), + zap.String("Cat", req.Cat.String()), + zap.Int64("TopMsgID", dialog.TopMessageID), + zap.String("Holes", hole.PrintHole(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.Cat)), + ) + } + + messages, users, groups := repo.Messages.GetMediaMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), 0, bar.Max, req.Limit, req.Cat) + fillMessagesMany(da, messages, users, groups) } func (r *message) genGetMediaHistoryCB( - teamID, peerID int64, peerType int32, maxID int64, cat msg.MediaCategory, + teamID, peerID int64, peerType int32, maxID int64, cat msg.MediaCategory, ) domain.MessageHandler { - return func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_MessagesMany: - x := &msg.MessagesMany{} - err := x.Unmarshal(m.Message) - r.Log().WarnOnErr("Error On Unmarshal MessagesMany", err) - - // sort the received messages by id - sort.Slice(x.Messages, func(i, j int) bool { - return x.Messages[i].ID > x.Messages[j].ID - }) - - // fill messages hole based on the server response - if msgCount := len(x.Messages); msgCount > 0 { - if maxID == 0 { - hole.InsertFill(teamID, peerID, peerType, cat, x.Messages[msgCount-1].ID, x.Messages[0].ID) - } else { - hole.InsertFill(teamID, peerID, peerType, cat, x.Messages[msgCount-1].ID, maxID) - } - } - - m.Message, _ = x.Marshal() - case rony.C_Error: - r.Log().Warn("received error on GetMediaHistory", zap.Error(domain.ParseServerError(m.Message))) - default: - } - } + return func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_MessagesMany: + x := &msg.MessagesMany{} + err := x.Unmarshal(m.Message) + r.Log().WarnOnErr("Error On Unmarshal MessagesMany", err) + + // sort the received messages by id + sort.Slice(x.Messages, func(i, j int) bool { + return x.Messages[i].ID > x.Messages[j].ID + }) + + // fill messages hole based on the server response + if msgCount := len(x.Messages); msgCount > 0 { + if maxID == 0 { + hole.InsertFill(teamID, peerID, peerType, cat, x.Messages[msgCount-1].ID, x.Messages[0].ID) + } else { + hole.InsertFill(teamID, peerID, peerType, cat, x.Messages[msgCount-1].ID, maxID) + } + } + + m.Message, _ = x.Marshal() + case rony.C_Error: + r.Log().Warn("received error on GetMediaHistory", zap.Error(domain.ParseServerError(m.Message))) + default: + } + } } func (r *message) messagesDelete(da request.Callback) { - req := &msg.MessagesDelete{} - if err := da.RequestData(req); err != nil { - return - } - - // Get PendingMessage and cancel its requests - pendingMessageIDs := make([]int64, 0, 4) - for _, id := range req.MessageIDs { - if id < 0 { - pendingMessageIDs = append(pendingMessageIDs, id) - } - } - if len(pendingMessageIDs) > 0 { - for _, id := range pendingMessageIDs { - pm, _ := repo.PendingMessages.GetByID(id) - if pm == nil { - continue - } - if pm.FileID != 0 { - r.SDK().FileCtrl().CancelUploadRequest(pm.FileID) - } - - _ = repo.PendingMessages.Delete(id) - } - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.MessagesDelete{} + if err := da.RequestData(req); err != nil { + return + } + + // Get PendingMessage and cancel its requests + pendingMessageIDs := make([]int64, 0, 4) + for _, id := range req.MessageIDs { + if id < 0 { + pendingMessageIDs = append(pendingMessageIDs, id) + } + } + if len(pendingMessageIDs) > 0 { + for _, id := range pendingMessageIDs { + pm, _ := repo.PendingMessages.GetByID(id) + if pm == nil { + continue + } + if pm.FileID != 0 { + r.SDK().FileCtrl().CancelUploadRequest(pm.FileID) + } + + _ = repo.PendingMessages.Delete(id) + } + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) messagesGet(da request.Callback) { - req := &msg.MessagesGet{} - if err := da.RequestData(req); err != nil { - return - } - - msgIDs := domain.MInt64B{} - pMsgIDs := domain.MInt64B{} - - for _, v := range req.MessagesIDs { - if v > 0 { - msgIDs[v] = true - } else { - pMsgIDs[v] = true - } - } - - messages, _ := repo.Messages.GetMany(msgIDs.ToArray()) - messages = append(messages, repo.PendingMessages.GetMany(pMsgIDs.ToArray())...) - - mUsers := domain.MInt64B{} - mUsers[req.Peer.ID] = true - for _, m := range messages { - mUsers[m.SenderID] = true - mUsers[m.FwdSenderID] = true - actUserIDs := domain.ExtractActionUserIDs(m.MessageAction, m.MessageActionData) - for _, id := range actUserIDs { - mUsers[id] = true - } - } - users, _ := repo.Users.GetMany(mUsers.ToArray()) - - // if db already had all users - if len(messages) == (len(msgIDs)+len(pMsgIDs)) && len(users) > 0 { - res := &msg.MessagesMany{ - Messages: messages, - Users: users, - } - da.Response(msg.C_MessagesMany, res) - return - } - - // websocketSend the request to the server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.MessagesGet{} + if err := da.RequestData(req); err != nil { + return + } + + msgIDs := domain.MInt64B{} + pMsgIDs := domain.MInt64B{} + + for _, v := range req.MessagesIDs { + if v > 0 { + msgIDs[v] = true + } else { + pMsgIDs[v] = true + } + } + + messages, _ := repo.Messages.GetMany(msgIDs.ToArray()) + messages = append(messages, repo.PendingMessages.GetMany(pMsgIDs.ToArray())...) + + mUsers := domain.MInt64B{} + mUsers[req.Peer.ID] = true + for _, m := range messages { + mUsers[m.SenderID] = true + mUsers[m.FwdSenderID] = true + actUserIDs := domain.ExtractActionUserIDs(m.MessageAction, m.MessageActionData) + for _, id := range actUserIDs { + mUsers[id] = true + } + } + users, _ := repo.Users.GetMany(mUsers.ToArray()) + + // if db already had all users + if len(messages) == (len(msgIDs)+len(pMsgIDs)) && len(users) > 0 { + res := &msg.MessagesMany{ + Messages: messages, + Users: users, + } + da.Response(msg.C_MessagesMany, res) + return + } + + // websocketSend the request to the server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) messagesClearHistory(da request.Callback) { - req := &msg.MessagesClearHistory{} - if err := da.RequestData(req); err != nil { - return - } - - if req.MaxID == 0 { - d, err := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if err != nil { - da.Response(rony.C_Error, &rony.Error{Code: "00", Items: err.Error()}) - return - } - req.MaxID = d.TopMessageID - } - - err := repo.Messages.ClearHistory(r.SDK().GetConnInfo().PickupUserID(), da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MaxID) - r.Log().WarnOnErr("got error on clear history", err, - zap.Int64("PeerID", req.Peer.ID), - zap.Int64("TeamID", da.TeamID()), - ) - - if req.Delete { - err = repo.Dialogs.Delete(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - r.Log().WarnOnErr("got error on deleting dialogs", err, - zap.Int64("PeerID", req.Peer.ID), - zap.Int64("TeamID", da.TeamID()), - ) - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.MessagesClearHistory{} + if err := da.RequestData(req); err != nil { + return + } + + if req.MaxID == 0 { + d, err := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if err != nil { + da.Response(rony.C_Error, &rony.Error{Code: "00", Items: err.Error()}) + return + } + req.MaxID = d.TopMessageID + } + + err := repo.Messages.ClearHistory(r.SDK().GetConnInfo().PickupUserID(), da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MaxID) + r.Log().WarnOnErr("got error on clear history", err, + zap.Int64("PeerID", req.Peer.ID), + zap.Int64("TeamID", da.TeamID()), + ) + + if req.Delete { + err = repo.Dialogs.Delete(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + r.Log().WarnOnErr("got error on deleting dialogs", err, + zap.Int64("PeerID", req.Peer.ID), + zap.Int64("TeamID", da.TeamID()), + ) + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) messagesReadContents(da request.Callback) { - req := &msg.MessagesReadContents{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.MessagesReadContents{} + if err := da.RequestData(req); err != nil { + return + } - _ = repo.Messages.SetContentRead(req.Peer.ID, int32(req.Peer.Type), req.MessageIDs) + _ = repo.Messages.SetContentRead(req.Peer.ID, int32(req.Peer.Type), req.MessageIDs) - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) messagesSaveDraft(da request.Callback) { - req := &msg.MessagesSaveDraft{} - if err := da.RequestData(req); err != nil { - return - } - - dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if dialog != nil { - dialog.Draft = &msg.DraftMessage{ - Body: req.Body, - Entities: req.Entities, - PeerID: req.Peer.ID, - PeerType: int32(req.Peer.Type), - Date: tools.TimeUnix(), - ReplyTo: req.ReplyTo, - } - _ = repo.Dialogs.Save(dialog) - } - - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + req := &msg.MessagesSaveDraft{} + if err := da.RequestData(req); err != nil { + return + } + + dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if dialog != nil { + dialog.Draft = &msg.DraftMessage{ + Body: req.Body, + Entities: req.Entities, + PeerID: req.Peer.ID, + PeerType: int32(req.Peer.Type), + Date: tools.TimeUnix(), + ReplyTo: req.ReplyTo, + } + _ = repo.Dialogs.Save(dialog) + } + + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) messagesClearDraft(da request.Callback) { - req := &msg.MessagesClearDraft{} - if err := da.RequestData(req); err != nil { - return - } - - dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if dialog != nil { - if dialog.Draft != nil { - dialog.Draft = nil - _ = repo.Dialogs.Save(dialog) - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) - } - } - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.MessagesClearDraft{} + if err := da.RequestData(req); err != nil { + return + } + + dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if dialog != nil { + if dialog.Draft != nil { + dialog.Draft = nil + _ = repo.Dialogs.Save(dialog) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) + } + } + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (r *message) messagesTogglePin(da request.Callback) { - req := &msg.MessagesTogglePin{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.MessagesTogglePin{} + if err := da.RequestData(req); err != nil { + return + } - err := repo.Dialogs.UpdatePinMessageID(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MessageID) - r.Log().ErrorOnErr("go error on toggle pin dialog", err) + err := repo.Dialogs.UpdatePinMessageID(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MessageID) + r.Log().ErrorOnErr("go error on toggle pin dialog", err) - r.SDK().QueueCtrl().EnqueueCommand(da) + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) messagesSendReaction(da request.Callback) { - req := &msg.MessagesSendReaction{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.MessagesSendReaction{} + if err := da.RequestData(req); err != nil { + return + } - err := repo.Reactions.IncrementReactionUseCount(req.Reaction, 1) - r.Log().ErrorOnErr("got error on send message reaction", err) + err := repo.Reactions.IncrementReactionUseCount(req.Reaction, 1) + r.Log().ErrorOnErr("got error on send message reaction", err) - r.SDK().QueueCtrl().EnqueueCommand(da) + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) messagesDeleteReaction(da request.Callback) { - req := &msg.MessagesDeleteReaction{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.MessagesDeleteReaction{} + if err := da.RequestData(req); err != nil { + return + } - for _, react := range req.Reactions { - err := repo.Reactions.IncrementReactionUseCount(react, -1) - r.Log().ErrorOnErr("got error on deleting message reaction", err) - } + for _, react := range req.Reactions { + err := repo.Reactions.IncrementReactionUseCount(react, -1) + r.Log().ErrorOnErr("got error on deleting message reaction", err) + } - r.SDK().QueueCtrl().EnqueueCommand(da) + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) messagesToggleDialogPin(da request.Callback) { - req := &msg.MessagesToggleDialogPin{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.MessagesToggleDialogPin{} + if err := da.RequestData(req); err != nil { + return + } - dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if dialog != nil { - dialog.Pinned = req.Pin - _ = repo.Dialogs.Save(dialog) - } + dialog, _ := repo.Dialogs.Get(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if dialog != nil { + dialog.Pinned = req.Pin + _ = repo.Dialogs.Save(dialog) + } - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *message) clientGetMediaHistory(da request.Callback) { - req := &msg.ClientGetMediaHistory{} - if err := da.RequestData(req); err != nil { - return - } - - messages, users, groups := repo.Messages.GetMediaMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MinID, req.MaxID, req.Limit, req.Cat) - if len(messages) > 0 { - da.Response(msg.C_MessagesMany, - &msg.MessagesMany{ - Messages: messages, - Users: users, - Groups: groups, - }, - ) - return - } + req := &msg.ClientGetMediaHistory{} + if err := da.RequestData(req); err != nil { + return + } + + messages, users, groups := repo.Messages.GetMediaMessageHistory(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MinID, req.MaxID, req.Limit, req.Cat) + if len(messages) > 0 { + da.Response(msg.C_MessagesMany, + &msg.MessagesMany{ + Messages: messages, + Users: users, + Groups: groups, + }, + ) + return + } } func (r *message) clientSendMessageMedia(da request.Callback) { - reqMedia := &msg.ClientSendMessageMedia{} - if err := da.RequestData(reqMedia); err != nil { - return - } - - // support IOS file path - reqMedia.FilePath = strings.TrimPrefix(reqMedia.FilePath, "file://") - reqMedia.ThumbFilePath = strings.TrimPrefix(reqMedia.ThumbFilePath, "file://") - - // insert into pending messages, id is negative nano timestamp and save RandomID too : Done - fileID := domain.SequentialUniqueID() - msgID := -fileID - thumbID := int64(0) - reqMedia.FileUploadID = fmt.Sprintf("%d", fileID) - reqMedia.FileID = fileID - if reqMedia.ThumbFilePath != "" { - thumbID = domain.RandomInt63() - reqMedia.ThumbID = thumbID - reqMedia.ThumbUploadID = fmt.Sprintf("%d", thumbID) - } - - checkSha256 := true - switch reqMedia.MediaType { - case msg.InputMediaType_InputMediaTypeUploadedDocument: - for _, attr := range reqMedia.Attributes { - if attr.Type == msg.DocumentAttributeType_AttributeTypeAudio { - x := &msg.DocumentAttributeAudio{} - _ = x.Unmarshal(attr.Data) - if x.Voice { - checkSha256 = false - } - } - } - default: - panic("Invalid MediaInputType") - } - - h, _ := domain.CalculateSha256(reqMedia.FilePath) - pendingMessage, err := repo.PendingMessages.SaveClientMessageMedia( - da.TeamID(), da.TeamAccess(), msgID, r.SDK().GetConnInfo().PickupUserID(), fileID, fileID, thumbID, reqMedia, h, - ) - if err != nil { - e := &rony.Error{ - Code: "n/a", - Items: "Failed to save to pendingMessages : " + err.Error(), - } - da.Response(rony.C_Error, e) - return - } - - // start the upload process - r.SDK().FileCtrl().UploadMessageDocument(pendingMessage.ID, reqMedia.FilePath, reqMedia.ThumbFilePath, fileID, thumbID, h, pendingMessage.PeerID, checkSha256) - - da.Response(msg.C_ClientPendingMessage, pendingMessage) + reqMedia := &msg.ClientSendMessageMedia{} + if err := da.RequestData(reqMedia); err != nil { + return + } + + // support IOS file path + reqMedia.FilePath = strings.TrimPrefix(reqMedia.FilePath, "file://") + reqMedia.ThumbFilePath = strings.TrimPrefix(reqMedia.ThumbFilePath, "file://") + + // insert into pending messages, id is negative nano timestamp and save RandomID too : Done + fileID := domain.SequentialUniqueID() + msgID := -fileID + thumbID := int64(0) + reqMedia.FileUploadID = fmt.Sprintf("%d", fileID) + reqMedia.FileID = fileID + if reqMedia.ThumbFilePath != "" { + thumbID = domain.RandomInt63() + reqMedia.ThumbID = thumbID + reqMedia.ThumbUploadID = fmt.Sprintf("%d", thumbID) + } + + checkSha256 := true + switch reqMedia.MediaType { + case msg.InputMediaType_InputMediaTypeUploadedDocument: + for _, attr := range reqMedia.Attributes { + if attr.Type == msg.DocumentAttributeType_AttributeTypeAudio { + x := &msg.DocumentAttributeAudio{} + _ = x.Unmarshal(attr.Data) + if x.Voice { + checkSha256 = false + } + } + } + default: + panic("Invalid MediaInputType") + } + + h, _ := domain.CalculateSha256(reqMedia.FilePath) + pendingMessage, err := repo.PendingMessages.SaveClientMessageMedia( + da.TeamID(), da.TeamAccess(), msgID, r.SDK().GetConnInfo().PickupUserID(), fileID, fileID, thumbID, reqMedia, h, + ) + if err != nil { + e := &rony.Error{ + Code: "n/a", + Items: "Failed to save to pendingMessages : " + err.Error(), + } + da.Response(rony.C_Error, e) + return + } + + // start the upload process + r.SDK().FileCtrl().UploadMessageDocument(pendingMessage.ID, reqMedia.FilePath, reqMedia.ThumbFilePath, fileID, thumbID, h, pendingMessage.PeerID, checkSha256) + + da.Response(msg.C_ClientPendingMessage, pendingMessage) } func (r *message) clientGetFrequentReactions(da request.Callback) { - reactions := domain.SysConfig.Reactions + reactions := domain.SysConfig.Reactions - useCountsMap := make(map[string]uint32, len(reactions)) + useCountsMap := make(map[string]uint32, len(reactions)) - for _, r := range reactions { - useCount, _ := repo.Reactions.GetReactionUseCount(r) - useCountsMap[r] = useCount - } + for _, r := range reactions { + useCount, _ := repo.Reactions.GetReactionUseCount(r) + useCountsMap[r] = useCount + } - sort.Slice(reactions, func(i, j int) bool { - return useCountsMap[reactions[i]] > useCountsMap[reactions[j]] - }) + sort.Slice(reactions, func(i, j int) bool { + return useCountsMap[reactions[i]] > useCountsMap[reactions[j]] + }) - da.Response(msg.C_ClientFrequentReactions, - &msg.ClientFrequentReactions{ - Reactions: reactions, - }, - ) + da.Response(msg.C_ClientFrequentReactions, + &msg.ClientFrequentReactions{ + Reactions: reactions, + }, + ) } func (r *message) clientGetCachedMedia(da request.Callback) { - req := &msg.ClientGetCachedMedia{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.ClientGetCachedMedia{} + if err := da.RequestData(req); err != nil { + return + } - res := repo.Files.GetCachedMedia(da.TeamID()) - da.Response(msg.C_ClientCachedMediaInfo, res) + res := repo.Files.GetCachedMedia(da.TeamID()) + da.Response(msg.C_ClientCachedMediaInfo, res) } func (r *message) clientClearCachedMedia(da request.Callback) { - req := &msg.ClientClearCachedMedia{} - if err := da.RequestData(req); err != nil { - return - } - - if req.Peer != nil { - repo.Files.DeleteCachedMediaByPeer(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MediaTypes) - } else if len(req.MediaTypes) > 0 { - repo.Files.DeleteCachedMediaByMediaType(da.TeamID(), req.MediaTypes) - } else { - repo.Files.ClearCache() - } - - da.Response(msg.C_Bool, &msg.Bool{Result: true}) + req := &msg.ClientClearCachedMedia{} + if err := da.RequestData(req); err != nil { + return + } + + if req.Peer != nil { + repo.Files.DeleteCachedMediaByPeer(da.TeamID(), req.Peer.ID, int32(req.Peer.Type), req.MediaTypes) + } else if len(req.MediaTypes) > 0 { + repo.Files.DeleteCachedMediaByMediaType(da.TeamID(), req.MediaTypes) + } else { + repo.Files.ClearCache() + } + + da.Response(msg.C_Bool, &msg.Bool{Result: true}) } func (r *message) clientGetLastBotKeyboard(da request.Callback) { - req := &msg.ClientGetLastBotKeyboard{} - if err := da.RequestData(req); err != nil { - return - } - - lastKeyboardMsg, _ := repo.Messages.GetLastBotKeyboard(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) - if lastKeyboardMsg == nil { - da.Response(rony.C_Error, &rony.Error{Code: "00", Items: "message not found"}) - return - } - - da.Response(msg.C_UserMessage, lastKeyboardMsg) + req := &msg.ClientGetLastBotKeyboard{} + if err := da.RequestData(req); err != nil { + return + } + + lastKeyboardMsg, _ := repo.Messages.GetLastBotKeyboard(da.TeamID(), req.Peer.ID, int32(req.Peer.Type)) + if lastKeyboardMsg == nil { + da.Response(rony.C_Error, &rony.Error{Code: "00", Items: "message not found"}) + return + } + + da.Response(msg.C_UserMessage, lastKeyboardMsg) } diff --git a/module/message/message.go b/module/message/message.go index 0180a1f7..af25199f 100644 --- a/module/message/message.go +++ b/module/message/message.go @@ -1,10 +1,10 @@ package message import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -17,65 +17,65 @@ import ( */ type message struct { - module.Base + module.Base } func New() *message { - r := &message{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_MessagesClearDraft: r.messagesClearDraft, - msg.C_MessagesClearHistory: r.messagesClearHistory, - msg.C_MessagesDelete: r.messagesDelete, - msg.C_MessagesDeleteReaction: r.messagesDeleteReaction, - msg.C_MessagesGet: r.messagesGet, - msg.C_MessagesGetDialog: r.messagesGetDialog, - msg.C_MessagesGetDialogs: r.messagesGetDialogs, - msg.C_MessagesGetHistory: r.messagesGetHistory, - msg.C_MessagesGetMediaHistory: r.messagesGetMediaHistory, - msg.C_MessagesReadContents: r.messagesReadContents, - msg.C_MessagesReadHistory: r.messagesReadHistory, - msg.C_MessagesSaveDraft: r.messagesSaveDraft, - msg.C_MessagesSend: r.messagesSend, - msg.C_MessagesSendMedia: r.messagesSendMedia, - msg.C_MessagesSendReaction: r.messagesSendReaction, - msg.C_MessagesToggleDialogPin: r.messagesToggleDialogPin, - msg.C_MessagesTogglePin: r.messagesTogglePin, - msg.C_ClientGetFrequentReactions: r.clientGetFrequentReactions, - msg.C_ClientGetMediaHistory: r.clientGetMediaHistory, - msg.C_ClientSendMessageMedia: r.clientSendMessageMedia, - msg.C_ClientClearCachedMedia: r.clientClearCachedMedia, - msg.C_ClientGetCachedMedia: r.clientGetCachedMedia, - msg.C_ClientGetLastBotKeyboard: r.clientGetLastBotKeyboard, - }, - ) - r.RegisterUpdateAppliers( - map[int64]domain.UpdateApplier{ - msg.C_UpdateDialogPinned: r.updateDialogPinned, - msg.C_UpdateDraftMessage: r.updateDraftMessage, - msg.C_UpdateDraftMessageCleared: r.updateDraftMessageCleared, - msg.C_UpdateMessageEdited: r.updateMessageEdited, - msg.C_UpdateMessageID: r.updateMessageID, - msg.C_UpdateMessagePinned: r.updateMessagePinned, - msg.C_UpdateMessagesDeleted: r.updateMessagesDeleted, - msg.C_UpdateNewMessage: r.updateNewMessage, - msg.C_UpdateNotifySettings: r.updateNotifySettings, - msg.C_UpdateReaction: r.updateReaction, - msg.C_UpdateReadHistoryInbox: r.updateReadHistoryInbox, - msg.C_UpdateReadHistoryOutbox: r.updateReadHistoryOutbox, - msg.C_UpdateReadMessagesContents: r.updateReadMessagesContents, - }, - ) - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_MessagesDialogs: r.messagesDialogs, - msg.C_MessagesMany: r.messagesMany, - msg.C_MessagesReactionList: r.reactionList, - }, - ) - return r + r := &message{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_MessagesClearDraft: r.messagesClearDraft, + msg.C_MessagesClearHistory: r.messagesClearHistory, + msg.C_MessagesDelete: r.messagesDelete, + msg.C_MessagesDeleteReaction: r.messagesDeleteReaction, + msg.C_MessagesGet: r.messagesGet, + msg.C_MessagesGetDialog: r.messagesGetDialog, + msg.C_MessagesGetDialogs: r.messagesGetDialogs, + msg.C_MessagesGetHistory: r.messagesGetHistory, + msg.C_MessagesGetMediaHistory: r.messagesGetMediaHistory, + msg.C_MessagesReadContents: r.messagesReadContents, + msg.C_MessagesReadHistory: r.messagesReadHistory, + msg.C_MessagesSaveDraft: r.messagesSaveDraft, + msg.C_MessagesSend: r.messagesSend, + msg.C_MessagesSendMedia: r.messagesSendMedia, + msg.C_MessagesSendReaction: r.messagesSendReaction, + msg.C_MessagesToggleDialogPin: r.messagesToggleDialogPin, + msg.C_MessagesTogglePin: r.messagesTogglePin, + msg.C_ClientGetFrequentReactions: r.clientGetFrequentReactions, + msg.C_ClientGetMediaHistory: r.clientGetMediaHistory, + msg.C_ClientSendMessageMedia: r.clientSendMessageMedia, + msg.C_ClientClearCachedMedia: r.clientClearCachedMedia, + msg.C_ClientGetCachedMedia: r.clientGetCachedMedia, + msg.C_ClientGetLastBotKeyboard: r.clientGetLastBotKeyboard, + }, + ) + r.RegisterUpdateAppliers( + map[int64]domain.UpdateApplier{ + msg.C_UpdateDialogPinned: r.updateDialogPinned, + msg.C_UpdateDraftMessage: r.updateDraftMessage, + msg.C_UpdateDraftMessageCleared: r.updateDraftMessageCleared, + msg.C_UpdateMessageEdited: r.updateMessageEdited, + msg.C_UpdateMessageID: r.updateMessageID, + msg.C_UpdateMessagePinned: r.updateMessagePinned, + msg.C_UpdateMessagesDeleted: r.updateMessagesDeleted, + msg.C_UpdateNewMessage: r.updateNewMessage, + msg.C_UpdateNotifySettings: r.updateNotifySettings, + msg.C_UpdateReaction: r.updateReaction, + msg.C_UpdateReadHistoryInbox: r.updateReadHistoryInbox, + msg.C_UpdateReadHistoryOutbox: r.updateReadHistoryOutbox, + msg.C_UpdateReadMessagesContents: r.updateReadMessagesContents, + }, + ) + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_MessagesDialogs: r.messagesDialogs, + msg.C_MessagesMany: r.messagesMany, + msg.C_MessagesReactionList: r.reactionList, + }, + ) + return r } func (r *message) Name() string { - return module.Message + return module.Message } diff --git a/module/message/message_appliers.go b/module/message/message_appliers.go index ef130877..ac42f7e7 100644 --- a/module/message/message_appliers.go +++ b/module/message/message_appliers.go @@ -1,12 +1,12 @@ package message import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/hole" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/pools" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/hole" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/pools" + "go.uber.org/zap" ) /* @@ -19,105 +19,105 @@ import ( */ func (r *message) messagesDialogs(e *rony.MessageEnvelope) { - x := new(msg.MessagesDialogs) - if err := x.Unmarshal(e.Message); err != nil { - r.Log().Error("couldn't unmarshal MessagesDialogs", zap.Error(err)) - return - } - r.Log().Debug("applies MessagesDialogs", - zap.Int("Dialogs", len(x.Dialogs)), - zap.Int64("GetUpdateID", x.UpdateID), - zap.Int32("Count", x.Count), - ) + x := new(msg.MessagesDialogs) + if err := x.Unmarshal(e.Message); err != nil { + r.Log().Error("couldn't unmarshal MessagesDialogs", zap.Error(err)) + return + } + r.Log().Debug("applies MessagesDialogs", + zap.Int("Dialogs", len(x.Dialogs)), + zap.Int64("GetUpdateID", x.UpdateID), + zap.Int32("Count", x.Count), + ) - mMessages := make(map[int64]*msg.UserMessage) - for _, message := range x.Messages { - mMessages[message.ID] = message - } + mMessages := make(map[int64]*msg.UserMessage) + for _, message := range x.Messages { + mMessages[message.ID] = message + } - waitGroup := pools.AcquireWaitGroup() - for _, dialog := range x.Dialogs { - waitGroup.Add(1) - go func(dialog *msg.Dialog) { - topMessage := mMessages[dialog.TopMessageID] - if topMessage == nil { - r.Log().Error("got dialog with nil top message", zap.Int64("MessageID", dialog.TopMessageID)) - err := repo.Dialogs.Save(dialog) - r.Log().WarnOnErr("got error on save dialog", err) - } else { - err := repo.Dialogs.SaveNew(dialog, topMessage.CreatedOn) - r.Log().WarnOnErr("got error on save new dialog", err) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryNone, dialog.TopMessageID, dialog.TopMessageID) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryAudio, dialog.TopMessageID, dialog.TopMessageID) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryVoice, dialog.TopMessageID, dialog.TopMessageID) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryMedia, dialog.TopMessageID, dialog.TopMessageID) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryFile, dialog.TopMessageID, dialog.TopMessageID) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryGif, dialog.TopMessageID, dialog.TopMessageID) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryWeb, dialog.TopMessageID, dialog.TopMessageID) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryContact, dialog.TopMessageID, dialog.TopMessageID) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryLocation, dialog.TopMessageID, dialog.TopMessageID) - } - waitGroup.Done() - }(dialog) + waitGroup := pools.AcquireWaitGroup() + for _, dialog := range x.Dialogs { + waitGroup.Add(1) + go func(dialog *msg.Dialog) { + topMessage := mMessages[dialog.TopMessageID] + if topMessage == nil { + r.Log().Error("got dialog with nil top message", zap.Int64("MessageID", dialog.TopMessageID)) + err := repo.Dialogs.Save(dialog) + r.Log().WarnOnErr("got error on save dialog", err) + } else { + err := repo.Dialogs.SaveNew(dialog, topMessage.CreatedOn) + r.Log().WarnOnErr("got error on save new dialog", err) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryNone, dialog.TopMessageID, dialog.TopMessageID) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryAudio, dialog.TopMessageID, dialog.TopMessageID) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryVoice, dialog.TopMessageID, dialog.TopMessageID) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryMedia, dialog.TopMessageID, dialog.TopMessageID) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryFile, dialog.TopMessageID, dialog.TopMessageID) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryGif, dialog.TopMessageID, dialog.TopMessageID) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryWeb, dialog.TopMessageID, dialog.TopMessageID) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryContact, dialog.TopMessageID, dialog.TopMessageID) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, msg.MediaCategory_MediaCategoryLocation, dialog.TopMessageID, dialog.TopMessageID) + } + waitGroup.Done() + }(dialog) - } - // save Groups & Users & Messages + } + // save Groups & Users & Messages - waitGroup.Add(3) - go func() { - _ = repo.Users.Save(x.Users...) - waitGroup.Done() - }() - go func() { - _ = repo.Groups.Save(x.Groups...) - waitGroup.Done() - }() - go func() { - _ = repo.Messages.Save(x.Messages...) - waitGroup.Done() - }() - waitGroup.Wait() - pools.ReleaseWaitGroup(waitGroup) + waitGroup.Add(3) + go func() { + _ = repo.Users.Save(x.Users...) + waitGroup.Done() + }() + go func() { + _ = repo.Groups.Save(x.Groups...) + waitGroup.Done() + }() + go func() { + _ = repo.Messages.Save(x.Messages...) + waitGroup.Done() + }() + waitGroup.Wait() + pools.ReleaseWaitGroup(waitGroup) } func (r *message) messagesMany(e *rony.MessageEnvelope) { - x := new(msg.MessagesMany) - err := x.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal MessagesMany", zap.Error(err)) - return - } + x := new(msg.MessagesMany) + err := x.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal MessagesMany", zap.Error(err)) + return + } - // save Groups & Users & Messages - waitGroup := pools.AcquireWaitGroup() - waitGroup.Add(3) - go func() { - _ = repo.Users.Save(x.Users...) - waitGroup.Done() - }() - go func() { - _ = repo.Groups.Save(x.Groups...) - waitGroup.Done() - }() - go func() { - _ = repo.Messages.Save(x.Messages...) - waitGroup.Done() - }() - waitGroup.Wait() - pools.ReleaseWaitGroup(waitGroup) + // save Groups & Users & Messages + waitGroup := pools.AcquireWaitGroup() + waitGroup.Add(3) + go func() { + _ = repo.Users.Save(x.Users...) + waitGroup.Done() + }() + go func() { + _ = repo.Groups.Save(x.Groups...) + waitGroup.Done() + }() + go func() { + _ = repo.Messages.Save(x.Messages...) + waitGroup.Done() + }() + waitGroup.Wait() + pools.ReleaseWaitGroup(waitGroup) - r.Log().Info("applies MessagesMany", - zap.Bool("Continues", x.Continuous), - zap.Int("Messages", len(x.Messages)), - ) + r.Log().Info("applies MessagesMany", + zap.Bool("Continues", x.Continuous), + zap.Int("Messages", len(x.Messages)), + ) } func (r *message) reactionList(e *rony.MessageEnvelope) { - tm := &msg.MessagesReactionList{} - err := tm.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal MessagesReactionList", zap.Error(err)) - return - } + tm := &msg.MessagesReactionList{} + err := tm.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal MessagesReactionList", zap.Error(err)) + return + } } diff --git a/module/message/update_appliers.go b/module/message/update_appliers.go index 089bf27f..161819ca 100644 --- a/module/message/update_appliers.go +++ b/module/message/update_appliers.go @@ -1,19 +1,20 @@ package message import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/hole" - mon "git.ronaksoft.com/river/sdk/internal/monitoring" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/uiexec" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "os" - "sync" - "time" + "os" + "sync" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/hole" + mon "github.com/ronaksoft/river-sdk/internal/monitoring" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/uiexec" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) /* @@ -26,548 +27,548 @@ import ( */ func (r *message) updateNewMessage(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateNewMessage{} - err := x.Unmarshal(u.Update) - if err != nil { - r.Log().Error("couldn't unmarshal UpdateNewMessage", zap.Error(err)) - return nil, err - } - - r.Log().Debug("applies UpdateNewMessage", - zap.Int64("MessageID", x.Message.ID), - zap.Int64("UpdateID", x.UpdateID), - ) - - dialog, _ := repo.Dialogs.Get(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - if dialog == nil { - unreadCount := int32(0) - if x.Sender.ID != r.SDK().SyncCtrl().GetUserID() { - unreadCount = 1 - } - // make sure to created the message hole b4 creating dialog - dialog = &msg.Dialog{ - TeamID: x.Message.TeamID, - PeerID: x.Message.PeerID, - PeerType: x.Message.PeerType, - TopMessageID: x.Message.ID, - UnreadCount: unreadCount, - MentionedCount: 0, - AccessHash: x.AccessHash, - } - err := repo.Dialogs.SaveNew(dialog, x.Message.CreatedOn) - if err != nil { - return nil, err - } - } - - waitGroup := pools.AcquireWaitGroup() - waitGroup.Add(1) - go func() { - // used messageType to identify client & server messages on Media thingy - x.Message.MessageType = 1 - repo.MessagesExtra.SaveScrollID(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType, 0, 0) - waitGroup.Done() - }() - - waitGroup.Add(1) - go func() { - // save user if does not exist - err = repo.Users.Save(x.Sender) - r.Log().WarnOnErr("got error on saving user while applying new message", err, zap.Int64("SenderID", x.Sender.ID)) - waitGroup.Done() - }() - - waitGroup.Add(1) - go func() { - err = repo.Messages.SaveNew(x.Message, r.SDK().SyncCtrl().GetUserID()) - r.Log().WarnOnErr("got error on saving new message while applying new message", err, zap.Int64("SenderID", x.Sender.ID)) - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, 0, dialog.TopMessageID, x.Message.ID) - waitGroup.Done() - }() - - waitGroup.Wait() - pools.ReleaseWaitGroup(waitGroup) - - // handle Message's Action - res := []*msg.UpdateEnvelope{u} - res = append(res, r.handleMessageAction(x, u)...) - - // If sender is me, check for pending - if x.Message.SenderID == r.SDK().SyncCtrl().GetUserID() { - pm := repo.PendingMessages.GetByRealID(x.Message.ID) - if pm != nil { - r.handlePendingMessage(x) - _ = repo.PendingMessages.Delete(pm.ID) - repo.PendingMessages.DeleteByRealID(x.Message.ID) - } - - if x.Message.PeerID != x.Message.SenderID { - if x.Message.FwdSenderID != 0 { - _ = repo.TopPeers.Update(msg.TopPeerCategory_Forwards, r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - } else { - switch msg.PeerType(x.Message.PeerType) { - case msg.PeerType_PeerUser: - p, _ := repo.Users.Get(x.Message.PeerID) - if p == nil || !p.IsBot { - _ = repo.TopPeers.Update(msg.TopPeerCategory_Users, r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - } else { - _ = repo.TopPeers.Update(msg.TopPeerCategory_BotsMessage, r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - } - case msg.PeerType_PeerGroup: - _ = repo.TopPeers.Update(msg.TopPeerCategory_Groups, r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - } - } - } - - // We check if the file is GIF then check if it is a saved gif, if true, then update last access - switch x.Message.MediaType { - case msg.MediaType_MediaTypeDocument: - xx := &msg.MediaDocument{} - _ = xx.Unmarshal(x.Message.Media) - for _, attr := range xx.Doc.Attributes { - if attr.Type == msg.DocumentAttributeType_AttributeTypeAnimated { - if repo.Gifs.IsSaved(xx.Doc.ClusterID, xx.Doc.ID) { - _ = repo.Gifs.UpdateLastAccess(xx.Doc.ClusterID, xx.Doc.ID, x.Message.CreatedOn) - - uiexec.ExecDataSynced(false, false, true) - } - } - } - mon.IncMediaSent() - case msg.MediaType_MediaTypeEmpty: - mon.IncMessageSent() - default: - mon.IncMediaSent() - } - } else { - switch x.Message.MediaType { - case msg.MediaType_MediaTypeEmpty: - mon.IncMessageReceived() - default: - mon.IncMediaReceived() - } - } - - return res, nil + x := &msg.UpdateNewMessage{} + err := x.Unmarshal(u.Update) + if err != nil { + r.Log().Error("couldn't unmarshal UpdateNewMessage", zap.Error(err)) + return nil, err + } + + r.Log().Debug("applies UpdateNewMessage", + zap.Int64("MessageID", x.Message.ID), + zap.Int64("UpdateID", x.UpdateID), + ) + + dialog, _ := repo.Dialogs.Get(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + if dialog == nil { + unreadCount := int32(0) + if x.Sender.ID != r.SDK().SyncCtrl().GetUserID() { + unreadCount = 1 + } + // make sure to created the message hole b4 creating dialog + dialog = &msg.Dialog{ + TeamID: x.Message.TeamID, + PeerID: x.Message.PeerID, + PeerType: x.Message.PeerType, + TopMessageID: x.Message.ID, + UnreadCount: unreadCount, + MentionedCount: 0, + AccessHash: x.AccessHash, + } + err := repo.Dialogs.SaveNew(dialog, x.Message.CreatedOn) + if err != nil { + return nil, err + } + } + + waitGroup := pools.AcquireWaitGroup() + waitGroup.Add(1) + go func() { + // used messageType to identify client & server messages on Media thingy + x.Message.MessageType = 1 + repo.MessagesExtra.SaveScrollID(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType, 0, 0) + waitGroup.Done() + }() + + waitGroup.Add(1) + go func() { + // save user if does not exist + err = repo.Users.Save(x.Sender) + r.Log().WarnOnErr("got error on saving user while applying new message", err, zap.Int64("SenderID", x.Sender.ID)) + waitGroup.Done() + }() + + waitGroup.Add(1) + go func() { + err = repo.Messages.SaveNew(x.Message, r.SDK().SyncCtrl().GetUserID()) + r.Log().WarnOnErr("got error on saving new message while applying new message", err, zap.Int64("SenderID", x.Sender.ID)) + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, 0, dialog.TopMessageID, x.Message.ID) + waitGroup.Done() + }() + + waitGroup.Wait() + pools.ReleaseWaitGroup(waitGroup) + + // handle Message's Action + res := []*msg.UpdateEnvelope{u} + res = append(res, r.handleMessageAction(x, u)...) + + // If sender is me, check for pending + if x.Message.SenderID == r.SDK().SyncCtrl().GetUserID() { + pm := repo.PendingMessages.GetByRealID(x.Message.ID) + if pm != nil { + r.handlePendingMessage(x) + _ = repo.PendingMessages.Delete(pm.ID) + repo.PendingMessages.DeleteByRealID(x.Message.ID) + } + + if x.Message.PeerID != x.Message.SenderID { + if x.Message.FwdSenderID != 0 { + _ = repo.TopPeers.Update(msg.TopPeerCategory_Forwards, r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + } else { + switch msg.PeerType(x.Message.PeerType) { + case msg.PeerType_PeerUser: + p, _ := repo.Users.Get(x.Message.PeerID) + if p == nil || !p.IsBot { + _ = repo.TopPeers.Update(msg.TopPeerCategory_Users, r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + } else { + _ = repo.TopPeers.Update(msg.TopPeerCategory_BotsMessage, r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + } + case msg.PeerType_PeerGroup: + _ = repo.TopPeers.Update(msg.TopPeerCategory_Groups, r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + } + } + } + + // We check if the file is GIF then check if it is a saved gif, if true, then update last access + switch x.Message.MediaType { + case msg.MediaType_MediaTypeDocument: + xx := &msg.MediaDocument{} + _ = xx.Unmarshal(x.Message.Media) + for _, attr := range xx.Doc.Attributes { + if attr.Type == msg.DocumentAttributeType_AttributeTypeAnimated { + if repo.Gifs.IsSaved(xx.Doc.ClusterID, xx.Doc.ID) { + _ = repo.Gifs.UpdateLastAccess(xx.Doc.ClusterID, xx.Doc.ID, x.Message.CreatedOn) + + uiexec.ExecDataSynced(false, false, true) + } + } + } + mon.IncMediaSent() + case msg.MediaType_MediaTypeEmpty: + mon.IncMessageSent() + default: + mon.IncMediaSent() + } + } else { + switch x.Message.MediaType { + case msg.MediaType_MediaTypeEmpty: + mon.IncMessageReceived() + default: + mon.IncMediaReceived() + } + } + + return res, nil } func (r *message) handleMessageAction(x *msg.UpdateNewMessage, u *msg.UpdateEnvelope) (res []*msg.UpdateEnvelope) { - switch x.Message.MessageAction { - case domain.MessageActionContactRegistered: - go func() { - waitGroup := &sync.WaitGroup{} - waitGroup.Add(1) - r.SDK().SyncCtrl().GetContacts(waitGroup, 0, 0) - waitGroup.Wait() - }() - case domain.MessageActionGroupDeleteUser: - act := new(msg.MessageActionGroupDeleteUser) - err := act.Unmarshal(x.Message.MessageActionData) - if err != nil { - r.Log().Error("couldn't unmarshal MessageActionGroupDeleteUser", zap.Error(err)) - } - - // Check if user left (deleted him/her self from group) remove its GroupSearch, Dialog and its MessagesPending - selfUserID := r.SDK().GetConnInfo().PickupUserID() - userLeft := false - for _, v := range act.UserIDs { - if v == selfUserID { - userLeft = true - break - } - } - - // Don't go further if the user itself has not been left or removed - if !userLeft { - break - } - - // remove from top peers - err = repo.TopPeers.Delete(msg.TopPeerCategory_Groups, x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - if err != nil { - r.Log().Error("couldn't delete group from top peers", zap.Error(err)) - } - - // Delete PendingMessage - deletedMsgs := repo.PendingMessages.DeletePeerAllMessages(x.Message.PeerID, x.Message.PeerType) - if deletedMsgs != nil { - buff, err := deletedMsgs.Marshal() - if err != nil { - r.Log().Error("couldn't marshal ClientUpdateMessagesDeleted", zap.Error(err)) - break - } - - udp := &msg.UpdateEnvelope{ - Constructor: msg.C_ClientUpdateMessagesDeleted, - Update: buff, - UCount: 1, - Timestamp: u.Timestamp, - UpdateID: u.UpdateID, - } - - res = append(res, udp) - - } - case domain.MessageActionClearHistory: - act := new(msg.MessageActionClearHistory) - _ = act.Unmarshal(x.Message.MessageActionData) - - // 1. Delete All Messages < x.MessageID - _ = repo.Messages.ClearHistory(r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType, act.MaxID) - - // 2. Delete Scroll Position - repo.MessagesExtra.SaveScrollID(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType, 0, 0) - - if act.Delete { - // 3. Delete Dialog - _ = repo.Dialogs.Delete(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - } else { - // 3. Get dialog and create first hole - dialog, _ := repo.Dialogs.Get(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - if dialog != nil { - hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, 0, dialog.TopMessageID, dialog.TopMessageID) - } - } - } - return + switch x.Message.MessageAction { + case domain.MessageActionContactRegistered: + go func() { + waitGroup := &sync.WaitGroup{} + waitGroup.Add(1) + r.SDK().SyncCtrl().GetContacts(waitGroup, 0, 0) + waitGroup.Wait() + }() + case domain.MessageActionGroupDeleteUser: + act := new(msg.MessageActionGroupDeleteUser) + err := act.Unmarshal(x.Message.MessageActionData) + if err != nil { + r.Log().Error("couldn't unmarshal MessageActionGroupDeleteUser", zap.Error(err)) + } + + // Check if user left (deleted him/her self from group) remove its GroupSearch, Dialog and its MessagesPending + selfUserID := r.SDK().GetConnInfo().PickupUserID() + userLeft := false + for _, v := range act.UserIDs { + if v == selfUserID { + userLeft = true + break + } + } + + // Don't go further if the user itself has not been left or removed + if !userLeft { + break + } + + // remove from top peers + err = repo.TopPeers.Delete(msg.TopPeerCategory_Groups, x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + if err != nil { + r.Log().Error("couldn't delete group from top peers", zap.Error(err)) + } + + // Delete PendingMessage + deletedMsgs := repo.PendingMessages.DeletePeerAllMessages(x.Message.PeerID, x.Message.PeerType) + if deletedMsgs != nil { + buff, err := deletedMsgs.Marshal() + if err != nil { + r.Log().Error("couldn't marshal ClientUpdateMessagesDeleted", zap.Error(err)) + break + } + + udp := &msg.UpdateEnvelope{ + Constructor: msg.C_ClientUpdateMessagesDeleted, + Update: buff, + UCount: 1, + Timestamp: u.Timestamp, + UpdateID: u.UpdateID, + } + + res = append(res, udp) + + } + case domain.MessageActionClearHistory: + act := new(msg.MessageActionClearHistory) + _ = act.Unmarshal(x.Message.MessageActionData) + + // 1. Delete All Messages < x.MessageID + _ = repo.Messages.ClearHistory(r.SDK().SyncCtrl().GetUserID(), x.Message.TeamID, x.Message.PeerID, x.Message.PeerType, act.MaxID) + + // 2. Delete Scroll Position + repo.MessagesExtra.SaveScrollID(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType, 0, 0) + + if act.Delete { + // 3. Delete Dialog + _ = repo.Dialogs.Delete(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + } else { + // 3. Get dialog and create first hole + dialog, _ := repo.Dialogs.Get(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + if dialog != nil { + hole.InsertFill(dialog.TeamID, dialog.PeerID, dialog.PeerType, 0, dialog.TopMessageID, dialog.TopMessageID) + } + } + } + return } func (r *message) handlePendingMessage(x *msg.UpdateNewMessage) { - pmsg := repo.PendingMessages.GetByRealID(x.Message.ID) - if pmsg == nil { - return - } - - if pmsg.MediaType != msg.InputMediaType_InputMediaTypeMessageDocument { - // if it was file upload request - switch x.Message.MediaType { - case msg.MediaType_MediaTypeDocument: - // save to local files and delete file status - clientSendMedia := new(msg.ClientSendMessageMedia) - unmarshalErr := clientSendMedia.Unmarshal(pmsg.Media) - if unmarshalErr == nil { // TODO!!! fix this with some flag in pending message - clientFile, err := repo.Files.GetMediaDocument(x.Message) - r.Log().WarnOnErr("Error On GetMediaDocument", err) - - err = os.Rename(clientSendMedia.FilePath, repo.Files.GetFilePath(clientFile)) - if err != nil { - r.Log().Error("Error On HandlePendingMessage (Move) we try Copy", zap.Error(err)) - err = domain.CopyFile(clientSendMedia.FilePath, repo.Files.GetFilePath(clientFile)) - if err != nil { - r.Log().Error("Error On HandlePendingMessage (Copy) we give up!", zap.Error(err)) - } - return - } - } else { - r.Log().Error("Error On HandlePendingMessage", zap.Error(unmarshalErr)) - } - } - } - - clientUpdate := &msg.ClientUpdatePendingMessageDelivery{ - Messages: x.Message, - PendingMessage: pmsg, - Success: true, - } - - bytes, _ := clientUpdate.Marshal() - udpMsg := &msg.UpdateEnvelope{ - Constructor: msg.C_ClientUpdatePendingMessageDelivery, - Update: bytes, - UpdateID: 0, - Timestamp: tools.TimeUnix(), - } - - uiexec.ExecUpdate(msg.C_UpdateEnvelope, udpMsg) + pmsg := repo.PendingMessages.GetByRealID(x.Message.ID) + if pmsg == nil { + return + } + + if pmsg.MediaType != msg.InputMediaType_InputMediaTypeMessageDocument { + // if it was file upload request + switch x.Message.MediaType { + case msg.MediaType_MediaTypeDocument: + // save to local files and delete file status + clientSendMedia := new(msg.ClientSendMessageMedia) + unmarshalErr := clientSendMedia.Unmarshal(pmsg.Media) + if unmarshalErr == nil { // TODO!!! fix this with some flag in pending message + clientFile, err := repo.Files.GetMediaDocument(x.Message) + r.Log().WarnOnErr("Error On GetMediaDocument", err) + + err = os.Rename(clientSendMedia.FilePath, repo.Files.GetFilePath(clientFile)) + if err != nil { + r.Log().Error("Error On HandlePendingMessage (Move) we try Copy", zap.Error(err)) + err = domain.CopyFile(clientSendMedia.FilePath, repo.Files.GetFilePath(clientFile)) + if err != nil { + r.Log().Error("Error On HandlePendingMessage (Copy) we give up!", zap.Error(err)) + } + return + } + } else { + r.Log().Error("Error On HandlePendingMessage", zap.Error(unmarshalErr)) + } + } + } + + clientUpdate := &msg.ClientUpdatePendingMessageDelivery{ + Messages: x.Message, + PendingMessage: pmsg, + Success: true, + } + + bytes, _ := clientUpdate.Marshal() + udpMsg := &msg.UpdateEnvelope{ + Constructor: msg.C_ClientUpdatePendingMessageDelivery, + Update: bytes, + UpdateID: 0, + Timestamp: tools.TimeUnix(), + } + + uiexec.ExecUpdate(msg.C_UpdateEnvelope, udpMsg) } func (r *message) updateReadHistoryInbox(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateReadHistoryInbox) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateReadHistoryInbox", - zap.Int64("MaxID", x.MaxID), - zap.Int64("UpdateID", x.UpdateID), - zap.Int64("PeerID", x.Peer.ID), - ) - - err = repo.Dialogs.UpdateReadInboxMaxID(r.SDK().SyncCtrl().GetUserID(), x.TeamID, x.Peer.ID, x.Peer.Type, x.MaxID) - r.Log().WarnOnErr("could not update read inbox max id on received update", err) - - res := []*msg.UpdateEnvelope{u} - return res, nil + x := new(msg.UpdateReadHistoryInbox) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateReadHistoryInbox", + zap.Int64("MaxID", x.MaxID), + zap.Int64("UpdateID", x.UpdateID), + zap.Int64("PeerID", x.Peer.ID), + ) + + err = repo.Dialogs.UpdateReadInboxMaxID(r.SDK().SyncCtrl().GetUserID(), x.TeamID, x.Peer.ID, x.Peer.Type, x.MaxID) + r.Log().WarnOnErr("could not update read inbox max id on received update", err) + + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *message) updateReadHistoryOutbox(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateReadHistoryOutbox) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateReadHistoryOutbox", - zap.Int64("MaxID", x.MaxID), - zap.Int64("UpdateID", x.UpdateID), - zap.Int64("PeerID", x.Peer.ID), - ) - - _ = repo.Dialogs.UpdateReadOutboxMaxID(x.TeamID, x.Peer.ID, x.Peer.Type, x.MaxID) - res := []*msg.UpdateEnvelope{u} - return res, nil + x := new(msg.UpdateReadHistoryOutbox) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateReadHistoryOutbox", + zap.Int64("MaxID", x.MaxID), + zap.Int64("UpdateID", x.UpdateID), + zap.Int64("PeerID", x.Peer.ID), + ) + + _ = repo.Dialogs.UpdateReadOutboxMaxID(x.TeamID, x.Peer.ID, x.Peer.Type, x.MaxID) + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *message) updateMessageEdited(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateMessageEdited) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } + x := new(msg.UpdateMessageEdited) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } - r.Log().Debug("applies UpdateMessageEdited", - zap.Int64("MessageID", x.Message.ID), - zap.Int64("UpdateID", x.UpdateID), - ) + r.Log().Debug("applies UpdateMessageEdited", + zap.Int64("MessageID", x.Message.ID), + zap.Int64("UpdateID", x.UpdateID), + ) - repo.Messages.Save(x.Message) + repo.Messages.Save(x.Message) - res := []*msg.UpdateEnvelope{u} - return res, nil + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *message) updateMessageID(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - res := make([]*msg.UpdateEnvelope, 0) - x := new(msg.UpdateMessageID) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applied UpdateMessageID", - zap.Int64("RandomID", x.RandomID), - zap.Int64("MessageID", x.MessageID), - ) - - msgEnvelop := new(rony.MessageEnvelope) - msgEnvelop.Constructor = rony.C_MessageEnvelope - - sent := new(msg.MessagesSent) - sent.MessageID = x.MessageID - sent.RandomID = x.RandomID - sent.CreatedOn = time.Now().Unix() - - // If we are here, it means we receive UpdateNewMessage before UpdateMessageID / MessagesSent - // so we create a fake UpdateMessageDelete to remove the pending from the view - pm, _ := repo.PendingMessages.GetByRandomID(sent.RandomID) - - userMessage, _ := repo.Messages.Get(sent.MessageID) - if userMessage != nil { - r.Log().Info("received UpdateMessageID after UpdateNewMessage", - zap.Int64("RandomID", x.RandomID), - zap.Int64("MID", x.MessageID), - zap.String("Body", userMessage.Body), - ) - - if pm == nil { - r.Log().Warn("But we couldn't find Pending Message", - zap.Int64("RandomID", sent.RandomID), - zap.Int64("RealID", sent.MessageID), - ) - return res, nil - } - r.deletePendingMessage(pm) - return res, nil - } - - if pm == nil { - return nil, nil - } - r.Log().Info("received UpdateMessageID before UpdateNewMessage", - zap.Int64("RandomID", x.RandomID), - zap.Int64("MID", x.MessageID), - zap.Int64("PendingID", pm.ID), - ) - - repo.PendingMessages.SaveByRealID(sent.RandomID, sent.MessageID) - return res, nil + res := make([]*msg.UpdateEnvelope, 0) + x := new(msg.UpdateMessageID) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applied UpdateMessageID", + zap.Int64("RandomID", x.RandomID), + zap.Int64("MessageID", x.MessageID), + ) + + msgEnvelop := new(rony.MessageEnvelope) + msgEnvelop.Constructor = rony.C_MessageEnvelope + + sent := new(msg.MessagesSent) + sent.MessageID = x.MessageID + sent.RandomID = x.RandomID + sent.CreatedOn = time.Now().Unix() + + // If we are here, it means we receive UpdateNewMessage before UpdateMessageID / MessagesSent + // so we create a fake UpdateMessageDelete to remove the pending from the view + pm, _ := repo.PendingMessages.GetByRandomID(sent.RandomID) + + userMessage, _ := repo.Messages.Get(sent.MessageID) + if userMessage != nil { + r.Log().Info("received UpdateMessageID after UpdateNewMessage", + zap.Int64("RandomID", x.RandomID), + zap.Int64("MID", x.MessageID), + zap.String("Body", userMessage.Body), + ) + + if pm == nil { + r.Log().Warn("But we couldn't find Pending Message", + zap.Int64("RandomID", sent.RandomID), + zap.Int64("RealID", sent.MessageID), + ) + return res, nil + } + r.deletePendingMessage(pm) + return res, nil + } + + if pm == nil { + return nil, nil + } + r.Log().Info("received UpdateMessageID before UpdateNewMessage", + zap.Int64("RandomID", x.RandomID), + zap.Int64("MID", x.MessageID), + zap.Int64("PendingID", pm.ID), + ) + + repo.PendingMessages.SaveByRealID(sent.RandomID, sent.MessageID) + return res, nil } func (r *message) deletePendingMessage(pm *msg.ClientPendingMessage) { - // It means we have received the NewMessage - update := &msg.UpdateMessagesDeleted{ - Peer: &msg.Peer{ID: pm.PeerID, Type: pm.PeerType}, - MessageIDs: []int64{pm.ID}, - } - bytes, _ := update.Marshal() - - updateEnvelope := &msg.UpdateEnvelope{ - Constructor: msg.C_UpdateMessagesDeleted, - Update: bytes, - UpdateID: 0, - Timestamp: time.Now().Unix(), - } - - uiexec.ExecUpdate(msg.C_UpdateEnvelope, updateEnvelope) - - _ = repo.PendingMessages.Delete(pm.ID) + // It means we have received the NewMessage + update := &msg.UpdateMessagesDeleted{ + Peer: &msg.Peer{ID: pm.PeerID, Type: pm.PeerType}, + MessageIDs: []int64{pm.ID}, + } + bytes, _ := update.Marshal() + + updateEnvelope := &msg.UpdateEnvelope{ + Constructor: msg.C_UpdateMessagesDeleted, + Update: bytes, + UpdateID: 0, + Timestamp: time.Now().Unix(), + } + + uiexec.ExecUpdate(msg.C_UpdateEnvelope, updateEnvelope) + + _ = repo.PendingMessages.Delete(pm.ID) } func (r *message) updateDraftMessage(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateDraftMessage) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateDraftMessage", - zap.Int64("UpdateID", x.UpdateID), - ) - - dialog, _ := repo.Dialogs.Get(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) - if dialog != nil { - dialog.Draft = x.Message - repo.Dialogs.Save(dialog) - } - - res := []*msg.UpdateEnvelope{u} - return res, nil + x := new(msg.UpdateDraftMessage) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateDraftMessage", + zap.Int64("UpdateID", x.UpdateID), + ) + + dialog, _ := repo.Dialogs.Get(x.Message.TeamID, x.Message.PeerID, x.Message.PeerType) + if dialog != nil { + dialog.Draft = x.Message + repo.Dialogs.Save(dialog) + } + + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *message) updateDraftMessageCleared(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateDraftMessageCleared) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateDraftMessageCleared", - zap.Int64("UpdateID", x.UpdateID), - ) - - dialog, _ := repo.Dialogs.Get(x.TeamID, x.Peer.ID, x.Peer.Type) - if dialog != nil { - dialog.Draft = nil - _ = repo.Dialogs.Save(dialog) - } - - res := []*msg.UpdateEnvelope{u} - return res, nil + x := new(msg.UpdateDraftMessageCleared) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateDraftMessageCleared", + zap.Int64("UpdateID", x.UpdateID), + ) + + dialog, _ := repo.Dialogs.Get(x.TeamID, x.Peer.ID, x.Peer.Type) + if dialog != nil { + dialog.Draft = nil + _ = repo.Dialogs.Save(dialog) + } + + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *message) updateReaction(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateReaction{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateReaction", - zap.Int64("UpdateID", x.UpdateID), - ) - - err = repo.Messages.UpdateReactionCounter(x.MessageID, x.Counter, x.YourReactions) - if err != nil { - return nil, err - } - - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateReaction{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateReaction", + zap.Int64("UpdateID", x.UpdateID), + ) + + err = repo.Messages.UpdateReactionCounter(x.MessageID, x.Counter, x.YourReactions) + if err != nil { + return nil, err + } + + return []*msg.UpdateEnvelope{u}, nil } func (r *message) updateMessagePinned(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateMessagePinned{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateMessagePinned", - zap.Int64("UpdateID", x.UpdateID), - ) - - err = repo.Dialogs.UpdatePinMessageID(x.TeamID, x.Peer.ID, x.Peer.Type, x.MsgID) - if err != nil { - return nil, err - } - - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateMessagePinned{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateMessagePinned", + zap.Int64("UpdateID", x.UpdateID), + ) + + err = repo.Dialogs.UpdatePinMessageID(x.TeamID, x.Peer.ID, x.Peer.Type, x.MsgID) + if err != nil { + return nil, err + } + + return []*msg.UpdateEnvelope{u}, nil } func (r *message) updateReadMessagesContents(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateReadMessagesContents{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } + x := &msg.UpdateReadMessagesContents{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } - r.Log().Debug("applies UpdateReadMessagesContents", - zap.Int64s("MessageIDs", x.MessageIDs), - zap.Int64("UpdateID", x.UpdateID), - ) + r.Log().Debug("applies UpdateReadMessagesContents", + zap.Int64s("MessageIDs", x.MessageIDs), + zap.Int64("UpdateID", x.UpdateID), + ) - repo.Messages.SetContentRead(x.Peer.ID, x.Peer.Type, x.MessageIDs) + repo.Messages.SetContentRead(x.Peer.ID, x.Peer.Type, x.MessageIDs) - res := []*msg.UpdateEnvelope{u} - return res, nil + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *message) updateMessagesDeleted(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateMessagesDeleted) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateMessagesDeleted", - zap.Int64("UpdateID", x.UpdateID), - ) - - repo.Messages.Delete(r.SDK().SyncCtrl().GetUserID(), x.TeamID, x.Peer.ID, x.Peer.Type, x.MessageIDs...) - - update := new(msg.ClientUpdateMessagesDeleted) - update.PeerID = x.Peer.ID - update.PeerType = x.Peer.Type - update.MessageIDs = x.MessageIDs - - res := []*msg.UpdateEnvelope{u} - - updateEnvelope := new(msg.UpdateEnvelope) - updateEnvelope.Constructor = msg.C_ClientUpdateMessagesDeleted - updateEnvelope.Timestamp = u.Timestamp - updateEnvelope.UCount = 1 - updateEnvelope.UpdateID = u.UpdateID - updateEnvelope.Update, _ = update.Marshal() - res = append(res, updateEnvelope) - return res, nil + x := new(msg.UpdateMessagesDeleted) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateMessagesDeleted", + zap.Int64("UpdateID", x.UpdateID), + ) + + repo.Messages.Delete(r.SDK().SyncCtrl().GetUserID(), x.TeamID, x.Peer.ID, x.Peer.Type, x.MessageIDs...) + + update := new(msg.ClientUpdateMessagesDeleted) + update.PeerID = x.Peer.ID + update.PeerType = x.Peer.Type + update.MessageIDs = x.MessageIDs + + res := []*msg.UpdateEnvelope{u} + + updateEnvelope := new(msg.UpdateEnvelope) + updateEnvelope.Constructor = msg.C_ClientUpdateMessagesDeleted + updateEnvelope.Timestamp = u.Timestamp + updateEnvelope.UCount = 1 + updateEnvelope.UpdateID = u.UpdateID + updateEnvelope.Update, _ = update.Marshal() + res = append(res, updateEnvelope) + return res, nil } func (r *message) updateNotifySettings(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateNotifySettings) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } + x := new(msg.UpdateNotifySettings) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } - r.Log().Debug("applies UpdateNotifySettings", - zap.Int64("UpdateID", x.UpdateID), - ) + r.Log().Debug("applies UpdateNotifySettings", + zap.Int64("UpdateID", x.UpdateID), + ) - repo.Dialogs.UpdateNotifySetting(x.TeamID, x.NotifyPeer.ID, x.NotifyPeer.Type, x.Settings) + repo.Dialogs.UpdateNotifySetting(x.TeamID, x.NotifyPeer.ID, x.NotifyPeer.Type, x.Settings) - res := []*msg.UpdateEnvelope{u} - return res, nil + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *message) updateDialogPinned(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateDialogPinned) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateDialogPinned", - zap.Int64("UpdateID", x.UpdateID), - ) - - repo.Dialogs.UpdatePinned(x) - res := []*msg.UpdateEnvelope{u} - return res, nil + x := new(msg.UpdateDialogPinned) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateDialogPinned", + zap.Int64("UpdateID", x.UpdateID), + ) + + repo.Dialogs.UpdatePinned(x) + res := []*msg.UpdateEnvelope{u} + return res, nil } diff --git a/module/module.go b/module/module.go index 0a04dd19..6087848d 100644 --- a/module/module.go +++ b/module/module.go @@ -1,15 +1,15 @@ package module import ( - fileCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_file" - networkCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_network" - queueCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_queue" - syncCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_sync" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" + fileCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_file" + networkCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_network" + queueCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_queue" + syncCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_sync" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" ) /* @@ -23,85 +23,85 @@ import ( // RequestDelegate each request should have this callbacks type RequestDelegate interface { - OnComplete(b []byte) - OnTimeout(err error) - Flags() int32 + OnComplete(b []byte) + OnTimeout(err error) + Flags() int32 } // SDK represents the Prime or Mini River. type SDK interface { - Version() string - SyncCtrl() *syncCtrl.Controller - NetCtrl() *networkCtrl.Controller - QueueCtrl() *queueCtrl.Controller - FileCtrl() *fileCtrl.Controller - GetConnInfo() domain.RiverConfigurator - Module(name string) Module - Execute(cb request.Callback) (err error) + Version() string + SyncCtrl() *syncCtrl.Controller + NetCtrl() *networkCtrl.Controller + QueueCtrl() *queueCtrl.Controller + FileCtrl() *fileCtrl.Controller + GetConnInfo() domain.RiverConfigurator + Module(name string) Module + Execute(cb request.Callback) (err error) } type Module interface { - Name() string - Init(sdk SDK, logger *logs.Logger) - LocalHandlers() map[int64]request.LocalHandler - UpdateAppliers() map[int64]domain.UpdateApplier - MessageAppliers() map[int64]domain.MessageApplier - Execute(da request.Callback) + Name() string + Init(sdk SDK, logger *logs.Logger) + LocalHandlers() map[int64]request.LocalHandler + UpdateAppliers() map[int64]domain.UpdateApplier + MessageAppliers() map[int64]domain.MessageApplier + Execute(da request.Callback) } // Base provides the boilerplate code for every module. Hence developer only needs to write the module specific // LocalHandlers, UpdateAppliers and MessageAppliers. type Base struct { - sdk SDK - handlers map[int64]request.LocalHandler - updateAppliers map[int64]domain.UpdateApplier - messageAppliers map[int64]domain.MessageApplier - logger *logs.Logger + sdk SDK + handlers map[int64]request.LocalHandler + updateAppliers map[int64]domain.UpdateApplier + messageAppliers map[int64]domain.MessageApplier + logger *logs.Logger } func (b *Base) Init(sdk SDK, logger *logs.Logger) { - b.sdk = sdk - b.logger = logger + b.sdk = sdk + b.logger = logger } func (b *Base) Execute(da request.Callback) { - h := b.handlers[da.Constructor()] - if h == nil { - da.Response(rony.C_Error, errors.New("00", "MODULE_HANDLER_NOT_FOUND")) - return - } + h := b.handlers[da.Constructor()] + if h == nil { + da.Response(rony.C_Error, errors.New("00", "MODULE_HANDLER_NOT_FOUND")) + return + } - h(da) + h(da) } func (b *Base) RegisterUpdateAppliers(appliers map[int64]domain.UpdateApplier) { - b.updateAppliers = appliers + b.updateAppliers = appliers } func (b *Base) UpdateAppliers() map[int64]domain.UpdateApplier { - return b.updateAppliers + return b.updateAppliers } func (b *Base) RegisterMessageAppliers(appliers map[int64]domain.MessageApplier) { - b.messageAppliers = appliers + b.messageAppliers = appliers } func (b *Base) MessageAppliers() map[int64]domain.MessageApplier { - return b.messageAppliers + return b.messageAppliers } func (b *Base) RegisterHandlers(handlers map[int64]request.LocalHandler) { - b.handlers = handlers + b.handlers = handlers } func (b *Base) LocalHandlers() map[int64]request.LocalHandler { - return b.handlers + return b.handlers } func (b *Base) SDK() SDK { - return b.sdk + return b.sdk } func (b *Base) Log() *logs.Logger { - return b.logger + return b.logger } diff --git a/module/notification/notification.go b/module/notification/notification.go index 5bf5dbee..840e5cb6 100644 --- a/module/notification/notification.go +++ b/module/notification/notification.go @@ -1,13 +1,13 @@ package notification import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" + "go.uber.org/zap" ) /** @@ -17,50 +17,50 @@ import ( */ type notification struct { - module.Base + module.Base } func New() *notification { - r := ¬ification{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_ClientDismissNotification: r.clientDismissNotification, - msg.C_ClientGetNotificationDismissTime: r.clientGetNotificationDismissTime, - }, - ) - return r + r := ¬ification{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_ClientDismissNotification: r.clientDismissNotification, + msg.C_ClientGetNotificationDismissTime: r.clientGetNotificationDismissTime, + }, + ) + return r } func (r *notification) Name() string { - return module.Notification + return module.Notification } func (r *notification) clientDismissNotification(da request.Callback) { - req := &msg.ClientDismissNotification{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.ClientDismissNotification{} + if err := da.RequestData(req); err != nil { + return + } - err := repo.Notifications.SetNotificationDismissTime(da.TeamID(), req.Peer, req.Ts) - if err != nil { - r.Log().Error("got error on set client dismiss notification", zap.Error(err)) - } + err := repo.Notifications.SetNotificationDismissTime(da.TeamID(), req.Peer, req.Ts) + if err != nil { + r.Log().Error("got error on set client dismiss notification", zap.Error(err)) + } } func (r *notification) clientGetNotificationDismissTime(da request.Callback) { - req := &msg.ClientDismissNotification{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.ClientDismissNotification{} + if err := da.RequestData(req); err != nil { + return + } - ts, err := repo.Notifications.GetNotificationDismissTime(da.TeamID(), req.Peer) - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } + ts, err := repo.Notifications.GetNotificationDismissTime(da.TeamID(), req.Peer) + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } - res := &msg.ClientNotificationDismissTime{ - Ts: ts, - } - da.Response(msg.C_ClientNotificationDismissTime, res) + res := &msg.ClientNotificationDismissTime{ + Ts: ts, + } + da.Response(msg.C_ClientNotificationDismissTime, res) } diff --git a/module/search/handlers.go b/module/search/handlers.go index d2171834..878a7555 100644 --- a/module/search/handlers.go +++ b/module/search/handlers.go @@ -1,14 +1,15 @@ package search import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" - "strings" - "time" + "strings" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" ) /* @@ -21,173 +22,173 @@ import ( */ func (r *search) clientGlobalSearch(da request.Callback) { - req := &msg.ClientGlobalSearch{} - if err := da.RequestData(req); err != nil { - return - } - - searchPhrase := strings.ToLower(req.Text) - searchResults := &msg.ClientSearchResult{} - var userContacts []*msg.ContactUser - var nonContacts []*msg.ContactUser - var msgs []*msg.UserMessage - if len(req.LabelIDs) > 0 { - if req.Peer != nil { - msgs = repo.Messages.SearchByLabels(da.TeamID(), req.LabelIDs, req.Peer.ID, req.Limit) - } else { - msgs = repo.Messages.SearchByLabels(da.TeamID(), req.LabelIDs, 0, req.Limit) - } - - } else if req.SenderID != 0 { - msgs = repo.Messages.SearchBySender(da.TeamID(), searchPhrase, req.SenderID, req.Peer.ID, req.Limit) - } else if req.Peer != nil { - msgs = repo.Messages.SearchTextByPeerID(da.TeamID(), searchPhrase, req.Peer.ID, req.Limit) - } else { - msgs = repo.Messages.SearchText(da.TeamID(), searchPhrase, req.Limit) - } - - // get users && group IDs - userIDs := domain.MInt64B{} - matchedUserIDs := domain.MInt64B{} - groupIDs := domain.MInt64B{} - for _, m := range msgs { - if m.PeerType == int32(msg.PeerType_PeerSelf) || m.PeerType == int32(msg.PeerType_PeerUser) { - userIDs[m.PeerID] = true - } - if m.PeerType == int32(msg.PeerType_PeerGroup) { - groupIDs[m.PeerID] = true - } - if m.SenderID > 0 { - userIDs[m.SenderID] = true - } else { - groupIDs[m.PeerID] = true - } - if m.FwdSenderID > 0 { - userIDs[m.FwdSenderID] = true - } else { - groupIDs[m.FwdSenderID] = true - } - } - - // if peerID == 0 then look for group and contact names too - if req.Peer == nil { - userContacts, _ = repo.Users.SearchContacts(da.TeamID(), searchPhrase) - for _, userContact := range userContacts { - matchedUserIDs[userContact.ID] = true - } - nonContacts = repo.Users.SearchNonContacts(da.TeamID(), searchPhrase) - for _, userContact := range nonContacts { - matchedUserIDs[userContact.ID] = true - } - searchResults.MatchedGroups = repo.Groups.Search(da.TeamID(), searchPhrase) - } - - users, _ := repo.Users.GetMany(userIDs.ToArray()) - groups, _ := repo.Groups.GetMany(groupIDs.ToArray()) - matchedUsers, _ := repo.Users.GetMany(matchedUserIDs.ToArray()) - - searchResults.Messages = msgs - searchResults.Users = users - searchResults.Groups = groups - searchResults.MatchedUsers = matchedUsers - da.Response(msg.C_ClientSearchResult, searchResults) + req := &msg.ClientGlobalSearch{} + if err := da.RequestData(req); err != nil { + return + } + + searchPhrase := strings.ToLower(req.Text) + searchResults := &msg.ClientSearchResult{} + var userContacts []*msg.ContactUser + var nonContacts []*msg.ContactUser + var msgs []*msg.UserMessage + if len(req.LabelIDs) > 0 { + if req.Peer != nil { + msgs = repo.Messages.SearchByLabels(da.TeamID(), req.LabelIDs, req.Peer.ID, req.Limit) + } else { + msgs = repo.Messages.SearchByLabels(da.TeamID(), req.LabelIDs, 0, req.Limit) + } + + } else if req.SenderID != 0 { + msgs = repo.Messages.SearchBySender(da.TeamID(), searchPhrase, req.SenderID, req.Peer.ID, req.Limit) + } else if req.Peer != nil { + msgs = repo.Messages.SearchTextByPeerID(da.TeamID(), searchPhrase, req.Peer.ID, req.Limit) + } else { + msgs = repo.Messages.SearchText(da.TeamID(), searchPhrase, req.Limit) + } + + // get users && group IDs + userIDs := domain.MInt64B{} + matchedUserIDs := domain.MInt64B{} + groupIDs := domain.MInt64B{} + for _, m := range msgs { + if m.PeerType == int32(msg.PeerType_PeerSelf) || m.PeerType == int32(msg.PeerType_PeerUser) { + userIDs[m.PeerID] = true + } + if m.PeerType == int32(msg.PeerType_PeerGroup) { + groupIDs[m.PeerID] = true + } + if m.SenderID > 0 { + userIDs[m.SenderID] = true + } else { + groupIDs[m.PeerID] = true + } + if m.FwdSenderID > 0 { + userIDs[m.FwdSenderID] = true + } else { + groupIDs[m.FwdSenderID] = true + } + } + + // if peerID == 0 then look for group and contact names too + if req.Peer == nil { + userContacts, _ = repo.Users.SearchContacts(da.TeamID(), searchPhrase) + for _, userContact := range userContacts { + matchedUserIDs[userContact.ID] = true + } + nonContacts = repo.Users.SearchNonContacts(da.TeamID(), searchPhrase) + for _, userContact := range nonContacts { + matchedUserIDs[userContact.ID] = true + } + searchResults.MatchedGroups = repo.Groups.Search(da.TeamID(), searchPhrase) + } + + users, _ := repo.Users.GetMany(userIDs.ToArray()) + groups, _ := repo.Groups.GetMany(groupIDs.ToArray()) + matchedUsers, _ := repo.Users.GetMany(matchedUserIDs.ToArray()) + + searchResults.Messages = msgs + searchResults.Users = users + searchResults.Groups = groups + searchResults.MatchedUsers = matchedUsers + da.Response(msg.C_ClientSearchResult, searchResults) } func (r *search) clientGetRecentSearch(da request.Callback) { - req := &msg.ClientGetRecentSearch{} - if err := da.RequestData(req); err != nil { - return - } - - recentSearches := repo.RecentSearches.List(da.TeamID(), req.Limit) - - // get users && group IDs - userIDs := domain.MInt64B{} - groupIDs := domain.MInt64B{} - for _, r := range recentSearches { - if r.Peer.Type == int32(msg.PeerType_PeerSelf) || r.Peer.Type == int32(msg.PeerType_PeerUser) { - userIDs[r.Peer.ID] = true - } - if r.Peer.Type == int32(msg.PeerType_PeerGroup) { - groupIDs[r.Peer.ID] = true - } - } - - users, _ := repo.Users.GetMany(userIDs.ToArray()) - groups, _ := repo.Groups.GetMany(groupIDs.ToArray()) - - res := &msg.ClientRecentSearchMany{ - RecentSearches: recentSearches, - Users: users, - Groups: groups, - } - da.Response(msg.C_ClientRecentSearchMany, res) + req := &msg.ClientGetRecentSearch{} + if err := da.RequestData(req); err != nil { + return + } + + recentSearches := repo.RecentSearches.List(da.TeamID(), req.Limit) + + // get users && group IDs + userIDs := domain.MInt64B{} + groupIDs := domain.MInt64B{} + for _, r := range recentSearches { + if r.Peer.Type == int32(msg.PeerType_PeerSelf) || r.Peer.Type == int32(msg.PeerType_PeerUser) { + userIDs[r.Peer.ID] = true + } + if r.Peer.Type == int32(msg.PeerType_PeerGroup) { + groupIDs[r.Peer.ID] = true + } + } + + users, _ := repo.Users.GetMany(userIDs.ToArray()) + groups, _ := repo.Groups.GetMany(groupIDs.ToArray()) + + res := &msg.ClientRecentSearchMany{ + RecentSearches: recentSearches, + Users: users, + Groups: groups, + } + da.Response(msg.C_ClientRecentSearchMany, res) } func (r *search) clientPutRecentSearch(da request.Callback) { - req := &msg.ClientPutRecentSearch{} - if err := da.RequestData(req); err != nil { - return - } - - peer := &msg.Peer{ - ID: req.Peer.ID, - Type: int32(req.Peer.Type), - AccessHash: req.Peer.AccessHash, - } - - recentSearch := &msg.ClientRecentSearch{ - Peer: peer, - Date: int32(time.Now().Unix()), - } - - err := repo.RecentSearches.Put(da.TeamID(), recentSearch) - - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } - - res := &msg.Bool{ - Result: true, - } - da.Response(msg.C_Bool, res) + req := &msg.ClientPutRecentSearch{} + if err := da.RequestData(req); err != nil { + return + } + + peer := &msg.Peer{ + ID: req.Peer.ID, + Type: int32(req.Peer.Type), + AccessHash: req.Peer.AccessHash, + } + + recentSearch := &msg.ClientRecentSearch{ + Peer: peer, + Date: int32(time.Now().Unix()), + } + + err := repo.RecentSearches.Put(da.TeamID(), recentSearch) + + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } + + res := &msg.Bool{ + Result: true, + } + da.Response(msg.C_Bool, res) } func (r *search) clientRemoveAllRecentSearches(da request.Callback) { - req := &msg.ClientRemoveAllRecentSearches{} - if err := da.RequestData(req); err != nil { - return - } - - err := repo.RecentSearches.Clear(da.TeamID()) - - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } - - res := &msg.Bool{ - Result: true, - } - da.Response(msg.C_Bool, res) + req := &msg.ClientRemoveAllRecentSearches{} + if err := da.RequestData(req); err != nil { + return + } + + err := repo.RecentSearches.Clear(da.TeamID()) + + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } + + res := &msg.Bool{ + Result: true, + } + da.Response(msg.C_Bool, res) } func (r *search) clientRemoveRecentSearch(da request.Callback) { - req := &msg.ClientRemoveRecentSearch{} - if err := da.RequestData(req); err != nil { - return - } - - err := repo.RecentSearches.Delete(da.TeamID(), req.Peer) - - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } - - res := &msg.Bool{ - Result: true, - } - da.Response(msg.C_Bool, res) + req := &msg.ClientRemoveRecentSearch{} + if err := da.RequestData(req); err != nil { + return + } + + err := repo.RecentSearches.Delete(da.TeamID(), req.Peer) + + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } + + res := &msg.Bool{ + Result: true, + } + da.Response(msg.C_Bool, res) } diff --git a/module/search/search.go b/module/search/search.go index b237ce15..826c108f 100644 --- a/module/search/search.go +++ b/module/search/search.go @@ -1,9 +1,9 @@ package search import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -16,23 +16,23 @@ import ( */ type search struct { - module.Base + module.Base } func New() *search { - r := &search{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_ClientGetRecentSearch: r.clientGetRecentSearch, - msg.C_ClientGlobalSearch: r.clientGlobalSearch, - msg.C_ClientPutRecentSearch: r.clientPutRecentSearch, - msg.C_ClientRemoveAllRecentSearches: r.clientRemoveAllRecentSearches, - msg.C_ClientRemoveRecentSearch: r.clientRemoveRecentSearch, - }, - ) - return r + r := &search{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_ClientGetRecentSearch: r.clientGetRecentSearch, + msg.C_ClientGlobalSearch: r.clientGlobalSearch, + msg.C_ClientPutRecentSearch: r.clientPutRecentSearch, + msg.C_ClientRemoveAllRecentSearches: r.clientRemoveAllRecentSearches, + msg.C_ClientRemoveRecentSearch: r.clientRemoveRecentSearch, + }, + ) + return r } func (r *search) Name() string { - return module.Search + return module.Search } diff --git a/module/system/handlers.go b/module/system/handlers.go index 5670e847..2edc0b8a 100644 --- a/module/system/handlers.go +++ b/module/system/handlers.go @@ -1,9 +1,9 @@ package system import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" ) /* @@ -16,5 +16,5 @@ import ( */ func (r *system) systemGetConfig(da request.Callback) { - da.Response(msg.C_SystemConfig, domain.SysConfig) + da.Response(msg.C_SystemConfig, domain.SysConfig) } diff --git a/module/system/message_appliers.go b/module/system/message_appliers.go index 7d9b750a..66800037 100644 --- a/module/system/message_appliers.go +++ b/module/system/message_appliers.go @@ -1,11 +1,11 @@ package system import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -18,23 +18,23 @@ import ( */ func (r *system) systemConfig(e *rony.MessageEnvelope) { - u := &msg.SystemConfig{} - err := u.Unmarshal(e.Message) - if err != nil { - r.Log().Error("SystemModule couldn't unmarshal SystemConfig", zap.Error(err)) - return - } + u := &msg.SystemConfig{} + err := u.Unmarshal(e.Message) + if err != nil { + r.Log().Error("SystemModule couldn't unmarshal SystemConfig", zap.Error(err)) + return + } - r.Log().Debug("SystemModule applies SystemConfig") + r.Log().Debug("SystemModule applies SystemConfig") - sysConfBytes, _ := u.Marshal() - domain.SysConfig.Reactions = domain.SysConfig.Reactions[:0] - err = domain.SysConfig.Unmarshal(sysConfBytes) - if err != nil { - r.Log().Error("SystemModule got error on unmarshalling SystemConfig", zap.Error(err)) - } - err = repo.System.SaveBytes("SysConfig", sysConfBytes) - if err != nil { - r.Log().Error("SystemModule got error on saving SystemConfig", zap.Error(err)) - } + sysConfBytes, _ := u.Marshal() + domain.SysConfig.Reactions = domain.SysConfig.Reactions[:0] + err = domain.SysConfig.Unmarshal(sysConfBytes) + if err != nil { + r.Log().Error("SystemModule got error on unmarshalling SystemConfig", zap.Error(err)) + } + err = repo.System.SaveBytes("SysConfig", sysConfBytes) + if err != nil { + r.Log().Error("SystemModule got error on saving SystemConfig", zap.Error(err)) + } } diff --git a/module/system/system.go b/module/system/system.go index 8a97f46f..63382175 100644 --- a/module/system/system.go +++ b/module/system/system.go @@ -1,10 +1,10 @@ package system import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -17,24 +17,24 @@ import ( */ type system struct { - module.Base + module.Base } func New() *system { - r := &system{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_SystemGetConfig: r.systemGetConfig, - }, - ) - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_SystemConfig: r.systemConfig, - }, - ) - return r + r := &system{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_SystemGetConfig: r.systemGetConfig, + }, + ) + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_SystemConfig: r.systemConfig, + }, + ) + return r } func (r *system) Name() string { - return module.System + return module.System } diff --git a/module/team/handlers.go b/module/team/handlers.go index b739cfdb..4bfc0bca 100644 --- a/module/team/handlers.go +++ b/module/team/handlers.go @@ -1,11 +1,11 @@ package team import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" ) /* @@ -18,38 +18,38 @@ import ( */ func (r *team) teamEdit(da request.Callback) { - req := &msg.TeamEdit{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.TeamEdit{} + if err := da.RequestData(req); err != nil { + return + } - team, _ := repo.Teams.Get(req.TeamID) + team, _ := repo.Teams.Get(req.TeamID) - if team != nil { - team.Name = req.Name - _ = repo.Teams.Save(team) - } + if team != nil { + team.Name = req.Name + _ = repo.Teams.Save(team) + } - r.SDK().QueueCtrl().EnqueueCommand(da) + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *team) clientGetTeamCounters(da request.Callback) { - req := &msg.ClientGetTeamCounters{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.ClientGetTeamCounters{} + if err := da.RequestData(req); err != nil { + return + } - unreadCount, mentionCount, err := repo.Dialogs.CountAllUnread(r.SDK().GetConnInfo().PickupUserID(), req.Team.ID, req.WithMutes) + unreadCount, mentionCount, err := repo.Dialogs.CountAllUnread(r.SDK().GetConnInfo().PickupUserID(), req.Team.ID, req.WithMutes) - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } - res := &msg.ClientTeamCounters{ - UnreadCount: int64(unreadCount), - MentionCount: int64(mentionCount), - } + res := &msg.ClientTeamCounters{ + UnreadCount: int64(unreadCount), + MentionCount: int64(mentionCount), + } - da.Response(msg.C_ClientTeamCounters, res) + da.Response(msg.C_ClientTeamCounters, res) } diff --git a/module/team/message_appliers.go b/module/team/message_appliers.go index 32d056b9..23a1fd46 100644 --- a/module/team/message_appliers.go +++ b/module/team/message_appliers.go @@ -1,10 +1,10 @@ package team import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -17,31 +17,31 @@ import ( */ func (r *team) teamsMany(e *rony.MessageEnvelope) { - tm := &msg.TeamsMany{} - err := tm.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal TeamsMany", zap.Error(err)) - return - } + tm := &msg.TeamsMany{} + err := tm.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal TeamsMany", zap.Error(err)) + return + } - err = repo.Users.Save(tm.Users...) - r.Log().ErrorOnErr("couldn't save teamsMany users", err) + err = repo.Users.Save(tm.Users...) + r.Log().ErrorOnErr("couldn't save teamsMany users", err) - err = repo.Teams.Clear() - r.Log().ErrorOnErr("couldn't clear saved teams", err) + err = repo.Teams.Clear() + r.Log().ErrorOnErr("couldn't clear saved teams", err) - err = repo.Teams.Save(tm.Teams...) - r.Log().ErrorOnErr("couldn't save teamsMany teams", err) + err = repo.Teams.Save(tm.Teams...) + r.Log().ErrorOnErr("couldn't save teamsMany teams", err) } func (r *team) teamMembers(e *rony.MessageEnvelope) { - tm := &msg.TeamMembers{} - err := tm.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal TeamMembers", zap.Error(err)) - return - } - - err = repo.Users.Save(tm.Users...) - r.Log().ErrorOnErr("couldn't save teamMembers users", err) + tm := &msg.TeamMembers{} + err := tm.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal TeamMembers", zap.Error(err)) + return + } + + err = repo.Users.Save(tm.Users...) + r.Log().ErrorOnErr("couldn't save teamMembers users", err) } diff --git a/module/team/team.go b/module/team/team.go index 901d6f50..152b85fa 100644 --- a/module/team/team.go +++ b/module/team/team.go @@ -1,10 +1,10 @@ package team import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -17,35 +17,35 @@ import ( */ type team struct { - module.Base + module.Base } func New() *team { - r := &team{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_TeamEdit: r.teamEdit, - msg.C_ClientGetTeamCounters: r.clientGetTeamCounters, - }, - ) - r.RegisterUpdateAppliers( - map[int64]domain.UpdateApplier{ - msg.C_UpdateTeam: r.updateTeam, - msg.C_UpdateTeamCreated: r.updateTeamCreated, - msg.C_UpdateTeamMemberAdded: r.updateTeamMemberAdded, - msg.C_UpdateTeamMemberRemoved: r.updateTeamMemberRemoved, - msg.C_UpdateTeamMemberStatus: r.updateTeamMemberStatus, - }, - ) - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_TeamMembers: r.teamMembers, - msg.C_TeamsMany: r.teamsMany, - }, - ) - return r + r := &team{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_TeamEdit: r.teamEdit, + msg.C_ClientGetTeamCounters: r.clientGetTeamCounters, + }, + ) + r.RegisterUpdateAppliers( + map[int64]domain.UpdateApplier{ + msg.C_UpdateTeam: r.updateTeam, + msg.C_UpdateTeamCreated: r.updateTeamCreated, + msg.C_UpdateTeamMemberAdded: r.updateTeamMemberAdded, + msg.C_UpdateTeamMemberRemoved: r.updateTeamMemberRemoved, + msg.C_UpdateTeamMemberStatus: r.updateTeamMemberStatus, + }, + ) + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_TeamMembers: r.teamMembers, + msg.C_TeamsMany: r.teamsMany, + }, + ) + return r } func (r *team) Name() string { - return module.Team + return module.Team } diff --git a/module/team/update_appliers.go b/module/team/update_appliers.go index 7d477f6f..6c8a4a9f 100644 --- a/module/team/update_appliers.go +++ b/module/team/update_appliers.go @@ -1,10 +1,10 @@ package team import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "go.uber.org/zap" ) /* @@ -17,108 +17,108 @@ import ( */ func (r *team) updateTeamMemberAdded(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateTeamMemberAdded{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateTeamMemberAdded", - zap.Int64("UpdateID", x.UpdateID), - ) - - _ = repo.Users.Save(x.User) - _ = repo.Users.SaveContact(x.TeamID, x.Contact) - err = repo.System.SaveInt(domain.GetContactsGetHashKey(x.TeamID), uint64(x.Hash)) - if err != nil { - return nil, err - } - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateTeamMemberAdded{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateTeamMemberAdded", + zap.Int64("UpdateID", x.UpdateID), + ) + + _ = repo.Users.Save(x.User) + _ = repo.Users.SaveContact(x.TeamID, x.Contact) + err = repo.System.SaveInt(domain.GetContactsGetHashKey(x.TeamID), uint64(x.Hash)) + if err != nil { + return nil, err + } + return []*msg.UpdateEnvelope{u}, nil } func (r *team) updateTeamMemberRemoved(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateTeamMemberRemoved{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateTeamMemberRemoved", - zap.Int64("UpdateID", x.UpdateID), - ) - - if x.UserID == r.SDK().GetConnInfo().PickupUserID() { - // we have been deleted from the team - _ = repo.Teams.Delete(x.TeamID) - _ = repo.Users.DeleteAllContacts(x.TeamID) - } else { - _ = repo.Users.DeleteContact(x.TeamID, x.UserID) - err = repo.System.SaveInt(domain.GetContactsGetHashKey(x.TeamID), uint64(x.Hash)) - if err != nil { - return nil, err - } - } - - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateTeamMemberRemoved{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateTeamMemberRemoved", + zap.Int64("UpdateID", x.UpdateID), + ) + + if x.UserID == r.SDK().GetConnInfo().PickupUserID() { + // we have been deleted from the team + _ = repo.Teams.Delete(x.TeamID) + _ = repo.Users.DeleteAllContacts(x.TeamID) + } else { + _ = repo.Users.DeleteContact(x.TeamID, x.UserID) + err = repo.System.SaveInt(domain.GetContactsGetHashKey(x.TeamID), uint64(x.Hash)) + if err != nil { + return nil, err + } + } + + return []*msg.UpdateEnvelope{u}, nil } // TODO:: improve applier to update data locally func (r *team) updateTeamMemberStatus(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateTeamMemberStatus{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } + x := &msg.UpdateTeamMemberStatus{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } - r.Log().Debug("applies UpdateTeamMemberStatus", - zap.Int64("UpdateID", x.UpdateID), - ) + r.Log().Debug("applies UpdateTeamMemberStatus", + zap.Int64("UpdateID", x.UpdateID), + ) - return []*msg.UpdateEnvelope{u}, nil + return []*msg.UpdateEnvelope{u}, nil } func (r *team) updateTeamCreated(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateTeamCreated{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateTeamCreated", - zap.Int64("UpdateID", x.UpdateID), - ) - - err = repo.Teams.Save(x.Team) - if err != nil { - return nil, err - } - - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateTeamCreated{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateTeamCreated", + zap.Int64("UpdateID", x.UpdateID), + ) + + err = repo.Teams.Save(x.Team) + if err != nil { + return nil, err + } + + return []*msg.UpdateEnvelope{u}, nil } func (r *team) updateTeam(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateTeam{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } - - r.Log().Debug("applies UpdateTeam", - zap.Int64("UpdateID", x.UpdateID), - zap.String("Name", x.Name), - ) - - t, err := repo.Teams.Get(x.TeamID) - if err != nil { - return nil, nil - } - - t.Name = x.Name - - err = repo.Teams.Save(t) - if err != nil { - return nil, err - } - - return []*msg.UpdateEnvelope{u}, nil + x := &msg.UpdateTeam{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } + + r.Log().Debug("applies UpdateTeam", + zap.Int64("UpdateID", x.UpdateID), + zap.String("Name", x.Name), + ) + + t, err := repo.Teams.Get(x.TeamID) + if err != nil { + return nil, nil + } + + t.Name = x.Name + + err = repo.Teams.Save(t) + if err != nil { + return nil, err + } + + return []*msg.UpdateEnvelope{u}, nil } diff --git a/module/user/handler.go b/module/user/handler.go index 701066d9..1e1ef6cf 100644 --- a/module/user/handler.go +++ b/module/user/handler.go @@ -1,11 +1,12 @@ package user import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "sort" + "sort" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" ) /* @@ -18,79 +19,79 @@ import ( */ func (r *user) usersGetFull(da request.Callback) { - req := &msg.UsersGetFull{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.UsersGetFull{} + if err := da.RequestData(req); err != nil { + return + } - userIDs := domain.MInt64B{} - for _, v := range req.Users { - userIDs[v.UserID] = true - } + userIDs := domain.MInt64B{} + for _, v := range req.Users { + userIDs[v.UserID] = true + } - users, outDated, _ := repo.Users.GetManyWithOutdated(userIDs.ToArray()) - allResolved := len(users) == len(userIDs) - if allResolved { - res := &msg.UsersMany{} - for _, user := range users { - user.PhotoGallery = repo.Users.GetPhotoGallery(user.ID) - sort.Slice(user.PhotoGallery, func(i, j int) bool { - return user.PhotoGallery[i].PhotoID > user.PhotoGallery[j].PhotoID - }) - } - res.Users = users - da.Response(msg.C_UsersMany, res) + users, outDated, _ := repo.Users.GetManyWithOutdated(userIDs.ToArray()) + allResolved := len(users) == len(userIDs) + if allResolved { + res := &msg.UsersMany{} + for _, user := range users { + user.PhotoGallery = repo.Users.GetPhotoGallery(user.ID) + sort.Slice(user.PhotoGallery, func(i, j int) bool { + return user.PhotoGallery[i].PhotoID > user.PhotoGallery[j].PhotoID + }) + } + res.Users = users + da.Response(msg.C_UsersMany, res) - if len(outDated) > 0 { - req.Users = req.Users[:0] - for _, user := range outDated { - req.Users = append(req.Users, &msg.InputUser{ - UserID: user.ID, - AccessHash: user.AccessHash, - }) - } - // TODO:: update da with new request - r.SDK().QueueCtrl().EnqueueCommand(da) - } - return - } + if len(outDated) > 0 { + req.Users = req.Users[:0] + for _, user := range outDated { + req.Users = append(req.Users, &msg.InputUser{ + UserID: user.ID, + AccessHash: user.AccessHash, + }) + } + // TODO:: update da with new request + r.SDK().QueueCtrl().EnqueueCommand(da) + } + return + } - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } func (r *user) usersGet(da request.Callback) { - req := &msg.UsersGet{} - if err := da.RequestData(req); err != nil { - return - } + req := &msg.UsersGet{} + if err := da.RequestData(req); err != nil { + return + } - userIDs := domain.MInt64B{} - for _, v := range req.Users { - userIDs[v.UserID] = true - } + userIDs := domain.MInt64B{} + for _, v := range req.Users { + userIDs[v.UserID] = true + } - users, outDated, _ := repo.Users.GetManyWithOutdated(userIDs.ToArray()) - allResolved := len(users) == len(userIDs) - if allResolved { - res := new(msg.UsersMany) - res.Users = users - da.Response(msg.C_UsersMany, res) + users, outDated, _ := repo.Users.GetManyWithOutdated(userIDs.ToArray()) + allResolved := len(users) == len(userIDs) + if allResolved { + res := new(msg.UsersMany) + res.Users = users + da.Response(msg.C_UsersMany, res) - if len(outDated) > 0 { - req.Users = req.Users[:0] - for _, user := range outDated { - req.Users = append(req.Users, &msg.InputUser{ - UserID: user.ID, - AccessHash: user.AccessHash, - }) - } - // TODO:: update da with new request - r.SDK().QueueCtrl().EnqueueCommand(da) - } - return - } + if len(outDated) > 0 { + req.Users = req.Users[:0] + for _, user := range outDated { + req.Users = append(req.Users, &msg.InputUser{ + UserID: user.ID, + AccessHash: user.AccessHash, + }) + } + // TODO:: update da with new request + r.SDK().QueueCtrl().EnqueueCommand(da) + } + return + } - // send the request to server - r.SDK().QueueCtrl().EnqueueCommand(da) + // send the request to server + r.SDK().QueueCtrl().EnqueueCommand(da) } diff --git a/module/user/message_appliers.go b/module/user/message_appliers.go index 20a6f754..8911a58d 100644 --- a/module/user/message_appliers.go +++ b/module/user/message_appliers.go @@ -1,10 +1,10 @@ package user import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -17,14 +17,14 @@ import ( */ func (r *user) usersMany(e *rony.MessageEnvelope) { - x := new(msg.UsersMany) - err := x.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal UsersMany", zap.Error(err)) - return - } - r.Log().Debug("applies usersMany", - zap.Int("Users", len(x.Users)), - ) - _ = repo.Users.Save(x.Users...) + x := new(msg.UsersMany) + err := x.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal UsersMany", zap.Error(err)) + return + } + r.Log().Debug("applies usersMany", + zap.Int("Users", len(x.Users)), + ) + _ = repo.Users.Save(x.Users...) } diff --git a/module/user/update_appliers.go b/module/user/update_appliers.go index 8232dbe9..9962711c 100644 --- a/module/user/update_appliers.go +++ b/module/user/update_appliers.go @@ -1,9 +1,9 @@ package user import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "go.uber.org/zap" ) /* @@ -16,79 +16,79 @@ import ( */ func (r *user) updateUsername(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateUsername) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } + x := new(msg.UpdateUsername) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } - r.Log().Debug("applies UpdateUsername", - zap.Int64("UpdateID", x.UpdateID), - ) + r.Log().Debug("applies UpdateUsername", + zap.Int64("UpdateID", x.UpdateID), + ) - if x.UserID == r.SDK().SyncCtrl().GetUserID() { - r.SDK().GetConnInfo().ChangeUserID(x.UserID) - r.SDK().GetConnInfo().ChangeUsername(x.Username) - r.SDK().GetConnInfo().ChangeFirstName(x.FirstName) - r.SDK().GetConnInfo().ChangeLastName(x.LastName) - r.SDK().GetConnInfo().ChangePhone(x.Phone) - r.SDK().GetConnInfo().ChangeBio(x.Bio) - r.SDK().GetConnInfo().Save() - } + if x.UserID == r.SDK().SyncCtrl().GetUserID() { + r.SDK().GetConnInfo().ChangeUserID(x.UserID) + r.SDK().GetConnInfo().ChangeUsername(x.Username) + r.SDK().GetConnInfo().ChangeFirstName(x.FirstName) + r.SDK().GetConnInfo().ChangeLastName(x.LastName) + r.SDK().GetConnInfo().ChangePhone(x.Phone) + r.SDK().GetConnInfo().ChangeBio(x.Bio) + r.SDK().GetConnInfo().Save() + } - err = repo.Users.UpdateProfile(x.UserID, x.FirstName, x.LastName, x.Username, x.Bio, x.Phone) - if err != nil { - return nil, err - } + err = repo.Users.UpdateProfile(x.UserID, x.FirstName, x.LastName, x.Username, x.Bio, x.Phone) + if err != nil { + return nil, err + } - res := []*msg.UpdateEnvelope{u} - return res, nil + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *user) updateUserPhoto(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := new(msg.UpdateUserPhoto) - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } + x := new(msg.UpdateUserPhoto) + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } - r.Log().Debug("applies UpdateUserPhoto", - zap.Int64("UpdateID", x.UpdateID), - zap.Any("PhotoID", x.PhotoID), - ) + r.Log().Debug("applies UpdateUserPhoto", + zap.Int64("UpdateID", x.UpdateID), + zap.Any("PhotoID", x.PhotoID), + ) - if x.Photo != nil { - err = repo.Users.UpdatePhoto(x.UserID, x.Photo) - if err != nil { - r.Log().Warn("got error on updating user's profile photo", - zap.Int64("UserID", x.UserID), - zap.Any("Photo", x.Photo), - ) - } - } + if x.Photo != nil { + err = repo.Users.UpdatePhoto(x.UserID, x.Photo) + if err != nil { + r.Log().Warn("got error on updating user's profile photo", + zap.Int64("UserID", x.UserID), + zap.Any("Photo", x.Photo), + ) + } + } - for _, photoID := range x.DeletedPhotoIDs { - _ = repo.Users.RemovePhotoGallery(x.UserID, photoID) - } + for _, photoID := range x.DeletedPhotoIDs { + _ = repo.Users.RemovePhotoGallery(x.UserID, photoID) + } - res := []*msg.UpdateEnvelope{u} - return res, nil + res := []*msg.UpdateEnvelope{u} + return res, nil } func (r *user) updateUserBlocked(u *msg.UpdateEnvelope) ([]*msg.UpdateEnvelope, error) { - x := &msg.UpdateUserBlocked{} - err := x.Unmarshal(u.Update) - if err != nil { - return nil, err - } + x := &msg.UpdateUserBlocked{} + err := x.Unmarshal(u.Update) + if err != nil { + return nil, err + } - r.Log().Debug("applies UpdateUserBlocked", - zap.Int64("UpdateID", x.UpdateID), - ) + r.Log().Debug("applies UpdateUserBlocked", + zap.Int64("UpdateID", x.UpdateID), + ) - err = repo.Users.UpdateBlocked(x.UserID, x.Blocked) - if err != nil { - return nil, err - } - return []*msg.UpdateEnvelope{u}, nil + err = repo.Users.UpdateBlocked(x.UserID, x.Blocked) + if err != nil { + return nil, err + } + return []*msg.UpdateEnvelope{u}, nil } diff --git a/module/user/user.go b/module/user/user.go index d7c70b25..3b5d7a1c 100644 --- a/module/user/user.go +++ b/module/user/user.go @@ -1,10 +1,10 @@ package user import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" ) /* @@ -17,32 +17,32 @@ import ( */ type user struct { - module.Base + module.Base } func New() *user { - r := &user{} - r.RegisterHandlers( - map[int64]request.LocalHandler{ - msg.C_UsersGet: r.usersGet, - msg.C_UsersGetFull: r.usersGetFull, - }, - ) - r.RegisterUpdateAppliers( - map[int64]domain.UpdateApplier{ - msg.C_UpdateUsername: r.updateUsername, - msg.C_UpdateUserBlocked: r.updateUserBlocked, - msg.C_UpdateUserPhoto: r.updateUserPhoto, - }, - ) - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_UsersMany: r.usersMany, - }, - ) - return r + r := &user{} + r.RegisterHandlers( + map[int64]request.LocalHandler{ + msg.C_UsersGet: r.usersGet, + msg.C_UsersGetFull: r.usersGetFull, + }, + ) + r.RegisterUpdateAppliers( + map[int64]domain.UpdateApplier{ + msg.C_UpdateUsername: r.updateUsername, + msg.C_UpdateUserBlocked: r.updateUserBlocked, + msg.C_UpdateUserPhoto: r.updateUserPhoto, + }, + ) + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_UsersMany: r.usersMany, + }, + ) + return r } func (r *user) Name() string { - return module.User + return module.User } diff --git a/module/wallpaper/wallpaper.go b/module/wallpaper/wallpaper.go index a916c424..6ab218cc 100644 --- a/module/wallpaper/wallpaper.go +++ b/module/wallpaper/wallpaper.go @@ -1,12 +1,12 @@ package wallpaper import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/module" - "github.com/ronaksoft/rony" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/module" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -19,33 +19,33 @@ import ( */ type wallpaper struct { - module.Base + module.Base } func New() *wallpaper { - r := &wallpaper{} - r.RegisterMessageAppliers( - map[int64]domain.MessageApplier{ - msg.C_WallPapersMany: r.wallpapersMany, - }, - ) - return r + r := &wallpaper{} + r.RegisterMessageAppliers( + map[int64]domain.MessageApplier{ + msg.C_WallPapersMany: r.wallpapersMany, + }, + ) + return r } func (r *wallpaper) Name() string { - return module.Wallpaper + return module.Wallpaper } func (r *wallpaper) wallpapersMany(e *rony.MessageEnvelope) { - u := &msg.WallPapersMany{} - err := u.Unmarshal(e.Message) - if err != nil { - r.Log().Error("couldn't unmarshal wallpapersMany", zap.Error(err)) - return - } + u := &msg.WallPapersMany{} + err := u.Unmarshal(e.Message) + if err != nil { + r.Log().Error("couldn't unmarshal wallpapersMany", zap.Error(err)) + return + } - err = repo.Wallpapers.SaveWallpapers(u) - if err != nil { - r.Log().Error("got error on saving wallpapersMany", zap.Error(err)) - } + err = repo.Wallpapers.SaveWallpapers(u) + if err != nil { + r.Log().Error("got error on saving wallpapersMany", zap.Error(err)) + } } diff --git a/sdk/mini/cmd_file.go b/sdk/mini/cmd_file.go index 77177ebc..efbe1414 100644 --- a/sdk/mini/cmd_file.go +++ b/sdk/mini/cmd_file.go @@ -1,112 +1,113 @@ package mini import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - fileCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_file" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "io/ioutil" - "os" - "path" + "fmt" + "io/ioutil" + "os" + "path" + + "github.com/ronaksoft/river-msg/go/msg" + fileCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_file" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) func (r *River) GetFilePath(clusterID int32, fileID int64, accessHash int64) string { - // We only support thumbnail for now - return path.Join(repo.DirCache, fmt.Sprintf("%d%d%s", fileID, clusterID, ".jpg")) + // We only support thumbnail for now + return path.Join(repo.DirCache, fmt.Sprintf("%d%d%s", fileID, clusterID, ".jpg")) } func (r *River) GetFileStatus(clusterID int32, fileID int64, accessHash int64) []byte { - fileStatus := &msg.ClientFileStatus{ - Status: int32(request.StatusNone), - Progress: 0, - FilePath: "", - } - filePath := r.GetFilePath(clusterID, fileID, accessHash) - if _, err := os.Stat(filePath); os.IsNotExist(err) { - fileStatus.FilePath = "" - } else { - fileStatus.FilePath = filePath - fileStatus.Progress = 100 - fileStatus.Status = int32(request.StatusCompleted) - } + fileStatus := &msg.ClientFileStatus{ + Status: int32(request.StatusNone), + Progress: 0, + FilePath: "", + } + filePath := r.GetFilePath(clusterID, fileID, accessHash) + if _, err := os.Stat(filePath); os.IsNotExist(err) { + fileStatus.FilePath = "" + } else { + fileStatus.FilePath = filePath + fileStatus.Progress = 100 + fileStatus.Status = int32(request.StatusCompleted) + } - buf, _ := fileStatus.Marshal() - return buf + buf, _ := fileStatus.Marshal() + return buf } func (r *River) FileDownloadThumbnail(clusterID int32, fileID int64, accessHash int64) (err error) { - filePath := path.Join(repo.DirCache, fmt.Sprintf("%d%d%s", fileID, clusterID, ".jpg")) - req := &msg.FileGet{ - Location: &msg.InputFileLocation{ - ClusterID: clusterID, - FileID: fileID, - AccessHash: uint64(accessHash), - Version: 0, - }, - Offset: 0, - Limit: 0, - } + filePath := path.Join(repo.DirCache, fmt.Sprintf("%d%d%s", fileID, clusterID, ".jpg")) + req := &msg.FileGet{ + Location: &msg.InputFileLocation{ + ClusterID: clusterID, + FileID: fileID, + AccessHash: uint64(accessHash), + Version: 0, + }, + Offset: 0, + Limit: 0, + } - return tools.Try(fileCtrl.RetryMaxAttempts, fileCtrl.RetryWaitTime, func() error { - reqCB := request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_FileGet, req, - func() { - err = domain.ErrRequestTimeout - }, - func(res *rony.MessageEnvelope) { - switch res.Constructor { - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(res.Message) - err = x - case msg.C_File: - x := &msg.File{} - err = x.Unmarshal(res.Message) - if err != nil { - return - } + return tools.Try(fileCtrl.RetryMaxAttempts, fileCtrl.RetryWaitTime, func() error { + reqCB := request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_FileGet, req, + func() { + err = domain.ErrRequestTimeout + }, + func(res *rony.MessageEnvelope) { + switch res.Constructor { + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(res.Message) + err = x + case msg.C_File: + x := &msg.File{} + err = x.Unmarshal(res.Message) + if err != nil { + return + } - // write to file path - err = ioutil.WriteFile(filePath, x.Bytes, 0666) - if err != nil { - return - } - } - }, - nil, false, 0, domain.HttpRequestTimeout, - ) - r.network.HttpCommand(nil, reqCB) - return err - }) + // write to file path + err = ioutil.WriteFile(filePath, x.Bytes, 0666) + if err != nil { + return + } + } + }, + nil, false, 0, domain.HttpRequestTimeout, + ) + r.network.HttpCommand(nil, reqCB) + return err + }) } // GetDocumentHash returns the md5 hash of the document func (r *River) GetDocumentHash(clusterID int32, fileID int64, accessHash int64) string { - file, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) + file, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) - if err != nil { - logger.Warn("Error On GetDocumentHash (Files.Get)", - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - zap.Int64("AccessHash", accessHash), - zap.Error(err), - ) - return "" - } + if err != nil { + logger.Warn("Error On GetDocumentHash (Files.Get)", + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + zap.Int64("AccessHash", accessHash), + zap.Error(err), + ) + return "" + } - if file.MessageID == 0 { - logger.Warn("Not a message document", - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - zap.Int64("AccessHash", accessHash), - ) - return "" - } + if file.MessageID == 0 { + logger.Warn("Not a message document", + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + zap.Int64("AccessHash", accessHash), + ) + return "" + } - return file.MD5Checksum + return file.MD5Checksum } diff --git a/sdk/mini/cmd_general.go b/sdk/mini/cmd_general.go index 402278b2..eaa63468 100644 --- a/sdk/mini/cmd_general.go +++ b/sdk/mini/cmd_general.go @@ -1,15 +1,16 @@ package mini import ( - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/minirepo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony/registry" - "go.uber.org/zap" - "runtime" - "sync" - "time" + "runtime" + "sync" + "time" + + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/minirepo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony/registry" + "go.uber.org/zap" ) /* @@ -23,150 +24,152 @@ import ( // AppKill must be called when app is closed func (r *River) AppKill() { - r.network.Stop() + r.network.Stop() } // AppStart must be called when app is started func (r *River) AppStart() error { - runtime.GOMAXPROCS(runtime.NumCPU() * 2) - - logs.SetSentry(r.ConnInfo.AuthID, r.ConnInfo.UserID, r.sentryDSN) - logger.Info("MiniRiver Starting") - - minirepo.MustInit(r.dbPath) - - // Update Authorizations - r.network.SetAuthorization(r.ConnInfo.AuthID, r.ConnInfo.AuthKey) - - // Start Controllers - r.network.Start() - - domain.StartTime = time.Now() - domain.WindowLog = func(txt string) {} - logger.Info("MiniRiver Started") - - err := r.syncServerTime() - if err != nil { - logger.Warn("MiniRiver got error on get server time", zap.Error(err)) - } - - // Run update/message processors in background - go r.messageReceiver() - go r.updateReceiver() - - if r.getLastUpdateID(0) == 0 { - // run in sync for the first time - wg := sync.WaitGroup{} - wg.Add(3) - go func() { - r.syncTeams() - wg.Done() - }() - go func() { - r.syncContacts(0, 0) - wg.Done() - }() - go func() { - r.syncDialogs(0, 0) - wg.Done() - }() - wg.Wait() - } else { - // run in background - go r.syncContacts(0, 0) - go r.syncDialogs(0, 0) - go r.syncTeams() - } - - return nil + runtime.GOMAXPROCS(runtime.NumCPU() * 2) + + logs.SetSentry(r.ConnInfo.AuthID, r.ConnInfo.UserID, r.sentryDSN) + logger.Info("MiniRiver Starting") + + minirepo.MustInit(r.dbPath) + + // Update Authorizations + r.network.SetAuthorization(r.ConnInfo.AuthID, r.ConnInfo.AuthKey) + + // Start Controllers + r.network.Start() + + domain.StartTime = time.Now() + domain.WindowLog = func(txt string) {} + logger.Info("MiniRiver Started") + + err := r.syncServerTime() + if err != nil { + logger.Warn("MiniRiver got error on get server time", zap.Error(err)) + } + + // Run update/message processors in background + go r.messageReceiver() + go r.updateReceiver() + + if r.getLastUpdateID(0) == 0 { + // run in sync for the first time + wg := sync.WaitGroup{} + wg.Add(3) + go func() { + r.syncTeams() + wg.Done() + }() + go func() { + r.syncContacts(0, 0) + wg.Done() + }() + go func() { + r.syncDialogs(0, 0) + wg.Done() + }() + wg.Wait() + } else { + // run in background + go r.syncContacts(0, 0) + go r.syncDialogs(0, 0) + go r.syncTeams() + } + + return nil } // ExecuteCommand is a wrapper function to pass the request to the queueController, to be passed to networkController for final // delivery to the server. SDK uses GetCurrentTeam() to detect the targeted team of the request func (r *River) ExecuteCommand(constructor int64, commandBytes []byte, delegate RequestDelegate) (requestID int64, err error) { - requestID = domain.SequentialUniqueID() - err = r.executeCommand( - request.DelegateAdapter( - domain.GetCurrTeamID(), domain.GetCurrTeamAccess(), uint64(requestID), constructor, commandBytes, delegate, delegate.OnProgress, - ), - ) - return requestID, err + requestID = domain.SequentialUniqueID() + err = r.executeCommand( + request.DelegateAdapter( + domain.GetCurrTeamID(), domain.GetCurrTeamAccess(), uint64(requestID), constructor, commandBytes, delegate, delegate.OnProgress, + ), + ) + return requestID, err } // ExecuteCommandWithTeam is similar to ExecuteTeam but explicitly defines the target team -func (r *River) ExecuteCommandWithTeam(teamID, accessHash, constructor int64, commandBytes []byte, delegate RequestDelegate) (requestID int64, err error) { - requestID = domain.SequentialUniqueID() - err = r.executeCommand( - request.DelegateAdapter( - teamID, uint64(accessHash), uint64(requestID), constructor, commandBytes, delegate, delegate.OnProgress, - ), - ) - return requestID, err +func (r *River) ExecuteCommandWithTeam( + teamID, accessHash, constructor int64, commandBytes []byte, delegate RequestDelegate, +) (requestID int64, err error) { + requestID = domain.SequentialUniqueID() + err = r.executeCommand( + request.DelegateAdapter( + teamID, uint64(accessHash), uint64(requestID), constructor, commandBytes, delegate, delegate.OnProgress, + ), + ) + return requestID, err } func (r *River) executeCommand(reqCB request.Callback) (err error) { - if registry.ConstructorName(reqCB.Constructor()) == "" { - return domain.ErrInvalidConstructor - } + if registry.ConstructorName(reqCB.Constructor()) == "" { + return domain.ErrInvalidConstructor + } - logger.Debug("executes command", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(reqCB.Constructor())), - zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), - ) + logger.Debug("executes command", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(reqCB.Constructor())), + zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), + ) - serverForce := reqCB.Flags()&request.ServerForced != 0 + serverForce := reqCB.Flags()&request.ServerForced != 0 - // If the constructor is a local command then - handler, ok := r.localCommands[reqCB.Constructor()] - if ok && !serverForce { - r.executeLocalCommand(handler, reqCB) - return - } + // If the constructor is a local command then + handler, ok := r.localCommands[reqCB.Constructor()] + if ok && !serverForce { + r.executeLocalCommand(handler, reqCB) + return + } - // If we reached here, then execute the remote commands - r.executeRemoteCommand(reqCB) + // If we reached here, then execute the remote commands + r.executeRemoteCommand(reqCB) - return + return } func (r *River) executeLocalCommand(handler request.LocalHandler, reqCB request.Callback) { - logger.Info("execute local command", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(reqCB.Constructor())), - zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), - ) + logger.Info("execute local command", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(reqCB.Constructor())), + zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), + ) - handler(reqCB) + handler(reqCB) } func (r *River) executeRemoteCommand(reqCB request.Callback) { - logger.Info("execute remote command", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(reqCB.Constructor())), - zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), - ) + logger.Info("execute remote command", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(reqCB.Constructor())), + zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), + ) - r.network.HttpCommand(nil, reqCB) + r.network.HttpCommand(nil, reqCB) } func (r *River) SetTeam(teamID int64, teamAccessHash int64) { - domain.SetCurrentTeam(teamID, uint64(teamAccessHash)) - if r.getLastUpdateID(teamID) == 0 { - // run in sync for the first time - wg := sync.WaitGroup{} - wg.Add(2) - go func() { - r.syncContacts(teamID, uint64(teamAccessHash)) - wg.Done() - }() - go func() { - r.syncDialogs(teamID, uint64(teamAccessHash)) - wg.Done() - }() - wg.Wait() - } else { - // run in background - go r.syncContacts(teamID, uint64(teamAccessHash)) - go r.syncDialogs(teamID, uint64(teamAccessHash)) - } + domain.SetCurrentTeam(teamID, uint64(teamAccessHash)) + if r.getLastUpdateID(teamID) == 0 { + // run in sync for the first time + wg := sync.WaitGroup{} + wg.Add(2) + go func() { + r.syncContacts(teamID, uint64(teamAccessHash)) + wg.Done() + }() + go func() { + r.syncDialogs(teamID, uint64(teamAccessHash)) + wg.Done() + }() + wg.Wait() + } else { + // run in background + go r.syncContacts(teamID, uint64(teamAccessHash)) + go r.syncDialogs(teamID, uint64(teamAccessHash)) + } } diff --git a/sdk/mini/delegates.go b/sdk/mini/delegates.go index a6607bea..44dc98d0 100644 --- a/sdk/mini/delegates.go +++ b/sdk/mini/delegates.go @@ -1,39 +1,39 @@ package mini import ( - "git.ronaksoft.com/river/sdk/internal/request" + "github.com/ronaksoft/river-sdk/internal/request" ) // MainDelegate external (UI) handler will listen to this function to receive data from SDK type MainDelegate interface { - OnNetworkStatusChanged(status int) - OnSyncStatusChanged(status int) - OnUpdates(constructor int64, b []byte) - OnGeneralError(b []byte) - OnSessionClosed(res int) - ShowLoggerAlert() - AddLog(text string) - AppUpdate(version string, updateAvailable, force bool) - DataSynced(dialogs, contacts, gifs bool) + OnNetworkStatusChanged(status int) + OnSyncStatusChanged(status int) + OnUpdates(constructor int64, b []byte) + OnGeneralError(b []byte) + OnSessionClosed(res int) + ShowLoggerAlert() + AddLog(text string) + AppUpdate(version string, updateAvailable, force bool) + DataSynced(dialogs, contacts, gifs bool) } type ( - RequestDelegateFlag = request.DelegateFlag + RequestDelegateFlag = request.DelegateFlag ) type RequestDelegate interface { - OnComplete(b []byte) - OnTimeout(err error) - Flags() RequestDelegateFlag - OnProgress(int64) + OnComplete(b []byte) + OnTimeout(err error) + Flags() RequestDelegateFlag + OnProgress(int64) } // Request Flags const ( - RequestServerForced RequestDelegateFlag = 1 << iota - RequestBlocking - RequestSkipWaitForNetwork - RequestSkipFlusher - RequestRealtime - RequestBatch + RequestServerForced RequestDelegateFlag = 1 << iota + RequestBlocking + RequestSkipWaitForNetwork + RequestSkipFlusher + RequestRealtime + RequestBatch ) diff --git a/sdk/mini/handlers_client.go b/sdk/mini/handlers_client.go index 1ade33da..55294a53 100644 --- a/sdk/mini/handlers_client.go +++ b/sdk/mini/handlers_client.go @@ -1,20 +1,21 @@ package mini import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - fileCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_file" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/minirepo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" - "github.com/ronaksoft/rony/pools" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "io" - "os" - "strings" + "fmt" + "io" + "os" + "strings" + + "github.com/ronaksoft/river-msg/go/msg" + fileCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_file" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/minirepo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" + "github.com/ronaksoft/rony/pools" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) /* @@ -27,282 +28,282 @@ import ( */ func (r *River) clientSendMessageMedia(da request.Callback) { - reqMedia := &msg.ClientSendMessageMedia{} - if err := da.RequestData(reqMedia); err != nil { - return - } + reqMedia := &msg.ClientSendMessageMedia{} + if err := da.RequestData(reqMedia); err != nil { + return + } - // support IOS file path - reqMedia.FilePath = strings.TrimPrefix(reqMedia.FilePath, "file://") - reqMedia.ThumbFilePath = strings.TrimPrefix(reqMedia.ThumbFilePath, "file://") + // support IOS file path + reqMedia.FilePath = strings.TrimPrefix(reqMedia.FilePath, "file://") + reqMedia.ThumbFilePath = strings.TrimPrefix(reqMedia.ThumbFilePath, "file://") - fileID := tools.SecureRandomInt63(0) - thumbID := int64(0) - reqMedia.FileUploadID = fmt.Sprintf("%d", fileID) - reqMedia.FileID = fileID - if reqMedia.ThumbFilePath != "" { - thumbID = tools.SecureRandomInt63(0) - reqMedia.ThumbID = thumbID - reqMedia.ThumbUploadID = fmt.Sprintf("%d", thumbID) - } + fileID := tools.SecureRandomInt63(0) + thumbID := int64(0) + reqMedia.FileUploadID = fmt.Sprintf("%d", fileID) + reqMedia.FileID = fileID + if reqMedia.ThumbFilePath != "" { + thumbID = tools.SecureRandomInt63(0) + reqMedia.ThumbID = thumbID + reqMedia.ThumbUploadID = fmt.Sprintf("%d", thumbID) + } - checkSha256 := true - switch reqMedia.MediaType { - case msg.InputMediaType_InputMediaTypeUploadedDocument: - for _, attr := range reqMedia.Attributes { - if attr.Type == msg.DocumentAttributeType_AttributeTypeAudio { - x := &msg.DocumentAttributeAudio{} - _ = x.Unmarshal(attr.Data) - if x.Voice { - checkSha256 = false - } - } - } - default: - panic("Invalid MediaInputType") - } + checkSha256 := true + switch reqMedia.MediaType { + case msg.InputMediaType_InputMediaTypeUploadedDocument: + for _, attr := range reqMedia.Attributes { + if attr.Type == msg.DocumentAttributeType_AttributeTypeAudio { + x := &msg.DocumentAttributeAudio{} + _ = x.Unmarshal(attr.Data) + if x.Voice { + checkSha256 = false + } + } + } + default: + panic("Invalid MediaInputType") + } - if thumbID != 0 { - err := r.uploadFile(da, thumbID, reqMedia.ThumbFilePath, false) - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } - } + if thumbID != 0 { + err := r.uploadFile(da, thumbID, reqMedia.ThumbFilePath, false) + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } + } - var ( - fileLocation *msg.FileLocation - ) - if checkSha256 { - fileLocation, _ = r.checkSha256(reqMedia) - } + var ( + fileLocation *msg.FileLocation + ) + if checkSha256 { + fileLocation, _ = r.checkSha256(reqMedia) + } - // Create SendMessageMedia Request - x := &msg.MessagesSendMedia{ - Peer: reqMedia.Peer, - ClearDraft: reqMedia.ClearDraft, - RandomID: tools.RandomInt64(0), - ReplyTo: reqMedia.ReplyTo, - } + // Create SendMessageMedia Request + x := &msg.MessagesSendMedia{ + Peer: reqMedia.Peer, + ClearDraft: reqMedia.ClearDraft, + RandomID: tools.RandomInt64(0), + ReplyTo: reqMedia.ReplyTo, + } - if fileLocation != nil { - // File already uploaded - x.MediaType = msg.InputMediaType_InputMediaTypeDocument - doc := &msg.InputMediaDocument{ - Caption: reqMedia.Caption, - Attributes: reqMedia.Attributes, - Entities: reqMedia.Entities, - Document: &msg.InputDocument{ - ID: fileLocation.FileID, - AccessHash: fileLocation.AccessHash, - ClusterID: fileLocation.ClusterID, - }, - TinyThumbnail: reqMedia.TinyThumb, - } - if thumbID != 0 { - doc.Thumbnail = &msg.InputFile{ - FileID: thumbID, - FileName: "thumb_" + reqMedia.FileName, - MD5Checksum: "", - } - } - x.MediaData, _ = doc.Marshal() - da.OnProgress(100) - } else { - err := r.uploadFile(da, fileID, reqMedia.FilePath, true) - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } - // File just uploaded - x.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument - doc := &msg.InputMediaUploadedDocument{ - MimeType: reqMedia.FileMIME, - Attributes: reqMedia.Attributes, - Caption: reqMedia.Caption, - Entities: reqMedia.Entities, - File: &msg.InputFile{ - FileID: fileID, - FileName: reqMedia.FileName, - MD5Checksum: "", - }, - TinyThumbnail: reqMedia.TinyThumb, - } - if thumbID != 0 { - doc.Thumbnail = &msg.InputFile{ - FileID: thumbID, - FileName: "thumb_" + reqMedia.FileName, - MD5Checksum: "", - } - } - x.MediaData, _ = doc.Marshal() - } + if fileLocation != nil { + // File already uploaded + x.MediaType = msg.InputMediaType_InputMediaTypeDocument + doc := &msg.InputMediaDocument{ + Caption: reqMedia.Caption, + Attributes: reqMedia.Attributes, + Entities: reqMedia.Entities, + Document: &msg.InputDocument{ + ID: fileLocation.FileID, + AccessHash: fileLocation.AccessHash, + ClusterID: fileLocation.ClusterID, + }, + TinyThumbnail: reqMedia.TinyThumb, + } + if thumbID != 0 { + doc.Thumbnail = &msg.InputFile{ + FileID: thumbID, + FileName: "thumb_" + reqMedia.FileName, + MD5Checksum: "", + } + } + x.MediaData, _ = doc.Marshal() + da.OnProgress(100) + } else { + err := r.uploadFile(da, fileID, reqMedia.FilePath, true) + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } + // File just uploaded + x.MediaType = msg.InputMediaType_InputMediaTypeUploadedDocument + doc := &msg.InputMediaUploadedDocument{ + MimeType: reqMedia.FileMIME, + Attributes: reqMedia.Attributes, + Caption: reqMedia.Caption, + Entities: reqMedia.Entities, + File: &msg.InputFile{ + FileID: fileID, + FileName: reqMedia.FileName, + MD5Checksum: "", + }, + TinyThumbnail: reqMedia.TinyThumb, + } + if thumbID != 0 { + doc.Thumbnail = &msg.InputFile{ + FileID: thumbID, + FileName: "thumb_" + reqMedia.FileName, + MD5Checksum: "", + } + } + x.MediaData, _ = doc.Marshal() + } - da.Envelope().Fill(da.RequestID(), msg.C_MessagesSendMedia, x) - r.network.HttpCommand(nil, da) + da.Envelope().Fill(da.RequestID(), msg.C_MessagesSendMedia, x) + r.network.HttpCommand(nil, da) } func (r *River) checkSha256(req *msg.ClientSendMessageMedia) (fl *msg.FileLocation, err error) { - h, _ := domain.CalculateSha256(req.FilePath) - if len(h) == 0 { - return nil, domain.ErrDoesNotExists - } - // Check File stats and return error if any problem exists - var fileSize int32 - fileInfo, err := os.Stat(req.FilePath) - if err != nil { - return nil, err - } else { - fileSize = int32(fileInfo.Size()) - if fileSize <= 0 { - return nil, domain.ErrInvalidData - } else if fileSize > fileCtrl.MaxFileSizeAllowedSize { - return nil, domain.ErrFileTooLarge - } - } + h, _ := domain.CalculateSha256(req.FilePath) + if len(h) == 0 { + return nil, domain.ErrDoesNotExists + } + // Check File stats and return error if any problem exists + var fileSize int32 + fileInfo, err := os.Stat(req.FilePath) + if err != nil { + return nil, err + } else { + fileSize = int32(fileInfo.Size()) + if fileSize <= 0 { + return nil, domain.ErrInvalidData + } else if fileSize > fileCtrl.MaxFileSizeAllowedSize { + return nil, domain.ErrFileTooLarge + } + } - reqCB := request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_FileGetBySha256, - &msg.FileGetBySha256{ - Sha256: h, - FileSize: fileSize, - }, - func() { - err = domain.ErrRequestTimeout - }, - func(res *rony.MessageEnvelope) { - switch res.Constructor { - case msg.C_FileLocation: - fl = &msg.FileLocation{} - _ = fl.Unmarshal(res.Message) - return - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(res.Message) - err = x - default: - err = domain.ErrServer - } - }, - nil, false, 0, domain.HttpRequestTimeout, - ) - r.network.HttpCommand(nil, reqCB) + reqCB := request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_FileGetBySha256, + &msg.FileGetBySha256{ + Sha256: h, + FileSize: fileSize, + }, + func() { + err = domain.ErrRequestTimeout + }, + func(res *rony.MessageEnvelope) { + switch res.Constructor { + case msg.C_FileLocation: + fl = &msg.FileLocation{} + _ = fl.Unmarshal(res.Message) + return + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(res.Message) + err = x + default: + err = domain.ErrServer + } + }, + nil, false, 0, domain.HttpRequestTimeout, + ) + r.network.HttpCommand(nil, reqCB) - return + return } func (r *River) uploadFile(da request.Callback, fileID int64, filePath string, progress bool) error { - f, err := os.Open(filePath) - if err != nil { - return err - } - defer f.Close() + f, err := os.Open(filePath) + if err != nil { + return err + } + defer f.Close() - var ( - fileSize int64 - ) - // Check File stats and return error if any problem exists - fileInfo, err := os.Stat(filePath) - if err != nil { - return err - } else { - fileSize = fileInfo.Size() - if fileSize <= 0 { - return domain.ErrInvalidData - } else if fileSize > fileCtrl.MaxFileSizeAllowedSize { - return domain.ErrFileTooLarge - } - } + var ( + fileSize int64 + ) + // Check File stats and return error if any problem exists + fileInfo, err := os.Stat(filePath) + if err != nil { + return err + } else { + fileSize = fileInfo.Size() + if fileSize <= 0 { + return domain.ErrInvalidData + } else if fileSize > fileCtrl.MaxFileSizeAllowedSize { + return domain.ErrFileTooLarge + } + } - // Calculate number of parts based on our chunk size - totalParts := int32(0) - dividend := int32(fileSize / fileCtrl.DefaultChunkSize) - if fileSize%int64(fileCtrl.DefaultChunkSize) > 0 { - totalParts = dividend + 1 - } else { - totalParts = dividend - } + // Calculate number of parts based on our chunk size + totalParts := int32(0) + dividend := int32(fileSize / fileCtrl.DefaultChunkSize) + if fileSize%int64(fileCtrl.DefaultChunkSize) > 0 { + totalParts = dividend + 1 + } else { + totalParts = dividend + } - for partIndex := int32(0); partIndex < totalParts; partIndex++ { - logger.Info("SavePart", - zap.Int32("PartID", partIndex), zap.Int32("Total", totalParts), - zap.Int64("FileSize", fileSize), - ) - err = r.savePart(da, f, fileID, partIndex, totalParts) - if err != nil { - logger.Warn("Error On SavePart (MiniSDK)", zap.Error(err)) - return err - } + for partIndex := int32(0); partIndex < totalParts; partIndex++ { + logger.Info("SavePart", + zap.Int32("PartID", partIndex), zap.Int32("Total", totalParts), + zap.Int64("FileSize", fileSize), + ) + err = r.savePart(da, f, fileID, partIndex, totalParts) + if err != nil { + logger.Warn("Error On SavePart (MiniSDK)", zap.Error(err)) + return err + } - if progress { - da.OnProgress(int64(float64(partIndex) / float64(totalParts) * 100)) - } - } + if progress { + da.OnProgress(int64(float64(partIndex) / float64(totalParts) * 100)) + } + } - return nil + return nil } func (r *River) savePart(da request.Callback, f io.Reader, fileID int64, partIndex, totalParts int32) error { - var buf [fileCtrl.DefaultChunkSize]byte - n, err := f.Read(buf[:]) - if err != nil { - return err - } - req := &msg.FileSavePart{ - FileID: fileID, - PartID: partIndex + 1, - TotalParts: totalParts, - Bytes: buf[:n], - } - reqBuf := pools.Buffer.FromProto(req) - defer pools.Buffer.Put(reqBuf) - reqCB := request.NewCallbackFromBytes( - da.TeamID(), da.TeamAccess(), domain.NextRequestID(), msg.C_FileSavePart, *reqBuf.Bytes(), - func() { - err = domain.ErrRequestTimeout - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_Bool: - err = nil - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - err = x - default: - err = domain.ErrServer - } - }, - nil, - false, 0, domain.HttpRequestTimeout, - ) - r.network.HttpCommand(nil, reqCB) - return err + var buf [fileCtrl.DefaultChunkSize]byte + n, err := f.Read(buf[:]) + if err != nil { + return err + } + req := &msg.FileSavePart{ + FileID: fileID, + PartID: partIndex + 1, + TotalParts: totalParts, + Bytes: buf[:n], + } + reqBuf := pools.Buffer.FromProto(req) + defer pools.Buffer.Put(reqBuf) + reqCB := request.NewCallbackFromBytes( + da.TeamID(), da.TeamAccess(), domain.NextRequestID(), msg.C_FileSavePart, *reqBuf.Bytes(), + func() { + err = domain.ErrRequestTimeout + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_Bool: + err = nil + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + err = x + default: + err = domain.ErrServer + } + }, + nil, + false, 0, domain.HttpRequestTimeout, + ) + r.network.HttpCommand(nil, reqCB) + return err } func (r *River) clientGlobalSearch(da request.Callback) { - req := &msg.ClientGlobalSearch{} - if err := da.RequestData(req); err != nil { - return - } - logger.Debug("local handler for ClientGlobalSearch called", - zap.Int64("TeamID", da.TeamID()), - zap.Any("Text", req.Text), - ) - res := &msg.ClientSearchResult{} - uniqueUsers := domain.MInt64B{} - uniqueGroups := domain.MInt64B{} - cUsers := minirepo.Users.SearchContacts(da.TeamID(), strings.ToLower(req.Text), int(req.Limit)) - for _, cu := range cUsers { - uniqueUsers[cu.ID] = true - } + req := &msg.ClientGlobalSearch{} + if err := da.RequestData(req); err != nil { + return + } + logger.Debug("local handler for ClientGlobalSearch called", + zap.Int64("TeamID", da.TeamID()), + zap.Any("Text", req.Text), + ) + res := &msg.ClientSearchResult{} + uniqueUsers := domain.MInt64B{} + uniqueGroups := domain.MInt64B{} + cUsers := minirepo.Users.SearchContacts(da.TeamID(), strings.ToLower(req.Text), int(req.Limit)) + for _, cu := range cUsers { + uniqueUsers[cu.ID] = true + } - cGroups := minirepo.Groups.Search(da.TeamID(), strings.ToLower(req.Text), int(req.Limit)) - for _, g := range cGroups { - uniqueGroups[g.ID] = true - } + cGroups := minirepo.Groups.Search(da.TeamID(), strings.ToLower(req.Text), int(req.Limit)) + for _, g := range cGroups { + uniqueGroups[g.ID] = true + } - res.Users, _ = minirepo.Users.ReadMany(uniqueUsers.ToArray()...) - res.Groups, _ = minirepo.Groups.ReadMany(da.TeamID(), uniqueGroups.ToArray()...) - res.MatchedUsers = append(res.MatchedUsers, res.Users...) - res.MatchedGroups = append(res.MatchedGroups, res.Groups...) + res.Users, _ = minirepo.Users.ReadMany(uniqueUsers.ToArray()...) + res.Groups, _ = minirepo.Groups.ReadMany(da.TeamID(), uniqueGroups.ToArray()...) + res.MatchedUsers = append(res.MatchedUsers, res.Users...) + res.MatchedGroups = append(res.MatchedGroups, res.Groups...) - da.Response(msg.C_ClientSearchResult, res) + da.Response(msg.C_ClientSearchResult, res) } diff --git a/sdk/mini/handlers_local.go b/sdk/mini/handlers_local.go index 08b57156..58f99482 100644 --- a/sdk/mini/handlers_local.go +++ b/sdk/mini/handlers_local.go @@ -1,13 +1,13 @@ package mini import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/minirepo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/errors" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/minirepo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/errors" + "go.uber.org/zap" ) /* @@ -20,116 +20,116 @@ import ( */ func (r *River) messagesSendMedia(da request.Callback) { - req := &msg.MessagesSendMedia{} - if err := da.RequestData(req); err != nil { - return - } - - req.RandomID = domain.SequentialUniqueID() - da.Envelope().Fill(da.RequestID(), msg.C_MessagesSendMedia, req) - r.network.HttpCommand(nil, da) + req := &msg.MessagesSendMedia{} + if err := da.RequestData(req); err != nil { + return + } + + req.RandomID = domain.SequentialUniqueID() + da.Envelope().Fill(da.RequestID(), msg.C_MessagesSendMedia, req) + r.network.HttpCommand(nil, da) } func (r *River) messagesGetDialogs(da request.Callback) { - req := &msg.MessagesGetDialogs{} - if err := da.RequestData(req); err != nil { - return - } - - logger.Debug("local handler for MessagesGetDialogs called", - zap.Int64("TeamID", da.TeamID()), - zap.Int32("Offset", req.Offset), - zap.Int32("Limit", req.Limit), - ) - res := &msg.MessagesDialogs{} - res.Dialogs, _ = minirepo.Dialogs.List(da.TeamID(), req.Offset, req.Limit) - - // If the localDB had no data send the request to server - if len(res.Dialogs) == 0 { - r.network.HttpCommand(nil, da) - return - } - - mUsers := domain.MInt64B{} - mGroups := domain.MInt64B{} - for _, dialog := range res.Dialogs { - switch msg.PeerType(dialog.PeerType) { - case msg.PeerType_PeerUser, msg.PeerType_PeerExternalUser: - if dialog.PeerID != 0 { - mUsers[dialog.PeerID] = true - } - case msg.PeerType_PeerGroup: - if dialog.PeerID != 0 { - mGroups[dialog.PeerID] = true - } - } - } - - res.Groups, _ = minirepo.Groups.ReadMany(da.TeamID(), mGroups.ToArray()...) - if len(res.Groups) != len(mGroups) { - logger.Warn("found unmatched dialog groups", zap.Int("Got", len(res.Groups)), zap.Int("Need", len(mGroups))) - for groupID := range mGroups { - found := false - for _, g := range res.Groups { - if g.ID == groupID { - found = true - break - } - } - if !found { - logger.Warn("missed group", zap.Int64("GroupID", groupID)) - } - } - } - res.Users, _ = minirepo.Users.ReadMany(mUsers.ToArray()...) - if len(res.Users) != len(mUsers) { - logger.Warn("found unmatched dialog users", zap.Int("Got", len(res.Users)), zap.Int("Need", len(mUsers))) - for userID := range mUsers { - found := false - for _, g := range res.Users { - if g.ID == userID { - found = true - break - } - } - if !found { - logger.Warn("missed user", zap.Int64("UserID", userID)) - } - } - } - - da.Response(msg.C_MessagesDialogs, res) + req := &msg.MessagesGetDialogs{} + if err := da.RequestData(req); err != nil { + return + } + + logger.Debug("local handler for MessagesGetDialogs called", + zap.Int64("TeamID", da.TeamID()), + zap.Int32("Offset", req.Offset), + zap.Int32("Limit", req.Limit), + ) + res := &msg.MessagesDialogs{} + res.Dialogs, _ = minirepo.Dialogs.List(da.TeamID(), req.Offset, req.Limit) + + // If the localDB had no data send the request to server + if len(res.Dialogs) == 0 { + r.network.HttpCommand(nil, da) + return + } + + mUsers := domain.MInt64B{} + mGroups := domain.MInt64B{} + for _, dialog := range res.Dialogs { + switch msg.PeerType(dialog.PeerType) { + case msg.PeerType_PeerUser, msg.PeerType_PeerExternalUser: + if dialog.PeerID != 0 { + mUsers[dialog.PeerID] = true + } + case msg.PeerType_PeerGroup: + if dialog.PeerID != 0 { + mGroups[dialog.PeerID] = true + } + } + } + + res.Groups, _ = minirepo.Groups.ReadMany(da.TeamID(), mGroups.ToArray()...) + if len(res.Groups) != len(mGroups) { + logger.Warn("found unmatched dialog groups", zap.Int("Got", len(res.Groups)), zap.Int("Need", len(mGroups))) + for groupID := range mGroups { + found := false + for _, g := range res.Groups { + if g.ID == groupID { + found = true + break + } + } + if !found { + logger.Warn("missed group", zap.Int64("GroupID", groupID)) + } + } + } + res.Users, _ = minirepo.Users.ReadMany(mUsers.ToArray()...) + if len(res.Users) != len(mUsers) { + logger.Warn("found unmatched dialog users", zap.Int("Got", len(res.Users)), zap.Int("Need", len(mUsers))) + for userID := range mUsers { + found := false + for _, g := range res.Users { + if g.ID == userID { + found = true + break + } + } + if !found { + logger.Warn("missed user", zap.Int64("UserID", userID)) + } + } + } + + da.Response(msg.C_MessagesDialogs, res) } func (r *River) contactsGet(da request.Callback) { - req := &msg.ContactsGet{} - if err := da.RequestData(req); err != nil { - return - } - - res, err := minirepo.Users.ReadAllContacts(da.TeamID()) - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } - - da.Response(msg.C_ContactsMany, res) + req := &msg.ContactsGet{} + if err := da.RequestData(req); err != nil { + return + } + + res, err := minirepo.Users.ReadAllContacts(da.TeamID()) + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } + + da.Response(msg.C_ContactsMany, res) } func (r *River) accountGetTeams(da request.Callback) { - req := &msg.AccountGetTeams{} - if err := da.RequestData(req); err != nil { - return - } - - teams, err := minirepo.Teams.List() - if err != nil { - da.Response(rony.C_Error, errors.New("00", err.Error())) - return - } - - res := &msg.TeamsMany{ - Teams: teams, - } - da.Response(msg.C_TeamsMany, res) + req := &msg.AccountGetTeams{} + if err := da.RequestData(req); err != nil { + return + } + + teams, err := minirepo.Teams.List() + if err != nil { + da.Response(rony.C_Error, errors.New("00", err.Error())) + return + } + + res := &msg.TeamsMany{ + Teams: teams, + } + da.Response(msg.C_TeamsMany, res) } diff --git a/sdk/mini/river.go b/sdk/mini/river.go index aee6a706..1cee1b13 100644 --- a/sdk/mini/river.go +++ b/sdk/mini/river.go @@ -1,18 +1,19 @@ package mini import ( - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - networkCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_network" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/logs" - "git.ronaksoft.com/river/sdk/internal/minirepo" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "strings" + "fmt" + "strings" + + "github.com/ronaksoft/river-msg/go/msg" + networkCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_network" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/logs" + "github.com/ronaksoft/river-sdk/internal/minirepo" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) /* @@ -25,48 +26,48 @@ import ( */ var ( - logger *logs.Logger + logger *logs.Logger ) func init() { - logger = logs.With("MiniRiver") + logger = logs.With("MiniRiver") } type RiverConfig struct { - SeedHostPorts string - // DbPath is the path of the folder holding the sqlite database. - DbPath string - // DbID is used to save data for different accounts in separate databases. Could be used for multi-account cases. - DbID string - // MainDelegate holds all the general callback functions that let the user of this SDK - // get notified of the events. - MainDelegate MainDelegate - - // LogLevel - LogLevel int - SentryDSN string - // Folder path to save files - DocumentPhotoDirectory string - DocumentVideoDirectory string - DocumentFileDirectory string - DocumentAudioDirectory string - DocumentCacheDirectory string - LogDirectory string - // ConnInfo stores the Connection Info - ConnInfo *RiverConnection - // ClientInfo - ClientPlatform string - ClientVersion string - ClientOs string - ClientVendor string - CountryCode string - - MaxInFlightDownloads int32 - MaxInFlightUploads int32 - - // Team related parameters - TeamID int64 - TeamAccessHash int64 + SeedHostPorts string + // DbPath is the path of the folder holding the sqlite database. + DbPath string + // DbID is used to save data for different accounts in separate databases. Could be used for multi-account cases. + DbID string + // MainDelegate holds all the general callback functions that let the user of this SDK + // get notified of the events. + MainDelegate MainDelegate + + // LogLevel + LogLevel int + SentryDSN string + // Folder path to save files + DocumentPhotoDirectory string + DocumentVideoDirectory string + DocumentFileDirectory string + DocumentAudioDirectory string + DocumentCacheDirectory string + LogDirectory string + // ConnInfo stores the Connection Info + ConnInfo *RiverConnection + // ClientInfo + ClientPlatform string + ClientVersion string + ClientOs string + ClientVendor string + CountryCode string + + MaxInFlightDownloads int32 + MaxInFlightUploads int32 + + // Team related parameters + TeamID int64 + TeamAccessHash int64 } // River is the main and a wrapper around all the components of the system (networkController, queueController, @@ -76,138 +77,138 @@ type RiverConfig struct { // to smooth the connection between client and server are done by this SDK. The underlying storage used // by this SDK is Badger V2. 'repo' is the package name selected to handle repository functions. type River struct { - ConnInfo *RiverConnection - dbPath string - sentryDSN string + ConnInfo *RiverConnection + dbPath string + sentryDSN string - // localCommands can be satisfied by client cache - localCommands map[int64]request.LocalHandler - messageChan chan []*rony.MessageEnvelope - updateChan chan *msg.UpdateContainer + // localCommands can be satisfied by client cache + localCommands map[int64]request.LocalHandler + messageChan chan []*rony.MessageEnvelope + updateChan chan *msg.UpdateContainer - // Internal Controllers - network *networkCtrl.Controller + // Internal Controllers + network *networkCtrl.Controller - // Delegates - mainDelegate MainDelegate + // Delegates + mainDelegate MainDelegate } // SetConfig must be called before any other function, otherwise it panics func (r *River) SetConfig(conf *RiverConfig) { - domain.ClientPlatform = conf.ClientPlatform - domain.ClientVersion = conf.ClientVersion - domain.ClientOS = conf.ClientOs - domain.ClientVendor = conf.ClientVendor - - r.messageChan = make(chan []*rony.MessageEnvelope, 100) - r.updateChan = make(chan *msg.UpdateContainer, 100) - r.sentryDSN = conf.SentryDSN - r.ConnInfo = conf.ConnInfo - - if conf.MaxInFlightDownloads <= 0 { - conf.MaxInFlightDownloads = 10 - } - if conf.MaxInFlightUploads <= 0 { - conf.MaxInFlightUploads = 10 - } - - // Initialize DB Path - conf.DbPath = strings.TrimPrefix(conf.DbPath, "file://") - conf.DbPath = strings.TrimRight(conf.DbPath, "/ ") - r.dbPath = fmt.Sprintf("%s/%s.db", conf.DbPath, conf.DbID) - - r.registerCommandHandlers() - r.mainDelegate = conf.MainDelegate - - // set log level - logger.SetLogLevel(conf.LogLevel) - - // Initialize Network Controller - r.network = networkCtrl.New( - networkCtrl.Config{ - SeedHosts: strings.Split(conf.SeedHostPorts, ","), - CountryCode: conf.CountryCode, - }, - ) - r.network.UpdateEndpoint("") - r.network.OnNetworkStatusChange = func(newQuality domain.NetworkStatus) {} - r.network.OnGeneralError = r.onGeneralError - r.network.UpdateChan = r.updateChan - r.network.MessageChan = r.messageChan - r.network.OnWebsocketConnect = r.onNetworkConnect - - // Initialize FileController - repo.SetRootFolders( - conf.DocumentAudioDirectory, - conf.DocumentFileDirectory, - conf.DocumentPhotoDirectory, - conf.DocumentVideoDirectory, - conf.DocumentCacheDirectory, - ) - - // Initialize River Connection - logger.Info("SetConfig done!") - - // Set current team - domain.SetCurrentTeam(conf.TeamID, uint64(conf.TeamAccessHash)) + domain.ClientPlatform = conf.ClientPlatform + domain.ClientVersion = conf.ClientVersion + domain.ClientOS = conf.ClientOs + domain.ClientVendor = conf.ClientVendor + + r.messageChan = make(chan []*rony.MessageEnvelope, 100) + r.updateChan = make(chan *msg.UpdateContainer, 100) + r.sentryDSN = conf.SentryDSN + r.ConnInfo = conf.ConnInfo + + if conf.MaxInFlightDownloads <= 0 { + conf.MaxInFlightDownloads = 10 + } + if conf.MaxInFlightUploads <= 0 { + conf.MaxInFlightUploads = 10 + } + + // Initialize DB Path + conf.DbPath = strings.TrimPrefix(conf.DbPath, "file://") + conf.DbPath = strings.TrimRight(conf.DbPath, "/ ") + r.dbPath = fmt.Sprintf("%s/%s.db", conf.DbPath, conf.DbID) + + r.registerCommandHandlers() + r.mainDelegate = conf.MainDelegate + + // set log level + logger.SetLogLevel(conf.LogLevel) + + // Initialize Network Controller + r.network = networkCtrl.New( + networkCtrl.Config{ + SeedHosts: strings.Split(conf.SeedHostPorts, ","), + CountryCode: conf.CountryCode, + }, + ) + r.network.UpdateEndpoint("") + r.network.OnNetworkStatusChange = func(newQuality domain.NetworkStatus) {} + r.network.OnGeneralError = r.onGeneralError + r.network.UpdateChan = r.updateChan + r.network.MessageChan = r.messageChan + r.network.OnWebsocketConnect = r.onNetworkConnect + + // Initialize FileController + repo.SetRootFolders( + conf.DocumentAudioDirectory, + conf.DocumentFileDirectory, + conf.DocumentPhotoDirectory, + conf.DocumentVideoDirectory, + conf.DocumentCacheDirectory, + ) + + // Initialize River Connection + logger.Info("SetConfig done!") + + // Set current team + domain.SetCurrentTeam(conf.TeamID, uint64(conf.TeamAccessHash)) } func (r *River) onNetworkConnect() (err error) { - return nil + return nil } func (r *River) onGeneralError(requestID uint64, e *rony.Error) { - logger.Info("received error (General)", - zap.Uint64("ReqID", requestID), - zap.String("Code", e.Code), - zap.String("Item", e.Items), - ) - - if r.mainDelegate != nil && requestID == 0 { - buff, _ := e.Marshal() - r.mainDelegate.OnGeneralError(buff) - } + logger.Info("received error (General)", + zap.Uint64("ReqID", requestID), + zap.String("Code", e.Code), + zap.String("Item", e.Items), + ) + + if r.mainDelegate != nil && requestID == 0 { + buff, _ := e.Marshal() + r.mainDelegate.OnGeneralError(buff) + } } func (r *River) messageReceiver() { - // NOP Loop to just clear the received messages - for range r.messageChan { - } + // NOP Loop to just clear the received messages + for range r.messageChan { + } } func (r *River) updateReceiver() { - // NOP Loop to just clear the received updates - for range r.updateChan { - } + // NOP Loop to just clear the received updates + for range r.updateChan { + } } func (r *River) registerCommandHandlers() { - r.localCommands = map[int64]request.LocalHandler{ - msg.C_AccountGetTeams: r.accountGetTeams, - msg.C_ClientSendMessageMedia: r.clientSendMessageMedia, - msg.C_ClientGlobalSearch: r.clientGlobalSearch, - msg.C_MessagesSendMedia: r.messagesSendMedia, - msg.C_MessagesGetDialogs: r.messagesGetDialogs, - msg.C_ContactsGet: r.contactsGet, - } + r.localCommands = map[int64]request.LocalHandler{ + msg.C_AccountGetTeams: r.accountGetTeams, + msg.C_ClientSendMessageMedia: r.clientSendMessageMedia, + msg.C_ClientGlobalSearch: r.clientGlobalSearch, + msg.C_MessagesSendMedia: r.messagesSendMedia, + msg.C_MessagesGetDialogs: r.messagesGetDialogs, + msg.C_ContactsGet: r.contactsGet, + } } func (r *River) setLastUpdateID(teamID, updateID int64) error { - return minirepo.General.SaveInt64(tools.S2B(fmt.Sprintf("%s.%d", domain.SkUpdateID, teamID)), updateID) + return minirepo.General.SaveInt64(tools.S2B(fmt.Sprintf("%s.%d", domain.SkUpdateID, teamID)), updateID) } func (r *River) getLastUpdateID(teamID int64) int64 { - return minirepo.General.GetInt64(tools.S2B(fmt.Sprintf("%s.%d", domain.SkUpdateID, teamID))) + return minirepo.General.GetInt64(tools.S2B(fmt.Sprintf("%s.%d", domain.SkUpdateID, teamID))) } func (r *River) setContactsHash(teamID int64, h uint32) error { - return minirepo.General.SaveUInt32(tools.S2B(fmt.Sprintf("%s.%d", domain.SkContactsGetHash, teamID)), h) + return minirepo.General.SaveUInt32(tools.S2B(fmt.Sprintf("%s.%d", domain.SkContactsGetHash, teamID)), h) } func (r *River) getContactsHash(teamID int64) uint32 { - return minirepo.General.GetUInt32(tools.S2B(fmt.Sprintf("%s.%d", domain.SkContactsGetHash, teamID))) + return minirepo.General.GetUInt32(tools.S2B(fmt.Sprintf("%s.%d", domain.SkContactsGetHash, teamID))) } // RiverConnection connection info type RiverConnection struct { - AuthID int64 - AuthKey []byte - UserID int64 + AuthID int64 + AuthKey []byte + UserID int64 } diff --git a/sdk/mini/river_sync.go b/sdk/mini/river_sync.go index f4165eb2..71ecb306 100644 --- a/sdk/mini/river_sync.go +++ b/sdk/mini/river_sync.go @@ -1,13 +1,14 @@ package mini import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/minirepo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/ronaksoft/rony" - "go.uber.org/zap" - "time" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/minirepo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/rony" + "go.uber.org/zap" ) /* @@ -20,204 +21,204 @@ import ( */ func (r *River) syncServerTime() (err error) { - r.network.HttpCommand( - nil, - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_SystemGetServerTime, &msg.SystemGetServerTime{}, - func() { - err = domain.ErrRequestTimeout - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_SystemServerTime: - x := &msg.SystemServerTime{} - err = x.Unmarshal(m.Message) - if err != nil { - logger.Error("couldn't unmarshal SystemGetServerTime response", zap.Error(err)) - return - } - clientTime := time.Now().Unix() - serverTime := x.Timestamp - domain.TimeDelta = time.Duration(serverTime-clientTime) * time.Second + r.network.HttpCommand( + nil, + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_SystemGetServerTime, &msg.SystemGetServerTime{}, + func() { + err = domain.ErrRequestTimeout + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_SystemServerTime: + x := &msg.SystemServerTime{} + err = x.Unmarshal(m.Message) + if err != nil { + logger.Error("couldn't unmarshal SystemGetServerTime response", zap.Error(err)) + return + } + clientTime := time.Now().Unix() + serverTime := x.Timestamp + domain.TimeDelta = time.Duration(serverTime-clientTime) * time.Second - logger.Debug("MiniRiver received SystemServerTime", - zap.Int64("ServerTime", serverTime), - zap.Int64("ClientTime", clientTime), - zap.Duration("Difference", domain.TimeDelta), - ) - case rony.C_Error: - logger.Warn("MiniRiver received error on GetSystemServerTime", zap.Error(domain.ParseServerError(m.Message))) - err = domain.ParseServerError(m.Message) - } - }, - nil, false, 0, 0, - ), - ) - return + logger.Debug("MiniRiver received SystemServerTime", + zap.Int64("ServerTime", serverTime), + zap.Int64("ClientTime", clientTime), + zap.Duration("Difference", domain.TimeDelta), + ) + case rony.C_Error: + logger.Warn("MiniRiver received error on GetSystemServerTime", zap.Error(domain.ParseServerError(m.Message))) + err = domain.ParseServerError(m.Message) + } + }, + nil, false, 0, 0, + ), + ) + return } func (r *River) syncUpdateState(teamID int64) (updated bool, err error) { - req := rony.PoolMessageEnvelope.Get() - defer rony.PoolMessageEnvelope.Put(req) - req.Fill(domain.NextRequestID(), msg.C_UpdateGetState, &msg.UpdateGetState{}) + req := rony.PoolMessageEnvelope.Get() + defer rony.PoolMessageEnvelope.Put(req) + req.Fill(domain.NextRequestID(), msg.C_UpdateGetState, &msg.UpdateGetState{}) - currentUpdateID := r.getLastUpdateID(teamID) - r.network.HttpCommand( - nil, - request.NewCallback(0, 0, domain.NextRequestID(), msg.C_UpdateGetState, &msg.UpdateGetState{}, - func() { - err = domain.ErrRequestTimeout - }, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_UpdateState: - x := &msg.UpdateState{} - err = x.Unmarshal(m.Message) - if err != nil { - logger.Error("MiniRiver couldn't unmarshal SystemGetServerTime response", zap.Error(err)) - return - } - if x.UpdateID > currentUpdateID { - updated = true - } - err = r.setLastUpdateID(teamID, x.UpdateID) - if err != nil { - logger.Error("MiniRiver couldn't save LastUpdateID to the database", zap.Error(err)) - return - } - case rony.C_Error: - logger.Warn("MiniRiver received error on GetSystemServerTime", zap.Error(domain.ParseServerError(m.Message))) - err = domain.ParseServerError(m.Message) - } - }, - nil, false, 0, 0, - ), - ) - return + currentUpdateID := r.getLastUpdateID(teamID) + r.network.HttpCommand( + nil, + request.NewCallback(0, 0, domain.NextRequestID(), msg.C_UpdateGetState, &msg.UpdateGetState{}, + func() { + err = domain.ErrRequestTimeout + }, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_UpdateState: + x := &msg.UpdateState{} + err = x.Unmarshal(m.Message) + if err != nil { + logger.Error("MiniRiver couldn't unmarshal SystemGetServerTime response", zap.Error(err)) + return + } + if x.UpdateID > currentUpdateID { + updated = true + } + err = r.setLastUpdateID(teamID, x.UpdateID) + if err != nil { + logger.Error("MiniRiver couldn't save LastUpdateID to the database", zap.Error(err)) + return + } + case rony.C_Error: + logger.Warn("MiniRiver received error on GetSystemServerTime", zap.Error(domain.ParseServerError(m.Message))) + err = domain.ParseServerError(m.Message) + } + }, + nil, false, 0, 0, + ), + ) + return } func (r *River) syncContacts(teamID int64, teamAccess uint64) { - r.network.HttpCommand( - nil, - request.NewCallback( - teamID, teamAccess, domain.NextRequestID(), msg.C_ContactsGet, &msg.ContactsGet{Crc32Hash: r.getContactsHash(teamID)}, - func() {}, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_ContactsMany: - x := &msg.ContactsMany{} - _ = x.Unmarshal(m.Message) - if !x.Modified { - return - } - err := minirepo.Users.SaveAllContacts(teamID, x) - if err != nil { - logger.Warn("MiniRiver got error on saving users/contacts", zap.Error(err)) - return - } - err = r.setContactsHash(teamID, x.Hash) - if err != nil { - logger.Warn("MiniRiver got error on saving contacts hash", zap.Error(err)) - } - r.mainDelegate.DataSynced(false, true, false) - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - logger.Warn("MiniRiver got server error on syncing contacts", zap.Error(x)) - default: - logger.Warn("MiniRiver got unknown server response") - } - }, - nil, false, 0, 0, - ), - ) + r.network.HttpCommand( + nil, + request.NewCallback( + teamID, teamAccess, domain.NextRequestID(), msg.C_ContactsGet, &msg.ContactsGet{Crc32Hash: r.getContactsHash(teamID)}, + func() {}, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_ContactsMany: + x := &msg.ContactsMany{} + _ = x.Unmarshal(m.Message) + if !x.Modified { + return + } + err := minirepo.Users.SaveAllContacts(teamID, x) + if err != nil { + logger.Warn("MiniRiver got error on saving users/contacts", zap.Error(err)) + return + } + err = r.setContactsHash(teamID, x.Hash) + if err != nil { + logger.Warn("MiniRiver got error on saving contacts hash", zap.Error(err)) + } + r.mainDelegate.DataSynced(false, true, false) + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + logger.Warn("MiniRiver got server error on syncing contacts", zap.Error(x)) + default: + logger.Warn("MiniRiver got unknown server response") + } + }, + nil, false, 0, 0, + ), + ) } func (r *River) syncDialogs(teamID int64, teamAccess uint64) { - var ( - keepGoing = true - offset int32 = 0 - ) + var ( + keepGoing = true + offset int32 = 0 + ) - updated, err := r.syncUpdateState(teamID) - if err != nil { - logger.Warn("MiniRiver got error on UpdateSync", zap.Error(err)) - } - if !updated { - return - } - for keepGoing { - r.network.HttpCommand( - nil, - request.NewCallback( - teamID, teamAccess, domain.NextRequestID(), msg.C_MessagesGetDialogs, - &msg.MessagesGetDialogs{ - Limit: 250, - Offset: offset, - ExcludePinned: false, - }, - func() {}, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_MessagesDialogs: - x := &msg.MessagesDialogs{} - _ = x.Unmarshal(m.Message) - _ = minirepo.Dialogs.Save(x.Dialogs...) - _ = minirepo.Users.SaveUser(x.Users...) - _ = minirepo.Groups.Save(x.Groups...) - offset += int32(len(x.Dialogs)) - if len(x.Dialogs) == 0 { - keepGoing = false - } - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - logger.Warn("MiniRiver got server error on syncing dialogs", zap.Error(x)) - default: - logger.Warn("MiniRiver got unknown server response") - } - }, - nil, false, 0, domain.HttpRequestTimeShort, - ), - ) - } + updated, err := r.syncUpdateState(teamID) + if err != nil { + logger.Warn("MiniRiver got error on UpdateSync", zap.Error(err)) + } + if !updated { + return + } + for keepGoing { + r.network.HttpCommand( + nil, + request.NewCallback( + teamID, teamAccess, domain.NextRequestID(), msg.C_MessagesGetDialogs, + &msg.MessagesGetDialogs{ + Limit: 250, + Offset: offset, + ExcludePinned: false, + }, + func() {}, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_MessagesDialogs: + x := &msg.MessagesDialogs{} + _ = x.Unmarshal(m.Message) + _ = minirepo.Dialogs.Save(x.Dialogs...) + _ = minirepo.Users.SaveUser(x.Users...) + _ = minirepo.Groups.Save(x.Groups...) + offset += int32(len(x.Dialogs)) + if len(x.Dialogs) == 0 { + keepGoing = false + } + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + logger.Warn("MiniRiver got server error on syncing dialogs", zap.Error(x)) + default: + logger.Warn("MiniRiver got unknown server response") + } + }, + nil, false, 0, domain.HttpRequestTimeShort, + ), + ) + } - r.mainDelegate.DataSynced(true, false, false) + r.mainDelegate.DataSynced(true, false, false) } func (r *River) syncTeams() { - r.network.HttpCommand( - nil, - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_AccountGetTeams, &msg.AccountGetTeams{}, - func() {}, - func(m *rony.MessageEnvelope) { - switch m.Constructor { - case msg.C_TeamsMany: - x := &msg.TeamsMany{} - _ = x.Unmarshal(m.Message) + r.network.HttpCommand( + nil, + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_AccountGetTeams, &msg.AccountGetTeams{}, + func() {}, + func(m *rony.MessageEnvelope) { + switch m.Constructor { + case msg.C_TeamsMany: + x := &msg.TeamsMany{} + _ = x.Unmarshal(m.Message) - err := minirepo.Teams.Save(x.Teams...) - if err != nil { - logger.Warn("got error on saving teams [Teams]", zap.Error(err)) - return - } - err = minirepo.Users.SaveUser(x.Users...) - if err != nil { - logger.Warn("got error on saving teams [Users]", zap.Error(err)) - return - } - case rony.C_Error: - x := &rony.Error{} - _ = x.Unmarshal(m.Message) - logger.Warn("MiniRiver got server error on syncing contacts", zap.Error(x)) - default: - logger.Warn("MiniRiver got unknown server response") - } - }, - nil, false, 0, 0, - ), - ) + err := minirepo.Teams.Save(x.Teams...) + if err != nil { + logger.Warn("got error on saving teams [Teams]", zap.Error(err)) + return + } + err = minirepo.Users.SaveUser(x.Users...) + if err != nil { + logger.Warn("got error on saving teams [Users]", zap.Error(err)) + return + } + case rony.C_Error: + x := &rony.Error{} + _ = x.Unmarshal(m.Message) + logger.Warn("MiniRiver got server error on syncing contacts", zap.Error(x)) + default: + logger.Warn("MiniRiver got unknown server response") + } + }, + nil, false, 0, 0, + ), + ) } diff --git a/sdk/prime/cmd_db.go b/sdk/prime/cmd_db.go index f4c7f031..2e784d37 100644 --- a/sdk/prime/cmd_db.go +++ b/sdk/prime/cmd_db.go @@ -1,35 +1,35 @@ package riversdk import ( - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "go.uber.org/zap" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "go.uber.org/zap" ) func (r *River) IsMessageExist(messageID int64) bool { - message, _ := repo.Messages.Get(messageID) - return message != nil + message, _ := repo.Messages.Get(messageID) + return message != nil } func (r *River) IsGifSaved(fileID int64, clusterID int32) bool { - return repo.Gifs.IsSaved(clusterID, fileID) + return repo.Gifs.IsSaved(clusterID, fileID) } func (r *River) GetRealTopMessageID(peerID int64, peerType int32) int64 { - topMsgID, err := repo.Messages.GetTopMessageID(domain.GetCurrTeamID(), peerID, peerType) - if err != nil { - logger.Error("GetRealTopMessageID got error on Messages.GetTopMessageID()", zap.Error(err)) - return -1 - } - return topMsgID + topMsgID, err := repo.Messages.GetTopMessageID(domain.GetCurrTeamID(), peerID, peerType) + if err != nil { + logger.Error("GetRealTopMessageID got error on Messages.GetTopMessageID()", zap.Error(err)) + return -1 + } + return topMsgID } func (r *River) GetPinnedDialogsCount() int32 { - dialogs := repo.Dialogs.GetPinnedDialogs() - return int32(len(dialogs)) + dialogs := repo.Dialogs.GetPinnedDialogs() + return int32(len(dialogs)) } func (r *River) ResetCalculatedImportHash() { - err := repo.System.SaveInt(domain.SkContactsImportHash, 0) - logger.ErrorOnErr("ResetCalculatedImportHash", err) + err := repo.System.SaveInt(domain.SkContactsImportHash, 0) + logger.ErrorOnErr("ResetCalculatedImportHash", err) } diff --git a/sdk/prime/cmd_debug.go b/sdk/prime/cmd_debug.go index 945877a4..bd5d5f07 100644 --- a/sdk/prime/cmd_debug.go +++ b/sdk/prime/cmd_debug.go @@ -1,14 +1,14 @@ package riversdk import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/module" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/module" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) /* @@ -21,49 +21,49 @@ import ( */ func (r *River) HandleDebugActions(txt string) { - req := &msg.MessagesSend{ - RandomID: tools.RandomInt64(0), - Peer: &msg.InputPeer{ID: r.ConnInfo.UserID}, - Body: txt, - ReplyTo: 0, - ClearDraft: false, - Entities: nil, - } - in := &rony.MessageEnvelope{} - in.Fill(domain.NextRequestID(), msg.C_MessagesSend, req) - r.Module(module.Message).Execute( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_MessagesSend, req, - nil, nil, nil, false, 0, 0, - ), - ) + req := &msg.MessagesSend{ + RandomID: tools.RandomInt64(0), + Peer: &msg.InputPeer{ID: r.ConnInfo.UserID}, + Body: txt, + ReplyTo: 0, + ClearDraft: false, + Entities: nil, + } + in := &rony.MessageEnvelope{} + in.Fill(domain.NextRequestID(), msg.C_MessagesSend, req) + r.Module(module.Message).Execute( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_MessagesSend, req, + nil, nil, nil, false, 0, 0, + ), + ) } func (r *River) GetHole(peerID int64, peerType int32) []byte { - return repo.MessagesExtra.GetHoles(domain.GetCurrTeamID(), peerID, peerType, 0) + return repo.MessagesExtra.GetHoles(domain.GetCurrTeamID(), peerID, peerType, 0) } func (r *River) CancelFileRequest(reqID string) { - err := repo.Files.DeleteFileRequest(reqID) - if err != nil { - logger.Warn("got error on delete file request", zap.Error(err)) - } + err := repo.Files.DeleteFileRequest(reqID) + if err != nil { + logger.Warn("got error on delete file request", zap.Error(err)) + } } func (r *River) DeleteAllPendingMessages() { - for _, p := range repo.PendingMessages.GetAll() { - if p.FileID != 0 { - r.fileCtrl.CancelUploadRequest(p.FileID) - } - _ = repo.PendingMessages.Delete(p.ID) - } + for _, p := range repo.PendingMessages.GetAll() { + if p.FileID != 0 { + r.fileCtrl.CancelUploadRequest(p.FileID) + } + _ = repo.PendingMessages.Delete(p.ID) + } } func (r *River) SetUpdateState(newUpdateID int64) { - _ = r.syncCtrl.SetUpdateID(newUpdateID) - go r.syncCtrl.Sync() + _ = r.syncCtrl.SetUpdateID(newUpdateID) + go r.syncCtrl.Sync() } func (r *River) GetUpdateState() int64 { - return r.syncCtrl.GetUpdateID() + return r.syncCtrl.GetUpdateID() } diff --git a/sdk/prime/cmd_file.go b/sdk/prime/cmd_file.go index 25ec2709..c25c8a2b 100644 --- a/sdk/prime/cmd_file.go +++ b/sdk/prime/cmd_file.go @@ -1,175 +1,176 @@ package riversdk import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "github.com/dgraph-io/badger/v2" - "go.uber.org/zap" - "os" + "os" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "go.uber.org/zap" ) func (r *River) GetFileStatus(clusterID int32, fileID int64, accessHash int64) []byte { - fileStatus := new(msg.ClientFileStatus) - if clusterID == 0 && accessHash == 0 { - // It it Upload - uploadRequest := r.fileCtrl.GetUploadRequest(fileID) - if uploadRequest != nil { - fileStatus.FilePath = uploadRequest.FilePath - if uploadRequest.TotalParts > 0 { - fileStatus.Progress = int64(float64(len(uploadRequest.FinishedParts)) / float64(uploadRequest.TotalParts) * 100) - } - fileStatus.Status = int32(request.StatusInProgress) - } else { - fileStatus.Status = int32(request.StatusNone) - fileStatus.Progress = 0 - } - } else { - downloadRequest := r.fileCtrl.GetDownloadRequest(clusterID, fileID, uint64(accessHash)) - if downloadRequest != nil { - fileStatus.FilePath = downloadRequest.FilePath - fileStatus.Status = int32(request.StatusInProgress) - if downloadRequest.TotalParts > 0 { - fileStatus.Progress = int64(float64(len(downloadRequest.FinishedParts)) / float64(downloadRequest.TotalParts) * 100) - } - } else { - clientFile, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) - if err == nil { - filePath := repo.Files.GetFilePath(clientFile) - if _, err = os.Stat(filePath); os.IsNotExist(err) { - fileStatus.FilePath = "" - } else { - fileStatus.FilePath = filePath - fileStatus.Progress = 100 - fileStatus.Status = int32(request.StatusCompleted) - } - } - } - } - - buf, _ := fileStatus.Marshal() - return buf + fileStatus := new(msg.ClientFileStatus) + if clusterID == 0 && accessHash == 0 { + // It it Upload + uploadRequest := r.fileCtrl.GetUploadRequest(fileID) + if uploadRequest != nil { + fileStatus.FilePath = uploadRequest.FilePath + if uploadRequest.TotalParts > 0 { + fileStatus.Progress = int64(float64(len(uploadRequest.FinishedParts)) / float64(uploadRequest.TotalParts) * 100) + } + fileStatus.Status = int32(request.StatusInProgress) + } else { + fileStatus.Status = int32(request.StatusNone) + fileStatus.Progress = 0 + } + } else { + downloadRequest := r.fileCtrl.GetDownloadRequest(clusterID, fileID, uint64(accessHash)) + if downloadRequest != nil { + fileStatus.FilePath = downloadRequest.FilePath + fileStatus.Status = int32(request.StatusInProgress) + if downloadRequest.TotalParts > 0 { + fileStatus.Progress = int64(float64(len(downloadRequest.FinishedParts)) / float64(downloadRequest.TotalParts) * 100) + } + } else { + clientFile, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) + if err == nil { + filePath := repo.Files.GetFilePath(clientFile) + if _, err = os.Stat(filePath); os.IsNotExist(err) { + fileStatus.FilePath = "" + } else { + fileStatus.FilePath = filePath + fileStatus.Progress = 100 + fileStatus.Status = int32(request.StatusCompleted) + } + } + } + } + + buf, _ := fileStatus.Marshal() + return buf } func (r *River) GetFilePath(clusterID int32, fileID int64, accessHash int64) string { - clientFile, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) - if err == nil { - filePath := repo.Files.GetFilePath(clientFile) - return filePath - } - return "" + clientFile, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) + if err == nil { + filePath := repo.Files.GetFilePath(clientFile) + return filePath + } + return "" } func (r *River) FileDownloadAsync(clusterID int32, fileID int64, accessHash int64, skipDelegate bool) (reqID string) { - var err error - reqID, err = r.fileCtrl.DownloadAsync(clusterID, fileID, uint64(accessHash), skipDelegate) - switch err { - case nil: - case badger.ErrKeyNotFound: - logger.Warn("Error On GetFile (Key not found)", - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - zap.Int64("AccessHash", accessHash), - ) - default: - logger.Warn("Error On GetFile", - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - zap.Int64("AccessHash", accessHash), - zap.Error(err), - ) - } - return + var err error + reqID, err = r.fileCtrl.DownloadAsync(clusterID, fileID, uint64(accessHash), skipDelegate) + switch err { + case nil: + case badger.ErrKeyNotFound: + logger.Warn("Error On GetFile (Key not found)", + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + zap.Int64("AccessHash", accessHash), + ) + default: + logger.Warn("Error On GetFile", + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + zap.Int64("AccessHash", accessHash), + zap.Error(err), + ) + } + return } func (r *River) FileDownloadSync(clusterID int32, fileID int64, accessHash int64, skipDelegate bool) error { - _, err := r.fileCtrl.DownloadSync(clusterID, fileID, uint64(accessHash), skipDelegate) - switch err { - case nil: - case badger.ErrKeyNotFound: - logger.Warn("Error On GetFile (Key not found)", - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - zap.Int64("AccessHash", accessHash), - ) - default: - logger.Warn("Error On GetFile", - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - zap.Int64("AccessHash", accessHash), - zap.Error(err), - ) - } - return err + _, err := r.fileCtrl.DownloadSync(clusterID, fileID, uint64(accessHash), skipDelegate) + switch err { + case nil: + case badger.ErrKeyNotFound: + logger.Warn("Error On GetFile (Key not found)", + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + zap.Int64("AccessHash", accessHash), + ) + default: + logger.Warn("Error On GetFile", + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + zap.Int64("AccessHash", accessHash), + zap.Error(err), + ) + } + return err } // CancelDownload cancel download func (r *River) CancelDownload(clusterID int32, fileID int64, accessHash int64) { - clientFile, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) - if err != nil { - return - } - r.fileCtrl.CancelDownloadRequest(clusterID, fileID, uint64(accessHash)) - if clientFile.MessageID == 0 { - return - } + clientFile, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) + if err != nil { + return + } + r.fileCtrl.CancelDownloadRequest(clusterID, fileID, uint64(accessHash)) + if clientFile.MessageID == 0 { + return + } } // ResumeUpload must be called if for any reason the upload of a ClientSendMediaMessage failed, // then client should call this function by providing the pending message id, or if delete the pending // message. func (r *River) ResumeUpload(pendingMessageID int64) { - pendingMessage, _ := repo.PendingMessages.GetByID(pendingMessageID) - if pendingMessage == nil { - return - } - req := new(msg.ClientSendMessageMedia) - _ = req.Unmarshal(pendingMessage.Media) - - logger.Info("resumes upload", zap.Int64("MsgID", pendingMessageID)) - if uploadReq := r.fileCtrl.GetUploadRequest(pendingMessage.FileID); uploadReq == nil { - r.fileCtrl.UploadMessageDocument( - pendingMessageID, req.FilePath, req.ThumbFilePath, pendingMessage.FileID, - pendingMessage.ThumbID, pendingMessage.Sha256, pendingMessage.PeerID, - true, - ) - } + pendingMessage, _ := repo.PendingMessages.GetByID(pendingMessageID) + if pendingMessage == nil { + return + } + req := new(msg.ClientSendMessageMedia) + _ = req.Unmarshal(pendingMessage.Media) + + logger.Info("resumes upload", zap.Int64("MsgID", pendingMessageID)) + if uploadReq := r.fileCtrl.GetUploadRequest(pendingMessage.FileID); uploadReq == nil { + r.fileCtrl.UploadMessageDocument( + pendingMessageID, req.FilePath, req.ThumbFilePath, pendingMessage.FileID, + pendingMessage.ThumbID, pendingMessage.Sha256, pendingMessage.PeerID, + true, + ) + } } // AccountUploadPhoto upload user profile photo func (r *River) AccountUploadPhoto(filePath string) (reqID string) { - reqID = r.fileCtrl.UploadUserPhoto(filePath) - return + reqID = r.fileCtrl.UploadUserPhoto(filePath) + return } // GroupUploadPhoto upload group profile photo func (r *River) GroupUploadPhoto(groupID int64, filePath string) (reqID string) { - reqID = r.fileCtrl.UploadGroupPhoto(groupID, filePath) - return + reqID = r.fileCtrl.UploadGroupPhoto(groupID, filePath) + return } // GetDocumentHash returns the md5 hash of the document func (r *River) GetDocumentHash(clusterID int32, fileID int64, accessHash int64) string { - file, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) - - if err != nil { - logger.Warn("Error On GetDocumentHash (Files.Get)", - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - zap.Int64("AccessHash", accessHash), - zap.Error(err), - ) - return "" - } - - if file.MessageID == 0 { - logger.Warn("Not a message document", - zap.Int32("ClusterID", clusterID), - zap.Int64("FileID", fileID), - zap.Int64("AccessHash", accessHash), - ) - return "" - } - - return file.MD5Checksum + file, err := repo.Files.Get(clusterID, fileID, uint64(accessHash)) + + if err != nil { + logger.Warn("Error On GetDocumentHash (Files.Get)", + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + zap.Int64("AccessHash", accessHash), + zap.Error(err), + ) + return "" + } + + if file.MessageID == 0 { + logger.Warn("Not a message document", + zap.Int32("ClusterID", clusterID), + zap.Int64("FileID", fileID), + zap.Int64("AccessHash", accessHash), + ) + return "" + } + + return file.MD5Checksum } diff --git a/sdk/prime/cmd_general.go b/sdk/prime/cmd_general.go index 4e07ab7b..f4b4f776 100644 --- a/sdk/prime/cmd_general.go +++ b/sdk/prime/cmd_general.go @@ -1,653 +1,656 @@ package riversdk import ( - "crypto/rand" - "crypto/rsa" - "encoding/binary" - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/hole" - "git.ronaksoft.com/river/sdk/internal/logs" - mon "git.ronaksoft.com/river/sdk/internal/monitoring" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/internal/salt" - "github.com/monnand/dhkx" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/registry" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "math/big" - "os" - "runtime" - "sync" - "time" + "crypto/rand" + "crypto/rsa" + "encoding/binary" + "math/big" + "os" + "runtime" + "sync" + "time" + + "github.com/monnand/dhkx" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/hole" + "github.com/ronaksoft/river-sdk/internal/logs" + mon "github.com/ronaksoft/river-sdk/internal/monitoring" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/internal/salt" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/registry" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" ) func (r *River) Execute(cb request.Callback) (err error) { - return r.executeCommand(cb) + return r.executeCommand(cb) } // ExecuteCommand is a wrapper function to pass the request to the queueController, to be passed to networkController for final // delivery to the server. SDK uses GetCurrentTeam() to detect the targeted team of the request func (r *River) ExecuteCommand(constructor int64, commandBytes []byte, delegate RequestDelegate) (requestID int64, err error) { - requestID = domain.SequentialUniqueID() - err = r.executeCommand( - request.DelegateAdapter( - domain.GetCurrTeamID(), domain.GetCurrTeamAccess(), uint64(requestID), constructor, commandBytes, delegate, nil, - ), - ) - return requestID, err + requestID = domain.SequentialUniqueID() + err = r.executeCommand( + request.DelegateAdapter( + domain.GetCurrTeamID(), domain.GetCurrTeamAccess(), uint64(requestID), constructor, commandBytes, delegate, nil, + ), + ) + return requestID, err } // ExecuteCommandWithTeam is similar to ExecuteTeam but explicitly defines the target team -func (r *River) ExecuteCommandWithTeam(teamID, accessHash, constructor int64, commandBytes []byte, delegate RequestDelegate) (requestID int64, err error) { - requestID = domain.SequentialUniqueID() - err = r.executeCommand( - request.DelegateAdapter( - teamID, uint64(accessHash), uint64(requestID), constructor, commandBytes, delegate, nil, - ), - ) - return requestID, err +func (r *River) ExecuteCommandWithTeam( + teamID, accessHash, constructor int64, commandBytes []byte, delegate RequestDelegate, +) (requestID int64, err error) { + requestID = domain.SequentialUniqueID() + err = r.executeCommand( + request.DelegateAdapter( + teamID, uint64(accessHash), uint64(requestID), constructor, commandBytes, delegate, nil, + ), + ) + return requestID, err } func (r *River) executeCommand(reqCB request.Callback) (err error) { - if registry.ConstructorName(reqCB.Constructor()) == "" { - err = domain.ErrInvalidConstructor - return - } - - var ( - waitGroup = &sync.WaitGroup{} - blockingMode = reqCB.Flags()&request.Blocking != 0 - serverForce = reqCB.Flags()&request.ServerForced != 0 - ) - - logger.Debug("executes command", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(reqCB.Constructor())), - zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), - ) - - // if function is in blocking mode set the waitGroup to block until the job is done, otherwise - // save 'delegate' into delegates list to be fetched later. - if blockingMode { - waitGroup.Add(1) - defer waitGroup.Wait() - } - - // If the constructor is a local command then - handler, ok := r.localCommands[reqCB.Constructor()] - if ok && !serverForce { - go func() { - r.executeLocalCommand(handler, reqCB) - if blockingMode { - waitGroup.Done() - } - }() - return - } - - go func() { - r.executeRemoteCommand(reqCB) - if blockingMode { - waitGroup.Done() - } - }() - return + if registry.ConstructorName(reqCB.Constructor()) == "" { + err = domain.ErrInvalidConstructor + return + } + + var ( + waitGroup = &sync.WaitGroup{} + blockingMode = reqCB.Flags()&request.Blocking != 0 + serverForce = reqCB.Flags()&request.ServerForced != 0 + ) + + logger.Debug("executes command", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(reqCB.Constructor())), + zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), + ) + + // if function is in blocking mode set the waitGroup to block until the job is done, otherwise + // save 'delegate' into delegates list to be fetched later. + if blockingMode { + waitGroup.Add(1) + defer waitGroup.Wait() + } + + // If the constructor is a local command then + handler, ok := r.localCommands[reqCB.Constructor()] + if ok && !serverForce { + go func() { + r.executeLocalCommand(handler, reqCB) + if blockingMode { + waitGroup.Done() + } + }() + return + } + + go func() { + r.executeRemoteCommand(reqCB) + if blockingMode { + waitGroup.Done() + } + }() + return } func (r *River) executeLocalCommand(handler request.LocalHandler, reqCB request.Callback) { - logger.Info("execute local command", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(reqCB.Constructor())), - zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), - ) - - out := &rony.MessageEnvelope{ - RequestID: reqCB.RequestID(), - } - out.Header = append(out.Header, reqCB.Envelope().Header...) - - handler(reqCB) + logger.Info("execute local command", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(reqCB.Constructor())), + zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), + ) + + out := &rony.MessageEnvelope{ + RequestID: reqCB.RequestID(), + } + out.Header = append(out.Header, reqCB.Envelope().Header...) + + handler(reqCB) } func (r *River) executeRemoteCommand(reqCB request.Callback) { - logger.Info("execute remote command", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(reqCB.Constructor())), - zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), - ) - - var ( - directToNet = r.realTimeCommands[reqCB.Constructor()] - waitForNetwork = true - ) - - if reqCB.Flags()&request.SkipWaitForNetwork != 0 { - waitForNetwork = false - directToNet = true - - go func() { - <-time.After(reqCB.Timeout()) - reqCB := request.GetCallback(reqCB.RequestID()) - if reqCB != nil { - reqCB.OnTimeout() - r.CancelRequest(int64(reqCB.RequestID())) - } - }() - } - if reqCB.Flags()&request.Realtime != 0 { - directToNet = true - } - - if waitForNetwork { - r.networkCtrl.WaitForNetwork(true) - } - - // If the constructor is a realtime command, then just send it to the server - if directToNet { - r.networkCtrl.WebsocketCommand(reqCB) - } else { - r.queueCtrl.EnqueueCommand(reqCB) - } + logger.Info("execute remote command", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(reqCB.Constructor())), + zap.String("Flags", request.DelegateFlagToString(reqCB.Flags())), + ) + + var ( + directToNet = r.realTimeCommands[reqCB.Constructor()] + waitForNetwork = true + ) + + if reqCB.Flags()&request.SkipWaitForNetwork != 0 { + waitForNetwork = false + directToNet = true + + go func() { + <-time.After(reqCB.Timeout()) + reqCB := request.GetCallback(reqCB.RequestID()) + if reqCB != nil { + reqCB.OnTimeout() + r.CancelRequest(int64(reqCB.RequestID())) + } + }() + } + if reqCB.Flags()&request.Realtime != 0 { + directToNet = true + } + + if waitForNetwork { + r.networkCtrl.WaitForNetwork(true) + } + + // If the constructor is a realtime command, then just send it to the server + if directToNet { + r.networkCtrl.WebsocketCommand(reqCB) + } else { + r.queueCtrl.EnqueueCommand(reqCB) + } } // CreateAuthKey creates an AuthID and AuthKey to be used for transporting messages between client and server func (r *River) CreateAuthKey() (err error) { - logger.Info("CreateAuthKey()") + logger.Info("CreateAuthKey()") - // Wait for network - r.networkCtrl.WaitForNetwork(false) + // Wait for network + r.networkCtrl.WaitForNetwork(false) - sk, err := r.getServerKeys() - if err != nil { - logger.Warn("got error on SystemGetServers") - return - } + sk, err := r.getServerKeys() + if err != nil { + logger.Warn("got error on SystemGetServers") + return + } - clientNonce, serverNonce, serverPubFP, serverDHFP, serverPQ, err := r.initConnect() - if err != nil { - logger.Warn("got error on InitConnect", zap.Error(err)) - return - } - logger.Info("passed the 1st step of CreateAuthKey", - zap.Uint64("ServerNonce", serverNonce), - zap.Uint64("ServerPubFP", serverPubFP), - zap.Uint64("ServerPQ", serverPQ), - ) + clientNonce, serverNonce, serverPubFP, serverDHFP, serverPQ, err := r.initConnect() + if err != nil { + logger.Warn("got error on InitConnect", zap.Error(err)) + return + } + logger.Info("passed the 1st step of CreateAuthKey", + zap.Uint64("ServerNonce", serverNonce), + zap.Uint64("ServerPubFP", serverPubFP), + zap.Uint64("ServerPQ", serverPQ), + ) - err = r.initCompleteAuth(sk, clientNonce, serverNonce, serverPubFP, serverDHFP, serverPQ) - logger.Info("passed the 2nd step of CreateAuthKey") + err = r.initCompleteAuth(sk, clientNonce, serverNonce, serverPubFP, serverDHFP, serverPQ) + logger.Info("passed the 2nd step of CreateAuthKey") - // double set AuthID - r.networkCtrl.SetAuthorization(r.ConnInfo.AuthID, r.ConnInfo.AuthKey[:]) + // double set AuthID + r.networkCtrl.SetAuthorization(r.ConnInfo.AuthID, r.ConnInfo.AuthKey[:]) - r.ConnInfo.Save() + r.ConnInfo.Save() - return + return } func (r *River) getServerKeys() (sk *msg.SystemKeys, err error) { - logger.Info("GetServerKeys") - r.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, - domain.NextRequestID(), - msg.C_SystemGetServerKeys, - &msg.SystemGetServerKeys{}, - func() { - err = domain.ErrRequestTimeout - }, - func(res *rony.MessageEnvelope) { - logger.Debug("GetServerKeys() Success Callback Called") - switch res.Constructor { - case msg.C_SystemKeys: - sk = &msg.SystemKeys{} - err = sk.Unmarshal(res.Message) - if err != nil { - logger.Error("couldn't unmarshal SystemKeys response", zap.Error(err)) - return - } - - logger.Debug("received SystemKeys", - zap.Int("Keys", len(sk.RSAPublicKeys)), - zap.Int("DHGroups", len(sk.DHGroups)), - ) - case rony.C_Error: - err = domain.ParseServerError(res.Message) - default: - err = domain.ErrInvalidConstructor - } - }, - nil, - false, - 0, domain.WebsocketRequestTimeout, - ), - ) - - return + logger.Info("GetServerKeys") + r.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, + domain.NextRequestID(), + msg.C_SystemGetServerKeys, + &msg.SystemGetServerKeys{}, + func() { + err = domain.ErrRequestTimeout + }, + func(res *rony.MessageEnvelope) { + logger.Debug("GetServerKeys() Success Callback Called") + switch res.Constructor { + case msg.C_SystemKeys: + sk = &msg.SystemKeys{} + err = sk.Unmarshal(res.Message) + if err != nil { + logger.Error("couldn't unmarshal SystemKeys response", zap.Error(err)) + return + } + + logger.Debug("received SystemKeys", + zap.Int("Keys", len(sk.RSAPublicKeys)), + zap.Int("DHGroups", len(sk.DHGroups)), + ) + case rony.C_Error: + err = domain.ParseServerError(res.Message) + default: + err = domain.ErrInvalidConstructor + } + }, + nil, + false, + 0, domain.WebsocketRequestTimeout, + ), + ) + + return } func (r *River) initConnect() (clientNonce, serverNonce, serverPubFP, serverDHFP, serverPQ uint64, err error) { - logger.Info("CreateAuthKey() 1st Step Started :: InitConnect") - r.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, - domain.NextRequestID(), - msg.C_InitConnect, - &msg.InitConnect{ - ClientNonce: domain.NextRequestID(), - }, - func() { - err = domain.ErrRequestTimeout - }, - func(res *rony.MessageEnvelope) { - logger.Debug("CreateAuthKey() Success Callback Called") - switch res.Constructor { - case msg.C_InitResponse: - x := new(msg.InitResponse) - err = x.Unmarshal(res.Message) - if err != nil { - logger.Error("CreateAuthKey() Success Callback", zap.Error(err)) - } - clientNonce = x.ClientNonce - serverNonce = x.ServerNonce - serverPubFP = x.RSAPubKeyFingerPrint - serverDHFP = x.DHGroupFingerPrint - serverPQ = x.PQ - logger.Debug("CreateAuthKey() InitResponse Received", - zap.Uint64("ServerNonce", serverNonce), - zap.Uint64("ClientNonce", clientNonce), - zap.Uint64("ServerDhFingerPrint", serverDHFP), - zap.Uint64("ServerFingerPrint", serverPubFP), - ) - case rony.C_Error: - err = domain.ParseServerError(res.Message) - default: - err = domain.ErrInvalidConstructor - } - }, - nil, - false, 0, domain.WebsocketRequestTimeout, - ), - ) - return + logger.Info("CreateAuthKey() 1st Step Started :: InitConnect") + r.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, + domain.NextRequestID(), + msg.C_InitConnect, + &msg.InitConnect{ + ClientNonce: domain.NextRequestID(), + }, + func() { + err = domain.ErrRequestTimeout + }, + func(res *rony.MessageEnvelope) { + logger.Debug("CreateAuthKey() Success Callback Called") + switch res.Constructor { + case msg.C_InitResponse: + x := new(msg.InitResponse) + err = x.Unmarshal(res.Message) + if err != nil { + logger.Error("CreateAuthKey() Success Callback", zap.Error(err)) + } + clientNonce = x.ClientNonce + serverNonce = x.ServerNonce + serverPubFP = x.RSAPubKeyFingerPrint + serverDHFP = x.DHGroupFingerPrint + serverPQ = x.PQ + logger.Debug("CreateAuthKey() InitResponse Received", + zap.Uint64("ServerNonce", serverNonce), + zap.Uint64("ClientNonce", clientNonce), + zap.Uint64("ServerDhFingerPrint", serverDHFP), + zap.Uint64("ServerFingerPrint", serverPubFP), + ) + case rony.C_Error: + err = domain.ParseServerError(res.Message) + default: + err = domain.ErrInvalidConstructor + } + }, + nil, + false, 0, domain.WebsocketRequestTimeout, + ), + ) + return } func (r *River) initCompleteAuth(sk *msg.SystemKeys, clientNonce, serverNonce, serverPubFP, serverDHFP, serverPQ uint64) (err error) { - logger.Info("CreateAuthKey() 2nd Step Started :: InitCompleteAuth") - - dhGroup, err := r.getDhGroup(sk, int64(serverDHFP)) - if err != nil { - return err - } - dhPrime := big.NewInt(0) - dhPrime.SetString(dhGroup.Prime, 16) - - dh := dhkx.CreateGroup(dhPrime, big.NewInt(int64(dhGroup.Gen))) - clientDhKey, _ := dh.GeneratePrivateKey(rand.Reader) - - req2 := &msg.InitCompleteAuth{ - ServerNonce: serverNonce, - ClientNonce: clientNonce, - ClientDHPubKey: clientDhKey.Bytes(), - } - - p, q := domain.SplitPQ(big.NewInt(int64(serverPQ))) - if p.Cmp(q) < 0 { - req2.P = p.Uint64() - req2.Q = q.Uint64() - } else { - req2.P = q.Uint64() - req2.Q = p.Uint64() - } - - logger.Debug("CreateAuthKey() PQ Split", - zap.Uint64("P", req2.P), - zap.Uint64("Q", req2.Q), - ) - - serverPubKey, err := r.getPublicKey(sk, int64(serverPubFP)) - if err != nil { - return err - } - n := big.NewInt(0) - n.SetString(serverPubKey.N, 10) - rsaPublicKey := rsa.PublicKey{ - N: n, - E: int(serverPubKey.E), - } - - q2Internal := &msg.InitCompleteAuthInternal{ - SecretNonce: []byte(domain.RandomID(16)), - } - decrypted, _ := q2Internal.Marshal() - encrypted, err := rsa.EncryptPKCS1v15(rand.Reader, &rsaPublicKey, decrypted) - if err != nil { - logger.Error("CreateAuthKey() got error on EncryptPKCS1v15()", zap.Error(err)) - } - req2.EncryptedPayload = encrypted - r.networkCtrl.WebsocketCommand( - request.NewCallback( - 0, 0, - domain.NextRequestID(), - msg.C_InitCompleteAuth, - req2, - func() { - err = domain.ErrRequestTimeout - }, - func(res *rony.MessageEnvelope) { - switch res.Constructor { - case msg.C_InitAuthCompleted: - x := new(msg.InitAuthCompleted) - _ = x.Unmarshal(res.Message) - switch x.Status { - case msg.InitAuthCompleted_OK: - serverDhKey, err := dh.ComputeKey(dhkx.NewPublicKey(x.ServerDHPubKey), clientDhKey) - if err != nil { - logger.Error("CreateAuthKey() -> ComputeKey()", zap.Error(err)) - return - } - // r.ConnInfo.AuthKey = serverDhKey.Bytes() - copy(r.ConnInfo.AuthKey[:], serverDhKey.Bytes()) - - // authKeyHash, _ := domain.Sha256(r.ConnInfo.AuthKey[:]) - var authKeyHash [32]byte - tools.MustSha256(r.ConnInfo.AuthKey[:], authKeyHash[:0]) - r.ConnInfo.AuthID = int64(binary.LittleEndian.Uint64(authKeyHash[24:32])) - - var ( - secret []byte - secretHash [32]byte - ) - secret = append(secret, q2Internal.SecretNonce...) - secret = append(secret, byte(msg.InitAuthCompleted_OK)) - secret = append(secret, authKeyHash[:8]...) - tools.MustSha256(secret, secretHash[:0]) - if x.SecretHash != binary.LittleEndian.Uint64(secretHash[24:32]) { - logger.Warn("CreateAuthKey secret hashes do not match", - zap.Uint64("Server", x.SecretHash), - zap.Uint64("Client", binary.LittleEndian.Uint64(secretHash[24:32])), - ) - return - } - case msg.InitAuthCompleted_RETRY: - // TODO:: Retry with new DHKey - case msg.InitAuthCompleted_FAIL: - err = domain.ErrAuthFailed - return - } - r.networkCtrl.SetAuthorization(r.ConnInfo.AuthID, r.ConnInfo.AuthKey[:]) - case rony.C_Error: - err = domain.ParseServerError(res.Message) - return - default: - err = domain.ErrInvalidConstructor - return - } - }, - nil, - false, 0, domain.WebsocketRequestTimeout, - ), - ) - return + logger.Info("CreateAuthKey() 2nd Step Started :: InitCompleteAuth") + + dhGroup, err := r.getDhGroup(sk, int64(serverDHFP)) + if err != nil { + return err + } + dhPrime := big.NewInt(0) + dhPrime.SetString(dhGroup.Prime, 16) + + dh := dhkx.CreateGroup(dhPrime, big.NewInt(int64(dhGroup.Gen))) + clientDhKey, _ := dh.GeneratePrivateKey(rand.Reader) + + req2 := &msg.InitCompleteAuth{ + ServerNonce: serverNonce, + ClientNonce: clientNonce, + ClientDHPubKey: clientDhKey.Bytes(), + } + + p, q := domain.SplitPQ(big.NewInt(int64(serverPQ))) + if p.Cmp(q) < 0 { + req2.P = p.Uint64() + req2.Q = q.Uint64() + } else { + req2.P = q.Uint64() + req2.Q = p.Uint64() + } + + logger.Debug("CreateAuthKey() PQ Split", + zap.Uint64("P", req2.P), + zap.Uint64("Q", req2.Q), + ) + + serverPubKey, err := r.getPublicKey(sk, int64(serverPubFP)) + if err != nil { + return err + } + n := big.NewInt(0) + n.SetString(serverPubKey.N, 10) + rsaPublicKey := rsa.PublicKey{ + N: n, + E: int(serverPubKey.E), + } + + q2Internal := &msg.InitCompleteAuthInternal{ + SecretNonce: []byte(domain.RandomID(16)), + } + decrypted, _ := q2Internal.Marshal() + encrypted, err := rsa.EncryptPKCS1v15(rand.Reader, &rsaPublicKey, decrypted) + if err != nil { + logger.Error("CreateAuthKey() got error on EncryptPKCS1v15()", zap.Error(err)) + } + req2.EncryptedPayload = encrypted + r.networkCtrl.WebsocketCommand( + request.NewCallback( + 0, 0, + domain.NextRequestID(), + msg.C_InitCompleteAuth, + req2, + func() { + err = domain.ErrRequestTimeout + }, + func(res *rony.MessageEnvelope) { + switch res.Constructor { + case msg.C_InitAuthCompleted: + x := new(msg.InitAuthCompleted) + _ = x.Unmarshal(res.Message) + switch x.Status { + case msg.InitAuthCompleted_OK: + serverDhKey, err := dh.ComputeKey(dhkx.NewPublicKey(x.ServerDHPubKey), clientDhKey) + if err != nil { + logger.Error("CreateAuthKey() -> ComputeKey()", zap.Error(err)) + return + } + // r.ConnInfo.AuthKey = serverDhKey.Bytes() + copy(r.ConnInfo.AuthKey[:], serverDhKey.Bytes()) + + // authKeyHash, _ := domain.Sha256(r.ConnInfo.AuthKey[:]) + var authKeyHash [32]byte + tools.MustSha256(r.ConnInfo.AuthKey[:], authKeyHash[:0]) + r.ConnInfo.AuthID = int64(binary.LittleEndian.Uint64(authKeyHash[24:32])) + + var ( + secret []byte + secretHash [32]byte + ) + secret = append(secret, q2Internal.SecretNonce...) + secret = append(secret, byte(msg.InitAuthCompleted_OK)) + secret = append(secret, authKeyHash[:8]...) + tools.MustSha256(secret, secretHash[:0]) + if x.SecretHash != binary.LittleEndian.Uint64(secretHash[24:32]) { + logger.Warn("CreateAuthKey secret hashes do not match", + zap.Uint64("Server", x.SecretHash), + zap.Uint64("Client", binary.LittleEndian.Uint64(secretHash[24:32])), + ) + return + } + case msg.InitAuthCompleted_RETRY: + // TODO:: Retry with new DHKey + case msg.InitAuthCompleted_FAIL: + err = domain.ErrAuthFailed + return + } + r.networkCtrl.SetAuthorization(r.ConnInfo.AuthID, r.ConnInfo.AuthKey[:]) + case rony.C_Error: + err = domain.ParseServerError(res.Message) + return + default: + err = domain.ErrInvalidConstructor + return + } + }, + nil, + false, 0, domain.WebsocketRequestTimeout, + ), + ) + return } func (r *River) getPublicKey(pk *msg.SystemKeys, keyFP int64) (*msg.RSAPublicKey, error) { - logger.Info("Public Key loaded", - zap.Int64("keyFP", keyFP), - ) - for _, pk := range pk.RSAPublicKeys { - if pk.FingerPrint == keyFP { - - return pk, nil - } - } - return nil, domain.ErrNotFound + logger.Info("Public Key loaded", + zap.Int64("keyFP", keyFP), + ) + for _, pk := range pk.RSAPublicKeys { + if pk.FingerPrint == keyFP { + + return pk, nil + } + } + return nil, domain.ErrNotFound } func (r *River) getDhGroup(pk *msg.SystemKeys, keyFP int64) (*msg.DHGroup, error) { - logger.Info("DHGroup Key loaded", - zap.Int64("keyFP", keyFP), - ) - for _, dh := range pk.DHGroups { - if dh.FingerPrint == keyFP { - return dh, nil - } - } - return nil, domain.ErrNotFound + logger.Info("DHGroup Key loaded", + zap.Int64("keyFP", keyFP), + ) + for _, dh := range pk.DHGroups { + if dh.FingerPrint == keyFP { + return dh, nil + } + } + return nil, domain.ErrNotFound } // ResetAuthKey reset authorization information, useful in logout func (r *River) ResetAuthKey() { - r.networkCtrl.SetAuthorization(0, nil) - r.ConnInfo.AuthID = 0 - r.ConnInfo.AuthKey = [256]byte{} - r.ConnInfo.Save() + r.networkCtrl.SetAuthorization(0, nil) + r.ConnInfo.AuthID = 0 + r.ConnInfo.AuthKey = [256]byte{} + r.ConnInfo.Save() } // CancelRequest remove given requestID callbacks&delegates and if its not processed by queue we skip it on queue distributor func (r *River) CancelRequest(requestID int64) { - // Cancel Request - r.queueCtrl.CancelRequest(uint64(requestID)) + // Cancel Request + r.queueCtrl.CancelRequest(uint64(requestID)) } // DeletePendingMessage removes pending message from DB func (r *River) DeletePendingMessage(id int64) (isSuccess bool) { - pmsg, _ := repo.PendingMessages.GetByID(id) - if pmsg == nil { - return - } - if pmsg.FileID != 0 { - r.fileCtrl.CancelUploadRequest(pmsg.FileID) - } - - err := repo.PendingMessages.Delete(id) - isSuccess = err == nil - return + pmsg, _ := repo.PendingMessages.GetByID(id) + if pmsg == nil { + return + } + if pmsg.FileID != 0 { + r.fileCtrl.CancelUploadRequest(pmsg.FileID) + } + + err := repo.PendingMessages.Delete(id) + isSuccess = err == nil + return } // GetSyncStatus returns SyncController status func (r *River) GetSyncStatus() int32 { - return int32(r.syncCtrl.GetSyncStatus()) + return int32(r.syncCtrl.GetSyncStatus()) } // Logout drop queue & database , etc ... func (r *River) Logout(notifyServer bool, reason int) error { - _, err, _ := domain.SingleFlight.Do("Logout", func() (interface{}, error) { - logger.Info("Logout Called") - - // unregister device if token exist - if notifyServer { - // send logout request to server - waitGroup := &sync.WaitGroup{} - waitGroup.Add(1) - r.syncCtrl.Logout(waitGroup, 3) - waitGroup.Wait() - logger.Info("sent a AuthLogout request to server, received response") - } - - if r.mainDelegate != nil { - r.mainDelegate.OnSessionClosed(reason) - logger.Info("called SessionClosed delegate") - } - - // Stop Controllers - r.syncCtrl.Stop() - r.queueCtrl.Stop() - r.fileCtrl.Stop() - r.networkCtrl.Stop() - logger.Info("stopped all the controllers") - - repo.DropAll() - logger.Info("reset our database") - - r.ConnInfo.FirstName = "" - r.ConnInfo.LastName = "" - r.ConnInfo.Phone = "" - r.ConnInfo.UserID = 0 - r.ConnInfo.Username = "" - r.ConnInfo.Bio = "" - r.ConnInfo.Save() - logger.Info("reset our connection info") - - err := r.AppStart() - if err != nil { - return nil, err - } - logger.Info("started the app again") - - r.networkCtrl.Connect() - logger.Info("start connecting to server") - return nil, err - }) - return err + _, err, _ := domain.SingleFlight.Do("Logout", func() (interface{}, error) { + logger.Info("Logout Called") + + // unregister device if token exist + if notifyServer { + // send logout request to server + waitGroup := &sync.WaitGroup{} + waitGroup.Add(1) + r.syncCtrl.Logout(waitGroup, 3) + waitGroup.Wait() + logger.Info("sent a AuthLogout request to server, received response") + } + + if r.mainDelegate != nil { + r.mainDelegate.OnSessionClosed(reason) + logger.Info("called SessionClosed delegate") + } + + // Stop Controllers + r.syncCtrl.Stop() + r.queueCtrl.Stop() + r.fileCtrl.Stop() + r.networkCtrl.Stop() + logger.Info("stopped all the controllers") + + repo.DropAll() + logger.Info("reset our database") + + r.ConnInfo.FirstName = "" + r.ConnInfo.LastName = "" + r.ConnInfo.Phone = "" + r.ConnInfo.UserID = 0 + r.ConnInfo.Username = "" + r.ConnInfo.Bio = "" + r.ConnInfo.Save() + logger.Info("reset our connection info") + + err := r.AppStart() + if err != nil { + return nil, err + } + logger.Info("started the app again") + + r.networkCtrl.Connect() + logger.Info("start connecting to server") + return nil, err + }) + return err } // UpdateContactInfo update contact name func (r *River) UpdateContactInfo(teamID int64, userID int64, firstName, lastName string) error { - return repo.Users.UpdateContactInfo(teamID, userID, firstName, lastName) + return repo.Users.UpdateContactInfo(teamID, userID, firstName, lastName) } func (r *River) GetScrollStatus(peerID int64, peerType int32) int64 { - return repo.MessagesExtra.GetScrollID(domain.GetCurrTeamID(), peerID, peerType, 0) + return repo.MessagesExtra.GetScrollID(domain.GetCurrTeamID(), peerID, peerType, 0) } func (r *River) SetScrollStatus(peerID, msgID int64, peerType int32) { - repo.MessagesExtra.SaveScrollID(domain.GetCurrTeamID(), peerID, peerType, 0, msgID) + repo.MessagesExtra.SaveScrollID(domain.GetCurrTeamID(), peerID, peerType, 0, msgID) } func (r *River) GetServerTimeUnix() int64 { - return domain.Now().Unix() + return domain.Now().Unix() } // AppForeground must be called every time apps come into foreground. func (r *River) AppForeground(online bool) { - logger.Info("APP is Foreground", zap.Bool("Online", online)) - statusOnline = online - - // Set the time we come to foreground - mon.SetForegroundTime() - - if r.networkCtrl.Connected() { - err := r.networkCtrl.Ping(domain.RandomUint64(), domain.WebsocketPingTimeout) - if err != nil { - logger.Info("AppForeground:: Ping failed, we reconnect", zap.Error(err)) - r.networkCtrl.Reconnect() - } else { - r.syncCtrl.Sync() - } - } else { - logger.Info("AppForeground:: Network was disconnected we reconnect") - r.networkCtrl.Reconnect() - } - if online { - r.syncCtrl.UpdateStatus(statusOnline) - } + logger.Info("APP is Foreground", zap.Bool("Online", online)) + statusOnline = online + + // Set the time we come to foreground + mon.SetForegroundTime() + + if r.networkCtrl.Connected() { + err := r.networkCtrl.Ping(domain.RandomUint64(), domain.WebsocketPingTimeout) + if err != nil { + logger.Info("AppForeground:: Ping failed, we reconnect", zap.Error(err)) + r.networkCtrl.Reconnect() + } else { + r.syncCtrl.Sync() + } + } else { + logger.Info("AppForeground:: Network was disconnected we reconnect") + r.networkCtrl.Reconnect() + } + if online { + r.syncCtrl.UpdateStatus(statusOnline) + } } // AppBackground must be called every time apps goes into background func (r *River) AppBackground() { - logger.Info("APP is Background") - statusOnline = false - r.syncCtrl.UpdateStatus(false) + logger.Info("APP is Background") + statusOnline = false + r.syncCtrl.UpdateStatus(false) - // Compute the time we have been foreground - mon.IncForegroundTime() + // Compute the time we have been foreground + mon.IncForegroundTime() - // Save the usage - mon.SaveUsage() + // Save the usage + mon.SaveUsage() } // AppKill must be called when app is closed func (r *River) AppKill() { - r.AppBackground() + r.AppBackground() } // AppStart must be called when app is started func (r *River) AppStart() error { - statusOnline = false - runtime.GOMAXPROCS(runtime.NumCPU() * 2) - - logs.SetSentry(r.ConnInfo.AuthID, r.ConnInfo.UserID, r.sentryDSN) - logger.Info("Starting") - - // Initialize MessageHole - hole.Init() - - // Initialize DB replaced with ORM - err := repo.Init(r.dbPath, r.optimizeForLowMemory) - if err != nil { - _ = os.RemoveAll(r.dbPath) - return err - } - - repo.SetSelfUserID(r.ConnInfo.UserID) - - confBytes, _ := repo.System.LoadBytes("SysConfig") - if confBytes != nil { - domain.SysConfig.Reactions = domain.SysConfig.Reactions[:0] - err := domain.SysConfig.Unmarshal(confBytes) - if err != nil { - logger.Warn("could not unmarshal SysConfig", zap.Error(err)) - } - } - - // Load the usage stats - mon.LoadUsage() - - // Update Authorizations - r.networkCtrl.SetAuthorization(r.ConnInfo.AuthID, r.ConnInfo.AuthKey[:]) - r.syncCtrl.SetUserID(r.ConnInfo.UserID) - - // Update the current salt - salt.UpdateSalt() - - // Start Controllers - r.networkCtrl.Start() - r.fileCtrl.Start() - r.queueCtrl.Start(r.resetQueueOnStartup) - r.syncCtrl.Start() - - lastReIndexTime, err := repo.System.LoadInt(domain.SkReIndexTime) - if err != nil || time.Now().Unix()-int64(lastReIndexTime) > domain.Day { - go func() { - logger.Info("ReIndexing Users & Groups") - repo.Users.ReIndex(domain.GetCurrTeamID()) - repo.Groups.ReIndex() - repo.Messages.ReIndex() - _ = repo.System.SaveInt(domain.SkReIndexTime, uint64(time.Now().Unix())) - }() - } - - domain.StartTime = time.Now() - domain.WindowLog = func(txt string) { - r.mainDelegate.AddLog(txt) - } - logger.Info("Started") - - // Run update/message processors in background - go r.messageReceiver() - go r.updateReceiver() - - // Try to keep the user's status online - go r.updateStatusJob() - - // Run Garbage Collection In Background - go func() { - time.Sleep(10 * time.Second) - repo.GC() - }() - - return nil + statusOnline = false + runtime.GOMAXPROCS(runtime.NumCPU() * 2) + + logs.SetSentry(r.ConnInfo.AuthID, r.ConnInfo.UserID, r.sentryDSN) + logger.Info("Starting") + + // Initialize MessageHole + hole.Init() + + // Initialize DB replaced with ORM + err := repo.Init(r.dbPath, r.optimizeForLowMemory) + if err != nil { + _ = os.RemoveAll(r.dbPath) + return err + } + + repo.SetSelfUserID(r.ConnInfo.UserID) + + confBytes, _ := repo.System.LoadBytes("SysConfig") + if confBytes != nil { + domain.SysConfig.Reactions = domain.SysConfig.Reactions[:0] + err := domain.SysConfig.Unmarshal(confBytes) + if err != nil { + logger.Warn("could not unmarshal SysConfig", zap.Error(err)) + } + } + + // Load the usage stats + mon.LoadUsage() + + // Update Authorizations + r.networkCtrl.SetAuthorization(r.ConnInfo.AuthID, r.ConnInfo.AuthKey[:]) + r.syncCtrl.SetUserID(r.ConnInfo.UserID) + + // Update the current salt + salt.UpdateSalt() + + // Start Controllers + r.networkCtrl.Start() + r.fileCtrl.Start() + r.queueCtrl.Start(r.resetQueueOnStartup) + r.syncCtrl.Start() + + lastReIndexTime, err := repo.System.LoadInt(domain.SkReIndexTime) + if err != nil || time.Now().Unix()-int64(lastReIndexTime) > domain.Day { + go func() { + logger.Info("ReIndexing Users & Groups") + repo.Users.ReIndex(domain.GetCurrTeamID()) + repo.Groups.ReIndex() + repo.Messages.ReIndex() + _ = repo.System.SaveInt(domain.SkReIndexTime, uint64(time.Now().Unix())) + }() + } + + domain.StartTime = time.Now() + domain.WindowLog = func(txt string) { + r.mainDelegate.AddLog(txt) + } + logger.Info("Started") + + // Run update/message processors in background + go r.messageReceiver() + go r.updateReceiver() + + // Try to keep the user's status online + go r.updateStatusJob() + + // Run Garbage Collection In Background + go func() { + time.Sleep(10 * time.Second) + repo.GC() + }() + + return nil } func (r *River) SetTeam(teamID int64, teamAccessHash int64, forceSync bool) { - domain.SetCurrentTeam(teamID, uint64(teamAccessHash)) + domain.SetCurrentTeam(teamID, uint64(teamAccessHash)) - if teamID != 0 { - r.syncCtrl.TeamSync(teamID, uint64(teamAccessHash), forceSync) - } + if teamID != 0 { + r.syncCtrl.TeamSync(teamID, uint64(teamAccessHash), forceSync) + } } func (r *River) Version() string { - return domain.SDKVersion + return domain.SDKVersion } /* @@ -657,9 +660,9 @@ func (r *River) Version() string { var statusOnline bool func (r *River) updateStatusJob() { - d := time.Duration(domain.SysConfig.OnlineUpdatePeriodInSec-5) * time.Second - for { - time.Sleep(d) - r.syncCtrl.UpdateStatus(statusOnline) - } + d := time.Duration(domain.SysConfig.OnlineUpdatePeriodInSec-5) * time.Second + for { + time.Sleep(d) + r.syncCtrl.UpdateStatus(statusOnline) + } } diff --git a/sdk/prime/cmd_general_test.go b/sdk/prime/cmd_general_test.go index 3c755d11..ff612ab1 100644 --- a/sdk/prime/cmd_general_test.go +++ b/sdk/prime/cmd_general_test.go @@ -1,33 +1,33 @@ package riversdk import ( - "git.ronaksoft.com/river/sdk/internal/testenv" - "go.uber.org/zap/zapcore" + "github.com/ronaksoft/river-sdk/internal/testenv" + "go.uber.org/zap/zapcore" ) func init() { - testenv.Log().Info("Creating New River SDK Instance") - r := new(River) - conInfo := new(RiverConnection) - r.SetConfig(&RiverConfig{ - DbPath: "./_data/", - DbID: "test", - // ServerKeysFilePath: "./keys.json", - SeedHostPorts: "edge.river.im", - MainDelegate: new(MainDelegateDummy), - FileDelegate: new(FileDelegateDummy), - LogLevel: int(zapcore.DebugLevel), - DocumentAudioDirectory: "./_files/audio", - DocumentVideoDirectory: "./_files/video", - DocumentPhotoDirectory: "./_files/photo", - DocumentFileDirectory: "./_files/file", - DocumentCacheDirectory: "./_files/cache", - LogDirectory: "./_files/logs", - ConnInfo: conInfo, - }) - err := r.AppStart() - if err != nil { - panic(err) - } - _River = r + testenv.Log().Info("Creating New River SDK Instance") + r := new(River) + conInfo := new(RiverConnection) + r.SetConfig(&RiverConfig{ + DbPath: "./_data/", + DbID: "test", + // ServerKeysFilePath: "./keys.json", + SeedHostPorts: "edge.river.im", + MainDelegate: new(MainDelegateDummy), + FileDelegate: new(FileDelegateDummy), + LogLevel: int(zapcore.DebugLevel), + DocumentAudioDirectory: "./_files/audio", + DocumentVideoDirectory: "./_files/video", + DocumentPhotoDirectory: "./_files/photo", + DocumentFileDirectory: "./_files/file", + DocumentCacheDirectory: "./_files/cache", + LogDirectory: "./_files/logs", + ConnInfo: conInfo, + }) + err := r.AppStart() + if err != nil { + panic(err) + } + _River = r } diff --git a/sdk/prime/cmd_network.go b/sdk/prime/cmd_network.go index ec4d22d2..d7ef94e4 100644 --- a/sdk/prime/cmd_network.go +++ b/sdk/prime/cmd_network.go @@ -1,8 +1,8 @@ package riversdk import ( - "git.ronaksoft.com/river/sdk/internal/domain" - "go.uber.org/zap" + "github.com/ronaksoft/river-sdk/internal/domain" + "go.uber.org/zap" ) /* @@ -15,27 +15,27 @@ import ( */ func (r *River) StartNetwork(country string) { - if country != "" { - r.networkCtrl.UpdateEndpoint(country) - } - r.networkCtrl.Connect() + if country != "" { + r.networkCtrl.UpdateEndpoint(country) + } + r.networkCtrl.Connect() } func (r *River) StopNetwork() { - r.networkCtrl.Disconnect() + r.networkCtrl.Disconnect() } // NetworkChange accepts possible values: cellular (2), wifi (1), none (0) func (r *River) NetworkChange(connection int) { - logger.Debug("NetworkChange called", zap.Int("C", connection)) - switch connection { - case domain.ConnectionNone: - r.networkCtrl.Disconnect() - default: - r.networkCtrl.Reconnect() - } + logger.Debug("NetworkChange called", zap.Int("C", connection)) + switch connection { + case domain.ConnectionNone: + r.networkCtrl.Disconnect() + default: + r.networkCtrl.Reconnect() + } } func (r *River) GetNetworkStatus() int32 { - return int32(r.networkCtrl.GetStatus()) + return int32(r.networkCtrl.GetStatus()) } diff --git a/sdk/prime/cmd_search.go b/sdk/prime/cmd_search.go index 3802578f..8afbc9dc 100644 --- a/sdk/prime/cmd_search.go +++ b/sdk/prime/cmd_search.go @@ -1,8 +1,9 @@ package riversdk import ( - "git.ronaksoft.com/river/sdk/internal/repo" - "sync" + "sync" + + "github.com/ronaksoft/river-sdk/internal/repo" ) /* @@ -15,16 +16,16 @@ import ( */ func (r *River) SearchReIndex(teamID int64) { - waitGroup := sync.WaitGroup{} - waitGroup.Add(2) - go func() { - _ = repo.Users.ReIndex(teamID) - _ = repo.Groups.ReIndex() - waitGroup.Done() - }() - go func() { - repo.Messages.ReIndex() - waitGroup.Done() - }() - waitGroup.Wait() + waitGroup := sync.WaitGroup{} + waitGroup.Add(2) + go func() { + _ = repo.Users.ReIndex(teamID) + _ = repo.Groups.ReIndex() + waitGroup.Done() + }() + go func() { + repo.Messages.ReIndex() + waitGroup.Done() + }() + waitGroup.Wait() } diff --git a/sdk/prime/delegates.go b/sdk/prime/delegates.go index ec7fac50..e3cf06a2 100644 --- a/sdk/prime/delegates.go +++ b/sdk/prime/delegates.go @@ -1,43 +1,43 @@ package riversdk import ( - "git.ronaksoft.com/river/sdk/internal/request" + "github.com/ronaksoft/river-sdk/internal/request" ) // MainDelegate external (UI) handler will listen to this function to receive data from SDK type MainDelegate interface { - OnNetworkStatusChanged(status int) - OnSyncStatusChanged(status int) - OnUpdates(constructor int64, b []byte) - OnGeneralError(b []byte) - OnSessionClosed(res int) - ShowLoggerAlert() - AddLog(text string) - AppUpdate(version string, updateAvailable, force bool) - DataSynced(dialogs, contacts, gifs bool) + OnNetworkStatusChanged(status int) + OnSyncStatusChanged(status int) + OnUpdates(constructor int64, b []byte) + OnGeneralError(b []byte) + OnSessionClosed(res int) + ShowLoggerAlert() + AddLog(text string) + AppUpdate(version string, updateAvailable, force bool) + DataSynced(dialogs, contacts, gifs bool) } type FileDelegate interface { - OnProgressChanged(reqID string, clusterID int32, fileID, accessHash, percent int64, peerID int64) - OnCompleted(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) - OnCancel(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) + OnProgressChanged(reqID string, clusterID int32, fileID, accessHash, percent int64, peerID int64) + OnCompleted(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) + OnCancel(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) } type ConnInfoDelegate interface { - SaveConnInfo(connInfo []byte) - Get(key string) string - Set(key, value string) + SaveConnInfo(connInfo []byte) + Get(key string) string + Set(key, value string) } type CallDelegate interface { - OnUpdate(action int32, b []byte) - InitStream(audio, video bool) bool - InitConnection(connID int32, b []byte) int64 - CloseConnection(connID int32) bool - GetOfferSDP(connID int32) (out []byte) - SetOfferGetAnswerSDP(connID int32, req []byte) (out []byte) - SetAnswerSDP(connID int32, b []byte) bool - AddIceCandidate(connID int32, b []byte) bool + OnUpdate(action int32, b []byte) + InitStream(audio, video bool) bool + InitConnection(connID int32, b []byte) int64 + CloseConnection(connID int32) bool + GetOfferSDP(connID int32) (out []byte) + SetOfferGetAnswerSDP(connID int32, req []byte) (out []byte) + SetAnswerSDP(connID int32, b []byte) bool + AddIceCandidate(connID int32, b []byte) bool } type RequestDelegateFlag = request.DelegateFlag @@ -45,16 +45,16 @@ type RequestDelegateFlag = request.DelegateFlag // Request Flags // These are exact copies of request.Delegate flags const ( - RequestServerForced RequestDelegateFlag = 1 << iota - RequestBlocking - RequestSkipWaitForNetwork - RequestSkipFlusher - RequestRealtime - RequestBatch + RequestServerForced RequestDelegateFlag = 1 << iota + RequestBlocking + RequestSkipWaitForNetwork + RequestSkipFlusher + RequestRealtime + RequestBatch ) type RequestDelegate interface { - OnComplete(b []byte) - OnTimeout(err error) - Flags() RequestDelegateFlag + OnComplete(b []byte) + OnTimeout(err error) + Flags() RequestDelegateFlag } diff --git a/sdk/prime/message_hole.go b/sdk/prime/message_hole.go index 19f3a791..2c9baa9c 100644 --- a/sdk/prime/message_hole.go +++ b/sdk/prime/message_hole.go @@ -1,7 +1,7 @@ package riversdk import ( - "git.ronaksoft.com/river/sdk/internal/hole" + "github.com/ronaksoft/river-sdk/internal/hole" ) /* @@ -14,57 +14,57 @@ import ( */ type MessageHole struct { - lists map[string]*hole.Detector + lists map[string]*hole.Detector } func (mh *MessageHole) Init() { - mh.lists = make(map[string]*hole.Detector) + mh.lists = make(map[string]*hole.Detector) } func (mh *MessageHole) detector(key string) *hole.Detector { - hm, ok := mh.lists[key] - if !ok { - hm = &hole.Detector{} - mh.lists[key] = hm - } - return hm + hm, ok := mh.lists[key] + if !ok { + hm = &hole.Detector{} + mh.lists[key] = hm + } + return hm } func (mh *MessageHole) InsertHole(key string, min, max int64) { - m := mh.detector(key) - m.InsertBar(hole.Bar{Min: min, Max: max, Type: hole.Hole}) + m := mh.detector(key) + m.InsertBar(hole.Bar{Min: min, Max: max, Type: hole.Hole}) } func (mh *MessageHole) InsertFill(key string, min, max int64) { - m := mh.detector(key) - m.InsertBar(hole.Bar{Min: min, Max: max, Type: hole.Filled}) + m := mh.detector(key) + m.InsertBar(hole.Bar{Min: min, Max: max, Type: hole.Filled}) } func (mh *MessageHole) IsInHole(key string, msgID int64) bool { - m := mh.detector(key) - return m.IsPointHole(msgID) + m := mh.detector(key) + return m.IsPointHole(msgID) } func (mh *MessageHole) IsRangeFilled(key string, min, max int64) bool { - m := mh.detector(key) - return m.IsRangeFilled(min, max) + m := mh.detector(key) + return m.IsRangeFilled(min, max) } func (mh *MessageHole) SetLowerFilled(key string) { - m := mh.detector(key) - m.SetLowerFilled() + m := mh.detector(key) + m.SetLowerFilled() } func (mh *MessageHole) SetUpperFilled(key string, maxID int64) { - m := mh.detector(key) - m.SetUpperFilled(maxID) + m := mh.detector(key) + m.SetUpperFilled(maxID) } func (mh *MessageHole) String(key string) string { - m := mh.detector(key) - return m.String() + m := mh.detector(key) + return m.String() } func (mh *MessageHole) Release(key string) { - delete(mh.lists, key) + delete(mh.lists, key) } diff --git a/sdk/prime/river.go b/sdk/prime/river.go index 7f394d14..d4aba4f9 100644 --- a/sdk/prime/river.go +++ b/sdk/prime/river.go @@ -1,104 +1,105 @@ package riversdk import ( - "encoding/json" - "fmt" - "git.ronaksoft.com/river/msg/go/msg" - fileCtrl "git.ronaksoft.com/river/sdk/internal/ctrl_file" - "git.ronaksoft.com/river/sdk/internal/logs" - mon "git.ronaksoft.com/river/sdk/internal/monitoring" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/request" - "git.ronaksoft.com/river/sdk/internal/salt" - "git.ronaksoft.com/river/sdk/internal/uiexec" - "git.ronaksoft.com/river/sdk/module" - "git.ronaksoft.com/river/sdk/module/account" - "git.ronaksoft.com/river/sdk/module/auth" - "git.ronaksoft.com/river/sdk/module/bot" - "git.ronaksoft.com/river/sdk/module/call" - "git.ronaksoft.com/river/sdk/module/contact" - "git.ronaksoft.com/river/sdk/module/gif" - "git.ronaksoft.com/river/sdk/module/group" - "git.ronaksoft.com/river/sdk/module/label" - "git.ronaksoft.com/river/sdk/module/message" - "git.ronaksoft.com/river/sdk/module/notification" - "git.ronaksoft.com/river/sdk/module/search" - "git.ronaksoft.com/river/sdk/module/system" - "git.ronaksoft.com/river/sdk/module/team" - "git.ronaksoft.com/river/sdk/module/user" - "git.ronaksoft.com/river/sdk/module/wallpaper" - "github.com/ronaksoft/rony" - "github.com/ronaksoft/rony/registry" - "github.com/ronaksoft/rony/tools" - "go.uber.org/zap" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" - - "git.ronaksoft.com/river/sdk/internal/ctrl_network" - "git.ronaksoft.com/river/sdk/internal/ctrl_queue" - "git.ronaksoft.com/river/sdk/internal/ctrl_sync" - "git.ronaksoft.com/river/sdk/internal/domain" + "encoding/json" + "fmt" + "strconv" + "strings" + "sync" + "sync/atomic" + "time" + + "github.com/ronaksoft/river-msg/go/msg" + fileCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_file" + networkCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_network" + queueCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_queue" + syncCtrl "github.com/ronaksoft/river-sdk/internal/ctrl_sync" + "github.com/ronaksoft/river-sdk/internal/logs" + mon "github.com/ronaksoft/river-sdk/internal/monitoring" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/request" + "github.com/ronaksoft/river-sdk/internal/salt" + "github.com/ronaksoft/river-sdk/internal/uiexec" + "github.com/ronaksoft/river-sdk/module" + "github.com/ronaksoft/river-sdk/module/account" + "github.com/ronaksoft/river-sdk/module/auth" + "github.com/ronaksoft/river-sdk/module/bot" + "github.com/ronaksoft/river-sdk/module/call" + "github.com/ronaksoft/river-sdk/module/contact" + "github.com/ronaksoft/river-sdk/module/gif" + "github.com/ronaksoft/river-sdk/module/group" + "github.com/ronaksoft/river-sdk/module/label" + "github.com/ronaksoft/river-sdk/module/message" + "github.com/ronaksoft/river-sdk/module/notification" + "github.com/ronaksoft/river-sdk/module/search" + "github.com/ronaksoft/river-sdk/module/system" + "github.com/ronaksoft/river-sdk/module/team" + "github.com/ronaksoft/river-sdk/module/user" + "github.com/ronaksoft/river-sdk/module/wallpaper" + "github.com/ronaksoft/rony" + "github.com/ronaksoft/rony/registry" + "github.com/ronaksoft/rony/tools" + "go.uber.org/zap" + + "github.com/ronaksoft/river-sdk/internal/domain" ) var ( - logger *logs.Logger + logger *logs.Logger ) func init() { - logger = logs.With("River") + logger = logs.With("River") } func SetLogLevel(l int) { - logger.SetLogLevel(l) + logger.SetLogLevel(l) } type RiverConfig struct { - // Comma separated list of hostports - SeedHostPorts string - // DbPath is the path of the folder holding the sqlite database. - DbPath string - // DbID is used to save data for different accounts in separate databases. Could be used for multi-account cases. - DbID string - // MainDelegate holds all the general callback functions that let the user of this SDK - // get notified of the events. - MainDelegate MainDelegate - // FileDelegate holds all the callbacks required by file related functions - FileDelegate FileDelegate - // CallDelegate handle call events to devices - CallDelegate CallDelegate - // LogLevel - LogLevel int - SentryDSN string - // Folder path to save files - DocumentPhotoDirectory string - DocumentVideoDirectory string - DocumentFileDirectory string - DocumentAudioDirectory string - DocumentCacheDirectory string - LogDirectory string - // ConnInfo stores the Connection Info - ConnInfo *RiverConnection - // ClientInfo - ClientPlatform string - ClientVersion string - ClientOs string - ClientVendor string - CountryCode string - - // OptimizeForLowMemory if is set then SDK tries to use the lowest possible ram - OptimizeForLowMemory bool - MaxInFlightDownloads int32 - MaxInFlightUploads int32 - - // Misc - ResetQueueOnStartup bool - - // Team related parameters - TeamID int64 - TeamAccessHash int64 + // Comma separated list of hostports + SeedHostPorts string + // DbPath is the path of the folder holding the sqlite database. + DbPath string + // DbID is used to save data for different accounts in separate databases. Could be used for multi-account cases. + DbID string + // MainDelegate holds all the general callback functions that let the user of this SDK + // get notified of the events. + MainDelegate MainDelegate + // FileDelegate holds all the callbacks required by file related functions + FileDelegate FileDelegate + // CallDelegate handle call events to devices + CallDelegate CallDelegate + // LogLevel + LogLevel int + SentryDSN string + // Folder path to save files + DocumentPhotoDirectory string + DocumentVideoDirectory string + DocumentFileDirectory string + DocumentAudioDirectory string + DocumentCacheDirectory string + LogDirectory string + // ConnInfo stores the Connection Info + ConnInfo *RiverConnection + // ClientInfo + ClientPlatform string + ClientVersion string + ClientOs string + ClientVendor string + CountryCode string + + // OptimizeForLowMemory if is set then SDK tries to use the lowest possible ram + OptimizeForLowMemory bool + MaxInFlightDownloads int32 + MaxInFlightUploads int32 + + // Misc + ResetQueueOnStartup bool + + // Team related parameters + TeamID int64 + TeamAccessHash int64 } // River is the main and a wrapper around all the components of the system (networkController, queueController, @@ -108,664 +109,664 @@ type RiverConfig struct { // to smooth the connection between client and server are done by this SDK. The underlying storage used // by this SDK is Badger V2. 'repo' is the package name selected to handle repository functions. type River struct { - // Connection Info - ConnInfo *RiverConnection - // modules hold reference to registered modules - modules map[string]module.Module - // localCommands can be satisfied by client cache - localCommands map[int64]request.LocalHandler - // realTimeCommands should not passed to queue to send they should directly pass to networkController - realTimeCommands map[int64]bool - messageChan chan []*rony.MessageEnvelope - updateChan chan *msg.UpdateContainer - - // Internal Controllers - networkCtrl *networkCtrl.Controller - queueCtrl *queueCtrl.Controller - syncCtrl *syncCtrl.Controller - fileCtrl *fileCtrl.Controller - - // Delegates - mainDelegate MainDelegate - fileDelegate FileDelegate - callDelegate CallDelegate - - // Internal Misc. Configs - dbPath string - optimizeForLowMemory bool - resetQueueOnStartup bool - sentryDSN string + // Connection Info + ConnInfo *RiverConnection + // modules hold reference to registered modules + modules map[string]module.Module + // localCommands can be satisfied by client cache + localCommands map[int64]request.LocalHandler + // realTimeCommands should not passed to queue to send they should directly pass to networkController + realTimeCommands map[int64]bool + messageChan chan []*rony.MessageEnvelope + updateChan chan *msg.UpdateContainer + + // Internal Controllers + networkCtrl *networkCtrl.Controller + queueCtrl *queueCtrl.Controller + syncCtrl *syncCtrl.Controller + fileCtrl *fileCtrl.Controller + + // Delegates + mainDelegate MainDelegate + fileDelegate FileDelegate + callDelegate CallDelegate + + // Internal Misc. Configs + dbPath string + optimizeForLowMemory bool + resetQueueOnStartup bool + sentryDSN string } func (r *River) GetConnInfo() domain.RiverConfigurator { - return r.ConnInfo + return r.ConnInfo } func (r *River) SyncCtrl() *syncCtrl.Controller { - return r.syncCtrl + return r.syncCtrl } func (r *River) NetCtrl() *networkCtrl.Controller { - return r.networkCtrl + return r.networkCtrl } func (r *River) QueueCtrl() *queueCtrl.Controller { - return r.queueCtrl + return r.queueCtrl } func (r *River) FileCtrl() *fileCtrl.Controller { - return r.fileCtrl + return r.fileCtrl } func (r *River) Module(name string) module.Module { - return r.modules[name] + return r.modules[name] } // SetConfig must be called before any other function, otherwise it panics func (r *River) SetConfig(conf *RiverConfig) { - domain.ClientPlatform = conf.ClientPlatform - domain.ClientVersion = conf.ClientVersion - domain.ClientOS = conf.ClientOs - domain.ClientVendor = conf.ClientVendor - - r.messageChan = make(chan []*rony.MessageEnvelope, 100) - r.updateChan = make(chan *msg.UpdateContainer, 100) - r.sentryDSN = conf.SentryDSN - r.optimizeForLowMemory = conf.OptimizeForLowMemory - r.resetQueueOnStartup = conf.ResetQueueOnStartup - r.ConnInfo = conf.ConnInfo - - if conf.MaxInFlightDownloads <= 0 { - conf.MaxInFlightDownloads = 10 - } - if conf.MaxInFlightUploads <= 0 { - conf.MaxInFlightUploads = 10 - } - - // Initialize DB Path - conf.DbPath = strings.TrimPrefix(conf.DbPath, "file://") - conf.DbPath = strings.TrimRight(conf.DbPath, "/ ") - r.dbPath = fmt.Sprintf("%s/%s.db", conf.DbPath, conf.DbID) - - r.mainDelegate = conf.MainDelegate - r.fileDelegate = conf.FileDelegate - r.callDelegate = conf.CallDelegate - - // set log level - logger.SetLogLevel(conf.LogLevel) - if conf.LogDirectory != "" { - logger.WarnOnErr("Initializing log file", logs.SetFilePath(conf.LogDirectory)) - } - - // Initialize realtime requests - r.modules = map[string]module.Module{} - r.localCommands = map[int64]request.LocalHandler{} - r.realTimeCommands = map[int64]bool{ - msg.C_MessagesSetTyping: true, - msg.C_InitConnect: true, - msg.C_InitConnectTest: true, - msg.C_InitAuthCompleted: true, - msg.C_SystemGetConfig: true, - msg.C_SystemGetSalts: true, - msg.C_SystemGetServerTime: true, - msg.C_SystemGetServerKeys: true, - } - - // Initialize UI-Executor - uiexec.Init( - r.mainDelegate.OnUpdates, - r.mainDelegate.DataSynced, - ) - - // Initialize Network Controller - r.networkCtrl = networkCtrl.New( - networkCtrl.Config{ - SeedHosts: strings.Split(conf.SeedHostPorts, ","), - CountryCode: conf.CountryCode, - }, - ) - r.networkCtrl.OnNetworkStatusChange = func(newQuality domain.NetworkStatus) { - if r.mainDelegate != nil { - r.mainDelegate.OnNetworkStatusChanged(int(newQuality)) - } - } - r.networkCtrl.OnGeneralError = r.onGeneralError - r.networkCtrl.OnWebsocketConnect = r.onNetworkConnect - r.networkCtrl.MessageChan = r.messageChan - r.networkCtrl.UpdateChan = r.updateChan - - // Initialize FileController - repo.SetRootFolders( - conf.DocumentAudioDirectory, - conf.DocumentFileDirectory, - conf.DocumentPhotoDirectory, - conf.DocumentVideoDirectory, - conf.DocumentCacheDirectory, - ) - r.fileCtrl = fileCtrl.New(fileCtrl.Config{ - Network: r.networkCtrl, - DbPath: r.dbPath, - MaxInflightDownloads: conf.MaxInFlightDownloads, - MaxInflightUploads: conf.MaxInFlightUploads, - CompletedCB: r.fileDelegate.OnCompleted, - ProgressChangedCB: r.fileDelegate.OnProgressChanged, - CancelCB: r.fileDelegate.OnCancel, - PostUploadProcessCB: r.postUploadProcess, - }) - - // Initialize queueController - r.queueCtrl = queueCtrl.New(r.fileCtrl, r.networkCtrl, r.dbPath) - - // Initialize Sync Controller - r.syncCtrl = syncCtrl.NewSyncController( - syncCtrl.Config{ - ConnInfo: r.ConnInfo, - NetworkCtrl: r.networkCtrl, - QueueCtrl: r.queueCtrl, - FileCtrl: r.fileCtrl, - SyncStatusChangeCB: func(newStatus domain.SyncStatus) { - if r.mainDelegate != nil { - r.mainDelegate.OnSyncStatusChanged(int(newStatus)) - } - }, - AppUpdateCB: func(version string, updateAvailable bool, force bool) { - if r.mainDelegate != nil { - r.mainDelegate.AppUpdate(version, updateAvailable, force) - } - }, - }, - ) - - // Set current team - domain.SetCurrentTeam(conf.TeamID, uint64(conf.TeamAccessHash)) - - deviceType := msg.CallDeviceType_CallDeviceUnknown - if domain.ClientPlatform == "River iOS" { - deviceType = msg.CallDeviceType_CallDeviceIOS - } else if domain.ClientPlatform == "River Android" { - deviceType = msg.CallDeviceType_CallDeviceAndroid - } - - callModule := call.New(&call.Config{ - TeamID: domain.GetCurrTeamID(), - TeamAccess: domain.GetCurrTeamAccess(), - UserID: r.ConnInfo.UserID, - DeviceType: deviceType, - Callback: &call.Callback{ - OnUpdate: r.callDelegate.OnUpdate, - InitStream: r.callDelegate.InitStream, - InitConnection: r.callDelegate.InitConnection, - CloseConnection: r.callDelegate.CloseConnection, - GetOfferSDP: r.callDelegate.GetOfferSDP, - SetOfferGetAnswerSDP: r.callDelegate.SetOfferGetAnswerSDP, - SetAnswerSDP: r.callDelegate.SetAnswerSDP, - AddIceCandidate: r.callDelegate.AddIceCandidate, - }, - }) - - r.registerModule( - account.New(), auth.New(), bot.New(), contact.New(), - gif.New(), group.New(), label.New(), message.New(), - search.New(), system.New(), team.New(), user.New(), wallpaper.New(), - callModule, notification.New(), - ) - - // Initialize River Connection - logger.Info("SetConfig done!") + domain.ClientPlatform = conf.ClientPlatform + domain.ClientVersion = conf.ClientVersion + domain.ClientOS = conf.ClientOs + domain.ClientVendor = conf.ClientVendor + + r.messageChan = make(chan []*rony.MessageEnvelope, 100) + r.updateChan = make(chan *msg.UpdateContainer, 100) + r.sentryDSN = conf.SentryDSN + r.optimizeForLowMemory = conf.OptimizeForLowMemory + r.resetQueueOnStartup = conf.ResetQueueOnStartup + r.ConnInfo = conf.ConnInfo + + if conf.MaxInFlightDownloads <= 0 { + conf.MaxInFlightDownloads = 10 + } + if conf.MaxInFlightUploads <= 0 { + conf.MaxInFlightUploads = 10 + } + + // Initialize DB Path + conf.DbPath = strings.TrimPrefix(conf.DbPath, "file://") + conf.DbPath = strings.TrimRight(conf.DbPath, "/ ") + r.dbPath = fmt.Sprintf("%s/%s.db", conf.DbPath, conf.DbID) + + r.mainDelegate = conf.MainDelegate + r.fileDelegate = conf.FileDelegate + r.callDelegate = conf.CallDelegate + + // set log level + logger.SetLogLevel(conf.LogLevel) + if conf.LogDirectory != "" { + logger.WarnOnErr("Initializing log file", logs.SetFilePath(conf.LogDirectory)) + } + + // Initialize realtime requests + r.modules = map[string]module.Module{} + r.localCommands = map[int64]request.LocalHandler{} + r.realTimeCommands = map[int64]bool{ + msg.C_MessagesSetTyping: true, + msg.C_InitConnect: true, + msg.C_InitConnectTest: true, + msg.C_InitAuthCompleted: true, + msg.C_SystemGetConfig: true, + msg.C_SystemGetSalts: true, + msg.C_SystemGetServerTime: true, + msg.C_SystemGetServerKeys: true, + } + + // Initialize UI-Executor + uiexec.Init( + r.mainDelegate.OnUpdates, + r.mainDelegate.DataSynced, + ) + + // Initialize Network Controller + r.networkCtrl = networkCtrl.New( + networkCtrl.Config{ + SeedHosts: strings.Split(conf.SeedHostPorts, ","), + CountryCode: conf.CountryCode, + }, + ) + r.networkCtrl.OnNetworkStatusChange = func(newQuality domain.NetworkStatus) { + if r.mainDelegate != nil { + r.mainDelegate.OnNetworkStatusChanged(int(newQuality)) + } + } + r.networkCtrl.OnGeneralError = r.onGeneralError + r.networkCtrl.OnWebsocketConnect = r.onNetworkConnect + r.networkCtrl.MessageChan = r.messageChan + r.networkCtrl.UpdateChan = r.updateChan + + // Initialize FileController + repo.SetRootFolders( + conf.DocumentAudioDirectory, + conf.DocumentFileDirectory, + conf.DocumentPhotoDirectory, + conf.DocumentVideoDirectory, + conf.DocumentCacheDirectory, + ) + r.fileCtrl = fileCtrl.New(fileCtrl.Config{ + Network: r.networkCtrl, + DbPath: r.dbPath, + MaxInflightDownloads: conf.MaxInFlightDownloads, + MaxInflightUploads: conf.MaxInFlightUploads, + CompletedCB: r.fileDelegate.OnCompleted, + ProgressChangedCB: r.fileDelegate.OnProgressChanged, + CancelCB: r.fileDelegate.OnCancel, + PostUploadProcessCB: r.postUploadProcess, + }) + + // Initialize queueController + r.queueCtrl = queueCtrl.New(r.fileCtrl, r.networkCtrl, r.dbPath) + + // Initialize Sync Controller + r.syncCtrl = syncCtrl.NewSyncController( + syncCtrl.Config{ + ConnInfo: r.ConnInfo, + NetworkCtrl: r.networkCtrl, + QueueCtrl: r.queueCtrl, + FileCtrl: r.fileCtrl, + SyncStatusChangeCB: func(newStatus domain.SyncStatus) { + if r.mainDelegate != nil { + r.mainDelegate.OnSyncStatusChanged(int(newStatus)) + } + }, + AppUpdateCB: func(version string, updateAvailable bool, force bool) { + if r.mainDelegate != nil { + r.mainDelegate.AppUpdate(version, updateAvailable, force) + } + }, + }, + ) + + // Set current team + domain.SetCurrentTeam(conf.TeamID, uint64(conf.TeamAccessHash)) + + deviceType := msg.CallDeviceType_CallDeviceUnknown + if domain.ClientPlatform == "River iOS" { + deviceType = msg.CallDeviceType_CallDeviceIOS + } else if domain.ClientPlatform == "River Android" { + deviceType = msg.CallDeviceType_CallDeviceAndroid + } + + callModule := call.New(&call.Config{ + TeamID: domain.GetCurrTeamID(), + TeamAccess: domain.GetCurrTeamAccess(), + UserID: r.ConnInfo.UserID, + DeviceType: deviceType, + Callback: &call.Callback{ + OnUpdate: r.callDelegate.OnUpdate, + InitStream: r.callDelegate.InitStream, + InitConnection: r.callDelegate.InitConnection, + CloseConnection: r.callDelegate.CloseConnection, + GetOfferSDP: r.callDelegate.GetOfferSDP, + SetOfferGetAnswerSDP: r.callDelegate.SetOfferGetAnswerSDP, + SetAnswerSDP: r.callDelegate.SetAnswerSDP, + AddIceCandidate: r.callDelegate.AddIceCandidate, + }, + }) + + r.registerModule( + account.New(), auth.New(), bot.New(), contact.New(), + gif.New(), group.New(), label.New(), message.New(), + search.New(), system.New(), team.New(), user.New(), wallpaper.New(), + callModule, notification.New(), + ) + + // Initialize River Connection + logger.Info("SetConfig done!") } func (r *River) onNetworkConnect() (err error) { - defer logger.RecoverPanic( - "onNetworkConnect", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - }, - nil, - ) - - domain.WindowLog(fmt.Sprintf("Connected: %s", domain.StartTime.Format(time.Kitchen))) - var serverUpdateID int64 - waitGroup := &sync.WaitGroup{} - // If we have no salt then we must call GetServerTime and GetServerSalt sequentially, otherwise - // We call them in parallel - if atomic.LoadInt32(&domain.TimeSynced) == 0 { - err = r.syncCtrl.GetServerTime() - if err != nil { - return err - } - domain.WindowLog(fmt.Sprintf("ServerTime (%s): %s", domain.TimeDelta, time.Since(domain.StartTime))) - } - atomic.CompareAndSwapInt32(&domain.TimeSynced, 0, 1) - - switch salt.Count() { - case 0: - r.syncCtrl.GetServerSalt() - domain.WindowLog(fmt.Sprintf("ServerSalt: %s", time.Since(domain.StartTime))) - case 1, 2, 3: - waitGroup.Add(1) - go func() { - r.syncCtrl.GetServerSalt() - domain.WindowLog(fmt.Sprintf("ServerSalt: %s", time.Since(domain.StartTime))) - waitGroup.Done() - }() - default: - // We have enough salts - } - - serverUpdateID, err = r.syncCtrl.AuthRecall("NetworkConnect") - if err != nil { - logger.Warn("Error On AuthRecall", zap.Error(err)) - } - domain.WindowLog(fmt.Sprintf("AuthRecalled: %s", time.Since(domain.StartTime))) - waitGroup.Wait() - - // If we are disconnected or not logged in or error happened then we return - if err != nil || r.syncCtrl.GetUserID() == 0 || r.networkCtrl.Disconnected() { - return - } - - go func() { - // Check if client is synced with servers - if r.syncCtrl.GetUpdateID() < serverUpdateID { - // Sync with Server - r.syncCtrl.Sync() - domain.WindowLog(fmt.Sprintf("Synced: %s", time.Since(domain.StartTime))) - } else { - r.syncCtrl.SetSynced() - domain.WindowLog(fmt.Sprintf("Already Synced: %s", time.Since(domain.StartTime))) - } - - // Load SystemConfigs - if atomic.LoadInt32(&domain.ConfigSynced) == 0 { - r.syncCtrl.GetSystemConfig() - } - atomic.CompareAndSwapInt32(&domain.ConfigSynced, 0, 1) - - if atomic.LoadInt32(&domain.ContactsSynced) == 0 { - // Get contacts and imports remaining contacts - waitGroup.Add(1) - r.syncCtrl.GetContacts(waitGroup, 0, 0) - waitGroup.Wait() - domain.WindowLog(fmt.Sprintf("ContactsGet: %s", time.Since(domain.StartTime))) - r.syncCtrl.ContactsImport(true, nil) - domain.WindowLog(fmt.Sprintf("ContactsImported: %s", time.Since(domain.StartTime))) - } - atomic.CompareAndSwapInt32(&domain.ContactsSynced, 0, 1) - - }() - return nil + defer logger.RecoverPanic( + "onNetworkConnect", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + }, + nil, + ) + + domain.WindowLog(fmt.Sprintf("Connected: %s", domain.StartTime.Format(time.Kitchen))) + var serverUpdateID int64 + waitGroup := &sync.WaitGroup{} + // If we have no salt then we must call GetServerTime and GetServerSalt sequentially, otherwise + // We call them in parallel + if atomic.LoadInt32(&domain.TimeSynced) == 0 { + err = r.syncCtrl.GetServerTime() + if err != nil { + return err + } + domain.WindowLog(fmt.Sprintf("ServerTime (%s): %s", domain.TimeDelta, time.Since(domain.StartTime))) + } + atomic.CompareAndSwapInt32(&domain.TimeSynced, 0, 1) + + switch salt.Count() { + case 0: + r.syncCtrl.GetServerSalt() + domain.WindowLog(fmt.Sprintf("ServerSalt: %s", time.Since(domain.StartTime))) + case 1, 2, 3: + waitGroup.Add(1) + go func() { + r.syncCtrl.GetServerSalt() + domain.WindowLog(fmt.Sprintf("ServerSalt: %s", time.Since(domain.StartTime))) + waitGroup.Done() + }() + default: + // We have enough salts + } + + serverUpdateID, err = r.syncCtrl.AuthRecall("NetworkConnect") + if err != nil { + logger.Warn("Error On AuthRecall", zap.Error(err)) + } + domain.WindowLog(fmt.Sprintf("AuthRecalled: %s", time.Since(domain.StartTime))) + waitGroup.Wait() + + // If we are disconnected or not logged in or error happened then we return + if err != nil || r.syncCtrl.GetUserID() == 0 || r.networkCtrl.Disconnected() { + return + } + + go func() { + // Check if client is synced with servers + if r.syncCtrl.GetUpdateID() < serverUpdateID { + // Sync with Server + r.syncCtrl.Sync() + domain.WindowLog(fmt.Sprintf("Synced: %s", time.Since(domain.StartTime))) + } else { + r.syncCtrl.SetSynced() + domain.WindowLog(fmt.Sprintf("Already Synced: %s", time.Since(domain.StartTime))) + } + + // Load SystemConfigs + if atomic.LoadInt32(&domain.ConfigSynced) == 0 { + r.syncCtrl.GetSystemConfig() + } + atomic.CompareAndSwapInt32(&domain.ConfigSynced, 0, 1) + + if atomic.LoadInt32(&domain.ContactsSynced) == 0 { + // Get contacts and imports remaining contacts + waitGroup.Add(1) + r.syncCtrl.GetContacts(waitGroup, 0, 0) + waitGroup.Wait() + domain.WindowLog(fmt.Sprintf("ContactsGet: %s", time.Since(domain.StartTime))) + r.syncCtrl.ContactsImport(true, nil) + domain.WindowLog(fmt.Sprintf("ContactsImported: %s", time.Since(domain.StartTime))) + } + atomic.CompareAndSwapInt32(&domain.ContactsSynced, 0, 1) + + }() + return nil } func (r *River) onGeneralError(requestID uint64, e *rony.Error) { - logger.Info("received error (General)", - zap.Uint64("ReqID", requestID), - zap.String("Code", e.Code), - zap.String("Item", e.Items), - ) - switch { - case domain.CheckError(e, msg.ErrCodeInvalid, msg.ErrItemSalt): - if !salt.UpdateSalt() { - go func() { - r.syncCtrl.GetServerSalt() - domain.WindowLog(fmt.Sprintf("SaltsReceived: %s", time.Since(domain.StartTime))) - }() - } - case domain.CheckError(e, msg.ErrCodeUnavailable, msg.ErrItemUserID): - // We don't do anything just log, but client must call logout - } - - if r.mainDelegate != nil && requestID == 0 { - buff, _ := e.Marshal() - r.mainDelegate.OnGeneralError(buff) - } + logger.Info("received error (General)", + zap.Uint64("ReqID", requestID), + zap.String("Code", e.Code), + zap.String("Item", e.Items), + ) + switch { + case domain.CheckError(e, msg.ErrCodeInvalid, msg.ErrItemSalt): + if !salt.UpdateSalt() { + go func() { + r.syncCtrl.GetServerSalt() + domain.WindowLog(fmt.Sprintf("SaltsReceived: %s", time.Since(domain.StartTime))) + }() + } + case domain.CheckError(e, msg.ErrCodeUnavailable, msg.ErrItemUserID): + // We don't do anything just log, but client must call logout + } + + if r.mainDelegate != nil && requestID == 0 { + buff, _ := e.Marshal() + r.mainDelegate.OnGeneralError(buff) + } } func (r *River) messageReceiver() { - defer logger.RecoverPanic( - "messageReceiver", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - }, - r.messageReceiver, - ) - - for msgs := range r.messageChan { - // sync localDB with responses in the background - r.syncCtrl.MessageApplier(msgs) - - // check requestCallbacks and call callbacks - for idx := range msgs { - reqCB := request.GetCallback(msgs[idx].RequestID) - if reqCB == nil { - continue - } - - mon.ServerResponseTime(reqCB.Constructor(), msgs[idx].Constructor, time.Duration(tools.NanoTime()-reqCB.SentOn())) - select { - case reqCB.ResponseChan() <- msgs[idx]: - logger.Debug("received response", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(msgs[idx].Constructor)), - ) - default: - logger.Error("received response but no callback, we drop response", - zap.Uint64("ReqID", reqCB.RequestID()), - zap.String("C", registry.ConstructorName(msgs[idx].Constructor)), - ) - reqCB.Discard() - } - } - } + defer logger.RecoverPanic( + "messageReceiver", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + }, + r.messageReceiver, + ) + + for msgs := range r.messageChan { + // sync localDB with responses in the background + r.syncCtrl.MessageApplier(msgs) + + // check requestCallbacks and call callbacks + for idx := range msgs { + reqCB := request.GetCallback(msgs[idx].RequestID) + if reqCB == nil { + continue + } + + mon.ServerResponseTime(reqCB.Constructor(), msgs[idx].Constructor, time.Duration(tools.NanoTime()-reqCB.SentOn())) + select { + case reqCB.ResponseChan() <- msgs[idx]: + logger.Debug("received response", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(msgs[idx].Constructor)), + ) + default: + logger.Error("received response but no callback, we drop response", + zap.Uint64("ReqID", reqCB.RequestID()), + zap.String("C", registry.ConstructorName(msgs[idx].Constructor)), + ) + reqCB.Discard() + } + } + } } func (r *River) updateReceiver() { - defer logger.RecoverPanic( - "updateReceiver", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - }, - r.updateReceiver, - ) - for updateContainer := range r.updateChan { - outOfSync := false - if updateContainer.MinUpdateID != 0 && updateContainer.MinUpdateID > r.syncCtrl.GetUpdateID()+1 { - logger.Info("are out of sync", - zap.Int64("ContainerMinID", updateContainer.MinUpdateID), - zap.Int64("ClientUpdateID", r.syncCtrl.GetUpdateID()), - ) - outOfSync = true - } - - if outOfSync { - go r.syncCtrl.Sync() - continue - } - - r.syncCtrl.UpdateApplier(updateContainer, outOfSync) - } + defer logger.RecoverPanic( + "updateReceiver", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + }, + r.updateReceiver, + ) + for updateContainer := range r.updateChan { + outOfSync := false + if updateContainer.MinUpdateID != 0 && updateContainer.MinUpdateID > r.syncCtrl.GetUpdateID()+1 { + logger.Info("are out of sync", + zap.Int64("ContainerMinID", updateContainer.MinUpdateID), + zap.Int64("ClientUpdateID", r.syncCtrl.GetUpdateID()), + ) + outOfSync = true + } + + if outOfSync { + go r.syncCtrl.Sync() + continue + } + + r.syncCtrl.UpdateApplier(updateContainer, outOfSync) + } } func (r *River) postUploadProcess(uploadRequest *msg.ClientFileRequest) bool { - defer logger.RecoverPanic( - "postUploadProcess", - domain.M{ - "OS": domain.ClientOS, - "Ver": domain.ClientVersion, - "FilePath": uploadRequest.FilePath, - }, - nil, - ) - - logger.Info("Post Upload Process", - zap.Bool("IsProfile", uploadRequest.IsProfilePhoto), - zap.Int64("MessageID", uploadRequest.MessageID), - zap.Int64("FileID", uploadRequest.FileID), - ) - switch { - case !uploadRequest.IsProfilePhoto && uploadRequest.MessageID != 0: - return r.sendMessageMedia(uploadRequest) - case uploadRequest.IsProfilePhoto && uploadRequest.GroupID == 0: - return r.uploadAccountPhoto(uploadRequest) - case uploadRequest.IsProfilePhoto && uploadRequest.GroupID != 0: - return r.uploadGroupPhoto(uploadRequest) - } - return false + defer logger.RecoverPanic( + "postUploadProcess", + domain.M{ + "OS": domain.ClientOS, + "Ver": domain.ClientVersion, + "FilePath": uploadRequest.FilePath, + }, + nil, + ) + + logger.Info("Post Upload Process", + zap.Bool("IsProfile", uploadRequest.IsProfilePhoto), + zap.Int64("MessageID", uploadRequest.MessageID), + zap.Int64("FileID", uploadRequest.FileID), + ) + switch { + case !uploadRequest.IsProfilePhoto && uploadRequest.MessageID != 0: + return r.sendMessageMedia(uploadRequest) + case uploadRequest.IsProfilePhoto && uploadRequest.GroupID == 0: + return r.uploadAccountPhoto(uploadRequest) + case uploadRequest.IsProfilePhoto && uploadRequest.GroupID != 0: + return r.uploadGroupPhoto(uploadRequest) + } + return false } func (r *River) sendMessageMedia(uploadRequest *msg.ClientFileRequest) (success bool) { - // This is a upload for message send - pendingMessage, _ := repo.PendingMessages.GetByID(uploadRequest.MessageID) - if pendingMessage == nil { - return true - } - - req := &msg.ClientSendMessageMedia{} - _ = req.Unmarshal(pendingMessage.Media) - err := tools.Try(3, time.Millisecond*500, func() error { - var fileLoc *msg.FileLocation - if uploadRequest.FileID != 0 && uploadRequest.AccessHash != 0 && uploadRequest.ClusterID != 0 { - req.MediaType = msg.InputMediaType_InputMediaTypeDocument - fileLoc = &msg.FileLocation{ - ClusterID: uploadRequest.ClusterID, - FileID: uploadRequest.FileID, - AccessHash: uploadRequest.AccessHash, - } - } - return repo.PendingMessages.UpdateClientMessageMedia(pendingMessage, uploadRequest.TotalParts, req.MediaType, fileLoc) - }) - if err != nil { - logger.Error("Error On UpdateClientMessageMedia", zap.Error(err)) - } - - // Create SendMessageMedia Request - x := &msg.MessagesSendMedia{ - Peer: req.Peer, - ClearDraft: req.ClearDraft, - MediaType: req.MediaType, - RandomID: pendingMessage.FileID, - ReplyTo: req.ReplyTo, - } - - switch x.MediaType { - case msg.InputMediaType_InputMediaTypeUploadedDocument: - doc := &msg.InputMediaUploadedDocument{ - MimeType: req.FileMIME, - Attributes: req.Attributes, - Caption: req.Caption, - Entities: req.Entities, - File: &msg.InputFile{ - FileID: uploadRequest.FileID, - FileName: req.FileName, - MD5Checksum: "", - }, - TinyThumbnail: req.TinyThumb, - } - if uploadRequest.ThumbID != 0 { - doc.Thumbnail = &msg.InputFile{ - FileID: uploadRequest.ThumbID, - FileName: "thumb_" + req.FileName, - MD5Checksum: "", - } - } - x.MediaData, _ = doc.Marshal() - case msg.InputMediaType_InputMediaTypeDocument: - doc := &msg.InputMediaDocument{ - Caption: req.Caption, - Attributes: req.Attributes, - Entities: req.Entities, - Document: &msg.InputDocument{ - ID: uploadRequest.FileID, - AccessHash: uploadRequest.AccessHash, - ClusterID: uploadRequest.ClusterID, - }, - TinyThumbnail: req.TinyThumb, - } - if uploadRequest.ThumbID != 0 { - doc.Thumbnail = &msg.InputFile{ - FileID: uploadRequest.ThumbID, - FileName: "thumb_" + req.FileName, - MD5Checksum: "", - } - } - x.MediaData, _ = doc.Marshal() - - default: - } - - success = true - - waitGroup := sync.WaitGroup{} - waitGroup.Add(1) - successCB := func(m *rony.MessageEnvelope) { - logger.Info("MessagesSendMedia success callback called", zap.String("C", registry.ConstructorName(m.Constructor))) - switch m.Constructor { - case rony.C_Error: - success = false - x := &rony.Error{} - if err := x.Unmarshal(m.Message); err != nil { - logger.Error("couldn't unmarshal MessagesSendMedia (Error) response", zap.Error(err)) - } - logger.Error("received error on MessagesSendMedia response", - zap.String("Code", x.Code), - zap.String("Item", x.Items), - ) - if x.Code == msg.ErrCodeAlreadyExists && x.Items == msg.ErrItemRandomID { - success = true - _ = repo.PendingMessages.Delete(uploadRequest.MessageID) - - } - } - waitGroup.Done() - } - timeoutCB := func() { - success = false - logger.Debug("got Timeout! on MessagesSendMedia response") - waitGroup.Done() - } - - r.queueCtrl.EnqueueCommand( - request.NewCallback( - 0, 0, uint64(x.RandomID), msg.C_MessagesSendMedia, x, - timeoutCB, successCB, nil, false, 0, 0, - ), - ) - - waitGroup.Wait() - return + // This is a upload for message send + pendingMessage, _ := repo.PendingMessages.GetByID(uploadRequest.MessageID) + if pendingMessage == nil { + return true + } + + req := &msg.ClientSendMessageMedia{} + _ = req.Unmarshal(pendingMessage.Media) + err := tools.Try(3, time.Millisecond*500, func() error { + var fileLoc *msg.FileLocation + if uploadRequest.FileID != 0 && uploadRequest.AccessHash != 0 && uploadRequest.ClusterID != 0 { + req.MediaType = msg.InputMediaType_InputMediaTypeDocument + fileLoc = &msg.FileLocation{ + ClusterID: uploadRequest.ClusterID, + FileID: uploadRequest.FileID, + AccessHash: uploadRequest.AccessHash, + } + } + return repo.PendingMessages.UpdateClientMessageMedia(pendingMessage, uploadRequest.TotalParts, req.MediaType, fileLoc) + }) + if err != nil { + logger.Error("Error On UpdateClientMessageMedia", zap.Error(err)) + } + + // Create SendMessageMedia Request + x := &msg.MessagesSendMedia{ + Peer: req.Peer, + ClearDraft: req.ClearDraft, + MediaType: req.MediaType, + RandomID: pendingMessage.FileID, + ReplyTo: req.ReplyTo, + } + + switch x.MediaType { + case msg.InputMediaType_InputMediaTypeUploadedDocument: + doc := &msg.InputMediaUploadedDocument{ + MimeType: req.FileMIME, + Attributes: req.Attributes, + Caption: req.Caption, + Entities: req.Entities, + File: &msg.InputFile{ + FileID: uploadRequest.FileID, + FileName: req.FileName, + MD5Checksum: "", + }, + TinyThumbnail: req.TinyThumb, + } + if uploadRequest.ThumbID != 0 { + doc.Thumbnail = &msg.InputFile{ + FileID: uploadRequest.ThumbID, + FileName: "thumb_" + req.FileName, + MD5Checksum: "", + } + } + x.MediaData, _ = doc.Marshal() + case msg.InputMediaType_InputMediaTypeDocument: + doc := &msg.InputMediaDocument{ + Caption: req.Caption, + Attributes: req.Attributes, + Entities: req.Entities, + Document: &msg.InputDocument{ + ID: uploadRequest.FileID, + AccessHash: uploadRequest.AccessHash, + ClusterID: uploadRequest.ClusterID, + }, + TinyThumbnail: req.TinyThumb, + } + if uploadRequest.ThumbID != 0 { + doc.Thumbnail = &msg.InputFile{ + FileID: uploadRequest.ThumbID, + FileName: "thumb_" + req.FileName, + MD5Checksum: "", + } + } + x.MediaData, _ = doc.Marshal() + + default: + } + + success = true + + waitGroup := sync.WaitGroup{} + waitGroup.Add(1) + successCB := func(m *rony.MessageEnvelope) { + logger.Info("MessagesSendMedia success callback called", zap.String("C", registry.ConstructorName(m.Constructor))) + switch m.Constructor { + case rony.C_Error: + success = false + x := &rony.Error{} + if err := x.Unmarshal(m.Message); err != nil { + logger.Error("couldn't unmarshal MessagesSendMedia (Error) response", zap.Error(err)) + } + logger.Error("received error on MessagesSendMedia response", + zap.String("Code", x.Code), + zap.String("Item", x.Items), + ) + if x.Code == msg.ErrCodeAlreadyExists && x.Items == msg.ErrItemRandomID { + success = true + _ = repo.PendingMessages.Delete(uploadRequest.MessageID) + + } + } + waitGroup.Done() + } + timeoutCB := func() { + success = false + logger.Debug("got Timeout! on MessagesSendMedia response") + waitGroup.Done() + } + + r.queueCtrl.EnqueueCommand( + request.NewCallback( + 0, 0, uint64(x.RandomID), msg.C_MessagesSendMedia, x, + timeoutCB, successCB, nil, false, 0, 0, + ), + ) + + waitGroup.Wait() + return } func (r *River) uploadGroupPhoto(uploadRequest *msg.ClientFileRequest) (success bool) { - // This is a upload group profile picture - x := &msg.GroupsUploadPhoto{ - GroupID: uploadRequest.GroupID, - File: &msg.InputFile{ - FileID: uploadRequest.FileID, - FileName: strconv.FormatInt(uploadRequest.FileID, 10) + ".jpg", - TotalParts: uploadRequest.TotalParts, - MD5Checksum: "", - }, - } - - success = true - waitGroup := sync.WaitGroup{} - waitGroup.Add(1) - successCB := func(m *rony.MessageEnvelope) { - logger.Debug("GroupUploadPhoto success callback called") - switch m.Constructor { - case rony.C_Error: - success = false - x := &rony.Error{} - if err := x.Unmarshal(m.Message); err != nil { - logger.Error("couldn't unmarshal GroupUploadPhoto (Error) response", zap.Error(err)) - } - logger.Error("received error on GroupUploadPhoto response", zap.String("Code", x.Code), zap.String("Item", x.Items)) - } - waitGroup.Done() - } - timeoutCB := func() { - success = false - logger.Debug("got Timeout! on GroupUploadPhoto response") - waitGroup.Done() - } - r.queueCtrl.EnqueueCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_GroupsUploadPhoto, x, - timeoutCB, successCB, nil, - false, 0, 0, - ), - ) - waitGroup.Wait() - return + // This is a upload group profile picture + x := &msg.GroupsUploadPhoto{ + GroupID: uploadRequest.GroupID, + File: &msg.InputFile{ + FileID: uploadRequest.FileID, + FileName: strconv.FormatInt(uploadRequest.FileID, 10) + ".jpg", + TotalParts: uploadRequest.TotalParts, + MD5Checksum: "", + }, + } + + success = true + waitGroup := sync.WaitGroup{} + waitGroup.Add(1) + successCB := func(m *rony.MessageEnvelope) { + logger.Debug("GroupUploadPhoto success callback called") + switch m.Constructor { + case rony.C_Error: + success = false + x := &rony.Error{} + if err := x.Unmarshal(m.Message); err != nil { + logger.Error("couldn't unmarshal GroupUploadPhoto (Error) response", zap.Error(err)) + } + logger.Error("received error on GroupUploadPhoto response", zap.String("Code", x.Code), zap.String("Item", x.Items)) + } + waitGroup.Done() + } + timeoutCB := func() { + success = false + logger.Debug("got Timeout! on GroupUploadPhoto response") + waitGroup.Done() + } + r.queueCtrl.EnqueueCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_GroupsUploadPhoto, x, + timeoutCB, successCB, nil, + false, 0, 0, + ), + ) + waitGroup.Wait() + return } func (r *River) uploadAccountPhoto(uploadRequest *msg.ClientFileRequest) (success bool) { - // This is a upload account profile picture - x := &msg.AccountUploadPhoto{ - File: &msg.InputFile{ - FileID: uploadRequest.FileID, - FileName: strconv.FormatInt(uploadRequest.FileID, 10) + ".jpg", - TotalParts: uploadRequest.TotalParts, - MD5Checksum: "", - }, - } - - success = true - waitGroup := sync.WaitGroup{} - waitGroup.Add(1) - successCB := func(m *rony.MessageEnvelope) { - logger.Debug("AccountUploadPhoto success callback called") - switch m.Constructor { - case rony.C_Error: - success = false - x := &rony.Error{} - if err := x.Unmarshal(m.Message); err != nil { - logger.Error("couldn't unmarshal AccountUploadPhoto (Error) response", zap.Error(err)) - } - logger.Error("received error on AccountUploadPhoto response", zap.String("Code", x.Code), zap.String("Item", x.Items)) - } - waitGroup.Done() - } - timeoutCB := func() { - success = false - logger.Debug("Timeout! on AccountUploadPhoto response") - waitGroup.Done() - } - - r.queueCtrl.EnqueueCommand( - request.NewCallback( - 0, 0, domain.NextRequestID(), msg.C_AccountUploadPhoto, x, - timeoutCB, successCB, nil, - false, 0, 0, - ), - ) - waitGroup.Wait() - return + // This is a upload account profile picture + x := &msg.AccountUploadPhoto{ + File: &msg.InputFile{ + FileID: uploadRequest.FileID, + FileName: strconv.FormatInt(uploadRequest.FileID, 10) + ".jpg", + TotalParts: uploadRequest.TotalParts, + MD5Checksum: "", + }, + } + + success = true + waitGroup := sync.WaitGroup{} + waitGroup.Add(1) + successCB := func(m *rony.MessageEnvelope) { + logger.Debug("AccountUploadPhoto success callback called") + switch m.Constructor { + case rony.C_Error: + success = false + x := &rony.Error{} + if err := x.Unmarshal(m.Message); err != nil { + logger.Error("couldn't unmarshal AccountUploadPhoto (Error) response", zap.Error(err)) + } + logger.Error("received error on AccountUploadPhoto response", zap.String("Code", x.Code), zap.String("Item", x.Items)) + } + waitGroup.Done() + } + timeoutCB := func() { + success = false + logger.Debug("Timeout! on AccountUploadPhoto response") + waitGroup.Done() + } + + r.queueCtrl.EnqueueCommand( + request.NewCallback( + 0, 0, domain.NextRequestID(), msg.C_AccountUploadPhoto, x, + timeoutCB, successCB, nil, + false, 0, 0, + ), + ) + waitGroup.Wait() + return } func (r *River) registerModule(modules ...module.Module) { - for _, m := range modules { - m.Init(r, logger.With(m.Name())) - r.modules[m.Name()] = m - for c, h := range m.LocalHandlers() { - r.localCommands[c] = h - } - for c, h := range m.UpdateAppliers() { - r.syncCtrl.RegisterUpdateApplier(c, h) - } - for c, h := range m.MessageAppliers() { - r.syncCtrl.RegisterMessageApplier(c, h) - } - } + for _, m := range modules { + m.Init(r, logger.With(m.Name())) + r.modules[m.Name()] = m + for c, h := range m.LocalHandlers() { + r.localCommands[c] = h + } + for c, h := range m.UpdateAppliers() { + r.syncCtrl.RegisterUpdateApplier(c, h) + } + for c, h := range m.MessageAppliers() { + r.syncCtrl.RegisterMessageApplier(c, h) + } + } } // RiverConnection connection info type RiverConnection struct { - AuthID int64 - AuthKey [256]byte - UserID int64 - Username string - Phone string - FirstName string - LastName string - Bio string - Delegate ConnInfoDelegate `json:"-"` - Version int + AuthID int64 + AuthKey [256]byte + UserID int64 + Username string + Phone string + FirstName string + LastName string + Bio string + Delegate ConnInfoDelegate `json:"-"` + Version int } // Save RiverConfig interface func func (v *RiverConnection) Save() { - logger.Debug("ConnInfo saved.") - b, _ := json.Marshal(v) - v.Delegate.SaveConnInfo(b) + logger.Debug("ConnInfo saved.") + b, _ := json.Marshal(v) + v.Delegate.SaveConnInfo(b) } func (v *RiverConnection) ChangeAuthID(authID int64) { v.AuthID = authID } func (v *RiverConnection) ChangeAuthKey(authKey []byte) { - copy(v.AuthKey[:], authKey[:256]) + copy(v.AuthKey[:], authKey[:256]) } func (v *RiverConnection) GetAuthKey() []byte { - var bytes = make([]byte, 256) - copy(bytes, v.AuthKey[0:256]) - return bytes + var bytes = make([]byte, 256) + copy(bytes, v.AuthKey[0:256]) + return bytes } func (v *RiverConnection) ChangeUserID(userID int64) { v.UserID = userID } @@ -773,7 +774,7 @@ func (v *RiverConnection) ChangeUserID(userID int64) { v.UserID = userID } func (v *RiverConnection) ChangeUsername(username string) { v.Username = username } func (v *RiverConnection) ChangePhone(phone string) { - v.Phone = phone + v.Phone = phone } func (v *RiverConnection) ChangeFirstName(firstName string) { v.FirstName = firstName } @@ -799,9 +800,9 @@ func (v *RiverConnection) PickupLastName() string { return v.LastName } func (v *RiverConnection) PickupBio() string { return v.Bio } func (v *RiverConnection) GetKey(key string) string { - return v.Delegate.Get(key) + return v.Delegate.Get(key) } func (v *RiverConnection) SetKey(key, value string) { - v.Delegate.Set(key, value) + v.Delegate.Set(key, value) } diff --git a/sdk/prime/river_test.go b/sdk/prime/river_test.go index ea064d75..bd3e49de 100644 --- a/sdk/prime/river_test.go +++ b/sdk/prime/river_test.go @@ -1,80 +1,81 @@ package riversdk import ( - "encoding/json" - "fmt" - "git.ronaksoft.com/river/sdk/internal/domain" - "git.ronaksoft.com/river/sdk/internal/repo" - "git.ronaksoft.com/river/sdk/internal/testenv" - "github.com/ronaksoft/rony" - . "github.com/smartystreets/goconvey/convey" - "go.uber.org/zap" - "go.uber.org/zap/zapcore" - "io/ioutil" - "os" - "testing" + "encoding/json" + "fmt" + "io/ioutil" + "os" + "testing" + + "github.com/ronaksoft/river-sdk/internal/domain" + "github.com/ronaksoft/river-sdk/internal/repo" + "github.com/ronaksoft/river-sdk/internal/testenv" + "github.com/ronaksoft/rony" + . "github.com/smartystreets/goconvey/convey" + "go.uber.org/zap" + "go.uber.org/zap/zapcore" ) var ( - _River *River + _River *River ) func TestSDK(t *testing.T) { - Convey("Start", t, func(c C) { - err := _River.AppStart() - c.So(err, ShouldBeNil) - - _River.StartNetwork("") - if _River.ConnInfo.AuthID == 0 { - _River.CreateAuthKey() - } - }) - Convey("Get Salt", t, func() { - - }) + Convey("Start", t, func(c C) { + err := _River.AppStart() + c.So(err, ShouldBeNil) + + _River.StartNetwork("") + if _River.ConnInfo.AuthID == 0 { + _River.CreateAuthKey() + } + }) + Convey("Get Salt", t, func() { + + }) } func init() { - testenv.Log().Info("Creating New River SDK Instance") - r := new(River) - conInfo := new(RiverConnection) - connDelegate := &ConnInfoDelegates{} - connDelegate.Load(conInfo) - conInfo.Delegate = new(ConnInfoDelegates) - - r.SetConfig(&RiverConfig{ - DbPath: "./_data/", - DbID: "test", - MainDelegate: new(MainDelegateDummy), - FileDelegate: new(FileDelegateDummy), - LogLevel: int(zapcore.DebugLevel), - DocumentAudioDirectory: "./_files/audio", - DocumentVideoDirectory: "./_files/video", - DocumentPhotoDirectory: "./_files/photo", - DocumentFileDirectory: "./_files/file", - DocumentCacheDirectory: "./_files/cache", - LogDirectory: "./_files/logs", - ConnInfo: conInfo, - SeedHostPorts: "river.ronaksoftware.com", - }) - _River = r - - repo.MustInit(fmt.Sprintf("%s/%s.db", "./_data", "test"), false) + testenv.Log().Info("Creating New River SDK Instance") + r := new(River) + conInfo := new(RiverConnection) + connDelegate := &ConnInfoDelegates{} + connDelegate.Load(conInfo) + conInfo.Delegate = new(ConnInfoDelegates) + + r.SetConfig(&RiverConfig{ + DbPath: "./_data/", + DbID: "test", + MainDelegate: new(MainDelegateDummy), + FileDelegate: new(FileDelegateDummy), + LogLevel: int(zapcore.DebugLevel), + DocumentAudioDirectory: "./_files/audio", + DocumentVideoDirectory: "./_files/video", + DocumentPhotoDirectory: "./_files/photo", + DocumentFileDirectory: "./_files/file", + DocumentCacheDirectory: "./_files/cache", + LogDirectory: "./_files/logs", + ConnInfo: conInfo, + SeedHostPorts: "river.ronaksoftware.com", + }) + _River = r + + repo.MustInit(fmt.Sprintf("%s/%s.db", "./_data", "test"), false) } type ConnInfoDelegates struct{} func (c *ConnInfoDelegates) Load(connInfo *RiverConnection) { - b, _ := ioutil.ReadFile("./_connection/connInfo") - _ = json.Unmarshal(b, connInfo) + b, _ := ioutil.ReadFile("./_connection/connInfo") + _ = json.Unmarshal(b, connInfo) } func (c *ConnInfoDelegates) SaveConnInfo(connInfo []byte) { - _ = os.MkdirAll("./_connection", os.ModePerm) - err := ioutil.WriteFile("./_connection/connInfo", connInfo, 0666) - if err != nil { - fmt.Println(err) - } + _ = os.MkdirAll("./_connection", os.ModePerm) + err := ioutil.WriteFile("./_connection/connInfo", connInfo, 0666) + if err != nil { + fmt.Println(err) + } } func (c *ConnInfoDelegates) Get(key string) string { return "" } @@ -88,27 +89,27 @@ func (d *MainDelegateDummy) OnUpdates(constructor int64, b []byte) {} func (d *MainDelegateDummy) OnDeferredRequests(requestID int64, b []byte) {} func (d *MainDelegateDummy) OnNetworkStatusChanged(quality int) { - state := domain.NetworkStatus(quality) - testenv.Log().Info("Network status changed", zap.String("Status", state.ToString())) + state := domain.NetworkStatus(quality) + testenv.Log().Info("Network status changed", zap.String("Status", state.ToString())) } func (d *MainDelegateDummy) OnSyncStatusChanged(newStatus int) { - state := domain.SyncStatus(newStatus) - testenv.Log().Info("Sync status changed", zap.String("Status", state.ToString())) + state := domain.SyncStatus(newStatus) + testenv.Log().Info("Sync status changed", zap.String("Status", state.ToString())) } func (d *MainDelegateDummy) OnAuthKeyCreated(authID int64) { - testenv.Log().Info("Auth Key Created", zap.Int64("AuthID", authID)) + testenv.Log().Info("Auth Key Created", zap.Int64("AuthID", authID)) } func (d *MainDelegateDummy) OnGeneralError(b []byte) { - e := new(rony.Error) - e.Unmarshal(b) - testenv.Log().Error("Received general error", zap.String("Code", e.Code), zap.String("Items", e.Items)) + e := new(rony.Error) + e.Unmarshal(b) + testenv.Log().Error("Received general error", zap.String("Code", e.Code), zap.String("Items", e.Items)) } func (d *MainDelegateDummy) OnSessionClosed(res int) { - testenv.Log().Info("Session Closed", zap.Int("Res", res)) + testenv.Log().Info("Session Closed", zap.Int("Res", res)) } func (d *MainDelegateDummy) ShowLoggerAlert() {} @@ -123,31 +124,31 @@ func (d *MainDelegateDummy) DataSynced(dialogs, contacts, gifs bool) { type RequestDelegateDummy struct{} func (RequestDelegateDummy) OnComplete(b []byte) { - fmt.Println(b) + fmt.Println(b) } func (RequestDelegateDummy) OnTimeout(err error) { - fmt.Println(err) + fmt.Println(err) } type FileDelegateDummy struct{} func (d *FileDelegateDummy) OnProgressChanged(reqID string, clusterID int32, fileID, accessHash, percent int64, peerID int64) { - testenv.Log().Info("Download progress changed", - zap.Int64("Progress", percent), - zap.Int64("PeerID", peerID), - ) + testenv.Log().Info("Download progress changed", + zap.Int64("Progress", percent), + zap.Int64("PeerID", peerID), + ) } func (d *FileDelegateDummy) OnCompleted(reqID string, clusterID int32, fileID, accessHash int64, filePath string, peerID int64) { - testenv.Log().Info("Download completed", - zap.String("ReqID", reqID), - zap.String("FilePath", filePath), - zap.Int64("PeerID", peerID), - ) + testenv.Log().Info("Download completed", + zap.String("ReqID", reqID), + zap.String("FilePath", filePath), + zap.Int64("PeerID", peerID), + ) } func (d *FileDelegateDummy) OnCancel(reqID string, clusterID int32, fileID, accessHash int64, hasError bool, peerID int64) { - testenv.Log().Error("CancelCB") + testenv.Log().Error("CancelCB") } diff --git a/sdk/prime/statics.go b/sdk/prime/statics.go index bbe02366..8332c55d 100644 --- a/sdk/prime/statics.go +++ b/sdk/prime/statics.go @@ -1,14 +1,15 @@ package riversdk import ( - "git.ronaksoft.com/river/msg/go/msg" - "git.ronaksoft.com/river/sdk/internal/domain" - "github.com/dgraph-io/badger/v2" - "math/big" - "os" - "path/filepath" - "strings" - "time" + "math/big" + "os" + "path/filepath" + "strings" + "time" + + "github.com/dgraph-io/badger/v2" + "github.com/ronaksoft/river-msg/go/msg" + "github.com/ronaksoft/river-sdk/internal/domain" ) /* @@ -22,129 +23,129 @@ import ( // GenSrpHash generates a hash to be used in AuthCheckPassword and other related apis func GenSrpHash(password []byte, algorithm int64, algorithmData []byte) []byte { - switch algorithm { - case msg.C_PasswordAlgorithmVer6A: - algo := &msg.PasswordAlgorithmVer6A{} - err := algo.Unmarshal(algorithmData) - - if err != nil { - return nil - } - - p := big.NewInt(0).SetBytes(algo.P) - x := big.NewInt(0).SetBytes(domain.PH2(password, algo.Salt1, algo.Salt2)) - v := big.NewInt(0).Exp(big.NewInt(int64(algo.G)), x, p) - - return v.Bytes() - default: - return nil - } + switch algorithm { + case msg.C_PasswordAlgorithmVer6A: + algo := &msg.PasswordAlgorithmVer6A{} + err := algo.Unmarshal(algorithmData) + + if err != nil { + return nil + } + + p := big.NewInt(0).SetBytes(algo.P) + x := big.NewInt(0).SetBytes(domain.PH2(password, algo.Salt1, algo.Salt2)) + v := big.NewInt(0).Exp(big.NewInt(int64(algo.G)), x, p) + + return v.Bytes() + default: + return nil + } } // GenInputPassword accepts AccountPassword marshaled as argument and return InputPassword marshaled func GenInputPassword(password []byte, accountPasswordBytes []byte) []byte { - ap := &msg.AccountPassword{} - _ = ap.Unmarshal(accountPasswordBytes) - - algo := &msg.PasswordAlgorithmVer6A{} - err := algo.Unmarshal(ap.AlgorithmData) - if err != nil { - return nil - } - - p := big.NewInt(0).SetBytes(algo.P) - g := big.NewInt(0).SetInt64(int64(algo.G)) - k := big.NewInt(0).SetBytes(domain.K(p, g)) - - x := big.NewInt(0).SetBytes(domain.PH2(password, algo.Salt1, algo.Salt2)) - v := big.NewInt(0).Exp(g, x, p) - a := big.NewInt(0).SetBytes(ap.RandomData) - ga := big.NewInt(0).Exp(g, a, p) - gb := big.NewInt(0).SetBytes(ap.SrpB) - u := big.NewInt(0).SetBytes(domain.U(ga, gb)) - kv := big.NewInt(0).Mod(big.NewInt(0).Mul(k, v), p) - t := big.NewInt(0).Mod(big.NewInt(0).Sub(gb, kv), p) - if t.Sign() < 0 { - t.Add(t, p) - } - sa := big.NewInt(0).Exp(t, big.NewInt(0).Add(a, big.NewInt(0).Mul(u, x)), p) - m1 := domain.MM(p, g, algo.Salt1, algo.Salt2, ga, gb, sa) - - inputPassword := &msg.InputPassword{ - SrpID: ap.SrpID, - A: domain.Pad(ga), - M1: m1, - } - res, _ := inputPassword.Marshal() - return res + ap := &msg.AccountPassword{} + _ = ap.Unmarshal(accountPasswordBytes) + + algo := &msg.PasswordAlgorithmVer6A{} + err := algo.Unmarshal(ap.AlgorithmData) + if err != nil { + return nil + } + + p := big.NewInt(0).SetBytes(algo.P) + g := big.NewInt(0).SetInt64(int64(algo.G)) + k := big.NewInt(0).SetBytes(domain.K(p, g)) + + x := big.NewInt(0).SetBytes(domain.PH2(password, algo.Salt1, algo.Salt2)) + v := big.NewInt(0).Exp(g, x, p) + a := big.NewInt(0).SetBytes(ap.RandomData) + ga := big.NewInt(0).Exp(g, a, p) + gb := big.NewInt(0).SetBytes(ap.SrpB) + u := big.NewInt(0).SetBytes(domain.U(ga, gb)) + kv := big.NewInt(0).Mod(big.NewInt(0).Mul(k, v), p) + t := big.NewInt(0).Mod(big.NewInt(0).Sub(gb, kv), p) + if t.Sign() < 0 { + t.Add(t, p) + } + sa := big.NewInt(0).Exp(t, big.NewInt(0).Add(a, big.NewInt(0).Mul(u, x)), p) + m1 := domain.MM(p, g, algo.Salt1, algo.Salt2, ga, gb, sa) + + inputPassword := &msg.InputPassword{ + SrpID: ap.SrpID, + A: domain.Pad(ga), + M1: m1, + } + res, _ := inputPassword.Marshal() + return res } func SanitizeQuestionAnswer(answer string) string { - return strings.ToLower(strings.TrimSpace(answer)) + return strings.ToLower(strings.TrimSpace(answer)) } func GetCountryCode(phone string) string { - return domain.GetCountryCode(phone) + return domain.GetCountryCode(phone) } // Version returns the version of the current SDK func Version() string { - return domain.SDKVersion + return domain.SDKVersion } // BadgerSupport identifies the version of the badger func BadgerSupport(dbDir string) bool { - dbDir = strings.TrimPrefix(dbDir, "file://") - f, err := os.Open(filepath.Join(dbDir, "MANIFEST")) - if err != nil { - return false - } - _, _, err = badger.ReplayManifestFile(f) - return err == nil + dbDir = strings.TrimPrefix(dbDir, "file://") + f, err := os.Open(filepath.Join(dbDir, "MANIFEST")) + if err != nil { + return false + } + _, _, err = badger.ReplayManifestFile(f) + return err == nil } func LastSeenEstimate(ts int64) int { - if ts == 0 { - return domain.LastSeenUnknown - } - - now := domain.Now() - seen := time.Unix(ts, 0) - - if now.Unix() < seen.Unix() { - return domain.LastSeenUnknown - } - - // We do Waterfall check - // 1. FewSeconds / Recently - if now.Sub(seen) < time.Minute { - return domain.LastSeenFewSeconds - } - if now.Sub(seen) < time.Hour { - return domain.LastSeenFewMinutes - } - - ny, nw := now.ISOWeek() - sy, sw := seen.ISOWeek() - // 2. Same Week/Year - if ny == sy && nw == sw { - if now.YearDay() == seen.YearDay() { - return domain.LastSeenToday - } else if now.YearDay() == seen.YearDay()+1 { - return domain.LastSeenYesterday - } - return domain.LastSeenThisWeek - } - - // 3. Same Year - if ny == sy { - if nw == sw+1 { - return domain.LastSeenLastWeek - } - if now.Month() == seen.Month() { - return domain.LastSeenThisMonth - } - } - - return domain.LastSeenLongTimeAgo + if ts == 0 { + return domain.LastSeenUnknown + } + + now := domain.Now() + seen := time.Unix(ts, 0) + + if now.Unix() < seen.Unix() { + return domain.LastSeenUnknown + } + + // We do Waterfall check + // 1. FewSeconds / Recently + if now.Sub(seen) < time.Minute { + return domain.LastSeenFewSeconds + } + if now.Sub(seen) < time.Hour { + return domain.LastSeenFewMinutes + } + + ny, nw := now.ISOWeek() + sy, sw := seen.ISOWeek() + // 2. Same Week/Year + if ny == sy && nw == sw { + if now.YearDay() == seen.YearDay() { + return domain.LastSeenToday + } else if now.YearDay() == seen.YearDay()+1 { + return domain.LastSeenYesterday + } + return domain.LastSeenThisWeek + } + + // 3. Same Year + if ny == sy { + if nw == sw+1 { + return domain.LastSeenLastWeek + } + if now.Month() == seen.Month() { + return domain.LastSeenThisMonth + } + } + + return domain.LastSeenLongTimeAgo } diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/accounts.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/accounts.pb.go deleted file mode 100644 index bca95270..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/accounts.pb.go +++ /dev/null @@ -1,3032 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: accounts.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// AccountSetNotifySettings -// @Function -// @Return: Bool -type AccountSetNotifySettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - Settings *PeerNotifySettings `protobuf:"bytes,2,opt,name=Settings,proto3" json:"Settings,omitempty"` -} - -func (x *AccountSetNotifySettings) Reset() { - *x = AccountSetNotifySettings{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountSetNotifySettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountSetNotifySettings) ProtoMessage() {} - -func (x *AccountSetNotifySettings) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountSetNotifySettings.ProtoReflect.Descriptor instead. -func (*AccountSetNotifySettings) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{0} -} - -func (x *AccountSetNotifySettings) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *AccountSetNotifySettings) GetSettings() *PeerNotifySettings { - if x != nil { - return x.Settings - } - return nil -} - -// AccountGetNotifySettings -// @Function -// @Return: NotifySettings -type AccountGetNotifySettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *AccountGetNotifySettings) Reset() { - *x = AccountGetNotifySettings{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountGetNotifySettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountGetNotifySettings) ProtoMessage() {} - -func (x *AccountGetNotifySettings) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountGetNotifySettings.ProtoReflect.Descriptor instead. -func (*AccountGetNotifySettings) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{1} -} - -func (x *AccountGetNotifySettings) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// AccountRegisterDevice -// @Function -// @Return: Bool -type AccountRegisterDevice struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` - DeviceModel string `protobuf:"bytes,3,opt,name=DeviceModel,proto3" json:"DeviceModel,omitempty"` - SystemVersion string `protobuf:"bytes,4,opt,name=SystemVersion,proto3" json:"SystemVersion,omitempty"` - AppVersion string `protobuf:"bytes,5,opt,name=AppVersion,proto3" json:"AppVersion,omitempty"` - LangCode string `protobuf:"bytes,6,opt,name=LangCode,proto3" json:"LangCode,omitempty"` - TokenType PushTokenProvider `protobuf:"varint,7,opt,name=TokenType,proto3,enum=msg.PushTokenProvider" json:"TokenType,omitempty"` - ClientID string `protobuf:"bytes,8,opt,name=ClientID,proto3" json:"ClientID,omitempty"` -} - -func (x *AccountRegisterDevice) Reset() { - *x = AccountRegisterDevice{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountRegisterDevice) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountRegisterDevice) ProtoMessage() {} - -func (x *AccountRegisterDevice) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountRegisterDevice.ProtoReflect.Descriptor instead. -func (*AccountRegisterDevice) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{2} -} - -func (x *AccountRegisterDevice) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -func (x *AccountRegisterDevice) GetDeviceModel() string { - if x != nil { - return x.DeviceModel - } - return "" -} - -func (x *AccountRegisterDevice) GetSystemVersion() string { - if x != nil { - return x.SystemVersion - } - return "" -} - -func (x *AccountRegisterDevice) GetAppVersion() string { - if x != nil { - return x.AppVersion - } - return "" -} - -func (x *AccountRegisterDevice) GetLangCode() string { - if x != nil { - return x.LangCode - } - return "" -} - -func (x *AccountRegisterDevice) GetTokenType() PushTokenProvider { - if x != nil { - return x.TokenType - } - return PushTokenProvider_PushTokenFirebase -} - -func (x *AccountRegisterDevice) GetClientID() string { - if x != nil { - return x.ClientID - } - return "" -} - -// AccountUnregisterDevice -// @Function -// @Return: Bool -type AccountUnregisterDevice struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TokenType int32 `protobuf:"varint,1,opt,name=TokenType,proto3" json:"TokenType,omitempty"` - Token string `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` -} - -func (x *AccountUnregisterDevice) Reset() { - *x = AccountUnregisterDevice{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountUnregisterDevice) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountUnregisterDevice) ProtoMessage() {} - -func (x *AccountUnregisterDevice) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountUnregisterDevice.ProtoReflect.Descriptor instead. -func (*AccountUnregisterDevice) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{3} -} - -func (x *AccountUnregisterDevice) GetTokenType() int32 { - if x != nil { - return x.TokenType - } - return 0 -} - -func (x *AccountUnregisterDevice) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -// AccountUpdateProfile -// @Function -// @Return: UserFull -type AccountUpdateProfile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FirstName string `protobuf:"bytes,1,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,2,opt,name=LastName,proto3" json:"LastName,omitempty"` - Bio string `protobuf:"bytes,3,opt,name=Bio,proto3" json:"Bio,omitempty"` -} - -func (x *AccountUpdateProfile) Reset() { - *x = AccountUpdateProfile{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountUpdateProfile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountUpdateProfile) ProtoMessage() {} - -func (x *AccountUpdateProfile) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountUpdateProfile.ProtoReflect.Descriptor instead. -func (*AccountUpdateProfile) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{4} -} - -func (x *AccountUpdateProfile) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *AccountUpdateProfile) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *AccountUpdateProfile) GetBio() string { - if x != nil { - return x.Bio - } - return "" -} - -// AccountCheckUsername -// @Function -// @Return: Bool -type AccountCheckUsername struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Username string `protobuf:"bytes,1,opt,name=Username,proto3" json:"Username,omitempty"` -} - -func (x *AccountCheckUsername) Reset() { - *x = AccountCheckUsername{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountCheckUsername) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountCheckUsername) ProtoMessage() {} - -func (x *AccountCheckUsername) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountCheckUsername.ProtoReflect.Descriptor instead. -func (*AccountCheckUsername) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{5} -} - -func (x *AccountCheckUsername) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -// AccountUpdateUsername -// @Function -// @Return: UserFull -type AccountUpdateUsername struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Username string `protobuf:"bytes,1,opt,name=Username,proto3" json:"Username,omitempty"` -} - -func (x *AccountUpdateUsername) Reset() { - *x = AccountUpdateUsername{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountUpdateUsername) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountUpdateUsername) ProtoMessage() {} - -func (x *AccountUpdateUsername) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountUpdateUsername.ProtoReflect.Descriptor instead. -func (*AccountUpdateUsername) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{6} -} - -func (x *AccountUpdateUsername) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -// AccountUploadPhoto -// @Function -// @Return: Bool / UserPhoto -type AccountUploadPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - File *InputFile `protobuf:"bytes,1,opt,name=File,proto3" json:"File,omitempty"` - ReturnObject bool `protobuf:"varint,2,opt,name=ReturnObject,proto3" json:"ReturnObject,omitempty"` -} - -func (x *AccountUploadPhoto) Reset() { - *x = AccountUploadPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountUploadPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountUploadPhoto) ProtoMessage() {} - -func (x *AccountUploadPhoto) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountUploadPhoto.ProtoReflect.Descriptor instead. -func (*AccountUploadPhoto) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{7} -} - -func (x *AccountUploadPhoto) GetFile() *InputFile { - if x != nil { - return x.File - } - return nil -} - -func (x *AccountUploadPhoto) GetReturnObject() bool { - if x != nil { - return x.ReturnObject - } - return false -} - -// AccountUpdatePhoto -// @Function -// @Return: Bool -type AccountUpdatePhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PhotoID int64 `protobuf:"varint,1,opt,name=PhotoID,proto3" json:"PhotoID,omitempty"` -} - -func (x *AccountUpdatePhoto) Reset() { - *x = AccountUpdatePhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountUpdatePhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountUpdatePhoto) ProtoMessage() {} - -func (x *AccountUpdatePhoto) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountUpdatePhoto.ProtoReflect.Descriptor instead. -func (*AccountUpdatePhoto) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{8} -} - -func (x *AccountUpdatePhoto) GetPhotoID() int64 { - if x != nil { - return x.PhotoID - } - return 0 -} - -// AccountSetWebPhoto -// @Function -// @Return: UserPhoto -type AccountSetWebPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - BigPhoto *InputWebLocation `protobuf:"bytes,1,opt,name=BigPhoto,proto3" json:"BigPhoto,omitempty"` - SmallPhoto *InputWebLocation `protobuf:"bytes,2,opt,name=SmallPhoto,proto3" json:"SmallPhoto,omitempty"` -} - -func (x *AccountSetWebPhoto) Reset() { - *x = AccountSetWebPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountSetWebPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountSetWebPhoto) ProtoMessage() {} - -func (x *AccountSetWebPhoto) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountSetWebPhoto.ProtoReflect.Descriptor instead. -func (*AccountSetWebPhoto) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{9} -} - -func (x *AccountSetWebPhoto) GetBigPhoto() *InputWebLocation { - if x != nil { - return x.BigPhoto - } - return nil -} - -func (x *AccountSetWebPhoto) GetSmallPhoto() *InputWebLocation { - if x != nil { - return x.SmallPhoto - } - return nil -} - -// AccountRemotePhoto -// @Function -// @Return: Bool -type AccountRemovePhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PhotoID int64 `protobuf:"varint,1,opt,name=PhotoID,proto3" json:"PhotoID,omitempty"` -} - -func (x *AccountRemovePhoto) Reset() { - *x = AccountRemovePhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountRemovePhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountRemovePhoto) ProtoMessage() {} - -func (x *AccountRemovePhoto) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountRemovePhoto.ProtoReflect.Descriptor instead. -func (*AccountRemovePhoto) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{10} -} - -func (x *AccountRemovePhoto) GetPhotoID() int64 { - if x != nil { - return x.PhotoID - } - return 0 -} - -// AccountSendChangePhoneCode -// @Function -// @Return: AuthSentCode -// @Deprecated -type AccountSendChangePhoneCode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - AppHash string `protobuf:"bytes,2,opt,name=AppHash,proto3" json:"AppHash,omitempty"` -} - -func (x *AccountSendChangePhoneCode) Reset() { - *x = AccountSendChangePhoneCode{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountSendChangePhoneCode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountSendChangePhoneCode) ProtoMessage() {} - -func (x *AccountSendChangePhoneCode) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountSendChangePhoneCode.ProtoReflect.Descriptor instead. -func (*AccountSendChangePhoneCode) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{11} -} - -func (x *AccountSendChangePhoneCode) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AccountSendChangePhoneCode) GetAppHash() string { - if x != nil { - return x.AppHash - } - return "" -} - -// AccountSendChangePhoneCode -// @Function -// @Return: AuthSentCode -type AccountSendVerifyPhoneCode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - AppHash string `protobuf:"bytes,2,opt,name=AppHash,proto3" json:"AppHash,omitempty"` -} - -func (x *AccountSendVerifyPhoneCode) Reset() { - *x = AccountSendVerifyPhoneCode{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountSendVerifyPhoneCode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountSendVerifyPhoneCode) ProtoMessage() {} - -func (x *AccountSendVerifyPhoneCode) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountSendVerifyPhoneCode.ProtoReflect.Descriptor instead. -func (*AccountSendVerifyPhoneCode) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{12} -} - -func (x *AccountSendVerifyPhoneCode) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AccountSendVerifyPhoneCode) GetAppHash() string { - if x != nil { - return x.AppHash - } - return "" -} - -// AccountResendVerifyPhoneCode -// @Function -// @Return: Bool -type AccountResendVerifyPhoneCode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - PhoneCodeHash string `protobuf:"bytes,2,opt,name=PhoneCodeHash,proto3" json:"PhoneCodeHash,omitempty"` - AppHash string `protobuf:"bytes,3,opt,name=AppHash,proto3" json:"AppHash,omitempty"` -} - -func (x *AccountResendVerifyPhoneCode) Reset() { - *x = AccountResendVerifyPhoneCode{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountResendVerifyPhoneCode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountResendVerifyPhoneCode) ProtoMessage() {} - -func (x *AccountResendVerifyPhoneCode) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountResendVerifyPhoneCode.ProtoReflect.Descriptor instead. -func (*AccountResendVerifyPhoneCode) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{13} -} - -func (x *AccountResendVerifyPhoneCode) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AccountResendVerifyPhoneCode) GetPhoneCodeHash() string { - if x != nil { - return x.PhoneCodeHash - } - return "" -} - -func (x *AccountResendVerifyPhoneCode) GetAppHash() string { - if x != nil { - return x.AppHash - } - return "" -} - -// AccountChangePhone -// @Function -// @Return: User -type AccountChangePhone struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - PhoneCodeHash string `protobuf:"bytes,2,opt,name=PhoneCodeHash,proto3" json:"PhoneCodeHash,omitempty"` - PhoneCode string `protobuf:"bytes,3,opt,name=PhoneCode,proto3" json:"PhoneCode,omitempty"` - Password *InputPassword `protobuf:"bytes,4,opt,name=Password,proto3" json:"Password,omitempty"` -} - -func (x *AccountChangePhone) Reset() { - *x = AccountChangePhone{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountChangePhone) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountChangePhone) ProtoMessage() {} - -func (x *AccountChangePhone) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountChangePhone.ProtoReflect.Descriptor instead. -func (*AccountChangePhone) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{14} -} - -func (x *AccountChangePhone) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AccountChangePhone) GetPhoneCodeHash() string { - if x != nil { - return x.PhoneCodeHash - } - return "" -} - -func (x *AccountChangePhone) GetPhoneCode() string { - if x != nil { - return x.PhoneCode - } - return "" -} - -func (x *AccountChangePhone) GetPassword() *InputPassword { - if x != nil { - return x.Password - } - return nil -} - -// AccountDelete -// @Function -// @Return: Bool -type AccountDelete struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - PhoneCodeHash string `protobuf:"bytes,2,opt,name=PhoneCodeHash,proto3" json:"PhoneCodeHash,omitempty"` - PhoneCode string `protobuf:"bytes,3,opt,name=PhoneCode,proto3" json:"PhoneCode,omitempty"` - Password *InputPassword `protobuf:"bytes,4,opt,name=Password,proto3" json:"Password,omitempty"` - Reason string `protobuf:"bytes,5,opt,name=Reason,proto3" json:"Reason,omitempty"` -} - -func (x *AccountDelete) Reset() { - *x = AccountDelete{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountDelete) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountDelete) ProtoMessage() {} - -func (x *AccountDelete) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountDelete.ProtoReflect.Descriptor instead. -func (*AccountDelete) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{15} -} - -func (x *AccountDelete) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AccountDelete) GetPhoneCodeHash() string { - if x != nil { - return x.PhoneCodeHash - } - return "" -} - -func (x *AccountDelete) GetPhoneCode() string { - if x != nil { - return x.PhoneCode - } - return "" -} - -func (x *AccountDelete) GetPassword() *InputPassword { - if x != nil { - return x.Password - } - return nil -} - -func (x *AccountDelete) GetReason() string { - if x != nil { - return x.Reason - } - return "" -} - -// AccountSetPrivacy -// @Function -// @Return: AccountPrivacyRules -type AccountSetPrivacy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ChatInvite []*PrivacyRule `protobuf:"bytes,1,rep,name=ChatInvite,proto3" json:"ChatInvite,omitempty"` - LastSeen []*PrivacyRule `protobuf:"bytes,2,rep,name=LastSeen,proto3" json:"LastSeen,omitempty"` - PhoneNumber []*PrivacyRule `protobuf:"bytes,3,rep,name=PhoneNumber,proto3" json:"PhoneNumber,omitempty"` - ProfilePhoto []*PrivacyRule `protobuf:"bytes,4,rep,name=ProfilePhoto,proto3" json:"ProfilePhoto,omitempty"` - ForwardedMessage []*PrivacyRule `protobuf:"bytes,5,rep,name=ForwardedMessage,proto3" json:"ForwardedMessage,omitempty"` - Call []*PrivacyRule `protobuf:"bytes,6,rep,name=Call,proto3" json:"Call,omitempty"` -} - -func (x *AccountSetPrivacy) Reset() { - *x = AccountSetPrivacy{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountSetPrivacy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountSetPrivacy) ProtoMessage() {} - -func (x *AccountSetPrivacy) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountSetPrivacy.ProtoReflect.Descriptor instead. -func (*AccountSetPrivacy) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{16} -} - -func (x *AccountSetPrivacy) GetChatInvite() []*PrivacyRule { - if x != nil { - return x.ChatInvite - } - return nil -} - -func (x *AccountSetPrivacy) GetLastSeen() []*PrivacyRule { - if x != nil { - return x.LastSeen - } - return nil -} - -func (x *AccountSetPrivacy) GetPhoneNumber() []*PrivacyRule { - if x != nil { - return x.PhoneNumber - } - return nil -} - -func (x *AccountSetPrivacy) GetProfilePhoto() []*PrivacyRule { - if x != nil { - return x.ProfilePhoto - } - return nil -} - -func (x *AccountSetPrivacy) GetForwardedMessage() []*PrivacyRule { - if x != nil { - return x.ForwardedMessage - } - return nil -} - -func (x *AccountSetPrivacy) GetCall() []*PrivacyRule { - if x != nil { - return x.Call - } - return nil -} - -// AccountGetPrivacy -// @Function -// @Return: AccountPrivacyRules -type AccountGetPrivacy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key PrivacyKey `protobuf:"varint,1,opt,name=Key,proto3,enum=msg.PrivacyKey" json:"Key,omitempty"` -} - -func (x *AccountGetPrivacy) Reset() { - *x = AccountGetPrivacy{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountGetPrivacy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountGetPrivacy) ProtoMessage() {} - -func (x *AccountGetPrivacy) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountGetPrivacy.ProtoReflect.Descriptor instead. -func (*AccountGetPrivacy) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{17} -} - -func (x *AccountGetPrivacy) GetKey() PrivacyKey { - if x != nil { - return x.Key - } - return PrivacyKey_PrivacyKeyNone -} - -// AccountGetAuthorizations -// @Function -// @Returns: Authorizations -type AccountGetAuthorizations struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AccountGetAuthorizations) Reset() { - *x = AccountGetAuthorizations{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountGetAuthorizations) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountGetAuthorizations) ProtoMessage() {} - -func (x *AccountGetAuthorizations) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountGetAuthorizations.ProtoReflect.Descriptor instead. -func (*AccountGetAuthorizations) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{18} -} - -// AccountResetAuthorization -// @Function -// @Returns: Bool -type AccountResetAuthorization struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthID int64 `protobuf:"varint,1,opt,name=AuthID,proto3" json:"AuthID,omitempty"` -} - -func (x *AccountResetAuthorization) Reset() { - *x = AccountResetAuthorization{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountResetAuthorization) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountResetAuthorization) ProtoMessage() {} - -func (x *AccountResetAuthorization) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountResetAuthorization.ProtoReflect.Descriptor instead. -func (*AccountResetAuthorization) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{19} -} - -func (x *AccountResetAuthorization) GetAuthID() int64 { - if x != nil { - return x.AuthID - } - return 0 -} - -// AccountUpdateStatus -// @Function -// @Returns: Bool -type AccountUpdateStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Online bool `protobuf:"varint,1,opt,name=Online,proto3" json:"Online,omitempty"` -} - -func (x *AccountUpdateStatus) Reset() { - *x = AccountUpdateStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountUpdateStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountUpdateStatus) ProtoMessage() {} - -func (x *AccountUpdateStatus) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountUpdateStatus.ProtoReflect.Descriptor instead. -func (*AccountUpdateStatus) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{20} -} - -func (x *AccountUpdateStatus) GetOnline() bool { - if x != nil { - return x.Online - } - return false -} - -// AccountSetLang -// @Function -// @Returns: Bool -type AccountSetLang struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LangCode string `protobuf:"bytes,1,opt,name=LangCode,proto3" json:"LangCode,omitempty"` -} - -func (x *AccountSetLang) Reset() { - *x = AccountSetLang{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountSetLang) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountSetLang) ProtoMessage() {} - -func (x *AccountSetLang) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountSetLang.ProtoReflect.Descriptor instead. -func (*AccountSetLang) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{21} -} - -func (x *AccountSetLang) GetLangCode() string { - if x != nil { - return x.LangCode - } - return "" -} - -// AccountGetPassword -// @Function -// @Returns: AccountPassword -// Obtain configuration for two-factor authorization with password -type AccountGetPassword struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AccountGetPassword) Reset() { - *x = AccountGetPassword{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountGetPassword) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountGetPassword) ProtoMessage() {} - -func (x *AccountGetPassword) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountGetPassword.ProtoReflect.Descriptor instead. -func (*AccountGetPassword) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{22} -} - -// AccountGetPasswordSettings -// @Function -// @Returns: AccountPasswordSettings -// Get private info associated to the password info (recovery email & so on) -type AccountGetPasswordSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Password *InputPassword `protobuf:"bytes,1,opt,name=Password,proto3" json:"Password,omitempty"` -} - -func (x *AccountGetPasswordSettings) Reset() { - *x = AccountGetPasswordSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountGetPasswordSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountGetPasswordSettings) ProtoMessage() {} - -func (x *AccountGetPasswordSettings) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountGetPasswordSettings.ProtoReflect.Descriptor instead. -func (*AccountGetPasswordSettings) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{23} -} - -func (x *AccountGetPasswordSettings) GetPassword() *InputPassword { - if x != nil { - return x.Password - } - return nil -} - -// AccountUpdatePassword -// @Function -// @Returns: Bool -type AccountUpdatePasswordSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Password *InputPassword `protobuf:"bytes,1,opt,name=Password,proto3" json:"Password,omitempty"` - PasswordHash []byte `protobuf:"bytes,2,opt,name=PasswordHash,proto3" json:"PasswordHash,omitempty"` - Algorithm int64 `protobuf:"varint,3,opt,name=Algorithm,proto3" json:"Algorithm,omitempty"` - AlgorithmData []byte `protobuf:"bytes,4,opt,name=AlgorithmData,proto3" json:"AlgorithmData,omitempty"` - Hint string `protobuf:"bytes,6,opt,name=Hint,proto3" json:"Hint,omitempty"` - Questions []*SecurityQuestion `protobuf:"bytes,7,rep,name=Questions,proto3" json:"Questions,omitempty"` -} - -func (x *AccountUpdatePasswordSettings) Reset() { - *x = AccountUpdatePasswordSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountUpdatePasswordSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountUpdatePasswordSettings) ProtoMessage() {} - -func (x *AccountUpdatePasswordSettings) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountUpdatePasswordSettings.ProtoReflect.Descriptor instead. -func (*AccountUpdatePasswordSettings) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{24} -} - -func (x *AccountUpdatePasswordSettings) GetPassword() *InputPassword { - if x != nil { - return x.Password - } - return nil -} - -func (x *AccountUpdatePasswordSettings) GetPasswordHash() []byte { - if x != nil { - return x.PasswordHash - } - return nil -} - -func (x *AccountUpdatePasswordSettings) GetAlgorithm() int64 { - if x != nil { - return x.Algorithm - } - return 0 -} - -func (x *AccountUpdatePasswordSettings) GetAlgorithmData() []byte { - if x != nil { - return x.AlgorithmData - } - return nil -} - -func (x *AccountUpdatePasswordSettings) GetHint() string { - if x != nil { - return x.Hint - } - return "" -} - -func (x *AccountUpdatePasswordSettings) GetQuestions() []*SecurityQuestion { - if x != nil { - return x.Questions - } - return nil -} - -// AccountRecoverPassword -// @Function -// @Returns: AccountPassword, AuthAuthorization -type AccountRecoverPassword struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Answers []*SecurityAnswer `protobuf:"bytes,1,rep,name=Answers,proto3" json:"Answers,omitempty"` - Algorithm int64 `protobuf:"varint,2,opt,name=Algorithm,proto3" json:"Algorithm,omitempty"` - AlgorithmData []byte `protobuf:"bytes,3,opt,name=AlgorithmData,proto3" json:"AlgorithmData,omitempty"` - SrpID int64 `protobuf:"varint,4,opt,name=SrpID,proto3" json:"SrpID,omitempty"` -} - -func (x *AccountRecoverPassword) Reset() { - *x = AccountRecoverPassword{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountRecoverPassword) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountRecoverPassword) ProtoMessage() {} - -func (x *AccountRecoverPassword) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountRecoverPassword.ProtoReflect.Descriptor instead. -func (*AccountRecoverPassword) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{25} -} - -func (x *AccountRecoverPassword) GetAnswers() []*SecurityAnswer { - if x != nil { - return x.Answers - } - return nil -} - -func (x *AccountRecoverPassword) GetAlgorithm() int64 { - if x != nil { - return x.Algorithm - } - return 0 -} - -func (x *AccountRecoverPassword) GetAlgorithmData() []byte { - if x != nil { - return x.AlgorithmData - } - return nil -} - -func (x *AccountRecoverPassword) GetSrpID() int64 { - if x != nil { - return x.SrpID - } - return 0 -} - -// AccountGetTeams -// @Function -// @Returns: TeamsMany -type AccountGetTeams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AccountGetTeams) Reset() { - *x = AccountGetTeams{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountGetTeams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountGetTeams) ProtoMessage() {} - -func (x *AccountGetTeams) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountGetTeams.ProtoReflect.Descriptor instead. -func (*AccountGetTeams) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{26} -} - -// AccountPasswordSettings -// Private info associated to the password info (recovery email and so on) -type AccountPasswordSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Hint string `protobuf:"bytes,2,opt,name=Hint,proto3" json:"Hint,omitempty"` - Questions []*RecoveryQuestion `protobuf:"bytes,3,rep,name=Questions,proto3" json:"Questions,omitempty"` -} - -func (x *AccountPasswordSettings) Reset() { - *x = AccountPasswordSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountPasswordSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountPasswordSettings) ProtoMessage() {} - -func (x *AccountPasswordSettings) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountPasswordSettings.ProtoReflect.Descriptor instead. -func (*AccountPasswordSettings) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{27} -} - -func (x *AccountPasswordSettings) GetHint() string { - if x != nil { - return x.Hint - } - return "" -} - -func (x *AccountPasswordSettings) GetQuestions() []*RecoveryQuestion { - if x != nil { - return x.Questions - } - return nil -} - -// SecurityQuestions -type SecurityQuestions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Questions []*SecurityQuestion `protobuf:"bytes,1,rep,name=Questions,proto3" json:"Questions,omitempty"` -} - -func (x *SecurityQuestions) Reset() { - *x = SecurityQuestions{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityQuestions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityQuestions) ProtoMessage() {} - -func (x *SecurityQuestions) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityQuestions.ProtoReflect.Descriptor instead. -func (*SecurityQuestions) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{28} -} - -func (x *SecurityQuestions) GetQuestions() []*SecurityQuestion { - if x != nil { - return x.Questions - } - return nil -} - -// RecoverQuestion -type RecoveryQuestion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int32 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Text string `protobuf:"bytes,2,opt,name=Text,proto3" json:"Text,omitempty"` -} - -func (x *RecoveryQuestion) Reset() { - *x = RecoveryQuestion{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RecoveryQuestion) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RecoveryQuestion) ProtoMessage() {} - -func (x *RecoveryQuestion) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RecoveryQuestion.ProtoReflect.Descriptor instead. -func (*RecoveryQuestion) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{29} -} - -func (x *RecoveryQuestion) GetID() int32 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *RecoveryQuestion) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -// SecurityQuestion -type SecurityQuestion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int32 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Text string `protobuf:"bytes,2,opt,name=Text,proto3" json:"Text,omitempty"` - Answer string `protobuf:"bytes,3,opt,name=Answer,proto3" json:"Answer,omitempty"` -} - -func (x *SecurityQuestion) Reset() { - *x = SecurityQuestion{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityQuestion) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityQuestion) ProtoMessage() {} - -func (x *SecurityQuestion) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityQuestion.ProtoReflect.Descriptor instead. -func (*SecurityQuestion) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{30} -} - -func (x *SecurityQuestion) GetID() int32 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *SecurityQuestion) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *SecurityQuestion) GetAnswer() string { - if x != nil { - return x.Answer - } - return "" -} - -// SecurityAnswer -type SecurityAnswer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - QuestionID int32 `protobuf:"varint,1,opt,name=QuestionID,proto3" json:"QuestionID,omitempty"` - Answer string `protobuf:"bytes,2,opt,name=Answer,proto3" json:"Answer,omitempty"` -} - -func (x *SecurityAnswer) Reset() { - *x = SecurityAnswer{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SecurityAnswer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SecurityAnswer) ProtoMessage() {} - -func (x *SecurityAnswer) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SecurityAnswer.ProtoReflect.Descriptor instead. -func (*SecurityAnswer) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{31} -} - -func (x *SecurityAnswer) GetQuestionID() int32 { - if x != nil { - return x.QuestionID - } - return 0 -} - -func (x *SecurityAnswer) GetAnswer() string { - if x != nil { - return x.Answer - } - return "" -} - -// AccountPassword -// Configuration for two-factor authorization -type AccountPassword struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - HasPassword bool `protobuf:"varint,1,opt,name=HasPassword,proto3" json:"HasPassword,omitempty"` - Hint string `protobuf:"bytes,2,opt,name=Hint,proto3" json:"Hint,omitempty"` - Algorithm int64 `protobuf:"varint,3,opt,name=Algorithm,proto3" json:"Algorithm,omitempty"` - AlgorithmData []byte `protobuf:"bytes,4,opt,name=AlgorithmData,proto3" json:"AlgorithmData,omitempty"` - SrpB []byte `protobuf:"bytes,5,opt,name=SrpB,proto3" json:"SrpB,omitempty"` - RandomData []byte `protobuf:"bytes,6,opt,name=RandomData,proto3" json:"RandomData,omitempty"` - SrpID int64 `protobuf:"varint,7,opt,name=SrpID,proto3" json:"SrpID,omitempty"` - Questions []*RecoveryQuestion `protobuf:"bytes,8,rep,name=Questions,proto3" json:"Questions,omitempty"` -} - -func (x *AccountPassword) Reset() { - *x = AccountPassword{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountPassword) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountPassword) ProtoMessage() {} - -func (x *AccountPassword) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountPassword.ProtoReflect.Descriptor instead. -func (*AccountPassword) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{32} -} - -func (x *AccountPassword) GetHasPassword() bool { - if x != nil { - return x.HasPassword - } - return false -} - -func (x *AccountPassword) GetHint() string { - if x != nil { - return x.Hint - } - return "" -} - -func (x *AccountPassword) GetAlgorithm() int64 { - if x != nil { - return x.Algorithm - } - return 0 -} - -func (x *AccountPassword) GetAlgorithmData() []byte { - if x != nil { - return x.AlgorithmData - } - return nil -} - -func (x *AccountPassword) GetSrpB() []byte { - if x != nil { - return x.SrpB - } - return nil -} - -func (x *AccountPassword) GetRandomData() []byte { - if x != nil { - return x.RandomData - } - return nil -} - -func (x *AccountPassword) GetSrpID() int64 { - if x != nil { - return x.SrpID - } - return 0 -} - -func (x *AccountPassword) GetQuestions() []*RecoveryQuestion { - if x != nil { - return x.Questions - } - return nil -} - -// AccountAuthorizations -type AccountAuthorizations struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Authorizations []*AccountAuthorization `protobuf:"bytes,1,rep,name=Authorizations,proto3" json:"Authorizations,omitempty"` -} - -func (x *AccountAuthorizations) Reset() { - *x = AccountAuthorizations{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountAuthorizations) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountAuthorizations) ProtoMessage() {} - -func (x *AccountAuthorizations) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountAuthorizations.ProtoReflect.Descriptor instead. -func (*AccountAuthorizations) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{33} -} - -func (x *AccountAuthorizations) GetAuthorizations() []*AccountAuthorization { - if x != nil { - return x.Authorizations - } - return nil -} - -// AccountAuthorization -type AccountAuthorization struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthID int64 `protobuf:"varint,100,opt,name=AuthID,proto3" json:"AuthID,omitempty"` - Model string `protobuf:"bytes,1,opt,name=Model,proto3" json:"Model,omitempty"` - AppVersion string `protobuf:"bytes,2,opt,name=AppVersion,proto3" json:"AppVersion,omitempty"` - SystemVersion string `protobuf:"bytes,3,opt,name=SystemVersion,proto3" json:"SystemVersion,omitempty"` - LangCode string `protobuf:"bytes,4,opt,name=LangCode,proto3" json:"LangCode,omitempty"` - CreatedAt int64 `protobuf:"varint,5,opt,name=CreatedAt,proto3" json:"CreatedAt,omitempty"` - ActiveAt int64 `protobuf:"varint,6,opt,name=ActiveAt,proto3" json:"ActiveAt,omitempty"` // @Deprecated - ClientIP string `protobuf:"bytes,7,opt,name=ClientIP,proto3" json:"ClientIP,omitempty"` - LastAccess int64 `protobuf:"varint,8,opt,name=LastAccess,proto3" json:"LastAccess,omitempty"` -} - -func (x *AccountAuthorization) Reset() { - *x = AccountAuthorization{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountAuthorization) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountAuthorization) ProtoMessage() {} - -func (x *AccountAuthorization) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountAuthorization.ProtoReflect.Descriptor instead. -func (*AccountAuthorization) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{34} -} - -func (x *AccountAuthorization) GetAuthID() int64 { - if x != nil { - return x.AuthID - } - return 0 -} - -func (x *AccountAuthorization) GetModel() string { - if x != nil { - return x.Model - } - return "" -} - -func (x *AccountAuthorization) GetAppVersion() string { - if x != nil { - return x.AppVersion - } - return "" -} - -func (x *AccountAuthorization) GetSystemVersion() string { - if x != nil { - return x.SystemVersion - } - return "" -} - -func (x *AccountAuthorization) GetLangCode() string { - if x != nil { - return x.LangCode - } - return "" -} - -func (x *AccountAuthorization) GetCreatedAt() int64 { - if x != nil { - return x.CreatedAt - } - return 0 -} - -func (x *AccountAuthorization) GetActiveAt() int64 { - if x != nil { - return x.ActiveAt - } - return 0 -} - -func (x *AccountAuthorization) GetClientIP() string { - if x != nil { - return x.ClientIP - } - return "" -} - -func (x *AccountAuthorization) GetLastAccess() int64 { - if x != nil { - return x.LastAccess - } - return 0 -} - -// AccountPrivacyRules -type AccountPrivacyRules struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Rules []*PrivacyRule `protobuf:"bytes,1,rep,name=Rules,proto3" json:"Rules,omitempty"` -} - -func (x *AccountPrivacyRules) Reset() { - *x = AccountPrivacyRules{} - if protoimpl.UnsafeEnabled { - mi := &file_accounts_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AccountPrivacyRules) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AccountPrivacyRules) ProtoMessage() {} - -func (x *AccountPrivacyRules) ProtoReflect() protoreflect.Message { - mi := &file_accounts_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AccountPrivacyRules.ProtoReflect.Descriptor instead. -func (*AccountPrivacyRules) Descriptor() ([]byte, []int) { - return file_accounts_proto_rawDescGZIP(), []int{35} -} - -func (x *AccountPrivacyRules) GetRules() []*PrivacyRule { - if x != nil { - return x.Rules - } - return nil -} - -var File_accounts_proto protoreflect.FileDescriptor - -var file_accounts_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x73, 0x0a, 0x18, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, - 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, - 0x6e, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x50, 0x65, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x52, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x3e, 0x0a, 0x18, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x22, 0x83, 0x02, 0x0a, - 0x15, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x24, - 0x0a, 0x0d, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x6e, 0x67, 0x43, 0x6f, 0x64, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x61, 0x6e, 0x67, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x34, 0x0a, 0x09, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, 0x09, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x49, 0x44, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x49, 0x44, 0x22, 0x4d, 0x0a, 0x17, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x6e, 0x72, - 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a, - 0x09, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x09, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x22, 0x62, 0x0a, 0x14, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x46, 0x69, 0x72, - 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x46, 0x69, - 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x42, 0x69, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x42, 0x69, 0x6f, 0x22, 0x32, 0x0a, 0x14, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x33, 0x0a, 0x15, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x5c, - 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, - 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x22, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, - 0x6c, 0x65, 0x52, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x74, 0x75, - 0x72, 0x6e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, - 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x32, 0x0a, 0x12, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x68, 0x6f, - 0x74, 0x6f, 0x12, 0x1c, 0x0a, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, - 0x22, 0x7e, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x65, 0x74, 0x57, 0x65, - 0x62, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x31, 0x0a, 0x08, 0x42, 0x69, 0x67, 0x50, 0x68, 0x6f, - 0x74, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x57, 0x65, 0x62, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x08, 0x42, 0x69, 0x67, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x35, 0x0a, 0x0a, 0x53, 0x6d, 0x61, - 0x6c, 0x6c, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x57, 0x65, 0x62, 0x4c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x50, 0x68, 0x6f, 0x74, 0x6f, - 0x22, 0x32, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x0a, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x50, 0x68, 0x6f, - 0x74, 0x6f, 0x49, 0x44, 0x22, 0x4c, 0x0a, 0x1a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, - 0x65, 0x6e, 0x64, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, - 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x70, 0x70, 0x48, - 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x41, 0x70, 0x70, 0x48, 0x61, - 0x73, 0x68, 0x22, 0x4c, 0x0a, 0x1a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x65, 0x6e, - 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x70, 0x70, 0x48, 0x61, 0x73, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x41, 0x70, 0x70, 0x48, 0x61, 0x73, 0x68, - 0x22, 0x74, 0x0a, 0x1c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x65, 0x6e, - 0x64, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, - 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, - 0x41, 0x70, 0x70, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x41, - 0x70, 0x70, 0x48, 0x61, 0x73, 0x68, 0x22, 0x9e, 0x01, 0x0a, 0x12, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x14, 0x0a, - 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, - 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, - 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x08, 0x50, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0xb1, 0x01, 0x0a, 0x0d, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, - 0x24, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, - 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, - 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, - 0x6f, 0x64, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, - 0x6f, 0x72, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0xc1, 0x02, 0x0a, 0x11, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x65, 0x74, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, - 0x79, 0x12, 0x30, 0x0a, 0x0a, 0x43, 0x68, 0x61, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, - 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0a, 0x43, 0x68, 0x61, 0x74, 0x49, 0x6e, 0x76, - 0x69, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x65, 0x65, 0x6e, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, - 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x65, 0x65, - 0x6e, 0x12, 0x32, 0x0a, 0x0b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, - 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, - 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0c, 0x50, - 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x3c, 0x0a, 0x10, 0x46, - 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, - 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x10, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, - 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x24, 0x0a, 0x04, 0x43, 0x61, 0x6c, - 0x6c, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, - 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x22, - 0x36, 0x0a, 0x11, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x50, 0x72, 0x69, - 0x76, 0x61, 0x63, 0x79, 0x12, 0x21, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x0f, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, - 0x65, 0x79, 0x52, 0x03, 0x4b, 0x65, 0x79, 0x22, 0x1a, 0x0a, 0x18, 0x41, 0x63, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x47, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x19, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, - 0x73, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x1a, 0x0a, 0x06, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, 0x22, 0x2d, 0x0a, 0x13, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x06, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x2c, 0x0a, 0x0e, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x65, 0x74, 0x4c, 0x61, 0x6e, 0x67, 0x12, 0x1a, 0x0a, - 0x08, 0x4c, 0x61, 0x6e, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x4c, 0x61, 0x6e, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, - 0x4c, 0x0a, 0x1a, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x50, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x2e, 0x0a, - 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, - 0x6f, 0x72, 0x64, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x80, 0x02, - 0x0a, 0x1d, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, - 0x2e, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, - 0x22, 0x0a, 0x0c, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x61, 0x73, 0x68, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x48, - 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, - 0x6d, 0x12, 0x24, 0x0a, 0x0d, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x44, 0x61, - 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, - 0x74, 0x68, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x69, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x48, 0x69, 0x6e, 0x74, 0x12, 0x33, 0x0a, 0x09, 0x51, - 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x51, 0x75, 0x65, - 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x22, 0xa5, 0x01, 0x0a, 0x16, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, - 0x76, 0x65, 0x72, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x2d, 0x0a, 0x07, 0x41, - 0x6e, 0x73, 0x77, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x41, 0x6e, 0x73, 0x77, 0x65, - 0x72, 0x52, 0x07, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x6c, - 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x41, - 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x24, 0x0a, 0x0d, 0x41, 0x6c, 0x67, 0x6f, - 0x72, 0x69, 0x74, 0x68, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x0d, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, - 0x0a, 0x05, 0x53, 0x72, 0x70, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, - 0x01, 0x52, 0x05, 0x53, 0x72, 0x70, 0x49, 0x44, 0x22, 0x11, 0x0a, 0x0f, 0x41, 0x63, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x22, 0x62, 0x0a, 0x17, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x53, 0x65, - 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x69, 0x6e, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x48, 0x69, 0x6e, 0x74, 0x12, 0x33, 0x0a, 0x09, 0x51, 0x75, - 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x51, 0x75, 0x65, 0x73, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, - 0x48, 0x0a, 0x11, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x51, 0x75, 0x65, 0x73, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x65, - 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, - 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x36, 0x0a, 0x10, 0x52, 0x65, 0x63, - 0x6f, 0x76, 0x65, 0x72, 0x79, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, - 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, - 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x65, 0x78, - 0x74, 0x22, 0x4e, 0x0a, 0x10, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x51, 0x75, 0x65, - 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, - 0x77, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, - 0x72, 0x22, 0x48, 0x0a, 0x0e, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x41, 0x6e, 0x73, - 0x77, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x22, 0x8e, 0x02, 0x0a, 0x0f, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, - 0x20, 0x0a, 0x0b, 0x48, 0x61, 0x73, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x48, 0x61, 0x73, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x48, 0x69, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, - 0x68, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, - 0x74, 0x68, 0x6d, 0x12, 0x24, 0x0a, 0x0d, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, - 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x41, 0x6c, 0x67, 0x6f, - 0x72, 0x69, 0x74, 0x68, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x72, 0x70, - 0x42, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x53, 0x72, 0x70, 0x42, 0x12, 0x1e, 0x0a, - 0x0a, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0a, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, - 0x05, 0x53, 0x72, 0x70, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x05, 0x53, 0x72, 0x70, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x09, 0x51, 0x75, 0x65, 0x73, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x09, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x5a, 0x0a, 0x15, - 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x0a, 0x0e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xa0, 0x02, 0x0a, 0x14, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x1a, 0x0a, 0x06, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, 0x12, 0x14, 0x0a, - 0x05, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x4d, 0x6f, - 0x64, 0x65, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x53, 0x79, 0x73, 0x74, - 0x65, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x6e, - 0x67, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x61, 0x6e, - 0x67, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x41, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x41, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x41, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x41, 0x74, 0x12, - 0x1a, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x50, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x50, 0x12, 0x1e, 0x0a, 0x0a, 0x4c, - 0x61, 0x73, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0a, 0x4c, 0x61, 0x73, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x3d, 0x0a, 0x13, 0x41, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, - 0x65, 0x73, 0x12, 0x26, 0x0a, 0x05, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, - 0x75, 0x6c, 0x65, 0x52, 0x05, 0x52, 0x75, 0x6c, 0x65, 0x73, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, - 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_accounts_proto_rawDescOnce sync.Once - file_accounts_proto_rawDescData = file_accounts_proto_rawDesc -) - -func file_accounts_proto_rawDescGZIP() []byte { - file_accounts_proto_rawDescOnce.Do(func() { - file_accounts_proto_rawDescData = protoimpl.X.CompressGZIP(file_accounts_proto_rawDescData) - }) - return file_accounts_proto_rawDescData -} - -var file_accounts_proto_msgTypes = make([]protoimpl.MessageInfo, 36) -var file_accounts_proto_goTypes = []interface{}{ - (*AccountSetNotifySettings)(nil), // 0: msg.AccountSetNotifySettings - (*AccountGetNotifySettings)(nil), // 1: msg.AccountGetNotifySettings - (*AccountRegisterDevice)(nil), // 2: msg.AccountRegisterDevice - (*AccountUnregisterDevice)(nil), // 3: msg.AccountUnregisterDevice - (*AccountUpdateProfile)(nil), // 4: msg.AccountUpdateProfile - (*AccountCheckUsername)(nil), // 5: msg.AccountCheckUsername - (*AccountUpdateUsername)(nil), // 6: msg.AccountUpdateUsername - (*AccountUploadPhoto)(nil), // 7: msg.AccountUploadPhoto - (*AccountUpdatePhoto)(nil), // 8: msg.AccountUpdatePhoto - (*AccountSetWebPhoto)(nil), // 9: msg.AccountSetWebPhoto - (*AccountRemovePhoto)(nil), // 10: msg.AccountRemovePhoto - (*AccountSendChangePhoneCode)(nil), // 11: msg.AccountSendChangePhoneCode - (*AccountSendVerifyPhoneCode)(nil), // 12: msg.AccountSendVerifyPhoneCode - (*AccountResendVerifyPhoneCode)(nil), // 13: msg.AccountResendVerifyPhoneCode - (*AccountChangePhone)(nil), // 14: msg.AccountChangePhone - (*AccountDelete)(nil), // 15: msg.AccountDelete - (*AccountSetPrivacy)(nil), // 16: msg.AccountSetPrivacy - (*AccountGetPrivacy)(nil), // 17: msg.AccountGetPrivacy - (*AccountGetAuthorizations)(nil), // 18: msg.AccountGetAuthorizations - (*AccountResetAuthorization)(nil), // 19: msg.AccountResetAuthorization - (*AccountUpdateStatus)(nil), // 20: msg.AccountUpdateStatus - (*AccountSetLang)(nil), // 21: msg.AccountSetLang - (*AccountGetPassword)(nil), // 22: msg.AccountGetPassword - (*AccountGetPasswordSettings)(nil), // 23: msg.AccountGetPasswordSettings - (*AccountUpdatePasswordSettings)(nil), // 24: msg.AccountUpdatePasswordSettings - (*AccountRecoverPassword)(nil), // 25: msg.AccountRecoverPassword - (*AccountGetTeams)(nil), // 26: msg.AccountGetTeams - (*AccountPasswordSettings)(nil), // 27: msg.AccountPasswordSettings - (*SecurityQuestions)(nil), // 28: msg.SecurityQuestions - (*RecoveryQuestion)(nil), // 29: msg.RecoveryQuestion - (*SecurityQuestion)(nil), // 30: msg.SecurityQuestion - (*SecurityAnswer)(nil), // 31: msg.SecurityAnswer - (*AccountPassword)(nil), // 32: msg.AccountPassword - (*AccountAuthorizations)(nil), // 33: msg.AccountAuthorizations - (*AccountAuthorization)(nil), // 34: msg.AccountAuthorization - (*AccountPrivacyRules)(nil), // 35: msg.AccountPrivacyRules - (*InputPeer)(nil), // 36: msg.InputPeer - (*PeerNotifySettings)(nil), // 37: msg.PeerNotifySettings - (PushTokenProvider)(0), // 38: msg.PushTokenProvider - (*InputFile)(nil), // 39: msg.InputFile - (*InputWebLocation)(nil), // 40: msg.InputWebLocation - (*InputPassword)(nil), // 41: msg.InputPassword - (*PrivacyRule)(nil), // 42: msg.PrivacyRule - (PrivacyKey)(0), // 43: msg.PrivacyKey -} -var file_accounts_proto_depIdxs = []int32{ - 36, // 0: msg.AccountSetNotifySettings.Peer:type_name -> msg.InputPeer - 37, // 1: msg.AccountSetNotifySettings.Settings:type_name -> msg.PeerNotifySettings - 36, // 2: msg.AccountGetNotifySettings.Peer:type_name -> msg.InputPeer - 38, // 3: msg.AccountRegisterDevice.TokenType:type_name -> msg.PushTokenProvider - 39, // 4: msg.AccountUploadPhoto.File:type_name -> msg.InputFile - 40, // 5: msg.AccountSetWebPhoto.BigPhoto:type_name -> msg.InputWebLocation - 40, // 6: msg.AccountSetWebPhoto.SmallPhoto:type_name -> msg.InputWebLocation - 41, // 7: msg.AccountChangePhone.Password:type_name -> msg.InputPassword - 41, // 8: msg.AccountDelete.Password:type_name -> msg.InputPassword - 42, // 9: msg.AccountSetPrivacy.ChatInvite:type_name -> msg.PrivacyRule - 42, // 10: msg.AccountSetPrivacy.LastSeen:type_name -> msg.PrivacyRule - 42, // 11: msg.AccountSetPrivacy.PhoneNumber:type_name -> msg.PrivacyRule - 42, // 12: msg.AccountSetPrivacy.ProfilePhoto:type_name -> msg.PrivacyRule - 42, // 13: msg.AccountSetPrivacy.ForwardedMessage:type_name -> msg.PrivacyRule - 42, // 14: msg.AccountSetPrivacy.Call:type_name -> msg.PrivacyRule - 43, // 15: msg.AccountGetPrivacy.Key:type_name -> msg.PrivacyKey - 41, // 16: msg.AccountGetPasswordSettings.Password:type_name -> msg.InputPassword - 41, // 17: msg.AccountUpdatePasswordSettings.Password:type_name -> msg.InputPassword - 30, // 18: msg.AccountUpdatePasswordSettings.Questions:type_name -> msg.SecurityQuestion - 31, // 19: msg.AccountRecoverPassword.Answers:type_name -> msg.SecurityAnswer - 29, // 20: msg.AccountPasswordSettings.Questions:type_name -> msg.RecoveryQuestion - 30, // 21: msg.SecurityQuestions.Questions:type_name -> msg.SecurityQuestion - 29, // 22: msg.AccountPassword.Questions:type_name -> msg.RecoveryQuestion - 34, // 23: msg.AccountAuthorizations.Authorizations:type_name -> msg.AccountAuthorization - 42, // 24: msg.AccountPrivacyRules.Rules:type_name -> msg.PrivacyRule - 25, // [25:25] is the sub-list for method output_type - 25, // [25:25] is the sub-list for method input_type - 25, // [25:25] is the sub-list for extension type_name - 25, // [25:25] is the sub-list for extension extendee - 0, // [0:25] is the sub-list for field type_name -} - -func init() { file_accounts_proto_init() } -func file_accounts_proto_init() { - if File_accounts_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_accounts_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountSetNotifySettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountGetNotifySettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountRegisterDevice); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountUnregisterDevice); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountUpdateProfile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountCheckUsername); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountUpdateUsername); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountUploadPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountUpdatePhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountSetWebPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountRemovePhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountSendChangePhoneCode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountSendVerifyPhoneCode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountResendVerifyPhoneCode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountChangePhone); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountDelete); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountSetPrivacy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountGetPrivacy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountGetAuthorizations); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountResetAuthorization); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountUpdateStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountSetLang); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountGetPassword); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountGetPasswordSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountUpdatePasswordSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountRecoverPassword); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountGetTeams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountPasswordSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityQuestions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RecoveryQuestion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityQuestion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SecurityAnswer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountPassword); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountAuthorizations); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountAuthorization); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_accounts_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AccountPrivacyRules); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_accounts_proto_rawDesc, - NumEnums: 0, - NumMessages: 36, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_accounts_proto_goTypes, - DependencyIndexes: file_accounts_proto_depIdxs, - MessageInfos: file_accounts_proto_msgTypes, - }.Build() - File_accounts_proto = out.File - file_accounts_proto_rawDesc = nil - file_accounts_proto_goTypes = nil - file_accounts_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/accounts.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/accounts.rony.go deleted file mode 100644 index 1b68d85b..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/accounts.rony.go +++ /dev/null @@ -1,2444 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: accounts.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_AccountSetNotifySettings int64 = 2016882075 - -type poolAccountSetNotifySettings struct { - pool sync.Pool -} - -func (p *poolAccountSetNotifySettings) Get() *AccountSetNotifySettings { - x, ok := p.pool.Get().(*AccountSetNotifySettings) - if !ok { - x = &AccountSetNotifySettings{} - } - - x.Peer = PoolInputPeer.Get() - - x.Settings = PoolPeerNotifySettings.Get() - - return x -} - -func (p *poolAccountSetNotifySettings) Put(x *AccountSetNotifySettings) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - PoolPeerNotifySettings.Put(x.Settings) - - p.pool.Put(x) -} - -var PoolAccountSetNotifySettings = poolAccountSetNotifySettings{} - -func (x *AccountSetNotifySettings) DeepCopy(z *AccountSetNotifySettings) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - if x.Settings != nil { - if z.Settings == nil { - z.Settings = PoolPeerNotifySettings.Get() - } - x.Settings.DeepCopy(z.Settings) - } else { - PoolPeerNotifySettings.Put(z.Settings) - z.Settings = nil - } -} - -func (x *AccountSetNotifySettings) Clone() *AccountSetNotifySettings { - z := &AccountSetNotifySettings{} - x.DeepCopy(z) - return z -} - -func (x *AccountSetNotifySettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountSetNotifySettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountSetNotifySettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountSetNotifySettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountSetNotifySettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountSetNotifySettings, x) -} - -const C_AccountGetNotifySettings int64 = 477008681 - -type poolAccountGetNotifySettings struct { - pool sync.Pool -} - -func (p *poolAccountGetNotifySettings) Get() *AccountGetNotifySettings { - x, ok := p.pool.Get().(*AccountGetNotifySettings) - if !ok { - x = &AccountGetNotifySettings{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolAccountGetNotifySettings) Put(x *AccountGetNotifySettings) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolAccountGetNotifySettings = poolAccountGetNotifySettings{} - -func (x *AccountGetNotifySettings) DeepCopy(z *AccountGetNotifySettings) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *AccountGetNotifySettings) Clone() *AccountGetNotifySettings { - z := &AccountGetNotifySettings{} - x.DeepCopy(z) - return z -} - -func (x *AccountGetNotifySettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountGetNotifySettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountGetNotifySettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountGetNotifySettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountGetNotifySettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountGetNotifySettings, x) -} - -const C_AccountRegisterDevice int64 = 946059841 - -type poolAccountRegisterDevice struct { - pool sync.Pool -} - -func (p *poolAccountRegisterDevice) Get() *AccountRegisterDevice { - x, ok := p.pool.Get().(*AccountRegisterDevice) - if !ok { - x = &AccountRegisterDevice{} - } - - return x -} - -func (p *poolAccountRegisterDevice) Put(x *AccountRegisterDevice) { - if x == nil { - return - } - - x.Token = "" - x.DeviceModel = "" - x.SystemVersion = "" - x.AppVersion = "" - x.LangCode = "" - x.TokenType = 0 - x.ClientID = "" - - p.pool.Put(x) -} - -var PoolAccountRegisterDevice = poolAccountRegisterDevice{} - -func (x *AccountRegisterDevice) DeepCopy(z *AccountRegisterDevice) { - z.Token = x.Token - z.DeviceModel = x.DeviceModel - z.SystemVersion = x.SystemVersion - z.AppVersion = x.AppVersion - z.LangCode = x.LangCode - z.TokenType = x.TokenType - z.ClientID = x.ClientID -} - -func (x *AccountRegisterDevice) Clone() *AccountRegisterDevice { - z := &AccountRegisterDevice{} - x.DeepCopy(z) - return z -} - -func (x *AccountRegisterDevice) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountRegisterDevice) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountRegisterDevice) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountRegisterDevice) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountRegisterDevice) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountRegisterDevice, x) -} - -const C_AccountUnregisterDevice int64 = 3981251588 - -type poolAccountUnregisterDevice struct { - pool sync.Pool -} - -func (p *poolAccountUnregisterDevice) Get() *AccountUnregisterDevice { - x, ok := p.pool.Get().(*AccountUnregisterDevice) - if !ok { - x = &AccountUnregisterDevice{} - } - - return x -} - -func (p *poolAccountUnregisterDevice) Put(x *AccountUnregisterDevice) { - if x == nil { - return - } - - x.TokenType = 0 - x.Token = "" - - p.pool.Put(x) -} - -var PoolAccountUnregisterDevice = poolAccountUnregisterDevice{} - -func (x *AccountUnregisterDevice) DeepCopy(z *AccountUnregisterDevice) { - z.TokenType = x.TokenType - z.Token = x.Token -} - -func (x *AccountUnregisterDevice) Clone() *AccountUnregisterDevice { - z := &AccountUnregisterDevice{} - x.DeepCopy(z) - return z -} - -func (x *AccountUnregisterDevice) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountUnregisterDevice) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountUnregisterDevice) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountUnregisterDevice) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountUnregisterDevice) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountUnregisterDevice, x) -} - -const C_AccountUpdateProfile int64 = 3725499887 - -type poolAccountUpdateProfile struct { - pool sync.Pool -} - -func (p *poolAccountUpdateProfile) Get() *AccountUpdateProfile { - x, ok := p.pool.Get().(*AccountUpdateProfile) - if !ok { - x = &AccountUpdateProfile{} - } - - return x -} - -func (p *poolAccountUpdateProfile) Put(x *AccountUpdateProfile) { - if x == nil { - return - } - - x.FirstName = "" - x.LastName = "" - x.Bio = "" - - p.pool.Put(x) -} - -var PoolAccountUpdateProfile = poolAccountUpdateProfile{} - -func (x *AccountUpdateProfile) DeepCopy(z *AccountUpdateProfile) { - z.FirstName = x.FirstName - z.LastName = x.LastName - z.Bio = x.Bio -} - -func (x *AccountUpdateProfile) Clone() *AccountUpdateProfile { - z := &AccountUpdateProfile{} - x.DeepCopy(z) - return z -} - -func (x *AccountUpdateProfile) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountUpdateProfile) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountUpdateProfile) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountUpdateProfile) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountUpdateProfile) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountUpdateProfile, x) -} - -const C_AccountCheckUsername int64 = 1501406413 - -type poolAccountCheckUsername struct { - pool sync.Pool -} - -func (p *poolAccountCheckUsername) Get() *AccountCheckUsername { - x, ok := p.pool.Get().(*AccountCheckUsername) - if !ok { - x = &AccountCheckUsername{} - } - - return x -} - -func (p *poolAccountCheckUsername) Put(x *AccountCheckUsername) { - if x == nil { - return - } - - x.Username = "" - - p.pool.Put(x) -} - -var PoolAccountCheckUsername = poolAccountCheckUsername{} - -func (x *AccountCheckUsername) DeepCopy(z *AccountCheckUsername) { - z.Username = x.Username -} - -func (x *AccountCheckUsername) Clone() *AccountCheckUsername { - z := &AccountCheckUsername{} - x.DeepCopy(z) - return z -} - -func (x *AccountCheckUsername) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountCheckUsername) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountCheckUsername) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountCheckUsername) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountCheckUsername) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountCheckUsername, x) -} - -const C_AccountUpdateUsername int64 = 1477164344 - -type poolAccountUpdateUsername struct { - pool sync.Pool -} - -func (p *poolAccountUpdateUsername) Get() *AccountUpdateUsername { - x, ok := p.pool.Get().(*AccountUpdateUsername) - if !ok { - x = &AccountUpdateUsername{} - } - - return x -} - -func (p *poolAccountUpdateUsername) Put(x *AccountUpdateUsername) { - if x == nil { - return - } - - x.Username = "" - - p.pool.Put(x) -} - -var PoolAccountUpdateUsername = poolAccountUpdateUsername{} - -func (x *AccountUpdateUsername) DeepCopy(z *AccountUpdateUsername) { - z.Username = x.Username -} - -func (x *AccountUpdateUsername) Clone() *AccountUpdateUsername { - z := &AccountUpdateUsername{} - x.DeepCopy(z) - return z -} - -func (x *AccountUpdateUsername) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountUpdateUsername) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountUpdateUsername) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountUpdateUsername) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountUpdateUsername) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountUpdateUsername, x) -} - -const C_AccountUploadPhoto int64 = 1222469957 - -type poolAccountUploadPhoto struct { - pool sync.Pool -} - -func (p *poolAccountUploadPhoto) Get() *AccountUploadPhoto { - x, ok := p.pool.Get().(*AccountUploadPhoto) - if !ok { - x = &AccountUploadPhoto{} - } - - x.File = PoolInputFile.Get() - - return x -} - -func (p *poolAccountUploadPhoto) Put(x *AccountUploadPhoto) { - if x == nil { - return - } - - PoolInputFile.Put(x.File) - x.ReturnObject = false - - p.pool.Put(x) -} - -var PoolAccountUploadPhoto = poolAccountUploadPhoto{} - -func (x *AccountUploadPhoto) DeepCopy(z *AccountUploadPhoto) { - if x.File != nil { - if z.File == nil { - z.File = PoolInputFile.Get() - } - x.File.DeepCopy(z.File) - } else { - PoolInputFile.Put(z.File) - z.File = nil - } - z.ReturnObject = x.ReturnObject -} - -func (x *AccountUploadPhoto) Clone() *AccountUploadPhoto { - z := &AccountUploadPhoto{} - x.DeepCopy(z) - return z -} - -func (x *AccountUploadPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountUploadPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountUploadPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountUploadPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountUploadPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountUploadPhoto, x) -} - -const C_AccountUpdatePhoto int64 = 406174115 - -type poolAccountUpdatePhoto struct { - pool sync.Pool -} - -func (p *poolAccountUpdatePhoto) Get() *AccountUpdatePhoto { - x, ok := p.pool.Get().(*AccountUpdatePhoto) - if !ok { - x = &AccountUpdatePhoto{} - } - - return x -} - -func (p *poolAccountUpdatePhoto) Put(x *AccountUpdatePhoto) { - if x == nil { - return - } - - x.PhotoID = 0 - - p.pool.Put(x) -} - -var PoolAccountUpdatePhoto = poolAccountUpdatePhoto{} - -func (x *AccountUpdatePhoto) DeepCopy(z *AccountUpdatePhoto) { - z.PhotoID = x.PhotoID -} - -func (x *AccountUpdatePhoto) Clone() *AccountUpdatePhoto { - z := &AccountUpdatePhoto{} - x.DeepCopy(z) - return z -} - -func (x *AccountUpdatePhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountUpdatePhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountUpdatePhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountUpdatePhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountUpdatePhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountUpdatePhoto, x) -} - -const C_AccountSetWebPhoto int64 = 46761477 - -type poolAccountSetWebPhoto struct { - pool sync.Pool -} - -func (p *poolAccountSetWebPhoto) Get() *AccountSetWebPhoto { - x, ok := p.pool.Get().(*AccountSetWebPhoto) - if !ok { - x = &AccountSetWebPhoto{} - } - - x.BigPhoto = PoolInputWebLocation.Get() - - x.SmallPhoto = PoolInputWebLocation.Get() - - return x -} - -func (p *poolAccountSetWebPhoto) Put(x *AccountSetWebPhoto) { - if x == nil { - return - } - - PoolInputWebLocation.Put(x.BigPhoto) - PoolInputWebLocation.Put(x.SmallPhoto) - - p.pool.Put(x) -} - -var PoolAccountSetWebPhoto = poolAccountSetWebPhoto{} - -func (x *AccountSetWebPhoto) DeepCopy(z *AccountSetWebPhoto) { - if x.BigPhoto != nil { - if z.BigPhoto == nil { - z.BigPhoto = PoolInputWebLocation.Get() - } - x.BigPhoto.DeepCopy(z.BigPhoto) - } else { - PoolInputWebLocation.Put(z.BigPhoto) - z.BigPhoto = nil - } - if x.SmallPhoto != nil { - if z.SmallPhoto == nil { - z.SmallPhoto = PoolInputWebLocation.Get() - } - x.SmallPhoto.DeepCopy(z.SmallPhoto) - } else { - PoolInputWebLocation.Put(z.SmallPhoto) - z.SmallPhoto = nil - } -} - -func (x *AccountSetWebPhoto) Clone() *AccountSetWebPhoto { - z := &AccountSetWebPhoto{} - x.DeepCopy(z) - return z -} - -func (x *AccountSetWebPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountSetWebPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountSetWebPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountSetWebPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountSetWebPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountSetWebPhoto, x) -} - -const C_AccountRemovePhoto int64 = 3728692172 - -type poolAccountRemovePhoto struct { - pool sync.Pool -} - -func (p *poolAccountRemovePhoto) Get() *AccountRemovePhoto { - x, ok := p.pool.Get().(*AccountRemovePhoto) - if !ok { - x = &AccountRemovePhoto{} - } - - return x -} - -func (p *poolAccountRemovePhoto) Put(x *AccountRemovePhoto) { - if x == nil { - return - } - - x.PhotoID = 0 - - p.pool.Put(x) -} - -var PoolAccountRemovePhoto = poolAccountRemovePhoto{} - -func (x *AccountRemovePhoto) DeepCopy(z *AccountRemovePhoto) { - z.PhotoID = x.PhotoID -} - -func (x *AccountRemovePhoto) Clone() *AccountRemovePhoto { - z := &AccountRemovePhoto{} - x.DeepCopy(z) - return z -} - -func (x *AccountRemovePhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountRemovePhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountRemovePhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountRemovePhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountRemovePhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountRemovePhoto, x) -} - -const C_AccountSendChangePhoneCode int64 = 1389121902 - -type poolAccountSendChangePhoneCode struct { - pool sync.Pool -} - -func (p *poolAccountSendChangePhoneCode) Get() *AccountSendChangePhoneCode { - x, ok := p.pool.Get().(*AccountSendChangePhoneCode) - if !ok { - x = &AccountSendChangePhoneCode{} - } - - return x -} - -func (p *poolAccountSendChangePhoneCode) Put(x *AccountSendChangePhoneCode) { - if x == nil { - return - } - - x.Phone = "" - x.AppHash = "" - - p.pool.Put(x) -} - -var PoolAccountSendChangePhoneCode = poolAccountSendChangePhoneCode{} - -func (x *AccountSendChangePhoneCode) DeepCopy(z *AccountSendChangePhoneCode) { - z.Phone = x.Phone - z.AppHash = x.AppHash -} - -func (x *AccountSendChangePhoneCode) Clone() *AccountSendChangePhoneCode { - z := &AccountSendChangePhoneCode{} - x.DeepCopy(z) - return z -} - -func (x *AccountSendChangePhoneCode) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountSendChangePhoneCode) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountSendChangePhoneCode) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountSendChangePhoneCode) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountSendChangePhoneCode) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountSendChangePhoneCode, x) -} - -const C_AccountSendVerifyPhoneCode int64 = 328900044 - -type poolAccountSendVerifyPhoneCode struct { - pool sync.Pool -} - -func (p *poolAccountSendVerifyPhoneCode) Get() *AccountSendVerifyPhoneCode { - x, ok := p.pool.Get().(*AccountSendVerifyPhoneCode) - if !ok { - x = &AccountSendVerifyPhoneCode{} - } - - return x -} - -func (p *poolAccountSendVerifyPhoneCode) Put(x *AccountSendVerifyPhoneCode) { - if x == nil { - return - } - - x.Phone = "" - x.AppHash = "" - - p.pool.Put(x) -} - -var PoolAccountSendVerifyPhoneCode = poolAccountSendVerifyPhoneCode{} - -func (x *AccountSendVerifyPhoneCode) DeepCopy(z *AccountSendVerifyPhoneCode) { - z.Phone = x.Phone - z.AppHash = x.AppHash -} - -func (x *AccountSendVerifyPhoneCode) Clone() *AccountSendVerifyPhoneCode { - z := &AccountSendVerifyPhoneCode{} - x.DeepCopy(z) - return z -} - -func (x *AccountSendVerifyPhoneCode) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountSendVerifyPhoneCode) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountSendVerifyPhoneCode) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountSendVerifyPhoneCode) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountSendVerifyPhoneCode) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountSendVerifyPhoneCode, x) -} - -const C_AccountResendVerifyPhoneCode int64 = 3140772691 - -type poolAccountResendVerifyPhoneCode struct { - pool sync.Pool -} - -func (p *poolAccountResendVerifyPhoneCode) Get() *AccountResendVerifyPhoneCode { - x, ok := p.pool.Get().(*AccountResendVerifyPhoneCode) - if !ok { - x = &AccountResendVerifyPhoneCode{} - } - - return x -} - -func (p *poolAccountResendVerifyPhoneCode) Put(x *AccountResendVerifyPhoneCode) { - if x == nil { - return - } - - x.Phone = "" - x.PhoneCodeHash = "" - x.AppHash = "" - - p.pool.Put(x) -} - -var PoolAccountResendVerifyPhoneCode = poolAccountResendVerifyPhoneCode{} - -func (x *AccountResendVerifyPhoneCode) DeepCopy(z *AccountResendVerifyPhoneCode) { - z.Phone = x.Phone - z.PhoneCodeHash = x.PhoneCodeHash - z.AppHash = x.AppHash -} - -func (x *AccountResendVerifyPhoneCode) Clone() *AccountResendVerifyPhoneCode { - z := &AccountResendVerifyPhoneCode{} - x.DeepCopy(z) - return z -} - -func (x *AccountResendVerifyPhoneCode) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountResendVerifyPhoneCode) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountResendVerifyPhoneCode) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountResendVerifyPhoneCode) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountResendVerifyPhoneCode) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountResendVerifyPhoneCode, x) -} - -const C_AccountChangePhone int64 = 4285969474 - -type poolAccountChangePhone struct { - pool sync.Pool -} - -func (p *poolAccountChangePhone) Get() *AccountChangePhone { - x, ok := p.pool.Get().(*AccountChangePhone) - if !ok { - x = &AccountChangePhone{} - } - - x.Password = PoolInputPassword.Get() - - return x -} - -func (p *poolAccountChangePhone) Put(x *AccountChangePhone) { - if x == nil { - return - } - - x.Phone = "" - x.PhoneCodeHash = "" - x.PhoneCode = "" - PoolInputPassword.Put(x.Password) - - p.pool.Put(x) -} - -var PoolAccountChangePhone = poolAccountChangePhone{} - -func (x *AccountChangePhone) DeepCopy(z *AccountChangePhone) { - z.Phone = x.Phone - z.PhoneCodeHash = x.PhoneCodeHash - z.PhoneCode = x.PhoneCode - if x.Password != nil { - if z.Password == nil { - z.Password = PoolInputPassword.Get() - } - x.Password.DeepCopy(z.Password) - } else { - PoolInputPassword.Put(z.Password) - z.Password = nil - } -} - -func (x *AccountChangePhone) Clone() *AccountChangePhone { - z := &AccountChangePhone{} - x.DeepCopy(z) - return z -} - -func (x *AccountChangePhone) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountChangePhone) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountChangePhone) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountChangePhone) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountChangePhone) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountChangePhone, x) -} - -const C_AccountDelete int64 = 846661545 - -type poolAccountDelete struct { - pool sync.Pool -} - -func (p *poolAccountDelete) Get() *AccountDelete { - x, ok := p.pool.Get().(*AccountDelete) - if !ok { - x = &AccountDelete{} - } - - x.Password = PoolInputPassword.Get() - - return x -} - -func (p *poolAccountDelete) Put(x *AccountDelete) { - if x == nil { - return - } - - x.Phone = "" - x.PhoneCodeHash = "" - x.PhoneCode = "" - PoolInputPassword.Put(x.Password) - x.Reason = "" - - p.pool.Put(x) -} - -var PoolAccountDelete = poolAccountDelete{} - -func (x *AccountDelete) DeepCopy(z *AccountDelete) { - z.Phone = x.Phone - z.PhoneCodeHash = x.PhoneCodeHash - z.PhoneCode = x.PhoneCode - if x.Password != nil { - if z.Password == nil { - z.Password = PoolInputPassword.Get() - } - x.Password.DeepCopy(z.Password) - } else { - PoolInputPassword.Put(z.Password) - z.Password = nil - } - z.Reason = x.Reason -} - -func (x *AccountDelete) Clone() *AccountDelete { - z := &AccountDelete{} - x.DeepCopy(z) - return z -} - -func (x *AccountDelete) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountDelete) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountDelete) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountDelete) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountDelete) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountDelete, x) -} - -const C_AccountSetPrivacy int64 = 1599585002 - -type poolAccountSetPrivacy struct { - pool sync.Pool -} - -func (p *poolAccountSetPrivacy) Get() *AccountSetPrivacy { - x, ok := p.pool.Get().(*AccountSetPrivacy) - if !ok { - x = &AccountSetPrivacy{} - } - - return x -} - -func (p *poolAccountSetPrivacy) Put(x *AccountSetPrivacy) { - if x == nil { - return - } - - for _, z := range x.ChatInvite { - PoolPrivacyRule.Put(z) - } - x.ChatInvite = x.ChatInvite[:0] - for _, z := range x.LastSeen { - PoolPrivacyRule.Put(z) - } - x.LastSeen = x.LastSeen[:0] - for _, z := range x.PhoneNumber { - PoolPrivacyRule.Put(z) - } - x.PhoneNumber = x.PhoneNumber[:0] - for _, z := range x.ProfilePhoto { - PoolPrivacyRule.Put(z) - } - x.ProfilePhoto = x.ProfilePhoto[:0] - for _, z := range x.ForwardedMessage { - PoolPrivacyRule.Put(z) - } - x.ForwardedMessage = x.ForwardedMessage[:0] - for _, z := range x.Call { - PoolPrivacyRule.Put(z) - } - x.Call = x.Call[:0] - - p.pool.Put(x) -} - -var PoolAccountSetPrivacy = poolAccountSetPrivacy{} - -func (x *AccountSetPrivacy) DeepCopy(z *AccountSetPrivacy) { - for idx := range x.ChatInvite { - if x.ChatInvite[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.ChatInvite[idx].DeepCopy(xx) - z.ChatInvite = append(z.ChatInvite, xx) - } - for idx := range x.LastSeen { - if x.LastSeen[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.LastSeen[idx].DeepCopy(xx) - z.LastSeen = append(z.LastSeen, xx) - } - for idx := range x.PhoneNumber { - if x.PhoneNumber[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.PhoneNumber[idx].DeepCopy(xx) - z.PhoneNumber = append(z.PhoneNumber, xx) - } - for idx := range x.ProfilePhoto { - if x.ProfilePhoto[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.ProfilePhoto[idx].DeepCopy(xx) - z.ProfilePhoto = append(z.ProfilePhoto, xx) - } - for idx := range x.ForwardedMessage { - if x.ForwardedMessage[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.ForwardedMessage[idx].DeepCopy(xx) - z.ForwardedMessage = append(z.ForwardedMessage, xx) - } - for idx := range x.Call { - if x.Call[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.Call[idx].DeepCopy(xx) - z.Call = append(z.Call, xx) - } -} - -func (x *AccountSetPrivacy) Clone() *AccountSetPrivacy { - z := &AccountSetPrivacy{} - x.DeepCopy(z) - return z -} - -func (x *AccountSetPrivacy) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountSetPrivacy) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountSetPrivacy) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountSetPrivacy) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountSetPrivacy) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountSetPrivacy, x) -} - -const C_AccountGetPrivacy int64 = 1897044856 - -type poolAccountGetPrivacy struct { - pool sync.Pool -} - -func (p *poolAccountGetPrivacy) Get() *AccountGetPrivacy { - x, ok := p.pool.Get().(*AccountGetPrivacy) - if !ok { - x = &AccountGetPrivacy{} - } - - return x -} - -func (p *poolAccountGetPrivacy) Put(x *AccountGetPrivacy) { - if x == nil { - return - } - - x.Key = 0 - - p.pool.Put(x) -} - -var PoolAccountGetPrivacy = poolAccountGetPrivacy{} - -func (x *AccountGetPrivacy) DeepCopy(z *AccountGetPrivacy) { - z.Key = x.Key -} - -func (x *AccountGetPrivacy) Clone() *AccountGetPrivacy { - z := &AccountGetPrivacy{} - x.DeepCopy(z) - return z -} - -func (x *AccountGetPrivacy) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountGetPrivacy) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountGetPrivacy) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountGetPrivacy) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountGetPrivacy) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountGetPrivacy, x) -} - -const C_AccountGetAuthorizations int64 = 2112646192 - -type poolAccountGetAuthorizations struct { - pool sync.Pool -} - -func (p *poolAccountGetAuthorizations) Get() *AccountGetAuthorizations { - x, ok := p.pool.Get().(*AccountGetAuthorizations) - if !ok { - x = &AccountGetAuthorizations{} - } - - return x -} - -func (p *poolAccountGetAuthorizations) Put(x *AccountGetAuthorizations) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolAccountGetAuthorizations = poolAccountGetAuthorizations{} - -func (x *AccountGetAuthorizations) DeepCopy(z *AccountGetAuthorizations) { -} - -func (x *AccountGetAuthorizations) Clone() *AccountGetAuthorizations { - z := &AccountGetAuthorizations{} - x.DeepCopy(z) - return z -} - -func (x *AccountGetAuthorizations) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountGetAuthorizations) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountGetAuthorizations) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountGetAuthorizations) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountGetAuthorizations) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountGetAuthorizations, x) -} - -const C_AccountResetAuthorization int64 = 1045069116 - -type poolAccountResetAuthorization struct { - pool sync.Pool -} - -func (p *poolAccountResetAuthorization) Get() *AccountResetAuthorization { - x, ok := p.pool.Get().(*AccountResetAuthorization) - if !ok { - x = &AccountResetAuthorization{} - } - - return x -} - -func (p *poolAccountResetAuthorization) Put(x *AccountResetAuthorization) { - if x == nil { - return - } - - x.AuthID = 0 - - p.pool.Put(x) -} - -var PoolAccountResetAuthorization = poolAccountResetAuthorization{} - -func (x *AccountResetAuthorization) DeepCopy(z *AccountResetAuthorization) { - z.AuthID = x.AuthID -} - -func (x *AccountResetAuthorization) Clone() *AccountResetAuthorization { - z := &AccountResetAuthorization{} - x.DeepCopy(z) - return z -} - -func (x *AccountResetAuthorization) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountResetAuthorization) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountResetAuthorization) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountResetAuthorization) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountResetAuthorization) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountResetAuthorization, x) -} - -const C_AccountUpdateStatus int64 = 666864933 - -type poolAccountUpdateStatus struct { - pool sync.Pool -} - -func (p *poolAccountUpdateStatus) Get() *AccountUpdateStatus { - x, ok := p.pool.Get().(*AccountUpdateStatus) - if !ok { - x = &AccountUpdateStatus{} - } - - return x -} - -func (p *poolAccountUpdateStatus) Put(x *AccountUpdateStatus) { - if x == nil { - return - } - - x.Online = false - - p.pool.Put(x) -} - -var PoolAccountUpdateStatus = poolAccountUpdateStatus{} - -func (x *AccountUpdateStatus) DeepCopy(z *AccountUpdateStatus) { - z.Online = x.Online -} - -func (x *AccountUpdateStatus) Clone() *AccountUpdateStatus { - z := &AccountUpdateStatus{} - x.DeepCopy(z) - return z -} - -func (x *AccountUpdateStatus) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountUpdateStatus) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountUpdateStatus) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountUpdateStatus) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountUpdateStatus) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountUpdateStatus, x) -} - -const C_AccountSetLang int64 = 2015777242 - -type poolAccountSetLang struct { - pool sync.Pool -} - -func (p *poolAccountSetLang) Get() *AccountSetLang { - x, ok := p.pool.Get().(*AccountSetLang) - if !ok { - x = &AccountSetLang{} - } - - return x -} - -func (p *poolAccountSetLang) Put(x *AccountSetLang) { - if x == nil { - return - } - - x.LangCode = "" - - p.pool.Put(x) -} - -var PoolAccountSetLang = poolAccountSetLang{} - -func (x *AccountSetLang) DeepCopy(z *AccountSetLang) { - z.LangCode = x.LangCode -} - -func (x *AccountSetLang) Clone() *AccountSetLang { - z := &AccountSetLang{} - x.DeepCopy(z) - return z -} - -func (x *AccountSetLang) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountSetLang) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountSetLang) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountSetLang) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountSetLang) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountSetLang, x) -} - -const C_AccountGetPassword int64 = 1702207851 - -type poolAccountGetPassword struct { - pool sync.Pool -} - -func (p *poolAccountGetPassword) Get() *AccountGetPassword { - x, ok := p.pool.Get().(*AccountGetPassword) - if !ok { - x = &AccountGetPassword{} - } - - return x -} - -func (p *poolAccountGetPassword) Put(x *AccountGetPassword) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolAccountGetPassword = poolAccountGetPassword{} - -func (x *AccountGetPassword) DeepCopy(z *AccountGetPassword) { -} - -func (x *AccountGetPassword) Clone() *AccountGetPassword { - z := &AccountGetPassword{} - x.DeepCopy(z) - return z -} - -func (x *AccountGetPassword) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountGetPassword) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountGetPassword) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountGetPassword) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountGetPassword) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountGetPassword, x) -} - -const C_AccountGetPasswordSettings int64 = 2052309739 - -type poolAccountGetPasswordSettings struct { - pool sync.Pool -} - -func (p *poolAccountGetPasswordSettings) Get() *AccountGetPasswordSettings { - x, ok := p.pool.Get().(*AccountGetPasswordSettings) - if !ok { - x = &AccountGetPasswordSettings{} - } - - x.Password = PoolInputPassword.Get() - - return x -} - -func (p *poolAccountGetPasswordSettings) Put(x *AccountGetPasswordSettings) { - if x == nil { - return - } - - PoolInputPassword.Put(x.Password) - - p.pool.Put(x) -} - -var PoolAccountGetPasswordSettings = poolAccountGetPasswordSettings{} - -func (x *AccountGetPasswordSettings) DeepCopy(z *AccountGetPasswordSettings) { - if x.Password != nil { - if z.Password == nil { - z.Password = PoolInputPassword.Get() - } - x.Password.DeepCopy(z.Password) - } else { - PoolInputPassword.Put(z.Password) - z.Password = nil - } -} - -func (x *AccountGetPasswordSettings) Clone() *AccountGetPasswordSettings { - z := &AccountGetPasswordSettings{} - x.DeepCopy(z) - return z -} - -func (x *AccountGetPasswordSettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountGetPasswordSettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountGetPasswordSettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountGetPasswordSettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountGetPasswordSettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountGetPasswordSettings, x) -} - -const C_AccountUpdatePasswordSettings int64 = 3193945896 - -type poolAccountUpdatePasswordSettings struct { - pool sync.Pool -} - -func (p *poolAccountUpdatePasswordSettings) Get() *AccountUpdatePasswordSettings { - x, ok := p.pool.Get().(*AccountUpdatePasswordSettings) - if !ok { - x = &AccountUpdatePasswordSettings{} - } - - x.Password = PoolInputPassword.Get() - - return x -} - -func (p *poolAccountUpdatePasswordSettings) Put(x *AccountUpdatePasswordSettings) { - if x == nil { - return - } - - PoolInputPassword.Put(x.Password) - x.PasswordHash = x.PasswordHash[:0] - x.Algorithm = 0 - x.AlgorithmData = x.AlgorithmData[:0] - x.Hint = "" - for _, z := range x.Questions { - PoolSecurityQuestion.Put(z) - } - x.Questions = x.Questions[:0] - - p.pool.Put(x) -} - -var PoolAccountUpdatePasswordSettings = poolAccountUpdatePasswordSettings{} - -func (x *AccountUpdatePasswordSettings) DeepCopy(z *AccountUpdatePasswordSettings) { - if x.Password != nil { - if z.Password == nil { - z.Password = PoolInputPassword.Get() - } - x.Password.DeepCopy(z.Password) - } else { - PoolInputPassword.Put(z.Password) - z.Password = nil - } - z.PasswordHash = append(z.PasswordHash[:0], x.PasswordHash...) - z.Algorithm = x.Algorithm - z.AlgorithmData = append(z.AlgorithmData[:0], x.AlgorithmData...) - z.Hint = x.Hint - for idx := range x.Questions { - if x.Questions[idx] == nil { - continue - } - xx := PoolSecurityQuestion.Get() - x.Questions[idx].DeepCopy(xx) - z.Questions = append(z.Questions, xx) - } -} - -func (x *AccountUpdatePasswordSettings) Clone() *AccountUpdatePasswordSettings { - z := &AccountUpdatePasswordSettings{} - x.DeepCopy(z) - return z -} - -func (x *AccountUpdatePasswordSettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountUpdatePasswordSettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountUpdatePasswordSettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountUpdatePasswordSettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountUpdatePasswordSettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountUpdatePasswordSettings, x) -} - -const C_AccountRecoverPassword int64 = 1086766738 - -type poolAccountRecoverPassword struct { - pool sync.Pool -} - -func (p *poolAccountRecoverPassword) Get() *AccountRecoverPassword { - x, ok := p.pool.Get().(*AccountRecoverPassword) - if !ok { - x = &AccountRecoverPassword{} - } - - return x -} - -func (p *poolAccountRecoverPassword) Put(x *AccountRecoverPassword) { - if x == nil { - return - } - - for _, z := range x.Answers { - PoolSecurityAnswer.Put(z) - } - x.Answers = x.Answers[:0] - x.Algorithm = 0 - x.AlgorithmData = x.AlgorithmData[:0] - x.SrpID = 0 - - p.pool.Put(x) -} - -var PoolAccountRecoverPassword = poolAccountRecoverPassword{} - -func (x *AccountRecoverPassword) DeepCopy(z *AccountRecoverPassword) { - for idx := range x.Answers { - if x.Answers[idx] == nil { - continue - } - xx := PoolSecurityAnswer.Get() - x.Answers[idx].DeepCopy(xx) - z.Answers = append(z.Answers, xx) - } - z.Algorithm = x.Algorithm - z.AlgorithmData = append(z.AlgorithmData[:0], x.AlgorithmData...) - z.SrpID = x.SrpID -} - -func (x *AccountRecoverPassword) Clone() *AccountRecoverPassword { - z := &AccountRecoverPassword{} - x.DeepCopy(z) - return z -} - -func (x *AccountRecoverPassword) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountRecoverPassword) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountRecoverPassword) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountRecoverPassword) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountRecoverPassword) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountRecoverPassword, x) -} - -const C_AccountGetTeams int64 = 2881489378 - -type poolAccountGetTeams struct { - pool sync.Pool -} - -func (p *poolAccountGetTeams) Get() *AccountGetTeams { - x, ok := p.pool.Get().(*AccountGetTeams) - if !ok { - x = &AccountGetTeams{} - } - - return x -} - -func (p *poolAccountGetTeams) Put(x *AccountGetTeams) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolAccountGetTeams = poolAccountGetTeams{} - -func (x *AccountGetTeams) DeepCopy(z *AccountGetTeams) { -} - -func (x *AccountGetTeams) Clone() *AccountGetTeams { - z := &AccountGetTeams{} - x.DeepCopy(z) - return z -} - -func (x *AccountGetTeams) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountGetTeams) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountGetTeams) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountGetTeams) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountGetTeams) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountGetTeams, x) -} - -const C_AccountPasswordSettings int64 = 3362978866 - -type poolAccountPasswordSettings struct { - pool sync.Pool -} - -func (p *poolAccountPasswordSettings) Get() *AccountPasswordSettings { - x, ok := p.pool.Get().(*AccountPasswordSettings) - if !ok { - x = &AccountPasswordSettings{} - } - - return x -} - -func (p *poolAccountPasswordSettings) Put(x *AccountPasswordSettings) { - if x == nil { - return - } - - x.Hint = "" - for _, z := range x.Questions { - PoolRecoveryQuestion.Put(z) - } - x.Questions = x.Questions[:0] - - p.pool.Put(x) -} - -var PoolAccountPasswordSettings = poolAccountPasswordSettings{} - -func (x *AccountPasswordSettings) DeepCopy(z *AccountPasswordSettings) { - z.Hint = x.Hint - for idx := range x.Questions { - if x.Questions[idx] == nil { - continue - } - xx := PoolRecoveryQuestion.Get() - x.Questions[idx].DeepCopy(xx) - z.Questions = append(z.Questions, xx) - } -} - -func (x *AccountPasswordSettings) Clone() *AccountPasswordSettings { - z := &AccountPasswordSettings{} - x.DeepCopy(z) - return z -} - -func (x *AccountPasswordSettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountPasswordSettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountPasswordSettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountPasswordSettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountPasswordSettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountPasswordSettings, x) -} - -const C_SecurityQuestions int64 = 1797596734 - -type poolSecurityQuestions struct { - pool sync.Pool -} - -func (p *poolSecurityQuestions) Get() *SecurityQuestions { - x, ok := p.pool.Get().(*SecurityQuestions) - if !ok { - x = &SecurityQuestions{} - } - - return x -} - -func (p *poolSecurityQuestions) Put(x *SecurityQuestions) { - if x == nil { - return - } - - for _, z := range x.Questions { - PoolSecurityQuestion.Put(z) - } - x.Questions = x.Questions[:0] - - p.pool.Put(x) -} - -var PoolSecurityQuestions = poolSecurityQuestions{} - -func (x *SecurityQuestions) DeepCopy(z *SecurityQuestions) { - for idx := range x.Questions { - if x.Questions[idx] == nil { - continue - } - xx := PoolSecurityQuestion.Get() - x.Questions[idx].DeepCopy(xx) - z.Questions = append(z.Questions, xx) - } -} - -func (x *SecurityQuestions) Clone() *SecurityQuestions { - z := &SecurityQuestions{} - x.DeepCopy(z) - return z -} - -func (x *SecurityQuestions) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SecurityQuestions) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SecurityQuestions) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SecurityQuestions) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SecurityQuestions) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SecurityQuestions, x) -} - -const C_RecoveryQuestion int64 = 1697591959 - -type poolRecoveryQuestion struct { - pool sync.Pool -} - -func (p *poolRecoveryQuestion) Get() *RecoveryQuestion { - x, ok := p.pool.Get().(*RecoveryQuestion) - if !ok { - x = &RecoveryQuestion{} - } - - return x -} - -func (p *poolRecoveryQuestion) Put(x *RecoveryQuestion) { - if x == nil { - return - } - - x.ID = 0 - x.Text = "" - - p.pool.Put(x) -} - -var PoolRecoveryQuestion = poolRecoveryQuestion{} - -func (x *RecoveryQuestion) DeepCopy(z *RecoveryQuestion) { - z.ID = x.ID - z.Text = x.Text -} - -func (x *RecoveryQuestion) Clone() *RecoveryQuestion { - z := &RecoveryQuestion{} - x.DeepCopy(z) - return z -} - -func (x *RecoveryQuestion) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *RecoveryQuestion) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *RecoveryQuestion) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *RecoveryQuestion) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *RecoveryQuestion) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_RecoveryQuestion, x) -} - -const C_SecurityQuestion int64 = 1092467205 - -type poolSecurityQuestion struct { - pool sync.Pool -} - -func (p *poolSecurityQuestion) Get() *SecurityQuestion { - x, ok := p.pool.Get().(*SecurityQuestion) - if !ok { - x = &SecurityQuestion{} - } - - return x -} - -func (p *poolSecurityQuestion) Put(x *SecurityQuestion) { - if x == nil { - return - } - - x.ID = 0 - x.Text = "" - x.Answer = "" - - p.pool.Put(x) -} - -var PoolSecurityQuestion = poolSecurityQuestion{} - -func (x *SecurityQuestion) DeepCopy(z *SecurityQuestion) { - z.ID = x.ID - z.Text = x.Text - z.Answer = x.Answer -} - -func (x *SecurityQuestion) Clone() *SecurityQuestion { - z := &SecurityQuestion{} - x.DeepCopy(z) - return z -} - -func (x *SecurityQuestion) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SecurityQuestion) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SecurityQuestion) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SecurityQuestion) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SecurityQuestion) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SecurityQuestion, x) -} - -const C_SecurityAnswer int64 = 1989228797 - -type poolSecurityAnswer struct { - pool sync.Pool -} - -func (p *poolSecurityAnswer) Get() *SecurityAnswer { - x, ok := p.pool.Get().(*SecurityAnswer) - if !ok { - x = &SecurityAnswer{} - } - - return x -} - -func (p *poolSecurityAnswer) Put(x *SecurityAnswer) { - if x == nil { - return - } - - x.QuestionID = 0 - x.Answer = "" - - p.pool.Put(x) -} - -var PoolSecurityAnswer = poolSecurityAnswer{} - -func (x *SecurityAnswer) DeepCopy(z *SecurityAnswer) { - z.QuestionID = x.QuestionID - z.Answer = x.Answer -} - -func (x *SecurityAnswer) Clone() *SecurityAnswer { - z := &SecurityAnswer{} - x.DeepCopy(z) - return z -} - -func (x *SecurityAnswer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SecurityAnswer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SecurityAnswer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SecurityAnswer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SecurityAnswer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SecurityAnswer, x) -} - -const C_AccountPassword int64 = 4178767656 - -type poolAccountPassword struct { - pool sync.Pool -} - -func (p *poolAccountPassword) Get() *AccountPassword { - x, ok := p.pool.Get().(*AccountPassword) - if !ok { - x = &AccountPassword{} - } - - return x -} - -func (p *poolAccountPassword) Put(x *AccountPassword) { - if x == nil { - return - } - - x.HasPassword = false - x.Hint = "" - x.Algorithm = 0 - x.AlgorithmData = x.AlgorithmData[:0] - x.SrpB = x.SrpB[:0] - x.RandomData = x.RandomData[:0] - x.SrpID = 0 - for _, z := range x.Questions { - PoolRecoveryQuestion.Put(z) - } - x.Questions = x.Questions[:0] - - p.pool.Put(x) -} - -var PoolAccountPassword = poolAccountPassword{} - -func (x *AccountPassword) DeepCopy(z *AccountPassword) { - z.HasPassword = x.HasPassword - z.Hint = x.Hint - z.Algorithm = x.Algorithm - z.AlgorithmData = append(z.AlgorithmData[:0], x.AlgorithmData...) - z.SrpB = append(z.SrpB[:0], x.SrpB...) - z.RandomData = append(z.RandomData[:0], x.RandomData...) - z.SrpID = x.SrpID - for idx := range x.Questions { - if x.Questions[idx] == nil { - continue - } - xx := PoolRecoveryQuestion.Get() - x.Questions[idx].DeepCopy(xx) - z.Questions = append(z.Questions, xx) - } -} - -func (x *AccountPassword) Clone() *AccountPassword { - z := &AccountPassword{} - x.DeepCopy(z) - return z -} - -func (x *AccountPassword) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountPassword) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountPassword) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountPassword) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountPassword) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountPassword, x) -} - -const C_AccountAuthorizations int64 = 1092320500 - -type poolAccountAuthorizations struct { - pool sync.Pool -} - -func (p *poolAccountAuthorizations) Get() *AccountAuthorizations { - x, ok := p.pool.Get().(*AccountAuthorizations) - if !ok { - x = &AccountAuthorizations{} - } - - return x -} - -func (p *poolAccountAuthorizations) Put(x *AccountAuthorizations) { - if x == nil { - return - } - - for _, z := range x.Authorizations { - PoolAccountAuthorization.Put(z) - } - x.Authorizations = x.Authorizations[:0] - - p.pool.Put(x) -} - -var PoolAccountAuthorizations = poolAccountAuthorizations{} - -func (x *AccountAuthorizations) DeepCopy(z *AccountAuthorizations) { - for idx := range x.Authorizations { - if x.Authorizations[idx] == nil { - continue - } - xx := PoolAccountAuthorization.Get() - x.Authorizations[idx].DeepCopy(xx) - z.Authorizations = append(z.Authorizations, xx) - } -} - -func (x *AccountAuthorizations) Clone() *AccountAuthorizations { - z := &AccountAuthorizations{} - x.DeepCopy(z) - return z -} - -func (x *AccountAuthorizations) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountAuthorizations) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountAuthorizations) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountAuthorizations) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountAuthorizations) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountAuthorizations, x) -} - -const C_AccountAuthorization int64 = 275571966 - -type poolAccountAuthorization struct { - pool sync.Pool -} - -func (p *poolAccountAuthorization) Get() *AccountAuthorization { - x, ok := p.pool.Get().(*AccountAuthorization) - if !ok { - x = &AccountAuthorization{} - } - - return x -} - -func (p *poolAccountAuthorization) Put(x *AccountAuthorization) { - if x == nil { - return - } - - x.AuthID = 0 - x.Model = "" - x.AppVersion = "" - x.SystemVersion = "" - x.LangCode = "" - x.CreatedAt = 0 - x.ActiveAt = 0 - x.ClientIP = "" - x.LastAccess = 0 - - p.pool.Put(x) -} - -var PoolAccountAuthorization = poolAccountAuthorization{} - -func (x *AccountAuthorization) DeepCopy(z *AccountAuthorization) { - z.AuthID = x.AuthID - z.Model = x.Model - z.AppVersion = x.AppVersion - z.SystemVersion = x.SystemVersion - z.LangCode = x.LangCode - z.CreatedAt = x.CreatedAt - z.ActiveAt = x.ActiveAt - z.ClientIP = x.ClientIP - z.LastAccess = x.LastAccess -} - -func (x *AccountAuthorization) Clone() *AccountAuthorization { - z := &AccountAuthorization{} - x.DeepCopy(z) - return z -} - -func (x *AccountAuthorization) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountAuthorization) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountAuthorization) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountAuthorization) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountAuthorization) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountAuthorization, x) -} - -const C_AccountPrivacyRules int64 = 3802018092 - -type poolAccountPrivacyRules struct { - pool sync.Pool -} - -func (p *poolAccountPrivacyRules) Get() *AccountPrivacyRules { - x, ok := p.pool.Get().(*AccountPrivacyRules) - if !ok { - x = &AccountPrivacyRules{} - } - - return x -} - -func (p *poolAccountPrivacyRules) Put(x *AccountPrivacyRules) { - if x == nil { - return - } - - for _, z := range x.Rules { - PoolPrivacyRule.Put(z) - } - x.Rules = x.Rules[:0] - - p.pool.Put(x) -} - -var PoolAccountPrivacyRules = poolAccountPrivacyRules{} - -func (x *AccountPrivacyRules) DeepCopy(z *AccountPrivacyRules) { - for idx := range x.Rules { - if x.Rules[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.Rules[idx].DeepCopy(xx) - z.Rules = append(z.Rules, xx) - } -} - -func (x *AccountPrivacyRules) Clone() *AccountPrivacyRules { - z := &AccountPrivacyRules{} - x.DeepCopy(z) - return z -} - -func (x *AccountPrivacyRules) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AccountPrivacyRules) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AccountPrivacyRules) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AccountPrivacyRules) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AccountPrivacyRules) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AccountPrivacyRules, x) -} - -func init() { - registry.RegisterConstructor(2016882075, "AccountSetNotifySettings") - registry.RegisterConstructor(477008681, "AccountGetNotifySettings") - registry.RegisterConstructor(946059841, "AccountRegisterDevice") - registry.RegisterConstructor(3981251588, "AccountUnregisterDevice") - registry.RegisterConstructor(3725499887, "AccountUpdateProfile") - registry.RegisterConstructor(1501406413, "AccountCheckUsername") - registry.RegisterConstructor(1477164344, "AccountUpdateUsername") - registry.RegisterConstructor(1222469957, "AccountUploadPhoto") - registry.RegisterConstructor(406174115, "AccountUpdatePhoto") - registry.RegisterConstructor(46761477, "AccountSetWebPhoto") - registry.RegisterConstructor(3728692172, "AccountRemovePhoto") - registry.RegisterConstructor(1389121902, "AccountSendChangePhoneCode") - registry.RegisterConstructor(328900044, "AccountSendVerifyPhoneCode") - registry.RegisterConstructor(3140772691, "AccountResendVerifyPhoneCode") - registry.RegisterConstructor(4285969474, "AccountChangePhone") - registry.RegisterConstructor(846661545, "AccountDelete") - registry.RegisterConstructor(1599585002, "AccountSetPrivacy") - registry.RegisterConstructor(1897044856, "AccountGetPrivacy") - registry.RegisterConstructor(2112646192, "AccountGetAuthorizations") - registry.RegisterConstructor(1045069116, "AccountResetAuthorization") - registry.RegisterConstructor(666864933, "AccountUpdateStatus") - registry.RegisterConstructor(2015777242, "AccountSetLang") - registry.RegisterConstructor(1702207851, "AccountGetPassword") - registry.RegisterConstructor(2052309739, "AccountGetPasswordSettings") - registry.RegisterConstructor(3193945896, "AccountUpdatePasswordSettings") - registry.RegisterConstructor(1086766738, "AccountRecoverPassword") - registry.RegisterConstructor(2881489378, "AccountGetTeams") - registry.RegisterConstructor(3362978866, "AccountPasswordSettings") - registry.RegisterConstructor(1797596734, "SecurityQuestions") - registry.RegisterConstructor(1697591959, "RecoveryQuestion") - registry.RegisterConstructor(1092467205, "SecurityQuestion") - registry.RegisterConstructor(1989228797, "SecurityAnswer") - registry.RegisterConstructor(4178767656, "AccountPassword") - registry.RegisterConstructor(1092320500, "AccountAuthorizations") - registry.RegisterConstructor(275571966, "AccountAuthorization") - registry.RegisterConstructor(3802018092, "AccountPrivacyRules") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/admin.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/admin.pb.go deleted file mode 100644 index f32e8703..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/admin.pb.go +++ /dev/null @@ -1,2817 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: admin.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// AdminPrivilege -type AdminPrivilege int32 - -const ( - AdminPrivilege_PrivilegeNone AdminPrivilege = 0 - AdminPrivilege_PrivilegeAdmin AdminPrivilege = 1 - AdminPrivilege_PrivilegeSuperAdmin AdminPrivilege = 2 -) - -// Enum value maps for AdminPrivilege. -var ( - AdminPrivilege_name = map[int32]string{ - 0: "PrivilegeNone", - 1: "PrivilegeAdmin", - 2: "PrivilegeSuperAdmin", - } - AdminPrivilege_value = map[string]int32{ - "PrivilegeNone": 0, - "PrivilegeAdmin": 1, - "PrivilegeSuperAdmin": 2, - } -) - -func (x AdminPrivilege) Enum() *AdminPrivilege { - p := new(AdminPrivilege) - *p = x - return p -} - -func (x AdminPrivilege) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (AdminPrivilege) Descriptor() protoreflect.EnumDescriptor { - return file_admin_proto_enumTypes[0].Descriptor() -} - -func (AdminPrivilege) Type() protoreflect.EnumType { - return &file_admin_proto_enumTypes[0] -} - -func (x AdminPrivilege) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use AdminPrivilege.Descriptor instead. -func (AdminPrivilege) EnumDescriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{0} -} - -// PushProviderType -type PushProviderType int32 - -const ( - PushProviderType_PushProviderUnknown PushProviderType = 0 - PushProviderType_PushProviderFirebase PushProviderType = 1 - PushProviderType_PushProviderApple PushProviderType = 2 - PushProviderType_PushProviderPushKit PushProviderType = 3 -) - -// Enum value maps for PushProviderType. -var ( - PushProviderType_name = map[int32]string{ - 0: "PushProviderUnknown", - 1: "PushProviderFirebase", - 2: "PushProviderApple", - 3: "PushProviderPushKit", - } - PushProviderType_value = map[string]int32{ - "PushProviderUnknown": 0, - "PushProviderFirebase": 1, - "PushProviderApple": 2, - "PushProviderPushKit": 3, - } -) - -func (x PushProviderType) Enum() *PushProviderType { - p := new(PushProviderType) - *p = x - return p -} - -func (x PushProviderType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PushProviderType) Descriptor() protoreflect.EnumDescriptor { - return file_admin_proto_enumTypes[1].Descriptor() -} - -func (PushProviderType) Type() protoreflect.EnumType { - return &file_admin_proto_enumTypes[1] -} - -func (x PushProviderType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PushProviderType.Descriptor instead. -func (PushProviderType) EnumDescriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{1} -} - -// AdminBroadcastMessage -type AdminBroadcastMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Body string `protobuf:"bytes,1,opt,name=Body,proto3" json:"Body,omitempty"` - ReceiverIDs []int64 `protobuf:"varint,2,rep,packed,name=ReceiverIDs,proto3" json:"ReceiverIDs,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,3,rep,name=Entities,proto3" json:"Entities,omitempty"` - MediaType InputMediaType `protobuf:"varint,4,opt,name=MediaType,proto3,enum=msg.InputMediaType" json:"MediaType,omitempty"` - MediaData []byte `protobuf:"bytes,5,opt,name=MediaData,proto3" json:"MediaData,omitempty"` -} - -func (x *AdminBroadcastMessage) Reset() { - *x = AdminBroadcastMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminBroadcastMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminBroadcastMessage) ProtoMessage() {} - -func (x *AdminBroadcastMessage) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminBroadcastMessage.ProtoReflect.Descriptor instead. -func (*AdminBroadcastMessage) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{0} -} - -func (x *AdminBroadcastMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *AdminBroadcastMessage) GetReceiverIDs() []int64 { - if x != nil { - return x.ReceiverIDs - } - return nil -} - -func (x *AdminBroadcastMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *AdminBroadcastMessage) GetMediaType() InputMediaType { - if x != nil { - return x.MediaType - } - return InputMediaType_InputMediaTypeEmpty -} - -func (x *AdminBroadcastMessage) GetMediaData() []byte { - if x != nil { - return x.MediaData - } - return nil -} - -// AdminSetWelcomeMessage -// @Function -// @Return: Bool -type AdminSetWelcomeMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - Lang string `protobuf:"bytes,2,opt,name=Lang,proto3" json:"Lang,omitempty"` - Template string `protobuf:"bytes,3,opt,name=Template,proto3" json:"Template,omitempty"` -} - -func (x *AdminSetWelcomeMessage) Reset() { - *x = AdminSetWelcomeMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminSetWelcomeMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminSetWelcomeMessage) ProtoMessage() {} - -func (x *AdminSetWelcomeMessage) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminSetWelcomeMessage.ProtoReflect.Descriptor instead. -func (*AdminSetWelcomeMessage) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{1} -} - -func (x *AdminSetWelcomeMessage) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminSetWelcomeMessage) GetLang() string { - if x != nil { - return x.Lang - } - return "" -} - -func (x *AdminSetWelcomeMessage) GetTemplate() string { - if x != nil { - return x.Template - } - return "" -} - -// AdminGetWelcomeMessage -// @Function -// @Return: WelcomeMessagesMany -type AdminGetWelcomeMessages struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` -} - -func (x *AdminGetWelcomeMessages) Reset() { - *x = AdminGetWelcomeMessages{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminGetWelcomeMessages) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminGetWelcomeMessages) ProtoMessage() {} - -func (x *AdminGetWelcomeMessages) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminGetWelcomeMessages.ProtoReflect.Descriptor instead. -func (*AdminGetWelcomeMessages) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{2} -} - -func (x *AdminGetWelcomeMessages) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -// AdminDeleteWelcomeMessage -// @Function -// @Return: Bool -type AdminDeleteWelcomeMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - Lang string `protobuf:"bytes,2,opt,name=Lang,proto3" json:"Lang,omitempty"` -} - -func (x *AdminDeleteWelcomeMessage) Reset() { - *x = AdminDeleteWelcomeMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminDeleteWelcomeMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminDeleteWelcomeMessage) ProtoMessage() {} - -func (x *AdminDeleteWelcomeMessage) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminDeleteWelcomeMessage.ProtoReflect.Descriptor instead. -func (*AdminDeleteWelcomeMessage) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{3} -} - -func (x *AdminDeleteWelcomeMessage) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminDeleteWelcomeMessage) GetLang() string { - if x != nil { - return x.Lang - } - return "" -} - -// AdminSetPushProvider -// @Function -// @Return: Bool -type AdminSetPushProvider struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - Provider *PushProvider `protobuf:"bytes,2,opt,name=Provider,proto3" json:"Provider,omitempty"` -} - -func (x *AdminSetPushProvider) Reset() { - *x = AdminSetPushProvider{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminSetPushProvider) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminSetPushProvider) ProtoMessage() {} - -func (x *AdminSetPushProvider) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminSetPushProvider.ProtoReflect.Descriptor instead. -func (*AdminSetPushProvider) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{4} -} - -func (x *AdminSetPushProvider) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminSetPushProvider) GetProvider() *PushProvider { - if x != nil { - return x.Provider - } - return nil -} - -// AdminGetPushProvider -// @Function -// @Return: PushProvidersMany -type AdminGetPushProviders struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` -} - -func (x *AdminGetPushProviders) Reset() { - *x = AdminGetPushProviders{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminGetPushProviders) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminGetPushProviders) ProtoMessage() {} - -func (x *AdminGetPushProviders) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminGetPushProviders.ProtoReflect.Descriptor instead. -func (*AdminGetPushProviders) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{5} -} - -func (x *AdminGetPushProviders) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -// AdminDeletePushProvider -// @Function -// @Return: Bool -type AdminDeletePushProvider struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Type PushProviderType `protobuf:"varint,3,opt,name=Type,proto3,enum=msg.PushProviderType" json:"Type,omitempty"` -} - -func (x *AdminDeletePushProvider) Reset() { - *x = AdminDeletePushProvider{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminDeletePushProvider) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminDeletePushProvider) ProtoMessage() {} - -func (x *AdminDeletePushProvider) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminDeletePushProvider.ProtoReflect.Descriptor instead. -func (*AdminDeletePushProvider) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{6} -} - -func (x *AdminDeletePushProvider) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminDeletePushProvider) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *AdminDeletePushProvider) GetType() PushProviderType { - if x != nil { - return x.Type - } - return PushProviderType_PushProviderUnknown -} - -// AdminSetVersion -// @Function -// @Return: Bool -type AdminSetVersion struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - Version *Version `protobuf:"bytes,2,opt,name=Version,proto3" json:"Version,omitempty"` -} - -func (x *AdminSetVersion) Reset() { - *x = AdminSetVersion{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminSetVersion) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminSetVersion) ProtoMessage() {} - -func (x *AdminSetVersion) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminSetVersion.ProtoReflect.Descriptor instead. -func (*AdminSetVersion) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{7} -} - -func (x *AdminSetVersion) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminSetVersion) GetVersion() *Version { - if x != nil { - return x.Version - } - return nil -} - -// AdminGetVersions -// @Function -// @Return: VersionsMany -type AdminGetVersions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` -} - -func (x *AdminGetVersions) Reset() { - *x = AdminGetVersions{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminGetVersions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminGetVersions) ProtoMessage() {} - -func (x *AdminGetVersions) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminGetVersions.ProtoReflect.Descriptor instead. -func (*AdminGetVersions) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{8} -} - -func (x *AdminGetVersions) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -// AdminSetStorageNode -// @Function -// @Return: Bool -type AdminSetStorageNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,10,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - ClusterID int32 `protobuf:"varint,1,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"` - DSN string `protobuf:"bytes,2,opt,name=DSN,proto3" json:"DSN,omitempty"` - Type string `protobuf:"bytes,3,opt,name=Type,proto3" json:"Type,omitempty"` - Location string `protobuf:"bytes,4,opt,name=Location,proto3" json:"Location,omitempty"` - Archive bool `protobuf:"varint,5,opt,name=Archive,proto3" json:"Archive,omitempty"` -} - -func (x *AdminSetStorageNode) Reset() { - *x = AdminSetStorageNode{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminSetStorageNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminSetStorageNode) ProtoMessage() {} - -func (x *AdminSetStorageNode) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminSetStorageNode.ProtoReflect.Descriptor instead. -func (*AdminSetStorageNode) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{9} -} - -func (x *AdminSetStorageNode) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminSetStorageNode) GetClusterID() int32 { - if x != nil { - return x.ClusterID - } - return 0 -} - -func (x *AdminSetStorageNode) GetDSN() string { - if x != nil { - return x.DSN - } - return "" -} - -func (x *AdminSetStorageNode) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *AdminSetStorageNode) GetLocation() string { - if x != nil { - return x.Location - } - return "" -} - -func (x *AdminSetStorageNode) GetArchive() bool { - if x != nil { - return x.Archive - } - return false -} - -// AdminGetStorageNode -// @Function -// @Return: StorageNode -type AdminGetStorageNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,10,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - ClusterID int32 `protobuf:"varint,1,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"` -} - -func (x *AdminGetStorageNode) Reset() { - *x = AdminGetStorageNode{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminGetStorageNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminGetStorageNode) ProtoMessage() {} - -func (x *AdminGetStorageNode) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminGetStorageNode.ProtoReflect.Descriptor instead. -func (*AdminGetStorageNode) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{10} -} - -func (x *AdminGetStorageNode) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminGetStorageNode) GetClusterID() int32 { - if x != nil { - return x.ClusterID - } - return 0 -} - -// AdminGetStorageNodes -// @Function -// @Return: StorageNode -type AdminGetStorageNodes struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,10,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` -} - -func (x *AdminGetStorageNodes) Reset() { - *x = AdminGetStorageNodes{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminGetStorageNodes) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminGetStorageNodes) ProtoMessage() {} - -func (x *AdminGetStorageNodes) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminGetStorageNodes.ProtoReflect.Descriptor instead. -func (*AdminGetStorageNodes) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{11} -} - -func (x *AdminGetStorageNodes) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -// AdminAddBannedSubnet -// @Function -// @Return: Bool -type AdminAddBannedSubnet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,10,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - CIDR []string `protobuf:"bytes,1,rep,name=CIDR,proto3" json:"CIDR,omitempty"` -} - -func (x *AdminAddBannedSubnet) Reset() { - *x = AdminAddBannedSubnet{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminAddBannedSubnet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminAddBannedSubnet) ProtoMessage() {} - -func (x *AdminAddBannedSubnet) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminAddBannedSubnet.ProtoReflect.Descriptor instead. -func (*AdminAddBannedSubnet) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{12} -} - -func (x *AdminAddBannedSubnet) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminAddBannedSubnet) GetCIDR() []string { - if x != nil { - return x.CIDR - } - return nil -} - -// AdminDeleteBanedSubnet -// @Function -// @Return: Bool -type AdminDeleteBannedSubnet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,10,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - CIDR []string `protobuf:"bytes,1,rep,name=CIDR,proto3" json:"CIDR,omitempty"` -} - -func (x *AdminDeleteBannedSubnet) Reset() { - *x = AdminDeleteBannedSubnet{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminDeleteBannedSubnet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminDeleteBannedSubnet) ProtoMessage() {} - -func (x *AdminDeleteBannedSubnet) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminDeleteBannedSubnet.ProtoReflect.Descriptor instead. -func (*AdminDeleteBannedSubnet) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{13} -} - -func (x *AdminDeleteBannedSubnet) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminDeleteBannedSubnet) GetCIDR() []string { - if x != nil { - return x.CIDR - } - return nil -} - -// AdminGetBannedSubnets -// @Function -// @Return: BannedSubnets -type AdminGetBannedSubnets struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,10,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` -} - -func (x *AdminGetBannedSubnets) Reset() { - *x = AdminGetBannedSubnets{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminGetBannedSubnets) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminGetBannedSubnets) ProtoMessage() {} - -func (x *AdminGetBannedSubnets) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminGetBannedSubnets.ProtoReflect.Descriptor instead. -func (*AdminGetBannedSubnets) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{14} -} - -func (x *AdminGetBannedSubnets) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -// BannedSubnets -type BannedSubnets struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Subnets []string `protobuf:"bytes,1,rep,name=Subnets,proto3" json:"Subnets,omitempty"` -} - -func (x *BannedSubnets) Reset() { - *x = BannedSubnets{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BannedSubnets) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BannedSubnets) ProtoMessage() {} - -func (x *BannedSubnets) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BannedSubnets.ProtoReflect.Descriptor instead. -func (*BannedSubnets) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{15} -} - -func (x *BannedSubnets) GetSubnets() []string { - if x != nil { - return x.Subnets - } - return nil -} - -// AdminSetToken -// @Function -// @Return: AdminToken -type AdminSetToken struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - Privilege AdminPrivilege `protobuf:"varint,2,opt,name=Privilege,proto3,enum=msg.AdminPrivilege" json:"Privilege,omitempty"` -} - -func (x *AdminSetToken) Reset() { - *x = AdminSetToken{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminSetToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminSetToken) ProtoMessage() {} - -func (x *AdminSetToken) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminSetToken.ProtoReflect.Descriptor instead. -func (*AdminSetToken) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{16} -} - -func (x *AdminSetToken) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminSetToken) GetPrivilege() AdminPrivilege { - if x != nil { - return x.Privilege - } - return AdminPrivilege_PrivilegeNone -} - -// AdminDeleteToken -// @Function -// @Return: Bool -type AdminDeleteToken struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - DeletedToken string `protobuf:"bytes,2,opt,name=DeletedToken,proto3" json:"DeletedToken,omitempty"` -} - -func (x *AdminDeleteToken) Reset() { - *x = AdminDeleteToken{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminDeleteToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminDeleteToken) ProtoMessage() {} - -func (x *AdminDeleteToken) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminDeleteToken.ProtoReflect.Descriptor instead. -func (*AdminDeleteToken) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{17} -} - -func (x *AdminDeleteToken) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminDeleteToken) GetDeletedToken() string { - if x != nil { - return x.DeletedToken - } - return "" -} - -// AdminReserveUsername -// @Function -// @Return: Bool -type AdminReserveUsername struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - Usernames []string `protobuf:"bytes,2,rep,name=Usernames,proto3" json:"Usernames,omitempty"` - Delete bool `protobuf:"varint,3,opt,name=Delete,proto3" json:"Delete,omitempty"` -} - -func (x *AdminReserveUsername) Reset() { - *x = AdminReserveUsername{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminReserveUsername) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminReserveUsername) ProtoMessage() {} - -func (x *AdminReserveUsername) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminReserveUsername.ProtoReflect.Descriptor instead. -func (*AdminReserveUsername) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{18} -} - -func (x *AdminReserveUsername) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminReserveUsername) GetUsernames() []string { - if x != nil { - return x.Usernames - } - return nil -} - -func (x *AdminReserveUsername) GetDelete() bool { - if x != nil { - return x.Delete - } - return false -} - -// AdminGetReservedUsernames -// @Function -// @Return: ReservedUsername -type AdminGetReservedUsernames struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` -} - -func (x *AdminGetReservedUsernames) Reset() { - *x = AdminGetReservedUsernames{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminGetReservedUsernames) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminGetReservedUsernames) ProtoMessage() {} - -func (x *AdminGetReservedUsernames) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminGetReservedUsernames.ProtoReflect.Descriptor instead. -func (*AdminGetReservedUsernames) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{19} -} - -func (x *AdminGetReservedUsernames) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -// AdminTeamCreate -// @Function -// @Return: Team -type AdminTeamCreate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,10,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - AccessToken string `protobuf:"bytes,1,opt,name=AccessToken,proto3" json:"AccessToken,omitempty"` - Capacity int32 `protobuf:"varint,2,opt,name=Capacity,proto3" json:"Capacity,omitempty"` // maximum number of team members - ExpireDate int64 `protobuf:"varint,3,opt,name=ExpireDate,proto3" json:"ExpireDate,omitempty"` // license expire time - Community bool `protobuf:"varint,4,opt,name=Community,proto3" json:"Community,omitempty"` // if team supports community users, send messages to team members - Title string `protobuf:"bytes,5,opt,name=Title,proto3" json:"Title,omitempty"` - CreatorID int64 `protobuf:"varint,6,opt,name=CreatorID,proto3" json:"CreatorID,omitempty"` -} - -func (x *AdminTeamCreate) Reset() { - *x = AdminTeamCreate{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminTeamCreate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminTeamCreate) ProtoMessage() {} - -func (x *AdminTeamCreate) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminTeamCreate.ProtoReflect.Descriptor instead. -func (*AdminTeamCreate) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{20} -} - -func (x *AdminTeamCreate) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *AdminTeamCreate) GetAccessToken() string { - if x != nil { - return x.AccessToken - } - return "" -} - -func (x *AdminTeamCreate) GetCapacity() int32 { - if x != nil { - return x.Capacity - } - return 0 -} - -func (x *AdminTeamCreate) GetExpireDate() int64 { - if x != nil { - return x.ExpireDate - } - return 0 -} - -func (x *AdminTeamCreate) GetCommunity() bool { - if x != nil { - return x.Community - } - return false -} - -func (x *AdminTeamCreate) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *AdminTeamCreate) GetCreatorID() int64 { - if x != nil { - return x.CreatorID - } - return 0 -} - -// AdminClusterInfo -// @Function -// @Returns: rony.Edges -type AdminGetClusterInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ReplicaSet uint64 `protobuf:"fixed64,1,opt,name=ReplicaSet,proto3" json:"ReplicaSet,omitempty"` -} - -func (x *AdminGetClusterInfo) Reset() { - *x = AdminGetClusterInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminGetClusterInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminGetClusterInfo) ProtoMessage() {} - -func (x *AdminGetClusterInfo) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminGetClusterInfo.ProtoReflect.Descriptor instead. -func (*AdminGetClusterInfo) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{21} -} - -func (x *AdminGetClusterInfo) GetReplicaSet() uint64 { - if x != nil { - return x.ReplicaSet - } - return 0 -} - -// StorageNode -type StorageNode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Archive bool `protobuf:"varint,1,opt,name=Archive,proto3" json:"Archive,omitempty"` - ClusterID int32 `protobuf:"varint,2,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"` - Location string `protobuf:"bytes,3,opt,name=Location,proto3" json:"Location,omitempty"` - DSN string `protobuf:"bytes,4,opt,name=DSN,proto3" json:"DSN,omitempty"` - Type string `protobuf:"bytes,5,opt,name=Type,proto3" json:"Type,omitempty"` -} - -func (x *StorageNode) Reset() { - *x = StorageNode{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StorageNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StorageNode) ProtoMessage() {} - -func (x *StorageNode) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StorageNode.ProtoReflect.Descriptor instead. -func (*StorageNode) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{22} -} - -func (x *StorageNode) GetArchive() bool { - if x != nil { - return x.Archive - } - return false -} - -func (x *StorageNode) GetClusterID() int32 { - if x != nil { - return x.ClusterID - } - return 0 -} - -func (x *StorageNode) GetLocation() string { - if x != nil { - return x.Location - } - return "" -} - -func (x *StorageNode) GetDSN() string { - if x != nil { - return x.DSN - } - return "" -} - -func (x *StorageNode) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -// StorageNodeMany -type StorageNodeMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Nodes []*StorageNode `protobuf:"bytes,1,rep,name=Nodes,proto3" json:"Nodes,omitempty"` - Empty bool `protobuf:"varint,2,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *StorageNodeMany) Reset() { - *x = StorageNodeMany{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StorageNodeMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StorageNodeMany) ProtoMessage() {} - -func (x *StorageNodeMany) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StorageNodeMany.ProtoReflect.Descriptor instead. -func (*StorageNodeMany) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{23} -} - -func (x *StorageNodeMany) GetNodes() []*StorageNode { - if x != nil { - return x.Nodes - } - return nil -} - -func (x *StorageNodeMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// AdminToken -type AdminToken struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Privilege AdminPrivilege `protobuf:"varint,1,opt,name=Privilege,proto3,enum=msg.AdminPrivilege" json:"Privilege,omitempty"` - Token string `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` -} - -func (x *AdminToken) Reset() { - *x = AdminToken{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AdminToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AdminToken) ProtoMessage() {} - -func (x *AdminToken) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AdminToken.ProtoReflect.Descriptor instead. -func (*AdminToken) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{24} -} - -func (x *AdminToken) GetPrivilege() AdminPrivilege { - if x != nil { - return x.Privilege - } - return AdminPrivilege_PrivilegeNone -} - -func (x *AdminToken) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -// WelcomeMessagesMany -type WelcomeMessagesMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Messages []*WelcomeMessage `protobuf:"bytes,1,rep,name=Messages,proto3" json:"Messages,omitempty"` - Count int32 `protobuf:"varint,2,opt,name=Count,proto3" json:"Count,omitempty"` -} - -func (x *WelcomeMessagesMany) Reset() { - *x = WelcomeMessagesMany{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WelcomeMessagesMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WelcomeMessagesMany) ProtoMessage() {} - -func (x *WelcomeMessagesMany) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WelcomeMessagesMany.ProtoReflect.Descriptor instead. -func (*WelcomeMessagesMany) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{25} -} - -func (x *WelcomeMessagesMany) GetMessages() []*WelcomeMessage { - if x != nil { - return x.Messages - } - return nil -} - -func (x *WelcomeMessagesMany) GetCount() int32 { - if x != nil { - return x.Count - } - return 0 -} - -// VersionsMany -type VersionsMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Versions []*Version `protobuf:"bytes,1,rep,name=Versions,proto3" json:"Versions,omitempty"` - Count int32 `protobuf:"varint,2,opt,name=Count,proto3" json:"Count,omitempty"` -} - -func (x *VersionsMany) Reset() { - *x = VersionsMany{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VersionsMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VersionsMany) ProtoMessage() {} - -func (x *VersionsMany) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use VersionsMany.ProtoReflect.Descriptor instead. -func (*VersionsMany) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{26} -} - -func (x *VersionsMany) GetVersions() []*Version { - if x != nil { - return x.Versions - } - return nil -} - -func (x *VersionsMany) GetCount() int32 { - if x != nil { - return x.Count - } - return 0 -} - -// PushProvidersMany -type PushProvidersMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Providers []*PushProvider `protobuf:"bytes,1,rep,name=Providers,proto3" json:"Providers,omitempty"` - Count int32 `protobuf:"varint,2,opt,name=Count,proto3" json:"Count,omitempty"` -} - -func (x *PushProvidersMany) Reset() { - *x = PushProvidersMany{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PushProvidersMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PushProvidersMany) ProtoMessage() {} - -func (x *PushProvidersMany) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PushProvidersMany.ProtoReflect.Descriptor instead. -func (*PushProvidersMany) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{27} -} - -func (x *PushProvidersMany) GetProviders() []*PushProvider { - if x != nil { - return x.Providers - } - return nil -} - -func (x *PushProvidersMany) GetCount() int32 { - if x != nil { - return x.Count - } - return 0 -} - -// WelcomeMessage -type WelcomeMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Lang string `protobuf:"bytes,2,opt,name=Lang,proto3" json:"Lang,omitempty"` - Template string `protobuf:"bytes,3,opt,name=Template,proto3" json:"Template,omitempty"` -} - -func (x *WelcomeMessage) Reset() { - *x = WelcomeMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WelcomeMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WelcomeMessage) ProtoMessage() {} - -func (x *WelcomeMessage) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WelcomeMessage.ProtoReflect.Descriptor instead. -func (*WelcomeMessage) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{28} -} - -func (x *WelcomeMessage) GetLang() string { - if x != nil { - return x.Lang - } - return "" -} - -func (x *WelcomeMessage) GetTemplate() string { - if x != nil { - return x.Template - } - return "" -} - -// PushProvider -type PushProvider struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - Type PushProviderType `protobuf:"varint,2,opt,name=Type,proto3,enum=msg.PushProviderType" json:"Type,omitempty"` - TestMode bool `protobuf:"varint,3,opt,name=TestMode,proto3" json:"TestMode,omitempty"` - Credentials []byte `protobuf:"bytes,4,opt,name=Credentials,proto3" json:"Credentials,omitempty"` - KeyID string `protobuf:"bytes,5,opt,name=KeyID,proto3" json:"KeyID,omitempty"` - TeamID string `protobuf:"bytes,6,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Topic string `protobuf:"bytes,7,opt,name=Topic,proto3" json:"Topic,omitempty"` -} - -func (x *PushProvider) Reset() { - *x = PushProvider{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PushProvider) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PushProvider) ProtoMessage() {} - -func (x *PushProvider) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PushProvider.ProtoReflect.Descriptor instead. -func (*PushProvider) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{29} -} - -func (x *PushProvider) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PushProvider) GetType() PushProviderType { - if x != nil { - return x.Type - } - return PushProviderType_PushProviderUnknown -} - -func (x *PushProvider) GetTestMode() bool { - if x != nil { - return x.TestMode - } - return false -} - -func (x *PushProvider) GetCredentials() []byte { - if x != nil { - return x.Credentials - } - return nil -} - -func (x *PushProvider) GetKeyID() string { - if x != nil { - return x.KeyID - } - return "" -} - -func (x *PushProvider) GetTeamID() string { - if x != nil { - return x.TeamID - } - return "" -} - -func (x *PushProvider) GetTopic() string { - if x != nil { - return x.Topic - } - return "" -} - -// AppUpdate -type Version struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Vendor string `protobuf:"bytes,1,opt,name=Vendor,proto3" json:"Vendor,omitempty"` // river android | river ios | nested android | nested ios - Stage string `protobuf:"bytes,2,opt,name=Stage,proto3" json:"Stage,omitempty"` // debug | production | test - OS string `protobuf:"bytes,3,opt,name=OS,proto3" json:"OS,omitempty"` // ios | android | mac | web | windows | linux - MinVersion string `protobuf:"bytes,4,opt,name=MinVersion,proto3" json:"MinVersion,omitempty"` - CurrentVersion string `protobuf:"bytes,5,opt,name=CurrentVersion,proto3" json:"CurrentVersion,omitempty"` - ForcedVersions []string `protobuf:"bytes,6,rep,name=ForcedVersions,proto3" json:"ForcedVersions,omitempty"` -} - -func (x *Version) Reset() { - *x = Version{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Version) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Version) ProtoMessage() {} - -func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Version.ProtoReflect.Descriptor instead. -func (*Version) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{30} -} - -func (x *Version) GetVendor() string { - if x != nil { - return x.Vendor - } - return "" -} - -func (x *Version) GetStage() string { - if x != nil { - return x.Stage - } - return "" -} - -func (x *Version) GetOS() string { - if x != nil { - return x.OS - } - return "" -} - -func (x *Version) GetMinVersion() string { - if x != nil { - return x.MinVersion - } - return "" -} - -func (x *Version) GetCurrentVersion() string { - if x != nil { - return x.CurrentVersion - } - return "" -} - -func (x *Version) GetForcedVersions() []string { - if x != nil { - return x.ForcedVersions - } - return nil -} - -// ReservedUsernames -type ReservedUsernames struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Usernames []string `protobuf:"bytes,1,rep,name=Usernames,proto3" json:"Usernames,omitempty"` - Count int32 `protobuf:"varint,2,opt,name=Count,proto3" json:"Count,omitempty"` -} - -func (x *ReservedUsernames) Reset() { - *x = ReservedUsernames{} - if protoimpl.UnsafeEnabled { - mi := &file_admin_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReservedUsernames) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReservedUsernames) ProtoMessage() {} - -func (x *ReservedUsernames) ProtoReflect() protoreflect.Message { - mi := &file_admin_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReservedUsernames.ProtoReflect.Descriptor instead. -func (*ReservedUsernames) Descriptor() ([]byte, []int) { - return file_admin_proto_rawDescGZIP(), []int{31} -} - -func (x *ReservedUsernames) GetUsernames() []string { - if x != nil { - return x.Usernames - } - return nil -} - -func (x *ReservedUsernames) GetCount() int32 { - if x != nil { - return x.Count - } - return 0 -} - -var File_admin_proto protoreflect.FileDescriptor - -var file_admin_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, - 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xce, 0x01, 0x0a, 0x15, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x42, 0x72, - 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, - 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x49, 0x44, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x72, 0x49, 0x44, 0x73, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x44, 0x61, 0x74, 0x61, 0x22, 0x6a, 0x0a, 0x16, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, - 0x74, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x61, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x4c, 0x61, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, - 0x65, 0x22, 0x3b, 0x0a, 0x17, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x47, 0x65, 0x74, 0x57, 0x65, 0x6c, - 0x63, 0x6f, 0x6d, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x51, - 0x0a, 0x19, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x57, 0x65, 0x6c, - 0x63, 0x6f, 0x6d, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12, 0x0a, - 0x04, 0x4c, 0x61, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4c, 0x61, 0x6e, - 0x67, 0x22, 0x67, 0x0a, 0x14, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x50, 0x75, 0x73, - 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2d, 0x0a, 0x08, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x52, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x22, 0x39, 0x0a, 0x15, 0x41, 0x64, - 0x6d, 0x69, 0x6e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x7a, 0x0a, 0x17, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, - 0x65, 0x22, 0x5b, 0x0a, 0x0f, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x26, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x34, - 0x0a, 0x10, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xb1, 0x01, 0x0a, 0x13, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, - 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, - 0x0a, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, - 0x44, 0x53, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x44, 0x53, 0x4e, 0x12, 0x12, - 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, - 0x0a, 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x22, 0x55, 0x0a, 0x13, 0x41, 0x64, 0x6d, 0x69, - 0x6e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, - 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x22, - 0x38, 0x0a, 0x14, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x4c, 0x0a, 0x14, 0x41, 0x64, 0x6d, - 0x69, 0x6e, 0x41, 0x64, 0x64, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x53, 0x75, 0x62, 0x6e, 0x65, - 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x49, 0x44, 0x52, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x04, 0x43, 0x49, 0x44, 0x52, 0x22, 0x4f, 0x0a, 0x17, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x53, 0x75, 0x62, 0x6e, - 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x49, 0x44, 0x52, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x04, 0x43, 0x49, 0x44, 0x52, 0x22, 0x39, 0x0a, 0x15, 0x41, 0x64, 0x6d, 0x69, - 0x6e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, - 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x22, 0x29, 0x0a, 0x0d, 0x42, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x53, 0x75, 0x62, - 0x6e, 0x65, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x53, 0x75, 0x62, 0x6e, 0x65, 0x74, 0x73, 0x22, 0x64, - 0x0a, 0x0d, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x53, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, - 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x12, 0x31, 0x0a, 0x09, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x52, 0x09, 0x50, 0x72, 0x69, 0x76, 0x69, - 0x6c, 0x65, 0x67, 0x65, 0x22, 0x58, 0x0a, 0x10, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x6e, - 0x0a, 0x14, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x55, 0x73, - 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x73, 0x65, 0x72, - 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x55, 0x73, 0x65, - 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x22, 0x3d, - 0x0a, 0x19, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xdd, 0x01, - 0x0a, 0x0f, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x54, 0x65, 0x61, 0x6d, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x20, 0x0a, - 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, - 0x1a, 0x0a, 0x08, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x08, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x45, - 0x78, 0x70, 0x69, 0x72, 0x65, 0x44, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0a, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x43, - 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, - 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, - 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x22, 0x35, 0x0a, - 0x13, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, - 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x53, - 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0a, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, - 0x61, 0x53, 0x65, 0x74, 0x22, 0x87, 0x01, 0x0a, 0x0b, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, - 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x44, 0x53, 0x4e, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x44, 0x53, 0x4e, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x22, 0x4f, - 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x6e, - 0x79, 0x12, 0x26, 0x0a, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x4e, 0x6f, - 0x64, 0x65, 0x52, 0x05, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, - 0x55, 0x0a, 0x0a, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x31, 0x0a, - 0x09, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x69, 0x76, - 0x69, 0x6c, 0x65, 0x67, 0x65, 0x52, 0x09, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x5c, 0x0a, 0x13, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, - 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x2f, 0x0a, - 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x4e, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x28, 0x0a, 0x08, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x5a, 0x0a, 0x11, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x2f, 0x0a, 0x09, 0x50, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x52, - 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x40, 0x0a, 0x0e, 0x57, 0x65, 0x6c, 0x63, 0x6f, 0x6d, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x61, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x4c, 0x61, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x22, 0xcf, 0x01, 0x0a, 0x0c, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x75, 0x73, 0x68, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, - 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x4b, 0x65, 0x79, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x4b, 0x65, 0x79, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x14, - 0x0a, 0x05, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, - 0x6f, 0x70, 0x69, 0x63, 0x22, 0xb7, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x16, 0x0a, 0x06, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x67, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x53, 0x74, 0x61, 0x67, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x4f, 0x53, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x4f, 0x53, 0x12, 0x1e, - 0x0a, 0x0a, 0x4d, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x4d, 0x69, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, - 0x0a, 0x0e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0e, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x64, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, - 0x46, 0x6f, 0x72, 0x63, 0x65, 0x64, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x47, - 0x0a, 0x11, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, - 0x73, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x2a, 0x50, 0x0a, 0x0e, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x72, 0x69, - 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, - 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x10, 0x01, - 0x12, 0x17, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x69, 0x6c, 0x65, 0x67, 0x65, 0x53, 0x75, 0x70, - 0x65, 0x72, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x10, 0x02, 0x2a, 0x75, 0x0a, 0x10, 0x50, 0x75, 0x73, - 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, - 0x13, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x55, 0x6e, 0x6b, - 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x46, 0x69, 0x72, 0x65, 0x62, 0x61, 0x73, 0x65, 0x10, 0x01, - 0x12, 0x15, 0x0a, 0x11, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x41, 0x70, 0x70, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x75, 0x73, 0x68, 0x50, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68, 0x4b, 0x69, 0x74, 0x10, 0x03, - 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_admin_proto_rawDescOnce sync.Once - file_admin_proto_rawDescData = file_admin_proto_rawDesc -) - -func file_admin_proto_rawDescGZIP() []byte { - file_admin_proto_rawDescOnce.Do(func() { - file_admin_proto_rawDescData = protoimpl.X.CompressGZIP(file_admin_proto_rawDescData) - }) - return file_admin_proto_rawDescData -} - -var file_admin_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_admin_proto_msgTypes = make([]protoimpl.MessageInfo, 32) -var file_admin_proto_goTypes = []interface{}{ - (AdminPrivilege)(0), // 0: msg.AdminPrivilege - (PushProviderType)(0), // 1: msg.PushProviderType - (*AdminBroadcastMessage)(nil), // 2: msg.AdminBroadcastMessage - (*AdminSetWelcomeMessage)(nil), // 3: msg.AdminSetWelcomeMessage - (*AdminGetWelcomeMessages)(nil), // 4: msg.AdminGetWelcomeMessages - (*AdminDeleteWelcomeMessage)(nil), // 5: msg.AdminDeleteWelcomeMessage - (*AdminSetPushProvider)(nil), // 6: msg.AdminSetPushProvider - (*AdminGetPushProviders)(nil), // 7: msg.AdminGetPushProviders - (*AdminDeletePushProvider)(nil), // 8: msg.AdminDeletePushProvider - (*AdminSetVersion)(nil), // 9: msg.AdminSetVersion - (*AdminGetVersions)(nil), // 10: msg.AdminGetVersions - (*AdminSetStorageNode)(nil), // 11: msg.AdminSetStorageNode - (*AdminGetStorageNode)(nil), // 12: msg.AdminGetStorageNode - (*AdminGetStorageNodes)(nil), // 13: msg.AdminGetStorageNodes - (*AdminAddBannedSubnet)(nil), // 14: msg.AdminAddBannedSubnet - (*AdminDeleteBannedSubnet)(nil), // 15: msg.AdminDeleteBannedSubnet - (*AdminGetBannedSubnets)(nil), // 16: msg.AdminGetBannedSubnets - (*BannedSubnets)(nil), // 17: msg.BannedSubnets - (*AdminSetToken)(nil), // 18: msg.AdminSetToken - (*AdminDeleteToken)(nil), // 19: msg.AdminDeleteToken - (*AdminReserveUsername)(nil), // 20: msg.AdminReserveUsername - (*AdminGetReservedUsernames)(nil), // 21: msg.AdminGetReservedUsernames - (*AdminTeamCreate)(nil), // 22: msg.AdminTeamCreate - (*AdminGetClusterInfo)(nil), // 23: msg.AdminGetClusterInfo - (*StorageNode)(nil), // 24: msg.StorageNode - (*StorageNodeMany)(nil), // 25: msg.StorageNodeMany - (*AdminToken)(nil), // 26: msg.AdminToken - (*WelcomeMessagesMany)(nil), // 27: msg.WelcomeMessagesMany - (*VersionsMany)(nil), // 28: msg.VersionsMany - (*PushProvidersMany)(nil), // 29: msg.PushProvidersMany - (*WelcomeMessage)(nil), // 30: msg.WelcomeMessage - (*PushProvider)(nil), // 31: msg.PushProvider - (*Version)(nil), // 32: msg.Version - (*ReservedUsernames)(nil), // 33: msg.ReservedUsernames - (*MessageEntity)(nil), // 34: msg.MessageEntity - (InputMediaType)(0), // 35: msg.InputMediaType -} -var file_admin_proto_depIdxs = []int32{ - 34, // 0: msg.AdminBroadcastMessage.Entities:type_name -> msg.MessageEntity - 35, // 1: msg.AdminBroadcastMessage.MediaType:type_name -> msg.InputMediaType - 31, // 2: msg.AdminSetPushProvider.Provider:type_name -> msg.PushProvider - 1, // 3: msg.AdminDeletePushProvider.Type:type_name -> msg.PushProviderType - 32, // 4: msg.AdminSetVersion.Version:type_name -> msg.Version - 0, // 5: msg.AdminSetToken.Privilege:type_name -> msg.AdminPrivilege - 24, // 6: msg.StorageNodeMany.Nodes:type_name -> msg.StorageNode - 0, // 7: msg.AdminToken.Privilege:type_name -> msg.AdminPrivilege - 30, // 8: msg.WelcomeMessagesMany.Messages:type_name -> msg.WelcomeMessage - 32, // 9: msg.VersionsMany.Versions:type_name -> msg.Version - 31, // 10: msg.PushProvidersMany.Providers:type_name -> msg.PushProvider - 1, // 11: msg.PushProvider.Type:type_name -> msg.PushProviderType - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name -} - -func init() { file_admin_proto_init() } -func file_admin_proto_init() { - if File_admin_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_admin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminBroadcastMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminSetWelcomeMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminGetWelcomeMessages); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminDeleteWelcomeMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminSetPushProvider); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminGetPushProviders); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminDeletePushProvider); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminSetVersion); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminGetVersions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminSetStorageNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminGetStorageNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminGetStorageNodes); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminAddBannedSubnet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminDeleteBannedSubnet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminGetBannedSubnets); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BannedSubnets); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminSetToken); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminDeleteToken); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminReserveUsername); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminGetReservedUsernames); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminTeamCreate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminGetClusterInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StorageNode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StorageNodeMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AdminToken); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WelcomeMessagesMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*VersionsMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PushProvidersMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WelcomeMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PushProvider); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Version); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_admin_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReservedUsernames); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_admin_proto_rawDesc, - NumEnums: 2, - NumMessages: 32, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_admin_proto_goTypes, - DependencyIndexes: file_admin_proto_depIdxs, - EnumInfos: file_admin_proto_enumTypes, - MessageInfos: file_admin_proto_msgTypes, - }.Build() - File_admin_proto = out.File - file_admin_proto_rawDesc = nil - file_admin_proto_goTypes = nil - file_admin_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/admin.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/admin.rony.go deleted file mode 100644 index da82cbad..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/admin.rony.go +++ /dev/null @@ -1,2051 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: admin.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_AdminBroadcastMessage int64 = 3981417409 - -type poolAdminBroadcastMessage struct { - pool sync.Pool -} - -func (p *poolAdminBroadcastMessage) Get() *AdminBroadcastMessage { - x, ok := p.pool.Get().(*AdminBroadcastMessage) - if !ok { - x = &AdminBroadcastMessage{} - } - - return x -} - -func (p *poolAdminBroadcastMessage) Put(x *AdminBroadcastMessage) { - if x == nil { - return - } - - x.Body = "" - x.ReceiverIDs = x.ReceiverIDs[:0] - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.MediaType = 0 - x.MediaData = x.MediaData[:0] - - p.pool.Put(x) -} - -var PoolAdminBroadcastMessage = poolAdminBroadcastMessage{} - -func (x *AdminBroadcastMessage) DeepCopy(z *AdminBroadcastMessage) { - z.Body = x.Body - z.ReceiverIDs = append(z.ReceiverIDs[:0], x.ReceiverIDs...) - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.MediaType = x.MediaType - z.MediaData = append(z.MediaData[:0], x.MediaData...) -} - -func (x *AdminBroadcastMessage) Clone() *AdminBroadcastMessage { - z := &AdminBroadcastMessage{} - x.DeepCopy(z) - return z -} - -func (x *AdminBroadcastMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminBroadcastMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminBroadcastMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminBroadcastMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminBroadcastMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminBroadcastMessage, x) -} - -const C_AdminSetWelcomeMessage int64 = 1149591874 - -type poolAdminSetWelcomeMessage struct { - pool sync.Pool -} - -func (p *poolAdminSetWelcomeMessage) Get() *AdminSetWelcomeMessage { - x, ok := p.pool.Get().(*AdminSetWelcomeMessage) - if !ok { - x = &AdminSetWelcomeMessage{} - } - - return x -} - -func (p *poolAdminSetWelcomeMessage) Put(x *AdminSetWelcomeMessage) { - if x == nil { - return - } - - x.AccessToken = "" - x.Lang = "" - x.Template = "" - - p.pool.Put(x) -} - -var PoolAdminSetWelcomeMessage = poolAdminSetWelcomeMessage{} - -func (x *AdminSetWelcomeMessage) DeepCopy(z *AdminSetWelcomeMessage) { - z.AccessToken = x.AccessToken - z.Lang = x.Lang - z.Template = x.Template -} - -func (x *AdminSetWelcomeMessage) Clone() *AdminSetWelcomeMessage { - z := &AdminSetWelcomeMessage{} - x.DeepCopy(z) - return z -} - -func (x *AdminSetWelcomeMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminSetWelcomeMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminSetWelcomeMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminSetWelcomeMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminSetWelcomeMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminSetWelcomeMessage, x) -} - -const C_AdminGetWelcomeMessages int64 = 2794709448 - -type poolAdminGetWelcomeMessages struct { - pool sync.Pool -} - -func (p *poolAdminGetWelcomeMessages) Get() *AdminGetWelcomeMessages { - x, ok := p.pool.Get().(*AdminGetWelcomeMessages) - if !ok { - x = &AdminGetWelcomeMessages{} - } - - return x -} - -func (p *poolAdminGetWelcomeMessages) Put(x *AdminGetWelcomeMessages) { - if x == nil { - return - } - - x.AccessToken = "" - - p.pool.Put(x) -} - -var PoolAdminGetWelcomeMessages = poolAdminGetWelcomeMessages{} - -func (x *AdminGetWelcomeMessages) DeepCopy(z *AdminGetWelcomeMessages) { - z.AccessToken = x.AccessToken -} - -func (x *AdminGetWelcomeMessages) Clone() *AdminGetWelcomeMessages { - z := &AdminGetWelcomeMessages{} - x.DeepCopy(z) - return z -} - -func (x *AdminGetWelcomeMessages) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminGetWelcomeMessages) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminGetWelcomeMessages) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminGetWelcomeMessages) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminGetWelcomeMessages) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminGetWelcomeMessages, x) -} - -const C_AdminDeleteWelcomeMessage int64 = 3940015991 - -type poolAdminDeleteWelcomeMessage struct { - pool sync.Pool -} - -func (p *poolAdminDeleteWelcomeMessage) Get() *AdminDeleteWelcomeMessage { - x, ok := p.pool.Get().(*AdminDeleteWelcomeMessage) - if !ok { - x = &AdminDeleteWelcomeMessage{} - } - - return x -} - -func (p *poolAdminDeleteWelcomeMessage) Put(x *AdminDeleteWelcomeMessage) { - if x == nil { - return - } - - x.AccessToken = "" - x.Lang = "" - - p.pool.Put(x) -} - -var PoolAdminDeleteWelcomeMessage = poolAdminDeleteWelcomeMessage{} - -func (x *AdminDeleteWelcomeMessage) DeepCopy(z *AdminDeleteWelcomeMessage) { - z.AccessToken = x.AccessToken - z.Lang = x.Lang -} - -func (x *AdminDeleteWelcomeMessage) Clone() *AdminDeleteWelcomeMessage { - z := &AdminDeleteWelcomeMessage{} - x.DeepCopy(z) - return z -} - -func (x *AdminDeleteWelcomeMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminDeleteWelcomeMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminDeleteWelcomeMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminDeleteWelcomeMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminDeleteWelcomeMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminDeleteWelcomeMessage, x) -} - -const C_AdminSetPushProvider int64 = 1758606947 - -type poolAdminSetPushProvider struct { - pool sync.Pool -} - -func (p *poolAdminSetPushProvider) Get() *AdminSetPushProvider { - x, ok := p.pool.Get().(*AdminSetPushProvider) - if !ok { - x = &AdminSetPushProvider{} - } - - x.Provider = PoolPushProvider.Get() - - return x -} - -func (p *poolAdminSetPushProvider) Put(x *AdminSetPushProvider) { - if x == nil { - return - } - - x.AccessToken = "" - PoolPushProvider.Put(x.Provider) - - p.pool.Put(x) -} - -var PoolAdminSetPushProvider = poolAdminSetPushProvider{} - -func (x *AdminSetPushProvider) DeepCopy(z *AdminSetPushProvider) { - z.AccessToken = x.AccessToken - if x.Provider != nil { - if z.Provider == nil { - z.Provider = PoolPushProvider.Get() - } - x.Provider.DeepCopy(z.Provider) - } else { - PoolPushProvider.Put(z.Provider) - z.Provider = nil - } -} - -func (x *AdminSetPushProvider) Clone() *AdminSetPushProvider { - z := &AdminSetPushProvider{} - x.DeepCopy(z) - return z -} - -func (x *AdminSetPushProvider) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminSetPushProvider) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminSetPushProvider) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminSetPushProvider) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminSetPushProvider) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminSetPushProvider, x) -} - -const C_AdminGetPushProviders int64 = 4257963974 - -type poolAdminGetPushProviders struct { - pool sync.Pool -} - -func (p *poolAdminGetPushProviders) Get() *AdminGetPushProviders { - x, ok := p.pool.Get().(*AdminGetPushProviders) - if !ok { - x = &AdminGetPushProviders{} - } - - return x -} - -func (p *poolAdminGetPushProviders) Put(x *AdminGetPushProviders) { - if x == nil { - return - } - - x.AccessToken = "" - - p.pool.Put(x) -} - -var PoolAdminGetPushProviders = poolAdminGetPushProviders{} - -func (x *AdminGetPushProviders) DeepCopy(z *AdminGetPushProviders) { - z.AccessToken = x.AccessToken -} - -func (x *AdminGetPushProviders) Clone() *AdminGetPushProviders { - z := &AdminGetPushProviders{} - x.DeepCopy(z) - return z -} - -func (x *AdminGetPushProviders) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminGetPushProviders) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminGetPushProviders) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminGetPushProviders) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminGetPushProviders) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminGetPushProviders, x) -} - -const C_AdminDeletePushProvider int64 = 1864898932 - -type poolAdminDeletePushProvider struct { - pool sync.Pool -} - -func (p *poolAdminDeletePushProvider) Get() *AdminDeletePushProvider { - x, ok := p.pool.Get().(*AdminDeletePushProvider) - if !ok { - x = &AdminDeletePushProvider{} - } - - return x -} - -func (p *poolAdminDeletePushProvider) Put(x *AdminDeletePushProvider) { - if x == nil { - return - } - - x.AccessToken = "" - x.Name = "" - x.Type = 0 - - p.pool.Put(x) -} - -var PoolAdminDeletePushProvider = poolAdminDeletePushProvider{} - -func (x *AdminDeletePushProvider) DeepCopy(z *AdminDeletePushProvider) { - z.AccessToken = x.AccessToken - z.Name = x.Name - z.Type = x.Type -} - -func (x *AdminDeletePushProvider) Clone() *AdminDeletePushProvider { - z := &AdminDeletePushProvider{} - x.DeepCopy(z) - return z -} - -func (x *AdminDeletePushProvider) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminDeletePushProvider) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminDeletePushProvider) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminDeletePushProvider) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminDeletePushProvider) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminDeletePushProvider, x) -} - -const C_AdminSetVersion int64 = 1311023404 - -type poolAdminSetVersion struct { - pool sync.Pool -} - -func (p *poolAdminSetVersion) Get() *AdminSetVersion { - x, ok := p.pool.Get().(*AdminSetVersion) - if !ok { - x = &AdminSetVersion{} - } - - x.Version = PoolVersion.Get() - - return x -} - -func (p *poolAdminSetVersion) Put(x *AdminSetVersion) { - if x == nil { - return - } - - x.AccessToken = "" - PoolVersion.Put(x.Version) - - p.pool.Put(x) -} - -var PoolAdminSetVersion = poolAdminSetVersion{} - -func (x *AdminSetVersion) DeepCopy(z *AdminSetVersion) { - z.AccessToken = x.AccessToken - if x.Version != nil { - if z.Version == nil { - z.Version = PoolVersion.Get() - } - x.Version.DeepCopy(z.Version) - } else { - PoolVersion.Put(z.Version) - z.Version = nil - } -} - -func (x *AdminSetVersion) Clone() *AdminSetVersion { - z := &AdminSetVersion{} - x.DeepCopy(z) - return z -} - -func (x *AdminSetVersion) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminSetVersion) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminSetVersion) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminSetVersion) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminSetVersion) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminSetVersion, x) -} - -const C_AdminGetVersions int64 = 934752256 - -type poolAdminGetVersions struct { - pool sync.Pool -} - -func (p *poolAdminGetVersions) Get() *AdminGetVersions { - x, ok := p.pool.Get().(*AdminGetVersions) - if !ok { - x = &AdminGetVersions{} - } - - return x -} - -func (p *poolAdminGetVersions) Put(x *AdminGetVersions) { - if x == nil { - return - } - - x.AccessToken = "" - - p.pool.Put(x) -} - -var PoolAdminGetVersions = poolAdminGetVersions{} - -func (x *AdminGetVersions) DeepCopy(z *AdminGetVersions) { - z.AccessToken = x.AccessToken -} - -func (x *AdminGetVersions) Clone() *AdminGetVersions { - z := &AdminGetVersions{} - x.DeepCopy(z) - return z -} - -func (x *AdminGetVersions) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminGetVersions) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminGetVersions) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminGetVersions) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminGetVersions) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminGetVersions, x) -} - -const C_AdminSetStorageNode int64 = 4159566764 - -type poolAdminSetStorageNode struct { - pool sync.Pool -} - -func (p *poolAdminSetStorageNode) Get() *AdminSetStorageNode { - x, ok := p.pool.Get().(*AdminSetStorageNode) - if !ok { - x = &AdminSetStorageNode{} - } - - return x -} - -func (p *poolAdminSetStorageNode) Put(x *AdminSetStorageNode) { - if x == nil { - return - } - - x.AccessToken = "" - x.ClusterID = 0 - x.DSN = "" - x.Type = "" - x.Location = "" - x.Archive = false - - p.pool.Put(x) -} - -var PoolAdminSetStorageNode = poolAdminSetStorageNode{} - -func (x *AdminSetStorageNode) DeepCopy(z *AdminSetStorageNode) { - z.AccessToken = x.AccessToken - z.ClusterID = x.ClusterID - z.DSN = x.DSN - z.Type = x.Type - z.Location = x.Location - z.Archive = x.Archive -} - -func (x *AdminSetStorageNode) Clone() *AdminSetStorageNode { - z := &AdminSetStorageNode{} - x.DeepCopy(z) - return z -} - -func (x *AdminSetStorageNode) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminSetStorageNode) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminSetStorageNode) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminSetStorageNode) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminSetStorageNode) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminSetStorageNode, x) -} - -const C_AdminGetStorageNode int64 = 2297643227 - -type poolAdminGetStorageNode struct { - pool sync.Pool -} - -func (p *poolAdminGetStorageNode) Get() *AdminGetStorageNode { - x, ok := p.pool.Get().(*AdminGetStorageNode) - if !ok { - x = &AdminGetStorageNode{} - } - - return x -} - -func (p *poolAdminGetStorageNode) Put(x *AdminGetStorageNode) { - if x == nil { - return - } - - x.AccessToken = "" - x.ClusterID = 0 - - p.pool.Put(x) -} - -var PoolAdminGetStorageNode = poolAdminGetStorageNode{} - -func (x *AdminGetStorageNode) DeepCopy(z *AdminGetStorageNode) { - z.AccessToken = x.AccessToken - z.ClusterID = x.ClusterID -} - -func (x *AdminGetStorageNode) Clone() *AdminGetStorageNode { - z := &AdminGetStorageNode{} - x.DeepCopy(z) - return z -} - -func (x *AdminGetStorageNode) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminGetStorageNode) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminGetStorageNode) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminGetStorageNode) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminGetStorageNode) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminGetStorageNode, x) -} - -const C_AdminGetStorageNodes int64 = 176633623 - -type poolAdminGetStorageNodes struct { - pool sync.Pool -} - -func (p *poolAdminGetStorageNodes) Get() *AdminGetStorageNodes { - x, ok := p.pool.Get().(*AdminGetStorageNodes) - if !ok { - x = &AdminGetStorageNodes{} - } - - return x -} - -func (p *poolAdminGetStorageNodes) Put(x *AdminGetStorageNodes) { - if x == nil { - return - } - - x.AccessToken = "" - - p.pool.Put(x) -} - -var PoolAdminGetStorageNodes = poolAdminGetStorageNodes{} - -func (x *AdminGetStorageNodes) DeepCopy(z *AdminGetStorageNodes) { - z.AccessToken = x.AccessToken -} - -func (x *AdminGetStorageNodes) Clone() *AdminGetStorageNodes { - z := &AdminGetStorageNodes{} - x.DeepCopy(z) - return z -} - -func (x *AdminGetStorageNodes) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminGetStorageNodes) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminGetStorageNodes) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminGetStorageNodes) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminGetStorageNodes) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminGetStorageNodes, x) -} - -const C_AdminAddBannedSubnet int64 = 1018562272 - -type poolAdminAddBannedSubnet struct { - pool sync.Pool -} - -func (p *poolAdminAddBannedSubnet) Get() *AdminAddBannedSubnet { - x, ok := p.pool.Get().(*AdminAddBannedSubnet) - if !ok { - x = &AdminAddBannedSubnet{} - } - - return x -} - -func (p *poolAdminAddBannedSubnet) Put(x *AdminAddBannedSubnet) { - if x == nil { - return - } - - x.AccessToken = "" - x.CIDR = x.CIDR[:0] - - p.pool.Put(x) -} - -var PoolAdminAddBannedSubnet = poolAdminAddBannedSubnet{} - -func (x *AdminAddBannedSubnet) DeepCopy(z *AdminAddBannedSubnet) { - z.AccessToken = x.AccessToken - z.CIDR = append(z.CIDR[:0], x.CIDR...) -} - -func (x *AdminAddBannedSubnet) Clone() *AdminAddBannedSubnet { - z := &AdminAddBannedSubnet{} - x.DeepCopy(z) - return z -} - -func (x *AdminAddBannedSubnet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminAddBannedSubnet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminAddBannedSubnet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminAddBannedSubnet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminAddBannedSubnet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminAddBannedSubnet, x) -} - -const C_AdminDeleteBannedSubnet int64 = 4271915141 - -type poolAdminDeleteBannedSubnet struct { - pool sync.Pool -} - -func (p *poolAdminDeleteBannedSubnet) Get() *AdminDeleteBannedSubnet { - x, ok := p.pool.Get().(*AdminDeleteBannedSubnet) - if !ok { - x = &AdminDeleteBannedSubnet{} - } - - return x -} - -func (p *poolAdminDeleteBannedSubnet) Put(x *AdminDeleteBannedSubnet) { - if x == nil { - return - } - - x.AccessToken = "" - x.CIDR = x.CIDR[:0] - - p.pool.Put(x) -} - -var PoolAdminDeleteBannedSubnet = poolAdminDeleteBannedSubnet{} - -func (x *AdminDeleteBannedSubnet) DeepCopy(z *AdminDeleteBannedSubnet) { - z.AccessToken = x.AccessToken - z.CIDR = append(z.CIDR[:0], x.CIDR...) -} - -func (x *AdminDeleteBannedSubnet) Clone() *AdminDeleteBannedSubnet { - z := &AdminDeleteBannedSubnet{} - x.DeepCopy(z) - return z -} - -func (x *AdminDeleteBannedSubnet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminDeleteBannedSubnet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminDeleteBannedSubnet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminDeleteBannedSubnet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminDeleteBannedSubnet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminDeleteBannedSubnet, x) -} - -const C_AdminGetBannedSubnets int64 = 937432341 - -type poolAdminGetBannedSubnets struct { - pool sync.Pool -} - -func (p *poolAdminGetBannedSubnets) Get() *AdminGetBannedSubnets { - x, ok := p.pool.Get().(*AdminGetBannedSubnets) - if !ok { - x = &AdminGetBannedSubnets{} - } - - return x -} - -func (p *poolAdminGetBannedSubnets) Put(x *AdminGetBannedSubnets) { - if x == nil { - return - } - - x.AccessToken = "" - - p.pool.Put(x) -} - -var PoolAdminGetBannedSubnets = poolAdminGetBannedSubnets{} - -func (x *AdminGetBannedSubnets) DeepCopy(z *AdminGetBannedSubnets) { - z.AccessToken = x.AccessToken -} - -func (x *AdminGetBannedSubnets) Clone() *AdminGetBannedSubnets { - z := &AdminGetBannedSubnets{} - x.DeepCopy(z) - return z -} - -func (x *AdminGetBannedSubnets) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminGetBannedSubnets) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminGetBannedSubnets) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminGetBannedSubnets) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminGetBannedSubnets) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminGetBannedSubnets, x) -} - -const C_BannedSubnets int64 = 1393688488 - -type poolBannedSubnets struct { - pool sync.Pool -} - -func (p *poolBannedSubnets) Get() *BannedSubnets { - x, ok := p.pool.Get().(*BannedSubnets) - if !ok { - x = &BannedSubnets{} - } - - return x -} - -func (p *poolBannedSubnets) Put(x *BannedSubnets) { - if x == nil { - return - } - - x.Subnets = x.Subnets[:0] - - p.pool.Put(x) -} - -var PoolBannedSubnets = poolBannedSubnets{} - -func (x *BannedSubnets) DeepCopy(z *BannedSubnets) { - z.Subnets = append(z.Subnets[:0], x.Subnets...) -} - -func (x *BannedSubnets) Clone() *BannedSubnets { - z := &BannedSubnets{} - x.DeepCopy(z) - return z -} - -func (x *BannedSubnets) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BannedSubnets) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BannedSubnets) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BannedSubnets) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BannedSubnets) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BannedSubnets, x) -} - -const C_AdminSetToken int64 = 2892519162 - -type poolAdminSetToken struct { - pool sync.Pool -} - -func (p *poolAdminSetToken) Get() *AdminSetToken { - x, ok := p.pool.Get().(*AdminSetToken) - if !ok { - x = &AdminSetToken{} - } - - return x -} - -func (p *poolAdminSetToken) Put(x *AdminSetToken) { - if x == nil { - return - } - - x.AccessToken = "" - x.Privilege = 0 - - p.pool.Put(x) -} - -var PoolAdminSetToken = poolAdminSetToken{} - -func (x *AdminSetToken) DeepCopy(z *AdminSetToken) { - z.AccessToken = x.AccessToken - z.Privilege = x.Privilege -} - -func (x *AdminSetToken) Clone() *AdminSetToken { - z := &AdminSetToken{} - x.DeepCopy(z) - return z -} - -func (x *AdminSetToken) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminSetToken) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminSetToken) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminSetToken) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminSetToken) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminSetToken, x) -} - -const C_AdminDeleteToken int64 = 3154441897 - -type poolAdminDeleteToken struct { - pool sync.Pool -} - -func (p *poolAdminDeleteToken) Get() *AdminDeleteToken { - x, ok := p.pool.Get().(*AdminDeleteToken) - if !ok { - x = &AdminDeleteToken{} - } - - return x -} - -func (p *poolAdminDeleteToken) Put(x *AdminDeleteToken) { - if x == nil { - return - } - - x.AccessToken = "" - x.DeletedToken = "" - - p.pool.Put(x) -} - -var PoolAdminDeleteToken = poolAdminDeleteToken{} - -func (x *AdminDeleteToken) DeepCopy(z *AdminDeleteToken) { - z.AccessToken = x.AccessToken - z.DeletedToken = x.DeletedToken -} - -func (x *AdminDeleteToken) Clone() *AdminDeleteToken { - z := &AdminDeleteToken{} - x.DeepCopy(z) - return z -} - -func (x *AdminDeleteToken) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminDeleteToken) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminDeleteToken) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminDeleteToken) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminDeleteToken) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminDeleteToken, x) -} - -const C_AdminReserveUsername int64 = 1947723452 - -type poolAdminReserveUsername struct { - pool sync.Pool -} - -func (p *poolAdminReserveUsername) Get() *AdminReserveUsername { - x, ok := p.pool.Get().(*AdminReserveUsername) - if !ok { - x = &AdminReserveUsername{} - } - - return x -} - -func (p *poolAdminReserveUsername) Put(x *AdminReserveUsername) { - if x == nil { - return - } - - x.AccessToken = "" - x.Usernames = x.Usernames[:0] - x.Delete = false - - p.pool.Put(x) -} - -var PoolAdminReserveUsername = poolAdminReserveUsername{} - -func (x *AdminReserveUsername) DeepCopy(z *AdminReserveUsername) { - z.AccessToken = x.AccessToken - z.Usernames = append(z.Usernames[:0], x.Usernames...) - z.Delete = x.Delete -} - -func (x *AdminReserveUsername) Clone() *AdminReserveUsername { - z := &AdminReserveUsername{} - x.DeepCopy(z) - return z -} - -func (x *AdminReserveUsername) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminReserveUsername) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminReserveUsername) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminReserveUsername) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminReserveUsername) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminReserveUsername, x) -} - -const C_AdminGetReservedUsernames int64 = 1588181579 - -type poolAdminGetReservedUsernames struct { - pool sync.Pool -} - -func (p *poolAdminGetReservedUsernames) Get() *AdminGetReservedUsernames { - x, ok := p.pool.Get().(*AdminGetReservedUsernames) - if !ok { - x = &AdminGetReservedUsernames{} - } - - return x -} - -func (p *poolAdminGetReservedUsernames) Put(x *AdminGetReservedUsernames) { - if x == nil { - return - } - - x.AccessToken = "" - - p.pool.Put(x) -} - -var PoolAdminGetReservedUsernames = poolAdminGetReservedUsernames{} - -func (x *AdminGetReservedUsernames) DeepCopy(z *AdminGetReservedUsernames) { - z.AccessToken = x.AccessToken -} - -func (x *AdminGetReservedUsernames) Clone() *AdminGetReservedUsernames { - z := &AdminGetReservedUsernames{} - x.DeepCopy(z) - return z -} - -func (x *AdminGetReservedUsernames) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminGetReservedUsernames) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminGetReservedUsernames) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminGetReservedUsernames) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminGetReservedUsernames) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminGetReservedUsernames, x) -} - -const C_AdminTeamCreate int64 = 2797066608 - -type poolAdminTeamCreate struct { - pool sync.Pool -} - -func (p *poolAdminTeamCreate) Get() *AdminTeamCreate { - x, ok := p.pool.Get().(*AdminTeamCreate) - if !ok { - x = &AdminTeamCreate{} - } - - return x -} - -func (p *poolAdminTeamCreate) Put(x *AdminTeamCreate) { - if x == nil { - return - } - - x.RandomID = 0 - x.AccessToken = "" - x.Capacity = 0 - x.ExpireDate = 0 - x.Community = false - x.Title = "" - x.CreatorID = 0 - - p.pool.Put(x) -} - -var PoolAdminTeamCreate = poolAdminTeamCreate{} - -func (x *AdminTeamCreate) DeepCopy(z *AdminTeamCreate) { - z.RandomID = x.RandomID - z.AccessToken = x.AccessToken - z.Capacity = x.Capacity - z.ExpireDate = x.ExpireDate - z.Community = x.Community - z.Title = x.Title - z.CreatorID = x.CreatorID -} - -func (x *AdminTeamCreate) Clone() *AdminTeamCreate { - z := &AdminTeamCreate{} - x.DeepCopy(z) - return z -} - -func (x *AdminTeamCreate) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminTeamCreate) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminTeamCreate) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminTeamCreate) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminTeamCreate) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminTeamCreate, x) -} - -const C_AdminGetClusterInfo int64 = 52432287 - -type poolAdminGetClusterInfo struct { - pool sync.Pool -} - -func (p *poolAdminGetClusterInfo) Get() *AdminGetClusterInfo { - x, ok := p.pool.Get().(*AdminGetClusterInfo) - if !ok { - x = &AdminGetClusterInfo{} - } - - return x -} - -func (p *poolAdminGetClusterInfo) Put(x *AdminGetClusterInfo) { - if x == nil { - return - } - - x.ReplicaSet = 0 - - p.pool.Put(x) -} - -var PoolAdminGetClusterInfo = poolAdminGetClusterInfo{} - -func (x *AdminGetClusterInfo) DeepCopy(z *AdminGetClusterInfo) { - z.ReplicaSet = x.ReplicaSet -} - -func (x *AdminGetClusterInfo) Clone() *AdminGetClusterInfo { - z := &AdminGetClusterInfo{} - x.DeepCopy(z) - return z -} - -func (x *AdminGetClusterInfo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminGetClusterInfo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminGetClusterInfo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminGetClusterInfo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminGetClusterInfo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminGetClusterInfo, x) -} - -const C_StorageNode int64 = 1966993242 - -type poolStorageNode struct { - pool sync.Pool -} - -func (p *poolStorageNode) Get() *StorageNode { - x, ok := p.pool.Get().(*StorageNode) - if !ok { - x = &StorageNode{} - } - - return x -} - -func (p *poolStorageNode) Put(x *StorageNode) { - if x == nil { - return - } - - x.Archive = false - x.ClusterID = 0 - x.Location = "" - x.DSN = "" - x.Type = "" - - p.pool.Put(x) -} - -var PoolStorageNode = poolStorageNode{} - -func (x *StorageNode) DeepCopy(z *StorageNode) { - z.Archive = x.Archive - z.ClusterID = x.ClusterID - z.Location = x.Location - z.DSN = x.DSN - z.Type = x.Type -} - -func (x *StorageNode) Clone() *StorageNode { - z := &StorageNode{} - x.DeepCopy(z) - return z -} - -func (x *StorageNode) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *StorageNode) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *StorageNode) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *StorageNode) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *StorageNode) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_StorageNode, x) -} - -const C_StorageNodeMany int64 = 2667693068 - -type poolStorageNodeMany struct { - pool sync.Pool -} - -func (p *poolStorageNodeMany) Get() *StorageNodeMany { - x, ok := p.pool.Get().(*StorageNodeMany) - if !ok { - x = &StorageNodeMany{} - } - - return x -} - -func (p *poolStorageNodeMany) Put(x *StorageNodeMany) { - if x == nil { - return - } - - for _, z := range x.Nodes { - PoolStorageNode.Put(z) - } - x.Nodes = x.Nodes[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolStorageNodeMany = poolStorageNodeMany{} - -func (x *StorageNodeMany) DeepCopy(z *StorageNodeMany) { - for idx := range x.Nodes { - if x.Nodes[idx] == nil { - continue - } - xx := PoolStorageNode.Get() - x.Nodes[idx].DeepCopy(xx) - z.Nodes = append(z.Nodes, xx) - } - z.Empty = x.Empty -} - -func (x *StorageNodeMany) Clone() *StorageNodeMany { - z := &StorageNodeMany{} - x.DeepCopy(z) - return z -} - -func (x *StorageNodeMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *StorageNodeMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *StorageNodeMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *StorageNodeMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *StorageNodeMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_StorageNodeMany, x) -} - -const C_AdminToken int64 = 2895609620 - -type poolAdminToken struct { - pool sync.Pool -} - -func (p *poolAdminToken) Get() *AdminToken { - x, ok := p.pool.Get().(*AdminToken) - if !ok { - x = &AdminToken{} - } - - return x -} - -func (p *poolAdminToken) Put(x *AdminToken) { - if x == nil { - return - } - - x.Privilege = 0 - x.Token = "" - - p.pool.Put(x) -} - -var PoolAdminToken = poolAdminToken{} - -func (x *AdminToken) DeepCopy(z *AdminToken) { - z.Privilege = x.Privilege - z.Token = x.Token -} - -func (x *AdminToken) Clone() *AdminToken { - z := &AdminToken{} - x.DeepCopy(z) - return z -} - -func (x *AdminToken) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AdminToken) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AdminToken) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AdminToken) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AdminToken) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AdminToken, x) -} - -const C_WelcomeMessagesMany int64 = 414982091 - -type poolWelcomeMessagesMany struct { - pool sync.Pool -} - -func (p *poolWelcomeMessagesMany) Get() *WelcomeMessagesMany { - x, ok := p.pool.Get().(*WelcomeMessagesMany) - if !ok { - x = &WelcomeMessagesMany{} - } - - return x -} - -func (p *poolWelcomeMessagesMany) Put(x *WelcomeMessagesMany) { - if x == nil { - return - } - - for _, z := range x.Messages { - PoolWelcomeMessage.Put(z) - } - x.Messages = x.Messages[:0] - x.Count = 0 - - p.pool.Put(x) -} - -var PoolWelcomeMessagesMany = poolWelcomeMessagesMany{} - -func (x *WelcomeMessagesMany) DeepCopy(z *WelcomeMessagesMany) { - for idx := range x.Messages { - if x.Messages[idx] == nil { - continue - } - xx := PoolWelcomeMessage.Get() - x.Messages[idx].DeepCopy(xx) - z.Messages = append(z.Messages, xx) - } - z.Count = x.Count -} - -func (x *WelcomeMessagesMany) Clone() *WelcomeMessagesMany { - z := &WelcomeMessagesMany{} - x.DeepCopy(z) - return z -} - -func (x *WelcomeMessagesMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WelcomeMessagesMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WelcomeMessagesMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WelcomeMessagesMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WelcomeMessagesMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WelcomeMessagesMany, x) -} - -const C_VersionsMany int64 = 2123920547 - -type poolVersionsMany struct { - pool sync.Pool -} - -func (p *poolVersionsMany) Get() *VersionsMany { - x, ok := p.pool.Get().(*VersionsMany) - if !ok { - x = &VersionsMany{} - } - - return x -} - -func (p *poolVersionsMany) Put(x *VersionsMany) { - if x == nil { - return - } - - for _, z := range x.Versions { - PoolVersion.Put(z) - } - x.Versions = x.Versions[:0] - x.Count = 0 - - p.pool.Put(x) -} - -var PoolVersionsMany = poolVersionsMany{} - -func (x *VersionsMany) DeepCopy(z *VersionsMany) { - for idx := range x.Versions { - if x.Versions[idx] == nil { - continue - } - xx := PoolVersion.Get() - x.Versions[idx].DeepCopy(xx) - z.Versions = append(z.Versions, xx) - } - z.Count = x.Count -} - -func (x *VersionsMany) Clone() *VersionsMany { - z := &VersionsMany{} - x.DeepCopy(z) - return z -} - -func (x *VersionsMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *VersionsMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *VersionsMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *VersionsMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *VersionsMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_VersionsMany, x) -} - -const C_PushProvidersMany int64 = 5873573 - -type poolPushProvidersMany struct { - pool sync.Pool -} - -func (p *poolPushProvidersMany) Get() *PushProvidersMany { - x, ok := p.pool.Get().(*PushProvidersMany) - if !ok { - x = &PushProvidersMany{} - } - - return x -} - -func (p *poolPushProvidersMany) Put(x *PushProvidersMany) { - if x == nil { - return - } - - for _, z := range x.Providers { - PoolPushProvider.Put(z) - } - x.Providers = x.Providers[:0] - x.Count = 0 - - p.pool.Put(x) -} - -var PoolPushProvidersMany = poolPushProvidersMany{} - -func (x *PushProvidersMany) DeepCopy(z *PushProvidersMany) { - for idx := range x.Providers { - if x.Providers[idx] == nil { - continue - } - xx := PoolPushProvider.Get() - x.Providers[idx].DeepCopy(xx) - z.Providers = append(z.Providers, xx) - } - z.Count = x.Count -} - -func (x *PushProvidersMany) Clone() *PushProvidersMany { - z := &PushProvidersMany{} - x.DeepCopy(z) - return z -} - -func (x *PushProvidersMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PushProvidersMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PushProvidersMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PushProvidersMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PushProvidersMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PushProvidersMany, x) -} - -const C_WelcomeMessage int64 = 2506678571 - -type poolWelcomeMessage struct { - pool sync.Pool -} - -func (p *poolWelcomeMessage) Get() *WelcomeMessage { - x, ok := p.pool.Get().(*WelcomeMessage) - if !ok { - x = &WelcomeMessage{} - } - - return x -} - -func (p *poolWelcomeMessage) Put(x *WelcomeMessage) { - if x == nil { - return - } - - x.Lang = "" - x.Template = "" - - p.pool.Put(x) -} - -var PoolWelcomeMessage = poolWelcomeMessage{} - -func (x *WelcomeMessage) DeepCopy(z *WelcomeMessage) { - z.Lang = x.Lang - z.Template = x.Template -} - -func (x *WelcomeMessage) Clone() *WelcomeMessage { - z := &WelcomeMessage{} - x.DeepCopy(z) - return z -} - -func (x *WelcomeMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WelcomeMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WelcomeMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WelcomeMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WelcomeMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WelcomeMessage, x) -} - -const C_PushProvider int64 = 1015984470 - -type poolPushProvider struct { - pool sync.Pool -} - -func (p *poolPushProvider) Get() *PushProvider { - x, ok := p.pool.Get().(*PushProvider) - if !ok { - x = &PushProvider{} - } - - return x -} - -func (p *poolPushProvider) Put(x *PushProvider) { - if x == nil { - return - } - - x.Name = "" - x.Type = 0 - x.TestMode = false - x.Credentials = x.Credentials[:0] - x.KeyID = "" - x.TeamID = "" - x.Topic = "" - - p.pool.Put(x) -} - -var PoolPushProvider = poolPushProvider{} - -func (x *PushProvider) DeepCopy(z *PushProvider) { - z.Name = x.Name - z.Type = x.Type - z.TestMode = x.TestMode - z.Credentials = append(z.Credentials[:0], x.Credentials...) - z.KeyID = x.KeyID - z.TeamID = x.TeamID - z.Topic = x.Topic -} - -func (x *PushProvider) Clone() *PushProvider { - z := &PushProvider{} - x.DeepCopy(z) - return z -} - -func (x *PushProvider) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PushProvider) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PushProvider) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PushProvider) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PushProvider) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PushProvider, x) -} - -const C_Version int64 = 1889659487 - -type poolVersion struct { - pool sync.Pool -} - -func (p *poolVersion) Get() *Version { - x, ok := p.pool.Get().(*Version) - if !ok { - x = &Version{} - } - - return x -} - -func (p *poolVersion) Put(x *Version) { - if x == nil { - return - } - - x.Vendor = "" - x.Stage = "" - x.OS = "" - x.MinVersion = "" - x.CurrentVersion = "" - x.ForcedVersions = x.ForcedVersions[:0] - - p.pool.Put(x) -} - -var PoolVersion = poolVersion{} - -func (x *Version) DeepCopy(z *Version) { - z.Vendor = x.Vendor - z.Stage = x.Stage - z.OS = x.OS - z.MinVersion = x.MinVersion - z.CurrentVersion = x.CurrentVersion - z.ForcedVersions = append(z.ForcedVersions[:0], x.ForcedVersions...) -} - -func (x *Version) Clone() *Version { - z := &Version{} - x.DeepCopy(z) - return z -} - -func (x *Version) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Version) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Version) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Version) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Version) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Version, x) -} - -const C_ReservedUsernames int64 = 1388055751 - -type poolReservedUsernames struct { - pool sync.Pool -} - -func (p *poolReservedUsernames) Get() *ReservedUsernames { - x, ok := p.pool.Get().(*ReservedUsernames) - if !ok { - x = &ReservedUsernames{} - } - - return x -} - -func (p *poolReservedUsernames) Put(x *ReservedUsernames) { - if x == nil { - return - } - - x.Usernames = x.Usernames[:0] - x.Count = 0 - - p.pool.Put(x) -} - -var PoolReservedUsernames = poolReservedUsernames{} - -func (x *ReservedUsernames) DeepCopy(z *ReservedUsernames) { - z.Usernames = append(z.Usernames[:0], x.Usernames...) - z.Count = x.Count -} - -func (x *ReservedUsernames) Clone() *ReservedUsernames { - z := &ReservedUsernames{} - x.DeepCopy(z) - return z -} - -func (x *ReservedUsernames) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ReservedUsernames) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ReservedUsernames) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ReservedUsernames) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ReservedUsernames) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ReservedUsernames, x) -} - -func init() { - registry.RegisterConstructor(3981417409, "AdminBroadcastMessage") - registry.RegisterConstructor(1149591874, "AdminSetWelcomeMessage") - registry.RegisterConstructor(2794709448, "AdminGetWelcomeMessages") - registry.RegisterConstructor(3940015991, "AdminDeleteWelcomeMessage") - registry.RegisterConstructor(1758606947, "AdminSetPushProvider") - registry.RegisterConstructor(4257963974, "AdminGetPushProviders") - registry.RegisterConstructor(1864898932, "AdminDeletePushProvider") - registry.RegisterConstructor(1311023404, "AdminSetVersion") - registry.RegisterConstructor(934752256, "AdminGetVersions") - registry.RegisterConstructor(4159566764, "AdminSetStorageNode") - registry.RegisterConstructor(2297643227, "AdminGetStorageNode") - registry.RegisterConstructor(176633623, "AdminGetStorageNodes") - registry.RegisterConstructor(1018562272, "AdminAddBannedSubnet") - registry.RegisterConstructor(4271915141, "AdminDeleteBannedSubnet") - registry.RegisterConstructor(937432341, "AdminGetBannedSubnets") - registry.RegisterConstructor(1393688488, "BannedSubnets") - registry.RegisterConstructor(2892519162, "AdminSetToken") - registry.RegisterConstructor(3154441897, "AdminDeleteToken") - registry.RegisterConstructor(1947723452, "AdminReserveUsername") - registry.RegisterConstructor(1588181579, "AdminGetReservedUsernames") - registry.RegisterConstructor(2797066608, "AdminTeamCreate") - registry.RegisterConstructor(52432287, "AdminGetClusterInfo") - registry.RegisterConstructor(1966993242, "StorageNode") - registry.RegisterConstructor(2667693068, "StorageNodeMany") - registry.RegisterConstructor(2895609620, "AdminToken") - registry.RegisterConstructor(414982091, "WelcomeMessagesMany") - registry.RegisterConstructor(2123920547, "VersionsMany") - registry.RegisterConstructor(5873573, "PushProvidersMany") - registry.RegisterConstructor(2506678571, "WelcomeMessage") - registry.RegisterConstructor(1015984470, "PushProvider") - registry.RegisterConstructor(1889659487, "Version") - registry.RegisterConstructor(1388055751, "ReservedUsernames") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/auth.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/auth.pb.go deleted file mode 100644 index f831ba8d..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/auth.pb.go +++ /dev/null @@ -1,2387 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: auth.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type InitAuthCompleted_Statuses int32 - -const ( - InitAuthCompleted_OK InitAuthCompleted_Statuses = 0 - InitAuthCompleted_FAIL InitAuthCompleted_Statuses = 1 - InitAuthCompleted_RETRY InitAuthCompleted_Statuses = 2 -) - -// Enum value maps for InitAuthCompleted_Statuses. -var ( - InitAuthCompleted_Statuses_name = map[int32]string{ - 0: "OK", - 1: "FAIL", - 2: "RETRY", - } - InitAuthCompleted_Statuses_value = map[string]int32{ - "OK": 0, - "FAIL": 1, - "RETRY": 2, - } -) - -func (x InitAuthCompleted_Statuses) Enum() *InitAuthCompleted_Statuses { - p := new(InitAuthCompleted_Statuses) - *p = x - return p -} - -func (x InitAuthCompleted_Statuses) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (InitAuthCompleted_Statuses) Descriptor() protoreflect.EnumDescriptor { - return file_auth_proto_enumTypes[0].Descriptor() -} - -func (InitAuthCompleted_Statuses) Type() protoreflect.EnumType { - return &file_auth_proto_enumTypes[0] -} - -func (x InitAuthCompleted_Statuses) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use InitAuthCompleted_Statuses.Descriptor instead. -func (InitAuthCompleted_Statuses) EnumDescriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{19, 0} -} - -// InitConnect -// @Function -// @Return: InitResponse -type InitConnect struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientNonce uint64 `protobuf:"fixed64,1,opt,name=ClientNonce,proto3" json:"ClientNonce,omitempty"` -} - -func (x *InitConnect) Reset() { - *x = InitConnect{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitConnect) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitConnect) ProtoMessage() {} - -func (x *InitConnect) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitConnect.ProtoReflect.Descriptor instead. -func (*InitConnect) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{0} -} - -func (x *InitConnect) GetClientNonce() uint64 { - if x != nil { - return x.ClientNonce - } - return 0 -} - -// InitCompleteAuth -// @Function -// @Return: InitAuthCompleted -type InitCompleteAuth struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientNonce uint64 `protobuf:"fixed64,1,opt,name=ClientNonce,proto3" json:"ClientNonce,omitempty"` - ServerNonce uint64 `protobuf:"fixed64,2,opt,name=ServerNonce,proto3" json:"ServerNonce,omitempty"` - ClientDHPubKey []byte `protobuf:"bytes,5,opt,name=ClientDHPubKey,proto3" json:"ClientDHPubKey,omitempty"` - P uint64 `protobuf:"fixed64,6,opt,name=P,proto3" json:"P,omitempty"` - Q uint64 `protobuf:"fixed64,7,opt,name=Q,proto3" json:"Q,omitempty"` - EncryptedPayload []byte `protobuf:"bytes,8,opt,name=EncryptedPayload,proto3" json:"EncryptedPayload,omitempty"` -} - -func (x *InitCompleteAuth) Reset() { - *x = InitCompleteAuth{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitCompleteAuth) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitCompleteAuth) ProtoMessage() {} - -func (x *InitCompleteAuth) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitCompleteAuth.ProtoReflect.Descriptor instead. -func (*InitCompleteAuth) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{1} -} - -func (x *InitCompleteAuth) GetClientNonce() uint64 { - if x != nil { - return x.ClientNonce - } - return 0 -} - -func (x *InitCompleteAuth) GetServerNonce() uint64 { - if x != nil { - return x.ServerNonce - } - return 0 -} - -func (x *InitCompleteAuth) GetClientDHPubKey() []byte { - if x != nil { - return x.ClientDHPubKey - } - return nil -} - -func (x *InitCompleteAuth) GetP() uint64 { - if x != nil { - return x.P - } - return 0 -} - -func (x *InitCompleteAuth) GetQ() uint64 { - if x != nil { - return x.Q - } - return 0 -} - -func (x *InitCompleteAuth) GetEncryptedPayload() []byte { - if x != nil { - return x.EncryptedPayload - } - return nil -} - -// InitConnectTest -// @Function -// @Return: InitTestAuth -type InitConnectTest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *InitConnectTest) Reset() { - *x = InitConnectTest{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitConnectTest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitConnectTest) ProtoMessage() {} - -func (x *InitConnectTest) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitConnectTest.ProtoReflect.Descriptor instead. -func (*InitConnectTest) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{2} -} - -// InitBindUser -// @Function -// @Return: InitUserBound -type InitBindUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthKey string `protobuf:"bytes,1,opt,name=AuthKey,proto3" json:"AuthKey,omitempty"` - Username string `protobuf:"bytes,2,opt,name=Username,proto3" json:"Username,omitempty"` - Phone string `protobuf:"bytes,3,opt,name=Phone,proto3" json:"Phone,omitempty"` - FirstName string `protobuf:"bytes,4,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,5,opt,name=LastName,proto3" json:"LastName,omitempty"` -} - -func (x *InitBindUser) Reset() { - *x = InitBindUser{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitBindUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitBindUser) ProtoMessage() {} - -func (x *InitBindUser) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitBindUser.ProtoReflect.Descriptor instead. -func (*InitBindUser) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{3} -} - -func (x *InitBindUser) GetAuthKey() string { - if x != nil { - return x.AuthKey - } - return "" -} - -func (x *InitBindUser) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *InitBindUser) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *InitBindUser) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *InitBindUser) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -// AuthRegister -// @Function -// @Return: AuthAuthorization -type AuthRegister struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - PhoneCode string `protobuf:"bytes,4,opt,name=PhoneCode,proto3" json:"PhoneCode,omitempty"` - PhoneCodeHash string `protobuf:"bytes,5,opt,name=PhoneCodeHash,proto3" json:"PhoneCodeHash,omitempty"` - LangCode string `protobuf:"bytes,6,opt,name=LangCode,proto3" json:"LangCode,omitempty"` -} - -func (x *AuthRegister) Reset() { - *x = AuthRegister{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthRegister) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthRegister) ProtoMessage() {} - -func (x *AuthRegister) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthRegister.ProtoReflect.Descriptor instead. -func (*AuthRegister) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{4} -} - -func (x *AuthRegister) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AuthRegister) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *AuthRegister) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *AuthRegister) GetPhoneCode() string { - if x != nil { - return x.PhoneCode - } - return "" -} - -func (x *AuthRegister) GetPhoneCodeHash() string { - if x != nil { - return x.PhoneCodeHash - } - return "" -} - -func (x *AuthRegister) GetLangCode() string { - if x != nil { - return x.LangCode - } - return "" -} - -// AuthBotRegister -// @Function -// @Return: AuthBotAuthorization -type AuthBotRegister struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - Username string `protobuf:"bytes,2,opt,name=Username,proto3" json:"Username,omitempty"` - OwnerID int64 `protobuf:"varint,3,opt,name=OwnerID,proto3" json:"OwnerID,omitempty"` -} - -func (x *AuthBotRegister) Reset() { - *x = AuthBotRegister{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthBotRegister) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthBotRegister) ProtoMessage() {} - -func (x *AuthBotRegister) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthBotRegister.ProtoReflect.Descriptor instead. -func (*AuthBotRegister) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{5} -} - -func (x *AuthBotRegister) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *AuthBotRegister) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *AuthBotRegister) GetOwnerID() int64 { - if x != nil { - return x.OwnerID - } - return 0 -} - -// AuthLogin -// @Function -// @Return: AuthAuthorization -type AuthLogin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - PhoneCodeHash string `protobuf:"bytes,2,opt,name=PhoneCodeHash,proto3" json:"PhoneCodeHash,omitempty"` - PhoneCode string `protobuf:"bytes,3,opt,name=PhoneCode,proto3" json:"PhoneCode,omitempty"` -} - -func (x *AuthLogin) Reset() { - *x = AuthLogin{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthLogin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthLogin) ProtoMessage() {} - -func (x *AuthLogin) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthLogin.ProtoReflect.Descriptor instead. -func (*AuthLogin) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{6} -} - -func (x *AuthLogin) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AuthLogin) GetPhoneCodeHash() string { - if x != nil { - return x.PhoneCodeHash - } - return "" -} - -func (x *AuthLogin) GetPhoneCode() string { - if x != nil { - return x.PhoneCode - } - return "" -} - -// AuthCheckPassword -// @Function -// @Return: AuthAuthorization -type AuthCheckPassword struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Password *InputPassword `protobuf:"bytes,1,opt,name=Password,proto3" json:"Password,omitempty"` -} - -func (x *AuthCheckPassword) Reset() { - *x = AuthCheckPassword{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthCheckPassword) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthCheckPassword) ProtoMessage() {} - -func (x *AuthCheckPassword) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthCheckPassword.ProtoReflect.Descriptor instead. -func (*AuthCheckPassword) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{7} -} - -func (x *AuthCheckPassword) GetPassword() *InputPassword { - if x != nil { - return x.Password - } - return nil -} - -// AuthRecoverPassword -// @Function -// @Returns AuthAuthorization -type AuthRecoverPassword struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Code string `protobuf:"bytes,1,opt,name=Code,proto3" json:"Code,omitempty"` -} - -func (x *AuthRecoverPassword) Reset() { - *x = AuthRecoverPassword{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthRecoverPassword) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthRecoverPassword) ProtoMessage() {} - -func (x *AuthRecoverPassword) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthRecoverPassword.ProtoReflect.Descriptor instead. -func (*AuthRecoverPassword) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{8} -} - -func (x *AuthRecoverPassword) GetCode() string { - if x != nil { - return x.Code - } - return "" -} - -// AuthLogout -// @Function -// @Return: Bool -type AuthLogout struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthIDs []int64 `protobuf:"varint,1,rep,packed,name=AuthIDs,proto3" json:"AuthIDs,omitempty"` -} - -func (x *AuthLogout) Reset() { - *x = AuthLogout{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthLogout) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthLogout) ProtoMessage() {} - -func (x *AuthLogout) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthLogout.ProtoReflect.Descriptor instead. -func (*AuthLogout) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{9} -} - -func (x *AuthLogout) GetAuthIDs() []int64 { - if x != nil { - return x.AuthIDs - } - return nil -} - -// AuthLoginByToken -// @Function -// @Return: AuthAuthorization -type AuthLoginByToken struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=Token,proto3" json:"Token,omitempty"` - Provider string `protobuf:"bytes,2,opt,name=Provider,proto3" json:"Provider,omitempty"` - Firstname string `protobuf:"bytes,3,opt,name=Firstname,proto3" json:"Firstname,omitempty"` - Lastname string `protobuf:"bytes,4,opt,name=Lastname,proto3" json:"Lastname,omitempty"` -} - -func (x *AuthLoginByToken) Reset() { - *x = AuthLoginByToken{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthLoginByToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthLoginByToken) ProtoMessage() {} - -func (x *AuthLoginByToken) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthLoginByToken.ProtoReflect.Descriptor instead. -func (*AuthLoginByToken) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{10} -} - -func (x *AuthLoginByToken) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -func (x *AuthLoginByToken) GetProvider() string { - if x != nil { - return x.Provider - } - return "" -} - -func (x *AuthLoginByToken) GetFirstname() string { - if x != nil { - return x.Firstname - } - return "" -} - -func (x *AuthLoginByToken) GetLastname() string { - if x != nil { - return x.Lastname - } - return "" -} - -// AuthCheckPhone -// @Function -// @Return: AuthCheckedPhone -type AuthCheckPhone struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` -} - -func (x *AuthCheckPhone) Reset() { - *x = AuthCheckPhone{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthCheckPhone) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthCheckPhone) ProtoMessage() {} - -func (x *AuthCheckPhone) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthCheckPhone.ProtoReflect.Descriptor instead. -func (*AuthCheckPhone) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{11} -} - -func (x *AuthCheckPhone) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -// AuthSendCode -// @Function -// @Return: AuthSentCode -type AuthSendCode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - AppHash string `protobuf:"bytes,2,opt,name=AppHash,proto3" json:"AppHash,omitempty"` -} - -func (x *AuthSendCode) Reset() { - *x = AuthSendCode{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthSendCode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthSendCode) ProtoMessage() {} - -func (x *AuthSendCode) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthSendCode.ProtoReflect.Descriptor instead. -func (*AuthSendCode) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{12} -} - -func (x *AuthSendCode) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AuthSendCode) GetAppHash() string { - if x != nil { - return x.AppHash - } - return "" -} - -// AuthResendCode -// @Function -// @Return: Bool -type AuthResendCode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - PhoneCodeHash string `protobuf:"bytes,2,opt,name=PhoneCodeHash,proto3" json:"PhoneCodeHash,omitempty"` - AppHash string `protobuf:"bytes,3,opt,name=AppHash,proto3" json:"AppHash,omitempty"` -} - -func (x *AuthResendCode) Reset() { - *x = AuthResendCode{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthResendCode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthResendCode) ProtoMessage() {} - -func (x *AuthResendCode) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthResendCode.ProtoReflect.Descriptor instead. -func (*AuthResendCode) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{13} -} - -func (x *AuthResendCode) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AuthResendCode) GetPhoneCodeHash() string { - if x != nil { - return x.PhoneCodeHash - } - return "" -} - -func (x *AuthResendCode) GetAppHash() string { - if x != nil { - return x.AppHash - } - return "" -} - -// AuthRecall -// @Function -// @Return: AuthRecalled -type AuthRecall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientID int64 `protobuf:"varint,1,opt,name=ClientID,proto3" json:"ClientID,omitempty"` - Version uint32 `protobuf:"varint,2,opt,name=Version,proto3" json:"Version,omitempty"` - AppVersion string `protobuf:"bytes,3,opt,name=AppVersion,proto3" json:"AppVersion,omitempty"` - Platform string `protobuf:"bytes,4,opt,name=Platform,proto3" json:"Platform,omitempty"` - Vendor string `protobuf:"bytes,5,opt,name=Vendor,proto3" json:"Vendor,omitempty"` - OSVersion string `protobuf:"bytes,6,opt,name=OSVersion,proto3" json:"OSVersion,omitempty"` -} - -func (x *AuthRecall) Reset() { - *x = AuthRecall{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthRecall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthRecall) ProtoMessage() {} - -func (x *AuthRecall) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthRecall.ProtoReflect.Descriptor instead. -func (*AuthRecall) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{14} -} - -func (x *AuthRecall) GetClientID() int64 { - if x != nil { - return x.ClientID - } - return 0 -} - -func (x *AuthRecall) GetVersion() uint32 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *AuthRecall) GetAppVersion() string { - if x != nil { - return x.AppVersion - } - return "" -} - -func (x *AuthRecall) GetPlatform() string { - if x != nil { - return x.Platform - } - return "" -} - -func (x *AuthRecall) GetVendor() string { - if x != nil { - return x.Vendor - } - return "" -} - -func (x *AuthRecall) GetOSVersion() string { - if x != nil { - return x.OSVersion - } - return "" -} - -// AuthDestroyKey -// @Function -// @Return: Bool -type AuthDestroyKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *AuthDestroyKey) Reset() { - *x = AuthDestroyKey{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthDestroyKey) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthDestroyKey) ProtoMessage() {} - -func (x *AuthDestroyKey) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthDestroyKey.ProtoReflect.Descriptor instead. -func (*AuthDestroyKey) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{15} -} - -// InitTestAuth -type InitTestAuth struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthID int64 `protobuf:"varint,1,opt,name=AuthID,proto3" json:"AuthID,omitempty"` - AuthKey []byte `protobuf:"bytes,2,opt,name=AuthKey,proto3" json:"AuthKey,omitempty"` -} - -func (x *InitTestAuth) Reset() { - *x = InitTestAuth{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitTestAuth) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitTestAuth) ProtoMessage() {} - -func (x *InitTestAuth) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitTestAuth.ProtoReflect.Descriptor instead. -func (*InitTestAuth) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{16} -} - -func (x *InitTestAuth) GetAuthID() int64 { - if x != nil { - return x.AuthID - } - return 0 -} - -func (x *InitTestAuth) GetAuthKey() []byte { - if x != nil { - return x.AuthKey - } - return nil -} - -// InitResponse -type InitResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientNonce uint64 `protobuf:"fixed64,1,opt,name=ClientNonce,proto3" json:"ClientNonce,omitempty"` - ServerNonce uint64 `protobuf:"fixed64,2,opt,name=ServerNonce,proto3" json:"ServerNonce,omitempty"` - RSAPubKeyFingerPrint uint64 `protobuf:"fixed64,3,opt,name=RSAPubKeyFingerPrint,proto3" json:"RSAPubKeyFingerPrint,omitempty"` - DHGroupFingerPrint uint64 `protobuf:"fixed64,4,opt,name=DHGroupFingerPrint,proto3" json:"DHGroupFingerPrint,omitempty"` - PQ uint64 `protobuf:"fixed64,5,opt,name=PQ,proto3" json:"PQ,omitempty"` - ServerTimestamp int64 `protobuf:"varint,6,opt,name=ServerTimestamp,proto3" json:"ServerTimestamp,omitempty"` -} - -func (x *InitResponse) Reset() { - *x = InitResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitResponse) ProtoMessage() {} - -func (x *InitResponse) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitResponse.ProtoReflect.Descriptor instead. -func (*InitResponse) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{17} -} - -func (x *InitResponse) GetClientNonce() uint64 { - if x != nil { - return x.ClientNonce - } - return 0 -} - -func (x *InitResponse) GetServerNonce() uint64 { - if x != nil { - return x.ServerNonce - } - return 0 -} - -func (x *InitResponse) GetRSAPubKeyFingerPrint() uint64 { - if x != nil { - return x.RSAPubKeyFingerPrint - } - return 0 -} - -func (x *InitResponse) GetDHGroupFingerPrint() uint64 { - if x != nil { - return x.DHGroupFingerPrint - } - return 0 -} - -func (x *InitResponse) GetPQ() uint64 { - if x != nil { - return x.PQ - } - return 0 -} - -func (x *InitResponse) GetServerTimestamp() int64 { - if x != nil { - return x.ServerTimestamp - } - return 0 -} - -// InitCompleteAuthInternal -type InitCompleteAuthInternal struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SecretNonce []byte `protobuf:"bytes,1,opt,name=SecretNonce,proto3" json:"SecretNonce,omitempty"` -} - -func (x *InitCompleteAuthInternal) Reset() { - *x = InitCompleteAuthInternal{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitCompleteAuthInternal) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitCompleteAuthInternal) ProtoMessage() {} - -func (x *InitCompleteAuthInternal) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitCompleteAuthInternal.ProtoReflect.Descriptor instead. -func (*InitCompleteAuthInternal) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{18} -} - -func (x *InitCompleteAuthInternal) GetSecretNonce() []byte { - if x != nil { - return x.SecretNonce - } - return nil -} - -// InitAuthCompleted -type InitAuthCompleted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientNonce uint64 `protobuf:"fixed64,1,opt,name=ClientNonce,proto3" json:"ClientNonce,omitempty"` - ServerNonce uint64 `protobuf:"fixed64,2,opt,name=ServerNonce,proto3" json:"ServerNonce,omitempty"` - Status InitAuthCompleted_Statuses `protobuf:"varint,3,opt,name=Status,proto3,enum=msg.InitAuthCompleted_Statuses" json:"Status,omitempty"` - SecretHash uint64 `protobuf:"fixed64,4,opt,name=SecretHash,proto3" json:"SecretHash,omitempty"` - ServerDHPubKey []byte `protobuf:"bytes,5,opt,name=ServerDHPubKey,proto3" json:"ServerDHPubKey,omitempty"` -} - -func (x *InitAuthCompleted) Reset() { - *x = InitAuthCompleted{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitAuthCompleted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitAuthCompleted) ProtoMessage() {} - -func (x *InitAuthCompleted) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitAuthCompleted.ProtoReflect.Descriptor instead. -func (*InitAuthCompleted) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{19} -} - -func (x *InitAuthCompleted) GetClientNonce() uint64 { - if x != nil { - return x.ClientNonce - } - return 0 -} - -func (x *InitAuthCompleted) GetServerNonce() uint64 { - if x != nil { - return x.ServerNonce - } - return 0 -} - -func (x *InitAuthCompleted) GetStatus() InitAuthCompleted_Statuses { - if x != nil { - return x.Status - } - return InitAuthCompleted_OK -} - -func (x *InitAuthCompleted) GetSecretHash() uint64 { - if x != nil { - return x.SecretHash - } - return 0 -} - -func (x *InitAuthCompleted) GetServerDHPubKey() []byte { - if x != nil { - return x.ServerDHPubKey - } - return nil -} - -// InitUserBound -type InitUserBound struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthID int64 `protobuf:"varint,1,opt,name=AuthID,proto3" json:"AuthID,omitempty"` -} - -func (x *InitUserBound) Reset() { - *x = InitUserBound{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InitUserBound) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InitUserBound) ProtoMessage() {} - -func (x *InitUserBound) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InitUserBound.ProtoReflect.Descriptor instead. -func (*InitUserBound) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{20} -} - -func (x *InitUserBound) GetAuthID() int64 { - if x != nil { - return x.AuthID - } - return 0 -} - -// AuthPasswordRecovery -type AuthPasswordRecovery struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - EmailPattern string `protobuf:"bytes,1,opt,name=EmailPattern,proto3" json:"EmailPattern,omitempty"` -} - -func (x *AuthPasswordRecovery) Reset() { - *x = AuthPasswordRecovery{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthPasswordRecovery) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthPasswordRecovery) ProtoMessage() {} - -func (x *AuthPasswordRecovery) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthPasswordRecovery.ProtoReflect.Descriptor instead. -func (*AuthPasswordRecovery) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{21} -} - -func (x *AuthPasswordRecovery) GetEmailPattern() string { - if x != nil { - return x.EmailPattern - } - return "" -} - -// AuthRecalled -type AuthRecalled struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientID int64 `protobuf:"varint,1,opt,name=ClientID,proto3" json:"ClientID,omitempty"` - Timestamp int64 `protobuf:"varint,2,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` - UpdateID int64 `protobuf:"varint,3,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Available bool `protobuf:"varint,4,opt,name=Available,proto3" json:"Available,omitempty"` - Force bool `protobuf:"varint,5,opt,name=Force,proto3" json:"Force,omitempty"` - CurrentVersion string `protobuf:"bytes,6,opt,name=CurrentVersion,proto3" json:"CurrentVersion,omitempty"` -} - -func (x *AuthRecalled) Reset() { - *x = AuthRecalled{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthRecalled) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthRecalled) ProtoMessage() {} - -func (x *AuthRecalled) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthRecalled.ProtoReflect.Descriptor instead. -func (*AuthRecalled) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{22} -} - -func (x *AuthRecalled) GetClientID() int64 { - if x != nil { - return x.ClientID - } - return 0 -} - -func (x *AuthRecalled) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *AuthRecalled) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *AuthRecalled) GetAvailable() bool { - if x != nil { - return x.Available - } - return false -} - -func (x *AuthRecalled) GetForce() bool { - if x != nil { - return x.Force - } - return false -} - -func (x *AuthRecalled) GetCurrentVersion() string { - if x != nil { - return x.CurrentVersion - } - return "" -} - -// AuthAuthorization -type AuthAuthorization struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Expired uint64 `protobuf:"fixed64,1,opt,name=Expired,proto3" json:"Expired,omitempty"` - User *User `protobuf:"bytes,2,opt,name=User,proto3" json:"User,omitempty"` - ActiveSessions uint32 `protobuf:"varint,3,opt,name=ActiveSessions,proto3" json:"ActiveSessions,omitempty"` -} - -func (x *AuthAuthorization) Reset() { - *x = AuthAuthorization{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthAuthorization) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthAuthorization) ProtoMessage() {} - -func (x *AuthAuthorization) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthAuthorization.ProtoReflect.Descriptor instead. -func (*AuthAuthorization) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{23} -} - -func (x *AuthAuthorization) GetExpired() uint64 { - if x != nil { - return x.Expired - } - return 0 -} - -func (x *AuthAuthorization) GetUser() *User { - if x != nil { - return x.User - } - return nil -} - -func (x *AuthAuthorization) GetActiveSessions() uint32 { - if x != nil { - return x.ActiveSessions - } - return 0 -} - -// AuthBotAuthorization -type AuthBotAuthorization struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthID int64 `protobuf:"varint,1,opt,name=AuthID,proto3" json:"AuthID,omitempty"` - AuthKey []byte `protobuf:"bytes,2,opt,name=AuthKey,proto3" json:"AuthKey,omitempty"` - Bot *Bot `protobuf:"bytes,3,opt,name=Bot,proto3" json:"Bot,omitempty"` -} - -func (x *AuthBotAuthorization) Reset() { - *x = AuthBotAuthorization{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthBotAuthorization) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthBotAuthorization) ProtoMessage() {} - -func (x *AuthBotAuthorization) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthBotAuthorization.ProtoReflect.Descriptor instead. -func (*AuthBotAuthorization) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{24} -} - -func (x *AuthBotAuthorization) GetAuthID() int64 { - if x != nil { - return x.AuthID - } - return 0 -} - -func (x *AuthBotAuthorization) GetAuthKey() []byte { - if x != nil { - return x.AuthKey - } - return nil -} - -func (x *AuthBotAuthorization) GetBot() *Bot { - if x != nil { - return x.Bot - } - return nil -} - -// AuthCheckedPhone -type AuthCheckedPhone struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Invited bool `protobuf:"varint,1,opt,name=Invited,proto3" json:"Invited,omitempty"` - Registered bool `protobuf:"varint,2,opt,name=Registered,proto3" json:"Registered,omitempty"` -} - -func (x *AuthCheckedPhone) Reset() { - *x = AuthCheckedPhone{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthCheckedPhone) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthCheckedPhone) ProtoMessage() {} - -func (x *AuthCheckedPhone) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthCheckedPhone.ProtoReflect.Descriptor instead. -func (*AuthCheckedPhone) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{25} -} - -func (x *AuthCheckedPhone) GetInvited() bool { - if x != nil { - return x.Invited - } - return false -} - -func (x *AuthCheckedPhone) GetRegistered() bool { - if x != nil { - return x.Registered - } - return false -} - -// AuthSentCode -type AuthSentCode struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - PhoneCodeHash string `protobuf:"bytes,2,opt,name=PhoneCodeHash,proto3" json:"PhoneCodeHash,omitempty"` - SendToPhone bool `protobuf:"varint,3,opt,name=SendToPhone,proto3" json:"SendToPhone,omitempty"` -} - -func (x *AuthSentCode) Reset() { - *x = AuthSentCode{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthSentCode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthSentCode) ProtoMessage() {} - -func (x *AuthSentCode) ProtoReflect() protoreflect.Message { - mi := &file_auth_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AuthSentCode.ProtoReflect.Descriptor instead. -func (*AuthSentCode) Descriptor() ([]byte, []int) { - return file_auth_proto_rawDescGZIP(), []int{26} -} - -func (x *AuthSentCode) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *AuthSentCode) GetPhoneCodeHash() string { - if x != nil { - return x.PhoneCodeHash - } - return "" -} - -func (x *AuthSentCode) GetSendToPhone() bool { - if x != nil { - return x.SendToPhone - } - return false -} - -var File_auth_proto protoreflect.FileDescriptor - -var file_auth_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, - 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x2f, 0x0a, 0x0b, 0x49, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x6e, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0b, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, - 0x6f, 0x6e, 0x63, 0x65, 0x22, 0xc6, 0x01, 0x0a, 0x10, 0x49, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6d, - 0x70, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0b, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, - 0x52, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x26, 0x0a, - 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x44, 0x48, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x44, 0x48, 0x50, - 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x50, 0x18, 0x06, 0x20, 0x01, 0x28, 0x06, - 0x52, 0x01, 0x50, 0x12, 0x0c, 0x0a, 0x01, 0x51, 0x18, 0x07, 0x20, 0x01, 0x28, 0x06, 0x52, 0x01, - 0x51, 0x12, 0x2a, 0x0a, 0x10, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x50, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x45, 0x6e, 0x63, - 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x11, 0x0a, - 0x0f, 0x49, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x54, 0x65, 0x73, 0x74, - 0x22, 0x94, 0x01, 0x0a, 0x0c, 0x49, 0x6e, 0x69, 0x74, 0x42, 0x69, 0x6e, 0x64, 0x55, 0x73, 0x65, - 0x72, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x55, - 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, - 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1c, 0x0a, - 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, - 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, - 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xbe, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, - 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, - 0x4c, 0x61, 0x6e, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x4c, 0x61, 0x6e, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x5b, 0x0a, 0x0f, 0x41, 0x75, 0x74, 0x68, - 0x42, 0x6f, 0x74, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x4e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x4f, - 0x77, 0x6e, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x4f, 0x77, - 0x6e, 0x65, 0x72, 0x49, 0x44, 0x22, 0x65, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x4c, 0x6f, 0x67, - 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, - 0x0a, 0x09, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x43, 0x0a, 0x11, - 0x41, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x12, 0x2e, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x22, 0x29, 0x0a, 0x13, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x22, 0x2a, 0x0a, 0x0a, - 0x41, 0x75, 0x74, 0x68, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x1c, 0x0a, 0x07, 0x41, 0x75, - 0x74, 0x68, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, - 0x07, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, 0x73, 0x22, 0x7e, 0x0a, 0x10, 0x41, 0x75, 0x74, 0x68, - 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x42, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x1c, - 0x0a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x4c, 0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x4c, 0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x26, 0x0a, 0x0e, 0x41, 0x75, 0x74, 0x68, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x22, 0x3e, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x6f, 0x64, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x70, 0x70, 0x48, 0x61, 0x73, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x41, 0x70, 0x70, 0x48, 0x61, 0x73, 0x68, - 0x22, 0x66, 0x0a, 0x0e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x65, 0x6e, 0x64, 0x43, 0x6f, - 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x18, - 0x0a, 0x07, 0x41, 0x70, 0x70, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x41, 0x70, 0x70, 0x48, 0x61, 0x73, 0x68, 0x22, 0xb8, 0x01, 0x0a, 0x0a, 0x41, 0x75, 0x74, - 0x68, 0x52, 0x65, 0x63, 0x61, 0x6c, 0x6c, 0x12, 0x1e, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x08, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x41, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x16, 0x0a, - 0x06, 0x56, 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x56, - 0x65, 0x6e, 0x64, 0x6f, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x4f, 0x53, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x4f, 0x53, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x22, 0x10, 0x0a, 0x0e, 0x41, 0x75, 0x74, 0x68, 0x44, 0x65, 0x73, 0x74, 0x72, - 0x6f, 0x79, 0x4b, 0x65, 0x79, 0x22, 0x40, 0x0a, 0x0c, 0x49, 0x6e, 0x69, 0x74, 0x54, 0x65, 0x73, - 0x74, 0x41, 0x75, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, 0x12, 0x18, 0x0a, - 0x07, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x22, 0xf0, 0x01, 0x0a, 0x0c, 0x49, 0x6e, 0x69, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0b, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x52, - 0x0b, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x14, - 0x52, 0x53, 0x41, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x50, - 0x72, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x06, 0x52, 0x14, 0x52, 0x53, 0x41, 0x50, - 0x75, 0x62, 0x4b, 0x65, 0x79, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x72, 0x69, 0x6e, 0x74, - 0x12, 0x2e, 0x0a, 0x12, 0x44, 0x48, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x6e, 0x67, 0x65, - 0x72, 0x50, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x06, 0x52, 0x12, 0x44, 0x48, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x72, 0x69, 0x6e, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x50, 0x51, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x52, 0x02, 0x50, 0x51, - 0x12, 0x28, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x3c, 0x0a, 0x18, 0x49, 0x6e, - 0x69, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x53, 0x65, 0x63, - 0x72, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x81, 0x02, 0x0a, 0x11, 0x49, 0x6e, 0x69, - 0x74, 0x41, 0x75, 0x74, 0x68, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x20, - 0x0a, 0x0b, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x06, 0x52, 0x0b, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, - 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x6f, 0x6e, - 0x63, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x41, 0x75, 0x74, - 0x68, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x65, 0x73, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x53, - 0x65, 0x63, 0x72, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x06, 0x52, - 0x0a, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x26, 0x0a, 0x0e, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x48, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x48, 0x50, 0x75, 0x62, - 0x4b, 0x65, 0x79, 0x22, 0x27, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x12, - 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x41, 0x49, 0x4c, 0x10, - 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x54, 0x52, 0x59, 0x10, 0x02, 0x22, 0x27, 0x0a, 0x0d, - 0x49, 0x6e, 0x69, 0x74, 0x55, 0x73, 0x65, 0x72, 0x42, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, - 0x75, 0x74, 0x68, 0x49, 0x44, 0x22, 0x3a, 0x0a, 0x14, 0x41, 0x75, 0x74, 0x68, 0x50, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x12, 0x22, 0x0a, - 0x0c, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x22, 0xc4, 0x01, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x63, 0x61, 0x6c, 0x6c, - 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, - 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x09, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x46, 0x6f, - 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x46, 0x6f, 0x72, 0x63, 0x65, - 0x12, 0x26, 0x0a, 0x0e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x74, 0x0a, 0x11, 0x41, 0x75, 0x74, 0x68, - 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, - 0x07, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x06, 0x52, 0x07, - 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x52, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, - 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x64, - 0x0a, 0x14, 0x41, 0x75, 0x74, 0x68, 0x42, 0x6f, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x75, 0x74, 0x68, 0x49, 0x44, 0x12, 0x18, - 0x0a, 0x07, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x07, 0x41, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x03, 0x42, 0x6f, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, 0x6f, 0x74, 0x52, - 0x03, 0x42, 0x6f, 0x74, 0x22, 0x4c, 0x0a, 0x10, 0x41, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x65, 0x64, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x6e, 0x76, 0x69, - 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x49, 0x6e, 0x76, 0x69, 0x74, - 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x65, 0x64, 0x22, 0x6c, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x74, 0x43, 0x6f, - 0x64, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x20, - 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_auth_proto_rawDescOnce sync.Once - file_auth_proto_rawDescData = file_auth_proto_rawDesc -) - -func file_auth_proto_rawDescGZIP() []byte { - file_auth_proto_rawDescOnce.Do(func() { - file_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_auth_proto_rawDescData) - }) - return file_auth_proto_rawDescData -} - -var file_auth_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 27) -var file_auth_proto_goTypes = []interface{}{ - (InitAuthCompleted_Statuses)(0), // 0: msg.InitAuthCompleted.Statuses - (*InitConnect)(nil), // 1: msg.InitConnect - (*InitCompleteAuth)(nil), // 2: msg.InitCompleteAuth - (*InitConnectTest)(nil), // 3: msg.InitConnectTest - (*InitBindUser)(nil), // 4: msg.InitBindUser - (*AuthRegister)(nil), // 5: msg.AuthRegister - (*AuthBotRegister)(nil), // 6: msg.AuthBotRegister - (*AuthLogin)(nil), // 7: msg.AuthLogin - (*AuthCheckPassword)(nil), // 8: msg.AuthCheckPassword - (*AuthRecoverPassword)(nil), // 9: msg.AuthRecoverPassword - (*AuthLogout)(nil), // 10: msg.AuthLogout - (*AuthLoginByToken)(nil), // 11: msg.AuthLoginByToken - (*AuthCheckPhone)(nil), // 12: msg.AuthCheckPhone - (*AuthSendCode)(nil), // 13: msg.AuthSendCode - (*AuthResendCode)(nil), // 14: msg.AuthResendCode - (*AuthRecall)(nil), // 15: msg.AuthRecall - (*AuthDestroyKey)(nil), // 16: msg.AuthDestroyKey - (*InitTestAuth)(nil), // 17: msg.InitTestAuth - (*InitResponse)(nil), // 18: msg.InitResponse - (*InitCompleteAuthInternal)(nil), // 19: msg.InitCompleteAuthInternal - (*InitAuthCompleted)(nil), // 20: msg.InitAuthCompleted - (*InitUserBound)(nil), // 21: msg.InitUserBound - (*AuthPasswordRecovery)(nil), // 22: msg.AuthPasswordRecovery - (*AuthRecalled)(nil), // 23: msg.AuthRecalled - (*AuthAuthorization)(nil), // 24: msg.AuthAuthorization - (*AuthBotAuthorization)(nil), // 25: msg.AuthBotAuthorization - (*AuthCheckedPhone)(nil), // 26: msg.AuthCheckedPhone - (*AuthSentCode)(nil), // 27: msg.AuthSentCode - (*InputPassword)(nil), // 28: msg.InputPassword - (*User)(nil), // 29: msg.User - (*Bot)(nil), // 30: msg.Bot -} -var file_auth_proto_depIdxs = []int32{ - 28, // 0: msg.AuthCheckPassword.Password:type_name -> msg.InputPassword - 0, // 1: msg.InitAuthCompleted.Status:type_name -> msg.InitAuthCompleted.Statuses - 29, // 2: msg.AuthAuthorization.User:type_name -> msg.User - 30, // 3: msg.AuthBotAuthorization.Bot:type_name -> msg.Bot - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_auth_proto_init() } -func file_auth_proto_init() { - if File_auth_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitConnect); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitCompleteAuth); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitConnectTest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitBindUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthRegister); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthBotRegister); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthLogin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthCheckPassword); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthRecoverPassword); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthLogout); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthLoginByToken); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthCheckPhone); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthSendCode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthResendCode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthRecall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthDestroyKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitTestAuth); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitCompleteAuthInternal); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitAuthCompleted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InitUserBound); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthPasswordRecovery); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthRecalled); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthAuthorization); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthBotAuthorization); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthCheckedPhone); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AuthSentCode); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_auth_proto_rawDesc, - NumEnums: 1, - NumMessages: 27, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_auth_proto_goTypes, - DependencyIndexes: file_auth_proto_depIdxs, - EnumInfos: file_auth_proto_enumTypes, - MessageInfos: file_auth_proto_msgTypes, - }.Build() - File_auth_proto = out.File - file_auth_proto_rawDesc = nil - file_auth_proto_goTypes = nil - file_auth_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/auth.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/auth.rony.go deleted file mode 100644 index 8548c929..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/auth.rony.go +++ /dev/null @@ -1,1715 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: auth.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_InitConnect int64 = 4150793517 - -type poolInitConnect struct { - pool sync.Pool -} - -func (p *poolInitConnect) Get() *InitConnect { - x, ok := p.pool.Get().(*InitConnect) - if !ok { - x = &InitConnect{} - } - - return x -} - -func (p *poolInitConnect) Put(x *InitConnect) { - if x == nil { - return - } - - x.ClientNonce = 0 - - p.pool.Put(x) -} - -var PoolInitConnect = poolInitConnect{} - -func (x *InitConnect) DeepCopy(z *InitConnect) { - z.ClientNonce = x.ClientNonce -} - -func (x *InitConnect) Clone() *InitConnect { - z := &InitConnect{} - x.DeepCopy(z) - return z -} - -func (x *InitConnect) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InitConnect) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InitConnect) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InitConnect) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InitConnect) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InitConnect, x) -} - -const C_InitCompleteAuth int64 = 1583178320 - -type poolInitCompleteAuth struct { - pool sync.Pool -} - -func (p *poolInitCompleteAuth) Get() *InitCompleteAuth { - x, ok := p.pool.Get().(*InitCompleteAuth) - if !ok { - x = &InitCompleteAuth{} - } - - return x -} - -func (p *poolInitCompleteAuth) Put(x *InitCompleteAuth) { - if x == nil { - return - } - - x.ClientNonce = 0 - x.ServerNonce = 0 - x.ClientDHPubKey = x.ClientDHPubKey[:0] - x.P = 0 - x.Q = 0 - x.EncryptedPayload = x.EncryptedPayload[:0] - - p.pool.Put(x) -} - -var PoolInitCompleteAuth = poolInitCompleteAuth{} - -func (x *InitCompleteAuth) DeepCopy(z *InitCompleteAuth) { - z.ClientNonce = x.ClientNonce - z.ServerNonce = x.ServerNonce - z.ClientDHPubKey = append(z.ClientDHPubKey[:0], x.ClientDHPubKey...) - z.P = x.P - z.Q = x.Q - z.EncryptedPayload = append(z.EncryptedPayload[:0], x.EncryptedPayload...) -} - -func (x *InitCompleteAuth) Clone() *InitCompleteAuth { - z := &InitCompleteAuth{} - x.DeepCopy(z) - return z -} - -func (x *InitCompleteAuth) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InitCompleteAuth) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InitCompleteAuth) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InitCompleteAuth) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InitCompleteAuth) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InitCompleteAuth, x) -} - -const C_InitConnectTest int64 = 3188015450 - -type poolInitConnectTest struct { - pool sync.Pool -} - -func (p *poolInitConnectTest) Get() *InitConnectTest { - x, ok := p.pool.Get().(*InitConnectTest) - if !ok { - x = &InitConnectTest{} - } - - return x -} - -func (p *poolInitConnectTest) Put(x *InitConnectTest) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolInitConnectTest = poolInitConnectTest{} - -func (x *InitConnectTest) DeepCopy(z *InitConnectTest) { -} - -func (x *InitConnectTest) Clone() *InitConnectTest { - z := &InitConnectTest{} - x.DeepCopy(z) - return z -} - -func (x *InitConnectTest) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InitConnectTest) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InitConnectTest) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InitConnectTest) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InitConnectTest) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InitConnectTest, x) -} - -const C_InitBindUser int64 = 1933549113 - -type poolInitBindUser struct { - pool sync.Pool -} - -func (p *poolInitBindUser) Get() *InitBindUser { - x, ok := p.pool.Get().(*InitBindUser) - if !ok { - x = &InitBindUser{} - } - - return x -} - -func (p *poolInitBindUser) Put(x *InitBindUser) { - if x == nil { - return - } - - x.AuthKey = "" - x.Username = "" - x.Phone = "" - x.FirstName = "" - x.LastName = "" - - p.pool.Put(x) -} - -var PoolInitBindUser = poolInitBindUser{} - -func (x *InitBindUser) DeepCopy(z *InitBindUser) { - z.AuthKey = x.AuthKey - z.Username = x.Username - z.Phone = x.Phone - z.FirstName = x.FirstName - z.LastName = x.LastName -} - -func (x *InitBindUser) Clone() *InitBindUser { - z := &InitBindUser{} - x.DeepCopy(z) - return z -} - -func (x *InitBindUser) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InitBindUser) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InitBindUser) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InitBindUser) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InitBindUser) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InitBindUser, x) -} - -const C_AuthRegister int64 = 2228369460 - -type poolAuthRegister struct { - pool sync.Pool -} - -func (p *poolAuthRegister) Get() *AuthRegister { - x, ok := p.pool.Get().(*AuthRegister) - if !ok { - x = &AuthRegister{} - } - - return x -} - -func (p *poolAuthRegister) Put(x *AuthRegister) { - if x == nil { - return - } - - x.Phone = "" - x.FirstName = "" - x.LastName = "" - x.PhoneCode = "" - x.PhoneCodeHash = "" - x.LangCode = "" - - p.pool.Put(x) -} - -var PoolAuthRegister = poolAuthRegister{} - -func (x *AuthRegister) DeepCopy(z *AuthRegister) { - z.Phone = x.Phone - z.FirstName = x.FirstName - z.LastName = x.LastName - z.PhoneCode = x.PhoneCode - z.PhoneCodeHash = x.PhoneCodeHash - z.LangCode = x.LangCode -} - -func (x *AuthRegister) Clone() *AuthRegister { - z := &AuthRegister{} - x.DeepCopy(z) - return z -} - -func (x *AuthRegister) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthRegister) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthRegister) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthRegister) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthRegister) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthRegister, x) -} - -const C_AuthBotRegister int64 = 1579606687 - -type poolAuthBotRegister struct { - pool sync.Pool -} - -func (p *poolAuthBotRegister) Get() *AuthBotRegister { - x, ok := p.pool.Get().(*AuthBotRegister) - if !ok { - x = &AuthBotRegister{} - } - - return x -} - -func (p *poolAuthBotRegister) Put(x *AuthBotRegister) { - if x == nil { - return - } - - x.Name = "" - x.Username = "" - x.OwnerID = 0 - - p.pool.Put(x) -} - -var PoolAuthBotRegister = poolAuthBotRegister{} - -func (x *AuthBotRegister) DeepCopy(z *AuthBotRegister) { - z.Name = x.Name - z.Username = x.Username - z.OwnerID = x.OwnerID -} - -func (x *AuthBotRegister) Clone() *AuthBotRegister { - z := &AuthBotRegister{} - x.DeepCopy(z) - return z -} - -func (x *AuthBotRegister) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthBotRegister) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthBotRegister) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthBotRegister) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthBotRegister) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthBotRegister, x) -} - -const C_AuthLogin int64 = 2587620888 - -type poolAuthLogin struct { - pool sync.Pool -} - -func (p *poolAuthLogin) Get() *AuthLogin { - x, ok := p.pool.Get().(*AuthLogin) - if !ok { - x = &AuthLogin{} - } - - return x -} - -func (p *poolAuthLogin) Put(x *AuthLogin) { - if x == nil { - return - } - - x.Phone = "" - x.PhoneCodeHash = "" - x.PhoneCode = "" - - p.pool.Put(x) -} - -var PoolAuthLogin = poolAuthLogin{} - -func (x *AuthLogin) DeepCopy(z *AuthLogin) { - z.Phone = x.Phone - z.PhoneCodeHash = x.PhoneCodeHash - z.PhoneCode = x.PhoneCode -} - -func (x *AuthLogin) Clone() *AuthLogin { - z := &AuthLogin{} - x.DeepCopy(z) - return z -} - -func (x *AuthLogin) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthLogin) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthLogin) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthLogin) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthLogin) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthLogin, x) -} - -const C_AuthCheckPassword int64 = 3346962908 - -type poolAuthCheckPassword struct { - pool sync.Pool -} - -func (p *poolAuthCheckPassword) Get() *AuthCheckPassword { - x, ok := p.pool.Get().(*AuthCheckPassword) - if !ok { - x = &AuthCheckPassword{} - } - - x.Password = PoolInputPassword.Get() - - return x -} - -func (p *poolAuthCheckPassword) Put(x *AuthCheckPassword) { - if x == nil { - return - } - - PoolInputPassword.Put(x.Password) - - p.pool.Put(x) -} - -var PoolAuthCheckPassword = poolAuthCheckPassword{} - -func (x *AuthCheckPassword) DeepCopy(z *AuthCheckPassword) { - if x.Password != nil { - if z.Password == nil { - z.Password = PoolInputPassword.Get() - } - x.Password.DeepCopy(z.Password) - } else { - PoolInputPassword.Put(z.Password) - z.Password = nil - } -} - -func (x *AuthCheckPassword) Clone() *AuthCheckPassword { - z := &AuthCheckPassword{} - x.DeepCopy(z) - return z -} - -func (x *AuthCheckPassword) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthCheckPassword) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthCheckPassword) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthCheckPassword) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthCheckPassword) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthCheckPassword, x) -} - -const C_AuthRecoverPassword int64 = 2711231991 - -type poolAuthRecoverPassword struct { - pool sync.Pool -} - -func (p *poolAuthRecoverPassword) Get() *AuthRecoverPassword { - x, ok := p.pool.Get().(*AuthRecoverPassword) - if !ok { - x = &AuthRecoverPassword{} - } - - return x -} - -func (p *poolAuthRecoverPassword) Put(x *AuthRecoverPassword) { - if x == nil { - return - } - - x.Code = "" - - p.pool.Put(x) -} - -var PoolAuthRecoverPassword = poolAuthRecoverPassword{} - -func (x *AuthRecoverPassword) DeepCopy(z *AuthRecoverPassword) { - z.Code = x.Code -} - -func (x *AuthRecoverPassword) Clone() *AuthRecoverPassword { - z := &AuthRecoverPassword{} - x.DeepCopy(z) - return z -} - -func (x *AuthRecoverPassword) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthRecoverPassword) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthRecoverPassword) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthRecoverPassword) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthRecoverPassword) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthRecoverPassword, x) -} - -const C_AuthLogout int64 = 992431648 - -type poolAuthLogout struct { - pool sync.Pool -} - -func (p *poolAuthLogout) Get() *AuthLogout { - x, ok := p.pool.Get().(*AuthLogout) - if !ok { - x = &AuthLogout{} - } - - return x -} - -func (p *poolAuthLogout) Put(x *AuthLogout) { - if x == nil { - return - } - - x.AuthIDs = x.AuthIDs[:0] - - p.pool.Put(x) -} - -var PoolAuthLogout = poolAuthLogout{} - -func (x *AuthLogout) DeepCopy(z *AuthLogout) { - z.AuthIDs = append(z.AuthIDs[:0], x.AuthIDs...) -} - -func (x *AuthLogout) Clone() *AuthLogout { - z := &AuthLogout{} - x.DeepCopy(z) - return z -} - -func (x *AuthLogout) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthLogout) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthLogout) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthLogout) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthLogout) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthLogout, x) -} - -const C_AuthLoginByToken int64 = 2851553023 - -type poolAuthLoginByToken struct { - pool sync.Pool -} - -func (p *poolAuthLoginByToken) Get() *AuthLoginByToken { - x, ok := p.pool.Get().(*AuthLoginByToken) - if !ok { - x = &AuthLoginByToken{} - } - - return x -} - -func (p *poolAuthLoginByToken) Put(x *AuthLoginByToken) { - if x == nil { - return - } - - x.Token = "" - x.Provider = "" - x.Firstname = "" - x.Lastname = "" - - p.pool.Put(x) -} - -var PoolAuthLoginByToken = poolAuthLoginByToken{} - -func (x *AuthLoginByToken) DeepCopy(z *AuthLoginByToken) { - z.Token = x.Token - z.Provider = x.Provider - z.Firstname = x.Firstname - z.Lastname = x.Lastname -} - -func (x *AuthLoginByToken) Clone() *AuthLoginByToken { - z := &AuthLoginByToken{} - x.DeepCopy(z) - return z -} - -func (x *AuthLoginByToken) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthLoginByToken) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthLoginByToken) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthLoginByToken) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthLoginByToken) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthLoginByToken, x) -} - -const C_AuthCheckPhone int64 = 4134648516 - -type poolAuthCheckPhone struct { - pool sync.Pool -} - -func (p *poolAuthCheckPhone) Get() *AuthCheckPhone { - x, ok := p.pool.Get().(*AuthCheckPhone) - if !ok { - x = &AuthCheckPhone{} - } - - return x -} - -func (p *poolAuthCheckPhone) Put(x *AuthCheckPhone) { - if x == nil { - return - } - - x.Phone = "" - - p.pool.Put(x) -} - -var PoolAuthCheckPhone = poolAuthCheckPhone{} - -func (x *AuthCheckPhone) DeepCopy(z *AuthCheckPhone) { - z.Phone = x.Phone -} - -func (x *AuthCheckPhone) Clone() *AuthCheckPhone { - z := &AuthCheckPhone{} - x.DeepCopy(z) - return z -} - -func (x *AuthCheckPhone) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthCheckPhone) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthCheckPhone) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthCheckPhone) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthCheckPhone) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthCheckPhone, x) -} - -const C_AuthSendCode int64 = 3984043365 - -type poolAuthSendCode struct { - pool sync.Pool -} - -func (p *poolAuthSendCode) Get() *AuthSendCode { - x, ok := p.pool.Get().(*AuthSendCode) - if !ok { - x = &AuthSendCode{} - } - - return x -} - -func (p *poolAuthSendCode) Put(x *AuthSendCode) { - if x == nil { - return - } - - x.Phone = "" - x.AppHash = "" - - p.pool.Put(x) -} - -var PoolAuthSendCode = poolAuthSendCode{} - -func (x *AuthSendCode) DeepCopy(z *AuthSendCode) { - z.Phone = x.Phone - z.AppHash = x.AppHash -} - -func (x *AuthSendCode) Clone() *AuthSendCode { - z := &AuthSendCode{} - x.DeepCopy(z) - return z -} - -func (x *AuthSendCode) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthSendCode) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthSendCode) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthSendCode) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthSendCode) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthSendCode, x) -} - -const C_AuthResendCode int64 = 2682713491 - -type poolAuthResendCode struct { - pool sync.Pool -} - -func (p *poolAuthResendCode) Get() *AuthResendCode { - x, ok := p.pool.Get().(*AuthResendCode) - if !ok { - x = &AuthResendCode{} - } - - return x -} - -func (p *poolAuthResendCode) Put(x *AuthResendCode) { - if x == nil { - return - } - - x.Phone = "" - x.PhoneCodeHash = "" - x.AppHash = "" - - p.pool.Put(x) -} - -var PoolAuthResendCode = poolAuthResendCode{} - -func (x *AuthResendCode) DeepCopy(z *AuthResendCode) { - z.Phone = x.Phone - z.PhoneCodeHash = x.PhoneCodeHash - z.AppHash = x.AppHash -} - -func (x *AuthResendCode) Clone() *AuthResendCode { - z := &AuthResendCode{} - x.DeepCopy(z) - return z -} - -func (x *AuthResendCode) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthResendCode) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthResendCode) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthResendCode) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthResendCode) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthResendCode, x) -} - -const C_AuthRecall int64 = 1172029049 - -type poolAuthRecall struct { - pool sync.Pool -} - -func (p *poolAuthRecall) Get() *AuthRecall { - x, ok := p.pool.Get().(*AuthRecall) - if !ok { - x = &AuthRecall{} - } - - return x -} - -func (p *poolAuthRecall) Put(x *AuthRecall) { - if x == nil { - return - } - - x.ClientID = 0 - x.Version = 0 - x.AppVersion = "" - x.Platform = "" - x.Vendor = "" - x.OSVersion = "" - - p.pool.Put(x) -} - -var PoolAuthRecall = poolAuthRecall{} - -func (x *AuthRecall) DeepCopy(z *AuthRecall) { - z.ClientID = x.ClientID - z.Version = x.Version - z.AppVersion = x.AppVersion - z.Platform = x.Platform - z.Vendor = x.Vendor - z.OSVersion = x.OSVersion -} - -func (x *AuthRecall) Clone() *AuthRecall { - z := &AuthRecall{} - x.DeepCopy(z) - return z -} - -func (x *AuthRecall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthRecall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthRecall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthRecall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthRecall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthRecall, x) -} - -const C_AuthDestroyKey int64 = 3673422656 - -type poolAuthDestroyKey struct { - pool sync.Pool -} - -func (p *poolAuthDestroyKey) Get() *AuthDestroyKey { - x, ok := p.pool.Get().(*AuthDestroyKey) - if !ok { - x = &AuthDestroyKey{} - } - - return x -} - -func (p *poolAuthDestroyKey) Put(x *AuthDestroyKey) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolAuthDestroyKey = poolAuthDestroyKey{} - -func (x *AuthDestroyKey) DeepCopy(z *AuthDestroyKey) { -} - -func (x *AuthDestroyKey) Clone() *AuthDestroyKey { - z := &AuthDestroyKey{} - x.DeepCopy(z) - return z -} - -func (x *AuthDestroyKey) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthDestroyKey) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthDestroyKey) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthDestroyKey) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthDestroyKey) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthDestroyKey, x) -} - -const C_InitTestAuth int64 = 2762878006 - -type poolInitTestAuth struct { - pool sync.Pool -} - -func (p *poolInitTestAuth) Get() *InitTestAuth { - x, ok := p.pool.Get().(*InitTestAuth) - if !ok { - x = &InitTestAuth{} - } - - return x -} - -func (p *poolInitTestAuth) Put(x *InitTestAuth) { - if x == nil { - return - } - - x.AuthID = 0 - x.AuthKey = x.AuthKey[:0] - - p.pool.Put(x) -} - -var PoolInitTestAuth = poolInitTestAuth{} - -func (x *InitTestAuth) DeepCopy(z *InitTestAuth) { - z.AuthID = x.AuthID - z.AuthKey = append(z.AuthKey[:0], x.AuthKey...) -} - -func (x *InitTestAuth) Clone() *InitTestAuth { - z := &InitTestAuth{} - x.DeepCopy(z) - return z -} - -func (x *InitTestAuth) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InitTestAuth) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InitTestAuth) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InitTestAuth) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InitTestAuth) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InitTestAuth, x) -} - -const C_InitResponse int64 = 4130340247 - -type poolInitResponse struct { - pool sync.Pool -} - -func (p *poolInitResponse) Get() *InitResponse { - x, ok := p.pool.Get().(*InitResponse) - if !ok { - x = &InitResponse{} - } - - return x -} - -func (p *poolInitResponse) Put(x *InitResponse) { - if x == nil { - return - } - - x.ClientNonce = 0 - x.ServerNonce = 0 - x.RSAPubKeyFingerPrint = 0 - x.DHGroupFingerPrint = 0 - x.PQ = 0 - x.ServerTimestamp = 0 - - p.pool.Put(x) -} - -var PoolInitResponse = poolInitResponse{} - -func (x *InitResponse) DeepCopy(z *InitResponse) { - z.ClientNonce = x.ClientNonce - z.ServerNonce = x.ServerNonce - z.RSAPubKeyFingerPrint = x.RSAPubKeyFingerPrint - z.DHGroupFingerPrint = x.DHGroupFingerPrint - z.PQ = x.PQ - z.ServerTimestamp = x.ServerTimestamp -} - -func (x *InitResponse) Clone() *InitResponse { - z := &InitResponse{} - x.DeepCopy(z) - return z -} - -func (x *InitResponse) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InitResponse) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InitResponse) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InitResponse) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InitResponse) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InitResponse, x) -} - -const C_InitCompleteAuthInternal int64 = 2360982492 - -type poolInitCompleteAuthInternal struct { - pool sync.Pool -} - -func (p *poolInitCompleteAuthInternal) Get() *InitCompleteAuthInternal { - x, ok := p.pool.Get().(*InitCompleteAuthInternal) - if !ok { - x = &InitCompleteAuthInternal{} - } - - return x -} - -func (p *poolInitCompleteAuthInternal) Put(x *InitCompleteAuthInternal) { - if x == nil { - return - } - - x.SecretNonce = x.SecretNonce[:0] - - p.pool.Put(x) -} - -var PoolInitCompleteAuthInternal = poolInitCompleteAuthInternal{} - -func (x *InitCompleteAuthInternal) DeepCopy(z *InitCompleteAuthInternal) { - z.SecretNonce = append(z.SecretNonce[:0], x.SecretNonce...) -} - -func (x *InitCompleteAuthInternal) Clone() *InitCompleteAuthInternal { - z := &InitCompleteAuthInternal{} - x.DeepCopy(z) - return z -} - -func (x *InitCompleteAuthInternal) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InitCompleteAuthInternal) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InitCompleteAuthInternal) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InitCompleteAuthInternal) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InitCompleteAuthInternal) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InitCompleteAuthInternal, x) -} - -const C_InitAuthCompleted int64 = 627708982 - -type poolInitAuthCompleted struct { - pool sync.Pool -} - -func (p *poolInitAuthCompleted) Get() *InitAuthCompleted { - x, ok := p.pool.Get().(*InitAuthCompleted) - if !ok { - x = &InitAuthCompleted{} - } - - return x -} - -func (p *poolInitAuthCompleted) Put(x *InitAuthCompleted) { - if x == nil { - return - } - - x.ClientNonce = 0 - x.ServerNonce = 0 - x.Status = 0 - x.SecretHash = 0 - x.ServerDHPubKey = x.ServerDHPubKey[:0] - - p.pool.Put(x) -} - -var PoolInitAuthCompleted = poolInitAuthCompleted{} - -func (x *InitAuthCompleted) DeepCopy(z *InitAuthCompleted) { - z.ClientNonce = x.ClientNonce - z.ServerNonce = x.ServerNonce - z.Status = x.Status - z.SecretHash = x.SecretHash - z.ServerDHPubKey = append(z.ServerDHPubKey[:0], x.ServerDHPubKey...) -} - -func (x *InitAuthCompleted) Clone() *InitAuthCompleted { - z := &InitAuthCompleted{} - x.DeepCopy(z) - return z -} - -func (x *InitAuthCompleted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InitAuthCompleted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InitAuthCompleted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InitAuthCompleted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InitAuthCompleted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InitAuthCompleted, x) -} - -const C_InitUserBound int64 = 128391141 - -type poolInitUserBound struct { - pool sync.Pool -} - -func (p *poolInitUserBound) Get() *InitUserBound { - x, ok := p.pool.Get().(*InitUserBound) - if !ok { - x = &InitUserBound{} - } - - return x -} - -func (p *poolInitUserBound) Put(x *InitUserBound) { - if x == nil { - return - } - - x.AuthID = 0 - - p.pool.Put(x) -} - -var PoolInitUserBound = poolInitUserBound{} - -func (x *InitUserBound) DeepCopy(z *InitUserBound) { - z.AuthID = x.AuthID -} - -func (x *InitUserBound) Clone() *InitUserBound { - z := &InitUserBound{} - x.DeepCopy(z) - return z -} - -func (x *InitUserBound) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InitUserBound) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InitUserBound) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InitUserBound) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InitUserBound) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InitUserBound, x) -} - -const C_AuthPasswordRecovery int64 = 3813475914 - -type poolAuthPasswordRecovery struct { - pool sync.Pool -} - -func (p *poolAuthPasswordRecovery) Get() *AuthPasswordRecovery { - x, ok := p.pool.Get().(*AuthPasswordRecovery) - if !ok { - x = &AuthPasswordRecovery{} - } - - return x -} - -func (p *poolAuthPasswordRecovery) Put(x *AuthPasswordRecovery) { - if x == nil { - return - } - - x.EmailPattern = "" - - p.pool.Put(x) -} - -var PoolAuthPasswordRecovery = poolAuthPasswordRecovery{} - -func (x *AuthPasswordRecovery) DeepCopy(z *AuthPasswordRecovery) { - z.EmailPattern = x.EmailPattern -} - -func (x *AuthPasswordRecovery) Clone() *AuthPasswordRecovery { - z := &AuthPasswordRecovery{} - x.DeepCopy(z) - return z -} - -func (x *AuthPasswordRecovery) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthPasswordRecovery) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthPasswordRecovery) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthPasswordRecovery) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthPasswordRecovery) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthPasswordRecovery, x) -} - -const C_AuthRecalled int64 = 3249025459 - -type poolAuthRecalled struct { - pool sync.Pool -} - -func (p *poolAuthRecalled) Get() *AuthRecalled { - x, ok := p.pool.Get().(*AuthRecalled) - if !ok { - x = &AuthRecalled{} - } - - return x -} - -func (p *poolAuthRecalled) Put(x *AuthRecalled) { - if x == nil { - return - } - - x.ClientID = 0 - x.Timestamp = 0 - x.UpdateID = 0 - x.Available = false - x.Force = false - x.CurrentVersion = "" - - p.pool.Put(x) -} - -var PoolAuthRecalled = poolAuthRecalled{} - -func (x *AuthRecalled) DeepCopy(z *AuthRecalled) { - z.ClientID = x.ClientID - z.Timestamp = x.Timestamp - z.UpdateID = x.UpdateID - z.Available = x.Available - z.Force = x.Force - z.CurrentVersion = x.CurrentVersion -} - -func (x *AuthRecalled) Clone() *AuthRecalled { - z := &AuthRecalled{} - x.DeepCopy(z) - return z -} - -func (x *AuthRecalled) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthRecalled) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthRecalled) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthRecalled) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthRecalled) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthRecalled, x) -} - -const C_AuthAuthorization int64 = 1140037965 - -type poolAuthAuthorization struct { - pool sync.Pool -} - -func (p *poolAuthAuthorization) Get() *AuthAuthorization { - x, ok := p.pool.Get().(*AuthAuthorization) - if !ok { - x = &AuthAuthorization{} - } - - x.User = PoolUser.Get() - - return x -} - -func (p *poolAuthAuthorization) Put(x *AuthAuthorization) { - if x == nil { - return - } - - x.Expired = 0 - PoolUser.Put(x.User) - x.ActiveSessions = 0 - - p.pool.Put(x) -} - -var PoolAuthAuthorization = poolAuthAuthorization{} - -func (x *AuthAuthorization) DeepCopy(z *AuthAuthorization) { - z.Expired = x.Expired - if x.User != nil { - if z.User == nil { - z.User = PoolUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolUser.Put(z.User) - z.User = nil - } - z.ActiveSessions = x.ActiveSessions -} - -func (x *AuthAuthorization) Clone() *AuthAuthorization { - z := &AuthAuthorization{} - x.DeepCopy(z) - return z -} - -func (x *AuthAuthorization) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthAuthorization) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthAuthorization) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthAuthorization) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthAuthorization) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthAuthorization, x) -} - -const C_AuthBotAuthorization int64 = 3304560814 - -type poolAuthBotAuthorization struct { - pool sync.Pool -} - -func (p *poolAuthBotAuthorization) Get() *AuthBotAuthorization { - x, ok := p.pool.Get().(*AuthBotAuthorization) - if !ok { - x = &AuthBotAuthorization{} - } - - x.Bot = PoolBot.Get() - - return x -} - -func (p *poolAuthBotAuthorization) Put(x *AuthBotAuthorization) { - if x == nil { - return - } - - x.AuthID = 0 - x.AuthKey = x.AuthKey[:0] - PoolBot.Put(x.Bot) - - p.pool.Put(x) -} - -var PoolAuthBotAuthorization = poolAuthBotAuthorization{} - -func (x *AuthBotAuthorization) DeepCopy(z *AuthBotAuthorization) { - z.AuthID = x.AuthID - z.AuthKey = append(z.AuthKey[:0], x.AuthKey...) - if x.Bot != nil { - if z.Bot == nil { - z.Bot = PoolBot.Get() - } - x.Bot.DeepCopy(z.Bot) - } else { - PoolBot.Put(z.Bot) - z.Bot = nil - } -} - -func (x *AuthBotAuthorization) Clone() *AuthBotAuthorization { - z := &AuthBotAuthorization{} - x.DeepCopy(z) - return z -} - -func (x *AuthBotAuthorization) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthBotAuthorization) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthBotAuthorization) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthBotAuthorization) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthBotAuthorization) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthBotAuthorization, x) -} - -const C_AuthCheckedPhone int64 = 2236203131 - -type poolAuthCheckedPhone struct { - pool sync.Pool -} - -func (p *poolAuthCheckedPhone) Get() *AuthCheckedPhone { - x, ok := p.pool.Get().(*AuthCheckedPhone) - if !ok { - x = &AuthCheckedPhone{} - } - - return x -} - -func (p *poolAuthCheckedPhone) Put(x *AuthCheckedPhone) { - if x == nil { - return - } - - x.Invited = false - x.Registered = false - - p.pool.Put(x) -} - -var PoolAuthCheckedPhone = poolAuthCheckedPhone{} - -func (x *AuthCheckedPhone) DeepCopy(z *AuthCheckedPhone) { - z.Invited = x.Invited - z.Registered = x.Registered -} - -func (x *AuthCheckedPhone) Clone() *AuthCheckedPhone { - z := &AuthCheckedPhone{} - x.DeepCopy(z) - return z -} - -func (x *AuthCheckedPhone) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthCheckedPhone) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthCheckedPhone) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthCheckedPhone) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthCheckedPhone) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthCheckedPhone, x) -} - -const C_AuthSentCode int64 = 2375498471 - -type poolAuthSentCode struct { - pool sync.Pool -} - -func (p *poolAuthSentCode) Get() *AuthSentCode { - x, ok := p.pool.Get().(*AuthSentCode) - if !ok { - x = &AuthSentCode{} - } - - return x -} - -func (p *poolAuthSentCode) Put(x *AuthSentCode) { - if x == nil { - return - } - - x.Phone = "" - x.PhoneCodeHash = "" - x.SendToPhone = false - - p.pool.Put(x) -} - -var PoolAuthSentCode = poolAuthSentCode{} - -func (x *AuthSentCode) DeepCopy(z *AuthSentCode) { - z.Phone = x.Phone - z.PhoneCodeHash = x.PhoneCodeHash - z.SendToPhone = x.SendToPhone -} - -func (x *AuthSentCode) Clone() *AuthSentCode { - z := &AuthSentCode{} - x.DeepCopy(z) - return z -} - -func (x *AuthSentCode) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AuthSentCode) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AuthSentCode) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AuthSentCode) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AuthSentCode) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AuthSentCode, x) -} - -func init() { - registry.RegisterConstructor(4150793517, "InitConnect") - registry.RegisterConstructor(1583178320, "InitCompleteAuth") - registry.RegisterConstructor(3188015450, "InitConnectTest") - registry.RegisterConstructor(1933549113, "InitBindUser") - registry.RegisterConstructor(2228369460, "AuthRegister") - registry.RegisterConstructor(1579606687, "AuthBotRegister") - registry.RegisterConstructor(2587620888, "AuthLogin") - registry.RegisterConstructor(3346962908, "AuthCheckPassword") - registry.RegisterConstructor(2711231991, "AuthRecoverPassword") - registry.RegisterConstructor(992431648, "AuthLogout") - registry.RegisterConstructor(2851553023, "AuthLoginByToken") - registry.RegisterConstructor(4134648516, "AuthCheckPhone") - registry.RegisterConstructor(3984043365, "AuthSendCode") - registry.RegisterConstructor(2682713491, "AuthResendCode") - registry.RegisterConstructor(1172029049, "AuthRecall") - registry.RegisterConstructor(3673422656, "AuthDestroyKey") - registry.RegisterConstructor(2762878006, "InitTestAuth") - registry.RegisterConstructor(4130340247, "InitResponse") - registry.RegisterConstructor(2360982492, "InitCompleteAuthInternal") - registry.RegisterConstructor(627708982, "InitAuthCompleted") - registry.RegisterConstructor(128391141, "InitUserBound") - registry.RegisterConstructor(3813475914, "AuthPasswordRecovery") - registry.RegisterConstructor(3249025459, "AuthRecalled") - registry.RegisterConstructor(1140037965, "AuthAuthorization") - registry.RegisterConstructor(3304560814, "AuthBotAuthorization") - registry.RegisterConstructor(2236203131, "AuthCheckedPhone") - registry.RegisterConstructor(2375498471, "AuthSentCode") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/calendar.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/calendar.pb.go deleted file mode 100644 index 6f056dbc..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/calendar.pb.go +++ /dev/null @@ -1,849 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: calendar.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// RecurringPeriod -type RecurringPeriod int32 - -const ( - RecurringPeriod_RecurringNone RecurringPeriod = 0 - RecurringPeriod_RecurringDaily RecurringPeriod = 1 - RecurringPeriod_RecurringWeekly RecurringPeriod = 2 - RecurringPeriod_RecurringMonthly RecurringPeriod = 3 - RecurringPeriod_RecurringYearly RecurringPeriod = 4 -) - -// Enum value maps for RecurringPeriod. -var ( - RecurringPeriod_name = map[int32]string{ - 0: "RecurringNone", - 1: "RecurringDaily", - 2: "RecurringWeekly", - 3: "RecurringMonthly", - 4: "RecurringYearly", - } - RecurringPeriod_value = map[string]int32{ - "RecurringNone": 0, - "RecurringDaily": 1, - "RecurringWeekly": 2, - "RecurringMonthly": 3, - "RecurringYearly": 4, - } -) - -func (x RecurringPeriod) Enum() *RecurringPeriod { - p := new(RecurringPeriod) - *p = x - return p -} - -func (x RecurringPeriod) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RecurringPeriod) Descriptor() protoreflect.EnumDescriptor { - return file_calendar_proto_enumTypes[0].Descriptor() -} - -func (RecurringPeriod) Type() protoreflect.EnumType { - return &file_calendar_proto_enumTypes[0] -} - -func (x RecurringPeriod) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RecurringPeriod.Descriptor instead. -func (RecurringPeriod) EnumDescriptor() ([]byte, []int) { - return file_calendar_proto_rawDescGZIP(), []int{0} -} - -// CalendarEditPolicy -type CalendarEditPolicy int32 - -const ( - CalendarEditPolicy_CalendarEditOne CalendarEditPolicy = 0 - CalendarEditPolicy_CalendarEditFollowing CalendarEditPolicy = 1 - CalendarEditPolicy_CalendarEditAll CalendarEditPolicy = 2 -) - -// Enum value maps for CalendarEditPolicy. -var ( - CalendarEditPolicy_name = map[int32]string{ - 0: "CalendarEditOne", - 1: "CalendarEditFollowing", - 2: "CalendarEditAll", - } - CalendarEditPolicy_value = map[string]int32{ - "CalendarEditOne": 0, - "CalendarEditFollowing": 1, - "CalendarEditAll": 2, - } -) - -func (x CalendarEditPolicy) Enum() *CalendarEditPolicy { - p := new(CalendarEditPolicy) - *p = x - return p -} - -func (x CalendarEditPolicy) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CalendarEditPolicy) Descriptor() protoreflect.EnumDescriptor { - return file_calendar_proto_enumTypes[1].Descriptor() -} - -func (CalendarEditPolicy) Type() protoreflect.EnumType { - return &file_calendar_proto_enumTypes[1] -} - -func (x CalendarEditPolicy) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CalendarEditPolicy.Descriptor instead. -func (CalendarEditPolicy) EnumDescriptor() ([]byte, []int) { - return file_calendar_proto_rawDescGZIP(), []int{1} -} - -// CalendarGetEvents -// @Function -// @Return: CalendarEventInstances -type CalendarGetEvents struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - From int64 `protobuf:"varint,1,opt,name=From,proto3" json:"From,omitempty"` - To int64 `protobuf:"varint,2,opt,name=To,proto3" json:"To,omitempty"` - Filter int32 `protobuf:"varint,3,opt,name=Filter,proto3" json:"Filter,omitempty"` -} - -func (x *CalendarGetEvents) Reset() { - *x = CalendarGetEvents{} - if protoimpl.UnsafeEnabled { - mi := &file_calendar_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CalendarGetEvents) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CalendarGetEvents) ProtoMessage() {} - -func (x *CalendarGetEvents) ProtoReflect() protoreflect.Message { - mi := &file_calendar_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CalendarGetEvents.ProtoReflect.Descriptor instead. -func (*CalendarGetEvents) Descriptor() ([]byte, []int) { - return file_calendar_proto_rawDescGZIP(), []int{0} -} - -func (x *CalendarGetEvents) GetFrom() int64 { - if x != nil { - return x.From - } - return 0 -} - -func (x *CalendarGetEvents) GetTo() int64 { - if x != nil { - return x.To - } - return 0 -} - -func (x *CalendarGetEvents) GetFilter() int32 { - if x != nil { - return x.Filter - } - return 0 -} - -// CalendarSetEvent -// @Function -// @Return: CalendarEventDescriptor -type CalendarSetEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` - Date int64 `protobuf:"varint,2,opt,name=Date,proto3" json:"Date,omitempty"` - StartRange int64 `protobuf:"varint,3,opt,name=StartRange,proto3" json:"StartRange,omitempty"` - Duration int64 `protobuf:"varint,4,opt,name=Duration,proto3" json:"Duration,omitempty"` - Recurring bool `protobuf:"varint,5,opt,name=Recurring,proto3" json:"Recurring,omitempty"` - Period RecurringPeriod `protobuf:"varint,6,opt,name=Period,proto3,enum=msg.RecurringPeriod" json:"Period,omitempty"` - AllDay bool `protobuf:"varint,7,opt,name=AllDay,proto3" json:"AllDay,omitempty"` - Team bool `protobuf:"varint,8,opt,name=Team,proto3" json:"Team,omitempty"` - Global bool `protobuf:"varint,9,opt,name=Global,proto3" json:"Global,omitempty"` -} - -func (x *CalendarSetEvent) Reset() { - *x = CalendarSetEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_calendar_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CalendarSetEvent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CalendarSetEvent) ProtoMessage() {} - -func (x *CalendarSetEvent) ProtoReflect() protoreflect.Message { - mi := &file_calendar_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CalendarSetEvent.ProtoReflect.Descriptor instead. -func (*CalendarSetEvent) Descriptor() ([]byte, []int) { - return file_calendar_proto_rawDescGZIP(), []int{1} -} - -func (x *CalendarSetEvent) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CalendarSetEvent) GetDate() int64 { - if x != nil { - return x.Date - } - return 0 -} - -func (x *CalendarSetEvent) GetStartRange() int64 { - if x != nil { - return x.StartRange - } - return 0 -} - -func (x *CalendarSetEvent) GetDuration() int64 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *CalendarSetEvent) GetRecurring() bool { - if x != nil { - return x.Recurring - } - return false -} - -func (x *CalendarSetEvent) GetPeriod() RecurringPeriod { - if x != nil { - return x.Period - } - return RecurringPeriod_RecurringNone -} - -func (x *CalendarSetEvent) GetAllDay() bool { - if x != nil { - return x.AllDay - } - return false -} - -func (x *CalendarSetEvent) GetTeam() bool { - if x != nil { - return x.Team - } - return false -} - -func (x *CalendarSetEvent) GetGlobal() bool { - if x != nil { - return x.Global - } - return false -} - -// CalendarEditEvent -// @Function -// @Return: CalendarEvent -type CalendarEditEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - EventID int64 `protobuf:"varint,1,opt,name=EventID,proto3" json:"EventID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Date int64 `protobuf:"varint,3,opt,name=Date,proto3" json:"Date,omitempty"` - StartRange int64 `protobuf:"varint,4,opt,name=StartRange,proto3" json:"StartRange,omitempty"` - Duration int64 `protobuf:"varint,5,opt,name=Duration,proto3" json:"Duration,omitempty"` - Recurring bool `protobuf:"varint,6,opt,name=Recurring,proto3" json:"Recurring,omitempty"` - Period RecurringPeriod `protobuf:"varint,7,opt,name=Period,proto3,enum=msg.RecurringPeriod" json:"Period,omitempty"` - AllDay bool `protobuf:"varint,8,opt,name=AllDay,proto3" json:"AllDay,omitempty"` - Policy CalendarEditPolicy `protobuf:"varint,9,opt,name=Policy,proto3,enum=msg.CalendarEditPolicy" json:"Policy,omitempty"` -} - -func (x *CalendarEditEvent) Reset() { - *x = CalendarEditEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_calendar_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CalendarEditEvent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CalendarEditEvent) ProtoMessage() {} - -func (x *CalendarEditEvent) ProtoReflect() protoreflect.Message { - mi := &file_calendar_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CalendarEditEvent.ProtoReflect.Descriptor instead. -func (*CalendarEditEvent) Descriptor() ([]byte, []int) { - return file_calendar_proto_rawDescGZIP(), []int{2} -} - -func (x *CalendarEditEvent) GetEventID() int64 { - if x != nil { - return x.EventID - } - return 0 -} - -func (x *CalendarEditEvent) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CalendarEditEvent) GetDate() int64 { - if x != nil { - return x.Date - } - return 0 -} - -func (x *CalendarEditEvent) GetStartRange() int64 { - if x != nil { - return x.StartRange - } - return 0 -} - -func (x *CalendarEditEvent) GetDuration() int64 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *CalendarEditEvent) GetRecurring() bool { - if x != nil { - return x.Recurring - } - return false -} - -func (x *CalendarEditEvent) GetPeriod() RecurringPeriod { - if x != nil { - return x.Period - } - return RecurringPeriod_RecurringNone -} - -func (x *CalendarEditEvent) GetAllDay() bool { - if x != nil { - return x.AllDay - } - return false -} - -func (x *CalendarEditEvent) GetPolicy() CalendarEditPolicy { - if x != nil { - return x.Policy - } - return CalendarEditPolicy_CalendarEditOne -} - -// CalendarRemoveEvent -// @Function -// @Return: Bool -type CalendarRemoveEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - EventID int64 `protobuf:"varint,1,opt,name=EventID,proto3" json:"EventID,omitempty"` -} - -func (x *CalendarRemoveEvent) Reset() { - *x = CalendarRemoveEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_calendar_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CalendarRemoveEvent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CalendarRemoveEvent) ProtoMessage() {} - -func (x *CalendarRemoveEvent) ProtoReflect() protoreflect.Message { - mi := &file_calendar_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CalendarRemoveEvent.ProtoReflect.Descriptor instead. -func (*CalendarRemoveEvent) Descriptor() ([]byte, []int) { - return file_calendar_proto_rawDescGZIP(), []int{3} -} - -func (x *CalendarRemoveEvent) GetEventID() int64 { - if x != nil { - return x.EventID - } - return 0 -} - -// CalendarEvent -type CalendarEvent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Recurring bool `protobuf:"varint,3,opt,name=Recurring,proto3" json:"Recurring,omitempty"` - Period RecurringPeriod `protobuf:"varint,4,opt,name=Period,proto3,enum=msg.RecurringPeriod" json:"Period,omitempty"` - AllDay bool `protobuf:"varint,5,opt,name=AllDay,proto3" json:"AllDay,omitempty"` -} - -func (x *CalendarEvent) Reset() { - *x = CalendarEvent{} - if protoimpl.UnsafeEnabled { - mi := &file_calendar_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CalendarEvent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CalendarEvent) ProtoMessage() {} - -func (x *CalendarEvent) ProtoReflect() protoreflect.Message { - mi := &file_calendar_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CalendarEvent.ProtoReflect.Descriptor instead. -func (*CalendarEvent) Descriptor() ([]byte, []int) { - return file_calendar_proto_rawDescGZIP(), []int{4} -} - -func (x *CalendarEvent) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *CalendarEvent) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *CalendarEvent) GetRecurring() bool { - if x != nil { - return x.Recurring - } - return false -} - -func (x *CalendarEvent) GetPeriod() RecurringPeriod { - if x != nil { - return x.Period - } - return RecurringPeriod_RecurringNone -} - -func (x *CalendarEvent) GetAllDay() bool { - if x != nil { - return x.AllDay - } - return false -} - -// CalendarEventInstance -type CalendarEventInstance struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - EventID int64 `protobuf:"varint,2,opt,name=EventID,proto3" json:"EventID,omitempty"` - Start int64 `protobuf:"varint,3,opt,name=Start,proto3" json:"Start,omitempty"` - End int64 `protobuf:"varint,4,opt,name=End,proto3" json:"End,omitempty"` - Colour string `protobuf:"bytes,5,opt,name=Colour,proto3" json:"Colour,omitempty"` -} - -func (x *CalendarEventInstance) Reset() { - *x = CalendarEventInstance{} - if protoimpl.UnsafeEnabled { - mi := &file_calendar_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CalendarEventInstance) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CalendarEventInstance) ProtoMessage() {} - -func (x *CalendarEventInstance) ProtoReflect() protoreflect.Message { - mi := &file_calendar_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CalendarEventInstance.ProtoReflect.Descriptor instead. -func (*CalendarEventInstance) Descriptor() ([]byte, []int) { - return file_calendar_proto_rawDescGZIP(), []int{5} -} - -func (x *CalendarEventInstance) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *CalendarEventInstance) GetEventID() int64 { - if x != nil { - return x.EventID - } - return 0 -} - -func (x *CalendarEventInstance) GetStart() int64 { - if x != nil { - return x.Start - } - return 0 -} - -func (x *CalendarEventInstance) GetEnd() int64 { - if x != nil { - return x.End - } - return 0 -} - -func (x *CalendarEventInstance) GetColour() string { - if x != nil { - return x.Colour - } - return "" -} - -var File_calendar_proto protoreflect.FileDescriptor - -var file_calendar_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x63, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x4f, 0x0a, 0x11, 0x43, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, - 0x72, 0x47, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x72, - 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x0e, - 0x0a, 0x02, 0x54, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x54, 0x6f, 0x12, 0x16, - 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x86, 0x02, 0x0a, 0x10, 0x43, 0x61, 0x6c, 0x65, 0x6e, - 0x64, 0x61, 0x72, 0x53, 0x65, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x4e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x44, - 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x1c, 0x0a, 0x09, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x09, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x2c, 0x0a, - 0x06, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, - 0x69, 0x6f, 0x64, 0x52, 0x06, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, - 0x6c, 0x6c, 0x44, 0x61, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x41, 0x6c, 0x6c, - 0x44, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x65, 0x61, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x04, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x6c, 0x6f, 0x62, 0x61, - 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x22, - 0xa6, 0x02, 0x0a, 0x11, 0x43, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x45, 0x64, 0x69, 0x74, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, - 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x04, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x52, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x53, 0x74, 0x61, - 0x72, 0x74, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, - 0x67, 0x12, 0x2c, 0x0a, 0x06, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, - 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x06, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x41, 0x6c, 0x6c, 0x44, 0x61, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x06, 0x41, 0x6c, 0x6c, 0x44, 0x61, 0x79, 0x12, 0x2f, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, - 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, - 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x45, 0x64, 0x69, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x52, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x2f, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x65, - 0x6e, 0x64, 0x61, 0x72, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, - 0x18, 0x0a, 0x07, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x07, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x22, 0x97, 0x01, 0x0a, 0x0d, 0x43, 0x61, - 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x4e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x09, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x2c, 0x0a, - 0x06, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, - 0x69, 0x6f, 0x64, 0x52, 0x06, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, - 0x6c, 0x6c, 0x44, 0x61, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x41, 0x6c, 0x6c, - 0x44, 0x61, 0x79, 0x22, 0x81, 0x01, 0x0a, 0x15, 0x43, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x0e, 0x0a, - 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x44, 0x12, 0x18, 0x0a, - 0x07, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x0a, - 0x03, 0x45, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x45, 0x6e, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x6f, 0x75, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x43, 0x6f, 0x6c, 0x6f, 0x75, 0x72, 0x2a, 0x78, 0x0a, 0x0f, 0x52, 0x65, 0x63, 0x75, 0x72, - 0x72, 0x69, 0x6e, 0x67, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x65, - 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x12, 0x0a, - 0x0e, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x10, - 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x57, 0x65, - 0x65, 0x6b, 0x6c, 0x79, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, - 0x69, 0x6e, 0x67, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x6c, 0x79, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, - 0x52, 0x65, 0x63, 0x75, 0x72, 0x72, 0x69, 0x6e, 0x67, 0x59, 0x65, 0x61, 0x72, 0x6c, 0x79, 0x10, - 0x04, 0x2a, 0x59, 0x0a, 0x12, 0x43, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x45, 0x64, 0x69, - 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x61, 0x6c, 0x65, 0x6e, - 0x64, 0x61, 0x72, 0x45, 0x64, 0x69, 0x74, 0x4f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, - 0x43, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x45, 0x64, 0x69, 0x74, 0x46, 0x6f, 0x6c, 0x6c, - 0x6f, 0x77, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x61, 0x6c, 0x65, 0x6e, - 0x64, 0x61, 0x72, 0x45, 0x64, 0x69, 0x74, 0x41, 0x6c, 0x6c, 0x10, 0x02, 0x42, 0x08, 0x5a, 0x06, - 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_calendar_proto_rawDescOnce sync.Once - file_calendar_proto_rawDescData = file_calendar_proto_rawDesc -) - -func file_calendar_proto_rawDescGZIP() []byte { - file_calendar_proto_rawDescOnce.Do(func() { - file_calendar_proto_rawDescData = protoimpl.X.CompressGZIP(file_calendar_proto_rawDescData) - }) - return file_calendar_proto_rawDescData -} - -var file_calendar_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_calendar_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_calendar_proto_goTypes = []interface{}{ - (RecurringPeriod)(0), // 0: msg.RecurringPeriod - (CalendarEditPolicy)(0), // 1: msg.CalendarEditPolicy - (*CalendarGetEvents)(nil), // 2: msg.CalendarGetEvents - (*CalendarSetEvent)(nil), // 3: msg.CalendarSetEvent - (*CalendarEditEvent)(nil), // 4: msg.CalendarEditEvent - (*CalendarRemoveEvent)(nil), // 5: msg.CalendarRemoveEvent - (*CalendarEvent)(nil), // 6: msg.CalendarEvent - (*CalendarEventInstance)(nil), // 7: msg.CalendarEventInstance -} -var file_calendar_proto_depIdxs = []int32{ - 0, // 0: msg.CalendarSetEvent.Period:type_name -> msg.RecurringPeriod - 0, // 1: msg.CalendarEditEvent.Period:type_name -> msg.RecurringPeriod - 1, // 2: msg.CalendarEditEvent.Policy:type_name -> msg.CalendarEditPolicy - 0, // 3: msg.CalendarEvent.Period:type_name -> msg.RecurringPeriod - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_calendar_proto_init() } -func file_calendar_proto_init() { - if File_calendar_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_calendar_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CalendarGetEvents); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_calendar_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CalendarSetEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_calendar_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CalendarEditEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_calendar_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CalendarRemoveEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_calendar_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CalendarEvent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_calendar_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CalendarEventInstance); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_calendar_proto_rawDesc, - NumEnums: 2, - NumMessages: 6, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_calendar_proto_goTypes, - DependencyIndexes: file_calendar_proto_depIdxs, - EnumInfos: file_calendar_proto_enumTypes, - MessageInfos: file_calendar_proto_msgTypes, - }.Build() - File_calendar_proto = out.File - file_calendar_proto_rawDesc = nil - file_calendar_proto_goTypes = nil - file_calendar_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/calendar.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/calendar.rony.go deleted file mode 100644 index 5f686dbc..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/calendar.rony.go +++ /dev/null @@ -1,423 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: calendar.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_CalendarGetEvents int64 = 1010730154 - -type poolCalendarGetEvents struct { - pool sync.Pool -} - -func (p *poolCalendarGetEvents) Get() *CalendarGetEvents { - x, ok := p.pool.Get().(*CalendarGetEvents) - if !ok { - x = &CalendarGetEvents{} - } - - return x -} - -func (p *poolCalendarGetEvents) Put(x *CalendarGetEvents) { - if x == nil { - return - } - - x.From = 0 - x.To = 0 - x.Filter = 0 - - p.pool.Put(x) -} - -var PoolCalendarGetEvents = poolCalendarGetEvents{} - -func (x *CalendarGetEvents) DeepCopy(z *CalendarGetEvents) { - z.From = x.From - z.To = x.To - z.Filter = x.Filter -} - -func (x *CalendarGetEvents) Clone() *CalendarGetEvents { - z := &CalendarGetEvents{} - x.DeepCopy(z) - return z -} - -func (x *CalendarGetEvents) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CalendarGetEvents) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CalendarGetEvents) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CalendarGetEvents) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CalendarGetEvents) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CalendarGetEvents, x) -} - -const C_CalendarSetEvent int64 = 3405460640 - -type poolCalendarSetEvent struct { - pool sync.Pool -} - -func (p *poolCalendarSetEvent) Get() *CalendarSetEvent { - x, ok := p.pool.Get().(*CalendarSetEvent) - if !ok { - x = &CalendarSetEvent{} - } - - return x -} - -func (p *poolCalendarSetEvent) Put(x *CalendarSetEvent) { - if x == nil { - return - } - - x.Name = "" - x.Date = 0 - x.StartRange = 0 - x.Duration = 0 - x.Recurring = false - x.Period = 0 - x.AllDay = false - x.Team = false - x.Global = false - - p.pool.Put(x) -} - -var PoolCalendarSetEvent = poolCalendarSetEvent{} - -func (x *CalendarSetEvent) DeepCopy(z *CalendarSetEvent) { - z.Name = x.Name - z.Date = x.Date - z.StartRange = x.StartRange - z.Duration = x.Duration - z.Recurring = x.Recurring - z.Period = x.Period - z.AllDay = x.AllDay - z.Team = x.Team - z.Global = x.Global -} - -func (x *CalendarSetEvent) Clone() *CalendarSetEvent { - z := &CalendarSetEvent{} - x.DeepCopy(z) - return z -} - -func (x *CalendarSetEvent) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CalendarSetEvent) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CalendarSetEvent) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CalendarSetEvent) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CalendarSetEvent) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CalendarSetEvent, x) -} - -const C_CalendarEditEvent int64 = 2440838922 - -type poolCalendarEditEvent struct { - pool sync.Pool -} - -func (p *poolCalendarEditEvent) Get() *CalendarEditEvent { - x, ok := p.pool.Get().(*CalendarEditEvent) - if !ok { - x = &CalendarEditEvent{} - } - - return x -} - -func (p *poolCalendarEditEvent) Put(x *CalendarEditEvent) { - if x == nil { - return - } - - x.EventID = 0 - x.Name = "" - x.Date = 0 - x.StartRange = 0 - x.Duration = 0 - x.Recurring = false - x.Period = 0 - x.AllDay = false - x.Policy = 0 - - p.pool.Put(x) -} - -var PoolCalendarEditEvent = poolCalendarEditEvent{} - -func (x *CalendarEditEvent) DeepCopy(z *CalendarEditEvent) { - z.EventID = x.EventID - z.Name = x.Name - z.Date = x.Date - z.StartRange = x.StartRange - z.Duration = x.Duration - z.Recurring = x.Recurring - z.Period = x.Period - z.AllDay = x.AllDay - z.Policy = x.Policy -} - -func (x *CalendarEditEvent) Clone() *CalendarEditEvent { - z := &CalendarEditEvent{} - x.DeepCopy(z) - return z -} - -func (x *CalendarEditEvent) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CalendarEditEvent) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CalendarEditEvent) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CalendarEditEvent) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CalendarEditEvent) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CalendarEditEvent, x) -} - -const C_CalendarRemoveEvent int64 = 3761579510 - -type poolCalendarRemoveEvent struct { - pool sync.Pool -} - -func (p *poolCalendarRemoveEvent) Get() *CalendarRemoveEvent { - x, ok := p.pool.Get().(*CalendarRemoveEvent) - if !ok { - x = &CalendarRemoveEvent{} - } - - return x -} - -func (p *poolCalendarRemoveEvent) Put(x *CalendarRemoveEvent) { - if x == nil { - return - } - - x.EventID = 0 - - p.pool.Put(x) -} - -var PoolCalendarRemoveEvent = poolCalendarRemoveEvent{} - -func (x *CalendarRemoveEvent) DeepCopy(z *CalendarRemoveEvent) { - z.EventID = x.EventID -} - -func (x *CalendarRemoveEvent) Clone() *CalendarRemoveEvent { - z := &CalendarRemoveEvent{} - x.DeepCopy(z) - return z -} - -func (x *CalendarRemoveEvent) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CalendarRemoveEvent) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CalendarRemoveEvent) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CalendarRemoveEvent) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CalendarRemoveEvent) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CalendarRemoveEvent, x) -} - -const C_CalendarEvent int64 = 1185062169 - -type poolCalendarEvent struct { - pool sync.Pool -} - -func (p *poolCalendarEvent) Get() *CalendarEvent { - x, ok := p.pool.Get().(*CalendarEvent) - if !ok { - x = &CalendarEvent{} - } - - return x -} - -func (p *poolCalendarEvent) Put(x *CalendarEvent) { - if x == nil { - return - } - - x.ID = 0 - x.Name = "" - x.Recurring = false - x.Period = 0 - x.AllDay = false - - p.pool.Put(x) -} - -var PoolCalendarEvent = poolCalendarEvent{} - -func (x *CalendarEvent) DeepCopy(z *CalendarEvent) { - z.ID = x.ID - z.Name = x.Name - z.Recurring = x.Recurring - z.Period = x.Period - z.AllDay = x.AllDay -} - -func (x *CalendarEvent) Clone() *CalendarEvent { - z := &CalendarEvent{} - x.DeepCopy(z) - return z -} - -func (x *CalendarEvent) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CalendarEvent) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CalendarEvent) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CalendarEvent) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CalendarEvent) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CalendarEvent, x) -} - -const C_CalendarEventInstance int64 = 3586847608 - -type poolCalendarEventInstance struct { - pool sync.Pool -} - -func (p *poolCalendarEventInstance) Get() *CalendarEventInstance { - x, ok := p.pool.Get().(*CalendarEventInstance) - if !ok { - x = &CalendarEventInstance{} - } - - return x -} - -func (p *poolCalendarEventInstance) Put(x *CalendarEventInstance) { - if x == nil { - return - } - - x.ID = 0 - x.EventID = 0 - x.Start = 0 - x.End = 0 - x.Colour = "" - - p.pool.Put(x) -} - -var PoolCalendarEventInstance = poolCalendarEventInstance{} - -func (x *CalendarEventInstance) DeepCopy(z *CalendarEventInstance) { - z.ID = x.ID - z.EventID = x.EventID - z.Start = x.Start - z.End = x.End - z.Colour = x.Colour -} - -func (x *CalendarEventInstance) Clone() *CalendarEventInstance { - z := &CalendarEventInstance{} - x.DeepCopy(z) - return z -} - -func (x *CalendarEventInstance) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CalendarEventInstance) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CalendarEventInstance) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CalendarEventInstance) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CalendarEventInstance) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CalendarEventInstance, x) -} - -func init() { - registry.RegisterConstructor(1010730154, "CalendarGetEvents") - registry.RegisterConstructor(3405460640, "CalendarSetEvent") - registry.RegisterConstructor(2440838922, "CalendarEditEvent") - registry.RegisterConstructor(3761579510, "CalendarRemoveEvent") - registry.RegisterConstructor(1185062169, "CalendarEvent") - registry.RegisterConstructor(3586847608, "CalendarEventInstance") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.bot.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.bot.pb.go deleted file mode 100644 index 4eca1943..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.bot.pb.go +++ /dev/null @@ -1,3153 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.bot.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// BotStart -// @Function (Client) -// @Return: Bool -type BotStart struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Bot *InputPeer `protobuf:"bytes,1,opt,name=Bot,proto3" json:"Bot,omitempty"` - RandomID int64 `protobuf:"varint,2,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - StartParam string `protobuf:"bytes,3,opt,name=StartParam,proto3" json:"StartParam,omitempty"` -} - -func (x *BotStart) Reset() { - *x = BotStart{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotStart) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotStart) ProtoMessage() {} - -func (x *BotStart) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotStart.ProtoReflect.Descriptor instead. -func (*BotStart) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{0} -} - -func (x *BotStart) GetBot() *InputPeer { - if x != nil { - return x.Bot - } - return nil -} - -func (x *BotStart) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *BotStart) GetStartParam() string { - if x != nil { - return x.StartParam - } - return "" -} - -// BotRecall -// @Function (BotOnly) -// @Return: BotRecalled -type BotRecall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Version int32 `protobuf:"varint,1,opt,name=Version,proto3" json:"Version,omitempty"` -} - -func (x *BotRecall) Reset() { - *x = BotRecall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotRecall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotRecall) ProtoMessage() {} - -func (x *BotRecall) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotRecall.ProtoReflect.Descriptor instead. -func (*BotRecall) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{1} -} - -func (x *BotRecall) GetVersion() int32 { - if x != nil { - return x.Version - } - return 0 -} - -// BotSetInfo -// @Function (BotOnly) -// @Return: Bool -type BotSetInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - BotID int64 `protobuf:"varint,1,opt,name=BotID,proto3" json:"BotID,omitempty"` - RandomID int64 `protobuf:"varint,2,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Owner int64 `protobuf:"varint,3,opt,name=Owner,proto3" json:"Owner,omitempty"` - BotCommands []*BotCommands `protobuf:"bytes,4,rep,name=BotCommands,proto3" json:"BotCommands,omitempty"` - Description string `protobuf:"bytes,5,opt,name=Description,proto3" json:"Description,omitempty"` - InlinePlaceholder string `protobuf:"bytes,6,opt,name=InlinePlaceholder,proto3" json:"InlinePlaceholder,omitempty"` - InlineGeo bool `protobuf:"varint,7,opt,name=InlineGeo,proto3" json:"InlineGeo,omitempty"` -} - -func (x *BotSetInfo) Reset() { - *x = BotSetInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotSetInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotSetInfo) ProtoMessage() {} - -func (x *BotSetInfo) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotSetInfo.ProtoReflect.Descriptor instead. -func (*BotSetInfo) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{2} -} - -func (x *BotSetInfo) GetBotID() int64 { - if x != nil { - return x.BotID - } - return 0 -} - -func (x *BotSetInfo) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *BotSetInfo) GetOwner() int64 { - if x != nil { - return x.Owner - } - return 0 -} - -func (x *BotSetInfo) GetBotCommands() []*BotCommands { - if x != nil { - return x.BotCommands - } - return nil -} - -func (x *BotSetInfo) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *BotSetInfo) GetInlinePlaceholder() string { - if x != nil { - return x.InlinePlaceholder - } - return "" -} - -func (x *BotSetInfo) GetInlineGeo() bool { - if x != nil { - return x.InlineGeo - } - return false -} - -// BotGet -// @Function (BotOnly) -// @Return: BotInfo -type BotGet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Limit int32 `protobuf:"varint,2,opt,name=Limit,proto3" json:"Limit,omitempty"` -} - -func (x *BotGet) Reset() { - *x = BotGet{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotGet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotGet) ProtoMessage() {} - -func (x *BotGet) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotGet.ProtoReflect.Descriptor instead. -func (*BotGet) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{3} -} - -func (x *BotGet) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *BotGet) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -// BotSendMessage -// @Function (BotOnly) -// @Return: UserMessage -type BotSendMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Body string `protobuf:"bytes,5,opt,name=Body,proto3" json:"Body,omitempty"` - ReplyTo int64 `protobuf:"varint,6,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - ClearDraft bool `protobuf:"varint,7,opt,name=ClearDraft,proto3" json:"ClearDraft,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,8,rep,name=Entities,proto3" json:"Entities,omitempty"` - ReplyMarkup int64 `protobuf:"varint,9,opt,name=ReplyMarkup,proto3" json:"ReplyMarkup,omitempty"` - ReplyMarkupData []byte `protobuf:"bytes,10,opt,name=ReplyMarkupData,proto3" json:"ReplyMarkupData,omitempty"` -} - -func (x *BotSendMessage) Reset() { - *x = BotSendMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotSendMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotSendMessage) ProtoMessage() {} - -func (x *BotSendMessage) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotSendMessage.ProtoReflect.Descriptor instead. -func (*BotSendMessage) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{4} -} - -func (x *BotSendMessage) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *BotSendMessage) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *BotSendMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *BotSendMessage) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *BotSendMessage) GetClearDraft() bool { - if x != nil { - return x.ClearDraft - } - return false -} - -func (x *BotSendMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *BotSendMessage) GetReplyMarkup() int64 { - if x != nil { - return x.ReplyMarkup - } - return 0 -} - -func (x *BotSendMessage) GetReplyMarkupData() []byte { - if x != nil { - return x.ReplyMarkupData - } - return nil -} - -// BotEditMessage -// @Function (BotOnly) -// @Return: UserMessage -type BotEditMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Body string `protobuf:"bytes,3,opt,name=Body,proto3" json:"Body,omitempty"` - MessageID int64 `protobuf:"varint,4,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,5,rep,name=Entities,proto3" json:"Entities,omitempty"` - ReplyMarkup int64 `protobuf:"varint,6,opt,name=ReplyMarkup,proto3" json:"ReplyMarkup,omitempty"` - ReplyMarkupData []byte `protobuf:"bytes,7,opt,name=ReplyMarkupData,proto3" json:"ReplyMarkupData,omitempty"` -} - -func (x *BotEditMessage) Reset() { - *x = BotEditMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotEditMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotEditMessage) ProtoMessage() {} - -func (x *BotEditMessage) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotEditMessage.ProtoReflect.Descriptor instead. -func (*BotEditMessage) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{5} -} - -func (x *BotEditMessage) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *BotEditMessage) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *BotEditMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *BotEditMessage) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *BotEditMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *BotEditMessage) GetReplyMarkup() int64 { - if x != nil { - return x.ReplyMarkup - } - return 0 -} - -func (x *BotEditMessage) GetReplyMarkupData() []byte { - if x != nil { - return x.ReplyMarkupData - } - return nil -} - -// BotSendMedia -// @Function (BotOnly) -// @Return: UserMessage -type BotSendMedia struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - MediaType InputMediaType `protobuf:"varint,3,opt,name=MediaType,proto3,enum=msg.InputMediaType" json:"MediaType,omitempty"` - MediaData []byte `protobuf:"bytes,4,opt,name=MediaData,proto3" json:"MediaData,omitempty"` - ReplyTo int64 `protobuf:"varint,5,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` -} - -func (x *BotSendMedia) Reset() { - *x = BotSendMedia{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotSendMedia) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotSendMedia) ProtoMessage() {} - -func (x *BotSendMedia) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotSendMedia.ProtoReflect.Descriptor instead. -func (*BotSendMedia) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{6} -} - -func (x *BotSendMedia) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *BotSendMedia) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *BotSendMedia) GetMediaType() InputMediaType { - if x != nil { - return x.MediaType - } - return InputMediaType_InputMediaTypeEmpty -} - -func (x *BotSendMedia) GetMediaData() []byte { - if x != nil { - return x.MediaData - } - return nil -} - -func (x *BotSendMedia) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -// BotSaveFilePart -// @Function (BotOnly) -// @Returns: Bool -type BotSaveFilePart struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FileID int64 `protobuf:"varint,1,opt,name=FileID,proto3" json:"FileID,omitempty"` - PartID int32 `protobuf:"varint,2,opt,name=PartID,proto3" json:"PartID,omitempty"` - TotalParts int32 `protobuf:"varint,3,opt,name=TotalParts,proto3" json:"TotalParts,omitempty"` - Bytes []byte `protobuf:"bytes,4,opt,name=Bytes,proto3" json:"Bytes,omitempty"` -} - -func (x *BotSaveFilePart) Reset() { - *x = BotSaveFilePart{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotSaveFilePart) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotSaveFilePart) ProtoMessage() {} - -func (x *BotSaveFilePart) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotSaveFilePart.ProtoReflect.Descriptor instead. -func (*BotSaveFilePart) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{7} -} - -func (x *BotSaveFilePart) GetFileID() int64 { - if x != nil { - return x.FileID - } - return 0 -} - -func (x *BotSaveFilePart) GetPartID() int32 { - if x != nil { - return x.PartID - } - return 0 -} - -func (x *BotSaveFilePart) GetTotalParts() int32 { - if x != nil { - return x.TotalParts - } - return 0 -} - -func (x *BotSaveFilePart) GetBytes() []byte { - if x != nil { - return x.Bytes - } - return nil -} - -// BotUpdateProfile -// @Function (BotOnly) -// @Return: Bool -type BotUpdateProfile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - BotID int64 `protobuf:"varint,1,opt,name=BotID,proto3" json:"BotID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Bio string `protobuf:"bytes,4,opt,name=Bio,proto3" json:"Bio,omitempty"` -} - -func (x *BotUpdateProfile) Reset() { - *x = BotUpdateProfile{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotUpdateProfile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotUpdateProfile) ProtoMessage() {} - -func (x *BotUpdateProfile) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotUpdateProfile.ProtoReflect.Descriptor instead. -func (*BotUpdateProfile) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{8} -} - -func (x *BotUpdateProfile) GetBotID() int64 { - if x != nil { - return x.BotID - } - return 0 -} - -func (x *BotUpdateProfile) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *BotUpdateProfile) GetBio() string { - if x != nil { - return x.Bio - } - return "" -} - -// BotUpdatePhoto -// @Function (BotOnly) -// @Returns: Bool -type BotUpdatePhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - File *InputFileLocation `protobuf:"bytes,1,opt,name=File,proto3" json:"File,omitempty"` - BotID int64 `protobuf:"varint,2,opt,name=BotID,proto3" json:"BotID,omitempty"` -} - -func (x *BotUpdatePhoto) Reset() { - *x = BotUpdatePhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotUpdatePhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotUpdatePhoto) ProtoMessage() {} - -func (x *BotUpdatePhoto) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotUpdatePhoto.ProtoReflect.Descriptor instead. -func (*BotUpdatePhoto) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{9} -} - -func (x *BotUpdatePhoto) GetFile() *InputFileLocation { - if x != nil { - return x.File - } - return nil -} - -func (x *BotUpdatePhoto) GetBotID() int64 { - if x != nil { - return x.BotID - } - return 0 -} - -// BotRevokeToken -// @Function (BotOnly) -// @Returns: BotToken -type BotRevokeToken struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - BotID int64 `protobuf:"varint,1,opt,name=BotID,proto3" json:"BotID,omitempty"` - GetNew bool `protobuf:"varint,2,opt,name=GetNew,proto3" json:"GetNew,omitempty"` -} - -func (x *BotRevokeToken) Reset() { - *x = BotRevokeToken{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotRevokeToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotRevokeToken) ProtoMessage() {} - -func (x *BotRevokeToken) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotRevokeToken.ProtoReflect.Descriptor instead. -func (*BotRevokeToken) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{10} -} - -func (x *BotRevokeToken) GetBotID() int64 { - if x != nil { - return x.BotID - } - return 0 -} - -func (x *BotRevokeToken) GetGetNew() bool { - if x != nil { - return x.GetNew - } - return false -} - -// BotDeleteMessage -// @Function (BotOnly) -// @Returns: Bool -type BotDeleteMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageIDs []int64 `protobuf:"varint,2,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` -} - -func (x *BotDeleteMessage) Reset() { - *x = BotDeleteMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotDeleteMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotDeleteMessage) ProtoMessage() {} - -func (x *BotDeleteMessage) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotDeleteMessage.ProtoReflect.Descriptor instead. -func (*BotDeleteMessage) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{11} -} - -func (x *BotDeleteMessage) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *BotDeleteMessage) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -// BotSetCallbackAnswer -// @Function (BotOnly) -// @Returns: Bool -type BotSetCallbackAnswer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - QueryID int64 `protobuf:"varint,1,opt,name=QueryID,proto3" json:"QueryID,omitempty"` - Url string `protobuf:"bytes,2,opt,name=Url,proto3" json:"Url,omitempty"` // URL to open - Message string `protobuf:"bytes,3,opt,name=Message,proto3" json:"Message,omitempty"` // Alert to show - CacheTime int32 `protobuf:"varint,4,opt,name=CacheTime,proto3" json:"CacheTime,omitempty"` // For how long should this answer be cached (in seconds) [Default is 300] -} - -func (x *BotSetCallbackAnswer) Reset() { - *x = BotSetCallbackAnswer{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotSetCallbackAnswer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotSetCallbackAnswer) ProtoMessage() {} - -func (x *BotSetCallbackAnswer) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotSetCallbackAnswer.ProtoReflect.Descriptor instead. -func (*BotSetCallbackAnswer) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{12} -} - -func (x *BotSetCallbackAnswer) GetQueryID() int64 { - if x != nil { - return x.QueryID - } - return 0 -} - -func (x *BotSetCallbackAnswer) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *BotSetCallbackAnswer) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *BotSetCallbackAnswer) GetCacheTime() int32 { - if x != nil { - return x.CacheTime - } - return 0 -} - -// BotGetCallbackAnswer -// @Function (Client) -// @Returns: BotCallbackAnswer -type BotGetCallbackAnswer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageID int64 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` // ID of the Message if button is the inline keyboard - Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"` // Callback data - Bot *InputUser `protobuf:"bytes,4,opt,name=Bot,proto3" json:"Bot,omitempty"` -} - -func (x *BotGetCallbackAnswer) Reset() { - *x = BotGetCallbackAnswer{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotGetCallbackAnswer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotGetCallbackAnswer) ProtoMessage() {} - -func (x *BotGetCallbackAnswer) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotGetCallbackAnswer.ProtoReflect.Descriptor instead. -func (*BotGetCallbackAnswer) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{13} -} - -func (x *BotGetCallbackAnswer) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *BotGetCallbackAnswer) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *BotGetCallbackAnswer) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *BotGetCallbackAnswer) GetBot() *InputUser { - if x != nil { - return x.Bot - } - return nil -} - -// BotGetInlineResults -// @Function (Client) -// @Returns: BotResults -type BotGetInlineResults struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Bot *InputUser `protobuf:"bytes,1,opt,name=Bot,proto3" json:"Bot,omitempty"` // The bot to query - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` // The currently opened chat - Query string `protobuf:"bytes,3,opt,name=Query,proto3" json:"Query,omitempty"` // The query - Offset string `protobuf:"bytes,4,opt,name=Offset,proto3" json:"Offset,omitempty"` // The offset within the results, will be passed directly as-is to the bot. - Location *InputGeoLocation `protobuf:"bytes,5,opt,name=Location,proto3" json:"Location,omitempty"` // The geolocation, if requested -} - -func (x *BotGetInlineResults) Reset() { - *x = BotGetInlineResults{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotGetInlineResults) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotGetInlineResults) ProtoMessage() {} - -func (x *BotGetInlineResults) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotGetInlineResults.ProtoReflect.Descriptor instead. -func (*BotGetInlineResults) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{14} -} - -func (x *BotGetInlineResults) GetBot() *InputUser { - if x != nil { - return x.Bot - } - return nil -} - -func (x *BotGetInlineResults) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *BotGetInlineResults) GetQuery() string { - if x != nil { - return x.Query - } - return "" -} - -func (x *BotGetInlineResults) GetOffset() string { - if x != nil { - return x.Offset - } - return "" -} - -func (x *BotGetInlineResults) GetLocation() *InputGeoLocation { - if x != nil { - return x.Location - } - return nil -} - -// BotSetInlineResults -// @Function (BotOnly) -// @Returns: Bool -type BotSetInlineResults struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Set this flag if the results are composed of media files - Gallery bool `protobuf:"varint,1,opt,name=Gallery,proto3" json:"Gallery,omitempty"` - // Set this flag if results may be cached on the server side only for the user that sent the query. - // By default, results may be returned to any user who sends the same query - Private bool `protobuf:"varint,2,opt,name=Private,proto3" json:"Private,omitempty"` - // The maximum amount of time in seconds that the result of the inline query may be cached on the server. - // Defaults to 300. - CacheTime int64 `protobuf:"varint,3,opt,name=CacheTime,proto3" json:"CacheTime,omitempty"` - // Pass the offset that a client should send in the next query with the same text to receive more results. - // Pass an empty string if there are no more results or if you don‘t - // support pagination. Offset length can’t exceed 64 bytes. - NextOffset string `protobuf:"bytes,4,opt,name=NextOffset,proto3" json:"NextOffset,omitempty"` - // Vector of results for the inline query - Results []*InputBotInlineResult `protobuf:"bytes,5,rep,name=Results,proto3" json:"Results,omitempty"` - // If passed, clients will display a button with specified text that switches the user to a private chat with - // the bot and sends the bot a start message with a certain parameter. - SwitchPM *BotInlineSwitchPM `protobuf:"bytes,6,opt,name=SwitchPM,proto3" json:"SwitchPM,omitempty"` - // Unique identifier for the answered query - QueryID int64 `protobuf:"varint,7,opt,name=QueryID,proto3" json:"QueryID,omitempty"` -} - -func (x *BotSetInlineResults) Reset() { - *x = BotSetInlineResults{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotSetInlineResults) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotSetInlineResults) ProtoMessage() {} - -func (x *BotSetInlineResults) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotSetInlineResults.ProtoReflect.Descriptor instead. -func (*BotSetInlineResults) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{15} -} - -func (x *BotSetInlineResults) GetGallery() bool { - if x != nil { - return x.Gallery - } - return false -} - -func (x *BotSetInlineResults) GetPrivate() bool { - if x != nil { - return x.Private - } - return false -} - -func (x *BotSetInlineResults) GetCacheTime() int64 { - if x != nil { - return x.CacheTime - } - return 0 -} - -func (x *BotSetInlineResults) GetNextOffset() string { - if x != nil { - return x.NextOffset - } - return "" -} - -func (x *BotSetInlineResults) GetResults() []*InputBotInlineResult { - if x != nil { - return x.Results - } - return nil -} - -func (x *BotSetInlineResults) GetSwitchPM() *BotInlineSwitchPM { - if x != nil { - return x.SwitchPM - } - return nil -} - -func (x *BotSetInlineResults) GetQueryID() int64 { - if x != nil { - return x.QueryID - } - return 0 -} - -// BotSendInlineResults -// @Function (Client) -// @Returns: Bool + Updates -type BotSendInlineResults struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - QueryID int64 `protobuf:"varint,2,opt,name=QueryID,proto3" json:"QueryID,omitempty"` // Query ID from BotResults response of BotGetInlineResults - ResultID string `protobuf:"bytes,3,opt,name=ResultID,proto3" json:"ResultID,omitempty"` // Result ID from BotResults response of BotGetInlineResults - ClearDraft bool `protobuf:"varint,4,opt,name=ClearDraft,proto3" json:"ClearDraft,omitempty"` - Peer *InputPeer `protobuf:"bytes,5,opt,name=Peer,proto3" json:"Peer,omitempty"` // Destination - ReplyTo int64 `protobuf:"varint,6,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - Silent bool `protobuf:"varint,7,opt,name=Silent,proto3" json:"Silent,omitempty"` // Do not send notification - HideVia bool `protobuf:"varint,8,opt,name=HideVia,proto3" json:"HideVia,omitempty"` // Hid via bot -} - -func (x *BotSendInlineResults) Reset() { - *x = BotSendInlineResults{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotSendInlineResults) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotSendInlineResults) ProtoMessage() {} - -func (x *BotSendInlineResults) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotSendInlineResults.ProtoReflect.Descriptor instead. -func (*BotSendInlineResults) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{16} -} - -func (x *BotSendInlineResults) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *BotSendInlineResults) GetQueryID() int64 { - if x != nil { - return x.QueryID - } - return 0 -} - -func (x *BotSendInlineResults) GetResultID() string { - if x != nil { - return x.ResultID - } - return "" -} - -func (x *BotSendInlineResults) GetClearDraft() bool { - if x != nil { - return x.ClearDraft - } - return false -} - -func (x *BotSendInlineResults) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *BotSendInlineResults) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *BotSendInlineResults) GetSilent() bool { - if x != nil { - return x.Silent - } - return false -} - -func (x *BotSendInlineResults) GetHideVia() bool { - if x != nil { - return x.HideVia - } - return false -} - -// BotUploadWallPaper -// @Function (BotFather, AdminBot) -// @Return: Bool -type BotUploadWallPaper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - File *InputFileLocation `protobuf:"bytes,1,opt,name=File,proto3" json:"File,omitempty"` - Dark bool `protobuf:"varint,2,opt,name=Dark,proto3" json:"Dark,omitempty"` - Pattern bool `protobuf:"varint,3,opt,name=Pattern,proto3" json:"Pattern,omitempty"` - Settings *WallPaperSettings `protobuf:"bytes,4,opt,name=Settings,proto3" json:"Settings,omitempty"` -} - -func (x *BotUploadWallPaper) Reset() { - *x = BotUploadWallPaper{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotUploadWallPaper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotUploadWallPaper) ProtoMessage() {} - -func (x *BotUploadWallPaper) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotUploadWallPaper.ProtoReflect.Descriptor instead. -func (*BotUploadWallPaper) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{17} -} - -func (x *BotUploadWallPaper) GetFile() *InputFileLocation { - if x != nil { - return x.File - } - return nil -} - -func (x *BotUploadWallPaper) GetDark() bool { - if x != nil { - return x.Dark - } - return false -} - -func (x *BotUploadWallPaper) GetPattern() bool { - if x != nil { - return x.Pattern - } - return false -} - -func (x *BotUploadWallPaper) GetSettings() *WallPaperSettings { - if x != nil { - return x.Settings - } - return nil -} - -// BotUploadGif -// @Function (GifBot Only) -// @Return: FileLocation -type BotUploadGif struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,100,opt,name=Token,proto3" json:"Token,omitempty"` - File *InputFile `protobuf:"bytes,1,opt,name=File,proto3" json:"File,omitempty"` - Thumb *InputFile `protobuf:"bytes,2,opt,name=Thumb,proto3" json:"Thumb,omitempty"` - Width uint32 `protobuf:"varint,3,opt,name=Width,proto3" json:"Width,omitempty"` - Height uint32 `protobuf:"varint,4,opt,name=Height,proto3" json:"Height,omitempty"` - MimeType string `protobuf:"bytes,5,opt,name=MimeType,proto3" json:"MimeType,omitempty"` -} - -func (x *BotUploadGif) Reset() { - *x = BotUploadGif{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotUploadGif) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotUploadGif) ProtoMessage() {} - -func (x *BotUploadGif) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotUploadGif.ProtoReflect.Descriptor instead. -func (*BotUploadGif) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{18} -} - -func (x *BotUploadGif) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -func (x *BotUploadGif) GetFile() *InputFile { - if x != nil { - return x.File - } - return nil -} - -func (x *BotUploadGif) GetThumb() *InputFile { - if x != nil { - return x.Thumb - } - return nil -} - -func (x *BotUploadGif) GetWidth() uint32 { - if x != nil { - return x.Width - } - return 0 -} - -func (x *BotUploadGif) GetHeight() uint32 { - if x != nil { - return x.Height - } - return 0 -} - -func (x *BotUploadGif) GetMimeType() string { - if x != nil { - return x.MimeType - } - return "" -} - -// BotResults -type BotResults struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Gallery bool `protobuf:"varint,1,opt,name=Gallery,proto3" json:"Gallery,omitempty"` - QueryID int64 `protobuf:"varint,2,opt,name=QueryID,proto3" json:"QueryID,omitempty"` - NextOffset string `protobuf:"bytes,3,opt,name=NextOffset,proto3" json:"NextOffset,omitempty"` // The next offset to use when navigating through results - SwitchPM *BotInlineSwitchPM `protobuf:"bytes,4,opt,name=SwitchPM,proto3" json:"SwitchPM,omitempty"` // Whether the bot requested the user to message him in private - Results []*BotInlineResult `protobuf:"bytes,5,rep,name=Results,proto3" json:"Results,omitempty"` // The results -} - -func (x *BotResults) Reset() { - *x = BotResults{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotResults) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotResults) ProtoMessage() {} - -func (x *BotResults) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotResults.ProtoReflect.Descriptor instead. -func (*BotResults) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{19} -} - -func (x *BotResults) GetGallery() bool { - if x != nil { - return x.Gallery - } - return false -} - -func (x *BotResults) GetQueryID() int64 { - if x != nil { - return x.QueryID - } - return 0 -} - -func (x *BotResults) GetNextOffset() string { - if x != nil { - return x.NextOffset - } - return "" -} - -func (x *BotResults) GetSwitchPM() *BotInlineSwitchPM { - if x != nil { - return x.SwitchPM - } - return nil -} - -func (x *BotResults) GetResults() []*BotInlineResult { - if x != nil { - return x.Results - } - return nil -} - -// BotInlineSwitchPM -type BotInlineSwitchPM struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Text for the button that switches the user to a private chat with the bot - // and sends the bot a start message with the parameter start_parameter (can be empty) - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` - // The parameter for the /start parameter - StartParam string `protobuf:"bytes,2,opt,name=StartParam,proto3" json:"StartParam,omitempty"` -} - -func (x *BotInlineSwitchPM) Reset() { - *x = BotInlineSwitchPM{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotInlineSwitchPM) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotInlineSwitchPM) ProtoMessage() {} - -func (x *BotInlineSwitchPM) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotInlineSwitchPM.ProtoReflect.Descriptor instead. -func (*BotInlineSwitchPM) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{20} -} - -func (x *BotInlineSwitchPM) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *BotInlineSwitchPM) GetStartParam() string { - if x != nil { - return x.StartParam - } - return "" -} - -// BotInlineResult -type BotInlineResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` - Type MediaType `protobuf:"varint,2,opt,name=Type,proto3,enum=msg.MediaType" json:"Type,omitempty"` - Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title,omitempty"` - Description string `protobuf:"bytes,4,opt,name=Description,proto3" json:"Description,omitempty"` - Url string `protobuf:"bytes,5,opt,name=Url,proto3" json:"Url,omitempty"` - Thumb *MediaWebDocument `protobuf:"bytes,6,opt,name=Thumb,proto3" json:"Thumb,omitempty"` - Message *BotInlineMessage `protobuf:"bytes,7,opt,name=Message,proto3" json:"Message,omitempty"` -} - -func (x *BotInlineResult) Reset() { - *x = BotInlineResult{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotInlineResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotInlineResult) ProtoMessage() {} - -func (x *BotInlineResult) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotInlineResult.ProtoReflect.Descriptor instead. -func (*BotInlineResult) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{21} -} - -func (x *BotInlineResult) GetID() string { - if x != nil { - return x.ID - } - return "" -} - -func (x *BotInlineResult) GetType() MediaType { - if x != nil { - return x.Type - } - return MediaType_MediaTypeEmpty -} - -func (x *BotInlineResult) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *BotInlineResult) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *BotInlineResult) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *BotInlineResult) GetThumb() *MediaWebDocument { - if x != nil { - return x.Thumb - } - return nil -} - -func (x *BotInlineResult) GetMessage() *BotInlineMessage { - if x != nil { - return x.Message - } - return nil -} - -// InputBotInlineResult -type InputBotInlineResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` - Type InputMediaType `protobuf:"varint,2,opt,name=Type,proto3,enum=msg.InputMediaType" json:"Type,omitempty"` - Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title,omitempty"` - Description string `protobuf:"bytes,4,opt,name=Description,proto3" json:"Description,omitempty"` - Url string `protobuf:"bytes,5,opt,name=Url,proto3" json:"Url,omitempty"` - Thumb *InputMediaWebDocument `protobuf:"bytes,6,opt,name=Thumb,proto3" json:"Thumb,omitempty"` - Message *InputBotInlineMessage `protobuf:"bytes,8,opt,name=Message,proto3" json:"Message,omitempty"` -} - -func (x *InputBotInlineResult) Reset() { - *x = InputBotInlineResult{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputBotInlineResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputBotInlineResult) ProtoMessage() {} - -func (x *InputBotInlineResult) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputBotInlineResult.ProtoReflect.Descriptor instead. -func (*InputBotInlineResult) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{22} -} - -func (x *InputBotInlineResult) GetID() string { - if x != nil { - return x.ID - } - return "" -} - -func (x *InputBotInlineResult) GetType() InputMediaType { - if x != nil { - return x.Type - } - return InputMediaType_InputMediaTypeEmpty -} - -func (x *InputBotInlineResult) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *InputBotInlineResult) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *InputBotInlineResult) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *InputBotInlineResult) GetThumb() *InputMediaWebDocument { - if x != nil { - return x.Thumb - } - return nil -} - -func (x *InputBotInlineResult) GetMessage() *InputBotInlineMessage { - if x != nil { - return x.Message - } - return nil -} - -// BotInlineMessage -type BotInlineMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MediaData []byte `protobuf:"bytes,1,opt,name=MediaData,proto3" json:"MediaData,omitempty"` - Body string `protobuf:"bytes,10,opt,name=Body,proto3" json:"Body,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,11,rep,name=Entities,proto3" json:"Entities,omitempty"` - ReplyTo int64 `protobuf:"varint,12,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - ReplyMarkup int64 `protobuf:"varint,13,opt,name=ReplyMarkup,proto3" json:"ReplyMarkup,omitempty"` - ReplyMarkupData []byte `protobuf:"bytes,14,opt,name=ReplyMarkupData,proto3" json:"ReplyMarkupData,omitempty"` -} - -func (x *BotInlineMessage) Reset() { - *x = BotInlineMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotInlineMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotInlineMessage) ProtoMessage() {} - -func (x *BotInlineMessage) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotInlineMessage.ProtoReflect.Descriptor instead. -func (*BotInlineMessage) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{23} -} - -func (x *BotInlineMessage) GetMediaData() []byte { - if x != nil { - return x.MediaData - } - return nil -} - -func (x *BotInlineMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *BotInlineMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *BotInlineMessage) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *BotInlineMessage) GetReplyMarkup() int64 { - if x != nil { - return x.ReplyMarkup - } - return 0 -} - -func (x *BotInlineMessage) GetReplyMarkupData() []byte { - if x != nil { - return x.ReplyMarkupData - } - return nil -} - -// InputBotInlineMessage -type InputBotInlineMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - InputMediaData []byte `protobuf:"bytes,1,opt,name=InputMediaData,proto3" json:"InputMediaData,omitempty"` - NoWebPage bool `protobuf:"varint,2,opt,name=NoWebPage,proto3" json:"NoWebPage,omitempty"` - Body string `protobuf:"bytes,10,opt,name=Body,proto3" json:"Body,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,11,rep,name=Entities,proto3" json:"Entities,omitempty"` - ReplyTo int64 `protobuf:"varint,12,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - ReplyMarkup int64 `protobuf:"varint,13,opt,name=ReplyMarkup,proto3" json:"ReplyMarkup,omitempty"` - ReplyMarkupData []byte `protobuf:"bytes,14,opt,name=ReplyMarkupData,proto3" json:"ReplyMarkupData,omitempty"` -} - -func (x *InputBotInlineMessage) Reset() { - *x = InputBotInlineMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputBotInlineMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputBotInlineMessage) ProtoMessage() {} - -func (x *InputBotInlineMessage) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputBotInlineMessage.ProtoReflect.Descriptor instead. -func (*InputBotInlineMessage) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{24} -} - -func (x *InputBotInlineMessage) GetInputMediaData() []byte { - if x != nil { - return x.InputMediaData - } - return nil -} - -func (x *InputBotInlineMessage) GetNoWebPage() bool { - if x != nil { - return x.NoWebPage - } - return false -} - -func (x *InputBotInlineMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *InputBotInlineMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *InputBotInlineMessage) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *InputBotInlineMessage) GetReplyMarkup() int64 { - if x != nil { - return x.ReplyMarkup - } - return 0 -} - -func (x *InputBotInlineMessage) GetReplyMarkupData() []byte { - if x != nil { - return x.ReplyMarkupData - } - return nil -} - -// BotToken -type BotToken struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token []byte `protobuf:"bytes,1,opt,name=Token,proto3" json:"Token,omitempty"` -} - -func (x *BotToken) Reset() { - *x = BotToken{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotToken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotToken) ProtoMessage() {} - -func (x *BotToken) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotToken.ProtoReflect.Descriptor instead. -func (*BotToken) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{25} -} - -func (x *BotToken) GetToken() []byte { - if x != nil { - return x.Token - } - return nil -} - -// BotRecalled -type BotRecalled struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Username string `protobuf:"bytes,2,opt,name=Username,proto3" json:"Username,omitempty"` -} - -func (x *BotRecalled) Reset() { - *x = BotRecalled{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotRecalled) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotRecalled) ProtoMessage() {} - -func (x *BotRecalled) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotRecalled.ProtoReflect.Descriptor instead. -func (*BotRecalled) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{26} -} - -func (x *BotRecalled) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *BotRecalled) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -// BotCallbackAnswer -type BotCallbackAnswer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=Url,proto3" json:"Url,omitempty"` // URL to open - Message string `protobuf:"bytes,2,opt,name=Message,proto3" json:"Message,omitempty"` // Alert to show - CacheTime int32 `protobuf:"varint,3,opt,name=CacheTime,proto3" json:"CacheTime,omitempty"` // For how long should this answer be cached (in seconds) -} - -func (x *BotCallbackAnswer) Reset() { - *x = BotCallbackAnswer{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotCallbackAnswer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotCallbackAnswer) ProtoMessage() {} - -func (x *BotCallbackAnswer) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotCallbackAnswer.ProtoReflect.Descriptor instead. -func (*BotCallbackAnswer) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{27} -} - -func (x *BotCallbackAnswer) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *BotCallbackAnswer) GetMessage() string { - if x != nil { - return x.Message - } - return "" -} - -func (x *BotCallbackAnswer) GetCacheTime() int32 { - if x != nil { - return x.CacheTime - } - return 0 -} - -// BotsMany -type BotsMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Bots []*BotInfo `protobuf:"bytes,1,rep,name=Bots,proto3" json:"Bots,omitempty"` - Empty bool `protobuf:"varint,2,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *BotsMany) Reset() { - *x = BotsMany{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotsMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotsMany) ProtoMessage() {} - -func (x *BotsMany) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotsMany.ProtoReflect.Descriptor instead. -func (*BotsMany) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{28} -} - -func (x *BotsMany) GetBots() []*BotInfo { - if x != nil { - return x.Bots - } - return nil -} - -func (x *BotsMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// BotGetCommands -// @Function -// @Return: BotCommandsMany -type BotGetCommands struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *BotGetCommands) Reset() { - *x = BotGetCommands{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotGetCommands) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotGetCommands) ProtoMessage() {} - -func (x *BotGetCommands) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotGetCommands.ProtoReflect.Descriptor instead. -func (*BotGetCommands) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{29} -} - -func (x *BotGetCommands) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// BotCommandsMany -type BotCommandsMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Commands []*BotCommands `protobuf:"bytes,1,rep,name=Commands,proto3" json:"Commands,omitempty"` - Empty bool `protobuf:"varint,2,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *BotCommandsMany) Reset() { - *x = BotCommandsMany{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_bot_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotCommandsMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotCommandsMany) ProtoMessage() {} - -func (x *BotCommandsMany) ProtoReflect() protoreflect.Message { - mi := &file_chat_bot_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotCommandsMany.ProtoReflect.Descriptor instead. -func (*BotCommandsMany) Descriptor() ([]byte, []int) { - return file_chat_bot_proto_rawDescGZIP(), []int{30} -} - -func (x *BotCommandsMany) GetCommands() []*BotCommands { - if x != nil { - return x.Commands - } - return nil -} - -func (x *BotCommandsMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -var File_chat_bot_proto protoreflect.FileDescriptor - -var file_chat_bot_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x62, 0x6f, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x70, 0x61, - 0x70, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x68, 0x0a, 0x08, 0x42, 0x6f, 0x74, - 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x20, 0x0a, 0x03, 0x42, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, - 0x65, 0x72, 0x52, 0x03, 0x42, 0x6f, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, - 0x6d, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, - 0x6d, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x22, 0x25, 0x0a, 0x09, 0x42, 0x6f, 0x74, 0x52, 0x65, 0x63, 0x61, 0x6c, 0x6c, - 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xf6, 0x01, 0x0a, 0x0a, 0x42, - 0x6f, 0x74, 0x53, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x42, 0x6f, 0x74, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x42, 0x6f, 0x74, 0x49, 0x44, 0x12, - 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x4f, - 0x77, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4f, 0x77, 0x6e, 0x65, - 0x72, 0x12, 0x32, 0x0a, 0x0b, 0x42, 0x6f, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, 0x6f, 0x74, - 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x52, 0x0b, 0x42, 0x6f, 0x74, 0x43, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x49, 0x6e, 0x6c, 0x69, 0x6e, - 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x11, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x68, - 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x47, - 0x65, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x47, 0x65, 0x6f, 0x22, 0x3a, 0x0a, 0x06, 0x42, 0x6f, 0x74, 0x47, 0x65, 0x74, 0x12, 0x1a, 0x0a, - 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, - 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, - 0x9a, 0x02, 0x0a, 0x0e, 0x42, 0x6f, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x22, - 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, - 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, - 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, - 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, - 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x18, - 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, - 0x75, 0x70, 0x12, 0x28, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, - 0x70, 0x44, 0x61, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x22, 0xfe, 0x01, 0x0a, - 0x0e, 0x42, 0x6f, 0x74, 0x45, 0x64, 0x69, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, - 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, - 0x12, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, - 0x44, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, - 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, - 0x6b, 0x75, 0x70, 0x12, 0x28, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, - 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x22, 0xb9, 0x01, - 0x0a, 0x0c, 0x42, 0x6f, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x1a, - 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x31, - 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, - 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x22, 0x7b, 0x0a, 0x0f, 0x42, 0x6f, 0x74, - 0x53, 0x61, 0x76, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x06, - 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x74, - 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x50, 0x61, 0x72, 0x74, 0x49, 0x44, - 0x12, 0x1e, 0x0a, 0x0a, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x05, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x4e, 0x0a, 0x10, 0x42, 0x6f, 0x74, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x42, 0x6f, - 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x42, 0x6f, 0x74, 0x49, 0x44, - 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x42, 0x69, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x42, 0x69, 0x6f, 0x22, 0x52, 0x0a, 0x0e, 0x42, 0x6f, 0x74, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x2a, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, - 0x46, 0x69, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x42, 0x6f, 0x74, 0x49, 0x44, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x05, 0x42, 0x6f, 0x74, 0x49, 0x44, 0x22, 0x3e, 0x0a, 0x0e, 0x42, 0x6f, - 0x74, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, - 0x42, 0x6f, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x42, 0x6f, 0x74, - 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x77, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x06, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x77, 0x22, 0x56, 0x0a, 0x10, 0x42, 0x6f, - 0x74, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x22, - 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, - 0x44, 0x73, 0x22, 0x7e, 0x0a, 0x14, 0x42, 0x6f, 0x74, 0x53, 0x65, 0x74, 0x43, 0x61, 0x6c, 0x6c, - 0x62, 0x61, 0x63, 0x6b, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x07, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, - 0x07, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, 0x6d, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, - 0x6d, 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x14, 0x42, 0x6f, 0x74, 0x47, 0x65, 0x74, 0x43, 0x61, 0x6c, - 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x04, 0x50, - 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, - 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, - 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, - 0x61, 0x12, 0x20, 0x0a, 0x03, 0x42, 0x6f, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x03, - 0x42, 0x6f, 0x74, 0x22, 0xbc, 0x01, 0x0a, 0x13, 0x42, 0x6f, 0x74, 0x47, 0x65, 0x74, 0x49, 0x6e, - 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x20, 0x0a, 0x03, 0x42, - 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x03, 0x42, 0x6f, 0x74, 0x12, 0x22, 0x0a, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x12, 0x14, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, - 0x31, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x47, 0x65, 0x6f, - 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0x8e, 0x02, 0x0a, 0x13, 0x42, 0x6f, 0x74, 0x53, 0x65, 0x74, 0x49, 0x6e, 0x6c, - 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x61, - 0x6c, 0x6c, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x47, 0x61, 0x6c, - 0x6c, 0x65, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, - 0x4e, 0x65, 0x78, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x4e, 0x65, 0x78, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x33, 0x0a, 0x07, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, - 0x6e, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x73, 0x12, 0x32, 0x0a, 0x08, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x50, 0x4d, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, - 0x69, 0x6e, 0x65, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x50, 0x4d, 0x52, 0x08, 0x53, 0x77, 0x69, - 0x74, 0x63, 0x68, 0x50, 0x4d, 0x12, 0x1c, 0x0a, 0x07, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x44, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x49, 0x44, 0x22, 0xfc, 0x01, 0x0a, 0x14, 0x42, 0x6f, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x49, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, - 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, - 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x07, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, - 0x66, 0x74, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, - 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, - 0x12, 0x16, 0x0a, 0x06, 0x53, 0x69, 0x6c, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x53, 0x69, 0x6c, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x48, 0x69, 0x64, 0x65, - 0x56, 0x69, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x48, 0x69, 0x64, 0x65, 0x56, - 0x69, 0x61, 0x22, 0xa2, 0x01, 0x0a, 0x12, 0x42, 0x6f, 0x74, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, - 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x04, 0x46, 0x69, 0x6c, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x72, 0x6b, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x04, 0x44, 0x61, 0x72, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x12, 0x32, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x57, 0x61, 0x6c, 0x6c, - 0x50, 0x61, 0x70, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0xb8, 0x01, 0x0a, 0x0c, 0x42, 0x6f, 0x74, 0x55, - 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x47, 0x69, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x64, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x22, - 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x46, 0x69, - 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x05, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, - 0x65, 0x52, 0x05, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x12, 0x14, 0x0a, 0x05, 0x57, 0x69, 0x64, 0x74, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, - 0x0a, 0x06, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, - 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x22, 0xc8, 0x01, 0x0a, 0x0a, 0x42, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x73, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x07, 0x47, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x07, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x07, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x4e, 0x65, 0x78, - 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x4e, - 0x65, 0x78, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x32, 0x0a, 0x08, 0x53, 0x77, 0x69, - 0x74, 0x63, 0x68, 0x50, 0x4d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x77, 0x69, 0x74, 0x63, - 0x68, 0x50, 0x4d, 0x52, 0x08, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x50, 0x4d, 0x12, 0x2e, 0x0a, - 0x07, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0x47, 0x0a, - 0x11, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, - 0x50, 0x4d, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x74, 0x61, 0x72, - 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x22, 0xed, 0x01, 0x0a, 0x0f, 0x42, 0x6f, 0x74, 0x49, 0x6e, - 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, - 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x72, 0x6c, 0x12, 0x2b, 0x0a, 0x05, 0x54, 0x68, 0x75, 0x6d, - 0x62, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x57, 0x65, 0x62, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x05, - 0x54, 0x68, 0x75, 0x6d, 0x62, 0x12, 0x2f, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, 0x6f, 0x74, - 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x81, 0x02, 0x0a, 0x14, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x12, - 0x27, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, - 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, - 0x72, 0x6c, 0x12, 0x30, 0x0a, 0x05, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x57, 0x65, 0x62, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x54, - 0x68, 0x75, 0x6d, 0x62, 0x12, 0x34, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xda, 0x01, 0x0a, 0x10, 0x42, - 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x0b, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, - 0x73, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x12, 0x28, 0x0a, - 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, - 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, - 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x22, 0x87, 0x02, 0x0a, 0x15, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, - 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x4e, 0x6f, 0x57, - 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x4e, 0x6f, - 0x57, 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, - 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2e, 0x0a, 0x08, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, - 0x72, 0x6b, 0x75, 0x70, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x12, 0x28, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, - 0x61, 0x22, 0x20, 0x0a, 0x08, 0x42, 0x6f, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, - 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x22, 0x39, 0x0a, 0x0b, 0x42, 0x6f, 0x74, 0x52, 0x65, 0x63, 0x61, 0x6c, 0x6c, - 0x65, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, - 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x5d, - 0x0a, 0x11, 0x42, 0x6f, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x41, 0x6e, 0x73, - 0x77, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x55, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x09, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x42, 0x0a, - 0x08, 0x42, 0x6f, 0x74, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x20, 0x0a, 0x04, 0x42, 0x6f, 0x74, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, 0x6f, - 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x42, 0x6f, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x22, 0x34, 0x0a, 0x0e, 0x42, 0x6f, 0x74, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, - 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x22, 0x55, 0x0a, 0x0f, 0x42, 0x6f, 0x74, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x2c, 0x0a, 0x08, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x42, 0x6f, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x52, 0x08, - 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x08, - 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_chat_bot_proto_rawDescOnce sync.Once - file_chat_bot_proto_rawDescData = file_chat_bot_proto_rawDesc -) - -func file_chat_bot_proto_rawDescGZIP() []byte { - file_chat_bot_proto_rawDescOnce.Do(func() { - file_chat_bot_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_bot_proto_rawDescData) - }) - return file_chat_bot_proto_rawDescData -} - -var file_chat_bot_proto_msgTypes = make([]protoimpl.MessageInfo, 31) -var file_chat_bot_proto_goTypes = []interface{}{ - (*BotStart)(nil), // 0: msg.BotStart - (*BotRecall)(nil), // 1: msg.BotRecall - (*BotSetInfo)(nil), // 2: msg.BotSetInfo - (*BotGet)(nil), // 3: msg.BotGet - (*BotSendMessage)(nil), // 4: msg.BotSendMessage - (*BotEditMessage)(nil), // 5: msg.BotEditMessage - (*BotSendMedia)(nil), // 6: msg.BotSendMedia - (*BotSaveFilePart)(nil), // 7: msg.BotSaveFilePart - (*BotUpdateProfile)(nil), // 8: msg.BotUpdateProfile - (*BotUpdatePhoto)(nil), // 9: msg.BotUpdatePhoto - (*BotRevokeToken)(nil), // 10: msg.BotRevokeToken - (*BotDeleteMessage)(nil), // 11: msg.BotDeleteMessage - (*BotSetCallbackAnswer)(nil), // 12: msg.BotSetCallbackAnswer - (*BotGetCallbackAnswer)(nil), // 13: msg.BotGetCallbackAnswer - (*BotGetInlineResults)(nil), // 14: msg.BotGetInlineResults - (*BotSetInlineResults)(nil), // 15: msg.BotSetInlineResults - (*BotSendInlineResults)(nil), // 16: msg.BotSendInlineResults - (*BotUploadWallPaper)(nil), // 17: msg.BotUploadWallPaper - (*BotUploadGif)(nil), // 18: msg.BotUploadGif - (*BotResults)(nil), // 19: msg.BotResults - (*BotInlineSwitchPM)(nil), // 20: msg.BotInlineSwitchPM - (*BotInlineResult)(nil), // 21: msg.BotInlineResult - (*InputBotInlineResult)(nil), // 22: msg.InputBotInlineResult - (*BotInlineMessage)(nil), // 23: msg.BotInlineMessage - (*InputBotInlineMessage)(nil), // 24: msg.InputBotInlineMessage - (*BotToken)(nil), // 25: msg.BotToken - (*BotRecalled)(nil), // 26: msg.BotRecalled - (*BotCallbackAnswer)(nil), // 27: msg.BotCallbackAnswer - (*BotsMany)(nil), // 28: msg.BotsMany - (*BotGetCommands)(nil), // 29: msg.BotGetCommands - (*BotCommandsMany)(nil), // 30: msg.BotCommandsMany - (*InputPeer)(nil), // 31: msg.InputPeer - (*BotCommands)(nil), // 32: msg.BotCommands - (*MessageEntity)(nil), // 33: msg.MessageEntity - (InputMediaType)(0), // 34: msg.InputMediaType - (*InputFileLocation)(nil), // 35: msg.InputFileLocation - (*InputUser)(nil), // 36: msg.InputUser - (*InputGeoLocation)(nil), // 37: msg.InputGeoLocation - (*WallPaperSettings)(nil), // 38: msg.WallPaperSettings - (*InputFile)(nil), // 39: msg.InputFile - (MediaType)(0), // 40: msg.MediaType - (*MediaWebDocument)(nil), // 41: msg.MediaWebDocument - (*InputMediaWebDocument)(nil), // 42: msg.InputMediaWebDocument - (*BotInfo)(nil), // 43: msg.BotInfo -} -var file_chat_bot_proto_depIdxs = []int32{ - 31, // 0: msg.BotStart.Bot:type_name -> msg.InputPeer - 32, // 1: msg.BotSetInfo.BotCommands:type_name -> msg.BotCommands - 31, // 2: msg.BotSendMessage.Peer:type_name -> msg.InputPeer - 33, // 3: msg.BotSendMessage.Entities:type_name -> msg.MessageEntity - 31, // 4: msg.BotEditMessage.Peer:type_name -> msg.InputPeer - 33, // 5: msg.BotEditMessage.Entities:type_name -> msg.MessageEntity - 31, // 6: msg.BotSendMedia.Peer:type_name -> msg.InputPeer - 34, // 7: msg.BotSendMedia.MediaType:type_name -> msg.InputMediaType - 35, // 8: msg.BotUpdatePhoto.File:type_name -> msg.InputFileLocation - 31, // 9: msg.BotDeleteMessage.Peer:type_name -> msg.InputPeer - 31, // 10: msg.BotGetCallbackAnswer.Peer:type_name -> msg.InputPeer - 36, // 11: msg.BotGetCallbackAnswer.Bot:type_name -> msg.InputUser - 36, // 12: msg.BotGetInlineResults.Bot:type_name -> msg.InputUser - 31, // 13: msg.BotGetInlineResults.Peer:type_name -> msg.InputPeer - 37, // 14: msg.BotGetInlineResults.Location:type_name -> msg.InputGeoLocation - 22, // 15: msg.BotSetInlineResults.Results:type_name -> msg.InputBotInlineResult - 20, // 16: msg.BotSetInlineResults.SwitchPM:type_name -> msg.BotInlineSwitchPM - 31, // 17: msg.BotSendInlineResults.Peer:type_name -> msg.InputPeer - 35, // 18: msg.BotUploadWallPaper.File:type_name -> msg.InputFileLocation - 38, // 19: msg.BotUploadWallPaper.Settings:type_name -> msg.WallPaperSettings - 39, // 20: msg.BotUploadGif.File:type_name -> msg.InputFile - 39, // 21: msg.BotUploadGif.Thumb:type_name -> msg.InputFile - 20, // 22: msg.BotResults.SwitchPM:type_name -> msg.BotInlineSwitchPM - 21, // 23: msg.BotResults.Results:type_name -> msg.BotInlineResult - 40, // 24: msg.BotInlineResult.Type:type_name -> msg.MediaType - 41, // 25: msg.BotInlineResult.Thumb:type_name -> msg.MediaWebDocument - 23, // 26: msg.BotInlineResult.Message:type_name -> msg.BotInlineMessage - 34, // 27: msg.InputBotInlineResult.Type:type_name -> msg.InputMediaType - 42, // 28: msg.InputBotInlineResult.Thumb:type_name -> msg.InputMediaWebDocument - 24, // 29: msg.InputBotInlineResult.Message:type_name -> msg.InputBotInlineMessage - 33, // 30: msg.BotInlineMessage.Entities:type_name -> msg.MessageEntity - 33, // 31: msg.InputBotInlineMessage.Entities:type_name -> msg.MessageEntity - 43, // 32: msg.BotsMany.Bots:type_name -> msg.BotInfo - 31, // 33: msg.BotGetCommands.Peer:type_name -> msg.InputPeer - 32, // 34: msg.BotCommandsMany.Commands:type_name -> msg.BotCommands - 35, // [35:35] is the sub-list for method output_type - 35, // [35:35] is the sub-list for method input_type - 35, // [35:35] is the sub-list for extension type_name - 35, // [35:35] is the sub-list for extension extendee - 0, // [0:35] is the sub-list for field type_name -} - -func init() { file_chat_bot_proto_init() } -func file_chat_bot_proto_init() { - if File_chat_bot_proto != nil { - return - } - file_core_types_proto_init() - file_chat_messages_medias_proto_init() - file_chat_wallpaper_proto_init() - if !protoimpl.UnsafeEnabled { - file_chat_bot_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotStart); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotRecall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotSetInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotGet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotSendMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotEditMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotSendMedia); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotSaveFilePart); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotUpdateProfile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotUpdatePhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotRevokeToken); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotDeleteMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotSetCallbackAnswer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotGetCallbackAnswer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotGetInlineResults); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotSetInlineResults); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotSendInlineResults); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotUploadWallPaper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotUploadGif); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotResults); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotInlineSwitchPM); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotInlineResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputBotInlineResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotInlineMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputBotInlineMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotToken); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotRecalled); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotCallbackAnswer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotsMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotGetCommands); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_bot_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotCommandsMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_bot_proto_rawDesc, - NumEnums: 0, - NumMessages: 31, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_bot_proto_goTypes, - DependencyIndexes: file_chat_bot_proto_depIdxs, - MessageInfos: file_chat_bot_proto_msgTypes, - }.Build() - File_chat_bot_proto = out.File - file_chat_bot_proto_rawDesc = nil - file_chat_bot_proto_goTypes = nil - file_chat_bot_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.bot.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.bot.rony.go deleted file mode 100644 index 606d068c..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.bot.rony.go +++ /dev/null @@ -1,2337 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.bot.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_BotStart int64 = 2068702388 - -type poolBotStart struct { - pool sync.Pool -} - -func (p *poolBotStart) Get() *BotStart { - x, ok := p.pool.Get().(*BotStart) - if !ok { - x = &BotStart{} - } - - x.Bot = PoolInputPeer.Get() - - return x -} - -func (p *poolBotStart) Put(x *BotStart) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Bot) - x.RandomID = 0 - x.StartParam = "" - - p.pool.Put(x) -} - -var PoolBotStart = poolBotStart{} - -func (x *BotStart) DeepCopy(z *BotStart) { - if x.Bot != nil { - if z.Bot == nil { - z.Bot = PoolInputPeer.Get() - } - x.Bot.DeepCopy(z.Bot) - } else { - PoolInputPeer.Put(z.Bot) - z.Bot = nil - } - z.RandomID = x.RandomID - z.StartParam = x.StartParam -} - -func (x *BotStart) Clone() *BotStart { - z := &BotStart{} - x.DeepCopy(z) - return z -} - -func (x *BotStart) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotStart) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotStart) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotStart) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotStart) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotStart, x) -} - -const C_BotRecall int64 = 4208974051 - -type poolBotRecall struct { - pool sync.Pool -} - -func (p *poolBotRecall) Get() *BotRecall { - x, ok := p.pool.Get().(*BotRecall) - if !ok { - x = &BotRecall{} - } - - return x -} - -func (p *poolBotRecall) Put(x *BotRecall) { - if x == nil { - return - } - - x.Version = 0 - - p.pool.Put(x) -} - -var PoolBotRecall = poolBotRecall{} - -func (x *BotRecall) DeepCopy(z *BotRecall) { - z.Version = x.Version -} - -func (x *BotRecall) Clone() *BotRecall { - z := &BotRecall{} - x.DeepCopy(z) - return z -} - -func (x *BotRecall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotRecall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotRecall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotRecall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotRecall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotRecall, x) -} - -const C_BotSetInfo int64 = 3735815245 - -type poolBotSetInfo struct { - pool sync.Pool -} - -func (p *poolBotSetInfo) Get() *BotSetInfo { - x, ok := p.pool.Get().(*BotSetInfo) - if !ok { - x = &BotSetInfo{} - } - - return x -} - -func (p *poolBotSetInfo) Put(x *BotSetInfo) { - if x == nil { - return - } - - x.BotID = 0 - x.RandomID = 0 - x.Owner = 0 - for _, z := range x.BotCommands { - PoolBotCommands.Put(z) - } - x.BotCommands = x.BotCommands[:0] - x.Description = "" - x.InlinePlaceholder = "" - x.InlineGeo = false - - p.pool.Put(x) -} - -var PoolBotSetInfo = poolBotSetInfo{} - -func (x *BotSetInfo) DeepCopy(z *BotSetInfo) { - z.BotID = x.BotID - z.RandomID = x.RandomID - z.Owner = x.Owner - for idx := range x.BotCommands { - if x.BotCommands[idx] == nil { - continue - } - xx := PoolBotCommands.Get() - x.BotCommands[idx].DeepCopy(xx) - z.BotCommands = append(z.BotCommands, xx) - } - z.Description = x.Description - z.InlinePlaceholder = x.InlinePlaceholder - z.InlineGeo = x.InlineGeo -} - -func (x *BotSetInfo) Clone() *BotSetInfo { - z := &BotSetInfo{} - x.DeepCopy(z) - return z -} - -func (x *BotSetInfo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotSetInfo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotSetInfo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotSetInfo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotSetInfo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotSetInfo, x) -} - -const C_BotGet int64 = 911895569 - -type poolBotGet struct { - pool sync.Pool -} - -func (p *poolBotGet) Get() *BotGet { - x, ok := p.pool.Get().(*BotGet) - if !ok { - x = &BotGet{} - } - - return x -} - -func (p *poolBotGet) Put(x *BotGet) { - if x == nil { - return - } - - x.UserID = 0 - x.Limit = 0 - - p.pool.Put(x) -} - -var PoolBotGet = poolBotGet{} - -func (x *BotGet) DeepCopy(z *BotGet) { - z.UserID = x.UserID - z.Limit = x.Limit -} - -func (x *BotGet) Clone() *BotGet { - z := &BotGet{} - x.DeepCopy(z) - return z -} - -func (x *BotGet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotGet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotGet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotGet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotGet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotGet, x) -} - -const C_BotSendMessage int64 = 2371725696 - -type poolBotSendMessage struct { - pool sync.Pool -} - -func (p *poolBotSendMessage) Get() *BotSendMessage { - x, ok := p.pool.Get().(*BotSendMessage) - if !ok { - x = &BotSendMessage{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolBotSendMessage) Put(x *BotSendMessage) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.Body = "" - x.ReplyTo = 0 - x.ClearDraft = false - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.ReplyMarkup = 0 - x.ReplyMarkupData = x.ReplyMarkupData[:0] - - p.pool.Put(x) -} - -var PoolBotSendMessage = poolBotSendMessage{} - -func (x *BotSendMessage) DeepCopy(z *BotSendMessage) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Body = x.Body - z.ReplyTo = x.ReplyTo - z.ClearDraft = x.ClearDraft - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.ReplyMarkup = x.ReplyMarkup - z.ReplyMarkupData = append(z.ReplyMarkupData[:0], x.ReplyMarkupData...) -} - -func (x *BotSendMessage) Clone() *BotSendMessage { - z := &BotSendMessage{} - x.DeepCopy(z) - return z -} - -func (x *BotSendMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotSendMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotSendMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotSendMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotSendMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotSendMessage, x) -} - -const C_BotEditMessage int64 = 1007063252 - -type poolBotEditMessage struct { - pool sync.Pool -} - -func (p *poolBotEditMessage) Get() *BotEditMessage { - x, ok := p.pool.Get().(*BotEditMessage) - if !ok { - x = &BotEditMessage{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolBotEditMessage) Put(x *BotEditMessage) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.Body = "" - x.MessageID = 0 - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.ReplyMarkup = 0 - x.ReplyMarkupData = x.ReplyMarkupData[:0] - - p.pool.Put(x) -} - -var PoolBotEditMessage = poolBotEditMessage{} - -func (x *BotEditMessage) DeepCopy(z *BotEditMessage) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Body = x.Body - z.MessageID = x.MessageID - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.ReplyMarkup = x.ReplyMarkup - z.ReplyMarkupData = append(z.ReplyMarkupData[:0], x.ReplyMarkupData...) -} - -func (x *BotEditMessage) Clone() *BotEditMessage { - z := &BotEditMessage{} - x.DeepCopy(z) - return z -} - -func (x *BotEditMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotEditMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotEditMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotEditMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotEditMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotEditMessage, x) -} - -const C_BotSendMedia int64 = 1844738193 - -type poolBotSendMedia struct { - pool sync.Pool -} - -func (p *poolBotSendMedia) Get() *BotSendMedia { - x, ok := p.pool.Get().(*BotSendMedia) - if !ok { - x = &BotSendMedia{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolBotSendMedia) Put(x *BotSendMedia) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.MediaType = 0 - x.MediaData = x.MediaData[:0] - x.ReplyTo = 0 - - p.pool.Put(x) -} - -var PoolBotSendMedia = poolBotSendMedia{} - -func (x *BotSendMedia) DeepCopy(z *BotSendMedia) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MediaType = x.MediaType - z.MediaData = append(z.MediaData[:0], x.MediaData...) - z.ReplyTo = x.ReplyTo -} - -func (x *BotSendMedia) Clone() *BotSendMedia { - z := &BotSendMedia{} - x.DeepCopy(z) - return z -} - -func (x *BotSendMedia) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotSendMedia) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotSendMedia) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotSendMedia) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotSendMedia) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotSendMedia, x) -} - -const C_BotSaveFilePart int64 = 905437522 - -type poolBotSaveFilePart struct { - pool sync.Pool -} - -func (p *poolBotSaveFilePart) Get() *BotSaveFilePart { - x, ok := p.pool.Get().(*BotSaveFilePart) - if !ok { - x = &BotSaveFilePart{} - } - - return x -} - -func (p *poolBotSaveFilePart) Put(x *BotSaveFilePart) { - if x == nil { - return - } - - x.FileID = 0 - x.PartID = 0 - x.TotalParts = 0 - x.Bytes = x.Bytes[:0] - - p.pool.Put(x) -} - -var PoolBotSaveFilePart = poolBotSaveFilePart{} - -func (x *BotSaveFilePart) DeepCopy(z *BotSaveFilePart) { - z.FileID = x.FileID - z.PartID = x.PartID - z.TotalParts = x.TotalParts - z.Bytes = append(z.Bytes[:0], x.Bytes...) -} - -func (x *BotSaveFilePart) Clone() *BotSaveFilePart { - z := &BotSaveFilePart{} - x.DeepCopy(z) - return z -} - -func (x *BotSaveFilePart) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotSaveFilePart) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotSaveFilePart) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotSaveFilePart) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotSaveFilePart) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotSaveFilePart, x) -} - -const C_BotUpdateProfile int64 = 2820005221 - -type poolBotUpdateProfile struct { - pool sync.Pool -} - -func (p *poolBotUpdateProfile) Get() *BotUpdateProfile { - x, ok := p.pool.Get().(*BotUpdateProfile) - if !ok { - x = &BotUpdateProfile{} - } - - return x -} - -func (p *poolBotUpdateProfile) Put(x *BotUpdateProfile) { - if x == nil { - return - } - - x.BotID = 0 - x.Name = "" - x.Bio = "" - - p.pool.Put(x) -} - -var PoolBotUpdateProfile = poolBotUpdateProfile{} - -func (x *BotUpdateProfile) DeepCopy(z *BotUpdateProfile) { - z.BotID = x.BotID - z.Name = x.Name - z.Bio = x.Bio -} - -func (x *BotUpdateProfile) Clone() *BotUpdateProfile { - z := &BotUpdateProfile{} - x.DeepCopy(z) - return z -} - -func (x *BotUpdateProfile) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotUpdateProfile) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotUpdateProfile) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotUpdateProfile) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotUpdateProfile) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotUpdateProfile, x) -} - -const C_BotUpdatePhoto int64 = 3464973784 - -type poolBotUpdatePhoto struct { - pool sync.Pool -} - -func (p *poolBotUpdatePhoto) Get() *BotUpdatePhoto { - x, ok := p.pool.Get().(*BotUpdatePhoto) - if !ok { - x = &BotUpdatePhoto{} - } - - x.File = PoolInputFileLocation.Get() - - return x -} - -func (p *poolBotUpdatePhoto) Put(x *BotUpdatePhoto) { - if x == nil { - return - } - - PoolInputFileLocation.Put(x.File) - x.BotID = 0 - - p.pool.Put(x) -} - -var PoolBotUpdatePhoto = poolBotUpdatePhoto{} - -func (x *BotUpdatePhoto) DeepCopy(z *BotUpdatePhoto) { - if x.File != nil { - if z.File == nil { - z.File = PoolInputFileLocation.Get() - } - x.File.DeepCopy(z.File) - } else { - PoolInputFileLocation.Put(z.File) - z.File = nil - } - z.BotID = x.BotID -} - -func (x *BotUpdatePhoto) Clone() *BotUpdatePhoto { - z := &BotUpdatePhoto{} - x.DeepCopy(z) - return z -} - -func (x *BotUpdatePhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotUpdatePhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotUpdatePhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotUpdatePhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotUpdatePhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotUpdatePhoto, x) -} - -const C_BotRevokeToken int64 = 1804706614 - -type poolBotRevokeToken struct { - pool sync.Pool -} - -func (p *poolBotRevokeToken) Get() *BotRevokeToken { - x, ok := p.pool.Get().(*BotRevokeToken) - if !ok { - x = &BotRevokeToken{} - } - - return x -} - -func (p *poolBotRevokeToken) Put(x *BotRevokeToken) { - if x == nil { - return - } - - x.BotID = 0 - x.GetNew = false - - p.pool.Put(x) -} - -var PoolBotRevokeToken = poolBotRevokeToken{} - -func (x *BotRevokeToken) DeepCopy(z *BotRevokeToken) { - z.BotID = x.BotID - z.GetNew = x.GetNew -} - -func (x *BotRevokeToken) Clone() *BotRevokeToken { - z := &BotRevokeToken{} - x.DeepCopy(z) - return z -} - -func (x *BotRevokeToken) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotRevokeToken) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotRevokeToken) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotRevokeToken) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotRevokeToken) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotRevokeToken, x) -} - -const C_BotDeleteMessage int64 = 3523077017 - -type poolBotDeleteMessage struct { - pool sync.Pool -} - -func (p *poolBotDeleteMessage) Get() *BotDeleteMessage { - x, ok := p.pool.Get().(*BotDeleteMessage) - if !ok { - x = &BotDeleteMessage{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolBotDeleteMessage) Put(x *BotDeleteMessage) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageIDs = x.MessageIDs[:0] - - p.pool.Put(x) -} - -var PoolBotDeleteMessage = poolBotDeleteMessage{} - -func (x *BotDeleteMessage) DeepCopy(z *BotDeleteMessage) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) -} - -func (x *BotDeleteMessage) Clone() *BotDeleteMessage { - z := &BotDeleteMessage{} - x.DeepCopy(z) - return z -} - -func (x *BotDeleteMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotDeleteMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotDeleteMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotDeleteMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotDeleteMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotDeleteMessage, x) -} - -const C_BotSetCallbackAnswer int64 = 1891806754 - -type poolBotSetCallbackAnswer struct { - pool sync.Pool -} - -func (p *poolBotSetCallbackAnswer) Get() *BotSetCallbackAnswer { - x, ok := p.pool.Get().(*BotSetCallbackAnswer) - if !ok { - x = &BotSetCallbackAnswer{} - } - - return x -} - -func (p *poolBotSetCallbackAnswer) Put(x *BotSetCallbackAnswer) { - if x == nil { - return - } - - x.QueryID = 0 - x.Url = "" - x.Message = "" - x.CacheTime = 0 - - p.pool.Put(x) -} - -var PoolBotSetCallbackAnswer = poolBotSetCallbackAnswer{} - -func (x *BotSetCallbackAnswer) DeepCopy(z *BotSetCallbackAnswer) { - z.QueryID = x.QueryID - z.Url = x.Url - z.Message = x.Message - z.CacheTime = x.CacheTime -} - -func (x *BotSetCallbackAnswer) Clone() *BotSetCallbackAnswer { - z := &BotSetCallbackAnswer{} - x.DeepCopy(z) - return z -} - -func (x *BotSetCallbackAnswer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotSetCallbackAnswer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotSetCallbackAnswer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotSetCallbackAnswer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotSetCallbackAnswer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotSetCallbackAnswer, x) -} - -const C_BotGetCallbackAnswer int64 = 345706640 - -type poolBotGetCallbackAnswer struct { - pool sync.Pool -} - -func (p *poolBotGetCallbackAnswer) Get() *BotGetCallbackAnswer { - x, ok := p.pool.Get().(*BotGetCallbackAnswer) - if !ok { - x = &BotGetCallbackAnswer{} - } - - x.Peer = PoolInputPeer.Get() - - x.Bot = PoolInputUser.Get() - - return x -} - -func (p *poolBotGetCallbackAnswer) Put(x *BotGetCallbackAnswer) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageID = 0 - x.Data = x.Data[:0] - PoolInputUser.Put(x.Bot) - - p.pool.Put(x) -} - -var PoolBotGetCallbackAnswer = poolBotGetCallbackAnswer{} - -func (x *BotGetCallbackAnswer) DeepCopy(z *BotGetCallbackAnswer) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageID = x.MessageID - z.Data = append(z.Data[:0], x.Data...) - if x.Bot != nil { - if z.Bot == nil { - z.Bot = PoolInputUser.Get() - } - x.Bot.DeepCopy(z.Bot) - } else { - PoolInputUser.Put(z.Bot) - z.Bot = nil - } -} - -func (x *BotGetCallbackAnswer) Clone() *BotGetCallbackAnswer { - z := &BotGetCallbackAnswer{} - x.DeepCopy(z) - return z -} - -func (x *BotGetCallbackAnswer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotGetCallbackAnswer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotGetCallbackAnswer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotGetCallbackAnswer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotGetCallbackAnswer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotGetCallbackAnswer, x) -} - -const C_BotGetInlineResults int64 = 4192114308 - -type poolBotGetInlineResults struct { - pool sync.Pool -} - -func (p *poolBotGetInlineResults) Get() *BotGetInlineResults { - x, ok := p.pool.Get().(*BotGetInlineResults) - if !ok { - x = &BotGetInlineResults{} - } - - x.Bot = PoolInputUser.Get() - - x.Peer = PoolInputPeer.Get() - - x.Location = PoolInputGeoLocation.Get() - - return x -} - -func (p *poolBotGetInlineResults) Put(x *BotGetInlineResults) { - if x == nil { - return - } - - PoolInputUser.Put(x.Bot) - PoolInputPeer.Put(x.Peer) - x.Query = "" - x.Offset = "" - PoolInputGeoLocation.Put(x.Location) - - p.pool.Put(x) -} - -var PoolBotGetInlineResults = poolBotGetInlineResults{} - -func (x *BotGetInlineResults) DeepCopy(z *BotGetInlineResults) { - if x.Bot != nil { - if z.Bot == nil { - z.Bot = PoolInputUser.Get() - } - x.Bot.DeepCopy(z.Bot) - } else { - PoolInputUser.Put(z.Bot) - z.Bot = nil - } - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Query = x.Query - z.Offset = x.Offset - if x.Location != nil { - if z.Location == nil { - z.Location = PoolInputGeoLocation.Get() - } - x.Location.DeepCopy(z.Location) - } else { - PoolInputGeoLocation.Put(z.Location) - z.Location = nil - } -} - -func (x *BotGetInlineResults) Clone() *BotGetInlineResults { - z := &BotGetInlineResults{} - x.DeepCopy(z) - return z -} - -func (x *BotGetInlineResults) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotGetInlineResults) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotGetInlineResults) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotGetInlineResults) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotGetInlineResults) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotGetInlineResults, x) -} - -const C_BotSetInlineResults int64 = 3418940573 - -type poolBotSetInlineResults struct { - pool sync.Pool -} - -func (p *poolBotSetInlineResults) Get() *BotSetInlineResults { - x, ok := p.pool.Get().(*BotSetInlineResults) - if !ok { - x = &BotSetInlineResults{} - } - - x.SwitchPM = PoolBotInlineSwitchPM.Get() - - return x -} - -func (p *poolBotSetInlineResults) Put(x *BotSetInlineResults) { - if x == nil { - return - } - - x.Gallery = false - x.Private = false - x.CacheTime = 0 - x.NextOffset = "" - for _, z := range x.Results { - PoolInputBotInlineResult.Put(z) - } - x.Results = x.Results[:0] - PoolBotInlineSwitchPM.Put(x.SwitchPM) - x.QueryID = 0 - - p.pool.Put(x) -} - -var PoolBotSetInlineResults = poolBotSetInlineResults{} - -func (x *BotSetInlineResults) DeepCopy(z *BotSetInlineResults) { - z.Gallery = x.Gallery - z.Private = x.Private - z.CacheTime = x.CacheTime - z.NextOffset = x.NextOffset - for idx := range x.Results { - if x.Results[idx] == nil { - continue - } - xx := PoolInputBotInlineResult.Get() - x.Results[idx].DeepCopy(xx) - z.Results = append(z.Results, xx) - } - if x.SwitchPM != nil { - if z.SwitchPM == nil { - z.SwitchPM = PoolBotInlineSwitchPM.Get() - } - x.SwitchPM.DeepCopy(z.SwitchPM) - } else { - PoolBotInlineSwitchPM.Put(z.SwitchPM) - z.SwitchPM = nil - } - z.QueryID = x.QueryID -} - -func (x *BotSetInlineResults) Clone() *BotSetInlineResults { - z := &BotSetInlineResults{} - x.DeepCopy(z) - return z -} - -func (x *BotSetInlineResults) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotSetInlineResults) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotSetInlineResults) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotSetInlineResults) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotSetInlineResults) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotSetInlineResults, x) -} - -const C_BotSendInlineResults int64 = 923160988 - -type poolBotSendInlineResults struct { - pool sync.Pool -} - -func (p *poolBotSendInlineResults) Get() *BotSendInlineResults { - x, ok := p.pool.Get().(*BotSendInlineResults) - if !ok { - x = &BotSendInlineResults{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolBotSendInlineResults) Put(x *BotSendInlineResults) { - if x == nil { - return - } - - x.RandomID = 0 - x.QueryID = 0 - x.ResultID = "" - x.ClearDraft = false - PoolInputPeer.Put(x.Peer) - x.ReplyTo = 0 - x.Silent = false - x.HideVia = false - - p.pool.Put(x) -} - -var PoolBotSendInlineResults = poolBotSendInlineResults{} - -func (x *BotSendInlineResults) DeepCopy(z *BotSendInlineResults) { - z.RandomID = x.RandomID - z.QueryID = x.QueryID - z.ResultID = x.ResultID - z.ClearDraft = x.ClearDraft - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.ReplyTo = x.ReplyTo - z.Silent = x.Silent - z.HideVia = x.HideVia -} - -func (x *BotSendInlineResults) Clone() *BotSendInlineResults { - z := &BotSendInlineResults{} - x.DeepCopy(z) - return z -} - -func (x *BotSendInlineResults) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotSendInlineResults) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotSendInlineResults) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotSendInlineResults) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotSendInlineResults) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotSendInlineResults, x) -} - -const C_BotUploadWallPaper int64 = 3329295900 - -type poolBotUploadWallPaper struct { - pool sync.Pool -} - -func (p *poolBotUploadWallPaper) Get() *BotUploadWallPaper { - x, ok := p.pool.Get().(*BotUploadWallPaper) - if !ok { - x = &BotUploadWallPaper{} - } - - x.File = PoolInputFileLocation.Get() - - x.Settings = PoolWallPaperSettings.Get() - - return x -} - -func (p *poolBotUploadWallPaper) Put(x *BotUploadWallPaper) { - if x == nil { - return - } - - PoolInputFileLocation.Put(x.File) - x.Dark = false - x.Pattern = false - PoolWallPaperSettings.Put(x.Settings) - - p.pool.Put(x) -} - -var PoolBotUploadWallPaper = poolBotUploadWallPaper{} - -func (x *BotUploadWallPaper) DeepCopy(z *BotUploadWallPaper) { - if x.File != nil { - if z.File == nil { - z.File = PoolInputFileLocation.Get() - } - x.File.DeepCopy(z.File) - } else { - PoolInputFileLocation.Put(z.File) - z.File = nil - } - z.Dark = x.Dark - z.Pattern = x.Pattern - if x.Settings != nil { - if z.Settings == nil { - z.Settings = PoolWallPaperSettings.Get() - } - x.Settings.DeepCopy(z.Settings) - } else { - PoolWallPaperSettings.Put(z.Settings) - z.Settings = nil - } -} - -func (x *BotUploadWallPaper) Clone() *BotUploadWallPaper { - z := &BotUploadWallPaper{} - x.DeepCopy(z) - return z -} - -func (x *BotUploadWallPaper) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotUploadWallPaper) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotUploadWallPaper) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotUploadWallPaper) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotUploadWallPaper) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotUploadWallPaper, x) -} - -const C_BotUploadGif int64 = 3473872836 - -type poolBotUploadGif struct { - pool sync.Pool -} - -func (p *poolBotUploadGif) Get() *BotUploadGif { - x, ok := p.pool.Get().(*BotUploadGif) - if !ok { - x = &BotUploadGif{} - } - - x.File = PoolInputFile.Get() - - x.Thumb = PoolInputFile.Get() - - return x -} - -func (p *poolBotUploadGif) Put(x *BotUploadGif) { - if x == nil { - return - } - - x.Token = "" - PoolInputFile.Put(x.File) - PoolInputFile.Put(x.Thumb) - x.Width = 0 - x.Height = 0 - x.MimeType = "" - - p.pool.Put(x) -} - -var PoolBotUploadGif = poolBotUploadGif{} - -func (x *BotUploadGif) DeepCopy(z *BotUploadGif) { - z.Token = x.Token - if x.File != nil { - if z.File == nil { - z.File = PoolInputFile.Get() - } - x.File.DeepCopy(z.File) - } else { - PoolInputFile.Put(z.File) - z.File = nil - } - if x.Thumb != nil { - if z.Thumb == nil { - z.Thumb = PoolInputFile.Get() - } - x.Thumb.DeepCopy(z.Thumb) - } else { - PoolInputFile.Put(z.Thumb) - z.Thumb = nil - } - z.Width = x.Width - z.Height = x.Height - z.MimeType = x.MimeType -} - -func (x *BotUploadGif) Clone() *BotUploadGif { - z := &BotUploadGif{} - x.DeepCopy(z) - return z -} - -func (x *BotUploadGif) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotUploadGif) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotUploadGif) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotUploadGif) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotUploadGif) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotUploadGif, x) -} - -const C_BotResults int64 = 527920130 - -type poolBotResults struct { - pool sync.Pool -} - -func (p *poolBotResults) Get() *BotResults { - x, ok := p.pool.Get().(*BotResults) - if !ok { - x = &BotResults{} - } - - x.SwitchPM = PoolBotInlineSwitchPM.Get() - - return x -} - -func (p *poolBotResults) Put(x *BotResults) { - if x == nil { - return - } - - x.Gallery = false - x.QueryID = 0 - x.NextOffset = "" - PoolBotInlineSwitchPM.Put(x.SwitchPM) - for _, z := range x.Results { - PoolBotInlineResult.Put(z) - } - x.Results = x.Results[:0] - - p.pool.Put(x) -} - -var PoolBotResults = poolBotResults{} - -func (x *BotResults) DeepCopy(z *BotResults) { - z.Gallery = x.Gallery - z.QueryID = x.QueryID - z.NextOffset = x.NextOffset - if x.SwitchPM != nil { - if z.SwitchPM == nil { - z.SwitchPM = PoolBotInlineSwitchPM.Get() - } - x.SwitchPM.DeepCopy(z.SwitchPM) - } else { - PoolBotInlineSwitchPM.Put(z.SwitchPM) - z.SwitchPM = nil - } - for idx := range x.Results { - if x.Results[idx] == nil { - continue - } - xx := PoolBotInlineResult.Get() - x.Results[idx].DeepCopy(xx) - z.Results = append(z.Results, xx) - } -} - -func (x *BotResults) Clone() *BotResults { - z := &BotResults{} - x.DeepCopy(z) - return z -} - -func (x *BotResults) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotResults) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotResults) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotResults) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotResults) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotResults, x) -} - -const C_BotInlineSwitchPM int64 = 3014743726 - -type poolBotInlineSwitchPM struct { - pool sync.Pool -} - -func (p *poolBotInlineSwitchPM) Get() *BotInlineSwitchPM { - x, ok := p.pool.Get().(*BotInlineSwitchPM) - if !ok { - x = &BotInlineSwitchPM{} - } - - return x -} - -func (p *poolBotInlineSwitchPM) Put(x *BotInlineSwitchPM) { - if x == nil { - return - } - - x.Text = "" - x.StartParam = "" - - p.pool.Put(x) -} - -var PoolBotInlineSwitchPM = poolBotInlineSwitchPM{} - -func (x *BotInlineSwitchPM) DeepCopy(z *BotInlineSwitchPM) { - z.Text = x.Text - z.StartParam = x.StartParam -} - -func (x *BotInlineSwitchPM) Clone() *BotInlineSwitchPM { - z := &BotInlineSwitchPM{} - x.DeepCopy(z) - return z -} - -func (x *BotInlineSwitchPM) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotInlineSwitchPM) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotInlineSwitchPM) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotInlineSwitchPM) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotInlineSwitchPM) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotInlineSwitchPM, x) -} - -const C_BotInlineResult int64 = 942846933 - -type poolBotInlineResult struct { - pool sync.Pool -} - -func (p *poolBotInlineResult) Get() *BotInlineResult { - x, ok := p.pool.Get().(*BotInlineResult) - if !ok { - x = &BotInlineResult{} - } - - x.Thumb = PoolMediaWebDocument.Get() - - x.Message = PoolBotInlineMessage.Get() - - return x -} - -func (p *poolBotInlineResult) Put(x *BotInlineResult) { - if x == nil { - return - } - - x.ID = "" - x.Type = 0 - x.Title = "" - x.Description = "" - x.Url = "" - PoolMediaWebDocument.Put(x.Thumb) - PoolBotInlineMessage.Put(x.Message) - - p.pool.Put(x) -} - -var PoolBotInlineResult = poolBotInlineResult{} - -func (x *BotInlineResult) DeepCopy(z *BotInlineResult) { - z.ID = x.ID - z.Type = x.Type - z.Title = x.Title - z.Description = x.Description - z.Url = x.Url - if x.Thumb != nil { - if z.Thumb == nil { - z.Thumb = PoolMediaWebDocument.Get() - } - x.Thumb.DeepCopy(z.Thumb) - } else { - PoolMediaWebDocument.Put(z.Thumb) - z.Thumb = nil - } - if x.Message != nil { - if z.Message == nil { - z.Message = PoolBotInlineMessage.Get() - } - x.Message.DeepCopy(z.Message) - } else { - PoolBotInlineMessage.Put(z.Message) - z.Message = nil - } -} - -func (x *BotInlineResult) Clone() *BotInlineResult { - z := &BotInlineResult{} - x.DeepCopy(z) - return z -} - -func (x *BotInlineResult) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotInlineResult) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotInlineResult) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotInlineResult) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotInlineResult) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotInlineResult, x) -} - -const C_InputBotInlineResult int64 = 2158273502 - -type poolInputBotInlineResult struct { - pool sync.Pool -} - -func (p *poolInputBotInlineResult) Get() *InputBotInlineResult { - x, ok := p.pool.Get().(*InputBotInlineResult) - if !ok { - x = &InputBotInlineResult{} - } - - x.Thumb = PoolInputMediaWebDocument.Get() - - x.Message = PoolInputBotInlineMessage.Get() - - return x -} - -func (p *poolInputBotInlineResult) Put(x *InputBotInlineResult) { - if x == nil { - return - } - - x.ID = "" - x.Type = 0 - x.Title = "" - x.Description = "" - x.Url = "" - PoolInputMediaWebDocument.Put(x.Thumb) - PoolInputBotInlineMessage.Put(x.Message) - - p.pool.Put(x) -} - -var PoolInputBotInlineResult = poolInputBotInlineResult{} - -func (x *InputBotInlineResult) DeepCopy(z *InputBotInlineResult) { - z.ID = x.ID - z.Type = x.Type - z.Title = x.Title - z.Description = x.Description - z.Url = x.Url - if x.Thumb != nil { - if z.Thumb == nil { - z.Thumb = PoolInputMediaWebDocument.Get() - } - x.Thumb.DeepCopy(z.Thumb) - } else { - PoolInputMediaWebDocument.Put(z.Thumb) - z.Thumb = nil - } - if x.Message != nil { - if z.Message == nil { - z.Message = PoolInputBotInlineMessage.Get() - } - x.Message.DeepCopy(z.Message) - } else { - PoolInputBotInlineMessage.Put(z.Message) - z.Message = nil - } -} - -func (x *InputBotInlineResult) Clone() *InputBotInlineResult { - z := &InputBotInlineResult{} - x.DeepCopy(z) - return z -} - -func (x *InputBotInlineResult) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputBotInlineResult) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputBotInlineResult) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputBotInlineResult) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputBotInlineResult) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputBotInlineResult, x) -} - -const C_BotInlineMessage int64 = 3297841032 - -type poolBotInlineMessage struct { - pool sync.Pool -} - -func (p *poolBotInlineMessage) Get() *BotInlineMessage { - x, ok := p.pool.Get().(*BotInlineMessage) - if !ok { - x = &BotInlineMessage{} - } - - return x -} - -func (p *poolBotInlineMessage) Put(x *BotInlineMessage) { - if x == nil { - return - } - - x.MediaData = x.MediaData[:0] - x.Body = "" - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.ReplyTo = 0 - x.ReplyMarkup = 0 - x.ReplyMarkupData = x.ReplyMarkupData[:0] - - p.pool.Put(x) -} - -var PoolBotInlineMessage = poolBotInlineMessage{} - -func (x *BotInlineMessage) DeepCopy(z *BotInlineMessage) { - z.MediaData = append(z.MediaData[:0], x.MediaData...) - z.Body = x.Body - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.ReplyTo = x.ReplyTo - z.ReplyMarkup = x.ReplyMarkup - z.ReplyMarkupData = append(z.ReplyMarkupData[:0], x.ReplyMarkupData...) -} - -func (x *BotInlineMessage) Clone() *BotInlineMessage { - z := &BotInlineMessage{} - x.DeepCopy(z) - return z -} - -func (x *BotInlineMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotInlineMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotInlineMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotInlineMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotInlineMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotInlineMessage, x) -} - -const C_InputBotInlineMessage int64 = 1408974864 - -type poolInputBotInlineMessage struct { - pool sync.Pool -} - -func (p *poolInputBotInlineMessage) Get() *InputBotInlineMessage { - x, ok := p.pool.Get().(*InputBotInlineMessage) - if !ok { - x = &InputBotInlineMessage{} - } - - return x -} - -func (p *poolInputBotInlineMessage) Put(x *InputBotInlineMessage) { - if x == nil { - return - } - - x.InputMediaData = x.InputMediaData[:0] - x.NoWebPage = false - x.Body = "" - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.ReplyTo = 0 - x.ReplyMarkup = 0 - x.ReplyMarkupData = x.ReplyMarkupData[:0] - - p.pool.Put(x) -} - -var PoolInputBotInlineMessage = poolInputBotInlineMessage{} - -func (x *InputBotInlineMessage) DeepCopy(z *InputBotInlineMessage) { - z.InputMediaData = append(z.InputMediaData[:0], x.InputMediaData...) - z.NoWebPage = x.NoWebPage - z.Body = x.Body - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.ReplyTo = x.ReplyTo - z.ReplyMarkup = x.ReplyMarkup - z.ReplyMarkupData = append(z.ReplyMarkupData[:0], x.ReplyMarkupData...) -} - -func (x *InputBotInlineMessage) Clone() *InputBotInlineMessage { - z := &InputBotInlineMessage{} - x.DeepCopy(z) - return z -} - -func (x *InputBotInlineMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputBotInlineMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputBotInlineMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputBotInlineMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputBotInlineMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputBotInlineMessage, x) -} - -const C_BotToken int64 = 3137540096 - -type poolBotToken struct { - pool sync.Pool -} - -func (p *poolBotToken) Get() *BotToken { - x, ok := p.pool.Get().(*BotToken) - if !ok { - x = &BotToken{} - } - - return x -} - -func (p *poolBotToken) Put(x *BotToken) { - if x == nil { - return - } - - x.Token = x.Token[:0] - - p.pool.Put(x) -} - -var PoolBotToken = poolBotToken{} - -func (x *BotToken) DeepCopy(z *BotToken) { - z.Token = append(z.Token[:0], x.Token...) -} - -func (x *BotToken) Clone() *BotToken { - z := &BotToken{} - x.DeepCopy(z) - return z -} - -func (x *BotToken) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotToken) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotToken) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotToken) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotToken) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotToken, x) -} - -const C_BotRecalled int64 = 4007077962 - -type poolBotRecalled struct { - pool sync.Pool -} - -func (p *poolBotRecalled) Get() *BotRecalled { - x, ok := p.pool.Get().(*BotRecalled) - if !ok { - x = &BotRecalled{} - } - - return x -} - -func (p *poolBotRecalled) Put(x *BotRecalled) { - if x == nil { - return - } - - x.ID = 0 - x.Username = "" - - p.pool.Put(x) -} - -var PoolBotRecalled = poolBotRecalled{} - -func (x *BotRecalled) DeepCopy(z *BotRecalled) { - z.ID = x.ID - z.Username = x.Username -} - -func (x *BotRecalled) Clone() *BotRecalled { - z := &BotRecalled{} - x.DeepCopy(z) - return z -} - -func (x *BotRecalled) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotRecalled) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotRecalled) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotRecalled) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotRecalled) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotRecalled, x) -} - -const C_BotCallbackAnswer int64 = 3344545062 - -type poolBotCallbackAnswer struct { - pool sync.Pool -} - -func (p *poolBotCallbackAnswer) Get() *BotCallbackAnswer { - x, ok := p.pool.Get().(*BotCallbackAnswer) - if !ok { - x = &BotCallbackAnswer{} - } - - return x -} - -func (p *poolBotCallbackAnswer) Put(x *BotCallbackAnswer) { - if x == nil { - return - } - - x.Url = "" - x.Message = "" - x.CacheTime = 0 - - p.pool.Put(x) -} - -var PoolBotCallbackAnswer = poolBotCallbackAnswer{} - -func (x *BotCallbackAnswer) DeepCopy(z *BotCallbackAnswer) { - z.Url = x.Url - z.Message = x.Message - z.CacheTime = x.CacheTime -} - -func (x *BotCallbackAnswer) Clone() *BotCallbackAnswer { - z := &BotCallbackAnswer{} - x.DeepCopy(z) - return z -} - -func (x *BotCallbackAnswer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotCallbackAnswer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotCallbackAnswer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotCallbackAnswer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotCallbackAnswer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotCallbackAnswer, x) -} - -const C_BotsMany int64 = 2942918011 - -type poolBotsMany struct { - pool sync.Pool -} - -func (p *poolBotsMany) Get() *BotsMany { - x, ok := p.pool.Get().(*BotsMany) - if !ok { - x = &BotsMany{} - } - - return x -} - -func (p *poolBotsMany) Put(x *BotsMany) { - if x == nil { - return - } - - for _, z := range x.Bots { - PoolBotInfo.Put(z) - } - x.Bots = x.Bots[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolBotsMany = poolBotsMany{} - -func (x *BotsMany) DeepCopy(z *BotsMany) { - for idx := range x.Bots { - if x.Bots[idx] == nil { - continue - } - xx := PoolBotInfo.Get() - x.Bots[idx].DeepCopy(xx) - z.Bots = append(z.Bots, xx) - } - z.Empty = x.Empty -} - -func (x *BotsMany) Clone() *BotsMany { - z := &BotsMany{} - x.DeepCopy(z) - return z -} - -func (x *BotsMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotsMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotsMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotsMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotsMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotsMany, x) -} - -const C_BotGetCommands int64 = 473628905 - -type poolBotGetCommands struct { - pool sync.Pool -} - -func (p *poolBotGetCommands) Get() *BotGetCommands { - x, ok := p.pool.Get().(*BotGetCommands) - if !ok { - x = &BotGetCommands{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolBotGetCommands) Put(x *BotGetCommands) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolBotGetCommands = poolBotGetCommands{} - -func (x *BotGetCommands) DeepCopy(z *BotGetCommands) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *BotGetCommands) Clone() *BotGetCommands { - z := &BotGetCommands{} - x.DeepCopy(z) - return z -} - -func (x *BotGetCommands) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotGetCommands) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotGetCommands) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotGetCommands) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotGetCommands) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotGetCommands, x) -} - -const C_BotCommandsMany int64 = 6153347 - -type poolBotCommandsMany struct { - pool sync.Pool -} - -func (p *poolBotCommandsMany) Get() *BotCommandsMany { - x, ok := p.pool.Get().(*BotCommandsMany) - if !ok { - x = &BotCommandsMany{} - } - - return x -} - -func (p *poolBotCommandsMany) Put(x *BotCommandsMany) { - if x == nil { - return - } - - for _, z := range x.Commands { - PoolBotCommands.Put(z) - } - x.Commands = x.Commands[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolBotCommandsMany = poolBotCommandsMany{} - -func (x *BotCommandsMany) DeepCopy(z *BotCommandsMany) { - for idx := range x.Commands { - if x.Commands[idx] == nil { - continue - } - xx := PoolBotCommands.Get() - x.Commands[idx].DeepCopy(xx) - z.Commands = append(z.Commands, xx) - } - z.Empty = x.Empty -} - -func (x *BotCommandsMany) Clone() *BotCommandsMany { - z := &BotCommandsMany{} - x.DeepCopy(z) - return z -} - -func (x *BotCommandsMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotCommandsMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotCommandsMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotCommandsMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotCommandsMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotCommandsMany, x) -} - -func init() { - registry.RegisterConstructor(2068702388, "BotStart") - registry.RegisterConstructor(4208974051, "BotRecall") - registry.RegisterConstructor(3735815245, "BotSetInfo") - registry.RegisterConstructor(911895569, "BotGet") - registry.RegisterConstructor(2371725696, "BotSendMessage") - registry.RegisterConstructor(1007063252, "BotEditMessage") - registry.RegisterConstructor(1844738193, "BotSendMedia") - registry.RegisterConstructor(905437522, "BotSaveFilePart") - registry.RegisterConstructor(2820005221, "BotUpdateProfile") - registry.RegisterConstructor(3464973784, "BotUpdatePhoto") - registry.RegisterConstructor(1804706614, "BotRevokeToken") - registry.RegisterConstructor(3523077017, "BotDeleteMessage") - registry.RegisterConstructor(1891806754, "BotSetCallbackAnswer") - registry.RegisterConstructor(345706640, "BotGetCallbackAnswer") - registry.RegisterConstructor(4192114308, "BotGetInlineResults") - registry.RegisterConstructor(3418940573, "BotSetInlineResults") - registry.RegisterConstructor(923160988, "BotSendInlineResults") - registry.RegisterConstructor(3329295900, "BotUploadWallPaper") - registry.RegisterConstructor(3473872836, "BotUploadGif") - registry.RegisterConstructor(527920130, "BotResults") - registry.RegisterConstructor(3014743726, "BotInlineSwitchPM") - registry.RegisterConstructor(942846933, "BotInlineResult") - registry.RegisterConstructor(2158273502, "InputBotInlineResult") - registry.RegisterConstructor(3297841032, "BotInlineMessage") - registry.RegisterConstructor(1408974864, "InputBotInlineMessage") - registry.RegisterConstructor(3137540096, "BotToken") - registry.RegisterConstructor(4007077962, "BotRecalled") - registry.RegisterConstructor(3344545062, "BotCallbackAnswer") - registry.RegisterConstructor(2942918011, "BotsMany") - registry.RegisterConstructor(473628905, "BotGetCommands") - registry.RegisterConstructor(6153347, "BotCommandsMany") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.community.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.community.pb.go deleted file mode 100644 index f646ef9c..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.community.pb.go +++ /dev/null @@ -1,1059 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.community.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// CommunitySendMedia -// @Function -// @Return: CommunityMessage -type CommunitySendMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Body string `protobuf:"bytes,3,opt,name=Body,proto3" json:"Body,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,5,rep,name=Entities,proto3" json:"Entities,omitempty"` - ReplyMarkup int64 `protobuf:"varint,6,opt,name=ReplyMarkup,proto3" json:"ReplyMarkup,omitempty"` - ReplyMarkupData []byte `protobuf:"bytes,7,opt,name=ReplyMarkupData,proto3" json:"ReplyMarkupData,omitempty"` - SenderID int64 `protobuf:"varint,8,opt,name=SenderID,proto3" json:"SenderID,omitempty"` - SenderMsgID int64 `protobuf:"varint,9,opt,name=SenderMsgID,proto3" json:"SenderMsgID,omitempty"` -} - -func (x *CommunitySendMessage) Reset() { - *x = CommunitySendMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunitySendMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunitySendMessage) ProtoMessage() {} - -func (x *CommunitySendMessage) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunitySendMessage.ProtoReflect.Descriptor instead. -func (*CommunitySendMessage) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{0} -} - -func (x *CommunitySendMessage) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *CommunitySendMessage) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *CommunitySendMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *CommunitySendMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *CommunitySendMessage) GetReplyMarkup() int64 { - if x != nil { - return x.ReplyMarkup - } - return 0 -} - -func (x *CommunitySendMessage) GetReplyMarkupData() []byte { - if x != nil { - return x.ReplyMarkupData - } - return nil -} - -func (x *CommunitySendMessage) GetSenderID() int64 { - if x != nil { - return x.SenderID - } - return 0 -} - -func (x *CommunitySendMessage) GetSenderMsgID() int64 { - if x != nil { - return x.SenderMsgID - } - return 0 -} - -// CommunitySendMedia -// @Function -// @Return: CommunityMessage -type CommunitySendMedia struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - MediaType InputMediaType `protobuf:"varint,3,opt,name=MediaType,proto3,enum=msg.InputMediaType" json:"MediaType,omitempty"` - MediaData []byte `protobuf:"bytes,4,opt,name=MediaData,proto3" json:"MediaData,omitempty"` - ReplyTo int64 `protobuf:"varint,5,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - ClearDraft bool `protobuf:"varint,6,opt,name=ClearDraft,proto3" json:"ClearDraft,omitempty"` - SenderID int64 `protobuf:"varint,9,opt,name=SenderID,proto3" json:"SenderID,omitempty"` - SenderMsgID int64 `protobuf:"varint,10,opt,name=SenderMsgID,proto3" json:"SenderMsgID,omitempty"` -} - -func (x *CommunitySendMedia) Reset() { - *x = CommunitySendMedia{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunitySendMedia) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunitySendMedia) ProtoMessage() {} - -func (x *CommunitySendMedia) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunitySendMedia.ProtoReflect.Descriptor instead. -func (*CommunitySendMedia) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{1} -} - -func (x *CommunitySendMedia) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *CommunitySendMedia) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *CommunitySendMedia) GetMediaType() InputMediaType { - if x != nil { - return x.MediaType - } - return InputMediaType_InputMediaTypeEmpty -} - -func (x *CommunitySendMedia) GetMediaData() []byte { - if x != nil { - return x.MediaData - } - return nil -} - -func (x *CommunitySendMedia) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *CommunitySendMedia) GetClearDraft() bool { - if x != nil { - return x.ClearDraft - } - return false -} - -func (x *CommunitySendMedia) GetSenderID() int64 { - if x != nil { - return x.SenderID - } - return 0 -} - -func (x *CommunitySendMedia) GetSenderMsgID() int64 { - if x != nil { - return x.SenderMsgID - } - return 0 -} - -// CommunitySetTyping -// @Function -// @Return: Bool -type CommunitySetTyping struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - Action TypingAction `protobuf:"varint,2,opt,name=Action,proto3,enum=msg.TypingAction" json:"Action,omitempty"` - SenderID int64 `protobuf:"varint,3,opt,name=SenderID,proto3" json:"SenderID,omitempty"` -} - -func (x *CommunitySetTyping) Reset() { - *x = CommunitySetTyping{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunitySetTyping) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunitySetTyping) ProtoMessage() {} - -func (x *CommunitySetTyping) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunitySetTyping.ProtoReflect.Descriptor instead. -func (*CommunitySetTyping) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{2} -} - -func (x *CommunitySetTyping) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *CommunitySetTyping) GetAction() TypingAction { - if x != nil { - return x.Action - } - return TypingAction_TypingActionTyping -} - -func (x *CommunitySetTyping) GetSenderID() int64 { - if x != nil { - return x.SenderID - } - return 0 -} - -// CommunityGetUpdates -// @Function -// @Return: CommunityUpdateContainer -type CommunityGetUpdates struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WaitAfterInMS int32 `protobuf:"varint,1,opt,name=WaitAfterInMS,proto3" json:"WaitAfterInMS,omitempty"` - WaitMaxInMS int32 `protobuf:"varint,2,opt,name=WaitMaxInMS,proto3" json:"WaitMaxInMS,omitempty"` - SizeLimit int32 `protobuf:"varint,3,opt,name=SizeLimit,proto3" json:"SizeLimit,omitempty"` - OffsetID int64 `protobuf:"varint,4,opt,name=OffsetID,proto3" json:"OffsetID,omitempty"` -} - -func (x *CommunityGetUpdates) Reset() { - *x = CommunityGetUpdates{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunityGetUpdates) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunityGetUpdates) ProtoMessage() {} - -func (x *CommunityGetUpdates) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunityGetUpdates.ProtoReflect.Descriptor instead. -func (*CommunityGetUpdates) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{3} -} - -func (x *CommunityGetUpdates) GetWaitAfterInMS() int32 { - if x != nil { - return x.WaitAfterInMS - } - return 0 -} - -func (x *CommunityGetUpdates) GetWaitMaxInMS() int32 { - if x != nil { - return x.WaitMaxInMS - } - return 0 -} - -func (x *CommunityGetUpdates) GetSizeLimit() int32 { - if x != nil { - return x.SizeLimit - } - return 0 -} - -func (x *CommunityGetUpdates) GetOffsetID() int64 { - if x != nil { - return x.OffsetID - } - return 0 -} - -// CommunityGetMembers -// @Function -// @Return: TeamMembers -type CommunityGetMembers struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Offset int32 `protobuf:"varint,1,opt,name=Offset,proto3" json:"Offset,omitempty"` - Limit int32 `protobuf:"varint,2,opt,name=Limit,proto3" json:"Limit,omitempty"` -} - -func (x *CommunityGetMembers) Reset() { - *x = CommunityGetMembers{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunityGetMembers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunityGetMembers) ProtoMessage() {} - -func (x *CommunityGetMembers) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunityGetMembers.ProtoReflect.Descriptor instead. -func (*CommunityGetMembers) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{4} -} - -func (x *CommunityGetMembers) GetOffset() int32 { - if x != nil { - return x.Offset - } - return 0 -} - -func (x *CommunityGetMembers) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -// CommunityRecall -// @Function -// @Return: Bool -type CommunityRecall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - AccessKey []byte `protobuf:"bytes,2,opt,name=AccessKey,proto3" json:"AccessKey,omitempty"` -} - -func (x *CommunityRecall) Reset() { - *x = CommunityRecall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunityRecall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunityRecall) ProtoMessage() {} - -func (x *CommunityRecall) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunityRecall.ProtoReflect.Descriptor instead. -func (*CommunityRecall) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{5} -} - -func (x *CommunityRecall) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *CommunityRecall) GetAccessKey() []byte { - if x != nil { - return x.AccessKey - } - return nil -} - -// CommunityAuthorizeUser -// @Function -// @Return: CommunityUser -type CommunityAuthorizeUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - Provider string `protobuf:"bytes,4,opt,name=Provider,proto3" json:"Provider,omitempty"` -} - -func (x *CommunityAuthorizeUser) Reset() { - *x = CommunityAuthorizeUser{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunityAuthorizeUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunityAuthorizeUser) ProtoMessage() {} - -func (x *CommunityAuthorizeUser) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunityAuthorizeUser.ProtoReflect.Descriptor instead. -func (*CommunityAuthorizeUser) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{6} -} - -func (x *CommunityAuthorizeUser) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *CommunityAuthorizeUser) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *CommunityAuthorizeUser) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *CommunityAuthorizeUser) GetProvider() string { - if x != nil { - return x.Provider - } - return "" -} - -// CommunityUser -type CommunityUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - Phone string `protobuf:"bytes,4,opt,name=Phone,proto3" json:"Phone,omitempty"` -} - -func (x *CommunityUser) Reset() { - *x = CommunityUser{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunityUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunityUser) ProtoMessage() {} - -func (x *CommunityUser) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunityUser.ProtoReflect.Descriptor instead. -func (*CommunityUser) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{7} -} - -func (x *CommunityUser) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *CommunityUser) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *CommunityUser) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *CommunityUser) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -// CommunityUpdateEnvelope -type CommunityUpdateEnvelope struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - OffsetID int64 `protobuf:"varint,1,opt,name=OffsetID,proto3" json:"OffsetID,omitempty"` - PartitionID int32 `protobuf:"varint,2,opt,name=PartitionID,proto3" json:"PartitionID,omitempty"` - Constructor int64 `protobuf:"varint,3,opt,name=Constructor,proto3" json:"Constructor,omitempty"` - Update []byte `protobuf:"bytes,4,opt,name=Update,proto3" json:"Update,omitempty"` -} - -func (x *CommunityUpdateEnvelope) Reset() { - *x = CommunityUpdateEnvelope{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunityUpdateEnvelope) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunityUpdateEnvelope) ProtoMessage() {} - -func (x *CommunityUpdateEnvelope) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunityUpdateEnvelope.ProtoReflect.Descriptor instead. -func (*CommunityUpdateEnvelope) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{8} -} - -func (x *CommunityUpdateEnvelope) GetOffsetID() int64 { - if x != nil { - return x.OffsetID - } - return 0 -} - -func (x *CommunityUpdateEnvelope) GetPartitionID() int32 { - if x != nil { - return x.PartitionID - } - return 0 -} - -func (x *CommunityUpdateEnvelope) GetConstructor() int64 { - if x != nil { - return x.Constructor - } - return 0 -} - -func (x *CommunityUpdateEnvelope) GetUpdate() []byte { - if x != nil { - return x.Update - } - return nil -} - -// CommunityUpdateContainer -type CommunityUpdateContainer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Updates []*CommunityUpdateEnvelope `protobuf:"bytes,1,rep,name=Updates,proto3" json:"Updates,omitempty"` - Empty bool `protobuf:"varint,2,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *CommunityUpdateContainer) Reset() { - *x = CommunityUpdateContainer{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_community_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CommunityUpdateContainer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CommunityUpdateContainer) ProtoMessage() {} - -func (x *CommunityUpdateContainer) ProtoReflect() protoreflect.Message { - mi := &file_chat_community_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CommunityUpdateContainer.ProtoReflect.Descriptor instead. -func (*CommunityUpdateContainer) Descriptor() ([]byte, []int) { - return file_chat_community_proto_rawDescGZIP(), []int{9} -} - -func (x *CommunityUpdateContainer) GetUpdates() []*CommunityUpdateEnvelope { - if x != nil { - return x.Updates - } - return nil -} - -func (x *CommunityUpdateContainer) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -var File_chat_community_proto protoreflect.FileDescriptor - -var file_chat_community_proto_rawDesc = []byte{ - 0x0a, 0x14, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa4, 0x02, - 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x53, 0x65, 0x6e, 0x64, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, - 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, - 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x12, 0x28, 0x0a, 0x0f, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, - 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x49, 0x44, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x49, - 0x44, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, - 0x73, 0x67, 0x49, 0x44, 0x22, 0x9d, 0x02, 0x0a, 0x12, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, - 0x74, 0x79, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x52, - 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, - 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x09, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, - 0x72, 0x61, 0x66, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x43, 0x6c, 0x65, 0x61, - 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x49, 0x44, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x49, - 0x44, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, - 0x73, 0x67, 0x49, 0x44, 0x22, 0x7f, 0x0a, 0x12, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, - 0x79, 0x53, 0x65, 0x74, 0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x29, - 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x49, 0x44, 0x22, 0x97, 0x01, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, - 0x69, 0x74, 0x79, 0x47, 0x65, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x24, 0x0a, - 0x0d, 0x57, 0x61, 0x69, 0x74, 0x41, 0x66, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x4d, 0x53, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x57, 0x61, 0x69, 0x74, 0x41, 0x66, 0x74, 0x65, 0x72, 0x49, - 0x6e, 0x4d, 0x53, 0x12, 0x20, 0x0a, 0x0b, 0x57, 0x61, 0x69, 0x74, 0x4d, 0x61, 0x78, 0x49, 0x6e, - 0x4d, 0x53, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x57, 0x61, 0x69, 0x74, 0x4d, 0x61, - 0x78, 0x49, 0x6e, 0x4d, 0x53, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x69, 0x7a, 0x65, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x53, 0x69, 0x7a, 0x65, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x44, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x49, 0x44, 0x22, - 0x43, 0x0a, 0x13, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x47, 0x65, 0x74, 0x4d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x22, 0x47, 0x0a, 0x0f, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, - 0x79, 0x52, 0x65, 0x63, 0x61, 0x6c, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, - 0x1c, 0x0a, 0x09, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x09, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x22, 0x84, 0x01, - 0x0a, 0x16, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x41, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x7a, 0x65, 0x55, 0x73, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x22, 0x77, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, - 0x79, 0x55, 0x73, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1c, 0x0a, - 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, - 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, - 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0x91, 0x01, - 0x0a, 0x17, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x4f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x50, 0x61, 0x72, 0x74, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x73, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x43, 0x6f, - 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x22, 0x68, 0x0a, 0x18, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x36, 0x0a, - 0x07, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x07, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x08, 0x5a, 0x06, 0x2e, - 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_chat_community_proto_rawDescOnce sync.Once - file_chat_community_proto_rawDescData = file_chat_community_proto_rawDesc -) - -func file_chat_community_proto_rawDescGZIP() []byte { - file_chat_community_proto_rawDescOnce.Do(func() { - file_chat_community_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_community_proto_rawDescData) - }) - return file_chat_community_proto_rawDescData -} - -var file_chat_community_proto_msgTypes = make([]protoimpl.MessageInfo, 10) -var file_chat_community_proto_goTypes = []interface{}{ - (*CommunitySendMessage)(nil), // 0: msg.CommunitySendMessage - (*CommunitySendMedia)(nil), // 1: msg.CommunitySendMedia - (*CommunitySetTyping)(nil), // 2: msg.CommunitySetTyping - (*CommunityGetUpdates)(nil), // 3: msg.CommunityGetUpdates - (*CommunityGetMembers)(nil), // 4: msg.CommunityGetMembers - (*CommunityRecall)(nil), // 5: msg.CommunityRecall - (*CommunityAuthorizeUser)(nil), // 6: msg.CommunityAuthorizeUser - (*CommunityUser)(nil), // 7: msg.CommunityUser - (*CommunityUpdateEnvelope)(nil), // 8: msg.CommunityUpdateEnvelope - (*CommunityUpdateContainer)(nil), // 9: msg.CommunityUpdateContainer - (*InputPeer)(nil), // 10: msg.InputPeer - (*MessageEntity)(nil), // 11: msg.MessageEntity - (InputMediaType)(0), // 12: msg.InputMediaType - (TypingAction)(0), // 13: msg.TypingAction -} -var file_chat_community_proto_depIdxs = []int32{ - 10, // 0: msg.CommunitySendMessage.Peer:type_name -> msg.InputPeer - 11, // 1: msg.CommunitySendMessage.Entities:type_name -> msg.MessageEntity - 10, // 2: msg.CommunitySendMedia.Peer:type_name -> msg.InputPeer - 12, // 3: msg.CommunitySendMedia.MediaType:type_name -> msg.InputMediaType - 10, // 4: msg.CommunitySetTyping.Peer:type_name -> msg.InputPeer - 13, // 5: msg.CommunitySetTyping.Action:type_name -> msg.TypingAction - 8, // 6: msg.CommunityUpdateContainer.Updates:type_name -> msg.CommunityUpdateEnvelope - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_chat_community_proto_init() } -func file_chat_community_proto_init() { - if File_chat_community_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_chat_community_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunitySendMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_community_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunitySendMedia); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_community_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunitySetTyping); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_community_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunityGetUpdates); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_community_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunityGetMembers); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_community_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunityRecall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_community_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunityAuthorizeUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_community_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunityUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_community_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunityUpdateEnvelope); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_community_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CommunityUpdateContainer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_community_proto_rawDesc, - NumEnums: 0, - NumMessages: 10, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_community_proto_goTypes, - DependencyIndexes: file_chat_community_proto_depIdxs, - MessageInfos: file_chat_community_proto_msgTypes, - }.Build() - File_chat_community_proto = out.File - file_chat_community_proto_rawDesc = nil - file_chat_community_proto_goTypes = nil - file_chat_community_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.community.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.community.rony.go deleted file mode 100644 index 8284f974..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.community.rony.go +++ /dev/null @@ -1,715 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.community.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_CommunitySendMessage int64 = 3506778488 - -type poolCommunitySendMessage struct { - pool sync.Pool -} - -func (p *poolCommunitySendMessage) Get() *CommunitySendMessage { - x, ok := p.pool.Get().(*CommunitySendMessage) - if !ok { - x = &CommunitySendMessage{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolCommunitySendMessage) Put(x *CommunitySendMessage) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.Body = "" - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.ReplyMarkup = 0 - x.ReplyMarkupData = x.ReplyMarkupData[:0] - x.SenderID = 0 - x.SenderMsgID = 0 - - p.pool.Put(x) -} - -var PoolCommunitySendMessage = poolCommunitySendMessage{} - -func (x *CommunitySendMessage) DeepCopy(z *CommunitySendMessage) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Body = x.Body - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.ReplyMarkup = x.ReplyMarkup - z.ReplyMarkupData = append(z.ReplyMarkupData[:0], x.ReplyMarkupData...) - z.SenderID = x.SenderID - z.SenderMsgID = x.SenderMsgID -} - -func (x *CommunitySendMessage) Clone() *CommunitySendMessage { - z := &CommunitySendMessage{} - x.DeepCopy(z) - return z -} - -func (x *CommunitySendMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunitySendMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunitySendMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunitySendMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunitySendMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunitySendMessage, x) -} - -const C_CommunitySendMedia int64 = 2436824148 - -type poolCommunitySendMedia struct { - pool sync.Pool -} - -func (p *poolCommunitySendMedia) Get() *CommunitySendMedia { - x, ok := p.pool.Get().(*CommunitySendMedia) - if !ok { - x = &CommunitySendMedia{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolCommunitySendMedia) Put(x *CommunitySendMedia) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.MediaType = 0 - x.MediaData = x.MediaData[:0] - x.ReplyTo = 0 - x.ClearDraft = false - x.SenderID = 0 - x.SenderMsgID = 0 - - p.pool.Put(x) -} - -var PoolCommunitySendMedia = poolCommunitySendMedia{} - -func (x *CommunitySendMedia) DeepCopy(z *CommunitySendMedia) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MediaType = x.MediaType - z.MediaData = append(z.MediaData[:0], x.MediaData...) - z.ReplyTo = x.ReplyTo - z.ClearDraft = x.ClearDraft - z.SenderID = x.SenderID - z.SenderMsgID = x.SenderMsgID -} - -func (x *CommunitySendMedia) Clone() *CommunitySendMedia { - z := &CommunitySendMedia{} - x.DeepCopy(z) - return z -} - -func (x *CommunitySendMedia) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunitySendMedia) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunitySendMedia) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunitySendMedia) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunitySendMedia) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunitySendMedia, x) -} - -const C_CommunitySetTyping int64 = 3413516595 - -type poolCommunitySetTyping struct { - pool sync.Pool -} - -func (p *poolCommunitySetTyping) Get() *CommunitySetTyping { - x, ok := p.pool.Get().(*CommunitySetTyping) - if !ok { - x = &CommunitySetTyping{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolCommunitySetTyping) Put(x *CommunitySetTyping) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.Action = 0 - x.SenderID = 0 - - p.pool.Put(x) -} - -var PoolCommunitySetTyping = poolCommunitySetTyping{} - -func (x *CommunitySetTyping) DeepCopy(z *CommunitySetTyping) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Action = x.Action - z.SenderID = x.SenderID -} - -func (x *CommunitySetTyping) Clone() *CommunitySetTyping { - z := &CommunitySetTyping{} - x.DeepCopy(z) - return z -} - -func (x *CommunitySetTyping) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunitySetTyping) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunitySetTyping) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunitySetTyping) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunitySetTyping) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunitySetTyping, x) -} - -const C_CommunityGetUpdates int64 = 2021391963 - -type poolCommunityGetUpdates struct { - pool sync.Pool -} - -func (p *poolCommunityGetUpdates) Get() *CommunityGetUpdates { - x, ok := p.pool.Get().(*CommunityGetUpdates) - if !ok { - x = &CommunityGetUpdates{} - } - - return x -} - -func (p *poolCommunityGetUpdates) Put(x *CommunityGetUpdates) { - if x == nil { - return - } - - x.WaitAfterInMS = 0 - x.WaitMaxInMS = 0 - x.SizeLimit = 0 - x.OffsetID = 0 - - p.pool.Put(x) -} - -var PoolCommunityGetUpdates = poolCommunityGetUpdates{} - -func (x *CommunityGetUpdates) DeepCopy(z *CommunityGetUpdates) { - z.WaitAfterInMS = x.WaitAfterInMS - z.WaitMaxInMS = x.WaitMaxInMS - z.SizeLimit = x.SizeLimit - z.OffsetID = x.OffsetID -} - -func (x *CommunityGetUpdates) Clone() *CommunityGetUpdates { - z := &CommunityGetUpdates{} - x.DeepCopy(z) - return z -} - -func (x *CommunityGetUpdates) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunityGetUpdates) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunityGetUpdates) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunityGetUpdates) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunityGetUpdates) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunityGetUpdates, x) -} - -const C_CommunityGetMembers int64 = 2022915988 - -type poolCommunityGetMembers struct { - pool sync.Pool -} - -func (p *poolCommunityGetMembers) Get() *CommunityGetMembers { - x, ok := p.pool.Get().(*CommunityGetMembers) - if !ok { - x = &CommunityGetMembers{} - } - - return x -} - -func (p *poolCommunityGetMembers) Put(x *CommunityGetMembers) { - if x == nil { - return - } - - x.Offset = 0 - x.Limit = 0 - - p.pool.Put(x) -} - -var PoolCommunityGetMembers = poolCommunityGetMembers{} - -func (x *CommunityGetMembers) DeepCopy(z *CommunityGetMembers) { - z.Offset = x.Offset - z.Limit = x.Limit -} - -func (x *CommunityGetMembers) Clone() *CommunityGetMembers { - z := &CommunityGetMembers{} - x.DeepCopy(z) - return z -} - -func (x *CommunityGetMembers) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunityGetMembers) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunityGetMembers) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunityGetMembers) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunityGetMembers) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunityGetMembers, x) -} - -const C_CommunityRecall int64 = 890349574 - -type poolCommunityRecall struct { - pool sync.Pool -} - -func (p *poolCommunityRecall) Get() *CommunityRecall { - x, ok := p.pool.Get().(*CommunityRecall) - if !ok { - x = &CommunityRecall{} - } - - return x -} - -func (p *poolCommunityRecall) Put(x *CommunityRecall) { - if x == nil { - return - } - - x.TeamID = 0 - x.AccessKey = x.AccessKey[:0] - - p.pool.Put(x) -} - -var PoolCommunityRecall = poolCommunityRecall{} - -func (x *CommunityRecall) DeepCopy(z *CommunityRecall) { - z.TeamID = x.TeamID - z.AccessKey = append(z.AccessKey[:0], x.AccessKey...) -} - -func (x *CommunityRecall) Clone() *CommunityRecall { - z := &CommunityRecall{} - x.DeepCopy(z) - return z -} - -func (x *CommunityRecall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunityRecall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunityRecall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunityRecall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunityRecall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunityRecall, x) -} - -const C_CommunityAuthorizeUser int64 = 1452766231 - -type poolCommunityAuthorizeUser struct { - pool sync.Pool -} - -func (p *poolCommunityAuthorizeUser) Get() *CommunityAuthorizeUser { - x, ok := p.pool.Get().(*CommunityAuthorizeUser) - if !ok { - x = &CommunityAuthorizeUser{} - } - - return x -} - -func (p *poolCommunityAuthorizeUser) Put(x *CommunityAuthorizeUser) { - if x == nil { - return - } - - x.Phone = "" - x.FirstName = "" - x.LastName = "" - x.Provider = "" - - p.pool.Put(x) -} - -var PoolCommunityAuthorizeUser = poolCommunityAuthorizeUser{} - -func (x *CommunityAuthorizeUser) DeepCopy(z *CommunityAuthorizeUser) { - z.Phone = x.Phone - z.FirstName = x.FirstName - z.LastName = x.LastName - z.Provider = x.Provider -} - -func (x *CommunityAuthorizeUser) Clone() *CommunityAuthorizeUser { - z := &CommunityAuthorizeUser{} - x.DeepCopy(z) - return z -} - -func (x *CommunityAuthorizeUser) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunityAuthorizeUser) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunityAuthorizeUser) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunityAuthorizeUser) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunityAuthorizeUser) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunityAuthorizeUser, x) -} - -const C_CommunityUser int64 = 3812837958 - -type poolCommunityUser struct { - pool sync.Pool -} - -func (p *poolCommunityUser) Get() *CommunityUser { - x, ok := p.pool.Get().(*CommunityUser) - if !ok { - x = &CommunityUser{} - } - - return x -} - -func (p *poolCommunityUser) Put(x *CommunityUser) { - if x == nil { - return - } - - x.UserID = 0 - x.FirstName = "" - x.LastName = "" - x.Phone = "" - - p.pool.Put(x) -} - -var PoolCommunityUser = poolCommunityUser{} - -func (x *CommunityUser) DeepCopy(z *CommunityUser) { - z.UserID = x.UserID - z.FirstName = x.FirstName - z.LastName = x.LastName - z.Phone = x.Phone -} - -func (x *CommunityUser) Clone() *CommunityUser { - z := &CommunityUser{} - x.DeepCopy(z) - return z -} - -func (x *CommunityUser) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunityUser) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunityUser) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunityUser) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunityUser) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunityUser, x) -} - -const C_CommunityUpdateEnvelope int64 = 1076119993 - -type poolCommunityUpdateEnvelope struct { - pool sync.Pool -} - -func (p *poolCommunityUpdateEnvelope) Get() *CommunityUpdateEnvelope { - x, ok := p.pool.Get().(*CommunityUpdateEnvelope) - if !ok { - x = &CommunityUpdateEnvelope{} - } - - return x -} - -func (p *poolCommunityUpdateEnvelope) Put(x *CommunityUpdateEnvelope) { - if x == nil { - return - } - - x.OffsetID = 0 - x.PartitionID = 0 - x.Constructor = 0 - x.Update = x.Update[:0] - - p.pool.Put(x) -} - -var PoolCommunityUpdateEnvelope = poolCommunityUpdateEnvelope{} - -func (x *CommunityUpdateEnvelope) DeepCopy(z *CommunityUpdateEnvelope) { - z.OffsetID = x.OffsetID - z.PartitionID = x.PartitionID - z.Constructor = x.Constructor - z.Update = append(z.Update[:0], x.Update...) -} - -func (x *CommunityUpdateEnvelope) Clone() *CommunityUpdateEnvelope { - z := &CommunityUpdateEnvelope{} - x.DeepCopy(z) - return z -} - -func (x *CommunityUpdateEnvelope) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunityUpdateEnvelope) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunityUpdateEnvelope) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunityUpdateEnvelope) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunityUpdateEnvelope) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunityUpdateEnvelope, x) -} - -const C_CommunityUpdateContainer int64 = 918339432 - -type poolCommunityUpdateContainer struct { - pool sync.Pool -} - -func (p *poolCommunityUpdateContainer) Get() *CommunityUpdateContainer { - x, ok := p.pool.Get().(*CommunityUpdateContainer) - if !ok { - x = &CommunityUpdateContainer{} - } - - return x -} - -func (p *poolCommunityUpdateContainer) Put(x *CommunityUpdateContainer) { - if x == nil { - return - } - - for _, z := range x.Updates { - PoolCommunityUpdateEnvelope.Put(z) - } - x.Updates = x.Updates[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolCommunityUpdateContainer = poolCommunityUpdateContainer{} - -func (x *CommunityUpdateContainer) DeepCopy(z *CommunityUpdateContainer) { - for idx := range x.Updates { - if x.Updates[idx] == nil { - continue - } - xx := PoolCommunityUpdateEnvelope.Get() - x.Updates[idx].DeepCopy(xx) - z.Updates = append(z.Updates, xx) - } - z.Empty = x.Empty -} - -func (x *CommunityUpdateContainer) Clone() *CommunityUpdateContainer { - z := &CommunityUpdateContainer{} - x.DeepCopy(z) - return z -} - -func (x *CommunityUpdateContainer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CommunityUpdateContainer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CommunityUpdateContainer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CommunityUpdateContainer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CommunityUpdateContainer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CommunityUpdateContainer, x) -} - -func init() { - registry.RegisterConstructor(3506778488, "CommunitySendMessage") - registry.RegisterConstructor(2436824148, "CommunitySendMedia") - registry.RegisterConstructor(3413516595, "CommunitySetTyping") - registry.RegisterConstructor(2021391963, "CommunityGetUpdates") - registry.RegisterConstructor(2022915988, "CommunityGetMembers") - registry.RegisterConstructor(890349574, "CommunityRecall") - registry.RegisterConstructor(1452766231, "CommunityAuthorizeUser") - registry.RegisterConstructor(3812837958, "CommunityUser") - registry.RegisterConstructor(1076119993, "CommunityUpdateEnvelope") - registry.RegisterConstructor(918339432, "CommunityUpdateContainer") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.groups.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.groups.pb.go deleted file mode 100644 index d9af7389..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.groups.pb.go +++ /dev/null @@ -1,1183 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.groups.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// GroupsCreate -// @Function -// @Return: Bool -type GroupsCreate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Users []*InputUser `protobuf:"bytes,1,rep,name=Users,proto3" json:"Users,omitempty"` - Title string `protobuf:"bytes,2,opt,name=Title,proto3" json:"Title,omitempty"` - RandomID int64 `protobuf:"varint,3,opt,name=RandomID,proto3" json:"RandomID,omitempty"` -} - -func (x *GroupsCreate) Reset() { - *x = GroupsCreate{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsCreate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsCreate) ProtoMessage() {} - -func (x *GroupsCreate) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsCreate.ProtoReflect.Descriptor instead. -func (*GroupsCreate) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{0} -} - -func (x *GroupsCreate) GetUsers() []*InputUser { - if x != nil { - return x.Users - } - return nil -} - -func (x *GroupsCreate) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *GroupsCreate) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -// GroupsAddUser -// @Function -// @Return: Bool -type GroupsAddUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - User *InputUser `protobuf:"bytes,2,opt,name=User,proto3" json:"User,omitempty"` - ForwardLimit int32 `protobuf:"varint,3,opt,name=ForwardLimit,proto3" json:"ForwardLimit,omitempty"` -} - -func (x *GroupsAddUser) Reset() { - *x = GroupsAddUser{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsAddUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsAddUser) ProtoMessage() {} - -func (x *GroupsAddUser) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsAddUser.ProtoReflect.Descriptor instead. -func (*GroupsAddUser) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{1} -} - -func (x *GroupsAddUser) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *GroupsAddUser) GetUser() *InputUser { - if x != nil { - return x.User - } - return nil -} - -func (x *GroupsAddUser) GetForwardLimit() int32 { - if x != nil { - return x.ForwardLimit - } - return 0 -} - -// GroupsEditTitle -// @Function -// @Return: Bool -type GroupsEditTitle struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - Title string `protobuf:"bytes,2,opt,name=Title,proto3" json:"Title,omitempty"` -} - -func (x *GroupsEditTitle) Reset() { - *x = GroupsEditTitle{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsEditTitle) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsEditTitle) ProtoMessage() {} - -func (x *GroupsEditTitle) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsEditTitle.ProtoReflect.Descriptor instead. -func (*GroupsEditTitle) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{2} -} - -func (x *GroupsEditTitle) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *GroupsEditTitle) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -// GroupsDeleteUser -// @Function -// @Return: Bool -type GroupsDeleteUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - User *InputUser `protobuf:"bytes,2,opt,name=User,proto3" json:"User,omitempty"` -} - -func (x *GroupsDeleteUser) Reset() { - *x = GroupsDeleteUser{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsDeleteUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsDeleteUser) ProtoMessage() {} - -func (x *GroupsDeleteUser) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsDeleteUser.ProtoReflect.Descriptor instead. -func (*GroupsDeleteUser) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{3} -} - -func (x *GroupsDeleteUser) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *GroupsDeleteUser) GetUser() *InputUser { - if x != nil { - return x.User - } - return nil -} - -// GroupsGetFull -// @Function -// @Return: GroupFull -type GroupsGetFull struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` -} - -func (x *GroupsGetFull) Reset() { - *x = GroupsGetFull{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsGetFull) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsGetFull) ProtoMessage() {} - -func (x *GroupsGetFull) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsGetFull.ProtoReflect.Descriptor instead. -func (*GroupsGetFull) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{4} -} - -func (x *GroupsGetFull) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -// GroupsToggleAdmins -// @Function -// @Return: Bool -type GroupsToggleAdmins struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - AdminEnabled bool `protobuf:"varint,2,opt,name=AdminEnabled,proto3" json:"AdminEnabled,omitempty"` -} - -func (x *GroupsToggleAdmins) Reset() { - *x = GroupsToggleAdmins{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsToggleAdmins) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsToggleAdmins) ProtoMessage() {} - -func (x *GroupsToggleAdmins) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsToggleAdmins.ProtoReflect.Descriptor instead. -func (*GroupsToggleAdmins) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{5} -} - -func (x *GroupsToggleAdmins) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *GroupsToggleAdmins) GetAdminEnabled() bool { - if x != nil { - return x.AdminEnabled - } - return false -} - -// GroupsToggleAdminOnly -// @Function -// @Return: Bool -type GroupsToggleAdminOnly struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - AdminOnly bool `protobuf:"varint,2,opt,name=AdminOnly,proto3" json:"AdminOnly,omitempty"` -} - -func (x *GroupsToggleAdminOnly) Reset() { - *x = GroupsToggleAdminOnly{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsToggleAdminOnly) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsToggleAdminOnly) ProtoMessage() {} - -func (x *GroupsToggleAdminOnly) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsToggleAdminOnly.ProtoReflect.Descriptor instead. -func (*GroupsToggleAdminOnly) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{6} -} - -func (x *GroupsToggleAdminOnly) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *GroupsToggleAdminOnly) GetAdminOnly() bool { - if x != nil { - return x.AdminOnly - } - return false -} - -// GroupsUpdateAdmin -// @Function -// @Return: Bool -type GroupsUpdateAdmin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - User *InputUser `protobuf:"bytes,2,opt,name=User,proto3" json:"User,omitempty"` - Admin bool `protobuf:"varint,3,opt,name=Admin,proto3" json:"Admin,omitempty"` -} - -func (x *GroupsUpdateAdmin) Reset() { - *x = GroupsUpdateAdmin{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsUpdateAdmin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsUpdateAdmin) ProtoMessage() {} - -func (x *GroupsUpdateAdmin) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsUpdateAdmin.ProtoReflect.Descriptor instead. -func (*GroupsUpdateAdmin) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{7} -} - -func (x *GroupsUpdateAdmin) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *GroupsUpdateAdmin) GetUser() *InputUser { - if x != nil { - return x.User - } - return nil -} - -func (x *GroupsUpdateAdmin) GetAdmin() bool { - if x != nil { - return x.Admin - } - return false -} - -// GroupsUploadPhoto -// @Function -// @Return: Bool / GroupPhoto -type GroupsUploadPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - File *InputFile `protobuf:"bytes,2,opt,name=File,proto3" json:"File,omitempty"` - ReturnObject bool `protobuf:"varint,3,opt,name=ReturnObject,proto3" json:"ReturnObject,omitempty"` -} - -func (x *GroupsUploadPhoto) Reset() { - *x = GroupsUploadPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsUploadPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsUploadPhoto) ProtoMessage() {} - -func (x *GroupsUploadPhoto) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsUploadPhoto.ProtoReflect.Descriptor instead. -func (*GroupsUploadPhoto) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{8} -} - -func (x *GroupsUploadPhoto) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *GroupsUploadPhoto) GetFile() *InputFile { - if x != nil { - return x.File - } - return nil -} - -func (x *GroupsUploadPhoto) GetReturnObject() bool { - if x != nil { - return x.ReturnObject - } - return false -} - -// GroupsRemovePhoto -// @Function -// @Return: Bool -type GroupsRemovePhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - PhotoID int64 `protobuf:"varint,2,opt,name=PhotoID,proto3" json:"PhotoID,omitempty"` -} - -func (x *GroupsRemovePhoto) Reset() { - *x = GroupsRemovePhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsRemovePhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsRemovePhoto) ProtoMessage() {} - -func (x *GroupsRemovePhoto) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsRemovePhoto.ProtoReflect.Descriptor instead. -func (*GroupsRemovePhoto) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{9} -} - -func (x *GroupsRemovePhoto) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *GroupsRemovePhoto) GetPhotoID() int64 { - if x != nil { - return x.PhotoID - } - return 0 -} - -// GroupsUpdatePhoto -// @Function -// @Return: Bool -type GroupsUpdatePhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PhotoID int64 `protobuf:"varint,1,opt,name=PhotoID,proto3" json:"PhotoID,omitempty"` - GroupID int64 `protobuf:"varint,2,opt,name=GroupID,proto3" json:"GroupID,omitempty"` -} - -func (x *GroupsUpdatePhoto) Reset() { - *x = GroupsUpdatePhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsUpdatePhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsUpdatePhoto) ProtoMessage() {} - -func (x *GroupsUpdatePhoto) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsUpdatePhoto.ProtoReflect.Descriptor instead. -func (*GroupsUpdatePhoto) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{10} -} - -func (x *GroupsUpdatePhoto) GetPhotoID() int64 { - if x != nil { - return x.PhotoID - } - return 0 -} - -func (x *GroupsUpdatePhoto) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -// GroupsGetHistoryStats -// @Function -// @Return: GroupsHistoryStats -type GroupsGetReadHistoryStats struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` -} - -func (x *GroupsGetReadHistoryStats) Reset() { - *x = GroupsGetReadHistoryStats{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsGetReadHistoryStats) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsGetReadHistoryStats) ProtoMessage() {} - -func (x *GroupsGetReadHistoryStats) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsGetReadHistoryStats.ProtoReflect.Descriptor instead. -func (*GroupsGetReadHistoryStats) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{11} -} - -func (x *GroupsGetReadHistoryStats) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -// GroupsHistoryStats -type GroupsHistoryStats struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Stats []*ReadHistoryStat `protobuf:"bytes,1,rep,name=Stats,proto3" json:"Stats,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Empty bool `protobuf:"varint,3,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *GroupsHistoryStats) Reset() { - *x = GroupsHistoryStats{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupsHistoryStats) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupsHistoryStats) ProtoMessage() {} - -func (x *GroupsHistoryStats) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupsHistoryStats.ProtoReflect.Descriptor instead. -func (*GroupsHistoryStats) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{12} -} - -func (x *GroupsHistoryStats) GetStats() []*ReadHistoryStat { - if x != nil { - return x.Stats - } - return nil -} - -func (x *GroupsHistoryStats) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *GroupsHistoryStats) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// ReadHistoryStat -type ReadHistoryStat struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - MessageID int64 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` -} - -func (x *ReadHistoryStat) Reset() { - *x = ReadHistoryStat{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_groups_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReadHistoryStat) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReadHistoryStat) ProtoMessage() {} - -func (x *ReadHistoryStat) ProtoReflect() protoreflect.Message { - mi := &file_chat_groups_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReadHistoryStat.ProtoReflect.Descriptor instead. -func (*ReadHistoryStat) Descriptor() ([]byte, []int) { - return file_chat_groups_proto_rawDescGZIP(), []int{13} -} - -func (x *ReadHistoryStat) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *ReadHistoryStat) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -var File_chat_groups_proto protoreflect.FileDescriptor - -var file_chat_groups_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x66, 0x0a, 0x0c, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x05, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, - 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, - 0x49, 0x44, 0x22, 0x75, 0x0a, 0x0d, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x41, 0x64, 0x64, 0x55, - 0x73, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, - 0x44, 0x12, 0x22, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, - 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x46, 0x6f, 0x72, - 0x77, 0x61, 0x72, 0x64, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x45, 0x0a, 0x0f, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x73, 0x45, 0x64, 0x69, 0x74, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x07, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, - 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, - 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, - 0x22, 0x54, 0x0a, 0x10, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x55, 0x73, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x52, 0x04, 0x55, 0x73, 0x65, 0x72, 0x22, 0x2d, 0x0a, 0x0d, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, - 0x47, 0x65, 0x74, 0x46, 0x75, 0x6c, 0x6c, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x49, 0x44, 0x22, 0x56, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x54, - 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x73, 0x12, 0x1c, 0x0a, 0x07, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0c, 0x41, 0x64, 0x6d, - 0x69, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x53, 0x0a, - 0x15, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x41, 0x64, 0x6d, - 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4f, 0x6e, - 0x6c, 0x79, 0x22, 0x6b, 0x0a, 0x11, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x64, 0x6d, - 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, - 0x79, 0x0a, 0x11, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, - 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, - 0x52, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x52, 0x65, - 0x74, 0x75, 0x72, 0x6e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x4f, 0x0a, 0x11, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, - 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x1c, 0x0a, - 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, - 0x30, 0x01, 0x52, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x22, 0x4f, 0x0a, 0x11, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, - 0x12, 0x1c, 0x0a, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x12, 0x1c, - 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x22, 0x39, 0x0a, 0x19, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x64, 0x48, 0x69, 0x73, - 0x74, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x22, 0x77, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x73, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x2a, 0x0a, - 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x74, - 0x61, 0x74, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x22, 0x4b, 0x0a, 0x0f, 0x52, 0x65, 0x61, 0x64, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x53, - 0x74, 0x61, 0x74, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, - 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x42, 0x08, 0x5a, - 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_chat_groups_proto_rawDescOnce sync.Once - file_chat_groups_proto_rawDescData = file_chat_groups_proto_rawDesc -) - -func file_chat_groups_proto_rawDescGZIP() []byte { - file_chat_groups_proto_rawDescOnce.Do(func() { - file_chat_groups_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_groups_proto_rawDescData) - }) - return file_chat_groups_proto_rawDescData -} - -var file_chat_groups_proto_msgTypes = make([]protoimpl.MessageInfo, 14) -var file_chat_groups_proto_goTypes = []interface{}{ - (*GroupsCreate)(nil), // 0: msg.GroupsCreate - (*GroupsAddUser)(nil), // 1: msg.GroupsAddUser - (*GroupsEditTitle)(nil), // 2: msg.GroupsEditTitle - (*GroupsDeleteUser)(nil), // 3: msg.GroupsDeleteUser - (*GroupsGetFull)(nil), // 4: msg.GroupsGetFull - (*GroupsToggleAdmins)(nil), // 5: msg.GroupsToggleAdmins - (*GroupsToggleAdminOnly)(nil), // 6: msg.GroupsToggleAdminOnly - (*GroupsUpdateAdmin)(nil), // 7: msg.GroupsUpdateAdmin - (*GroupsUploadPhoto)(nil), // 8: msg.GroupsUploadPhoto - (*GroupsRemovePhoto)(nil), // 9: msg.GroupsRemovePhoto - (*GroupsUpdatePhoto)(nil), // 10: msg.GroupsUpdatePhoto - (*GroupsGetReadHistoryStats)(nil), // 11: msg.GroupsGetReadHistoryStats - (*GroupsHistoryStats)(nil), // 12: msg.GroupsHistoryStats - (*ReadHistoryStat)(nil), // 13: msg.ReadHistoryStat - (*InputUser)(nil), // 14: msg.InputUser - (*InputFile)(nil), // 15: msg.InputFile - (*User)(nil), // 16: msg.User -} -var file_chat_groups_proto_depIdxs = []int32{ - 14, // 0: msg.GroupsCreate.Users:type_name -> msg.InputUser - 14, // 1: msg.GroupsAddUser.User:type_name -> msg.InputUser - 14, // 2: msg.GroupsDeleteUser.User:type_name -> msg.InputUser - 14, // 3: msg.GroupsUpdateAdmin.User:type_name -> msg.InputUser - 15, // 4: msg.GroupsUploadPhoto.File:type_name -> msg.InputFile - 13, // 5: msg.GroupsHistoryStats.Stats:type_name -> msg.ReadHistoryStat - 16, // 6: msg.GroupsHistoryStats.Users:type_name -> msg.User - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_chat_groups_proto_init() } -func file_chat_groups_proto_init() { - if File_chat_groups_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_chat_groups_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsCreate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsAddUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsEditTitle); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsDeleteUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsGetFull); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsToggleAdmins); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsToggleAdminOnly); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsUpdateAdmin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsUploadPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsRemovePhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsUpdatePhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsGetReadHistoryStats); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupsHistoryStats); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_groups_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReadHistoryStat); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_groups_proto_rawDesc, - NumEnums: 0, - NumMessages: 14, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_groups_proto_goTypes, - DependencyIndexes: file_chat_groups_proto_depIdxs, - MessageInfos: file_chat_groups_proto_msgTypes, - }.Build() - File_chat_groups_proto = out.File - file_chat_groups_proto_rawDesc = nil - file_chat_groups_proto_goTypes = nil - file_chat_groups_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.groups.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.groups.rony.go deleted file mode 100644 index e5cf4a2a..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.groups.rony.go +++ /dev/null @@ -1,939 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.groups.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_GroupsCreate int64 = 1271969037 - -type poolGroupsCreate struct { - pool sync.Pool -} - -func (p *poolGroupsCreate) Get() *GroupsCreate { - x, ok := p.pool.Get().(*GroupsCreate) - if !ok { - x = &GroupsCreate{} - } - - return x -} - -func (p *poolGroupsCreate) Put(x *GroupsCreate) { - if x == nil { - return - } - - for _, z := range x.Users { - PoolInputUser.Put(z) - } - x.Users = x.Users[:0] - x.Title = "" - x.RandomID = 0 - - p.pool.Put(x) -} - -var PoolGroupsCreate = poolGroupsCreate{} - -func (x *GroupsCreate) DeepCopy(z *GroupsCreate) { - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolInputUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - z.Title = x.Title - z.RandomID = x.RandomID -} - -func (x *GroupsCreate) Clone() *GroupsCreate { - z := &GroupsCreate{} - x.DeepCopy(z) - return z -} - -func (x *GroupsCreate) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsCreate) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsCreate) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsCreate) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsCreate) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsCreate, x) -} - -const C_GroupsAddUser int64 = 394654713 - -type poolGroupsAddUser struct { - pool sync.Pool -} - -func (p *poolGroupsAddUser) Get() *GroupsAddUser { - x, ok := p.pool.Get().(*GroupsAddUser) - if !ok { - x = &GroupsAddUser{} - } - - x.User = PoolInputUser.Get() - - return x -} - -func (p *poolGroupsAddUser) Put(x *GroupsAddUser) { - if x == nil { - return - } - - x.GroupID = 0 - PoolInputUser.Put(x.User) - x.ForwardLimit = 0 - - p.pool.Put(x) -} - -var PoolGroupsAddUser = poolGroupsAddUser{} - -func (x *GroupsAddUser) DeepCopy(z *GroupsAddUser) { - z.GroupID = x.GroupID - if x.User != nil { - if z.User == nil { - z.User = PoolInputUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolInputUser.Put(z.User) - z.User = nil - } - z.ForwardLimit = x.ForwardLimit -} - -func (x *GroupsAddUser) Clone() *GroupsAddUser { - z := &GroupsAddUser{} - x.DeepCopy(z) - return z -} - -func (x *GroupsAddUser) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsAddUser) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsAddUser) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsAddUser) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsAddUser) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsAddUser, x) -} - -const C_GroupsEditTitle int64 = 2582813461 - -type poolGroupsEditTitle struct { - pool sync.Pool -} - -func (p *poolGroupsEditTitle) Get() *GroupsEditTitle { - x, ok := p.pool.Get().(*GroupsEditTitle) - if !ok { - x = &GroupsEditTitle{} - } - - return x -} - -func (p *poolGroupsEditTitle) Put(x *GroupsEditTitle) { - if x == nil { - return - } - - x.GroupID = 0 - x.Title = "" - - p.pool.Put(x) -} - -var PoolGroupsEditTitle = poolGroupsEditTitle{} - -func (x *GroupsEditTitle) DeepCopy(z *GroupsEditTitle) { - z.GroupID = x.GroupID - z.Title = x.Title -} - -func (x *GroupsEditTitle) Clone() *GroupsEditTitle { - z := &GroupsEditTitle{} - x.DeepCopy(z) - return z -} - -func (x *GroupsEditTitle) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsEditTitle) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsEditTitle) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsEditTitle) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsEditTitle) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsEditTitle, x) -} - -const C_GroupsDeleteUser int64 = 3172322223 - -type poolGroupsDeleteUser struct { - pool sync.Pool -} - -func (p *poolGroupsDeleteUser) Get() *GroupsDeleteUser { - x, ok := p.pool.Get().(*GroupsDeleteUser) - if !ok { - x = &GroupsDeleteUser{} - } - - x.User = PoolInputUser.Get() - - return x -} - -func (p *poolGroupsDeleteUser) Put(x *GroupsDeleteUser) { - if x == nil { - return - } - - x.GroupID = 0 - PoolInputUser.Put(x.User) - - p.pool.Put(x) -} - -var PoolGroupsDeleteUser = poolGroupsDeleteUser{} - -func (x *GroupsDeleteUser) DeepCopy(z *GroupsDeleteUser) { - z.GroupID = x.GroupID - if x.User != nil { - if z.User == nil { - z.User = PoolInputUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolInputUser.Put(z.User) - z.User = nil - } -} - -func (x *GroupsDeleteUser) Clone() *GroupsDeleteUser { - z := &GroupsDeleteUser{} - x.DeepCopy(z) - return z -} - -func (x *GroupsDeleteUser) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsDeleteUser) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsDeleteUser) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsDeleteUser) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsDeleteUser) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsDeleteUser, x) -} - -const C_GroupsGetFull int64 = 2986704909 - -type poolGroupsGetFull struct { - pool sync.Pool -} - -func (p *poolGroupsGetFull) Get() *GroupsGetFull { - x, ok := p.pool.Get().(*GroupsGetFull) - if !ok { - x = &GroupsGetFull{} - } - - return x -} - -func (p *poolGroupsGetFull) Put(x *GroupsGetFull) { - if x == nil { - return - } - - x.GroupID = 0 - - p.pool.Put(x) -} - -var PoolGroupsGetFull = poolGroupsGetFull{} - -func (x *GroupsGetFull) DeepCopy(z *GroupsGetFull) { - z.GroupID = x.GroupID -} - -func (x *GroupsGetFull) Clone() *GroupsGetFull { - z := &GroupsGetFull{} - x.DeepCopy(z) - return z -} - -func (x *GroupsGetFull) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsGetFull) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsGetFull) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsGetFull) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsGetFull) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsGetFull, x) -} - -const C_GroupsToggleAdmins int64 = 1581076909 - -type poolGroupsToggleAdmins struct { - pool sync.Pool -} - -func (p *poolGroupsToggleAdmins) Get() *GroupsToggleAdmins { - x, ok := p.pool.Get().(*GroupsToggleAdmins) - if !ok { - x = &GroupsToggleAdmins{} - } - - return x -} - -func (p *poolGroupsToggleAdmins) Put(x *GroupsToggleAdmins) { - if x == nil { - return - } - - x.GroupID = 0 - x.AdminEnabled = false - - p.pool.Put(x) -} - -var PoolGroupsToggleAdmins = poolGroupsToggleAdmins{} - -func (x *GroupsToggleAdmins) DeepCopy(z *GroupsToggleAdmins) { - z.GroupID = x.GroupID - z.AdminEnabled = x.AdminEnabled -} - -func (x *GroupsToggleAdmins) Clone() *GroupsToggleAdmins { - z := &GroupsToggleAdmins{} - x.DeepCopy(z) - return z -} - -func (x *GroupsToggleAdmins) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsToggleAdmins) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsToggleAdmins) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsToggleAdmins) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsToggleAdmins) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsToggleAdmins, x) -} - -const C_GroupsToggleAdminOnly int64 = 3440147323 - -type poolGroupsToggleAdminOnly struct { - pool sync.Pool -} - -func (p *poolGroupsToggleAdminOnly) Get() *GroupsToggleAdminOnly { - x, ok := p.pool.Get().(*GroupsToggleAdminOnly) - if !ok { - x = &GroupsToggleAdminOnly{} - } - - return x -} - -func (p *poolGroupsToggleAdminOnly) Put(x *GroupsToggleAdminOnly) { - if x == nil { - return - } - - x.GroupID = 0 - x.AdminOnly = false - - p.pool.Put(x) -} - -var PoolGroupsToggleAdminOnly = poolGroupsToggleAdminOnly{} - -func (x *GroupsToggleAdminOnly) DeepCopy(z *GroupsToggleAdminOnly) { - z.GroupID = x.GroupID - z.AdminOnly = x.AdminOnly -} - -func (x *GroupsToggleAdminOnly) Clone() *GroupsToggleAdminOnly { - z := &GroupsToggleAdminOnly{} - x.DeepCopy(z) - return z -} - -func (x *GroupsToggleAdminOnly) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsToggleAdminOnly) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsToggleAdminOnly) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsToggleAdminOnly) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsToggleAdminOnly) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsToggleAdminOnly, x) -} - -const C_GroupsUpdateAdmin int64 = 1345991011 - -type poolGroupsUpdateAdmin struct { - pool sync.Pool -} - -func (p *poolGroupsUpdateAdmin) Get() *GroupsUpdateAdmin { - x, ok := p.pool.Get().(*GroupsUpdateAdmin) - if !ok { - x = &GroupsUpdateAdmin{} - } - - x.User = PoolInputUser.Get() - - return x -} - -func (p *poolGroupsUpdateAdmin) Put(x *GroupsUpdateAdmin) { - if x == nil { - return - } - - x.GroupID = 0 - PoolInputUser.Put(x.User) - x.Admin = false - - p.pool.Put(x) -} - -var PoolGroupsUpdateAdmin = poolGroupsUpdateAdmin{} - -func (x *GroupsUpdateAdmin) DeepCopy(z *GroupsUpdateAdmin) { - z.GroupID = x.GroupID - if x.User != nil { - if z.User == nil { - z.User = PoolInputUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolInputUser.Put(z.User) - z.User = nil - } - z.Admin = x.Admin -} - -func (x *GroupsUpdateAdmin) Clone() *GroupsUpdateAdmin { - z := &GroupsUpdateAdmin{} - x.DeepCopy(z) - return z -} - -func (x *GroupsUpdateAdmin) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsUpdateAdmin) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsUpdateAdmin) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsUpdateAdmin) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsUpdateAdmin) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsUpdateAdmin, x) -} - -const C_GroupsUploadPhoto int64 = 2624284907 - -type poolGroupsUploadPhoto struct { - pool sync.Pool -} - -func (p *poolGroupsUploadPhoto) Get() *GroupsUploadPhoto { - x, ok := p.pool.Get().(*GroupsUploadPhoto) - if !ok { - x = &GroupsUploadPhoto{} - } - - x.File = PoolInputFile.Get() - - return x -} - -func (p *poolGroupsUploadPhoto) Put(x *GroupsUploadPhoto) { - if x == nil { - return - } - - x.GroupID = 0 - PoolInputFile.Put(x.File) - x.ReturnObject = false - - p.pool.Put(x) -} - -var PoolGroupsUploadPhoto = poolGroupsUploadPhoto{} - -func (x *GroupsUploadPhoto) DeepCopy(z *GroupsUploadPhoto) { - z.GroupID = x.GroupID - if x.File != nil { - if z.File == nil { - z.File = PoolInputFile.Get() - } - x.File.DeepCopy(z.File) - } else { - PoolInputFile.Put(z.File) - z.File = nil - } - z.ReturnObject = x.ReturnObject -} - -func (x *GroupsUploadPhoto) Clone() *GroupsUploadPhoto { - z := &GroupsUploadPhoto{} - x.DeepCopy(z) - return z -} - -func (x *GroupsUploadPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsUploadPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsUploadPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsUploadPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsUploadPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsUploadPhoto, x) -} - -const C_GroupsRemovePhoto int64 = 176771682 - -type poolGroupsRemovePhoto struct { - pool sync.Pool -} - -func (p *poolGroupsRemovePhoto) Get() *GroupsRemovePhoto { - x, ok := p.pool.Get().(*GroupsRemovePhoto) - if !ok { - x = &GroupsRemovePhoto{} - } - - return x -} - -func (p *poolGroupsRemovePhoto) Put(x *GroupsRemovePhoto) { - if x == nil { - return - } - - x.GroupID = 0 - x.PhotoID = 0 - - p.pool.Put(x) -} - -var PoolGroupsRemovePhoto = poolGroupsRemovePhoto{} - -func (x *GroupsRemovePhoto) DeepCopy(z *GroupsRemovePhoto) { - z.GroupID = x.GroupID - z.PhotoID = x.PhotoID -} - -func (x *GroupsRemovePhoto) Clone() *GroupsRemovePhoto { - z := &GroupsRemovePhoto{} - x.DeepCopy(z) - return z -} - -func (x *GroupsRemovePhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsRemovePhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsRemovePhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsRemovePhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsRemovePhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsRemovePhoto, x) -} - -const C_GroupsUpdatePhoto int64 = 3431184397 - -type poolGroupsUpdatePhoto struct { - pool sync.Pool -} - -func (p *poolGroupsUpdatePhoto) Get() *GroupsUpdatePhoto { - x, ok := p.pool.Get().(*GroupsUpdatePhoto) - if !ok { - x = &GroupsUpdatePhoto{} - } - - return x -} - -func (p *poolGroupsUpdatePhoto) Put(x *GroupsUpdatePhoto) { - if x == nil { - return - } - - x.PhotoID = 0 - x.GroupID = 0 - - p.pool.Put(x) -} - -var PoolGroupsUpdatePhoto = poolGroupsUpdatePhoto{} - -func (x *GroupsUpdatePhoto) DeepCopy(z *GroupsUpdatePhoto) { - z.PhotoID = x.PhotoID - z.GroupID = x.GroupID -} - -func (x *GroupsUpdatePhoto) Clone() *GroupsUpdatePhoto { - z := &GroupsUpdatePhoto{} - x.DeepCopy(z) - return z -} - -func (x *GroupsUpdatePhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsUpdatePhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsUpdatePhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsUpdatePhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsUpdatePhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsUpdatePhoto, x) -} - -const C_GroupsGetReadHistoryStats int64 = 719309439 - -type poolGroupsGetReadHistoryStats struct { - pool sync.Pool -} - -func (p *poolGroupsGetReadHistoryStats) Get() *GroupsGetReadHistoryStats { - x, ok := p.pool.Get().(*GroupsGetReadHistoryStats) - if !ok { - x = &GroupsGetReadHistoryStats{} - } - - return x -} - -func (p *poolGroupsGetReadHistoryStats) Put(x *GroupsGetReadHistoryStats) { - if x == nil { - return - } - - x.GroupID = 0 - - p.pool.Put(x) -} - -var PoolGroupsGetReadHistoryStats = poolGroupsGetReadHistoryStats{} - -func (x *GroupsGetReadHistoryStats) DeepCopy(z *GroupsGetReadHistoryStats) { - z.GroupID = x.GroupID -} - -func (x *GroupsGetReadHistoryStats) Clone() *GroupsGetReadHistoryStats { - z := &GroupsGetReadHistoryStats{} - x.DeepCopy(z) - return z -} - -func (x *GroupsGetReadHistoryStats) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsGetReadHistoryStats) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsGetReadHistoryStats) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsGetReadHistoryStats) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsGetReadHistoryStats) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsGetReadHistoryStats, x) -} - -const C_GroupsHistoryStats int64 = 1080267574 - -type poolGroupsHistoryStats struct { - pool sync.Pool -} - -func (p *poolGroupsHistoryStats) Get() *GroupsHistoryStats { - x, ok := p.pool.Get().(*GroupsHistoryStats) - if !ok { - x = &GroupsHistoryStats{} - } - - return x -} - -func (p *poolGroupsHistoryStats) Put(x *GroupsHistoryStats) { - if x == nil { - return - } - - for _, z := range x.Stats { - PoolReadHistoryStat.Put(z) - } - x.Stats = x.Stats[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolGroupsHistoryStats = poolGroupsHistoryStats{} - -func (x *GroupsHistoryStats) DeepCopy(z *GroupsHistoryStats) { - for idx := range x.Stats { - if x.Stats[idx] == nil { - continue - } - xx := PoolReadHistoryStat.Get() - x.Stats[idx].DeepCopy(xx) - z.Stats = append(z.Stats, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - z.Empty = x.Empty -} - -func (x *GroupsHistoryStats) Clone() *GroupsHistoryStats { - z := &GroupsHistoryStats{} - x.DeepCopy(z) - return z -} - -func (x *GroupsHistoryStats) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupsHistoryStats) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupsHistoryStats) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupsHistoryStats) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupsHistoryStats) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupsHistoryStats, x) -} - -const C_ReadHistoryStat int64 = 3486960061 - -type poolReadHistoryStat struct { - pool sync.Pool -} - -func (p *poolReadHistoryStat) Get() *ReadHistoryStat { - x, ok := p.pool.Get().(*ReadHistoryStat) - if !ok { - x = &ReadHistoryStat{} - } - - return x -} - -func (p *poolReadHistoryStat) Put(x *ReadHistoryStat) { - if x == nil { - return - } - - x.UserID = 0 - x.MessageID = 0 - - p.pool.Put(x) -} - -var PoolReadHistoryStat = poolReadHistoryStat{} - -func (x *ReadHistoryStat) DeepCopy(z *ReadHistoryStat) { - z.UserID = x.UserID - z.MessageID = x.MessageID -} - -func (x *ReadHistoryStat) Clone() *ReadHistoryStat { - z := &ReadHistoryStat{} - x.DeepCopy(z) - return z -} - -func (x *ReadHistoryStat) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ReadHistoryStat) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ReadHistoryStat) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ReadHistoryStat) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ReadHistoryStat) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ReadHistoryStat, x) -} - -func init() { - registry.RegisterConstructor(1271969037, "GroupsCreate") - registry.RegisterConstructor(394654713, "GroupsAddUser") - registry.RegisterConstructor(2582813461, "GroupsEditTitle") - registry.RegisterConstructor(3172322223, "GroupsDeleteUser") - registry.RegisterConstructor(2986704909, "GroupsGetFull") - registry.RegisterConstructor(1581076909, "GroupsToggleAdmins") - registry.RegisterConstructor(3440147323, "GroupsToggleAdminOnly") - registry.RegisterConstructor(1345991011, "GroupsUpdateAdmin") - registry.RegisterConstructor(2624284907, "GroupsUploadPhoto") - registry.RegisterConstructor(176771682, "GroupsRemovePhoto") - registry.RegisterConstructor(3431184397, "GroupsUpdatePhoto") - registry.RegisterConstructor(719309439, "GroupsGetReadHistoryStats") - registry.RegisterConstructor(1080267574, "GroupsHistoryStats") - registry.RegisterConstructor(3486960061, "ReadHistoryStat") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.labels.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.labels.pb.go deleted file mode 100644 index 887a1805..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.labels.pb.go +++ /dev/null @@ -1,754 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.labels.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// LabelsCreate -// @Function -// @Returns Bool -type LabelsCreate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Colour string `protobuf:"bytes,3,opt,name=Colour,proto3" json:"Colour,omitempty"` -} - -func (x *LabelsCreate) Reset() { - *x = LabelsCreate{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_labels_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelsCreate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelsCreate) ProtoMessage() {} - -func (x *LabelsCreate) ProtoReflect() protoreflect.Message { - mi := &file_chat_labels_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelsCreate.ProtoReflect.Descriptor instead. -func (*LabelsCreate) Descriptor() ([]byte, []int) { - return file_chat_labels_proto_rawDescGZIP(), []int{0} -} - -func (x *LabelsCreate) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *LabelsCreate) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *LabelsCreate) GetColour() string { - if x != nil { - return x.Colour - } - return "" -} - -// LabelsEdit -// @Function -// @Returns: Bool -type LabelsEdit struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LabelID int32 `protobuf:"varint,1,opt,name=LabelID,proto3" json:"LabelID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Colour string `protobuf:"bytes,3,opt,name=Colour,proto3" json:"Colour,omitempty"` -} - -func (x *LabelsEdit) Reset() { - *x = LabelsEdit{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_labels_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelsEdit) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelsEdit) ProtoMessage() {} - -func (x *LabelsEdit) ProtoReflect() protoreflect.Message { - mi := &file_chat_labels_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelsEdit.ProtoReflect.Descriptor instead. -func (*LabelsEdit) Descriptor() ([]byte, []int) { - return file_chat_labels_proto_rawDescGZIP(), []int{1} -} - -func (x *LabelsEdit) GetLabelID() int32 { - if x != nil { - return x.LabelID - } - return 0 -} - -func (x *LabelsEdit) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *LabelsEdit) GetColour() string { - if x != nil { - return x.Colour - } - return "" -} - -// LabelsDelete -// @Function -// @Returns: Bool -type LabelsDelete struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LabelIDs []int32 `protobuf:"varint,1,rep,packed,name=LabelIDs,proto3" json:"LabelIDs,omitempty"` -} - -func (x *LabelsDelete) Reset() { - *x = LabelsDelete{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_labels_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelsDelete) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelsDelete) ProtoMessage() {} - -func (x *LabelsDelete) ProtoReflect() protoreflect.Message { - mi := &file_chat_labels_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelsDelete.ProtoReflect.Descriptor instead. -func (*LabelsDelete) Descriptor() ([]byte, []int) { - return file_chat_labels_proto_rawDescGZIP(), []int{2} -} - -func (x *LabelsDelete) GetLabelIDs() []int32 { - if x != nil { - return x.LabelIDs - } - return nil -} - -// LabelsGet -// @Function -// @Returns: LabelsMany -type LabelsGet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *LabelsGet) Reset() { - *x = LabelsGet{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_labels_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelsGet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelsGet) ProtoMessage() {} - -func (x *LabelsGet) ProtoReflect() protoreflect.Message { - mi := &file_chat_labels_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelsGet.ProtoReflect.Descriptor instead. -func (*LabelsGet) Descriptor() ([]byte, []int) { - return file_chat_labels_proto_rawDescGZIP(), []int{3} -} - -// LabelsAddToMessage -// @Function -// @Returns: Bool -type LabelsAddToMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - LabelIDs []int32 `protobuf:"varint,3,rep,packed,name=LabelIDs,proto3" json:"LabelIDs,omitempty"` - MessageIDs []int64 `protobuf:"varint,4,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` -} - -func (x *LabelsAddToMessage) Reset() { - *x = LabelsAddToMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_labels_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelsAddToMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelsAddToMessage) ProtoMessage() {} - -func (x *LabelsAddToMessage) ProtoReflect() protoreflect.Message { - mi := &file_chat_labels_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelsAddToMessage.ProtoReflect.Descriptor instead. -func (*LabelsAddToMessage) Descriptor() ([]byte, []int) { - return file_chat_labels_proto_rawDescGZIP(), []int{4} -} - -func (x *LabelsAddToMessage) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *LabelsAddToMessage) GetLabelIDs() []int32 { - if x != nil { - return x.LabelIDs - } - return nil -} - -func (x *LabelsAddToMessage) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -// LabelsRemoveFromMessage -// @Function -// @Returns: Bool -type LabelsRemoveFromMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - LabelIDs []int32 `protobuf:"varint,3,rep,packed,name=LabelIDs,proto3" json:"LabelIDs,omitempty"` - MessageIDs []int64 `protobuf:"varint,4,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` -} - -func (x *LabelsRemoveFromMessage) Reset() { - *x = LabelsRemoveFromMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_labels_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelsRemoveFromMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelsRemoveFromMessage) ProtoMessage() {} - -func (x *LabelsRemoveFromMessage) ProtoReflect() protoreflect.Message { - mi := &file_chat_labels_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelsRemoveFromMessage.ProtoReflect.Descriptor instead. -func (*LabelsRemoveFromMessage) Descriptor() ([]byte, []int) { - return file_chat_labels_proto_rawDescGZIP(), []int{5} -} - -func (x *LabelsRemoveFromMessage) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *LabelsRemoveFromMessage) GetLabelIDs() []int32 { - if x != nil { - return x.LabelIDs - } - return nil -} - -func (x *LabelsRemoveFromMessage) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -// LabelsListItems -// @Function -// @Returns: LabelItems -type LabelsListItems struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LabelID int32 `protobuf:"varint,1,opt,name=LabelID,proto3" json:"LabelID,omitempty"` - MinID int64 `protobuf:"varint,2,opt,name=MinID,proto3" json:"MinID,omitempty"` - MaxID int64 `protobuf:"varint,3,opt,name=MaxID,proto3" json:"MaxID,omitempty"` - Limit int32 `protobuf:"varint,4,opt,name=Limit,proto3" json:"Limit,omitempty"` -} - -func (x *LabelsListItems) Reset() { - *x = LabelsListItems{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_labels_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelsListItems) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelsListItems) ProtoMessage() {} - -func (x *LabelsListItems) ProtoReflect() protoreflect.Message { - mi := &file_chat_labels_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelsListItems.ProtoReflect.Descriptor instead. -func (*LabelsListItems) Descriptor() ([]byte, []int) { - return file_chat_labels_proto_rawDescGZIP(), []int{6} -} - -func (x *LabelsListItems) GetLabelID() int32 { - if x != nil { - return x.LabelID - } - return 0 -} - -func (x *LabelsListItems) GetMinID() int64 { - if x != nil { - return x.MinID - } - return 0 -} - -func (x *LabelsListItems) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -func (x *LabelsListItems) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -// LabelItems -type LabelItems struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LabelID int32 `protobuf:"varint,1,opt,name=LabelID,proto3" json:"LabelID,omitempty"` - Messages []*UserMessage `protobuf:"bytes,2,rep,name=Messages,proto3" json:"Messages,omitempty"` - Dialogs []*Dialog `protobuf:"bytes,3,rep,name=Dialogs,proto3" json:"Dialogs,omitempty"` - Users []*User `protobuf:"bytes,4,rep,name=Users,proto3" json:"Users,omitempty"` - Groups []*Group `protobuf:"bytes,5,rep,name=Groups,proto3" json:"Groups,omitempty"` -} - -func (x *LabelItems) Reset() { - *x = LabelItems{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_labels_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelItems) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelItems) ProtoMessage() {} - -func (x *LabelItems) ProtoReflect() protoreflect.Message { - mi := &file_chat_labels_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelItems.ProtoReflect.Descriptor instead. -func (*LabelItems) Descriptor() ([]byte, []int) { - return file_chat_labels_proto_rawDescGZIP(), []int{7} -} - -func (x *LabelItems) GetLabelID() int32 { - if x != nil { - return x.LabelID - } - return 0 -} - -func (x *LabelItems) GetMessages() []*UserMessage { - if x != nil { - return x.Messages - } - return nil -} - -func (x *LabelItems) GetDialogs() []*Dialog { - if x != nil { - return x.Dialogs - } - return nil -} - -func (x *LabelItems) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *LabelItems) GetGroups() []*Group { - if x != nil { - return x.Groups - } - return nil -} - -var File_chat_labels_proto protoreflect.FileDescriptor - -var file_chat_labels_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x56, 0x0a, 0x0c, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, - 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, - 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, - 0x6c, 0x6f, 0x75, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x6f, 0x6c, 0x6f, - 0x75, 0x72, 0x22, 0x52, 0x0a, 0x0a, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x64, 0x69, 0x74, - 0x12, 0x18, 0x0a, 0x07, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x07, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x6f, 0x75, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x43, 0x6f, 0x6c, 0x6f, 0x75, 0x72, 0x22, 0x2a, 0x0a, 0x0c, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, - 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, - 0x44, 0x73, 0x22, 0x0b, 0x0a, 0x09, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x47, 0x65, 0x74, 0x22, - 0x74, 0x0a, 0x12, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x41, 0x64, 0x64, 0x54, 0x6f, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, - 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x62, - 0x65, 0x6c, 0x49, 0x44, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x4c, 0x61, 0x62, - 0x65, 0x6c, 0x49, 0x44, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x49, 0x44, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x49, 0x44, 0x73, 0x22, 0x79, 0x0a, 0x17, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, - 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, - 0x22, 0x6d, 0x0a, 0x0f, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x74, - 0x65, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x12, 0x14, 0x0a, - 0x05, 0x4d, 0x69, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x69, - 0x6e, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, - 0xc0, 0x01, 0x0a, 0x0a, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x18, - 0x0a, 0x07, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x07, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x12, 0x2c, 0x0a, 0x08, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x25, 0x0a, 0x07, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x69, - 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x1f, 0x0a, - 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x22, - 0x0a, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x73, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_chat_labels_proto_rawDescOnce sync.Once - file_chat_labels_proto_rawDescData = file_chat_labels_proto_rawDesc -) - -func file_chat_labels_proto_rawDescGZIP() []byte { - file_chat_labels_proto_rawDescOnce.Do(func() { - file_chat_labels_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_labels_proto_rawDescData) - }) - return file_chat_labels_proto_rawDescData -} - -var file_chat_labels_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_chat_labels_proto_goTypes = []interface{}{ - (*LabelsCreate)(nil), // 0: msg.LabelsCreate - (*LabelsEdit)(nil), // 1: msg.LabelsEdit - (*LabelsDelete)(nil), // 2: msg.LabelsDelete - (*LabelsGet)(nil), // 3: msg.LabelsGet - (*LabelsAddToMessage)(nil), // 4: msg.LabelsAddToMessage - (*LabelsRemoveFromMessage)(nil), // 5: msg.LabelsRemoveFromMessage - (*LabelsListItems)(nil), // 6: msg.LabelsListItems - (*LabelItems)(nil), // 7: msg.LabelItems - (*InputPeer)(nil), // 8: msg.InputPeer - (*UserMessage)(nil), // 9: msg.UserMessage - (*Dialog)(nil), // 10: msg.Dialog - (*User)(nil), // 11: msg.User - (*Group)(nil), // 12: msg.Group -} -var file_chat_labels_proto_depIdxs = []int32{ - 8, // 0: msg.LabelsAddToMessage.Peer:type_name -> msg.InputPeer - 8, // 1: msg.LabelsRemoveFromMessage.Peer:type_name -> msg.InputPeer - 9, // 2: msg.LabelItems.Messages:type_name -> msg.UserMessage - 10, // 3: msg.LabelItems.Dialogs:type_name -> msg.Dialog - 11, // 4: msg.LabelItems.Users:type_name -> msg.User - 12, // 5: msg.LabelItems.Groups:type_name -> msg.Group - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_chat_labels_proto_init() } -func file_chat_labels_proto_init() { - if File_chat_labels_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_chat_labels_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelsCreate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_labels_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelsEdit); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_labels_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelsDelete); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_labels_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelsGet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_labels_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelsAddToMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_labels_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelsRemoveFromMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_labels_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelsListItems); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_labels_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelItems); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_labels_proto_rawDesc, - NumEnums: 0, - NumMessages: 8, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_labels_proto_goTypes, - DependencyIndexes: file_chat_labels_proto_depIdxs, - MessageInfos: file_chat_labels_proto_msgTypes, - }.Build() - File_chat_labels_proto = out.File - file_chat_labels_proto_rawDesc = nil - file_chat_labels_proto_goTypes = nil - file_chat_labels_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.labels.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.labels.rony.go deleted file mode 100644 index 10af4720..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.labels.rony.go +++ /dev/null @@ -1,574 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.labels.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_LabelsCreate int64 = 2138857068 - -type poolLabelsCreate struct { - pool sync.Pool -} - -func (p *poolLabelsCreate) Get() *LabelsCreate { - x, ok := p.pool.Get().(*LabelsCreate) - if !ok { - x = &LabelsCreate{} - } - - return x -} - -func (p *poolLabelsCreate) Put(x *LabelsCreate) { - if x == nil { - return - } - - x.RandomID = 0 - x.Name = "" - x.Colour = "" - - p.pool.Put(x) -} - -var PoolLabelsCreate = poolLabelsCreate{} - -func (x *LabelsCreate) DeepCopy(z *LabelsCreate) { - z.RandomID = x.RandomID - z.Name = x.Name - z.Colour = x.Colour -} - -func (x *LabelsCreate) Clone() *LabelsCreate { - z := &LabelsCreate{} - x.DeepCopy(z) - return z -} - -func (x *LabelsCreate) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *LabelsCreate) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *LabelsCreate) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *LabelsCreate) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *LabelsCreate) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_LabelsCreate, x) -} - -const C_LabelsEdit int64 = 2790466877 - -type poolLabelsEdit struct { - pool sync.Pool -} - -func (p *poolLabelsEdit) Get() *LabelsEdit { - x, ok := p.pool.Get().(*LabelsEdit) - if !ok { - x = &LabelsEdit{} - } - - return x -} - -func (p *poolLabelsEdit) Put(x *LabelsEdit) { - if x == nil { - return - } - - x.LabelID = 0 - x.Name = "" - x.Colour = "" - - p.pool.Put(x) -} - -var PoolLabelsEdit = poolLabelsEdit{} - -func (x *LabelsEdit) DeepCopy(z *LabelsEdit) { - z.LabelID = x.LabelID - z.Name = x.Name - z.Colour = x.Colour -} - -func (x *LabelsEdit) Clone() *LabelsEdit { - z := &LabelsEdit{} - x.DeepCopy(z) - return z -} - -func (x *LabelsEdit) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *LabelsEdit) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *LabelsEdit) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *LabelsEdit) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *LabelsEdit) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_LabelsEdit, x) -} - -const C_LabelsDelete int64 = 3401105936 - -type poolLabelsDelete struct { - pool sync.Pool -} - -func (p *poolLabelsDelete) Get() *LabelsDelete { - x, ok := p.pool.Get().(*LabelsDelete) - if !ok { - x = &LabelsDelete{} - } - - return x -} - -func (p *poolLabelsDelete) Put(x *LabelsDelete) { - if x == nil { - return - } - - x.LabelIDs = x.LabelIDs[:0] - - p.pool.Put(x) -} - -var PoolLabelsDelete = poolLabelsDelete{} - -func (x *LabelsDelete) DeepCopy(z *LabelsDelete) { - z.LabelIDs = append(z.LabelIDs[:0], x.LabelIDs...) -} - -func (x *LabelsDelete) Clone() *LabelsDelete { - z := &LabelsDelete{} - x.DeepCopy(z) - return z -} - -func (x *LabelsDelete) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *LabelsDelete) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *LabelsDelete) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *LabelsDelete) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *LabelsDelete) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_LabelsDelete, x) -} - -const C_LabelsGet int64 = 2575409921 - -type poolLabelsGet struct { - pool sync.Pool -} - -func (p *poolLabelsGet) Get() *LabelsGet { - x, ok := p.pool.Get().(*LabelsGet) - if !ok { - x = &LabelsGet{} - } - - return x -} - -func (p *poolLabelsGet) Put(x *LabelsGet) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolLabelsGet = poolLabelsGet{} - -func (x *LabelsGet) DeepCopy(z *LabelsGet) { -} - -func (x *LabelsGet) Clone() *LabelsGet { - z := &LabelsGet{} - x.DeepCopy(z) - return z -} - -func (x *LabelsGet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *LabelsGet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *LabelsGet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *LabelsGet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *LabelsGet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_LabelsGet, x) -} - -const C_LabelsAddToMessage int64 = 180144503 - -type poolLabelsAddToMessage struct { - pool sync.Pool -} - -func (p *poolLabelsAddToMessage) Get() *LabelsAddToMessage { - x, ok := p.pool.Get().(*LabelsAddToMessage) - if !ok { - x = &LabelsAddToMessage{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolLabelsAddToMessage) Put(x *LabelsAddToMessage) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.LabelIDs = x.LabelIDs[:0] - x.MessageIDs = x.MessageIDs[:0] - - p.pool.Put(x) -} - -var PoolLabelsAddToMessage = poolLabelsAddToMessage{} - -func (x *LabelsAddToMessage) DeepCopy(z *LabelsAddToMessage) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.LabelIDs = append(z.LabelIDs[:0], x.LabelIDs...) - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) -} - -func (x *LabelsAddToMessage) Clone() *LabelsAddToMessage { - z := &LabelsAddToMessage{} - x.DeepCopy(z) - return z -} - -func (x *LabelsAddToMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *LabelsAddToMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *LabelsAddToMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *LabelsAddToMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *LabelsAddToMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_LabelsAddToMessage, x) -} - -const C_LabelsRemoveFromMessage int64 = 4195197703 - -type poolLabelsRemoveFromMessage struct { - pool sync.Pool -} - -func (p *poolLabelsRemoveFromMessage) Get() *LabelsRemoveFromMessage { - x, ok := p.pool.Get().(*LabelsRemoveFromMessage) - if !ok { - x = &LabelsRemoveFromMessage{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolLabelsRemoveFromMessage) Put(x *LabelsRemoveFromMessage) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.LabelIDs = x.LabelIDs[:0] - x.MessageIDs = x.MessageIDs[:0] - - p.pool.Put(x) -} - -var PoolLabelsRemoveFromMessage = poolLabelsRemoveFromMessage{} - -func (x *LabelsRemoveFromMessage) DeepCopy(z *LabelsRemoveFromMessage) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.LabelIDs = append(z.LabelIDs[:0], x.LabelIDs...) - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) -} - -func (x *LabelsRemoveFromMessage) Clone() *LabelsRemoveFromMessage { - z := &LabelsRemoveFromMessage{} - x.DeepCopy(z) - return z -} - -func (x *LabelsRemoveFromMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *LabelsRemoveFromMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *LabelsRemoveFromMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *LabelsRemoveFromMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *LabelsRemoveFromMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_LabelsRemoveFromMessage, x) -} - -const C_LabelsListItems int64 = 2351763198 - -type poolLabelsListItems struct { - pool sync.Pool -} - -func (p *poolLabelsListItems) Get() *LabelsListItems { - x, ok := p.pool.Get().(*LabelsListItems) - if !ok { - x = &LabelsListItems{} - } - - return x -} - -func (p *poolLabelsListItems) Put(x *LabelsListItems) { - if x == nil { - return - } - - x.LabelID = 0 - x.MinID = 0 - x.MaxID = 0 - x.Limit = 0 - - p.pool.Put(x) -} - -var PoolLabelsListItems = poolLabelsListItems{} - -func (x *LabelsListItems) DeepCopy(z *LabelsListItems) { - z.LabelID = x.LabelID - z.MinID = x.MinID - z.MaxID = x.MaxID - z.Limit = x.Limit -} - -func (x *LabelsListItems) Clone() *LabelsListItems { - z := &LabelsListItems{} - x.DeepCopy(z) - return z -} - -func (x *LabelsListItems) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *LabelsListItems) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *LabelsListItems) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *LabelsListItems) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *LabelsListItems) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_LabelsListItems, x) -} - -const C_LabelItems int64 = 4271841358 - -type poolLabelItems struct { - pool sync.Pool -} - -func (p *poolLabelItems) Get() *LabelItems { - x, ok := p.pool.Get().(*LabelItems) - if !ok { - x = &LabelItems{} - } - - return x -} - -func (p *poolLabelItems) Put(x *LabelItems) { - if x == nil { - return - } - - x.LabelID = 0 - for _, z := range x.Messages { - PoolUserMessage.Put(z) - } - x.Messages = x.Messages[:0] - for _, z := range x.Dialogs { - PoolDialog.Put(z) - } - x.Dialogs = x.Dialogs[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Groups { - PoolGroup.Put(z) - } - x.Groups = x.Groups[:0] - - p.pool.Put(x) -} - -var PoolLabelItems = poolLabelItems{} - -func (x *LabelItems) DeepCopy(z *LabelItems) { - z.LabelID = x.LabelID - for idx := range x.Messages { - if x.Messages[idx] == nil { - continue - } - xx := PoolUserMessage.Get() - x.Messages[idx].DeepCopy(xx) - z.Messages = append(z.Messages, xx) - } - for idx := range x.Dialogs { - if x.Dialogs[idx] == nil { - continue - } - xx := PoolDialog.Get() - x.Dialogs[idx].DeepCopy(xx) - z.Dialogs = append(z.Dialogs, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Groups { - if x.Groups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.Groups[idx].DeepCopy(xx) - z.Groups = append(z.Groups, xx) - } -} - -func (x *LabelItems) Clone() *LabelItems { - z := &LabelItems{} - x.DeepCopy(z) - return z -} - -func (x *LabelItems) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *LabelItems) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *LabelItems) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *LabelItems) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *LabelItems) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_LabelItems, x) -} - -func init() { - registry.RegisterConstructor(2138857068, "LabelsCreate") - registry.RegisterConstructor(2790466877, "LabelsEdit") - registry.RegisterConstructor(3401105936, "LabelsDelete") - registry.RegisterConstructor(2575409921, "LabelsGet") - registry.RegisterConstructor(180144503, "LabelsAddToMessage") - registry.RegisterConstructor(4195197703, "LabelsRemoveFromMessage") - registry.RegisterConstructor(2351763198, "LabelsListItems") - registry.RegisterConstructor(4271841358, "LabelItems") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.actions.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.actions.pb.go deleted file mode 100644 index 27680868..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.actions.pb.go +++ /dev/null @@ -1,838 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.messages.actions.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// MessageActionGroupAddUser -type MessageActionGroupAddUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIDs []int64 `protobuf:"varint,1,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` -} - -func (x *MessageActionGroupAddUser) Reset() { - *x = MessageActionGroupAddUser{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionGroupAddUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionGroupAddUser) ProtoMessage() {} - -func (x *MessageActionGroupAddUser) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionGroupAddUser.ProtoReflect.Descriptor instead. -func (*MessageActionGroupAddUser) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{0} -} - -func (x *MessageActionGroupAddUser) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -// MessageActionGroupDeleteUser -type MessageActionGroupDeleteUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIDs []int64 `protobuf:"varint,1,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` -} - -func (x *MessageActionGroupDeleteUser) Reset() { - *x = MessageActionGroupDeleteUser{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionGroupDeleteUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionGroupDeleteUser) ProtoMessage() {} - -func (x *MessageActionGroupDeleteUser) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionGroupDeleteUser.ProtoReflect.Descriptor instead. -func (*MessageActionGroupDeleteUser) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{1} -} - -func (x *MessageActionGroupDeleteUser) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -// MessageActionGroupCreated -type MessageActionGroupCreated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupTitle string `protobuf:"bytes,1,opt,name=GroupTitle,proto3" json:"GroupTitle,omitempty"` - UserIDs []int64 `protobuf:"varint,2,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` -} - -func (x *MessageActionGroupCreated) Reset() { - *x = MessageActionGroupCreated{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionGroupCreated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionGroupCreated) ProtoMessage() {} - -func (x *MessageActionGroupCreated) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionGroupCreated.ProtoReflect.Descriptor instead. -func (*MessageActionGroupCreated) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{2} -} - -func (x *MessageActionGroupCreated) GetGroupTitle() string { - if x != nil { - return x.GroupTitle - } - return "" -} - -func (x *MessageActionGroupCreated) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -// MessageActionGroupTitleChanged -type MessageActionGroupTitleChanged struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GroupTitle string `protobuf:"bytes,1,opt,name=GroupTitle,proto3" json:"GroupTitle,omitempty"` -} - -func (x *MessageActionGroupTitleChanged) Reset() { - *x = MessageActionGroupTitleChanged{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionGroupTitleChanged) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionGroupTitleChanged) ProtoMessage() {} - -func (x *MessageActionGroupTitleChanged) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionGroupTitleChanged.ProtoReflect.Descriptor instead. -func (*MessageActionGroupTitleChanged) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{3} -} - -func (x *MessageActionGroupTitleChanged) GetGroupTitle() string { - if x != nil { - return x.GroupTitle - } - return "" -} - -// MessageActionGroupPhotoChanged -type MessageActionGroupPhotoChanged struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Photo *GroupPhoto `protobuf:"bytes,1,opt,name=Photo,proto3" json:"Photo,omitempty"` -} - -func (x *MessageActionGroupPhotoChanged) Reset() { - *x = MessageActionGroupPhotoChanged{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionGroupPhotoChanged) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionGroupPhotoChanged) ProtoMessage() {} - -func (x *MessageActionGroupPhotoChanged) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionGroupPhotoChanged.ProtoReflect.Descriptor instead. -func (*MessageActionGroupPhotoChanged) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{4} -} - -func (x *MessageActionGroupPhotoChanged) GetPhoto() *GroupPhoto { - if x != nil { - return x.Photo - } - return nil -} - -// MessageActionClearHistory -type MessageActionClearHistory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MaxID int64 `protobuf:"varint,1,opt,name=MaxID,proto3" json:"MaxID,omitempty"` - Delete bool `protobuf:"varint,2,opt,name=Delete,proto3" json:"Delete,omitempty"` -} - -func (x *MessageActionClearHistory) Reset() { - *x = MessageActionClearHistory{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionClearHistory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionClearHistory) ProtoMessage() {} - -func (x *MessageActionClearHistory) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionClearHistory.ProtoReflect.Descriptor instead. -func (*MessageActionClearHistory) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{5} -} - -func (x *MessageActionClearHistory) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -func (x *MessageActionClearHistory) GetDelete() bool { - if x != nil { - return x.Delete - } - return false -} - -// MessageActionContactRegistered -type MessageActionContactRegistered struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MessageActionContactRegistered) Reset() { - *x = MessageActionContactRegistered{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionContactRegistered) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionContactRegistered) ProtoMessage() {} - -func (x *MessageActionContactRegistered) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionContactRegistered.ProtoReflect.Descriptor instead. -func (*MessageActionContactRegistered) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{6} -} - -// MessageActionScreenShotTaken -type MessageActionScreenShotTaken struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MinID int64 `protobuf:"varint,1,opt,name=MinID,proto3" json:"MinID,omitempty"` - MaxID int64 `protobuf:"varint,2,opt,name=MaxID,proto3" json:"MaxID,omitempty"` -} - -func (x *MessageActionScreenShotTaken) Reset() { - *x = MessageActionScreenShotTaken{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionScreenShotTaken) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionScreenShotTaken) ProtoMessage() {} - -func (x *MessageActionScreenShotTaken) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionScreenShotTaken.ProtoReflect.Descriptor instead. -func (*MessageActionScreenShotTaken) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{7} -} - -func (x *MessageActionScreenShotTaken) GetMinID() int64 { - if x != nil { - return x.MinID - } - return 0 -} - -func (x *MessageActionScreenShotTaken) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -// MessageActionThreadClosed -type MessageActionThreadClosed struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ThreadID int64 `protobuf:"varint,1,opt,name=ThreadID,proto3" json:"ThreadID,omitempty"` -} - -func (x *MessageActionThreadClosed) Reset() { - *x = MessageActionThreadClosed{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionThreadClosed) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionThreadClosed) ProtoMessage() {} - -func (x *MessageActionThreadClosed) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionThreadClosed.ProtoReflect.Descriptor instead. -func (*MessageActionThreadClosed) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{8} -} - -func (x *MessageActionThreadClosed) GetThreadID() int64 { - if x != nil { - return x.ThreadID - } - return 0 -} - -// MessageActionCallStarted -type MessageActionCallStarted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *MessageActionCallStarted) Reset() { - *x = MessageActionCallStarted{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionCallStarted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionCallStarted) ProtoMessage() {} - -func (x *MessageActionCallStarted) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionCallStarted.ProtoReflect.Descriptor instead. -func (*MessageActionCallStarted) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{9} -} - -func (x *MessageActionCallStarted) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// MessageActionCallEnded -type MessageActionCallEnded struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - Reason DiscardReason `protobuf:"varint,2,opt,name=Reason,proto3,enum=msg.DiscardReason" json:"Reason,omitempty"` - Duration uint32 `protobuf:"varint,3,opt,name=Duration,proto3" json:"Duration,omitempty"` -} - -func (x *MessageActionCallEnded) Reset() { - *x = MessageActionCallEnded{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_actions_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageActionCallEnded) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageActionCallEnded) ProtoMessage() {} - -func (x *MessageActionCallEnded) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_actions_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageActionCallEnded.ProtoReflect.Descriptor instead. -func (*MessageActionCallEnded) Descriptor() ([]byte, []int) { - return file_chat_messages_actions_proto_rawDescGZIP(), []int{10} -} - -func (x *MessageActionCallEnded) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *MessageActionCallEnded) GetReason() DiscardReason { - if x != nil { - return x.Reason - } - return DiscardReason_DiscardReasonUnknown -} - -func (x *MessageActionCallEnded) GetDuration() uint32 { - if x != nil { - return x.Duration - } - return 0 -} - -var File_chat_messages_actions_proto protoreflect.FileDescriptor - -var file_chat_messages_actions_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, - 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x10, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x70, 0x68, 0x6f, 0x6e, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x19, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x55, - 0x73, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, - 0x73, 0x22, 0x3c, 0x0a, 0x1c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55, 0x73, 0x65, - 0x72, 0x12, 0x1c, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x22, - 0x59, 0x0a, 0x19, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x07, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x30, - 0x01, 0x52, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x22, 0x40, 0x0a, 0x1e, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x54, 0x69, 0x74, 0x6c, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x22, 0x47, 0x0a, 0x1e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x25, - 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x05, - 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x22, 0x49, 0x0a, 0x19, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x48, 0x69, 0x73, 0x74, 0x6f, - 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x22, 0x20, 0x0a, 0x1e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, - 0x65, 0x64, 0x22, 0x4a, 0x0a, 0x1c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x53, 0x68, 0x6f, 0x74, 0x54, 0x61, 0x6b, - 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x69, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x4d, 0x69, 0x6e, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x61, 0x78, 0x49, - 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x22, 0x37, - 0x0a, 0x19, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x68, 0x72, 0x65, 0x61, 0x64, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x54, - 0x68, 0x72, 0x65, 0x61, 0x64, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x54, - 0x68, 0x72, 0x65, 0x61, 0x64, 0x49, 0x44, 0x22, 0x32, 0x0a, 0x18, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x72, - 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x78, 0x0a, 0x16, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, - 0x45, 0x6e, 0x64, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x2a, 0x0a, - 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x52, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x44, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x44, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_chat_messages_actions_proto_rawDescOnce sync.Once - file_chat_messages_actions_proto_rawDescData = file_chat_messages_actions_proto_rawDesc -) - -func file_chat_messages_actions_proto_rawDescGZIP() []byte { - file_chat_messages_actions_proto_rawDescOnce.Do(func() { - file_chat_messages_actions_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_messages_actions_proto_rawDescData) - }) - return file_chat_messages_actions_proto_rawDescData -} - -var file_chat_messages_actions_proto_msgTypes = make([]protoimpl.MessageInfo, 11) -var file_chat_messages_actions_proto_goTypes = []interface{}{ - (*MessageActionGroupAddUser)(nil), // 0: msg.MessageActionGroupAddUser - (*MessageActionGroupDeleteUser)(nil), // 1: msg.MessageActionGroupDeleteUser - (*MessageActionGroupCreated)(nil), // 2: msg.MessageActionGroupCreated - (*MessageActionGroupTitleChanged)(nil), // 3: msg.MessageActionGroupTitleChanged - (*MessageActionGroupPhotoChanged)(nil), // 4: msg.MessageActionGroupPhotoChanged - (*MessageActionClearHistory)(nil), // 5: msg.MessageActionClearHistory - (*MessageActionContactRegistered)(nil), // 6: msg.MessageActionContactRegistered - (*MessageActionScreenShotTaken)(nil), // 7: msg.MessageActionScreenShotTaken - (*MessageActionThreadClosed)(nil), // 8: msg.MessageActionThreadClosed - (*MessageActionCallStarted)(nil), // 9: msg.MessageActionCallStarted - (*MessageActionCallEnded)(nil), // 10: msg.MessageActionCallEnded - (*GroupPhoto)(nil), // 11: msg.GroupPhoto - (DiscardReason)(0), // 12: msg.DiscardReason -} -var file_chat_messages_actions_proto_depIdxs = []int32{ - 11, // 0: msg.MessageActionGroupPhotoChanged.Photo:type_name -> msg.GroupPhoto - 12, // 1: msg.MessageActionCallEnded.Reason:type_name -> msg.DiscardReason - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_chat_messages_actions_proto_init() } -func file_chat_messages_actions_proto_init() { - if File_chat_messages_actions_proto != nil { - return - } - file_core_types_proto_init() - file_chat_phone_proto_init() - if !protoimpl.UnsafeEnabled { - file_chat_messages_actions_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionGroupAddUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionGroupDeleteUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionGroupCreated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionGroupTitleChanged); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionGroupPhotoChanged); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionClearHistory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionContactRegistered); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionScreenShotTaken); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionThreadClosed); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionCallStarted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_actions_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageActionCallEnded); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_messages_actions_proto_rawDesc, - NumEnums: 0, - NumMessages: 11, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_messages_actions_proto_goTypes, - DependencyIndexes: file_chat_messages_actions_proto_depIdxs, - MessageInfos: file_chat_messages_actions_proto_msgTypes, - }.Build() - File_chat_messages_actions_proto = out.File - file_chat_messages_actions_proto_rawDesc = nil - file_chat_messages_actions_proto_goTypes = nil - file_chat_messages_actions_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.actions.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.actions.rony.go deleted file mode 100644 index 83081c73..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.actions.rony.go +++ /dev/null @@ -1,678 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.messages.actions.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_MessageActionGroupAddUser int64 = 1949386261 - -type poolMessageActionGroupAddUser struct { - pool sync.Pool -} - -func (p *poolMessageActionGroupAddUser) Get() *MessageActionGroupAddUser { - x, ok := p.pool.Get().(*MessageActionGroupAddUser) - if !ok { - x = &MessageActionGroupAddUser{} - } - - return x -} - -func (p *poolMessageActionGroupAddUser) Put(x *MessageActionGroupAddUser) { - if x == nil { - return - } - - x.UserIDs = x.UserIDs[:0] - - p.pool.Put(x) -} - -var PoolMessageActionGroupAddUser = poolMessageActionGroupAddUser{} - -func (x *MessageActionGroupAddUser) DeepCopy(z *MessageActionGroupAddUser) { - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) -} - -func (x *MessageActionGroupAddUser) Clone() *MessageActionGroupAddUser { - z := &MessageActionGroupAddUser{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionGroupAddUser) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionGroupAddUser) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionGroupAddUser) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionGroupAddUser) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionGroupAddUser) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionGroupAddUser, x) -} - -const C_MessageActionGroupDeleteUser int64 = 1213452128 - -type poolMessageActionGroupDeleteUser struct { - pool sync.Pool -} - -func (p *poolMessageActionGroupDeleteUser) Get() *MessageActionGroupDeleteUser { - x, ok := p.pool.Get().(*MessageActionGroupDeleteUser) - if !ok { - x = &MessageActionGroupDeleteUser{} - } - - return x -} - -func (p *poolMessageActionGroupDeleteUser) Put(x *MessageActionGroupDeleteUser) { - if x == nil { - return - } - - x.UserIDs = x.UserIDs[:0] - - p.pool.Put(x) -} - -var PoolMessageActionGroupDeleteUser = poolMessageActionGroupDeleteUser{} - -func (x *MessageActionGroupDeleteUser) DeepCopy(z *MessageActionGroupDeleteUser) { - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) -} - -func (x *MessageActionGroupDeleteUser) Clone() *MessageActionGroupDeleteUser { - z := &MessageActionGroupDeleteUser{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionGroupDeleteUser) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionGroupDeleteUser) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionGroupDeleteUser) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionGroupDeleteUser) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionGroupDeleteUser) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionGroupDeleteUser, x) -} - -const C_MessageActionGroupCreated int64 = 2241024808 - -type poolMessageActionGroupCreated struct { - pool sync.Pool -} - -func (p *poolMessageActionGroupCreated) Get() *MessageActionGroupCreated { - x, ok := p.pool.Get().(*MessageActionGroupCreated) - if !ok { - x = &MessageActionGroupCreated{} - } - - return x -} - -func (p *poolMessageActionGroupCreated) Put(x *MessageActionGroupCreated) { - if x == nil { - return - } - - x.GroupTitle = "" - x.UserIDs = x.UserIDs[:0] - - p.pool.Put(x) -} - -var PoolMessageActionGroupCreated = poolMessageActionGroupCreated{} - -func (x *MessageActionGroupCreated) DeepCopy(z *MessageActionGroupCreated) { - z.GroupTitle = x.GroupTitle - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) -} - -func (x *MessageActionGroupCreated) Clone() *MessageActionGroupCreated { - z := &MessageActionGroupCreated{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionGroupCreated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionGroupCreated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionGroupCreated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionGroupCreated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionGroupCreated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionGroupCreated, x) -} - -const C_MessageActionGroupTitleChanged int64 = 2418464749 - -type poolMessageActionGroupTitleChanged struct { - pool sync.Pool -} - -func (p *poolMessageActionGroupTitleChanged) Get() *MessageActionGroupTitleChanged { - x, ok := p.pool.Get().(*MessageActionGroupTitleChanged) - if !ok { - x = &MessageActionGroupTitleChanged{} - } - - return x -} - -func (p *poolMessageActionGroupTitleChanged) Put(x *MessageActionGroupTitleChanged) { - if x == nil { - return - } - - x.GroupTitle = "" - - p.pool.Put(x) -} - -var PoolMessageActionGroupTitleChanged = poolMessageActionGroupTitleChanged{} - -func (x *MessageActionGroupTitleChanged) DeepCopy(z *MessageActionGroupTitleChanged) { - z.GroupTitle = x.GroupTitle -} - -func (x *MessageActionGroupTitleChanged) Clone() *MessageActionGroupTitleChanged { - z := &MessageActionGroupTitleChanged{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionGroupTitleChanged) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionGroupTitleChanged) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionGroupTitleChanged) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionGroupTitleChanged) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionGroupTitleChanged) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionGroupTitleChanged, x) -} - -const C_MessageActionGroupPhotoChanged int64 = 188265964 - -type poolMessageActionGroupPhotoChanged struct { - pool sync.Pool -} - -func (p *poolMessageActionGroupPhotoChanged) Get() *MessageActionGroupPhotoChanged { - x, ok := p.pool.Get().(*MessageActionGroupPhotoChanged) - if !ok { - x = &MessageActionGroupPhotoChanged{} - } - - x.Photo = PoolGroupPhoto.Get() - - return x -} - -func (p *poolMessageActionGroupPhotoChanged) Put(x *MessageActionGroupPhotoChanged) { - if x == nil { - return - } - - PoolGroupPhoto.Put(x.Photo) - - p.pool.Put(x) -} - -var PoolMessageActionGroupPhotoChanged = poolMessageActionGroupPhotoChanged{} - -func (x *MessageActionGroupPhotoChanged) DeepCopy(z *MessageActionGroupPhotoChanged) { - if x.Photo != nil { - if z.Photo == nil { - z.Photo = PoolGroupPhoto.Get() - } - x.Photo.DeepCopy(z.Photo) - } else { - PoolGroupPhoto.Put(z.Photo) - z.Photo = nil - } -} - -func (x *MessageActionGroupPhotoChanged) Clone() *MessageActionGroupPhotoChanged { - z := &MessageActionGroupPhotoChanged{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionGroupPhotoChanged) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionGroupPhotoChanged) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionGroupPhotoChanged) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionGroupPhotoChanged) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionGroupPhotoChanged) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionGroupPhotoChanged, x) -} - -const C_MessageActionClearHistory int64 = 1270465696 - -type poolMessageActionClearHistory struct { - pool sync.Pool -} - -func (p *poolMessageActionClearHistory) Get() *MessageActionClearHistory { - x, ok := p.pool.Get().(*MessageActionClearHistory) - if !ok { - x = &MessageActionClearHistory{} - } - - return x -} - -func (p *poolMessageActionClearHistory) Put(x *MessageActionClearHistory) { - if x == nil { - return - } - - x.MaxID = 0 - x.Delete = false - - p.pool.Put(x) -} - -var PoolMessageActionClearHistory = poolMessageActionClearHistory{} - -func (x *MessageActionClearHistory) DeepCopy(z *MessageActionClearHistory) { - z.MaxID = x.MaxID - z.Delete = x.Delete -} - -func (x *MessageActionClearHistory) Clone() *MessageActionClearHistory { - z := &MessageActionClearHistory{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionClearHistory) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionClearHistory) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionClearHistory) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionClearHistory) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionClearHistory) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionClearHistory, x) -} - -const C_MessageActionContactRegistered int64 = 2399156016 - -type poolMessageActionContactRegistered struct { - pool sync.Pool -} - -func (p *poolMessageActionContactRegistered) Get() *MessageActionContactRegistered { - x, ok := p.pool.Get().(*MessageActionContactRegistered) - if !ok { - x = &MessageActionContactRegistered{} - } - - return x -} - -func (p *poolMessageActionContactRegistered) Put(x *MessageActionContactRegistered) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolMessageActionContactRegistered = poolMessageActionContactRegistered{} - -func (x *MessageActionContactRegistered) DeepCopy(z *MessageActionContactRegistered) { -} - -func (x *MessageActionContactRegistered) Clone() *MessageActionContactRegistered { - z := &MessageActionContactRegistered{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionContactRegistered) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionContactRegistered) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionContactRegistered) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionContactRegistered) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionContactRegistered) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionContactRegistered, x) -} - -const C_MessageActionScreenShotTaken int64 = 2637201461 - -type poolMessageActionScreenShotTaken struct { - pool sync.Pool -} - -func (p *poolMessageActionScreenShotTaken) Get() *MessageActionScreenShotTaken { - x, ok := p.pool.Get().(*MessageActionScreenShotTaken) - if !ok { - x = &MessageActionScreenShotTaken{} - } - - return x -} - -func (p *poolMessageActionScreenShotTaken) Put(x *MessageActionScreenShotTaken) { - if x == nil { - return - } - - x.MinID = 0 - x.MaxID = 0 - - p.pool.Put(x) -} - -var PoolMessageActionScreenShotTaken = poolMessageActionScreenShotTaken{} - -func (x *MessageActionScreenShotTaken) DeepCopy(z *MessageActionScreenShotTaken) { - z.MinID = x.MinID - z.MaxID = x.MaxID -} - -func (x *MessageActionScreenShotTaken) Clone() *MessageActionScreenShotTaken { - z := &MessageActionScreenShotTaken{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionScreenShotTaken) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionScreenShotTaken) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionScreenShotTaken) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionScreenShotTaken) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionScreenShotTaken) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionScreenShotTaken, x) -} - -const C_MessageActionThreadClosed int64 = 1366382890 - -type poolMessageActionThreadClosed struct { - pool sync.Pool -} - -func (p *poolMessageActionThreadClosed) Get() *MessageActionThreadClosed { - x, ok := p.pool.Get().(*MessageActionThreadClosed) - if !ok { - x = &MessageActionThreadClosed{} - } - - return x -} - -func (p *poolMessageActionThreadClosed) Put(x *MessageActionThreadClosed) { - if x == nil { - return - } - - x.ThreadID = 0 - - p.pool.Put(x) -} - -var PoolMessageActionThreadClosed = poolMessageActionThreadClosed{} - -func (x *MessageActionThreadClosed) DeepCopy(z *MessageActionThreadClosed) { - z.ThreadID = x.ThreadID -} - -func (x *MessageActionThreadClosed) Clone() *MessageActionThreadClosed { - z := &MessageActionThreadClosed{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionThreadClosed) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionThreadClosed) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionThreadClosed) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionThreadClosed) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionThreadClosed) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionThreadClosed, x) -} - -const C_MessageActionCallStarted int64 = 3970382785 - -type poolMessageActionCallStarted struct { - pool sync.Pool -} - -func (p *poolMessageActionCallStarted) Get() *MessageActionCallStarted { - x, ok := p.pool.Get().(*MessageActionCallStarted) - if !ok { - x = &MessageActionCallStarted{} - } - - return x -} - -func (p *poolMessageActionCallStarted) Put(x *MessageActionCallStarted) { - if x == nil { - return - } - - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolMessageActionCallStarted = poolMessageActionCallStarted{} - -func (x *MessageActionCallStarted) DeepCopy(z *MessageActionCallStarted) { - z.CallID = x.CallID -} - -func (x *MessageActionCallStarted) Clone() *MessageActionCallStarted { - z := &MessageActionCallStarted{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionCallStarted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionCallStarted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionCallStarted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionCallStarted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionCallStarted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionCallStarted, x) -} - -const C_MessageActionCallEnded int64 = 62258227 - -type poolMessageActionCallEnded struct { - pool sync.Pool -} - -func (p *poolMessageActionCallEnded) Get() *MessageActionCallEnded { - x, ok := p.pool.Get().(*MessageActionCallEnded) - if !ok { - x = &MessageActionCallEnded{} - } - - return x -} - -func (p *poolMessageActionCallEnded) Put(x *MessageActionCallEnded) { - if x == nil { - return - } - - x.CallID = 0 - x.Reason = 0 - x.Duration = 0 - - p.pool.Put(x) -} - -var PoolMessageActionCallEnded = poolMessageActionCallEnded{} - -func (x *MessageActionCallEnded) DeepCopy(z *MessageActionCallEnded) { - z.CallID = x.CallID - z.Reason = x.Reason - z.Duration = x.Duration -} - -func (x *MessageActionCallEnded) Clone() *MessageActionCallEnded { - z := &MessageActionCallEnded{} - x.DeepCopy(z) - return z -} - -func (x *MessageActionCallEnded) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageActionCallEnded) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageActionCallEnded) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageActionCallEnded) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageActionCallEnded) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageActionCallEnded, x) -} - -func init() { - registry.RegisterConstructor(1949386261, "MessageActionGroupAddUser") - registry.RegisterConstructor(1213452128, "MessageActionGroupDeleteUser") - registry.RegisterConstructor(2241024808, "MessageActionGroupCreated") - registry.RegisterConstructor(2418464749, "MessageActionGroupTitleChanged") - registry.RegisterConstructor(188265964, "MessageActionGroupPhotoChanged") - registry.RegisterConstructor(1270465696, "MessageActionClearHistory") - registry.RegisterConstructor(2399156016, "MessageActionContactRegistered") - registry.RegisterConstructor(2637201461, "MessageActionScreenShotTaken") - registry.RegisterConstructor(1366382890, "MessageActionThreadClosed") - registry.RegisterConstructor(3970382785, "MessageActionCallStarted") - registry.RegisterConstructor(62258227, "MessageActionCallEnded") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.markups.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.markups.pb.go deleted file mode 100644 index f8aae189..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.markups.pb.go +++ /dev/null @@ -1,1036 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.messages.markups.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// ReplyKeyboardMarkup -type ReplyKeyboardMarkup struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Requests clients to hide the keyboard as soon as it's been used. - // The keyboard will still be available, but clients will automatically display the usual letter-keyboard - // in the chat – the user can press a special button in the input field - // to see the custom keyboard again. - SingleUse bool `protobuf:"varint,1,opt,name=SingleUse,proto3" json:"SingleUse,omitempty"` - // Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users - // that are @mentioned in the text of the Message object; 2) if the bot's message is a reply - // (has reply_to_message_id), sender of the original message. - // Example: A user requests to change the bot‘s language, bot replies to the request with a keyboard - // to select the new language. Other users in the group don’t see the keyboard. - Selective bool `protobuf:"varint,2,opt,name=Selective,proto3" json:"Selective,omitempty"` - // Requests clients to resize the keyboard vertically for optimal fit - // (e.g., make the keyboard smaller if there are just two rows of buttons). If not set, the custom - // keyboard is always of the same height as the app's standard keyboard. - Resize bool `protobuf:"varint,3,opt,name=Resize,proto3" json:"Resize,omitempty"` - Rows []*KeyboardButtonRow `protobuf:"bytes,4,rep,name=Rows,proto3" json:"Rows,omitempty"` -} - -func (x *ReplyKeyboardMarkup) Reset() { - *x = ReplyKeyboardMarkup{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReplyKeyboardMarkup) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReplyKeyboardMarkup) ProtoMessage() {} - -func (x *ReplyKeyboardMarkup) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReplyKeyboardMarkup.ProtoReflect.Descriptor instead. -func (*ReplyKeyboardMarkup) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{0} -} - -func (x *ReplyKeyboardMarkup) GetSingleUse() bool { - if x != nil { - return x.SingleUse - } - return false -} - -func (x *ReplyKeyboardMarkup) GetSelective() bool { - if x != nil { - return x.Selective - } - return false -} - -func (x *ReplyKeyboardMarkup) GetResize() bool { - if x != nil { - return x.Resize - } - return false -} - -func (x *ReplyKeyboardMarkup) GetRows() []*KeyboardButtonRow { - if x != nil { - return x.Rows - } - return nil -} - -// ReplyInlineMarkup -type ReplyInlineMarkup struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Rows []*KeyboardButtonRow `protobuf:"bytes,1,rep,name=Rows,proto3" json:"Rows,omitempty"` -} - -func (x *ReplyInlineMarkup) Reset() { - *x = ReplyInlineMarkup{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReplyInlineMarkup) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReplyInlineMarkup) ProtoMessage() {} - -func (x *ReplyInlineMarkup) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReplyInlineMarkup.ProtoReflect.Descriptor instead. -func (*ReplyInlineMarkup) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{1} -} - -func (x *ReplyInlineMarkup) GetRows() []*KeyboardButtonRow { - if x != nil { - return x.Rows - } - return nil -} - -// ReplyKeyboardHide -type ReplyKeyboardHide struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Use this flag if you want to remove the keyboard for specific users only. Targets: - // 1) users that are @mentioned in the text of the Message object; - // 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. - Selective bool `protobuf:"varint,1,opt,name=Selective,proto3" json:"Selective,omitempty"` -} - -func (x *ReplyKeyboardHide) Reset() { - *x = ReplyKeyboardHide{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReplyKeyboardHide) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReplyKeyboardHide) ProtoMessage() {} - -func (x *ReplyKeyboardHide) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReplyKeyboardHide.ProtoReflect.Descriptor instead. -func (*ReplyKeyboardHide) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{2} -} - -func (x *ReplyKeyboardHide) GetSelective() bool { - if x != nil { - return x.Selective - } - return false -} - -// ReplyKeyboardHide -// Force the user to send a reply -type ReplyKeyboardForceReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Requests clients to hide the keyboard as soon as it's been used. - // The keyboard will still be available, but clients will automatically display the usual letter-keyboard - // in the chat – the user can press a special button in the input field - // to see the custom keyboard again. - SingleUse bool `protobuf:"varint,1,opt,name=SingleUse,proto3" json:"SingleUse,omitempty"` - // Use this flag if you want to remove the keyboard for specific users only. Targets: - // 1) users that are @mentioned in the text of the Message object; - // 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message. - Selective bool `protobuf:"varint,2,opt,name=Selective,proto3" json:"Selective,omitempty"` -} - -func (x *ReplyKeyboardForceReply) Reset() { - *x = ReplyKeyboardForceReply{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReplyKeyboardForceReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReplyKeyboardForceReply) ProtoMessage() {} - -func (x *ReplyKeyboardForceReply) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReplyKeyboardForceReply.ProtoReflect.Descriptor instead. -func (*ReplyKeyboardForceReply) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{3} -} - -func (x *ReplyKeyboardForceReply) GetSingleUse() bool { - if x != nil { - return x.SingleUse - } - return false -} - -func (x *ReplyKeyboardForceReply) GetSelective() bool { - if x != nil { - return x.Selective - } - return false -} - -// KeyboardButtonRow -// This is a list of buttons -type KeyboardButtonRow struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Buttons []*KeyboardButtonEnvelope `protobuf:"bytes,1,rep,name=Buttons,proto3" json:"Buttons,omitempty"` -} - -func (x *KeyboardButtonRow) Reset() { - *x = KeyboardButtonRow{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *KeyboardButtonRow) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyboardButtonRow) ProtoMessage() {} - -func (x *KeyboardButtonRow) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyboardButtonRow.ProtoReflect.Descriptor instead. -func (*KeyboardButtonRow) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{4} -} - -func (x *KeyboardButtonRow) GetButtons() []*KeyboardButtonEnvelope { - if x != nil { - return x.Buttons - } - return nil -} - -// KeyboardButtonEnvelope -// This is an envelope for buttons -type KeyboardButtonEnvelope struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Constructor int64 `protobuf:"varint,1,opt,name=Constructor,proto3" json:"Constructor,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"` -} - -func (x *KeyboardButtonEnvelope) Reset() { - *x = KeyboardButtonEnvelope{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *KeyboardButtonEnvelope) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyboardButtonEnvelope) ProtoMessage() {} - -func (x *KeyboardButtonEnvelope) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyboardButtonEnvelope.ProtoReflect.Descriptor instead. -func (*KeyboardButtonEnvelope) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{5} -} - -func (x *KeyboardButtonEnvelope) GetConstructor() int64 { - if x != nil { - return x.Constructor - } - return 0 -} - -func (x *KeyboardButtonEnvelope) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -// Button -// This button do nothing and is just showing a text -type Button struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` -} - -func (x *Button) Reset() { - *x = Button{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Button) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Button) ProtoMessage() {} - -func (x *Button) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Button.ProtoReflect.Descriptor instead. -func (*Button) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{6} -} - -func (x *Button) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -// ButtonUrl -// Client must open the url -type ButtonUrl struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` - Url string `protobuf:"bytes,2,opt,name=Url,proto3" json:"Url,omitempty"` -} - -func (x *ButtonUrl) Reset() { - *x = ButtonUrl{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ButtonUrl) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ButtonUrl) ProtoMessage() {} - -func (x *ButtonUrl) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ButtonUrl.ProtoReflect.Descriptor instead. -func (*ButtonUrl) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{7} -} - -func (x *ButtonUrl) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *ButtonUrl) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -// ButtonCallback -// Client must use BotGetCallbackQuery to get a CallbackAnswer from the bot -type ButtonCallback struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"` -} - -func (x *ButtonCallback) Reset() { - *x = ButtonCallback{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ButtonCallback) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ButtonCallback) ProtoMessage() {} - -func (x *ButtonCallback) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ButtonCallback.ProtoReflect.Descriptor instead. -func (*ButtonCallback) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{8} -} - -func (x *ButtonCallback) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *ButtonCallback) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -// ButtonRequestPhone -// Button to request a user's phone number -type ButtonRequestPhone struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` -} - -func (x *ButtonRequestPhone) Reset() { - *x = ButtonRequestPhone{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ButtonRequestPhone) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ButtonRequestPhone) ProtoMessage() {} - -func (x *ButtonRequestPhone) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ButtonRequestPhone.ProtoReflect.Descriptor instead. -func (*ButtonRequestPhone) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{9} -} - -func (x *ButtonRequestPhone) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -// ButtonRequestGeoLocation -// Button to request a user's geolocation -type ButtonRequestGeoLocation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` -} - -func (x *ButtonRequestGeoLocation) Reset() { - *x = ButtonRequestGeoLocation{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ButtonRequestGeoLocation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ButtonRequestGeoLocation) ProtoMessage() {} - -func (x *ButtonRequestGeoLocation) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ButtonRequestGeoLocation.ProtoReflect.Descriptor instead. -func (*ButtonRequestGeoLocation) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{10} -} - -func (x *ButtonRequestGeoLocation) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -// ButtonSwitchInline -// Button to force a user to switch to inline mode Pressing the button will prompt the user -// to select one of their chats, open that chat and insert the bot‘s username and the -// specified inline query in the input field. -type ButtonSwitchInline struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` - Query string `protobuf:"bytes,2,opt,name=Query,proto3" json:"Query,omitempty"` - SamePeer bool `protobuf:"varint,3,opt,name=SamePeer,proto3" json:"SamePeer,omitempty"` -} - -func (x *ButtonSwitchInline) Reset() { - *x = ButtonSwitchInline{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ButtonSwitchInline) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ButtonSwitchInline) ProtoMessage() {} - -func (x *ButtonSwitchInline) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ButtonSwitchInline.ProtoReflect.Descriptor instead. -func (*ButtonSwitchInline) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{11} -} - -func (x *ButtonSwitchInline) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *ButtonSwitchInline) GetQuery() string { - if x != nil { - return x.Query - } - return "" -} - -func (x *ButtonSwitchInline) GetSamePeer() bool { - if x != nil { - return x.SamePeer - } - return false -} - -// ButtonBuy -// Button to buy a product -type ButtonBuy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` -} - -func (x *ButtonBuy) Reset() { - *x = ButtonBuy{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_markups_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ButtonBuy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ButtonBuy) ProtoMessage() {} - -func (x *ButtonBuy) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_markups_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ButtonBuy.ProtoReflect.Descriptor instead. -func (*ButtonBuy) Descriptor() ([]byte, []int) { - return file_chat_messages_markups_proto_rawDescGZIP(), []int{12} -} - -func (x *ButtonBuy) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -var File_chat_messages_markups_proto protoreflect.FileDescriptor - -var file_chat_messages_markups_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, - 0x6d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, - 0x73, 0x67, 0x22, 0x95, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4b, 0x65, 0x79, 0x62, - 0x6f, 0x61, 0x72, 0x64, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x53, - 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x53, 0x65, 0x6c, - 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x2a, - 0x0a, 0x04, 0x52, 0x6f, 0x77, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x4b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x42, 0x75, 0x74, 0x74, 0x6f, - 0x6e, 0x52, 0x6f, 0x77, 0x52, 0x04, 0x52, 0x6f, 0x77, 0x73, 0x22, 0x3f, 0x0a, 0x11, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x12, - 0x2a, 0x0a, 0x04, 0x52, 0x6f, 0x77, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x4b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x42, 0x75, 0x74, 0x74, - 0x6f, 0x6e, 0x52, 0x6f, 0x77, 0x52, 0x04, 0x52, 0x6f, 0x77, 0x73, 0x22, 0x31, 0x0a, 0x11, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x4b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x48, 0x69, 0x64, 0x65, - 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x55, - 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x46, - 0x6f, 0x72, 0x63, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x69, 0x6e, - 0x67, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x53, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x55, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x53, 0x65, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x4a, 0x0a, 0x11, 0x4b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, - 0x64, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x52, 0x6f, 0x77, 0x12, 0x35, 0x0a, 0x07, 0x42, 0x75, - 0x74, 0x74, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x4b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, - 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x07, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, - 0x73, 0x22, 0x4e, 0x0a, 0x16, 0x4b, 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x42, 0x75, 0x74, - 0x74, 0x6f, 0x6e, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x43, - 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0b, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, - 0x61, 0x22, 0x1c, 0x0a, 0x06, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x54, - 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, 0x22, - 0x31, 0x0a, 0x09, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, - 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, - 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, - 0x72, 0x6c, 0x22, 0x38, 0x0a, 0x0e, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, - 0x62, 0x61, 0x63, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x28, 0x0a, 0x12, - 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, 0x22, 0x2e, 0x0a, 0x18, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x47, 0x65, 0x6f, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, 0x22, 0x5a, 0x0a, 0x12, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, - 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, - 0x12, 0x14, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x61, 0x6d, 0x65, 0x50, 0x65, - 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x53, 0x61, 0x6d, 0x65, 0x50, 0x65, - 0x65, 0x72, 0x22, 0x1f, 0x0a, 0x09, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x42, 0x75, 0x79, 0x12, - 0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, - 0x65, 0x78, 0x74, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_chat_messages_markups_proto_rawDescOnce sync.Once - file_chat_messages_markups_proto_rawDescData = file_chat_messages_markups_proto_rawDesc -) - -func file_chat_messages_markups_proto_rawDescGZIP() []byte { - file_chat_messages_markups_proto_rawDescOnce.Do(func() { - file_chat_messages_markups_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_messages_markups_proto_rawDescData) - }) - return file_chat_messages_markups_proto_rawDescData -} - -var file_chat_messages_markups_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_chat_messages_markups_proto_goTypes = []interface{}{ - (*ReplyKeyboardMarkup)(nil), // 0: msg.ReplyKeyboardMarkup - (*ReplyInlineMarkup)(nil), // 1: msg.ReplyInlineMarkup - (*ReplyKeyboardHide)(nil), // 2: msg.ReplyKeyboardHide - (*ReplyKeyboardForceReply)(nil), // 3: msg.ReplyKeyboardForceReply - (*KeyboardButtonRow)(nil), // 4: msg.KeyboardButtonRow - (*KeyboardButtonEnvelope)(nil), // 5: msg.KeyboardButtonEnvelope - (*Button)(nil), // 6: msg.Button - (*ButtonUrl)(nil), // 7: msg.ButtonUrl - (*ButtonCallback)(nil), // 8: msg.ButtonCallback - (*ButtonRequestPhone)(nil), // 9: msg.ButtonRequestPhone - (*ButtonRequestGeoLocation)(nil), // 10: msg.ButtonRequestGeoLocation - (*ButtonSwitchInline)(nil), // 11: msg.ButtonSwitchInline - (*ButtonBuy)(nil), // 12: msg.ButtonBuy -} -var file_chat_messages_markups_proto_depIdxs = []int32{ - 4, // 0: msg.ReplyKeyboardMarkup.Rows:type_name -> msg.KeyboardButtonRow - 4, // 1: msg.ReplyInlineMarkup.Rows:type_name -> msg.KeyboardButtonRow - 5, // 2: msg.KeyboardButtonRow.Buttons:type_name -> msg.KeyboardButtonEnvelope - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_chat_messages_markups_proto_init() } -func file_chat_messages_markups_proto_init() { - if File_chat_messages_markups_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_chat_messages_markups_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReplyKeyboardMarkup); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReplyInlineMarkup); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReplyKeyboardHide); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReplyKeyboardForceReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyboardButtonRow); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyboardButtonEnvelope); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Button); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ButtonUrl); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ButtonCallback); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ButtonRequestPhone); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ButtonRequestGeoLocation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ButtonSwitchInline); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_markups_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ButtonBuy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_messages_markups_proto_rawDesc, - NumEnums: 0, - NumMessages: 13, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_messages_markups_proto_goTypes, - DependencyIndexes: file_chat_messages_markups_proto_depIdxs, - MessageInfos: file_chat_messages_markups_proto_msgTypes, - }.Build() - File_chat_messages_markups_proto = out.File - file_chat_messages_markups_proto_rawDesc = nil - file_chat_messages_markups_proto_goTypes = nil - file_chat_messages_markups_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.markups.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.markups.rony.go deleted file mode 100644 index df564009..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.markups.rony.go +++ /dev/null @@ -1,825 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.messages.markups.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_ReplyKeyboardMarkup int64 = 3207405102 - -type poolReplyKeyboardMarkup struct { - pool sync.Pool -} - -func (p *poolReplyKeyboardMarkup) Get() *ReplyKeyboardMarkup { - x, ok := p.pool.Get().(*ReplyKeyboardMarkup) - if !ok { - x = &ReplyKeyboardMarkup{} - } - - return x -} - -func (p *poolReplyKeyboardMarkup) Put(x *ReplyKeyboardMarkup) { - if x == nil { - return - } - - x.SingleUse = false - x.Selective = false - x.Resize = false - for _, z := range x.Rows { - PoolKeyboardButtonRow.Put(z) - } - x.Rows = x.Rows[:0] - - p.pool.Put(x) -} - -var PoolReplyKeyboardMarkup = poolReplyKeyboardMarkup{} - -func (x *ReplyKeyboardMarkup) DeepCopy(z *ReplyKeyboardMarkup) { - z.SingleUse = x.SingleUse - z.Selective = x.Selective - z.Resize = x.Resize - for idx := range x.Rows { - if x.Rows[idx] == nil { - continue - } - xx := PoolKeyboardButtonRow.Get() - x.Rows[idx].DeepCopy(xx) - z.Rows = append(z.Rows, xx) - } -} - -func (x *ReplyKeyboardMarkup) Clone() *ReplyKeyboardMarkup { - z := &ReplyKeyboardMarkup{} - x.DeepCopy(z) - return z -} - -func (x *ReplyKeyboardMarkup) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ReplyKeyboardMarkup) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ReplyKeyboardMarkup) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ReplyKeyboardMarkup) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ReplyKeyboardMarkup) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ReplyKeyboardMarkup, x) -} - -const C_ReplyInlineMarkup int64 = 2436413989 - -type poolReplyInlineMarkup struct { - pool sync.Pool -} - -func (p *poolReplyInlineMarkup) Get() *ReplyInlineMarkup { - x, ok := p.pool.Get().(*ReplyInlineMarkup) - if !ok { - x = &ReplyInlineMarkup{} - } - - return x -} - -func (p *poolReplyInlineMarkup) Put(x *ReplyInlineMarkup) { - if x == nil { - return - } - - for _, z := range x.Rows { - PoolKeyboardButtonRow.Put(z) - } - x.Rows = x.Rows[:0] - - p.pool.Put(x) -} - -var PoolReplyInlineMarkup = poolReplyInlineMarkup{} - -func (x *ReplyInlineMarkup) DeepCopy(z *ReplyInlineMarkup) { - for idx := range x.Rows { - if x.Rows[idx] == nil { - continue - } - xx := PoolKeyboardButtonRow.Get() - x.Rows[idx].DeepCopy(xx) - z.Rows = append(z.Rows, xx) - } -} - -func (x *ReplyInlineMarkup) Clone() *ReplyInlineMarkup { - z := &ReplyInlineMarkup{} - x.DeepCopy(z) - return z -} - -func (x *ReplyInlineMarkup) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ReplyInlineMarkup) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ReplyInlineMarkup) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ReplyInlineMarkup) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ReplyInlineMarkup) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ReplyInlineMarkup, x) -} - -const C_ReplyKeyboardHide int64 = 3134153306 - -type poolReplyKeyboardHide struct { - pool sync.Pool -} - -func (p *poolReplyKeyboardHide) Get() *ReplyKeyboardHide { - x, ok := p.pool.Get().(*ReplyKeyboardHide) - if !ok { - x = &ReplyKeyboardHide{} - } - - return x -} - -func (p *poolReplyKeyboardHide) Put(x *ReplyKeyboardHide) { - if x == nil { - return - } - - x.Selective = false - - p.pool.Put(x) -} - -var PoolReplyKeyboardHide = poolReplyKeyboardHide{} - -func (x *ReplyKeyboardHide) DeepCopy(z *ReplyKeyboardHide) { - z.Selective = x.Selective -} - -func (x *ReplyKeyboardHide) Clone() *ReplyKeyboardHide { - z := &ReplyKeyboardHide{} - x.DeepCopy(z) - return z -} - -func (x *ReplyKeyboardHide) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ReplyKeyboardHide) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ReplyKeyboardHide) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ReplyKeyboardHide) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ReplyKeyboardHide) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ReplyKeyboardHide, x) -} - -const C_ReplyKeyboardForceReply int64 = 258469686 - -type poolReplyKeyboardForceReply struct { - pool sync.Pool -} - -func (p *poolReplyKeyboardForceReply) Get() *ReplyKeyboardForceReply { - x, ok := p.pool.Get().(*ReplyKeyboardForceReply) - if !ok { - x = &ReplyKeyboardForceReply{} - } - - return x -} - -func (p *poolReplyKeyboardForceReply) Put(x *ReplyKeyboardForceReply) { - if x == nil { - return - } - - x.SingleUse = false - x.Selective = false - - p.pool.Put(x) -} - -var PoolReplyKeyboardForceReply = poolReplyKeyboardForceReply{} - -func (x *ReplyKeyboardForceReply) DeepCopy(z *ReplyKeyboardForceReply) { - z.SingleUse = x.SingleUse - z.Selective = x.Selective -} - -func (x *ReplyKeyboardForceReply) Clone() *ReplyKeyboardForceReply { - z := &ReplyKeyboardForceReply{} - x.DeepCopy(z) - return z -} - -func (x *ReplyKeyboardForceReply) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ReplyKeyboardForceReply) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ReplyKeyboardForceReply) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ReplyKeyboardForceReply) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ReplyKeyboardForceReply) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ReplyKeyboardForceReply, x) -} - -const C_KeyboardButtonRow int64 = 2222403758 - -type poolKeyboardButtonRow struct { - pool sync.Pool -} - -func (p *poolKeyboardButtonRow) Get() *KeyboardButtonRow { - x, ok := p.pool.Get().(*KeyboardButtonRow) - if !ok { - x = &KeyboardButtonRow{} - } - - return x -} - -func (p *poolKeyboardButtonRow) Put(x *KeyboardButtonRow) { - if x == nil { - return - } - - for _, z := range x.Buttons { - PoolKeyboardButtonEnvelope.Put(z) - } - x.Buttons = x.Buttons[:0] - - p.pool.Put(x) -} - -var PoolKeyboardButtonRow = poolKeyboardButtonRow{} - -func (x *KeyboardButtonRow) DeepCopy(z *KeyboardButtonRow) { - for idx := range x.Buttons { - if x.Buttons[idx] == nil { - continue - } - xx := PoolKeyboardButtonEnvelope.Get() - x.Buttons[idx].DeepCopy(xx) - z.Buttons = append(z.Buttons, xx) - } -} - -func (x *KeyboardButtonRow) Clone() *KeyboardButtonRow { - z := &KeyboardButtonRow{} - x.DeepCopy(z) - return z -} - -func (x *KeyboardButtonRow) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *KeyboardButtonRow) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *KeyboardButtonRow) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *KeyboardButtonRow) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *KeyboardButtonRow) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_KeyboardButtonRow, x) -} - -const C_KeyboardButtonEnvelope int64 = 2639543624 - -type poolKeyboardButtonEnvelope struct { - pool sync.Pool -} - -func (p *poolKeyboardButtonEnvelope) Get() *KeyboardButtonEnvelope { - x, ok := p.pool.Get().(*KeyboardButtonEnvelope) - if !ok { - x = &KeyboardButtonEnvelope{} - } - - return x -} - -func (p *poolKeyboardButtonEnvelope) Put(x *KeyboardButtonEnvelope) { - if x == nil { - return - } - - x.Constructor = 0 - x.Data = x.Data[:0] - - p.pool.Put(x) -} - -var PoolKeyboardButtonEnvelope = poolKeyboardButtonEnvelope{} - -func (x *KeyboardButtonEnvelope) DeepCopy(z *KeyboardButtonEnvelope) { - z.Constructor = x.Constructor - z.Data = append(z.Data[:0], x.Data...) -} - -func (x *KeyboardButtonEnvelope) Clone() *KeyboardButtonEnvelope { - z := &KeyboardButtonEnvelope{} - x.DeepCopy(z) - return z -} - -func (x *KeyboardButtonEnvelope) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *KeyboardButtonEnvelope) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *KeyboardButtonEnvelope) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *KeyboardButtonEnvelope) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *KeyboardButtonEnvelope) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_KeyboardButtonEnvelope, x) -} - -const C_Button int64 = 1034594571 - -type poolButton struct { - pool sync.Pool -} - -func (p *poolButton) Get() *Button { - x, ok := p.pool.Get().(*Button) - if !ok { - x = &Button{} - } - - return x -} - -func (p *poolButton) Put(x *Button) { - if x == nil { - return - } - - x.Text = "" - - p.pool.Put(x) -} - -var PoolButton = poolButton{} - -func (x *Button) DeepCopy(z *Button) { - z.Text = x.Text -} - -func (x *Button) Clone() *Button { - z := &Button{} - x.DeepCopy(z) - return z -} - -func (x *Button) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Button) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Button) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Button) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Button) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Button, x) -} - -const C_ButtonUrl int64 = 2309530052 - -type poolButtonUrl struct { - pool sync.Pool -} - -func (p *poolButtonUrl) Get() *ButtonUrl { - x, ok := p.pool.Get().(*ButtonUrl) - if !ok { - x = &ButtonUrl{} - } - - return x -} - -func (p *poolButtonUrl) Put(x *ButtonUrl) { - if x == nil { - return - } - - x.Text = "" - x.Url = "" - - p.pool.Put(x) -} - -var PoolButtonUrl = poolButtonUrl{} - -func (x *ButtonUrl) DeepCopy(z *ButtonUrl) { - z.Text = x.Text - z.Url = x.Url -} - -func (x *ButtonUrl) Clone() *ButtonUrl { - z := &ButtonUrl{} - x.DeepCopy(z) - return z -} - -func (x *ButtonUrl) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ButtonUrl) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ButtonUrl) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ButtonUrl) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ButtonUrl) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ButtonUrl, x) -} - -const C_ButtonCallback int64 = 4007711268 - -type poolButtonCallback struct { - pool sync.Pool -} - -func (p *poolButtonCallback) Get() *ButtonCallback { - x, ok := p.pool.Get().(*ButtonCallback) - if !ok { - x = &ButtonCallback{} - } - - return x -} - -func (p *poolButtonCallback) Put(x *ButtonCallback) { - if x == nil { - return - } - - x.Text = "" - x.Data = x.Data[:0] - - p.pool.Put(x) -} - -var PoolButtonCallback = poolButtonCallback{} - -func (x *ButtonCallback) DeepCopy(z *ButtonCallback) { - z.Text = x.Text - z.Data = append(z.Data[:0], x.Data...) -} - -func (x *ButtonCallback) Clone() *ButtonCallback { - z := &ButtonCallback{} - x.DeepCopy(z) - return z -} - -func (x *ButtonCallback) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ButtonCallback) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ButtonCallback) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ButtonCallback) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ButtonCallback) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ButtonCallback, x) -} - -const C_ButtonRequestPhone int64 = 630958494 - -type poolButtonRequestPhone struct { - pool sync.Pool -} - -func (p *poolButtonRequestPhone) Get() *ButtonRequestPhone { - x, ok := p.pool.Get().(*ButtonRequestPhone) - if !ok { - x = &ButtonRequestPhone{} - } - - return x -} - -func (p *poolButtonRequestPhone) Put(x *ButtonRequestPhone) { - if x == nil { - return - } - - x.Text = "" - - p.pool.Put(x) -} - -var PoolButtonRequestPhone = poolButtonRequestPhone{} - -func (x *ButtonRequestPhone) DeepCopy(z *ButtonRequestPhone) { - z.Text = x.Text -} - -func (x *ButtonRequestPhone) Clone() *ButtonRequestPhone { - z := &ButtonRequestPhone{} - x.DeepCopy(z) - return z -} - -func (x *ButtonRequestPhone) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ButtonRequestPhone) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ButtonRequestPhone) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ButtonRequestPhone) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ButtonRequestPhone) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ButtonRequestPhone, x) -} - -const C_ButtonRequestGeoLocation int64 = 323515934 - -type poolButtonRequestGeoLocation struct { - pool sync.Pool -} - -func (p *poolButtonRequestGeoLocation) Get() *ButtonRequestGeoLocation { - x, ok := p.pool.Get().(*ButtonRequestGeoLocation) - if !ok { - x = &ButtonRequestGeoLocation{} - } - - return x -} - -func (p *poolButtonRequestGeoLocation) Put(x *ButtonRequestGeoLocation) { - if x == nil { - return - } - - x.Text = "" - - p.pool.Put(x) -} - -var PoolButtonRequestGeoLocation = poolButtonRequestGeoLocation{} - -func (x *ButtonRequestGeoLocation) DeepCopy(z *ButtonRequestGeoLocation) { - z.Text = x.Text -} - -func (x *ButtonRequestGeoLocation) Clone() *ButtonRequestGeoLocation { - z := &ButtonRequestGeoLocation{} - x.DeepCopy(z) - return z -} - -func (x *ButtonRequestGeoLocation) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ButtonRequestGeoLocation) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ButtonRequestGeoLocation) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ButtonRequestGeoLocation) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ButtonRequestGeoLocation) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ButtonRequestGeoLocation, x) -} - -const C_ButtonSwitchInline int64 = 3842667878 - -type poolButtonSwitchInline struct { - pool sync.Pool -} - -func (p *poolButtonSwitchInline) Get() *ButtonSwitchInline { - x, ok := p.pool.Get().(*ButtonSwitchInline) - if !ok { - x = &ButtonSwitchInline{} - } - - return x -} - -func (p *poolButtonSwitchInline) Put(x *ButtonSwitchInline) { - if x == nil { - return - } - - x.Text = "" - x.Query = "" - x.SamePeer = false - - p.pool.Put(x) -} - -var PoolButtonSwitchInline = poolButtonSwitchInline{} - -func (x *ButtonSwitchInline) DeepCopy(z *ButtonSwitchInline) { - z.Text = x.Text - z.Query = x.Query - z.SamePeer = x.SamePeer -} - -func (x *ButtonSwitchInline) Clone() *ButtonSwitchInline { - z := &ButtonSwitchInline{} - x.DeepCopy(z) - return z -} - -func (x *ButtonSwitchInline) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ButtonSwitchInline) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ButtonSwitchInline) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ButtonSwitchInline) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ButtonSwitchInline) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ButtonSwitchInline, x) -} - -const C_ButtonBuy int64 = 2992465437 - -type poolButtonBuy struct { - pool sync.Pool -} - -func (p *poolButtonBuy) Get() *ButtonBuy { - x, ok := p.pool.Get().(*ButtonBuy) - if !ok { - x = &ButtonBuy{} - } - - return x -} - -func (p *poolButtonBuy) Put(x *ButtonBuy) { - if x == nil { - return - } - - x.Text = "" - - p.pool.Put(x) -} - -var PoolButtonBuy = poolButtonBuy{} - -func (x *ButtonBuy) DeepCopy(z *ButtonBuy) { - z.Text = x.Text -} - -func (x *ButtonBuy) Clone() *ButtonBuy { - z := &ButtonBuy{} - x.DeepCopy(z) - return z -} - -func (x *ButtonBuy) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ButtonBuy) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ButtonBuy) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ButtonBuy) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ButtonBuy) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ButtonBuy, x) -} - -func init() { - registry.RegisterConstructor(3207405102, "ReplyKeyboardMarkup") - registry.RegisterConstructor(2436413989, "ReplyInlineMarkup") - registry.RegisterConstructor(3134153306, "ReplyKeyboardHide") - registry.RegisterConstructor(258469686, "ReplyKeyboardForceReply") - registry.RegisterConstructor(2222403758, "KeyboardButtonRow") - registry.RegisterConstructor(2639543624, "KeyboardButtonEnvelope") - registry.RegisterConstructor(1034594571, "Button") - registry.RegisterConstructor(2309530052, "ButtonUrl") - registry.RegisterConstructor(4007711268, "ButtonCallback") - registry.RegisterConstructor(630958494, "ButtonRequestPhone") - registry.RegisterConstructor(323515934, "ButtonRequestGeoLocation") - registry.RegisterConstructor(3842667878, "ButtonSwitchInline") - registry.RegisterConstructor(2992465437, "ButtonBuy") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.medias.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.medias.pb.go deleted file mode 100644 index 122d355b..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.medias.pb.go +++ /dev/null @@ -1,2506 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.messages.medias.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// Document Type -type DocumentType int32 - -const ( - DocumentType_DocumentTypeUnknown DocumentType = 0 - DocumentType_DocumentTypePhoto DocumentType = 1 - DocumentType_DocumentTypeVoice DocumentType = 2 - DocumentType_DocumentTypeVideo DocumentType = 3 - DocumentType_DocumentTypeWebPage DocumentType = 4 - DocumentType_DocumentTypeReserved1 DocumentType = 5 - DocumentType_DocumentTypeReserved2 DocumentType = 6 - DocumentType_DocumentTypeReserved3 DocumentType = 7 - DocumentType_DocumentTypeReserved4 DocumentType = 8 -) - -// Enum value maps for DocumentType. -var ( - DocumentType_name = map[int32]string{ - 0: "DocumentTypeUnknown", - 1: "DocumentTypePhoto", - 2: "DocumentTypeVoice", - 3: "DocumentTypeVideo", - 4: "DocumentTypeWebPage", - 5: "DocumentTypeReserved1", - 6: "DocumentTypeReserved2", - 7: "DocumentTypeReserved3", - 8: "DocumentTypeReserved4", - } - DocumentType_value = map[string]int32{ - "DocumentTypeUnknown": 0, - "DocumentTypePhoto": 1, - "DocumentTypeVoice": 2, - "DocumentTypeVideo": 3, - "DocumentTypeWebPage": 4, - "DocumentTypeReserved1": 5, - "DocumentTypeReserved2": 6, - "DocumentTypeReserved3": 7, - "DocumentTypeReserved4": 8, - } -) - -func (x DocumentType) Enum() *DocumentType { - p := new(DocumentType) - *p = x - return p -} - -func (x DocumentType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (DocumentType) Descriptor() protoreflect.EnumDescriptor { - return file_chat_messages_medias_proto_enumTypes[0].Descriptor() -} - -func (DocumentType) Type() protoreflect.EnumType { - return &file_chat_messages_medias_proto_enumTypes[0] -} - -func (x DocumentType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use DocumentType.Descriptor instead. -func (DocumentType) EnumDescriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{0} -} - -// DocumentAttributeType -type DocumentAttributeType int32 - -const ( - DocumentAttributeType_AttributeTypeNone DocumentAttributeType = 0 - DocumentAttributeType_AttributeTypeAudio DocumentAttributeType = 1 - DocumentAttributeType_AttributeTypeVideo DocumentAttributeType = 2 - DocumentAttributeType_AttributeTypePhoto DocumentAttributeType = 3 - DocumentAttributeType_AttributeTypeFile DocumentAttributeType = 4 - DocumentAttributeType_AttributeTypeAnimated DocumentAttributeType = 5 - DocumentAttributeType_AttributeTypeVoiceCall DocumentAttributeType = 6 - DocumentAttributeType_AttributeReserved2 DocumentAttributeType = 7 - DocumentAttributeType_AttributeReserved3 DocumentAttributeType = 8 - DocumentAttributeType_AttributeReserved4 DocumentAttributeType = 9 -) - -// Enum value maps for DocumentAttributeType. -var ( - DocumentAttributeType_name = map[int32]string{ - 0: "AttributeTypeNone", - 1: "AttributeTypeAudio", - 2: "AttributeTypeVideo", - 3: "AttributeTypePhoto", - 4: "AttributeTypeFile", - 5: "AttributeTypeAnimated", - 6: "AttributeTypeVoiceCall", - 7: "AttributeReserved2", - 8: "AttributeReserved3", - 9: "AttributeReserved4", - } - DocumentAttributeType_value = map[string]int32{ - "AttributeTypeNone": 0, - "AttributeTypeAudio": 1, - "AttributeTypeVideo": 2, - "AttributeTypePhoto": 3, - "AttributeTypeFile": 4, - "AttributeTypeAnimated": 5, - "AttributeTypeVoiceCall": 6, - "AttributeReserved2": 7, - "AttributeReserved3": 8, - "AttributeReserved4": 9, - } -) - -func (x DocumentAttributeType) Enum() *DocumentAttributeType { - p := new(DocumentAttributeType) - *p = x - return p -} - -func (x DocumentAttributeType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (DocumentAttributeType) Descriptor() protoreflect.EnumDescriptor { - return file_chat_messages_medias_proto_enumTypes[1].Descriptor() -} - -func (DocumentAttributeType) Type() protoreflect.EnumType { - return &file_chat_messages_medias_proto_enumTypes[1] -} - -func (x DocumentAttributeType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use DocumentAttributeType.Descriptor instead. -func (DocumentAttributeType) EnumDescriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{1} -} - -type DocumentAttributeVoiceCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MaxCallAttempts uint32 `protobuf:"varint,1,opt,name=MaxCallAttempts,proto3" json:"MaxCallAttempts,omitempty"` - CallAttemptSleep uint32 `protobuf:"varint,2,opt,name=CallAttemptSleep,proto3" json:"CallAttemptSleep,omitempty"` // In Seconds -} - -func (x *DocumentAttributeVoiceCall) Reset() { - *x = DocumentAttributeVoiceCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentAttributeVoiceCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentAttributeVoiceCall) ProtoMessage() {} - -func (x *DocumentAttributeVoiceCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DocumentAttributeVoiceCall.ProtoReflect.Descriptor instead. -func (*DocumentAttributeVoiceCall) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{0} -} - -func (x *DocumentAttributeVoiceCall) GetMaxCallAttempts() uint32 { - if x != nil { - return x.MaxCallAttempts - } - return 0 -} - -func (x *DocumentAttributeVoiceCall) GetCallAttemptSleep() uint32 { - if x != nil { - return x.CallAttemptSleep - } - return 0 -} - -// DocumentAttributeAudio -type DocumentAttributeAudio struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Voice bool `protobuf:"varint,1,opt,name=Voice,proto3" json:"Voice,omitempty"` - Duration uint32 `protobuf:"varint,2,opt,name=Duration,proto3" json:"Duration,omitempty"` - Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title,omitempty"` - Performer string `protobuf:"bytes,4,opt,name=Performer,proto3" json:"Performer,omitempty"` - Album string `protobuf:"bytes,5,opt,name=Album,proto3" json:"Album,omitempty"` - Waveform []byte `protobuf:"bytes,6,opt,name=Waveform,proto3" json:"Waveform,omitempty"` -} - -func (x *DocumentAttributeAudio) Reset() { - *x = DocumentAttributeAudio{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentAttributeAudio) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentAttributeAudio) ProtoMessage() {} - -func (x *DocumentAttributeAudio) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DocumentAttributeAudio.ProtoReflect.Descriptor instead. -func (*DocumentAttributeAudio) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{1} -} - -func (x *DocumentAttributeAudio) GetVoice() bool { - if x != nil { - return x.Voice - } - return false -} - -func (x *DocumentAttributeAudio) GetDuration() uint32 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *DocumentAttributeAudio) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *DocumentAttributeAudio) GetPerformer() string { - if x != nil { - return x.Performer - } - return "" -} - -func (x *DocumentAttributeAudio) GetAlbum() string { - if x != nil { - return x.Album - } - return "" -} - -func (x *DocumentAttributeAudio) GetWaveform() []byte { - if x != nil { - return x.Waveform - } - return nil -} - -// DocumentAttributeVideo -type DocumentAttributeVideo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Width uint32 `protobuf:"varint,1,opt,name=Width,proto3" json:"Width,omitempty"` - Height uint32 `protobuf:"varint,2,opt,name=Height,proto3" json:"Height,omitempty"` - Duration uint32 `protobuf:"varint,3,opt,name=Duration,proto3" json:"Duration,omitempty"` - Round bool `protobuf:"varint,4,opt,name=Round,proto3" json:"Round,omitempty"` -} - -func (x *DocumentAttributeVideo) Reset() { - *x = DocumentAttributeVideo{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentAttributeVideo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentAttributeVideo) ProtoMessage() {} - -func (x *DocumentAttributeVideo) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DocumentAttributeVideo.ProtoReflect.Descriptor instead. -func (*DocumentAttributeVideo) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{2} -} - -func (x *DocumentAttributeVideo) GetWidth() uint32 { - if x != nil { - return x.Width - } - return 0 -} - -func (x *DocumentAttributeVideo) GetHeight() uint32 { - if x != nil { - return x.Height - } - return 0 -} - -func (x *DocumentAttributeVideo) GetDuration() uint32 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *DocumentAttributeVideo) GetRound() bool { - if x != nil { - return x.Round - } - return false -} - -// DocumentAttributePhoto -type DocumentAttributePhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Width uint32 `protobuf:"varint,1,opt,name=Width,proto3" json:"Width,omitempty"` - Height uint32 `protobuf:"varint,2,opt,name=Height,proto3" json:"Height,omitempty"` -} - -func (x *DocumentAttributePhoto) Reset() { - *x = DocumentAttributePhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentAttributePhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentAttributePhoto) ProtoMessage() {} - -func (x *DocumentAttributePhoto) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DocumentAttributePhoto.ProtoReflect.Descriptor instead. -func (*DocumentAttributePhoto) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{3} -} - -func (x *DocumentAttributePhoto) GetWidth() uint32 { - if x != nil { - return x.Width - } - return 0 -} - -func (x *DocumentAttributePhoto) GetHeight() uint32 { - if x != nil { - return x.Height - } - return 0 -} - -// DocumentAttributeFile -type DocumentAttributeFile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Filename string `protobuf:"bytes,1,opt,name=Filename,proto3" json:"Filename,omitempty"` -} - -func (x *DocumentAttributeFile) Reset() { - *x = DocumentAttributeFile{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentAttributeFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentAttributeFile) ProtoMessage() {} - -func (x *DocumentAttributeFile) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DocumentAttributeFile.ProtoReflect.Descriptor instead. -func (*DocumentAttributeFile) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{4} -} - -func (x *DocumentAttributeFile) GetFilename() string { - if x != nil { - return x.Filename - } - return "" -} - -// DocumentAttributeAnimated -type DocumentAttributeAnimated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Sound bool `protobuf:"varint,1,opt,name=Sound,proto3" json:"Sound,omitempty"` -} - -func (x *DocumentAttributeAnimated) Reset() { - *x = DocumentAttributeAnimated{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentAttributeAnimated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentAttributeAnimated) ProtoMessage() {} - -func (x *DocumentAttributeAnimated) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DocumentAttributeAnimated.ProtoReflect.Descriptor instead. -func (*DocumentAttributeAnimated) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{5} -} - -func (x *DocumentAttributeAnimated) GetSound() bool { - if x != nil { - return x.Sound - } - return false -} - -// DocumentAttribute -type DocumentAttribute struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type DocumentAttributeType `protobuf:"varint,1,opt,name=Type,proto3,enum=msg.DocumentAttributeType" json:"Type,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"` -} - -func (x *DocumentAttribute) Reset() { - *x = DocumentAttribute{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DocumentAttribute) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DocumentAttribute) ProtoMessage() {} - -func (x *DocumentAttribute) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DocumentAttribute.ProtoReflect.Descriptor instead. -func (*DocumentAttribute) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{6} -} - -func (x *DocumentAttribute) GetType() DocumentAttributeType { - if x != nil { - return x.Type - } - return DocumentAttributeType_AttributeTypeNone -} - -func (x *DocumentAttribute) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -// Document -type Document struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,2,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Date int64 `protobuf:"varint,3,opt,name=Date,proto3" json:"Date,omitempty"` - MimeType string `protobuf:"bytes,4,opt,name=MimeType,proto3" json:"MimeType,omitempty"` - FileSize int32 `protobuf:"varint,5,opt,name=FileSize,proto3" json:"FileSize,omitempty"` - Version int32 `protobuf:"varint,6,opt,name=Version,proto3" json:"Version,omitempty"` - ClusterID int32 `protobuf:"varint,7,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"` - Attributes []*DocumentAttribute `protobuf:"bytes,8,rep,name=Attributes,proto3" json:"Attributes,omitempty"` - Thumbnail *FileLocation `protobuf:"bytes,9,opt,name=Thumbnail,proto3" json:"Thumbnail,omitempty"` - MD5Checksum string `protobuf:"bytes,10,opt,name=MD5Checksum,proto3" json:"MD5Checksum,omitempty"` - TinyThumbnail []byte `protobuf:"bytes,11,opt,name=TinyThumbnail,proto3" json:"TinyThumbnail,omitempty"` -} - -func (x *Document) Reset() { - *x = Document{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Document) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Document) ProtoMessage() {} - -func (x *Document) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Document.ProtoReflect.Descriptor instead. -func (*Document) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{7} -} - -func (x *Document) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *Document) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *Document) GetDate() int64 { - if x != nil { - return x.Date - } - return 0 -} - -func (x *Document) GetMimeType() string { - if x != nil { - return x.MimeType - } - return "" -} - -func (x *Document) GetFileSize() int32 { - if x != nil { - return x.FileSize - } - return 0 -} - -func (x *Document) GetVersion() int32 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *Document) GetClusterID() int32 { - if x != nil { - return x.ClusterID - } - return 0 -} - -func (x *Document) GetAttributes() []*DocumentAttribute { - if x != nil { - return x.Attributes - } - return nil -} - -func (x *Document) GetThumbnail() *FileLocation { - if x != nil { - return x.Thumbnail - } - return nil -} - -func (x *Document) GetMD5Checksum() string { - if x != nil { - return x.MD5Checksum - } - return "" -} - -func (x *Document) GetTinyThumbnail() []byte { - if x != nil { - return x.TinyThumbnail - } - return nil -} - -// InputMediaWebDocument -type InputMediaWebDocument struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=Url,proto3" json:"Url,omitempty"` - DocSize int32 `protobuf:"varint,2,opt,name=DocSize,proto3" json:"DocSize,omitempty"` - MimeType string `protobuf:"bytes,3,opt,name=MimeType,proto3" json:"MimeType,omitempty"` - Attributes []*DocumentAttribute `protobuf:"bytes,4,rep,name=Attributes,proto3" json:"Attributes,omitempty"` -} - -func (x *InputMediaWebDocument) Reset() { - *x = InputMediaWebDocument{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputMediaWebDocument) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputMediaWebDocument) ProtoMessage() {} - -func (x *InputMediaWebDocument) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputMediaWebDocument.ProtoReflect.Descriptor instead. -func (*InputMediaWebDocument) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{8} -} - -func (x *InputMediaWebDocument) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *InputMediaWebDocument) GetDocSize() int32 { - if x != nil { - return x.DocSize - } - return 0 -} - -func (x *InputMediaWebDocument) GetMimeType() string { - if x != nil { - return x.MimeType - } - return "" -} - -func (x *InputMediaWebDocument) GetAttributes() []*DocumentAttribute { - if x != nil { - return x.Attributes - } - return nil -} - -// MediaWebDocument -type MediaWebDocument struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=Url,proto3" json:"Url,omitempty"` - DocSize int32 `protobuf:"varint,2,opt,name=DocSize,proto3" json:"DocSize,omitempty"` - MimeType string `protobuf:"bytes,3,opt,name=MimeType,proto3" json:"MimeType,omitempty"` - Attributes []*DocumentAttribute `protobuf:"bytes,4,rep,name=Attributes,proto3" json:"Attributes,omitempty"` - AccessHash uint64 `protobuf:"fixed64,5,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` -} - -func (x *MediaWebDocument) Reset() { - *x = MediaWebDocument{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaWebDocument) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaWebDocument) ProtoMessage() {} - -func (x *MediaWebDocument) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaWebDocument.ProtoReflect.Descriptor instead. -func (*MediaWebDocument) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{9} -} - -func (x *MediaWebDocument) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *MediaWebDocument) GetDocSize() int32 { - if x != nil { - return x.DocSize - } - return 0 -} - -func (x *MediaWebDocument) GetMimeType() string { - if x != nil { - return x.MimeType - } - return "" -} - -func (x *MediaWebDocument) GetAttributes() []*DocumentAttribute { - if x != nil { - return x.Attributes - } - return nil -} - -func (x *MediaWebDocument) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -// MediaWebPage -type MediaWebPage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MediaWebPage) Reset() { - *x = MediaWebPage{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaWebPage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaWebPage) ProtoMessage() {} - -func (x *MediaWebPage) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaWebPage.ProtoReflect.Descriptor instead. -func (*MediaWebPage) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{10} -} - -// InputMediaContact -type InputMediaContact struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - VCard string `protobuf:"bytes,4,opt,name=VCard,proto3" json:"VCard,omitempty"` -} - -func (x *InputMediaContact) Reset() { - *x = InputMediaContact{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputMediaContact) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputMediaContact) ProtoMessage() {} - -func (x *InputMediaContact) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputMediaContact.ProtoReflect.Descriptor instead. -func (*InputMediaContact) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{11} -} - -func (x *InputMediaContact) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *InputMediaContact) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *InputMediaContact) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *InputMediaContact) GetVCard() string { - if x != nil { - return x.VCard - } - return "" -} - -// MediaContact -type MediaContact struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Phone string `protobuf:"bytes,1,opt,name=Phone,proto3" json:"Phone,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - VCard string `protobuf:"bytes,4,opt,name=VCard,proto3" json:"VCard,omitempty"` -} - -func (x *MediaContact) Reset() { - *x = MediaContact{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaContact) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaContact) ProtoMessage() {} - -func (x *MediaContact) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaContact.ProtoReflect.Descriptor instead. -func (*MediaContact) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{12} -} - -func (x *MediaContact) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *MediaContact) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *MediaContact) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *MediaContact) GetVCard() string { - if x != nil { - return x.VCard - } - return "" -} - -// InputMediaUploadedDocument -type InputMediaUploadedDocument struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - File *InputFile `protobuf:"bytes,1,opt,name=File,proto3" json:"File,omitempty"` - Thumbnail *InputFile `protobuf:"bytes,2,opt,name=Thumbnail,proto3" json:"Thumbnail,omitempty"` - MimeType string `protobuf:"bytes,3,opt,name=MimeType,proto3" json:"MimeType,omitempty"` - Caption string `protobuf:"bytes,4,opt,name=Caption,proto3" json:"Caption,omitempty"` - Stickers []*InputDocument `protobuf:"bytes,5,rep,name=Stickers,proto3" json:"Stickers,omitempty"` - Attributes []*DocumentAttribute `protobuf:"bytes,6,rep,name=Attributes,proto3" json:"Attributes,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,7,rep,name=Entities,proto3" json:"Entities,omitempty"` - TinyThumbnail []byte `protobuf:"bytes,8,opt,name=TinyThumbnail,proto3" json:"TinyThumbnail,omitempty"` -} - -func (x *InputMediaUploadedDocument) Reset() { - *x = InputMediaUploadedDocument{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputMediaUploadedDocument) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputMediaUploadedDocument) ProtoMessage() {} - -func (x *InputMediaUploadedDocument) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputMediaUploadedDocument.ProtoReflect.Descriptor instead. -func (*InputMediaUploadedDocument) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{13} -} - -func (x *InputMediaUploadedDocument) GetFile() *InputFile { - if x != nil { - return x.File - } - return nil -} - -func (x *InputMediaUploadedDocument) GetThumbnail() *InputFile { - if x != nil { - return x.Thumbnail - } - return nil -} - -func (x *InputMediaUploadedDocument) GetMimeType() string { - if x != nil { - return x.MimeType - } - return "" -} - -func (x *InputMediaUploadedDocument) GetCaption() string { - if x != nil { - return x.Caption - } - return "" -} - -func (x *InputMediaUploadedDocument) GetStickers() []*InputDocument { - if x != nil { - return x.Stickers - } - return nil -} - -func (x *InputMediaUploadedDocument) GetAttributes() []*DocumentAttribute { - if x != nil { - return x.Attributes - } - return nil -} - -func (x *InputMediaUploadedDocument) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *InputMediaUploadedDocument) GetTinyThumbnail() []byte { - if x != nil { - return x.TinyThumbnail - } - return nil -} - -// InputMediaDocument -type InputMediaDocument struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Caption string `protobuf:"bytes,1,opt,name=Caption,proto3" json:"Caption,omitempty"` - Document *InputDocument `protobuf:"bytes,2,opt,name=Document,proto3" json:"Document,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,3,rep,name=Entities,proto3" json:"Entities,omitempty"` - Thumbnail *InputFile `protobuf:"bytes,4,opt,name=Thumbnail,proto3" json:"Thumbnail,omitempty"` - Attributes []*DocumentAttribute `protobuf:"bytes,5,rep,name=Attributes,proto3" json:"Attributes,omitempty"` - TinyThumbnail []byte `protobuf:"bytes,6,opt,name=TinyThumbnail,proto3" json:"TinyThumbnail,omitempty"` -} - -func (x *InputMediaDocument) Reset() { - *x = InputMediaDocument{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputMediaDocument) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputMediaDocument) ProtoMessage() {} - -func (x *InputMediaDocument) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputMediaDocument.ProtoReflect.Descriptor instead. -func (*InputMediaDocument) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{14} -} - -func (x *InputMediaDocument) GetCaption() string { - if x != nil { - return x.Caption - } - return "" -} - -func (x *InputMediaDocument) GetDocument() *InputDocument { - if x != nil { - return x.Document - } - return nil -} - -func (x *InputMediaDocument) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *InputMediaDocument) GetThumbnail() *InputFile { - if x != nil { - return x.Thumbnail - } - return nil -} - -func (x *InputMediaDocument) GetAttributes() []*DocumentAttribute { - if x != nil { - return x.Attributes - } - return nil -} - -func (x *InputMediaDocument) GetTinyThumbnail() []byte { - if x != nil { - return x.TinyThumbnail - } - return nil -} - -// InputMediaMessageDocument -type InputMediaMessageDocument struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageID int64 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Caption string `protobuf:"bytes,3,opt,name=Caption,proto3" json:"Caption,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,4,rep,name=Entities,proto3" json:"Entities,omitempty"` -} - -func (x *InputMediaMessageDocument) Reset() { - *x = InputMediaMessageDocument{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputMediaMessageDocument) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputMediaMessageDocument) ProtoMessage() {} - -func (x *InputMediaMessageDocument) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputMediaMessageDocument.ProtoReflect.Descriptor instead. -func (*InputMediaMessageDocument) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{15} -} - -func (x *InputMediaMessageDocument) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *InputMediaMessageDocument) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *InputMediaMessageDocument) GetCaption() string { - if x != nil { - return x.Caption - } - return "" -} - -func (x *InputMediaMessageDocument) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -// MediaDocument -type MediaDocument struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Caption string `protobuf:"bytes,1,opt,name=Caption,proto3" json:"Caption,omitempty"` - TTLinSeconds int32 `protobuf:"varint,2,opt,name=TTLinSeconds,proto3" json:"TTLinSeconds,omitempty"` // Seconds - Doc *Document `protobuf:"bytes,3,opt,name=Doc,proto3" json:"Doc,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,4,rep,name=Entities,proto3" json:"Entities,omitempty"` -} - -func (x *MediaDocument) Reset() { - *x = MediaDocument{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaDocument) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaDocument) ProtoMessage() {} - -func (x *MediaDocument) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaDocument.ProtoReflect.Descriptor instead. -func (*MediaDocument) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{16} -} - -func (x *MediaDocument) GetCaption() string { - if x != nil { - return x.Caption - } - return "" -} - -func (x *MediaDocument) GetTTLinSeconds() int32 { - if x != nil { - return x.TTLinSeconds - } - return 0 -} - -func (x *MediaDocument) GetDoc() *Document { - if x != nil { - return x.Doc - } - return nil -} - -func (x *MediaDocument) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -// InputMediaGeoLocation -type InputMediaGeoLocation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Lat float32 `protobuf:"fixed32,1,opt,name=Lat,proto3" json:"Lat,omitempty"` - Long float32 `protobuf:"fixed32,2,opt,name=Long,proto3" json:"Long,omitempty"` - Caption string `protobuf:"bytes,3,opt,name=Caption,proto3" json:"Caption,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,4,rep,name=Entities,proto3" json:"Entities,omitempty"` -} - -func (x *InputMediaGeoLocation) Reset() { - *x = InputMediaGeoLocation{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputMediaGeoLocation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputMediaGeoLocation) ProtoMessage() {} - -func (x *InputMediaGeoLocation) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputMediaGeoLocation.ProtoReflect.Descriptor instead. -func (*InputMediaGeoLocation) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{17} -} - -func (x *InputMediaGeoLocation) GetLat() float32 { - if x != nil { - return x.Lat - } - return 0 -} - -func (x *InputMediaGeoLocation) GetLong() float32 { - if x != nil { - return x.Long - } - return 0 -} - -func (x *InputMediaGeoLocation) GetCaption() string { - if x != nil { - return x.Caption - } - return "" -} - -func (x *InputMediaGeoLocation) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -// MediaGeoLocation -type MediaGeoLocation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Lat float32 `protobuf:"fixed32,1,opt,name=Lat,proto3" json:"Lat,omitempty"` - Long float32 `protobuf:"fixed32,2,opt,name=Long,proto3" json:"Long,omitempty"` - Caption string `protobuf:"bytes,3,opt,name=Caption,proto3" json:"Caption,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,4,rep,name=Entities,proto3" json:"Entities,omitempty"` -} - -func (x *MediaGeoLocation) Reset() { - *x = MediaGeoLocation{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaGeoLocation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaGeoLocation) ProtoMessage() {} - -func (x *MediaGeoLocation) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaGeoLocation.ProtoReflect.Descriptor instead. -func (*MediaGeoLocation) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{18} -} - -func (x *MediaGeoLocation) GetLat() float32 { - if x != nil { - return x.Lat - } - return 0 -} - -func (x *MediaGeoLocation) GetLong() float32 { - if x != nil { - return x.Long - } - return 0 -} - -func (x *MediaGeoLocation) GetCaption() string { - if x != nil { - return x.Caption - } - return "" -} - -func (x *MediaGeoLocation) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -// InputMediaPoll -type InputMediaPoll struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Poll *MediaPoll `protobuf:"bytes,1,opt,name=Poll,proto3" json:"Poll,omitempty"` -} - -func (x *InputMediaPoll) Reset() { - *x = InputMediaPoll{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputMediaPoll) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputMediaPoll) ProtoMessage() {} - -func (x *InputMediaPoll) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputMediaPoll.ProtoReflect.Descriptor instead. -func (*InputMediaPoll) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{19} -} - -func (x *InputMediaPoll) GetPoll() *MediaPoll { - if x != nil { - return x.Poll - } - return nil -} - -// MediaPoll -type MediaPoll struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Closed bool `protobuf:"varint,2,opt,name=Closed,proto3" json:"Closed,omitempty"` - PublicVoters bool `protobuf:"varint,3,opt,name=PublicVoters,proto3" json:"PublicVoters,omitempty"` - MultiChoice bool `protobuf:"varint,4,opt,name=MultiChoice,proto3" json:"MultiChoice,omitempty"` - Quiz bool `protobuf:"varint,5,opt,name=Quiz,proto3" json:"Quiz,omitempty"` - Question string `protobuf:"bytes,6,opt,name=Question,proto3" json:"Question,omitempty"` - Answers []*PollAnswer `protobuf:"bytes,7,rep,name=Answers,proto3" json:"Answers,omitempty"` -} - -func (x *MediaPoll) Reset() { - *x = MediaPoll{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MediaPoll) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MediaPoll) ProtoMessage() {} - -func (x *MediaPoll) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MediaPoll.ProtoReflect.Descriptor instead. -func (*MediaPoll) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{20} -} - -func (x *MediaPoll) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *MediaPoll) GetClosed() bool { - if x != nil { - return x.Closed - } - return false -} - -func (x *MediaPoll) GetPublicVoters() bool { - if x != nil { - return x.PublicVoters - } - return false -} - -func (x *MediaPoll) GetMultiChoice() bool { - if x != nil { - return x.MultiChoice - } - return false -} - -func (x *MediaPoll) GetQuiz() bool { - if x != nil { - return x.Quiz - } - return false -} - -func (x *MediaPoll) GetQuestion() string { - if x != nil { - return x.Question - } - return "" -} - -func (x *MediaPoll) GetAnswers() []*PollAnswer { - if x != nil { - return x.Answers - } - return nil -} - -// PollAnswer -type PollAnswer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` - Option []byte `protobuf:"bytes,2,opt,name=Option,proto3" json:"Option,omitempty"` -} - -func (x *PollAnswer) Reset() { - *x = PollAnswer{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PollAnswer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PollAnswer) ProtoMessage() {} - -func (x *PollAnswer) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PollAnswer.ProtoReflect.Descriptor instead. -func (*PollAnswer) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{21} -} - -func (x *PollAnswer) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *PollAnswer) GetOption() []byte { - if x != nil { - return x.Option - } - return nil -} - -// PollResults -type PollResults struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Results []*PollAnswerVoters `protobuf:"bytes,1,rep,name=Results,proto3" json:"Results,omitempty"` - TotalVoters int64 `protobuf:"varint,2,opt,name=TotalVoters,proto3" json:"TotalVoters,omitempty"` -} - -func (x *PollResults) Reset() { - *x = PollResults{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PollResults) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PollResults) ProtoMessage() {} - -func (x *PollResults) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PollResults.ProtoReflect.Descriptor instead. -func (*PollResults) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{22} -} - -func (x *PollResults) GetResults() []*PollAnswerVoters { - if x != nil { - return x.Results - } - return nil -} - -func (x *PollResults) GetTotalVoters() int64 { - if x != nil { - return x.TotalVoters - } - return 0 -} - -// PollAnswerVoters -type PollAnswerVoters struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Chosen bool `protobuf:"varint,1,opt,name=Chosen,proto3" json:"Chosen,omitempty"` // Whether User has chosen this answer - Correct bool `protobuf:"varint,2,opt,name=Correct,proto3" json:"Correct,omitempty"` // For Quiz Polls - Option []byte `protobuf:"bytes,3,opt,name=Option,proto3" json:"Option,omitempty"` - Voters int64 `protobuf:"varint,4,opt,name=Voters,proto3" json:"Voters,omitempty"` // Number of voters chosen this option -} - -func (x *PollAnswerVoters) Reset() { - *x = PollAnswerVoters{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_medias_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PollAnswerVoters) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PollAnswerVoters) ProtoMessage() {} - -func (x *PollAnswerVoters) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_medias_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PollAnswerVoters.ProtoReflect.Descriptor instead. -func (*PollAnswerVoters) Descriptor() ([]byte, []int) { - return file_chat_messages_medias_proto_rawDescGZIP(), []int{23} -} - -func (x *PollAnswerVoters) GetChosen() bool { - if x != nil { - return x.Chosen - } - return false -} - -func (x *PollAnswerVoters) GetCorrect() bool { - if x != nil { - return x.Correct - } - return false -} - -func (x *PollAnswerVoters) GetOption() []byte { - if x != nil { - return x.Option - } - return nil -} - -func (x *PollAnswerVoters) GetVoters() int64 { - if x != nil { - return x.Voters - } - return 0 -} - -var File_chat_messages_medias_proto protoreflect.FileDescriptor - -var file_chat_messages_medias_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, - 0x6d, 0x65, 0x64, 0x69, 0x61, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, - 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x72, 0x0a, 0x1a, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x43, 0x61, 0x6c, - 0x6c, 0x12, 0x28, 0x0a, 0x0f, 0x4d, 0x61, 0x78, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x74, 0x74, 0x65, - 0x6d, 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x4d, 0x61, 0x78, 0x43, - 0x61, 0x6c, 0x6c, 0x41, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x43, - 0x61, 0x6c, 0x6c, 0x41, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x53, 0x6c, 0x65, 0x65, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x74, 0x74, 0x65, 0x6d, - 0x70, 0x74, 0x53, 0x6c, 0x65, 0x65, 0x70, 0x22, 0xb0, 0x01, 0x0a, 0x16, 0x44, 0x6f, 0x63, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x41, 0x75, 0x64, - 0x69, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x05, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x44, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x65, - 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, - 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x6c, 0x62, 0x75, - 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x41, 0x6c, 0x62, 0x75, 0x6d, 0x12, 0x1a, - 0x0a, 0x08, 0x57, 0x61, 0x76, 0x65, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x08, 0x57, 0x61, 0x76, 0x65, 0x66, 0x6f, 0x72, 0x6d, 0x22, 0x78, 0x0a, 0x16, 0x44, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x56, - 0x69, 0x64, 0x65, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x57, 0x69, 0x64, 0x74, 0x68, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x05, 0x57, 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x48, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x48, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, - 0x0a, 0x05, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x52, - 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x46, 0x0a, 0x16, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x14, - 0x0a, 0x05, 0x57, 0x69, 0x64, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x57, - 0x69, 0x64, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x22, 0x33, 0x0a, 0x15, - 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, - 0x65, 0x22, 0x31, 0x0a, 0x19, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x41, 0x6e, 0x69, 0x6d, 0x61, 0x74, 0x65, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x53, - 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x57, 0x0a, 0x11, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x2e, 0x0a, 0x04, 0x54, 0x79, 0x70, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, - 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0xf7, 0x02, - 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x02, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, 0x44, 0x12, 0x22, - 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, - 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x04, 0x44, 0x61, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x6c, 0x75, 0x73, - 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x43, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x36, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, - 0x75, 0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x52, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2f, - 0x0a, 0x09, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x12, - 0x20, 0x0a, 0x0b, 0x4d, 0x44, 0x35, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4d, 0x44, 0x35, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, - 0x6d, 0x12, 0x24, 0x0a, 0x0d, 0x54, 0x69, 0x6e, 0x79, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, - 0x69, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x54, 0x69, 0x6e, 0x79, 0x54, 0x68, - 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x22, 0x97, 0x01, 0x0a, 0x15, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x57, 0x65, 0x62, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x55, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x6f, 0x63, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x44, 0x6f, 0x63, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x36, 0x0a, 0x0a, 0x41, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x73, 0x22, 0xb6, 0x01, 0x0a, 0x10, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x57, 0x65, 0x62, 0x44, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x72, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x6f, 0x63, 0x53, - 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x44, 0x6f, 0x63, 0x53, 0x69, - 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x36, - 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x41, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x48, 0x61, 0x73, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x22, 0x0e, 0x0a, 0x0c, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x57, 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x22, 0x79, 0x0a, 0x11, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, - 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x56, 0x43, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x56, 0x43, 0x61, 0x72, 0x64, 0x22, 0x74, 0x0a, 0x0c, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x46, - 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x73, - 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x61, 0x73, - 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x43, 0x61, 0x72, 0x64, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x56, 0x43, 0x61, 0x72, 0x64, 0x22, 0xe2, 0x02, 0x0a, 0x1a, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, - 0x65, 0x64, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x04, 0x46, 0x69, - 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x2c, - 0x0a, 0x09, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, - 0x65, 0x52, 0x09, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, - 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x61, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x61, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x08, 0x53, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x18, 0x05, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x53, 0x74, 0x69, 0x63, 0x6b, 0x65, - 0x72, 0x73, 0x12, 0x36, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, - 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x54, 0x69, - 0x6e, 0x79, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0d, 0x54, 0x69, 0x6e, 0x79, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, - 0x22, 0x9a, 0x02, 0x0a, 0x12, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x61, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x61, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x2e, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x44, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, - 0x73, 0x12, 0x2c, 0x0a, 0x09, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x46, 0x69, 0x6c, 0x65, 0x52, 0x09, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x12, - 0x36, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, - 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x41, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x54, 0x69, 0x6e, 0x79, 0x54, - 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, - 0x54, 0x69, 0x6e, 0x79, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, 0x61, 0x69, 0x6c, 0x22, 0xa7, 0x01, - 0x0a, 0x19, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x04, 0x50, - 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, - 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, - 0x07, 0x43, 0x61, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x43, 0x61, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x0d, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x61, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x61, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x54, 0x54, 0x4c, 0x69, 0x6e, 0x53, 0x65, 0x63, 0x6f, - 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x54, 0x54, 0x4c, 0x69, 0x6e, - 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x1f, 0x0a, 0x03, 0x44, 0x6f, 0x63, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x52, 0x03, 0x44, 0x6f, 0x63, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, - 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x87, 0x01, 0x0a, 0x15, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x47, 0x65, 0x6f, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x4c, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, - 0x03, 0x4c, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x6f, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x02, 0x52, 0x04, 0x4c, 0x6f, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x61, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x61, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, - 0x65, 0x73, 0x22, 0x82, 0x01, 0x0a, 0x10, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x47, 0x65, 0x6f, 0x4c, - 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x4c, 0x61, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x02, 0x52, 0x03, 0x4c, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x6f, 0x6e, - 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x4c, 0x6f, 0x6e, 0x67, 0x12, 0x18, 0x0a, - 0x07, 0x43, 0x61, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x43, 0x61, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x34, 0x0a, 0x0e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x50, 0x6f, 0x6c, 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x6f, 0x6c, - 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x50, 0x6f, 0x6c, 0x6c, 0x52, 0x04, 0x50, 0x6f, 0x6c, 0x6c, 0x22, 0xd4, 0x01, - 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x50, 0x6f, 0x6c, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x43, - 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x43, 0x6c, 0x6f, - 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x6f, 0x74, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x56, 0x6f, 0x74, 0x65, 0x72, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x75, 0x6c, 0x74, 0x69, - 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x4d, 0x75, - 0x6c, 0x74, 0x69, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x51, 0x75, 0x69, - 0x7a, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x51, 0x75, 0x69, 0x7a, 0x12, 0x1a, 0x0a, - 0x08, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x07, 0x41, 0x6e, 0x73, - 0x77, 0x65, 0x72, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x50, 0x6f, 0x6c, 0x6c, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x52, 0x07, 0x41, 0x6e, 0x73, - 0x77, 0x65, 0x72, 0x73, 0x22, 0x38, 0x0a, 0x0a, 0x50, 0x6f, 0x6c, 0x6c, 0x41, 0x6e, 0x73, 0x77, - 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x60, - 0x0a, 0x0b, 0x50, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x2f, 0x0a, - 0x07, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x6f, 0x6c, 0x6c, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x56, - 0x6f, 0x74, 0x65, 0x72, 0x73, 0x52, 0x07, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x20, - 0x0a, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x56, 0x6f, 0x74, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0b, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x56, 0x6f, 0x74, 0x65, 0x72, 0x73, - 0x22, 0x74, 0x0a, 0x10, 0x50, 0x6f, 0x6c, 0x6c, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x56, 0x6f, - 0x74, 0x65, 0x72, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x73, 0x65, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x43, 0x68, 0x6f, 0x73, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, - 0x43, 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x43, - 0x6f, 0x72, 0x72, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, - 0x0a, 0x06, 0x56, 0x6f, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, - 0x56, 0x6f, 0x74, 0x65, 0x72, 0x73, 0x2a, 0xf1, 0x01, 0x0a, 0x0c, 0x44, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, - 0x12, 0x15, 0x0a, 0x11, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, - 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x6f, 0x63, 0x75, 0x6d, - 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x10, 0x02, 0x12, 0x15, - 0x0a, 0x11, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x56, 0x69, - 0x64, 0x65, 0x6f, 0x10, 0x03, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x54, 0x79, 0x70, 0x65, 0x57, 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x10, 0x04, 0x12, 0x19, - 0x0a, 0x15, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x32, 0x10, 0x06, 0x12, 0x19, 0x0a, 0x15, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x33, 0x10, 0x07, 0x12, - 0x19, 0x0a, 0x15, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x34, 0x10, 0x08, 0x2a, 0x8c, 0x02, 0x0a, 0x15, 0x44, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x41, 0x75, 0x64, 0x69, - 0x6f, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x41, - 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x50, 0x68, 0x6f, 0x74, - 0x6f, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x10, 0x04, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x41, 0x6e, 0x69, 0x6d, 0x61, - 0x74, 0x65, 0x64, 0x10, 0x05, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x10, - 0x06, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x10, 0x07, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x74, 0x74, - 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x33, 0x10, - 0x08, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x34, 0x10, 0x09, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, - 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_chat_messages_medias_proto_rawDescOnce sync.Once - file_chat_messages_medias_proto_rawDescData = file_chat_messages_medias_proto_rawDesc -) - -func file_chat_messages_medias_proto_rawDescGZIP() []byte { - file_chat_messages_medias_proto_rawDescOnce.Do(func() { - file_chat_messages_medias_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_messages_medias_proto_rawDescData) - }) - return file_chat_messages_medias_proto_rawDescData -} - -var file_chat_messages_medias_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_chat_messages_medias_proto_msgTypes = make([]protoimpl.MessageInfo, 24) -var file_chat_messages_medias_proto_goTypes = []interface{}{ - (DocumentType)(0), // 0: msg.DocumentType - (DocumentAttributeType)(0), // 1: msg.DocumentAttributeType - (*DocumentAttributeVoiceCall)(nil), // 2: msg.DocumentAttributeVoiceCall - (*DocumentAttributeAudio)(nil), // 3: msg.DocumentAttributeAudio - (*DocumentAttributeVideo)(nil), // 4: msg.DocumentAttributeVideo - (*DocumentAttributePhoto)(nil), // 5: msg.DocumentAttributePhoto - (*DocumentAttributeFile)(nil), // 6: msg.DocumentAttributeFile - (*DocumentAttributeAnimated)(nil), // 7: msg.DocumentAttributeAnimated - (*DocumentAttribute)(nil), // 8: msg.DocumentAttribute - (*Document)(nil), // 9: msg.Document - (*InputMediaWebDocument)(nil), // 10: msg.InputMediaWebDocument - (*MediaWebDocument)(nil), // 11: msg.MediaWebDocument - (*MediaWebPage)(nil), // 12: msg.MediaWebPage - (*InputMediaContact)(nil), // 13: msg.InputMediaContact - (*MediaContact)(nil), // 14: msg.MediaContact - (*InputMediaUploadedDocument)(nil), // 15: msg.InputMediaUploadedDocument - (*InputMediaDocument)(nil), // 16: msg.InputMediaDocument - (*InputMediaMessageDocument)(nil), // 17: msg.InputMediaMessageDocument - (*MediaDocument)(nil), // 18: msg.MediaDocument - (*InputMediaGeoLocation)(nil), // 19: msg.InputMediaGeoLocation - (*MediaGeoLocation)(nil), // 20: msg.MediaGeoLocation - (*InputMediaPoll)(nil), // 21: msg.InputMediaPoll - (*MediaPoll)(nil), // 22: msg.MediaPoll - (*PollAnswer)(nil), // 23: msg.PollAnswer - (*PollResults)(nil), // 24: msg.PollResults - (*PollAnswerVoters)(nil), // 25: msg.PollAnswerVoters - (*FileLocation)(nil), // 26: msg.FileLocation - (*InputFile)(nil), // 27: msg.InputFile - (*InputDocument)(nil), // 28: msg.InputDocument - (*MessageEntity)(nil), // 29: msg.MessageEntity - (*InputPeer)(nil), // 30: msg.InputPeer -} -var file_chat_messages_medias_proto_depIdxs = []int32{ - 1, // 0: msg.DocumentAttribute.Type:type_name -> msg.DocumentAttributeType - 8, // 1: msg.Document.Attributes:type_name -> msg.DocumentAttribute - 26, // 2: msg.Document.Thumbnail:type_name -> msg.FileLocation - 8, // 3: msg.InputMediaWebDocument.Attributes:type_name -> msg.DocumentAttribute - 8, // 4: msg.MediaWebDocument.Attributes:type_name -> msg.DocumentAttribute - 27, // 5: msg.InputMediaUploadedDocument.File:type_name -> msg.InputFile - 27, // 6: msg.InputMediaUploadedDocument.Thumbnail:type_name -> msg.InputFile - 28, // 7: msg.InputMediaUploadedDocument.Stickers:type_name -> msg.InputDocument - 8, // 8: msg.InputMediaUploadedDocument.Attributes:type_name -> msg.DocumentAttribute - 29, // 9: msg.InputMediaUploadedDocument.Entities:type_name -> msg.MessageEntity - 28, // 10: msg.InputMediaDocument.Document:type_name -> msg.InputDocument - 29, // 11: msg.InputMediaDocument.Entities:type_name -> msg.MessageEntity - 27, // 12: msg.InputMediaDocument.Thumbnail:type_name -> msg.InputFile - 8, // 13: msg.InputMediaDocument.Attributes:type_name -> msg.DocumentAttribute - 30, // 14: msg.InputMediaMessageDocument.Peer:type_name -> msg.InputPeer - 29, // 15: msg.InputMediaMessageDocument.Entities:type_name -> msg.MessageEntity - 9, // 16: msg.MediaDocument.Doc:type_name -> msg.Document - 29, // 17: msg.MediaDocument.Entities:type_name -> msg.MessageEntity - 29, // 18: msg.InputMediaGeoLocation.Entities:type_name -> msg.MessageEntity - 29, // 19: msg.MediaGeoLocation.Entities:type_name -> msg.MessageEntity - 22, // 20: msg.InputMediaPoll.Poll:type_name -> msg.MediaPoll - 23, // 21: msg.MediaPoll.Answers:type_name -> msg.PollAnswer - 25, // 22: msg.PollResults.Results:type_name -> msg.PollAnswerVoters - 23, // [23:23] is the sub-list for method output_type - 23, // [23:23] is the sub-list for method input_type - 23, // [23:23] is the sub-list for extension type_name - 23, // [23:23] is the sub-list for extension extendee - 0, // [0:23] is the sub-list for field type_name -} - -func init() { file_chat_messages_medias_proto_init() } -func file_chat_messages_medias_proto_init() { - if File_chat_messages_medias_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_chat_messages_medias_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentAttributeVoiceCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentAttributeAudio); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentAttributeVideo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentAttributePhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentAttributeFile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentAttributeAnimated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DocumentAttribute); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Document); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputMediaWebDocument); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaWebDocument); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaWebPage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputMediaContact); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaContact); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputMediaUploadedDocument); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputMediaDocument); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputMediaMessageDocument); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaDocument); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputMediaGeoLocation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaGeoLocation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputMediaPoll); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MediaPoll); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollAnswer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollResults); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_medias_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PollAnswerVoters); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_messages_medias_proto_rawDesc, - NumEnums: 2, - NumMessages: 24, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_messages_medias_proto_goTypes, - DependencyIndexes: file_chat_messages_medias_proto_depIdxs, - EnumInfos: file_chat_messages_medias_proto_enumTypes, - MessageInfos: file_chat_messages_medias_proto_msgTypes, - }.Build() - File_chat_messages_medias_proto = out.File - file_chat_messages_medias_proto_rawDesc = nil - file_chat_messages_medias_proto_goTypes = nil - file_chat_messages_medias_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.medias.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.medias.rony.go deleted file mode 100644 index 6a7a7b07..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.medias.rony.go +++ /dev/null @@ -1,1770 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.messages.medias.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_DocumentAttributeVoiceCall int64 = 2787573148 - -type poolDocumentAttributeVoiceCall struct { - pool sync.Pool -} - -func (p *poolDocumentAttributeVoiceCall) Get() *DocumentAttributeVoiceCall { - x, ok := p.pool.Get().(*DocumentAttributeVoiceCall) - if !ok { - x = &DocumentAttributeVoiceCall{} - } - - return x -} - -func (p *poolDocumentAttributeVoiceCall) Put(x *DocumentAttributeVoiceCall) { - if x == nil { - return - } - - x.MaxCallAttempts = 0 - x.CallAttemptSleep = 0 - - p.pool.Put(x) -} - -var PoolDocumentAttributeVoiceCall = poolDocumentAttributeVoiceCall{} - -func (x *DocumentAttributeVoiceCall) DeepCopy(z *DocumentAttributeVoiceCall) { - z.MaxCallAttempts = x.MaxCallAttempts - z.CallAttemptSleep = x.CallAttemptSleep -} - -func (x *DocumentAttributeVoiceCall) Clone() *DocumentAttributeVoiceCall { - z := &DocumentAttributeVoiceCall{} - x.DeepCopy(z) - return z -} - -func (x *DocumentAttributeVoiceCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DocumentAttributeVoiceCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DocumentAttributeVoiceCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DocumentAttributeVoiceCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DocumentAttributeVoiceCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DocumentAttributeVoiceCall, x) -} - -const C_DocumentAttributeAudio int64 = 309707708 - -type poolDocumentAttributeAudio struct { - pool sync.Pool -} - -func (p *poolDocumentAttributeAudio) Get() *DocumentAttributeAudio { - x, ok := p.pool.Get().(*DocumentAttributeAudio) - if !ok { - x = &DocumentAttributeAudio{} - } - - return x -} - -func (p *poolDocumentAttributeAudio) Put(x *DocumentAttributeAudio) { - if x == nil { - return - } - - x.Voice = false - x.Duration = 0 - x.Title = "" - x.Performer = "" - x.Album = "" - x.Waveform = x.Waveform[:0] - - p.pool.Put(x) -} - -var PoolDocumentAttributeAudio = poolDocumentAttributeAudio{} - -func (x *DocumentAttributeAudio) DeepCopy(z *DocumentAttributeAudio) { - z.Voice = x.Voice - z.Duration = x.Duration - z.Title = x.Title - z.Performer = x.Performer - z.Album = x.Album - z.Waveform = append(z.Waveform[:0], x.Waveform...) -} - -func (x *DocumentAttributeAudio) Clone() *DocumentAttributeAudio { - z := &DocumentAttributeAudio{} - x.DeepCopy(z) - return z -} - -func (x *DocumentAttributeAudio) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DocumentAttributeAudio) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DocumentAttributeAudio) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DocumentAttributeAudio) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DocumentAttributeAudio) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DocumentAttributeAudio, x) -} - -const C_DocumentAttributeVideo int64 = 1993289477 - -type poolDocumentAttributeVideo struct { - pool sync.Pool -} - -func (p *poolDocumentAttributeVideo) Get() *DocumentAttributeVideo { - x, ok := p.pool.Get().(*DocumentAttributeVideo) - if !ok { - x = &DocumentAttributeVideo{} - } - - return x -} - -func (p *poolDocumentAttributeVideo) Put(x *DocumentAttributeVideo) { - if x == nil { - return - } - - x.Width = 0 - x.Height = 0 - x.Duration = 0 - x.Round = false - - p.pool.Put(x) -} - -var PoolDocumentAttributeVideo = poolDocumentAttributeVideo{} - -func (x *DocumentAttributeVideo) DeepCopy(z *DocumentAttributeVideo) { - z.Width = x.Width - z.Height = x.Height - z.Duration = x.Duration - z.Round = x.Round -} - -func (x *DocumentAttributeVideo) Clone() *DocumentAttributeVideo { - z := &DocumentAttributeVideo{} - x.DeepCopy(z) - return z -} - -func (x *DocumentAttributeVideo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DocumentAttributeVideo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DocumentAttributeVideo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DocumentAttributeVideo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DocumentAttributeVideo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DocumentAttributeVideo, x) -} - -const C_DocumentAttributePhoto int64 = 515862833 - -type poolDocumentAttributePhoto struct { - pool sync.Pool -} - -func (p *poolDocumentAttributePhoto) Get() *DocumentAttributePhoto { - x, ok := p.pool.Get().(*DocumentAttributePhoto) - if !ok { - x = &DocumentAttributePhoto{} - } - - return x -} - -func (p *poolDocumentAttributePhoto) Put(x *DocumentAttributePhoto) { - if x == nil { - return - } - - x.Width = 0 - x.Height = 0 - - p.pool.Put(x) -} - -var PoolDocumentAttributePhoto = poolDocumentAttributePhoto{} - -func (x *DocumentAttributePhoto) DeepCopy(z *DocumentAttributePhoto) { - z.Width = x.Width - z.Height = x.Height -} - -func (x *DocumentAttributePhoto) Clone() *DocumentAttributePhoto { - z := &DocumentAttributePhoto{} - x.DeepCopy(z) - return z -} - -func (x *DocumentAttributePhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DocumentAttributePhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DocumentAttributePhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DocumentAttributePhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DocumentAttributePhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DocumentAttributePhoto, x) -} - -const C_DocumentAttributeFile int64 = 2227452062 - -type poolDocumentAttributeFile struct { - pool sync.Pool -} - -func (p *poolDocumentAttributeFile) Get() *DocumentAttributeFile { - x, ok := p.pool.Get().(*DocumentAttributeFile) - if !ok { - x = &DocumentAttributeFile{} - } - - return x -} - -func (p *poolDocumentAttributeFile) Put(x *DocumentAttributeFile) { - if x == nil { - return - } - - x.Filename = "" - - p.pool.Put(x) -} - -var PoolDocumentAttributeFile = poolDocumentAttributeFile{} - -func (x *DocumentAttributeFile) DeepCopy(z *DocumentAttributeFile) { - z.Filename = x.Filename -} - -func (x *DocumentAttributeFile) Clone() *DocumentAttributeFile { - z := &DocumentAttributeFile{} - x.DeepCopy(z) - return z -} - -func (x *DocumentAttributeFile) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DocumentAttributeFile) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DocumentAttributeFile) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DocumentAttributeFile) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DocumentAttributeFile) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DocumentAttributeFile, x) -} - -const C_DocumentAttributeAnimated int64 = 1040723836 - -type poolDocumentAttributeAnimated struct { - pool sync.Pool -} - -func (p *poolDocumentAttributeAnimated) Get() *DocumentAttributeAnimated { - x, ok := p.pool.Get().(*DocumentAttributeAnimated) - if !ok { - x = &DocumentAttributeAnimated{} - } - - return x -} - -func (p *poolDocumentAttributeAnimated) Put(x *DocumentAttributeAnimated) { - if x == nil { - return - } - - x.Sound = false - - p.pool.Put(x) -} - -var PoolDocumentAttributeAnimated = poolDocumentAttributeAnimated{} - -func (x *DocumentAttributeAnimated) DeepCopy(z *DocumentAttributeAnimated) { - z.Sound = x.Sound -} - -func (x *DocumentAttributeAnimated) Clone() *DocumentAttributeAnimated { - z := &DocumentAttributeAnimated{} - x.DeepCopy(z) - return z -} - -func (x *DocumentAttributeAnimated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DocumentAttributeAnimated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DocumentAttributeAnimated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DocumentAttributeAnimated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DocumentAttributeAnimated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DocumentAttributeAnimated, x) -} - -const C_DocumentAttribute int64 = 4146719643 - -type poolDocumentAttribute struct { - pool sync.Pool -} - -func (p *poolDocumentAttribute) Get() *DocumentAttribute { - x, ok := p.pool.Get().(*DocumentAttribute) - if !ok { - x = &DocumentAttribute{} - } - - return x -} - -func (p *poolDocumentAttribute) Put(x *DocumentAttribute) { - if x == nil { - return - } - - x.Type = 0 - x.Data = x.Data[:0] - - p.pool.Put(x) -} - -var PoolDocumentAttribute = poolDocumentAttribute{} - -func (x *DocumentAttribute) DeepCopy(z *DocumentAttribute) { - z.Type = x.Type - z.Data = append(z.Data[:0], x.Data...) -} - -func (x *DocumentAttribute) Clone() *DocumentAttribute { - z := &DocumentAttribute{} - x.DeepCopy(z) - return z -} - -func (x *DocumentAttribute) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DocumentAttribute) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DocumentAttribute) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DocumentAttribute) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DocumentAttribute) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DocumentAttribute, x) -} - -const C_Document int64 = 555739168 - -type poolDocument struct { - pool sync.Pool -} - -func (p *poolDocument) Get() *Document { - x, ok := p.pool.Get().(*Document) - if !ok { - x = &Document{} - } - - x.Thumbnail = PoolFileLocation.Get() - - return x -} - -func (p *poolDocument) Put(x *Document) { - if x == nil { - return - } - - x.ID = 0 - x.AccessHash = 0 - x.Date = 0 - x.MimeType = "" - x.FileSize = 0 - x.Version = 0 - x.ClusterID = 0 - for _, z := range x.Attributes { - PoolDocumentAttribute.Put(z) - } - x.Attributes = x.Attributes[:0] - PoolFileLocation.Put(x.Thumbnail) - x.MD5Checksum = "" - x.TinyThumbnail = x.TinyThumbnail[:0] - - p.pool.Put(x) -} - -var PoolDocument = poolDocument{} - -func (x *Document) DeepCopy(z *Document) { - z.ID = x.ID - z.AccessHash = x.AccessHash - z.Date = x.Date - z.MimeType = x.MimeType - z.FileSize = x.FileSize - z.Version = x.Version - z.ClusterID = x.ClusterID - for idx := range x.Attributes { - if x.Attributes[idx] == nil { - continue - } - xx := PoolDocumentAttribute.Get() - x.Attributes[idx].DeepCopy(xx) - z.Attributes = append(z.Attributes, xx) - } - if x.Thumbnail != nil { - if z.Thumbnail == nil { - z.Thumbnail = PoolFileLocation.Get() - } - x.Thumbnail.DeepCopy(z.Thumbnail) - } else { - PoolFileLocation.Put(z.Thumbnail) - z.Thumbnail = nil - } - z.MD5Checksum = x.MD5Checksum - z.TinyThumbnail = append(z.TinyThumbnail[:0], x.TinyThumbnail...) -} - -func (x *Document) Clone() *Document { - z := &Document{} - x.DeepCopy(z) - return z -} - -func (x *Document) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Document) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Document) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Document) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Document) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Document, x) -} - -const C_InputMediaWebDocument int64 = 3529450013 - -type poolInputMediaWebDocument struct { - pool sync.Pool -} - -func (p *poolInputMediaWebDocument) Get() *InputMediaWebDocument { - x, ok := p.pool.Get().(*InputMediaWebDocument) - if !ok { - x = &InputMediaWebDocument{} - } - - return x -} - -func (p *poolInputMediaWebDocument) Put(x *InputMediaWebDocument) { - if x == nil { - return - } - - x.Url = "" - x.DocSize = 0 - x.MimeType = "" - for _, z := range x.Attributes { - PoolDocumentAttribute.Put(z) - } - x.Attributes = x.Attributes[:0] - - p.pool.Put(x) -} - -var PoolInputMediaWebDocument = poolInputMediaWebDocument{} - -func (x *InputMediaWebDocument) DeepCopy(z *InputMediaWebDocument) { - z.Url = x.Url - z.DocSize = x.DocSize - z.MimeType = x.MimeType - for idx := range x.Attributes { - if x.Attributes[idx] == nil { - continue - } - xx := PoolDocumentAttribute.Get() - x.Attributes[idx].DeepCopy(xx) - z.Attributes = append(z.Attributes, xx) - } -} - -func (x *InputMediaWebDocument) Clone() *InputMediaWebDocument { - z := &InputMediaWebDocument{} - x.DeepCopy(z) - return z -} - -func (x *InputMediaWebDocument) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputMediaWebDocument) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputMediaWebDocument) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputMediaWebDocument) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputMediaWebDocument) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputMediaWebDocument, x) -} - -const C_MediaWebDocument int64 = 1161129349 - -type poolMediaWebDocument struct { - pool sync.Pool -} - -func (p *poolMediaWebDocument) Get() *MediaWebDocument { - x, ok := p.pool.Get().(*MediaWebDocument) - if !ok { - x = &MediaWebDocument{} - } - - return x -} - -func (p *poolMediaWebDocument) Put(x *MediaWebDocument) { - if x == nil { - return - } - - x.Url = "" - x.DocSize = 0 - x.MimeType = "" - for _, z := range x.Attributes { - PoolDocumentAttribute.Put(z) - } - x.Attributes = x.Attributes[:0] - x.AccessHash = 0 - - p.pool.Put(x) -} - -var PoolMediaWebDocument = poolMediaWebDocument{} - -func (x *MediaWebDocument) DeepCopy(z *MediaWebDocument) { - z.Url = x.Url - z.DocSize = x.DocSize - z.MimeType = x.MimeType - for idx := range x.Attributes { - if x.Attributes[idx] == nil { - continue - } - xx := PoolDocumentAttribute.Get() - x.Attributes[idx].DeepCopy(xx) - z.Attributes = append(z.Attributes, xx) - } - z.AccessHash = x.AccessHash -} - -func (x *MediaWebDocument) Clone() *MediaWebDocument { - z := &MediaWebDocument{} - x.DeepCopy(z) - return z -} - -func (x *MediaWebDocument) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MediaWebDocument) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MediaWebDocument) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MediaWebDocument) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MediaWebDocument) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MediaWebDocument, x) -} - -const C_MediaWebPage int64 = 148034084 - -type poolMediaWebPage struct { - pool sync.Pool -} - -func (p *poolMediaWebPage) Get() *MediaWebPage { - x, ok := p.pool.Get().(*MediaWebPage) - if !ok { - x = &MediaWebPage{} - } - - return x -} - -func (p *poolMediaWebPage) Put(x *MediaWebPage) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolMediaWebPage = poolMediaWebPage{} - -func (x *MediaWebPage) DeepCopy(z *MediaWebPage) { -} - -func (x *MediaWebPage) Clone() *MediaWebPage { - z := &MediaWebPage{} - x.DeepCopy(z) - return z -} - -func (x *MediaWebPage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MediaWebPage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MediaWebPage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MediaWebPage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MediaWebPage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MediaWebPage, x) -} - -const C_InputMediaContact int64 = 1534117184 - -type poolInputMediaContact struct { - pool sync.Pool -} - -func (p *poolInputMediaContact) Get() *InputMediaContact { - x, ok := p.pool.Get().(*InputMediaContact) - if !ok { - x = &InputMediaContact{} - } - - return x -} - -func (p *poolInputMediaContact) Put(x *InputMediaContact) { - if x == nil { - return - } - - x.Phone = "" - x.FirstName = "" - x.LastName = "" - x.VCard = "" - - p.pool.Put(x) -} - -var PoolInputMediaContact = poolInputMediaContact{} - -func (x *InputMediaContact) DeepCopy(z *InputMediaContact) { - z.Phone = x.Phone - z.FirstName = x.FirstName - z.LastName = x.LastName - z.VCard = x.VCard -} - -func (x *InputMediaContact) Clone() *InputMediaContact { - z := &InputMediaContact{} - x.DeepCopy(z) - return z -} - -func (x *InputMediaContact) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputMediaContact) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputMediaContact) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputMediaContact) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputMediaContact) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputMediaContact, x) -} - -const C_MediaContact int64 = 3735320833 - -type poolMediaContact struct { - pool sync.Pool -} - -func (p *poolMediaContact) Get() *MediaContact { - x, ok := p.pool.Get().(*MediaContact) - if !ok { - x = &MediaContact{} - } - - return x -} - -func (p *poolMediaContact) Put(x *MediaContact) { - if x == nil { - return - } - - x.Phone = "" - x.FirstName = "" - x.LastName = "" - x.VCard = "" - - p.pool.Put(x) -} - -var PoolMediaContact = poolMediaContact{} - -func (x *MediaContact) DeepCopy(z *MediaContact) { - z.Phone = x.Phone - z.FirstName = x.FirstName - z.LastName = x.LastName - z.VCard = x.VCard -} - -func (x *MediaContact) Clone() *MediaContact { - z := &MediaContact{} - x.DeepCopy(z) - return z -} - -func (x *MediaContact) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MediaContact) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MediaContact) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MediaContact) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MediaContact) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MediaContact, x) -} - -const C_InputMediaUploadedDocument int64 = 870692909 - -type poolInputMediaUploadedDocument struct { - pool sync.Pool -} - -func (p *poolInputMediaUploadedDocument) Get() *InputMediaUploadedDocument { - x, ok := p.pool.Get().(*InputMediaUploadedDocument) - if !ok { - x = &InputMediaUploadedDocument{} - } - - x.File = PoolInputFile.Get() - - x.Thumbnail = PoolInputFile.Get() - - return x -} - -func (p *poolInputMediaUploadedDocument) Put(x *InputMediaUploadedDocument) { - if x == nil { - return - } - - PoolInputFile.Put(x.File) - PoolInputFile.Put(x.Thumbnail) - x.MimeType = "" - x.Caption = "" - for _, z := range x.Stickers { - PoolInputDocument.Put(z) - } - x.Stickers = x.Stickers[:0] - for _, z := range x.Attributes { - PoolDocumentAttribute.Put(z) - } - x.Attributes = x.Attributes[:0] - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.TinyThumbnail = x.TinyThumbnail[:0] - - p.pool.Put(x) -} - -var PoolInputMediaUploadedDocument = poolInputMediaUploadedDocument{} - -func (x *InputMediaUploadedDocument) DeepCopy(z *InputMediaUploadedDocument) { - if x.File != nil { - if z.File == nil { - z.File = PoolInputFile.Get() - } - x.File.DeepCopy(z.File) - } else { - PoolInputFile.Put(z.File) - z.File = nil - } - if x.Thumbnail != nil { - if z.Thumbnail == nil { - z.Thumbnail = PoolInputFile.Get() - } - x.Thumbnail.DeepCopy(z.Thumbnail) - } else { - PoolInputFile.Put(z.Thumbnail) - z.Thumbnail = nil - } - z.MimeType = x.MimeType - z.Caption = x.Caption - for idx := range x.Stickers { - if x.Stickers[idx] == nil { - continue - } - xx := PoolInputDocument.Get() - x.Stickers[idx].DeepCopy(xx) - z.Stickers = append(z.Stickers, xx) - } - for idx := range x.Attributes { - if x.Attributes[idx] == nil { - continue - } - xx := PoolDocumentAttribute.Get() - x.Attributes[idx].DeepCopy(xx) - z.Attributes = append(z.Attributes, xx) - } - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.TinyThumbnail = append(z.TinyThumbnail[:0], x.TinyThumbnail...) -} - -func (x *InputMediaUploadedDocument) Clone() *InputMediaUploadedDocument { - z := &InputMediaUploadedDocument{} - x.DeepCopy(z) - return z -} - -func (x *InputMediaUploadedDocument) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputMediaUploadedDocument) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputMediaUploadedDocument) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputMediaUploadedDocument) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputMediaUploadedDocument) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputMediaUploadedDocument, x) -} - -const C_InputMediaDocument int64 = 2258657627 - -type poolInputMediaDocument struct { - pool sync.Pool -} - -func (p *poolInputMediaDocument) Get() *InputMediaDocument { - x, ok := p.pool.Get().(*InputMediaDocument) - if !ok { - x = &InputMediaDocument{} - } - - x.Document = PoolInputDocument.Get() - - x.Thumbnail = PoolInputFile.Get() - - return x -} - -func (p *poolInputMediaDocument) Put(x *InputMediaDocument) { - if x == nil { - return - } - - x.Caption = "" - PoolInputDocument.Put(x.Document) - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - PoolInputFile.Put(x.Thumbnail) - for _, z := range x.Attributes { - PoolDocumentAttribute.Put(z) - } - x.Attributes = x.Attributes[:0] - x.TinyThumbnail = x.TinyThumbnail[:0] - - p.pool.Put(x) -} - -var PoolInputMediaDocument = poolInputMediaDocument{} - -func (x *InputMediaDocument) DeepCopy(z *InputMediaDocument) { - z.Caption = x.Caption - if x.Document != nil { - if z.Document == nil { - z.Document = PoolInputDocument.Get() - } - x.Document.DeepCopy(z.Document) - } else { - PoolInputDocument.Put(z.Document) - z.Document = nil - } - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - if x.Thumbnail != nil { - if z.Thumbnail == nil { - z.Thumbnail = PoolInputFile.Get() - } - x.Thumbnail.DeepCopy(z.Thumbnail) - } else { - PoolInputFile.Put(z.Thumbnail) - z.Thumbnail = nil - } - for idx := range x.Attributes { - if x.Attributes[idx] == nil { - continue - } - xx := PoolDocumentAttribute.Get() - x.Attributes[idx].DeepCopy(xx) - z.Attributes = append(z.Attributes, xx) - } - z.TinyThumbnail = append(z.TinyThumbnail[:0], x.TinyThumbnail...) -} - -func (x *InputMediaDocument) Clone() *InputMediaDocument { - z := &InputMediaDocument{} - x.DeepCopy(z) - return z -} - -func (x *InputMediaDocument) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputMediaDocument) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputMediaDocument) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputMediaDocument) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputMediaDocument) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputMediaDocument, x) -} - -const C_InputMediaMessageDocument int64 = 3638653559 - -type poolInputMediaMessageDocument struct { - pool sync.Pool -} - -func (p *poolInputMediaMessageDocument) Get() *InputMediaMessageDocument { - x, ok := p.pool.Get().(*InputMediaMessageDocument) - if !ok { - x = &InputMediaMessageDocument{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolInputMediaMessageDocument) Put(x *InputMediaMessageDocument) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageID = 0 - x.Caption = "" - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - - p.pool.Put(x) -} - -var PoolInputMediaMessageDocument = poolInputMediaMessageDocument{} - -func (x *InputMediaMessageDocument) DeepCopy(z *InputMediaMessageDocument) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageID = x.MessageID - z.Caption = x.Caption - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } -} - -func (x *InputMediaMessageDocument) Clone() *InputMediaMessageDocument { - z := &InputMediaMessageDocument{} - x.DeepCopy(z) - return z -} - -func (x *InputMediaMessageDocument) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputMediaMessageDocument) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputMediaMessageDocument) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputMediaMessageDocument) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputMediaMessageDocument) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputMediaMessageDocument, x) -} - -const C_MediaDocument int64 = 2281620705 - -type poolMediaDocument struct { - pool sync.Pool -} - -func (p *poolMediaDocument) Get() *MediaDocument { - x, ok := p.pool.Get().(*MediaDocument) - if !ok { - x = &MediaDocument{} - } - - x.Doc = PoolDocument.Get() - - return x -} - -func (p *poolMediaDocument) Put(x *MediaDocument) { - if x == nil { - return - } - - x.Caption = "" - x.TTLinSeconds = 0 - PoolDocument.Put(x.Doc) - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - - p.pool.Put(x) -} - -var PoolMediaDocument = poolMediaDocument{} - -func (x *MediaDocument) DeepCopy(z *MediaDocument) { - z.Caption = x.Caption - z.TTLinSeconds = x.TTLinSeconds - if x.Doc != nil { - if z.Doc == nil { - z.Doc = PoolDocument.Get() - } - x.Doc.DeepCopy(z.Doc) - } else { - PoolDocument.Put(z.Doc) - z.Doc = nil - } - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } -} - -func (x *MediaDocument) Clone() *MediaDocument { - z := &MediaDocument{} - x.DeepCopy(z) - return z -} - -func (x *MediaDocument) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MediaDocument) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MediaDocument) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MediaDocument) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MediaDocument) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MediaDocument, x) -} - -const C_InputMediaGeoLocation int64 = 185664060 - -type poolInputMediaGeoLocation struct { - pool sync.Pool -} - -func (p *poolInputMediaGeoLocation) Get() *InputMediaGeoLocation { - x, ok := p.pool.Get().(*InputMediaGeoLocation) - if !ok { - x = &InputMediaGeoLocation{} - } - - return x -} - -func (p *poolInputMediaGeoLocation) Put(x *InputMediaGeoLocation) { - if x == nil { - return - } - - x.Lat = 0 - x.Long = 0 - x.Caption = "" - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - - p.pool.Put(x) -} - -var PoolInputMediaGeoLocation = poolInputMediaGeoLocation{} - -func (x *InputMediaGeoLocation) DeepCopy(z *InputMediaGeoLocation) { - z.Lat = x.Lat - z.Long = x.Long - z.Caption = x.Caption - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } -} - -func (x *InputMediaGeoLocation) Clone() *InputMediaGeoLocation { - z := &InputMediaGeoLocation{} - x.DeepCopy(z) - return z -} - -func (x *InputMediaGeoLocation) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputMediaGeoLocation) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputMediaGeoLocation) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputMediaGeoLocation) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputMediaGeoLocation) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputMediaGeoLocation, x) -} - -const C_MediaGeoLocation int64 = 2625326500 - -type poolMediaGeoLocation struct { - pool sync.Pool -} - -func (p *poolMediaGeoLocation) Get() *MediaGeoLocation { - x, ok := p.pool.Get().(*MediaGeoLocation) - if !ok { - x = &MediaGeoLocation{} - } - - return x -} - -func (p *poolMediaGeoLocation) Put(x *MediaGeoLocation) { - if x == nil { - return - } - - x.Lat = 0 - x.Long = 0 - x.Caption = "" - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - - p.pool.Put(x) -} - -var PoolMediaGeoLocation = poolMediaGeoLocation{} - -func (x *MediaGeoLocation) DeepCopy(z *MediaGeoLocation) { - z.Lat = x.Lat - z.Long = x.Long - z.Caption = x.Caption - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } -} - -func (x *MediaGeoLocation) Clone() *MediaGeoLocation { - z := &MediaGeoLocation{} - x.DeepCopy(z) - return z -} - -func (x *MediaGeoLocation) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MediaGeoLocation) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MediaGeoLocation) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MediaGeoLocation) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MediaGeoLocation) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MediaGeoLocation, x) -} - -const C_InputMediaPoll int64 = 3633337678 - -type poolInputMediaPoll struct { - pool sync.Pool -} - -func (p *poolInputMediaPoll) Get() *InputMediaPoll { - x, ok := p.pool.Get().(*InputMediaPoll) - if !ok { - x = &InputMediaPoll{} - } - - x.Poll = PoolMediaPoll.Get() - - return x -} - -func (p *poolInputMediaPoll) Put(x *InputMediaPoll) { - if x == nil { - return - } - - PoolMediaPoll.Put(x.Poll) - - p.pool.Put(x) -} - -var PoolInputMediaPoll = poolInputMediaPoll{} - -func (x *InputMediaPoll) DeepCopy(z *InputMediaPoll) { - if x.Poll != nil { - if z.Poll == nil { - z.Poll = PoolMediaPoll.Get() - } - x.Poll.DeepCopy(z.Poll) - } else { - PoolMediaPoll.Put(z.Poll) - z.Poll = nil - } -} - -func (x *InputMediaPoll) Clone() *InputMediaPoll { - z := &InputMediaPoll{} - x.DeepCopy(z) - return z -} - -func (x *InputMediaPoll) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputMediaPoll) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputMediaPoll) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputMediaPoll) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputMediaPoll) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputMediaPoll, x) -} - -const C_MediaPoll int64 = 2688924895 - -type poolMediaPoll struct { - pool sync.Pool -} - -func (p *poolMediaPoll) Get() *MediaPoll { - x, ok := p.pool.Get().(*MediaPoll) - if !ok { - x = &MediaPoll{} - } - - return x -} - -func (p *poolMediaPoll) Put(x *MediaPoll) { - if x == nil { - return - } - - x.ID = 0 - x.Closed = false - x.PublicVoters = false - x.MultiChoice = false - x.Quiz = false - x.Question = "" - for _, z := range x.Answers { - PoolPollAnswer.Put(z) - } - x.Answers = x.Answers[:0] - - p.pool.Put(x) -} - -var PoolMediaPoll = poolMediaPoll{} - -func (x *MediaPoll) DeepCopy(z *MediaPoll) { - z.ID = x.ID - z.Closed = x.Closed - z.PublicVoters = x.PublicVoters - z.MultiChoice = x.MultiChoice - z.Quiz = x.Quiz - z.Question = x.Question - for idx := range x.Answers { - if x.Answers[idx] == nil { - continue - } - xx := PoolPollAnswer.Get() - x.Answers[idx].DeepCopy(xx) - z.Answers = append(z.Answers, xx) - } -} - -func (x *MediaPoll) Clone() *MediaPoll { - z := &MediaPoll{} - x.DeepCopy(z) - return z -} - -func (x *MediaPoll) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MediaPoll) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MediaPoll) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MediaPoll) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MediaPoll) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MediaPoll, x) -} - -const C_PollAnswer int64 = 2124799390 - -type poolPollAnswer struct { - pool sync.Pool -} - -func (p *poolPollAnswer) Get() *PollAnswer { - x, ok := p.pool.Get().(*PollAnswer) - if !ok { - x = &PollAnswer{} - } - - return x -} - -func (p *poolPollAnswer) Put(x *PollAnswer) { - if x == nil { - return - } - - x.Text = "" - x.Option = x.Option[:0] - - p.pool.Put(x) -} - -var PoolPollAnswer = poolPollAnswer{} - -func (x *PollAnswer) DeepCopy(z *PollAnswer) { - z.Text = x.Text - z.Option = append(z.Option[:0], x.Option...) -} - -func (x *PollAnswer) Clone() *PollAnswer { - z := &PollAnswer{} - x.DeepCopy(z) - return z -} - -func (x *PollAnswer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PollAnswer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PollAnswer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PollAnswer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PollAnswer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PollAnswer, x) -} - -const C_PollResults int64 = 3283416711 - -type poolPollResults struct { - pool sync.Pool -} - -func (p *poolPollResults) Get() *PollResults { - x, ok := p.pool.Get().(*PollResults) - if !ok { - x = &PollResults{} - } - - return x -} - -func (p *poolPollResults) Put(x *PollResults) { - if x == nil { - return - } - - for _, z := range x.Results { - PoolPollAnswerVoters.Put(z) - } - x.Results = x.Results[:0] - x.TotalVoters = 0 - - p.pool.Put(x) -} - -var PoolPollResults = poolPollResults{} - -func (x *PollResults) DeepCopy(z *PollResults) { - for idx := range x.Results { - if x.Results[idx] == nil { - continue - } - xx := PoolPollAnswerVoters.Get() - x.Results[idx].DeepCopy(xx) - z.Results = append(z.Results, xx) - } - z.TotalVoters = x.TotalVoters -} - -func (x *PollResults) Clone() *PollResults { - z := &PollResults{} - x.DeepCopy(z) - return z -} - -func (x *PollResults) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PollResults) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PollResults) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PollResults) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PollResults) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PollResults, x) -} - -const C_PollAnswerVoters int64 = 2095107985 - -type poolPollAnswerVoters struct { - pool sync.Pool -} - -func (p *poolPollAnswerVoters) Get() *PollAnswerVoters { - x, ok := p.pool.Get().(*PollAnswerVoters) - if !ok { - x = &PollAnswerVoters{} - } - - return x -} - -func (p *poolPollAnswerVoters) Put(x *PollAnswerVoters) { - if x == nil { - return - } - - x.Chosen = false - x.Correct = false - x.Option = x.Option[:0] - x.Voters = 0 - - p.pool.Put(x) -} - -var PoolPollAnswerVoters = poolPollAnswerVoters{} - -func (x *PollAnswerVoters) DeepCopy(z *PollAnswerVoters) { - z.Chosen = x.Chosen - z.Correct = x.Correct - z.Option = append(z.Option[:0], x.Option...) - z.Voters = x.Voters -} - -func (x *PollAnswerVoters) Clone() *PollAnswerVoters { - z := &PollAnswerVoters{} - x.DeepCopy(z) - return z -} - -func (x *PollAnswerVoters) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PollAnswerVoters) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PollAnswerVoters) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PollAnswerVoters) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PollAnswerVoters) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PollAnswerVoters, x) -} - -func init() { - registry.RegisterConstructor(2787573148, "DocumentAttributeVoiceCall") - registry.RegisterConstructor(309707708, "DocumentAttributeAudio") - registry.RegisterConstructor(1993289477, "DocumentAttributeVideo") - registry.RegisterConstructor(515862833, "DocumentAttributePhoto") - registry.RegisterConstructor(2227452062, "DocumentAttributeFile") - registry.RegisterConstructor(1040723836, "DocumentAttributeAnimated") - registry.RegisterConstructor(4146719643, "DocumentAttribute") - registry.RegisterConstructor(555739168, "Document") - registry.RegisterConstructor(3529450013, "InputMediaWebDocument") - registry.RegisterConstructor(1161129349, "MediaWebDocument") - registry.RegisterConstructor(148034084, "MediaWebPage") - registry.RegisterConstructor(1534117184, "InputMediaContact") - registry.RegisterConstructor(3735320833, "MediaContact") - registry.RegisterConstructor(870692909, "InputMediaUploadedDocument") - registry.RegisterConstructor(2258657627, "InputMediaDocument") - registry.RegisterConstructor(3638653559, "InputMediaMessageDocument") - registry.RegisterConstructor(2281620705, "MediaDocument") - registry.RegisterConstructor(185664060, "InputMediaGeoLocation") - registry.RegisterConstructor(2625326500, "MediaGeoLocation") - registry.RegisterConstructor(3633337678, "InputMediaPoll") - registry.RegisterConstructor(2688924895, "MediaPoll") - registry.RegisterConstructor(2124799390, "PollAnswer") - registry.RegisterConstructor(3283416711, "PollResults") - registry.RegisterConstructor(2095107985, "PollAnswerVoters") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.pb.go deleted file mode 100644 index d86c546e..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.pb.go +++ /dev/null @@ -1,2876 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.messages.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// MessageSend -// @Function -// @Return: MessagesSent -type MessagesSend struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Body string `protobuf:"bytes,5,opt,name=Body,proto3" json:"Body,omitempty"` - ReplyTo int64 `protobuf:"varint,6,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - ClearDraft bool `protobuf:"varint,7,opt,name=ClearDraft,proto3" json:"ClearDraft,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,8,rep,name=Entities,proto3" json:"Entities,omitempty"` -} - -func (x *MessagesSend) Reset() { - *x = MessagesSend{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesSend) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesSend) ProtoMessage() {} - -func (x *MessagesSend) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesSend.ProtoReflect.Descriptor instead. -func (*MessagesSend) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{0} -} - -func (x *MessagesSend) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *MessagesSend) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesSend) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *MessagesSend) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *MessagesSend) GetClearDraft() bool { - if x != nil { - return x.ClearDraft - } - return false -} - -func (x *MessagesSend) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -// MessageSendMedia -// @Function -// @Return: Messages -type MessagesSendMedia struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - MediaType InputMediaType `protobuf:"varint,3,opt,name=MediaType,proto3,enum=msg.InputMediaType" json:"MediaType,omitempty"` - MediaData []byte `protobuf:"bytes,4,opt,name=MediaData,proto3" json:"MediaData,omitempty"` - ReplyTo int64 `protobuf:"varint,5,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - ClearDraft bool `protobuf:"varint,6,opt,name=ClearDraft,proto3" json:"ClearDraft,omitempty"` -} - -func (x *MessagesSendMedia) Reset() { - *x = MessagesSendMedia{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesSendMedia) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesSendMedia) ProtoMessage() {} - -func (x *MessagesSendMedia) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesSendMedia.ProtoReflect.Descriptor instead. -func (*MessagesSendMedia) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{1} -} - -func (x *MessagesSendMedia) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *MessagesSendMedia) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesSendMedia) GetMediaType() InputMediaType { - if x != nil { - return x.MediaType - } - return InputMediaType_InputMediaTypeEmpty -} - -func (x *MessagesSendMedia) GetMediaData() []byte { - if x != nil { - return x.MediaData - } - return nil -} - -func (x *MessagesSendMedia) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *MessagesSendMedia) GetClearDraft() bool { - if x != nil { - return x.ClearDraft - } - return false -} - -// MessagesEdit -// @Function -// @Return: Bool -type MessagesEdit struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Body string `protobuf:"bytes,3,opt,name=Body,proto3" json:"Body,omitempty"` - MessageID int64 `protobuf:"varint,4,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,5,rep,name=Entities,proto3" json:"Entities,omitempty"` -} - -func (x *MessagesEdit) Reset() { - *x = MessagesEdit{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesEdit) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesEdit) ProtoMessage() {} - -func (x *MessagesEdit) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesEdit.ProtoReflect.Descriptor instead. -func (*MessagesEdit) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{2} -} - -func (x *MessagesEdit) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *MessagesEdit) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesEdit) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *MessagesEdit) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *MessagesEdit) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -// MessagesEditMedia -// @Function -// @Return: Bool -type MessagesEditMedia struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageID int64 `protobuf:"varint,3,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Caption string `protobuf:"bytes,4,opt,name=Caption,proto3" json:"Caption,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,5,rep,name=Entities,proto3" json:"Entities,omitempty"` -} - -func (x *MessagesEditMedia) Reset() { - *x = MessagesEditMedia{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesEditMedia) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesEditMedia) ProtoMessage() {} - -func (x *MessagesEditMedia) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesEditMedia.ProtoReflect.Descriptor instead. -func (*MessagesEditMedia) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{3} -} - -func (x *MessagesEditMedia) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *MessagesEditMedia) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesEditMedia) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *MessagesEditMedia) GetCaption() string { - if x != nil { - return x.Caption - } - return "" -} - -func (x *MessagesEditMedia) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -// MessageReadHistory -// @Function -// Returns: -type MessagesReadHistory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - MaxID int64 `protobuf:"varint,3,opt,name=MaxID,proto3" json:"MaxID,omitempty"` -} - -func (x *MessagesReadHistory) Reset() { - *x = MessagesReadHistory{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesReadHistory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesReadHistory) ProtoMessage() {} - -func (x *MessagesReadHistory) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesReadHistory.ProtoReflect.Descriptor instead. -func (*MessagesReadHistory) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{4} -} - -func (x *MessagesReadHistory) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesReadHistory) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -// MessagesGet -// @Function -// Returns: MessagesMany -type MessagesGet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessagesIDs []int64 `protobuf:"varint,2,rep,packed,name=MessagesIDs,proto3" json:"MessagesIDs,omitempty"` -} - -func (x *MessagesGet) Reset() { - *x = MessagesGet{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesGet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesGet) ProtoMessage() {} - -func (x *MessagesGet) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesGet.ProtoReflect.Descriptor instead. -func (*MessagesGet) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{5} -} - -func (x *MessagesGet) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesGet) GetMessagesIDs() []int64 { - if x != nil { - return x.MessagesIDs - } - return nil -} - -// MessagesGetHistory -// @Function -// Returns: MessagesMany -type MessagesGetHistory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Limit int32 `protobuf:"varint,3,opt,name=Limit,proto3" json:"Limit,omitempty"` - MaxID int64 `protobuf:"varint,4,opt,name=MaxID,proto3" json:"MaxID,omitempty"` - MinID int64 `protobuf:"varint,5,opt,name=MinID,proto3" json:"MinID,omitempty"` -} - -func (x *MessagesGetHistory) Reset() { - *x = MessagesGetHistory{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesGetHistory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesGetHistory) ProtoMessage() {} - -func (x *MessagesGetHistory) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesGetHistory.ProtoReflect.Descriptor instead. -func (*MessagesGetHistory) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{6} -} - -func (x *MessagesGetHistory) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesGetHistory) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *MessagesGetHistory) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -func (x *MessagesGetHistory) GetMinID() int64 { - if x != nil { - return x.MinID - } - return 0 -} - -// MessagesGetMediaHistory -// @Function -// Returns: MessagesMany -type MessagesGetMediaHistory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Limit int32 `protobuf:"varint,3,opt,name=Limit,proto3" json:"Limit,omitempty"` - MaxID int64 `protobuf:"varint,4,opt,name=MaxID,proto3" json:"MaxID,omitempty"` - Cat MediaCategory `protobuf:"varint,5,opt,name=Cat,proto3,enum=msg.MediaCategory" json:"Cat,omitempty"` -} - -func (x *MessagesGetMediaHistory) Reset() { - *x = MessagesGetMediaHistory{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesGetMediaHistory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesGetMediaHistory) ProtoMessage() {} - -func (x *MessagesGetMediaHistory) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesGetMediaHistory.ProtoReflect.Descriptor instead. -func (*MessagesGetMediaHistory) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{7} -} - -func (x *MessagesGetMediaHistory) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesGetMediaHistory) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *MessagesGetMediaHistory) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -func (x *MessagesGetMediaHistory) GetCat() MediaCategory { - if x != nil { - return x.Cat - } - return MediaCategory_MediaCategoryNone -} - -// MessagesGetDialogs -// @Function -// Returns: MessagesDialogs -type MessagesGetDialogs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Limit int32 `protobuf:"varint,2,opt,name=Limit,proto3" json:"Limit,omitempty"` - Offset int32 `protobuf:"varint,3,opt,name=Offset,proto3" json:"Offset,omitempty"` - ExcludePinned bool `protobuf:"varint,4,opt,name=ExcludePinned,proto3" json:"ExcludePinned,omitempty"` -} - -func (x *MessagesGetDialogs) Reset() { - *x = MessagesGetDialogs{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesGetDialogs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesGetDialogs) ProtoMessage() {} - -func (x *MessagesGetDialogs) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesGetDialogs.ProtoReflect.Descriptor instead. -func (*MessagesGetDialogs) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{8} -} - -func (x *MessagesGetDialogs) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *MessagesGetDialogs) GetOffset() int32 { - if x != nil { - return x.Offset - } - return 0 -} - -func (x *MessagesGetDialogs) GetExcludePinned() bool { - if x != nil { - return x.ExcludePinned - } - return false -} - -// MessagesGetPinnedDialogs -// @Function -// @Returns: MessagesDialogs -type MessagesGetPinnedDialogs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MessagesGetPinnedDialogs) Reset() { - *x = MessagesGetPinnedDialogs{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesGetPinnedDialogs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesGetPinnedDialogs) ProtoMessage() {} - -func (x *MessagesGetPinnedDialogs) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesGetPinnedDialogs.ProtoReflect.Descriptor instead. -func (*MessagesGetPinnedDialogs) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{9} -} - -// MessagesGetDialog -// @Function -// Returns: Dialog -type MessagesGetDialog struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *MessagesGetDialog) Reset() { - *x = MessagesGetDialog{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesGetDialog) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesGetDialog) ProtoMessage() {} - -func (x *MessagesGetDialog) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesGetDialog.ProtoReflect.Descriptor instead. -func (*MessagesGetDialog) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{10} -} - -func (x *MessagesGetDialog) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// MessagesSetTyping -// @Function -// Returns: Bool -type MessagesSetTyping struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - Action TypingAction `protobuf:"varint,2,opt,name=Action,proto3,enum=msg.TypingAction" json:"Action,omitempty"` -} - -func (x *MessagesSetTyping) Reset() { - *x = MessagesSetTyping{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesSetTyping) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesSetTyping) ProtoMessage() {} - -func (x *MessagesSetTyping) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesSetTyping.ProtoReflect.Descriptor instead. -func (*MessagesSetTyping) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{11} -} - -func (x *MessagesSetTyping) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesSetTyping) GetAction() TypingAction { - if x != nil { - return x.Action - } - return TypingAction_TypingActionTyping -} - -// MessageClearHistory -// @Function -// Returns: Bool -type MessagesClearHistory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MaxID int64 `protobuf:"varint,2,opt,name=MaxID,proto3" json:"MaxID,omitempty"` - Delete bool `protobuf:"varint,3,opt,name=Delete,proto3" json:"Delete,omitempty"` -} - -func (x *MessagesClearHistory) Reset() { - *x = MessagesClearHistory{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesClearHistory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesClearHistory) ProtoMessage() {} - -func (x *MessagesClearHistory) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesClearHistory.ProtoReflect.Descriptor instead. -func (*MessagesClearHistory) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{12} -} - -func (x *MessagesClearHistory) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesClearHistory) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -func (x *MessagesClearHistory) GetDelete() bool { - if x != nil { - return x.Delete - } - return false -} - -// MessagesDelete -// @Function -// Returns: Bool -type MessagesDelete struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageIDs []int64 `protobuf:"varint,2,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` - Revoke bool `protobuf:"varint,3,opt,name=Revoke,proto3" json:"Revoke,omitempty"` -} - -func (x *MessagesDelete) Reset() { - *x = MessagesDelete{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesDelete) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesDelete) ProtoMessage() {} - -func (x *MessagesDelete) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesDelete.ProtoReflect.Descriptor instead. -func (*MessagesDelete) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{13} -} - -func (x *MessagesDelete) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesDelete) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -func (x *MessagesDelete) GetRevoke() bool { - if x != nil { - return x.Revoke - } - return false -} - -// MessagesForward -// @Function -// Returns: Bool -type MessagesForward struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FromPeer *InputPeer `protobuf:"bytes,1,opt,name=FromPeer,proto3" json:"FromPeer,omitempty"` - ToPeer *InputPeer `protobuf:"bytes,2,opt,name=ToPeer,proto3" json:"ToPeer,omitempty"` - Silence bool `protobuf:"varint,3,opt,name=Silence,proto3" json:"Silence,omitempty"` - MessageIDs []int64 `protobuf:"varint,4,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` - RandomID int64 `protobuf:"varint,5,opt,name=RandomID,proto3" json:"RandomID,omitempty"` -} - -func (x *MessagesForward) Reset() { - *x = MessagesForward{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesForward) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesForward) ProtoMessage() {} - -func (x *MessagesForward) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesForward.ProtoReflect.Descriptor instead. -func (*MessagesForward) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{14} -} - -func (x *MessagesForward) GetFromPeer() *InputPeer { - if x != nil { - return x.FromPeer - } - return nil -} - -func (x *MessagesForward) GetToPeer() *InputPeer { - if x != nil { - return x.ToPeer - } - return nil -} - -func (x *MessagesForward) GetSilence() bool { - if x != nil { - return x.Silence - } - return false -} - -func (x *MessagesForward) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -func (x *MessagesForward) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -// MessagesReadContents -// @Function -// Returns: Bool -type MessagesReadContents struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageIDs []int64 `protobuf:"varint,2,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` -} - -func (x *MessagesReadContents) Reset() { - *x = MessagesReadContents{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesReadContents) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesReadContents) ProtoMessage() {} - -func (x *MessagesReadContents) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesReadContents.ProtoReflect.Descriptor instead. -func (*MessagesReadContents) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{15} -} - -func (x *MessagesReadContents) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesReadContents) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -// MessagesSaveDraft -// @Function -// Returns: Bool -type MessagesSaveDraft struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - ReplyTo int64 `protobuf:"varint,2,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - Body string `protobuf:"bytes,3,opt,name=Body,proto3" json:"Body,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,4,rep,name=Entities,proto3" json:"Entities,omitempty"` - EditedID int64 `protobuf:"varint,5,opt,name=EditedID,proto3" json:"EditedID,omitempty"` -} - -func (x *MessagesSaveDraft) Reset() { - *x = MessagesSaveDraft{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesSaveDraft) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesSaveDraft) ProtoMessage() {} - -func (x *MessagesSaveDraft) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesSaveDraft.ProtoReflect.Descriptor instead. -func (*MessagesSaveDraft) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{16} -} - -func (x *MessagesSaveDraft) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesSaveDraft) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *MessagesSaveDraft) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *MessagesSaveDraft) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *MessagesSaveDraft) GetEditedID() int64 { - if x != nil { - return x.EditedID - } - return 0 -} - -// MessagesClearDraft -// @Function -// @Returns: Bool -type MessagesClearDraft struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *MessagesClearDraft) Reset() { - *x = MessagesClearDraft{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesClearDraft) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesClearDraft) ProtoMessage() {} - -func (x *MessagesClearDraft) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesClearDraft.ProtoReflect.Descriptor instead. -func (*MessagesClearDraft) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{17} -} - -func (x *MessagesClearDraft) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// MessagesToggleDialogPin -// @Function -// @Returns: Bool -type MessagesToggleDialogPin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - Pin bool `protobuf:"varint,2,opt,name=Pin,proto3" json:"Pin,omitempty"` -} - -func (x *MessagesToggleDialogPin) Reset() { - *x = MessagesToggleDialogPin{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesToggleDialogPin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesToggleDialogPin) ProtoMessage() {} - -func (x *MessagesToggleDialogPin) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesToggleDialogPin.ProtoReflect.Descriptor instead. -func (*MessagesToggleDialogPin) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{18} -} - -func (x *MessagesToggleDialogPin) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesToggleDialogPin) GetPin() bool { - if x != nil { - return x.Pin - } - return false -} - -// MessagesReorderPinnedDialogs -// @Function -// @Returns: Bool -type MessagesReorderPinnedDialogs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peers []*InputPeer `protobuf:"bytes,1,rep,name=Peers,proto3" json:"Peers,omitempty"` -} - -func (x *MessagesReorderPinnedDialogs) Reset() { - *x = MessagesReorderPinnedDialogs{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesReorderPinnedDialogs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesReorderPinnedDialogs) ProtoMessage() {} - -func (x *MessagesReorderPinnedDialogs) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesReorderPinnedDialogs.ProtoReflect.Descriptor instead. -func (*MessagesReorderPinnedDialogs) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{19} -} - -func (x *MessagesReorderPinnedDialogs) GetPeers() []*InputPeer { - if x != nil { - return x.Peers - } - return nil -} - -// MessagesSendScreenShotNotification -// @Function -// @Returns: Bool -type MessagesSendScreenShotNotification struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - RandomID int64 `protobuf:"varint,2,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - ReplyTo int64 `protobuf:"varint,3,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - MinID int64 `protobuf:"varint,4,opt,name=MinID,proto3" json:"MinID,omitempty"` - MaxID int64 `protobuf:"varint,5,opt,name=MaxID,proto3" json:"MaxID,omitempty"` -} - -func (x *MessagesSendScreenShotNotification) Reset() { - *x = MessagesSendScreenShotNotification{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesSendScreenShotNotification) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesSendScreenShotNotification) ProtoMessage() {} - -func (x *MessagesSendScreenShotNotification) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesSendScreenShotNotification.ProtoReflect.Descriptor instead. -func (*MessagesSendScreenShotNotification) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{20} -} - -func (x *MessagesSendScreenShotNotification) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesSendScreenShotNotification) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *MessagesSendScreenShotNotification) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *MessagesSendScreenShotNotification) GetMinID() int64 { - if x != nil { - return x.MinID - } - return 0 -} - -func (x *MessagesSendScreenShotNotification) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -// MessageSendReaction -// @Function -// @Returns: Bool -type MessagesSendReaction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageID int64 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Reaction string `protobuf:"bytes,3,opt,name=Reaction,proto3" json:"Reaction,omitempty"` -} - -func (x *MessagesSendReaction) Reset() { - *x = MessagesSendReaction{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesSendReaction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesSendReaction) ProtoMessage() {} - -func (x *MessagesSendReaction) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesSendReaction.ProtoReflect.Descriptor instead. -func (*MessagesSendReaction) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{21} -} - -func (x *MessagesSendReaction) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesSendReaction) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *MessagesSendReaction) GetReaction() string { - if x != nil { - return x.Reaction - } - return "" -} - -// MessagesDeleteReaction -// @Function -// @Returns: Bool -type MessagesDeleteReaction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageID int64 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Reactions []string `protobuf:"bytes,3,rep,name=Reactions,proto3" json:"Reactions,omitempty"` -} - -func (x *MessagesDeleteReaction) Reset() { - *x = MessagesDeleteReaction{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesDeleteReaction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesDeleteReaction) ProtoMessage() {} - -func (x *MessagesDeleteReaction) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesDeleteReaction.ProtoReflect.Descriptor instead. -func (*MessagesDeleteReaction) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{22} -} - -func (x *MessagesDeleteReaction) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesDeleteReaction) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *MessagesDeleteReaction) GetReactions() []string { - if x != nil { - return x.Reactions - } - return nil -} - -// MessagesGetReactionList -// @Function -// @Return: MessagesReactionList -type MessagesGetReactionList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageID int64 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Hash int32 `protobuf:"varint,3,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *MessagesGetReactionList) Reset() { - *x = MessagesGetReactionList{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesGetReactionList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesGetReactionList) ProtoMessage() {} - -func (x *MessagesGetReactionList) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesGetReactionList.ProtoReflect.Descriptor instead. -func (*MessagesGetReactionList) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{23} -} - -func (x *MessagesGetReactionList) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesGetReactionList) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *MessagesGetReactionList) GetHash() int32 { - if x != nil { - return x.Hash - } - return 0 -} - -// MessagesPin -// @Function -// @Return: Bool -type MessagesTogglePin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageID int64 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Silent bool `protobuf:"varint,3,opt,name=Silent,proto3" json:"Silent,omitempty"` -} - -func (x *MessagesTogglePin) Reset() { - *x = MessagesTogglePin{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesTogglePin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesTogglePin) ProtoMessage() {} - -func (x *MessagesTogglePin) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesTogglePin.ProtoReflect.Descriptor instead. -func (*MessagesTogglePin) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{24} -} - -func (x *MessagesTogglePin) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesTogglePin) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *MessagesTogglePin) GetSilent() bool { - if x != nil { - return x.Silent - } - return false -} - -// MessagesReadReaction -// @Function -// @Return: Bool -type MessagesReadReaction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageIDs []int64 `protobuf:"varint,2,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` -} - -func (x *MessagesReadReaction) Reset() { - *x = MessagesReadReaction{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesReadReaction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesReadReaction) ProtoMessage() {} - -func (x *MessagesReadReaction) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesReadReaction.ProtoReflect.Descriptor instead. -func (*MessagesReadReaction) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{25} -} - -func (x *MessagesReadReaction) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *MessagesReadReaction) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -// MessagesDialogs -type MessagesDialogs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Dialogs []*Dialog `protobuf:"bytes,1,rep,name=Dialogs,proto3" json:"Dialogs,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Messages []*UserMessage `protobuf:"bytes,3,rep,name=Messages,proto3" json:"Messages,omitempty"` - Count int32 `protobuf:"varint,4,opt,name=Count,proto3" json:"Count,omitempty"` - UpdateID int64 `protobuf:"varint,5,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Groups []*Group `protobuf:"bytes,6,rep,name=Groups,proto3" json:"Groups,omitempty"` -} - -func (x *MessagesDialogs) Reset() { - *x = MessagesDialogs{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesDialogs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesDialogs) ProtoMessage() {} - -func (x *MessagesDialogs) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesDialogs.ProtoReflect.Descriptor instead. -func (*MessagesDialogs) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{26} -} - -func (x *MessagesDialogs) GetDialogs() []*Dialog { - if x != nil { - return x.Dialogs - } - return nil -} - -func (x *MessagesDialogs) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *MessagesDialogs) GetMessages() []*UserMessage { - if x != nil { - return x.Messages - } - return nil -} - -func (x *MessagesDialogs) GetCount() int32 { - if x != nil { - return x.Count - } - return 0 -} - -func (x *MessagesDialogs) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *MessagesDialogs) GetGroups() []*Group { - if x != nil { - return x.Groups - } - return nil -} - -// MessagesSent -type MessagesSent struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MessageID int64 `protobuf:"varint,1,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - RandomID int64 `protobuf:"varint,2,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - CreatedOn int64 `protobuf:"varint,3,opt,name=CreatedOn,proto3" json:"CreatedOn,omitempty"` -} - -func (x *MessagesSent) Reset() { - *x = MessagesSent{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesSent) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesSent) ProtoMessage() {} - -func (x *MessagesSent) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesSent.ProtoReflect.Descriptor instead. -func (*MessagesSent) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{27} -} - -func (x *MessagesSent) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *MessagesSent) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *MessagesSent) GetCreatedOn() int64 { - if x != nil { - return x.CreatedOn - } - return 0 -} - -// MessagesMany -type MessagesMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Messages []*UserMessage `protobuf:"bytes,1,rep,name=Messages,proto3" json:"Messages,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Groups []*Group `protobuf:"bytes,3,rep,name=Groups,proto3" json:"Groups,omitempty"` - Continuous bool `protobuf:"varint,4,opt,name=Continuous,proto3" json:"Continuous,omitempty"` - Empty bool `protobuf:"varint,5,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *MessagesMany) Reset() { - *x = MessagesMany{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesMany) ProtoMessage() {} - -func (x *MessagesMany) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesMany.ProtoReflect.Descriptor instead. -func (*MessagesMany) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{28} -} - -func (x *MessagesMany) GetMessages() []*UserMessage { - if x != nil { - return x.Messages - } - return nil -} - -func (x *MessagesMany) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *MessagesMany) GetGroups() []*Group { - if x != nil { - return x.Groups - } - return nil -} - -func (x *MessagesMany) GetContinuous() bool { - if x != nil { - return x.Continuous - } - return false -} - -func (x *MessagesMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// MessagesReactionList -type MessagesReactionList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - List []*ReactionList `protobuf:"bytes,1,rep,name=List,proto3" json:"List,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Hash int32 `protobuf:"varint,3,opt,name=Hash,proto3" json:"Hash,omitempty"` - Modified bool `protobuf:"varint,4,opt,name=Modified,proto3" json:"Modified,omitempty"` -} - -func (x *MessagesReactionList) Reset() { - *x = MessagesReactionList{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessagesReactionList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessagesReactionList) ProtoMessage() {} - -func (x *MessagesReactionList) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessagesReactionList.ProtoReflect.Descriptor instead. -func (*MessagesReactionList) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{29} -} - -func (x *MessagesReactionList) GetList() []*ReactionList { - if x != nil { - return x.List - } - return nil -} - -func (x *MessagesReactionList) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *MessagesReactionList) GetHash() int32 { - if x != nil { - return x.Hash - } - return 0 -} - -func (x *MessagesReactionList) GetModified() bool { - if x != nil { - return x.Modified - } - return false -} - -// ReactionList -type ReactionList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Reaction string `protobuf:"bytes,1,opt,name=Reaction,proto3" json:"Reaction,omitempty"` - UserIDs []int64 `protobuf:"varint,2,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` -} - -func (x *ReactionList) Reset() { - *x = ReactionList{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_messages_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReactionList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReactionList) ProtoMessage() {} - -func (x *ReactionList) ProtoReflect() protoreflect.Message { - mi := &file_chat_messages_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReactionList.ProtoReflect.Descriptor instead. -func (*ReactionList) Descriptor() ([]byte, []int) { - return file_chat_messages_proto_rawDescGZIP(), []int{30} -} - -func (x *ReactionList) GetReaction() string { - if x != nil { - return x.Reaction - } - return "" -} - -func (x *ReactionList) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -var File_chat_messages_proto protoreflect.FileDescriptor - -var file_chat_messages_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcc, 0x01, 0x0a, - 0x0c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x1a, 0x0a, - 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x43, - 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, 0x12, 0x2e, 0x0a, 0x08, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0xde, 0x01, 0x0a, 0x11, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x22, 0x0a, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x12, 0x31, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, 0x61, 0x74, - 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x44, 0x61, - 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, - 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, 0x22, 0xb0, 0x01, 0x0a, - 0x0c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x45, 0x64, 0x69, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, - 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, - 0xbb, 0x01, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x45, 0x64, 0x69, 0x74, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, - 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x61, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x61, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, - 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x22, 0x4f, 0x0a, - 0x13, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x64, 0x48, 0x69, 0x73, - 0x74, 0x6f, 0x72, 0x79, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, - 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x61, 0x78, 0x49, - 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x22, 0x53, - 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x47, 0x65, 0x74, 0x12, 0x22, 0x0a, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x49, 0x44, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x49, 0x44, 0x73, 0x22, 0x7a, 0x0a, 0x12, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x47, - 0x65, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, - 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x69, 0x6e, - 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x69, 0x6e, 0x49, 0x44, 0x22, - 0x8f, 0x01, 0x0a, 0x17, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x47, 0x65, 0x74, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x22, 0x0a, 0x04, 0x50, - 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, - 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x12, 0x24, 0x0a, 0x03, 0x43, - 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x03, 0x43, 0x61, - 0x74, 0x22, 0x68, 0x0a, 0x12, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x47, 0x65, 0x74, - 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, - 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x45, 0x78, - 0x63, 0x6c, 0x75, 0x64, 0x65, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x22, 0x1a, 0x0a, 0x18, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x47, 0x65, 0x74, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, - 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x22, 0x37, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x47, 0x65, 0x74, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x22, 0x0a, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x22, 0x62, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x53, 0x65, 0x74, 0x54, - 0x79, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, - 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x06, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x68, 0x0a, 0x14, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x43, 0x6c, 0x65, 0x61, 0x72, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x22, 0x0a, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x22, 0x6c, - 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, - 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x49, 0x44, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x22, 0xbb, 0x01, 0x0a, - 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, - 0x12, 0x2a, 0x0a, 0x08, 0x46, 0x72, 0x6f, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, - 0x65, 0x72, 0x52, 0x08, 0x46, 0x72, 0x6f, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, - 0x54, 0x6f, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x06, 0x54, 0x6f, - 0x50, 0x65, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x69, 0x6c, 0x65, 0x6e, 0x63, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x53, 0x69, 0x6c, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1e, - 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x22, 0x5a, 0x0a, 0x14, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x22, 0xb1, 0x01, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x53, 0x61, 0x76, 0x65, 0x44, 0x72, 0x61, 0x66, 0x74, 0x12, 0x22, 0x0a, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x42, 0x6f, - 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2e, - 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x45, 0x64, 0x69, 0x74, 0x65, 0x64, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x45, 0x64, 0x69, 0x74, 0x65, 0x64, 0x49, 0x44, 0x22, 0x38, 0x0a, 0x12, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, - 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x22, 0x4f, 0x0a, 0x17, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x50, 0x69, 0x6e, 0x12, - 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, - 0x65, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x50, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x03, 0x50, 0x69, 0x6e, 0x22, 0x44, 0x0a, 0x1c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x52, 0x65, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x44, 0x69, - 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x24, 0x0a, 0x05, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x50, 0x65, 0x65, 0x72, 0x52, 0x05, 0x50, 0x65, 0x65, 0x72, 0x73, 0x22, 0xaa, 0x01, 0x0a, 0x22, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x63, 0x72, 0x65, - 0x65, 0x6e, 0x53, 0x68, 0x6f, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, - 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, - 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x14, 0x0a, 0x05, - 0x4d, 0x69, 0x6e, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x69, 0x6e, - 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x22, 0x74, 0x0a, 0x14, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, - 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x78, - 0x0a, 0x16, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x52, 0x65, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x52, - 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x6f, 0x0a, 0x17, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x47, 0x65, 0x74, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, - 0x69, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, - 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x22, 0x6d, 0x0a, 0x11, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x73, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x50, 0x69, 0x6e, 0x12, 0x22, - 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, - 0x12, 0x16, 0x0a, 0x06, 0x53, 0x69, 0x6c, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x53, 0x69, 0x6c, 0x65, 0x6e, 0x74, 0x22, 0x5a, 0x0a, 0x14, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, - 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x49, 0x44, 0x73, 0x22, 0xdd, 0x01, 0x0a, 0x0f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x25, 0x0a, 0x07, 0x44, 0x69, 0x61, 0x6c, - 0x6f, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x07, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x12, - 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, - 0x12, 0x2c, 0x0a, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, - 0x12, 0x22, 0x0a, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x73, 0x22, 0x66, 0x0a, 0x0c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x53, 0x65, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x1c, - 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x22, 0xb7, 0x01, 0x0a, - 0x0c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x2c, 0x0a, - 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x52, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x55, - 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x22, 0x0a, 0x06, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, - 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x8e, 0x01, 0x0a, 0x14, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, - 0x25, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, - 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x4d, - 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x4d, - 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x22, 0x48, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, - 0x73, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_chat_messages_proto_rawDescOnce sync.Once - file_chat_messages_proto_rawDescData = file_chat_messages_proto_rawDesc -) - -func file_chat_messages_proto_rawDescGZIP() []byte { - file_chat_messages_proto_rawDescOnce.Do(func() { - file_chat_messages_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_messages_proto_rawDescData) - }) - return file_chat_messages_proto_rawDescData -} - -var file_chat_messages_proto_msgTypes = make([]protoimpl.MessageInfo, 31) -var file_chat_messages_proto_goTypes = []interface{}{ - (*MessagesSend)(nil), // 0: msg.MessagesSend - (*MessagesSendMedia)(nil), // 1: msg.MessagesSendMedia - (*MessagesEdit)(nil), // 2: msg.MessagesEdit - (*MessagesEditMedia)(nil), // 3: msg.MessagesEditMedia - (*MessagesReadHistory)(nil), // 4: msg.MessagesReadHistory - (*MessagesGet)(nil), // 5: msg.MessagesGet - (*MessagesGetHistory)(nil), // 6: msg.MessagesGetHistory - (*MessagesGetMediaHistory)(nil), // 7: msg.MessagesGetMediaHistory - (*MessagesGetDialogs)(nil), // 8: msg.MessagesGetDialogs - (*MessagesGetPinnedDialogs)(nil), // 9: msg.MessagesGetPinnedDialogs - (*MessagesGetDialog)(nil), // 10: msg.MessagesGetDialog - (*MessagesSetTyping)(nil), // 11: msg.MessagesSetTyping - (*MessagesClearHistory)(nil), // 12: msg.MessagesClearHistory - (*MessagesDelete)(nil), // 13: msg.MessagesDelete - (*MessagesForward)(nil), // 14: msg.MessagesForward - (*MessagesReadContents)(nil), // 15: msg.MessagesReadContents - (*MessagesSaveDraft)(nil), // 16: msg.MessagesSaveDraft - (*MessagesClearDraft)(nil), // 17: msg.MessagesClearDraft - (*MessagesToggleDialogPin)(nil), // 18: msg.MessagesToggleDialogPin - (*MessagesReorderPinnedDialogs)(nil), // 19: msg.MessagesReorderPinnedDialogs - (*MessagesSendScreenShotNotification)(nil), // 20: msg.MessagesSendScreenShotNotification - (*MessagesSendReaction)(nil), // 21: msg.MessagesSendReaction - (*MessagesDeleteReaction)(nil), // 22: msg.MessagesDeleteReaction - (*MessagesGetReactionList)(nil), // 23: msg.MessagesGetReactionList - (*MessagesTogglePin)(nil), // 24: msg.MessagesTogglePin - (*MessagesReadReaction)(nil), // 25: msg.MessagesReadReaction - (*MessagesDialogs)(nil), // 26: msg.MessagesDialogs - (*MessagesSent)(nil), // 27: msg.MessagesSent - (*MessagesMany)(nil), // 28: msg.MessagesMany - (*MessagesReactionList)(nil), // 29: msg.MessagesReactionList - (*ReactionList)(nil), // 30: msg.ReactionList - (*InputPeer)(nil), // 31: msg.InputPeer - (*MessageEntity)(nil), // 32: msg.MessageEntity - (InputMediaType)(0), // 33: msg.InputMediaType - (MediaCategory)(0), // 34: msg.MediaCategory - (TypingAction)(0), // 35: msg.TypingAction - (*Dialog)(nil), // 36: msg.Dialog - (*User)(nil), // 37: msg.User - (*UserMessage)(nil), // 38: msg.UserMessage - (*Group)(nil), // 39: msg.Group -} -var file_chat_messages_proto_depIdxs = []int32{ - 31, // 0: msg.MessagesSend.Peer:type_name -> msg.InputPeer - 32, // 1: msg.MessagesSend.Entities:type_name -> msg.MessageEntity - 31, // 2: msg.MessagesSendMedia.Peer:type_name -> msg.InputPeer - 33, // 3: msg.MessagesSendMedia.MediaType:type_name -> msg.InputMediaType - 31, // 4: msg.MessagesEdit.Peer:type_name -> msg.InputPeer - 32, // 5: msg.MessagesEdit.Entities:type_name -> msg.MessageEntity - 31, // 6: msg.MessagesEditMedia.Peer:type_name -> msg.InputPeer - 32, // 7: msg.MessagesEditMedia.Entities:type_name -> msg.MessageEntity - 31, // 8: msg.MessagesReadHistory.Peer:type_name -> msg.InputPeer - 31, // 9: msg.MessagesGet.Peer:type_name -> msg.InputPeer - 31, // 10: msg.MessagesGetHistory.Peer:type_name -> msg.InputPeer - 31, // 11: msg.MessagesGetMediaHistory.Peer:type_name -> msg.InputPeer - 34, // 12: msg.MessagesGetMediaHistory.Cat:type_name -> msg.MediaCategory - 31, // 13: msg.MessagesGetDialog.Peer:type_name -> msg.InputPeer - 31, // 14: msg.MessagesSetTyping.Peer:type_name -> msg.InputPeer - 35, // 15: msg.MessagesSetTyping.Action:type_name -> msg.TypingAction - 31, // 16: msg.MessagesClearHistory.Peer:type_name -> msg.InputPeer - 31, // 17: msg.MessagesDelete.Peer:type_name -> msg.InputPeer - 31, // 18: msg.MessagesForward.FromPeer:type_name -> msg.InputPeer - 31, // 19: msg.MessagesForward.ToPeer:type_name -> msg.InputPeer - 31, // 20: msg.MessagesReadContents.Peer:type_name -> msg.InputPeer - 31, // 21: msg.MessagesSaveDraft.Peer:type_name -> msg.InputPeer - 32, // 22: msg.MessagesSaveDraft.Entities:type_name -> msg.MessageEntity - 31, // 23: msg.MessagesClearDraft.Peer:type_name -> msg.InputPeer - 31, // 24: msg.MessagesToggleDialogPin.Peer:type_name -> msg.InputPeer - 31, // 25: msg.MessagesReorderPinnedDialogs.Peers:type_name -> msg.InputPeer - 31, // 26: msg.MessagesSendScreenShotNotification.Peer:type_name -> msg.InputPeer - 31, // 27: msg.MessagesSendReaction.Peer:type_name -> msg.InputPeer - 31, // 28: msg.MessagesDeleteReaction.Peer:type_name -> msg.InputPeer - 31, // 29: msg.MessagesGetReactionList.Peer:type_name -> msg.InputPeer - 31, // 30: msg.MessagesTogglePin.Peer:type_name -> msg.InputPeer - 31, // 31: msg.MessagesReadReaction.Peer:type_name -> msg.InputPeer - 36, // 32: msg.MessagesDialogs.Dialogs:type_name -> msg.Dialog - 37, // 33: msg.MessagesDialogs.Users:type_name -> msg.User - 38, // 34: msg.MessagesDialogs.Messages:type_name -> msg.UserMessage - 39, // 35: msg.MessagesDialogs.Groups:type_name -> msg.Group - 38, // 36: msg.MessagesMany.Messages:type_name -> msg.UserMessage - 37, // 37: msg.MessagesMany.Users:type_name -> msg.User - 39, // 38: msg.MessagesMany.Groups:type_name -> msg.Group - 30, // 39: msg.MessagesReactionList.List:type_name -> msg.ReactionList - 37, // 40: msg.MessagesReactionList.Users:type_name -> msg.User - 41, // [41:41] is the sub-list for method output_type - 41, // [41:41] is the sub-list for method input_type - 41, // [41:41] is the sub-list for extension type_name - 41, // [41:41] is the sub-list for extension extendee - 0, // [0:41] is the sub-list for field type_name -} - -func init() { file_chat_messages_proto_init() } -func file_chat_messages_proto_init() { - if File_chat_messages_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_chat_messages_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesSend); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesSendMedia); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesEdit); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesEditMedia); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesReadHistory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesGet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesGetHistory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesGetMediaHistory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesGetDialogs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesGetPinnedDialogs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesGetDialog); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesSetTyping); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesClearHistory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesDelete); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesForward); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesReadContents); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesSaveDraft); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesClearDraft); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesToggleDialogPin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesReorderPinnedDialogs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesSendScreenShotNotification); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesSendReaction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesDeleteReaction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesGetReactionList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesTogglePin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesReadReaction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesDialogs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesSent); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessagesReactionList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_messages_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReactionList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_messages_proto_rawDesc, - NumEnums: 0, - NumMessages: 31, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_messages_proto_goTypes, - DependencyIndexes: file_chat_messages_proto_depIdxs, - MessageInfos: file_chat_messages_proto_msgTypes, - }.Build() - File_chat_messages_proto = out.File - file_chat_messages_proto_rawDesc = nil - file_chat_messages_proto_goTypes = nil - file_chat_messages_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.rony.go deleted file mode 100644 index f0517f51..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.messages.rony.go +++ /dev/null @@ -1,2340 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.messages.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_MessagesSend int64 = 3000244183 - -type poolMessagesSend struct { - pool sync.Pool -} - -func (p *poolMessagesSend) Get() *MessagesSend { - x, ok := p.pool.Get().(*MessagesSend) - if !ok { - x = &MessagesSend{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesSend) Put(x *MessagesSend) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.Body = "" - x.ReplyTo = 0 - x.ClearDraft = false - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - - p.pool.Put(x) -} - -var PoolMessagesSend = poolMessagesSend{} - -func (x *MessagesSend) DeepCopy(z *MessagesSend) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Body = x.Body - z.ReplyTo = x.ReplyTo - z.ClearDraft = x.ClearDraft - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } -} - -func (x *MessagesSend) Clone() *MessagesSend { - z := &MessagesSend{} - x.DeepCopy(z) - return z -} - -func (x *MessagesSend) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesSend) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesSend) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesSend) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesSend) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesSend, x) -} - -const C_MessagesSendMedia int64 = 25498545 - -type poolMessagesSendMedia struct { - pool sync.Pool -} - -func (p *poolMessagesSendMedia) Get() *MessagesSendMedia { - x, ok := p.pool.Get().(*MessagesSendMedia) - if !ok { - x = &MessagesSendMedia{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesSendMedia) Put(x *MessagesSendMedia) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.MediaType = 0 - x.MediaData = x.MediaData[:0] - x.ReplyTo = 0 - x.ClearDraft = false - - p.pool.Put(x) -} - -var PoolMessagesSendMedia = poolMessagesSendMedia{} - -func (x *MessagesSendMedia) DeepCopy(z *MessagesSendMedia) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MediaType = x.MediaType - z.MediaData = append(z.MediaData[:0], x.MediaData...) - z.ReplyTo = x.ReplyTo - z.ClearDraft = x.ClearDraft -} - -func (x *MessagesSendMedia) Clone() *MessagesSendMedia { - z := &MessagesSendMedia{} - x.DeepCopy(z) - return z -} - -func (x *MessagesSendMedia) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesSendMedia) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesSendMedia) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesSendMedia) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesSendMedia) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesSendMedia, x) -} - -const C_MessagesEdit int64 = 2492658432 - -type poolMessagesEdit struct { - pool sync.Pool -} - -func (p *poolMessagesEdit) Get() *MessagesEdit { - x, ok := p.pool.Get().(*MessagesEdit) - if !ok { - x = &MessagesEdit{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesEdit) Put(x *MessagesEdit) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.Body = "" - x.MessageID = 0 - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - - p.pool.Put(x) -} - -var PoolMessagesEdit = poolMessagesEdit{} - -func (x *MessagesEdit) DeepCopy(z *MessagesEdit) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Body = x.Body - z.MessageID = x.MessageID - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } -} - -func (x *MessagesEdit) Clone() *MessagesEdit { - z := &MessagesEdit{} - x.DeepCopy(z) - return z -} - -func (x *MessagesEdit) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesEdit) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesEdit) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesEdit) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesEdit) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesEdit, x) -} - -const C_MessagesEditMedia int64 = 3565425857 - -type poolMessagesEditMedia struct { - pool sync.Pool -} - -func (p *poolMessagesEditMedia) Get() *MessagesEditMedia { - x, ok := p.pool.Get().(*MessagesEditMedia) - if !ok { - x = &MessagesEditMedia{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesEditMedia) Put(x *MessagesEditMedia) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.MessageID = 0 - x.Caption = "" - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - - p.pool.Put(x) -} - -var PoolMessagesEditMedia = poolMessagesEditMedia{} - -func (x *MessagesEditMedia) DeepCopy(z *MessagesEditMedia) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageID = x.MessageID - z.Caption = x.Caption - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } -} - -func (x *MessagesEditMedia) Clone() *MessagesEditMedia { - z := &MessagesEditMedia{} - x.DeepCopy(z) - return z -} - -func (x *MessagesEditMedia) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesEditMedia) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesEditMedia) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesEditMedia) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesEditMedia) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesEditMedia, x) -} - -const C_MessagesReadHistory int64 = 1300826534 - -type poolMessagesReadHistory struct { - pool sync.Pool -} - -func (p *poolMessagesReadHistory) Get() *MessagesReadHistory { - x, ok := p.pool.Get().(*MessagesReadHistory) - if !ok { - x = &MessagesReadHistory{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesReadHistory) Put(x *MessagesReadHistory) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MaxID = 0 - - p.pool.Put(x) -} - -var PoolMessagesReadHistory = poolMessagesReadHistory{} - -func (x *MessagesReadHistory) DeepCopy(z *MessagesReadHistory) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MaxID = x.MaxID -} - -func (x *MessagesReadHistory) Clone() *MessagesReadHistory { - z := &MessagesReadHistory{} - x.DeepCopy(z) - return z -} - -func (x *MessagesReadHistory) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesReadHistory) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesReadHistory) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesReadHistory) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesReadHistory) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesReadHistory, x) -} - -const C_MessagesGet int64 = 2151382317 - -type poolMessagesGet struct { - pool sync.Pool -} - -func (p *poolMessagesGet) Get() *MessagesGet { - x, ok := p.pool.Get().(*MessagesGet) - if !ok { - x = &MessagesGet{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesGet) Put(x *MessagesGet) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessagesIDs = x.MessagesIDs[:0] - - p.pool.Put(x) -} - -var PoolMessagesGet = poolMessagesGet{} - -func (x *MessagesGet) DeepCopy(z *MessagesGet) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessagesIDs = append(z.MessagesIDs[:0], x.MessagesIDs...) -} - -func (x *MessagesGet) Clone() *MessagesGet { - z := &MessagesGet{} - x.DeepCopy(z) - return z -} - -func (x *MessagesGet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesGet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesGet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesGet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesGet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesGet, x) -} - -const C_MessagesGetHistory int64 = 3396939832 - -type poolMessagesGetHistory struct { - pool sync.Pool -} - -func (p *poolMessagesGetHistory) Get() *MessagesGetHistory { - x, ok := p.pool.Get().(*MessagesGetHistory) - if !ok { - x = &MessagesGetHistory{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesGetHistory) Put(x *MessagesGetHistory) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.Limit = 0 - x.MaxID = 0 - x.MinID = 0 - - p.pool.Put(x) -} - -var PoolMessagesGetHistory = poolMessagesGetHistory{} - -func (x *MessagesGetHistory) DeepCopy(z *MessagesGetHistory) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Limit = x.Limit - z.MaxID = x.MaxID - z.MinID = x.MinID -} - -func (x *MessagesGetHistory) Clone() *MessagesGetHistory { - z := &MessagesGetHistory{} - x.DeepCopy(z) - return z -} - -func (x *MessagesGetHistory) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesGetHistory) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesGetHistory) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesGetHistory) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesGetHistory) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesGetHistory, x) -} - -const C_MessagesGetMediaHistory int64 = 4027732752 - -type poolMessagesGetMediaHistory struct { - pool sync.Pool -} - -func (p *poolMessagesGetMediaHistory) Get() *MessagesGetMediaHistory { - x, ok := p.pool.Get().(*MessagesGetMediaHistory) - if !ok { - x = &MessagesGetMediaHistory{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesGetMediaHistory) Put(x *MessagesGetMediaHistory) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.Limit = 0 - x.MaxID = 0 - x.Cat = 0 - - p.pool.Put(x) -} - -var PoolMessagesGetMediaHistory = poolMessagesGetMediaHistory{} - -func (x *MessagesGetMediaHistory) DeepCopy(z *MessagesGetMediaHistory) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Limit = x.Limit - z.MaxID = x.MaxID - z.Cat = x.Cat -} - -func (x *MessagesGetMediaHistory) Clone() *MessagesGetMediaHistory { - z := &MessagesGetMediaHistory{} - x.DeepCopy(z) - return z -} - -func (x *MessagesGetMediaHistory) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesGetMediaHistory) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesGetMediaHistory) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesGetMediaHistory) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesGetMediaHistory) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesGetMediaHistory, x) -} - -const C_MessagesGetDialogs int64 = 1429532372 - -type poolMessagesGetDialogs struct { - pool sync.Pool -} - -func (p *poolMessagesGetDialogs) Get() *MessagesGetDialogs { - x, ok := p.pool.Get().(*MessagesGetDialogs) - if !ok { - x = &MessagesGetDialogs{} - } - - return x -} - -func (p *poolMessagesGetDialogs) Put(x *MessagesGetDialogs) { - if x == nil { - return - } - - x.Limit = 0 - x.Offset = 0 - x.ExcludePinned = false - - p.pool.Put(x) -} - -var PoolMessagesGetDialogs = poolMessagesGetDialogs{} - -func (x *MessagesGetDialogs) DeepCopy(z *MessagesGetDialogs) { - z.Limit = x.Limit - z.Offset = x.Offset - z.ExcludePinned = x.ExcludePinned -} - -func (x *MessagesGetDialogs) Clone() *MessagesGetDialogs { - z := &MessagesGetDialogs{} - x.DeepCopy(z) - return z -} - -func (x *MessagesGetDialogs) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesGetDialogs) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesGetDialogs) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesGetDialogs) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesGetDialogs) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesGetDialogs, x) -} - -const C_MessagesGetPinnedDialogs int64 = 1963188912 - -type poolMessagesGetPinnedDialogs struct { - pool sync.Pool -} - -func (p *poolMessagesGetPinnedDialogs) Get() *MessagesGetPinnedDialogs { - x, ok := p.pool.Get().(*MessagesGetPinnedDialogs) - if !ok { - x = &MessagesGetPinnedDialogs{} - } - - return x -} - -func (p *poolMessagesGetPinnedDialogs) Put(x *MessagesGetPinnedDialogs) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolMessagesGetPinnedDialogs = poolMessagesGetPinnedDialogs{} - -func (x *MessagesGetPinnedDialogs) DeepCopy(z *MessagesGetPinnedDialogs) { -} - -func (x *MessagesGetPinnedDialogs) Clone() *MessagesGetPinnedDialogs { - z := &MessagesGetPinnedDialogs{} - x.DeepCopy(z) - return z -} - -func (x *MessagesGetPinnedDialogs) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesGetPinnedDialogs) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesGetPinnedDialogs) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesGetPinnedDialogs) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesGetPinnedDialogs) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesGetPinnedDialogs, x) -} - -const C_MessagesGetDialog int64 = 1050840034 - -type poolMessagesGetDialog struct { - pool sync.Pool -} - -func (p *poolMessagesGetDialog) Get() *MessagesGetDialog { - x, ok := p.pool.Get().(*MessagesGetDialog) - if !ok { - x = &MessagesGetDialog{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesGetDialog) Put(x *MessagesGetDialog) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolMessagesGetDialog = poolMessagesGetDialog{} - -func (x *MessagesGetDialog) DeepCopy(z *MessagesGetDialog) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *MessagesGetDialog) Clone() *MessagesGetDialog { - z := &MessagesGetDialog{} - x.DeepCopy(z) - return z -} - -func (x *MessagesGetDialog) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesGetDialog) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesGetDialog) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesGetDialog) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesGetDialog) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesGetDialog, x) -} - -const C_MessagesSetTyping int64 = 1540214486 - -type poolMessagesSetTyping struct { - pool sync.Pool -} - -func (p *poolMessagesSetTyping) Get() *MessagesSetTyping { - x, ok := p.pool.Get().(*MessagesSetTyping) - if !ok { - x = &MessagesSetTyping{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesSetTyping) Put(x *MessagesSetTyping) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.Action = 0 - - p.pool.Put(x) -} - -var PoolMessagesSetTyping = poolMessagesSetTyping{} - -func (x *MessagesSetTyping) DeepCopy(z *MessagesSetTyping) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Action = x.Action -} - -func (x *MessagesSetTyping) Clone() *MessagesSetTyping { - z := &MessagesSetTyping{} - x.DeepCopy(z) - return z -} - -func (x *MessagesSetTyping) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesSetTyping) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesSetTyping) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesSetTyping) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesSetTyping) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesSetTyping, x) -} - -const C_MessagesClearHistory int64 = 1981246180 - -type poolMessagesClearHistory struct { - pool sync.Pool -} - -func (p *poolMessagesClearHistory) Get() *MessagesClearHistory { - x, ok := p.pool.Get().(*MessagesClearHistory) - if !ok { - x = &MessagesClearHistory{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesClearHistory) Put(x *MessagesClearHistory) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MaxID = 0 - x.Delete = false - - p.pool.Put(x) -} - -var PoolMessagesClearHistory = poolMessagesClearHistory{} - -func (x *MessagesClearHistory) DeepCopy(z *MessagesClearHistory) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MaxID = x.MaxID - z.Delete = x.Delete -} - -func (x *MessagesClearHistory) Clone() *MessagesClearHistory { - z := &MessagesClearHistory{} - x.DeepCopy(z) - return z -} - -func (x *MessagesClearHistory) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesClearHistory) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesClearHistory) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesClearHistory) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesClearHistory) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesClearHistory, x) -} - -const C_MessagesDelete int64 = 3487616910 - -type poolMessagesDelete struct { - pool sync.Pool -} - -func (p *poolMessagesDelete) Get() *MessagesDelete { - x, ok := p.pool.Get().(*MessagesDelete) - if !ok { - x = &MessagesDelete{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesDelete) Put(x *MessagesDelete) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageIDs = x.MessageIDs[:0] - x.Revoke = false - - p.pool.Put(x) -} - -var PoolMessagesDelete = poolMessagesDelete{} - -func (x *MessagesDelete) DeepCopy(z *MessagesDelete) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) - z.Revoke = x.Revoke -} - -func (x *MessagesDelete) Clone() *MessagesDelete { - z := &MessagesDelete{} - x.DeepCopy(z) - return z -} - -func (x *MessagesDelete) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesDelete) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesDelete) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesDelete) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesDelete) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesDelete, x) -} - -const C_MessagesForward int64 = 2662884753 - -type poolMessagesForward struct { - pool sync.Pool -} - -func (p *poolMessagesForward) Get() *MessagesForward { - x, ok := p.pool.Get().(*MessagesForward) - if !ok { - x = &MessagesForward{} - } - - x.FromPeer = PoolInputPeer.Get() - - x.ToPeer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesForward) Put(x *MessagesForward) { - if x == nil { - return - } - - PoolInputPeer.Put(x.FromPeer) - PoolInputPeer.Put(x.ToPeer) - x.Silence = false - x.MessageIDs = x.MessageIDs[:0] - x.RandomID = 0 - - p.pool.Put(x) -} - -var PoolMessagesForward = poolMessagesForward{} - -func (x *MessagesForward) DeepCopy(z *MessagesForward) { - if x.FromPeer != nil { - if z.FromPeer == nil { - z.FromPeer = PoolInputPeer.Get() - } - x.FromPeer.DeepCopy(z.FromPeer) - } else { - PoolInputPeer.Put(z.FromPeer) - z.FromPeer = nil - } - if x.ToPeer != nil { - if z.ToPeer == nil { - z.ToPeer = PoolInputPeer.Get() - } - x.ToPeer.DeepCopy(z.ToPeer) - } else { - PoolInputPeer.Put(z.ToPeer) - z.ToPeer = nil - } - z.Silence = x.Silence - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) - z.RandomID = x.RandomID -} - -func (x *MessagesForward) Clone() *MessagesForward { - z := &MessagesForward{} - x.DeepCopy(z) - return z -} - -func (x *MessagesForward) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesForward) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesForward) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesForward) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesForward) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesForward, x) -} - -const C_MessagesReadContents int64 = 1781251275 - -type poolMessagesReadContents struct { - pool sync.Pool -} - -func (p *poolMessagesReadContents) Get() *MessagesReadContents { - x, ok := p.pool.Get().(*MessagesReadContents) - if !ok { - x = &MessagesReadContents{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesReadContents) Put(x *MessagesReadContents) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageIDs = x.MessageIDs[:0] - - p.pool.Put(x) -} - -var PoolMessagesReadContents = poolMessagesReadContents{} - -func (x *MessagesReadContents) DeepCopy(z *MessagesReadContents) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) -} - -func (x *MessagesReadContents) Clone() *MessagesReadContents { - z := &MessagesReadContents{} - x.DeepCopy(z) - return z -} - -func (x *MessagesReadContents) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesReadContents) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesReadContents) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesReadContents) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesReadContents) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesReadContents, x) -} - -const C_MessagesSaveDraft int64 = 921840607 - -type poolMessagesSaveDraft struct { - pool sync.Pool -} - -func (p *poolMessagesSaveDraft) Get() *MessagesSaveDraft { - x, ok := p.pool.Get().(*MessagesSaveDraft) - if !ok { - x = &MessagesSaveDraft{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesSaveDraft) Put(x *MessagesSaveDraft) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.ReplyTo = 0 - x.Body = "" - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.EditedID = 0 - - p.pool.Put(x) -} - -var PoolMessagesSaveDraft = poolMessagesSaveDraft{} - -func (x *MessagesSaveDraft) DeepCopy(z *MessagesSaveDraft) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.ReplyTo = x.ReplyTo - z.Body = x.Body - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.EditedID = x.EditedID -} - -func (x *MessagesSaveDraft) Clone() *MessagesSaveDraft { - z := &MessagesSaveDraft{} - x.DeepCopy(z) - return z -} - -func (x *MessagesSaveDraft) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesSaveDraft) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesSaveDraft) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesSaveDraft) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesSaveDraft) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesSaveDraft, x) -} - -const C_MessagesClearDraft int64 = 2164204563 - -type poolMessagesClearDraft struct { - pool sync.Pool -} - -func (p *poolMessagesClearDraft) Get() *MessagesClearDraft { - x, ok := p.pool.Get().(*MessagesClearDraft) - if !ok { - x = &MessagesClearDraft{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesClearDraft) Put(x *MessagesClearDraft) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolMessagesClearDraft = poolMessagesClearDraft{} - -func (x *MessagesClearDraft) DeepCopy(z *MessagesClearDraft) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *MessagesClearDraft) Clone() *MessagesClearDraft { - z := &MessagesClearDraft{} - x.DeepCopy(z) - return z -} - -func (x *MessagesClearDraft) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesClearDraft) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesClearDraft) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesClearDraft) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesClearDraft) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesClearDraft, x) -} - -const C_MessagesToggleDialogPin int64 = 1352871220 - -type poolMessagesToggleDialogPin struct { - pool sync.Pool -} - -func (p *poolMessagesToggleDialogPin) Get() *MessagesToggleDialogPin { - x, ok := p.pool.Get().(*MessagesToggleDialogPin) - if !ok { - x = &MessagesToggleDialogPin{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesToggleDialogPin) Put(x *MessagesToggleDialogPin) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.Pin = false - - p.pool.Put(x) -} - -var PoolMessagesToggleDialogPin = poolMessagesToggleDialogPin{} - -func (x *MessagesToggleDialogPin) DeepCopy(z *MessagesToggleDialogPin) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Pin = x.Pin -} - -func (x *MessagesToggleDialogPin) Clone() *MessagesToggleDialogPin { - z := &MessagesToggleDialogPin{} - x.DeepCopy(z) - return z -} - -func (x *MessagesToggleDialogPin) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesToggleDialogPin) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesToggleDialogPin) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesToggleDialogPin) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesToggleDialogPin) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesToggleDialogPin, x) -} - -const C_MessagesReorderPinnedDialogs int64 = 1409872986 - -type poolMessagesReorderPinnedDialogs struct { - pool sync.Pool -} - -func (p *poolMessagesReorderPinnedDialogs) Get() *MessagesReorderPinnedDialogs { - x, ok := p.pool.Get().(*MessagesReorderPinnedDialogs) - if !ok { - x = &MessagesReorderPinnedDialogs{} - } - - return x -} - -func (p *poolMessagesReorderPinnedDialogs) Put(x *MessagesReorderPinnedDialogs) { - if x == nil { - return - } - - for _, z := range x.Peers { - PoolInputPeer.Put(z) - } - x.Peers = x.Peers[:0] - - p.pool.Put(x) -} - -var PoolMessagesReorderPinnedDialogs = poolMessagesReorderPinnedDialogs{} - -func (x *MessagesReorderPinnedDialogs) DeepCopy(z *MessagesReorderPinnedDialogs) { - for idx := range x.Peers { - if x.Peers[idx] == nil { - continue - } - xx := PoolInputPeer.Get() - x.Peers[idx].DeepCopy(xx) - z.Peers = append(z.Peers, xx) - } -} - -func (x *MessagesReorderPinnedDialogs) Clone() *MessagesReorderPinnedDialogs { - z := &MessagesReorderPinnedDialogs{} - x.DeepCopy(z) - return z -} - -func (x *MessagesReorderPinnedDialogs) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesReorderPinnedDialogs) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesReorderPinnedDialogs) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesReorderPinnedDialogs) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesReorderPinnedDialogs) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesReorderPinnedDialogs, x) -} - -const C_MessagesSendScreenShotNotification int64 = 3682116055 - -type poolMessagesSendScreenShotNotification struct { - pool sync.Pool -} - -func (p *poolMessagesSendScreenShotNotification) Get() *MessagesSendScreenShotNotification { - x, ok := p.pool.Get().(*MessagesSendScreenShotNotification) - if !ok { - x = &MessagesSendScreenShotNotification{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesSendScreenShotNotification) Put(x *MessagesSendScreenShotNotification) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.RandomID = 0 - x.ReplyTo = 0 - x.MinID = 0 - x.MaxID = 0 - - p.pool.Put(x) -} - -var PoolMessagesSendScreenShotNotification = poolMessagesSendScreenShotNotification{} - -func (x *MessagesSendScreenShotNotification) DeepCopy(z *MessagesSendScreenShotNotification) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.RandomID = x.RandomID - z.ReplyTo = x.ReplyTo - z.MinID = x.MinID - z.MaxID = x.MaxID -} - -func (x *MessagesSendScreenShotNotification) Clone() *MessagesSendScreenShotNotification { - z := &MessagesSendScreenShotNotification{} - x.DeepCopy(z) - return z -} - -func (x *MessagesSendScreenShotNotification) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesSendScreenShotNotification) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesSendScreenShotNotification) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesSendScreenShotNotification) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesSendScreenShotNotification) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesSendScreenShotNotification, x) -} - -const C_MessagesSendReaction int64 = 279494057 - -type poolMessagesSendReaction struct { - pool sync.Pool -} - -func (p *poolMessagesSendReaction) Get() *MessagesSendReaction { - x, ok := p.pool.Get().(*MessagesSendReaction) - if !ok { - x = &MessagesSendReaction{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesSendReaction) Put(x *MessagesSendReaction) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageID = 0 - x.Reaction = "" - - p.pool.Put(x) -} - -var PoolMessagesSendReaction = poolMessagesSendReaction{} - -func (x *MessagesSendReaction) DeepCopy(z *MessagesSendReaction) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageID = x.MessageID - z.Reaction = x.Reaction -} - -func (x *MessagesSendReaction) Clone() *MessagesSendReaction { - z := &MessagesSendReaction{} - x.DeepCopy(z) - return z -} - -func (x *MessagesSendReaction) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesSendReaction) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesSendReaction) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesSendReaction) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesSendReaction) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesSendReaction, x) -} - -const C_MessagesDeleteReaction int64 = 1547991459 - -type poolMessagesDeleteReaction struct { - pool sync.Pool -} - -func (p *poolMessagesDeleteReaction) Get() *MessagesDeleteReaction { - x, ok := p.pool.Get().(*MessagesDeleteReaction) - if !ok { - x = &MessagesDeleteReaction{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesDeleteReaction) Put(x *MessagesDeleteReaction) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageID = 0 - x.Reactions = x.Reactions[:0] - - p.pool.Put(x) -} - -var PoolMessagesDeleteReaction = poolMessagesDeleteReaction{} - -func (x *MessagesDeleteReaction) DeepCopy(z *MessagesDeleteReaction) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageID = x.MessageID - z.Reactions = append(z.Reactions[:0], x.Reactions...) -} - -func (x *MessagesDeleteReaction) Clone() *MessagesDeleteReaction { - z := &MessagesDeleteReaction{} - x.DeepCopy(z) - return z -} - -func (x *MessagesDeleteReaction) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesDeleteReaction) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesDeleteReaction) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesDeleteReaction) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesDeleteReaction) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesDeleteReaction, x) -} - -const C_MessagesGetReactionList int64 = 3097050126 - -type poolMessagesGetReactionList struct { - pool sync.Pool -} - -func (p *poolMessagesGetReactionList) Get() *MessagesGetReactionList { - x, ok := p.pool.Get().(*MessagesGetReactionList) - if !ok { - x = &MessagesGetReactionList{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesGetReactionList) Put(x *MessagesGetReactionList) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageID = 0 - x.Hash = 0 - - p.pool.Put(x) -} - -var PoolMessagesGetReactionList = poolMessagesGetReactionList{} - -func (x *MessagesGetReactionList) DeepCopy(z *MessagesGetReactionList) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageID = x.MessageID - z.Hash = x.Hash -} - -func (x *MessagesGetReactionList) Clone() *MessagesGetReactionList { - z := &MessagesGetReactionList{} - x.DeepCopy(z) - return z -} - -func (x *MessagesGetReactionList) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesGetReactionList) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesGetReactionList) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesGetReactionList) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesGetReactionList) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesGetReactionList, x) -} - -const C_MessagesTogglePin int64 = 2824078244 - -type poolMessagesTogglePin struct { - pool sync.Pool -} - -func (p *poolMessagesTogglePin) Get() *MessagesTogglePin { - x, ok := p.pool.Get().(*MessagesTogglePin) - if !ok { - x = &MessagesTogglePin{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesTogglePin) Put(x *MessagesTogglePin) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageID = 0 - x.Silent = false - - p.pool.Put(x) -} - -var PoolMessagesTogglePin = poolMessagesTogglePin{} - -func (x *MessagesTogglePin) DeepCopy(z *MessagesTogglePin) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageID = x.MessageID - z.Silent = x.Silent -} - -func (x *MessagesTogglePin) Clone() *MessagesTogglePin { - z := &MessagesTogglePin{} - x.DeepCopy(z) - return z -} - -func (x *MessagesTogglePin) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesTogglePin) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesTogglePin) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesTogglePin) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesTogglePin) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesTogglePin, x) -} - -const C_MessagesReadReaction int64 = 2047257163 - -type poolMessagesReadReaction struct { - pool sync.Pool -} - -func (p *poolMessagesReadReaction) Get() *MessagesReadReaction { - x, ok := p.pool.Get().(*MessagesReadReaction) - if !ok { - x = &MessagesReadReaction{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolMessagesReadReaction) Put(x *MessagesReadReaction) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MessageIDs = x.MessageIDs[:0] - - p.pool.Put(x) -} - -var PoolMessagesReadReaction = poolMessagesReadReaction{} - -func (x *MessagesReadReaction) DeepCopy(z *MessagesReadReaction) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) -} - -func (x *MessagesReadReaction) Clone() *MessagesReadReaction { - z := &MessagesReadReaction{} - x.DeepCopy(z) - return z -} - -func (x *MessagesReadReaction) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesReadReaction) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesReadReaction) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesReadReaction) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesReadReaction) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesReadReaction, x) -} - -const C_MessagesDialogs int64 = 3252610224 - -type poolMessagesDialogs struct { - pool sync.Pool -} - -func (p *poolMessagesDialogs) Get() *MessagesDialogs { - x, ok := p.pool.Get().(*MessagesDialogs) - if !ok { - x = &MessagesDialogs{} - } - - return x -} - -func (p *poolMessagesDialogs) Put(x *MessagesDialogs) { - if x == nil { - return - } - - for _, z := range x.Dialogs { - PoolDialog.Put(z) - } - x.Dialogs = x.Dialogs[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Messages { - PoolUserMessage.Put(z) - } - x.Messages = x.Messages[:0] - x.Count = 0 - x.UpdateID = 0 - for _, z := range x.Groups { - PoolGroup.Put(z) - } - x.Groups = x.Groups[:0] - - p.pool.Put(x) -} - -var PoolMessagesDialogs = poolMessagesDialogs{} - -func (x *MessagesDialogs) DeepCopy(z *MessagesDialogs) { - for idx := range x.Dialogs { - if x.Dialogs[idx] == nil { - continue - } - xx := PoolDialog.Get() - x.Dialogs[idx].DeepCopy(xx) - z.Dialogs = append(z.Dialogs, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Messages { - if x.Messages[idx] == nil { - continue - } - xx := PoolUserMessage.Get() - x.Messages[idx].DeepCopy(xx) - z.Messages = append(z.Messages, xx) - } - z.Count = x.Count - z.UpdateID = x.UpdateID - for idx := range x.Groups { - if x.Groups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.Groups[idx].DeepCopy(xx) - z.Groups = append(z.Groups, xx) - } -} - -func (x *MessagesDialogs) Clone() *MessagesDialogs { - z := &MessagesDialogs{} - x.DeepCopy(z) - return z -} - -func (x *MessagesDialogs) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesDialogs) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesDialogs) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesDialogs) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesDialogs) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesDialogs, x) -} - -const C_MessagesSent int64 = 2942502835 - -type poolMessagesSent struct { - pool sync.Pool -} - -func (p *poolMessagesSent) Get() *MessagesSent { - x, ok := p.pool.Get().(*MessagesSent) - if !ok { - x = &MessagesSent{} - } - - return x -} - -func (p *poolMessagesSent) Put(x *MessagesSent) { - if x == nil { - return - } - - x.MessageID = 0 - x.RandomID = 0 - x.CreatedOn = 0 - - p.pool.Put(x) -} - -var PoolMessagesSent = poolMessagesSent{} - -func (x *MessagesSent) DeepCopy(z *MessagesSent) { - z.MessageID = x.MessageID - z.RandomID = x.RandomID - z.CreatedOn = x.CreatedOn -} - -func (x *MessagesSent) Clone() *MessagesSent { - z := &MessagesSent{} - x.DeepCopy(z) - return z -} - -func (x *MessagesSent) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesSent) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesSent) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesSent) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesSent) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesSent, x) -} - -const C_MessagesMany int64 = 1713238910 - -type poolMessagesMany struct { - pool sync.Pool -} - -func (p *poolMessagesMany) Get() *MessagesMany { - x, ok := p.pool.Get().(*MessagesMany) - if !ok { - x = &MessagesMany{} - } - - return x -} - -func (p *poolMessagesMany) Put(x *MessagesMany) { - if x == nil { - return - } - - for _, z := range x.Messages { - PoolUserMessage.Put(z) - } - x.Messages = x.Messages[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Groups { - PoolGroup.Put(z) - } - x.Groups = x.Groups[:0] - x.Continuous = false - x.Empty = false - - p.pool.Put(x) -} - -var PoolMessagesMany = poolMessagesMany{} - -func (x *MessagesMany) DeepCopy(z *MessagesMany) { - for idx := range x.Messages { - if x.Messages[idx] == nil { - continue - } - xx := PoolUserMessage.Get() - x.Messages[idx].DeepCopy(xx) - z.Messages = append(z.Messages, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Groups { - if x.Groups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.Groups[idx].DeepCopy(xx) - z.Groups = append(z.Groups, xx) - } - z.Continuous = x.Continuous - z.Empty = x.Empty -} - -func (x *MessagesMany) Clone() *MessagesMany { - z := &MessagesMany{} - x.DeepCopy(z) - return z -} - -func (x *MessagesMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesMany, x) -} - -const C_MessagesReactionList int64 = 181278607 - -type poolMessagesReactionList struct { - pool sync.Pool -} - -func (p *poolMessagesReactionList) Get() *MessagesReactionList { - x, ok := p.pool.Get().(*MessagesReactionList) - if !ok { - x = &MessagesReactionList{} - } - - return x -} - -func (p *poolMessagesReactionList) Put(x *MessagesReactionList) { - if x == nil { - return - } - - for _, z := range x.List { - PoolReactionList.Put(z) - } - x.List = x.List[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - x.Hash = 0 - x.Modified = false - - p.pool.Put(x) -} - -var PoolMessagesReactionList = poolMessagesReactionList{} - -func (x *MessagesReactionList) DeepCopy(z *MessagesReactionList) { - for idx := range x.List { - if x.List[idx] == nil { - continue - } - xx := PoolReactionList.Get() - x.List[idx].DeepCopy(xx) - z.List = append(z.List, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - z.Hash = x.Hash - z.Modified = x.Modified -} - -func (x *MessagesReactionList) Clone() *MessagesReactionList { - z := &MessagesReactionList{} - x.DeepCopy(z) - return z -} - -func (x *MessagesReactionList) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessagesReactionList) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessagesReactionList) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessagesReactionList) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessagesReactionList) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessagesReactionList, x) -} - -const C_ReactionList int64 = 4260855916 - -type poolReactionList struct { - pool sync.Pool -} - -func (p *poolReactionList) Get() *ReactionList { - x, ok := p.pool.Get().(*ReactionList) - if !ok { - x = &ReactionList{} - } - - return x -} - -func (p *poolReactionList) Put(x *ReactionList) { - if x == nil { - return - } - - x.Reaction = "" - x.UserIDs = x.UserIDs[:0] - - p.pool.Put(x) -} - -var PoolReactionList = poolReactionList{} - -func (x *ReactionList) DeepCopy(z *ReactionList) { - z.Reaction = x.Reaction - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) -} - -func (x *ReactionList) Clone() *ReactionList { - z := &ReactionList{} - x.DeepCopy(z) - return z -} - -func (x *ReactionList) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ReactionList) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ReactionList) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ReactionList) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ReactionList) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ReactionList, x) -} - -func init() { - registry.RegisterConstructor(3000244183, "MessagesSend") - registry.RegisterConstructor(25498545, "MessagesSendMedia") - registry.RegisterConstructor(2492658432, "MessagesEdit") - registry.RegisterConstructor(3565425857, "MessagesEditMedia") - registry.RegisterConstructor(1300826534, "MessagesReadHistory") - registry.RegisterConstructor(2151382317, "MessagesGet") - registry.RegisterConstructor(3396939832, "MessagesGetHistory") - registry.RegisterConstructor(4027732752, "MessagesGetMediaHistory") - registry.RegisterConstructor(1429532372, "MessagesGetDialogs") - registry.RegisterConstructor(1963188912, "MessagesGetPinnedDialogs") - registry.RegisterConstructor(1050840034, "MessagesGetDialog") - registry.RegisterConstructor(1540214486, "MessagesSetTyping") - registry.RegisterConstructor(1981246180, "MessagesClearHistory") - registry.RegisterConstructor(3487616910, "MessagesDelete") - registry.RegisterConstructor(2662884753, "MessagesForward") - registry.RegisterConstructor(1781251275, "MessagesReadContents") - registry.RegisterConstructor(921840607, "MessagesSaveDraft") - registry.RegisterConstructor(2164204563, "MessagesClearDraft") - registry.RegisterConstructor(1352871220, "MessagesToggleDialogPin") - registry.RegisterConstructor(1409872986, "MessagesReorderPinnedDialogs") - registry.RegisterConstructor(3682116055, "MessagesSendScreenShotNotification") - registry.RegisterConstructor(279494057, "MessagesSendReaction") - registry.RegisterConstructor(1547991459, "MessagesDeleteReaction") - registry.RegisterConstructor(3097050126, "MessagesGetReactionList") - registry.RegisterConstructor(2824078244, "MessagesTogglePin") - registry.RegisterConstructor(2047257163, "MessagesReadReaction") - registry.RegisterConstructor(3252610224, "MessagesDialogs") - registry.RegisterConstructor(2942502835, "MessagesSent") - registry.RegisterConstructor(1713238910, "MessagesMany") - registry.RegisterConstructor(181278607, "MessagesReactionList") - registry.RegisterConstructor(4260855916, "ReactionList") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.password.algorithms.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.password.algorithms.pb.go deleted file mode 100644 index 74dde2f6..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.password.algorithms.pb.go +++ /dev/null @@ -1,170 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.password.algorithms.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type PasswordAlgorithmVer6A struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Salt1 []byte `protobuf:"bytes,1,opt,name=Salt1,proto3" json:"Salt1,omitempty"` - Salt2 []byte `protobuf:"bytes,2,opt,name=Salt2,proto3" json:"Salt2,omitempty"` - G int32 `protobuf:"varint,3,opt,name=G,proto3" json:"G,omitempty"` - P []byte `protobuf:"bytes,4,opt,name=P,proto3" json:"P,omitempty"` -} - -func (x *PasswordAlgorithmVer6A) Reset() { - *x = PasswordAlgorithmVer6A{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_password_algorithms_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PasswordAlgorithmVer6A) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PasswordAlgorithmVer6A) ProtoMessage() {} - -func (x *PasswordAlgorithmVer6A) ProtoReflect() protoreflect.Message { - mi := &file_chat_password_algorithms_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PasswordAlgorithmVer6A.ProtoReflect.Descriptor instead. -func (*PasswordAlgorithmVer6A) Descriptor() ([]byte, []int) { - return file_chat_password_algorithms_proto_rawDescGZIP(), []int{0} -} - -func (x *PasswordAlgorithmVer6A) GetSalt1() []byte { - if x != nil { - return x.Salt1 - } - return nil -} - -func (x *PasswordAlgorithmVer6A) GetSalt2() []byte { - if x != nil { - return x.Salt2 - } - return nil -} - -func (x *PasswordAlgorithmVer6A) GetG() int32 { - if x != nil { - return x.G - } - return 0 -} - -func (x *PasswordAlgorithmVer6A) GetP() []byte { - if x != nil { - return x.P - } - return nil -} - -var File_chat_password_algorithms_proto protoreflect.FileDescriptor - -var file_chat_password_algorithms_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x2e, - 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x60, 0x0a, 0x16, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, - 0x64, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x56, 0x65, 0x72, 0x36, 0x41, 0x12, - 0x14, 0x0a, 0x05, 0x53, 0x61, 0x6c, 0x74, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x53, 0x61, 0x6c, 0x74, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x61, 0x6c, 0x74, 0x32, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x53, 0x61, 0x6c, 0x74, 0x32, 0x12, 0x0c, 0x0a, 0x01, 0x47, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x47, 0x12, 0x0c, 0x0a, 0x01, 0x50, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x01, 0x50, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, - 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_chat_password_algorithms_proto_rawDescOnce sync.Once - file_chat_password_algorithms_proto_rawDescData = file_chat_password_algorithms_proto_rawDesc -) - -func file_chat_password_algorithms_proto_rawDescGZIP() []byte { - file_chat_password_algorithms_proto_rawDescOnce.Do(func() { - file_chat_password_algorithms_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_password_algorithms_proto_rawDescData) - }) - return file_chat_password_algorithms_proto_rawDescData -} - -var file_chat_password_algorithms_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_chat_password_algorithms_proto_goTypes = []interface{}{ - (*PasswordAlgorithmVer6A)(nil), // 0: msg.PasswordAlgorithmVer6A -} -var file_chat_password_algorithms_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_chat_password_algorithms_proto_init() } -func file_chat_password_algorithms_proto_init() { - if File_chat_password_algorithms_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_chat_password_algorithms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PasswordAlgorithmVer6A); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_password_algorithms_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_password_algorithms_proto_goTypes, - DependencyIndexes: file_chat_password_algorithms_proto_depIdxs, - MessageInfos: file_chat_password_algorithms_proto_msgTypes, - }.Build() - File_chat_password_algorithms_proto = out.File - file_chat_password_algorithms_proto_rawDesc = nil - file_chat_password_algorithms_proto_goTypes = nil - file_chat_password_algorithms_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.password.algorithms.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.password.algorithms.rony.go deleted file mode 100644 index fcdfabde..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.password.algorithms.rony.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.password.algorithms.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_PasswordAlgorithmVer6A int64 = 341860043 - -type poolPasswordAlgorithmVer6A struct { - pool sync.Pool -} - -func (p *poolPasswordAlgorithmVer6A) Get() *PasswordAlgorithmVer6A { - x, ok := p.pool.Get().(*PasswordAlgorithmVer6A) - if !ok { - x = &PasswordAlgorithmVer6A{} - } - - return x -} - -func (p *poolPasswordAlgorithmVer6A) Put(x *PasswordAlgorithmVer6A) { - if x == nil { - return - } - - x.Salt1 = x.Salt1[:0] - x.Salt2 = x.Salt2[:0] - x.G = 0 - x.P = x.P[:0] - - p.pool.Put(x) -} - -var PoolPasswordAlgorithmVer6A = poolPasswordAlgorithmVer6A{} - -func (x *PasswordAlgorithmVer6A) DeepCopy(z *PasswordAlgorithmVer6A) { - z.Salt1 = append(z.Salt1[:0], x.Salt1...) - z.Salt2 = append(z.Salt2[:0], x.Salt2...) - z.G = x.G - z.P = append(z.P[:0], x.P...) -} - -func (x *PasswordAlgorithmVer6A) Clone() *PasswordAlgorithmVer6A { - z := &PasswordAlgorithmVer6A{} - x.DeepCopy(z) - return z -} - -func (x *PasswordAlgorithmVer6A) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PasswordAlgorithmVer6A) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PasswordAlgorithmVer6A) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PasswordAlgorithmVer6A) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PasswordAlgorithmVer6A) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PasswordAlgorithmVer6A, x) -} - -func init() { - registry.RegisterConstructor(341860043, "PasswordAlgorithmVer6A") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.phone.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.phone.pb.go deleted file mode 100644 index 2e351d3e..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.phone.pb.go +++ /dev/null @@ -1,3920 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.phone.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type DiscardReason int32 - -const ( - DiscardReason_DiscardReasonUnknown DiscardReason = 0 - DiscardReason_DiscardReasonMissed DiscardReason = 1 - DiscardReason_DiscardReasonBusy DiscardReason = 2 - DiscardReason_DiscardReasonHangup DiscardReason = 3 - DiscardReason_DiscardReasonDisconnect DiscardReason = 4 - DiscardReason_DiscardReasonReserved1 DiscardReason = 5 - DiscardReason_DiscardReasonReserved2 DiscardReason = 6 - DiscardReason_DiscardReasonReserved3 DiscardReason = 7 - DiscardReason_DiscardReasonReserved4 DiscardReason = 8 - DiscardReason_DiscardReasonReserved5 DiscardReason = 9 - DiscardReason_DiscardReasonReserved6 DiscardReason = 10 - DiscardReason_DiscardReasonReserved7 DiscardReason = 11 - DiscardReason_DiscardReasonReserved8 DiscardReason = 12 - DiscardReason_DiscardReasonReserved9 DiscardReason = 13 -) - -// Enum value maps for DiscardReason. -var ( - DiscardReason_name = map[int32]string{ - 0: "DiscardReasonUnknown", - 1: "DiscardReasonMissed", - 2: "DiscardReasonBusy", - 3: "DiscardReasonHangup", - 4: "DiscardReasonDisconnect", - 5: "DiscardReasonReserved1", - 6: "DiscardReasonReserved2", - 7: "DiscardReasonReserved3", - 8: "DiscardReasonReserved4", - 9: "DiscardReasonReserved5", - 10: "DiscardReasonReserved6", - 11: "DiscardReasonReserved7", - 12: "DiscardReasonReserved8", - 13: "DiscardReasonReserved9", - } - DiscardReason_value = map[string]int32{ - "DiscardReasonUnknown": 0, - "DiscardReasonMissed": 1, - "DiscardReasonBusy": 2, - "DiscardReasonHangup": 3, - "DiscardReasonDisconnect": 4, - "DiscardReasonReserved1": 5, - "DiscardReasonReserved2": 6, - "DiscardReasonReserved3": 7, - "DiscardReasonReserved4": 8, - "DiscardReasonReserved5": 9, - "DiscardReasonReserved6": 10, - "DiscardReasonReserved7": 11, - "DiscardReasonReserved8": 12, - "DiscardReasonReserved9": 13, - } -) - -func (x DiscardReason) Enum() *DiscardReason { - p := new(DiscardReason) - *p = x - return p -} - -func (x DiscardReason) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (DiscardReason) Descriptor() protoreflect.EnumDescriptor { - return file_chat_phone_proto_enumTypes[0].Descriptor() -} - -func (DiscardReason) Type() protoreflect.EnumType { - return &file_chat_phone_proto_enumTypes[0] -} - -func (x DiscardReason) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use DiscardReason.Descriptor instead. -func (DiscardReason) EnumDescriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{0} -} - -type CallDeviceType int32 - -const ( - CallDeviceType_CallDeviceUnknown CallDeviceType = 0 - CallDeviceType_CallDeviceDesktop CallDeviceType = 1 - CallDeviceType_CallDeviceWeb CallDeviceType = 2 - CallDeviceType_CallDeviceIOS CallDeviceType = 3 - CallDeviceType_CallDeviceAndroid CallDeviceType = 4 - CallDeviceType_CallDeviceReserved1 CallDeviceType = 5 - CallDeviceType_CallDeviceReserved2 CallDeviceType = 6 - CallDeviceType_CallDeviceReserved3 CallDeviceType = 7 - CallDeviceType_CallDeviceReserved4 CallDeviceType = 8 - CallDeviceType_CallDeviceReserved5 CallDeviceType = 9 - CallDeviceType_CallDeviceReserved6 CallDeviceType = 10 -) - -// Enum value maps for CallDeviceType. -var ( - CallDeviceType_name = map[int32]string{ - 0: "CallDeviceUnknown", - 1: "CallDeviceDesktop", - 2: "CallDeviceWeb", - 3: "CallDeviceIOS", - 4: "CallDeviceAndroid", - 5: "CallDeviceReserved1", - 6: "CallDeviceReserved2", - 7: "CallDeviceReserved3", - 8: "CallDeviceReserved4", - 9: "CallDeviceReserved5", - 10: "CallDeviceReserved6", - } - CallDeviceType_value = map[string]int32{ - "CallDeviceUnknown": 0, - "CallDeviceDesktop": 1, - "CallDeviceWeb": 2, - "CallDeviceIOS": 3, - "CallDeviceAndroid": 4, - "CallDeviceReserved1": 5, - "CallDeviceReserved2": 6, - "CallDeviceReserved3": 7, - "CallDeviceReserved4": 8, - "CallDeviceReserved5": 9, - "CallDeviceReserved6": 10, - } -) - -func (x CallDeviceType) Enum() *CallDeviceType { - p := new(CallDeviceType) - *p = x - return p -} - -func (x CallDeviceType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CallDeviceType) Descriptor() protoreflect.EnumDescriptor { - return file_chat_phone_proto_enumTypes[1].Descriptor() -} - -func (CallDeviceType) Type() protoreflect.EnumType { - return &file_chat_phone_proto_enumTypes[1] -} - -func (x CallDeviceType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CallDeviceType.Descriptor instead. -func (CallDeviceType) EnumDescriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{1} -} - -type PhoneCallRateReason int32 - -const ( - PhoneCallRateReason_PhoneCallRateReasonEmpty PhoneCallRateReason = 0 - PhoneCallRateReason_PhoneCallRateReasonReserved1 PhoneCallRateReason = 1 - PhoneCallRateReason_PhoneCallRateReasonReserved2 PhoneCallRateReason = 2 - PhoneCallRateReason_PhoneCallRateReasonReserved3 PhoneCallRateReason = 3 - PhoneCallRateReason_PhoneCallRateReasonReserved4 PhoneCallRateReason = 4 - PhoneCallRateReason_PhoneCallRateReasonReserved5 PhoneCallRateReason = 5 - PhoneCallRateReason_PhoneCallRateReasonReserved6 PhoneCallRateReason = 6 - PhoneCallRateReason_PhoneCallRateReasonReserved7 PhoneCallRateReason = 7 - PhoneCallRateReason_PhoneCallRateReasonReserved8 PhoneCallRateReason = 8 - PhoneCallRateReason_PhoneCallRateReasonReserved9 PhoneCallRateReason = 9 - PhoneCallRateReason_PhoneCallRateReasonReserved10 PhoneCallRateReason = 10 - PhoneCallRateReason_PhoneCallRateReasonReserved11 PhoneCallRateReason = 11 - PhoneCallRateReason_PhoneCallRateReasonReserved12 PhoneCallRateReason = 12 - PhoneCallRateReason_PhoneCallRateReasonReserved13 PhoneCallRateReason = 13 - PhoneCallRateReason_PhoneCallRateReasonReserved14 PhoneCallRateReason = 14 - PhoneCallRateReason_PhoneCallRateReasonReserved15 PhoneCallRateReason = 15 -) - -// Enum value maps for PhoneCallRateReason. -var ( - PhoneCallRateReason_name = map[int32]string{ - 0: "PhoneCallRateReasonEmpty", - 1: "PhoneCallRateReasonReserved1", - 2: "PhoneCallRateReasonReserved2", - 3: "PhoneCallRateReasonReserved3", - 4: "PhoneCallRateReasonReserved4", - 5: "PhoneCallRateReasonReserved5", - 6: "PhoneCallRateReasonReserved6", - 7: "PhoneCallRateReasonReserved7", - 8: "PhoneCallRateReasonReserved8", - 9: "PhoneCallRateReasonReserved9", - 10: "PhoneCallRateReasonReserved10", - 11: "PhoneCallRateReasonReserved11", - 12: "PhoneCallRateReasonReserved12", - 13: "PhoneCallRateReasonReserved13", - 14: "PhoneCallRateReasonReserved14", - 15: "PhoneCallRateReasonReserved15", - } - PhoneCallRateReason_value = map[string]int32{ - "PhoneCallRateReasonEmpty": 0, - "PhoneCallRateReasonReserved1": 1, - "PhoneCallRateReasonReserved2": 2, - "PhoneCallRateReasonReserved3": 3, - "PhoneCallRateReasonReserved4": 4, - "PhoneCallRateReasonReserved5": 5, - "PhoneCallRateReasonReserved6": 6, - "PhoneCallRateReasonReserved7": 7, - "PhoneCallRateReasonReserved8": 8, - "PhoneCallRateReasonReserved9": 9, - "PhoneCallRateReasonReserved10": 10, - "PhoneCallRateReasonReserved11": 11, - "PhoneCallRateReasonReserved12": 12, - "PhoneCallRateReasonReserved13": 13, - "PhoneCallRateReasonReserved14": 14, - "PhoneCallRateReasonReserved15": 15, - } -) - -func (x PhoneCallRateReason) Enum() *PhoneCallRateReason { - p := new(PhoneCallRateReason) - *p = x - return p -} - -func (x PhoneCallRateReason) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PhoneCallRateReason) Descriptor() protoreflect.EnumDescriptor { - return file_chat_phone_proto_enumTypes[2].Descriptor() -} - -func (PhoneCallRateReason) Type() protoreflect.EnumType { - return &file_chat_phone_proto_enumTypes[2] -} - -func (x PhoneCallRateReason) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PhoneCallRateReason.Descriptor instead. -func (PhoneCallRateReason) EnumDescriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{2} -} - -type PhoneCallAction int32 - -const ( - PhoneCallAction_PhoneCallEmpty PhoneCallAction = 0 - PhoneCallAction_PhoneCallAccepted PhoneCallAction = 1 - PhoneCallAction_PhoneCallRequested PhoneCallAction = 2 - PhoneCallAction_PhoneCallCallWaiting PhoneCallAction = 3 - PhoneCallAction_PhoneCallDiscarded PhoneCallAction = 4 - PhoneCallAction_PhoneCallIceExchange PhoneCallAction = 5 - PhoneCallAction_PhoneCallMediaSettingsChanged PhoneCallAction = 6 - PhoneCallAction_PhoneCallReactionSet PhoneCallAction = 7 - PhoneCallAction_PhoneCallSDPOffer PhoneCallAction = 8 - PhoneCallAction_PhoneCallSDPAnswer PhoneCallAction = 9 - PhoneCallAction_PhoneCallAck PhoneCallAction = 10 - PhoneCallAction_PhoneCallParticipantAdded PhoneCallAction = 11 - PhoneCallAction_PhoneCallParticipantRemoved PhoneCallAction = 12 - PhoneCallAction_PhoneCallJoinRequested PhoneCallAction = 13 - PhoneCallAction_PhoneCallAdminUpdated PhoneCallAction = 14 - PhoneCallAction_PhoneCallScreenShare PhoneCallAction = 15 - PhoneCallAction_PhoneCallPicked PhoneCallAction = 16 - PhoneCallAction_PhoneCallRestarted PhoneCallAction = 17 - PhoneCallAction_PhoneCallReserved14 PhoneCallAction = 18 - PhoneCallAction_PhoneCallReserved15 PhoneCallAction = 19 - PhoneCallAction_PhoneCallReserved16 PhoneCallAction = 20 - PhoneCallAction_PhoneCallReserved17 PhoneCallAction = 21 - PhoneCallAction_PhoneCallReserved18 PhoneCallAction = 22 - PhoneCallAction_PhoneCallReserved19 PhoneCallAction = 23 -) - -// Enum value maps for PhoneCallAction. -var ( - PhoneCallAction_name = map[int32]string{ - 0: "PhoneCallEmpty", - 1: "PhoneCallAccepted", - 2: "PhoneCallRequested", - 3: "PhoneCallCallWaiting", - 4: "PhoneCallDiscarded", - 5: "PhoneCallIceExchange", - 6: "PhoneCallMediaSettingsChanged", - 7: "PhoneCallReactionSet", - 8: "PhoneCallSDPOffer", - 9: "PhoneCallSDPAnswer", - 10: "PhoneCallAck", - 11: "PhoneCallParticipantAdded", - 12: "PhoneCallParticipantRemoved", - 13: "PhoneCallJoinRequested", - 14: "PhoneCallAdminUpdated", - 15: "PhoneCallScreenShare", - 16: "PhoneCallPicked", - 17: "PhoneCallRestarted", - 18: "PhoneCallReserved14", - 19: "PhoneCallReserved15", - 20: "PhoneCallReserved16", - 21: "PhoneCallReserved17", - 22: "PhoneCallReserved18", - 23: "PhoneCallReserved19", - } - PhoneCallAction_value = map[string]int32{ - "PhoneCallEmpty": 0, - "PhoneCallAccepted": 1, - "PhoneCallRequested": 2, - "PhoneCallCallWaiting": 3, - "PhoneCallDiscarded": 4, - "PhoneCallIceExchange": 5, - "PhoneCallMediaSettingsChanged": 6, - "PhoneCallReactionSet": 7, - "PhoneCallSDPOffer": 8, - "PhoneCallSDPAnswer": 9, - "PhoneCallAck": 10, - "PhoneCallParticipantAdded": 11, - "PhoneCallParticipantRemoved": 12, - "PhoneCallJoinRequested": 13, - "PhoneCallAdminUpdated": 14, - "PhoneCallScreenShare": 15, - "PhoneCallPicked": 16, - "PhoneCallRestarted": 17, - "PhoneCallReserved14": 18, - "PhoneCallReserved15": 19, - "PhoneCallReserved16": 20, - "PhoneCallReserved17": 21, - "PhoneCallReserved18": 22, - "PhoneCallReserved19": 23, - } -) - -func (x PhoneCallAction) Enum() *PhoneCallAction { - p := new(PhoneCallAction) - *p = x - return p -} - -func (x PhoneCallAction) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PhoneCallAction) Descriptor() protoreflect.EnumDescriptor { - return file_chat_phone_proto_enumTypes[3].Descriptor() -} - -func (PhoneCallAction) Type() protoreflect.EnumType { - return &file_chat_phone_proto_enumTypes[3] -} - -func (x PhoneCallAction) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PhoneCallAction.Descriptor instead. -func (PhoneCallAction) EnumDescriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{3} -} - -// PhoneInitCall -// @Function -// @Return: PhoneInit -type PhoneInitCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *PhoneInitCall) Reset() { - *x = PhoneInitCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneInitCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneInitCall) ProtoMessage() {} - -func (x *PhoneInitCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneInitCall.ProtoReflect.Descriptor instead. -func (*PhoneInitCall) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{0} -} - -func (x *PhoneInitCall) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneInitCall) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// PhoneRequestCall -// @Function -// @Return: PhoneCall -type PhoneRequestCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Initiator bool `protobuf:"varint,3,opt,name=Initiator,proto3" json:"Initiator,omitempty"` - Participants []*PhoneParticipantSDP `protobuf:"bytes,4,rep,name=Participants,proto3" json:"Participants,omitempty"` - CallID int64 `protobuf:"varint,5,opt,name=CallID,proto3" json:"CallID,omitempty"` - DeviceType CallDeviceType `protobuf:"varint,6,opt,name=DeviceType,proto3,enum=msg.CallDeviceType" json:"DeviceType,omitempty"` - Video bool `protobuf:"varint,7,opt,name=Video,proto3" json:"Video,omitempty"` -} - -func (x *PhoneRequestCall) Reset() { - *x = PhoneRequestCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneRequestCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneRequestCall) ProtoMessage() {} - -func (x *PhoneRequestCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneRequestCall.ProtoReflect.Descriptor instead. -func (*PhoneRequestCall) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{1} -} - -func (x *PhoneRequestCall) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *PhoneRequestCall) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneRequestCall) GetInitiator() bool { - if x != nil { - return x.Initiator - } - return false -} - -func (x *PhoneRequestCall) GetParticipants() []*PhoneParticipantSDP { - if x != nil { - return x.Participants - } - return nil -} - -func (x *PhoneRequestCall) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *PhoneRequestCall) GetDeviceType() CallDeviceType { - if x != nil { - return x.DeviceType - } - return CallDeviceType_CallDeviceUnknown -} - -func (x *PhoneRequestCall) GetVideo() bool { - if x != nil { - return x.Video - } - return false -} - -// PhoneAcceptCall -// @Function -// @Return: PhoneCall -type PhoneAcceptCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` - Participants []*PhoneParticipantSDP `protobuf:"bytes,3,rep,name=Participants,proto3" json:"Participants,omitempty"` - DeviceType CallDeviceType `protobuf:"varint,4,opt,name=DeviceType,proto3,enum=msg.CallDeviceType" json:"DeviceType,omitempty"` -} - -func (x *PhoneAcceptCall) Reset() { - *x = PhoneAcceptCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneAcceptCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneAcceptCall) ProtoMessage() {} - -func (x *PhoneAcceptCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneAcceptCall.ProtoReflect.Descriptor instead. -func (*PhoneAcceptCall) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{2} -} - -func (x *PhoneAcceptCall) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneAcceptCall) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *PhoneAcceptCall) GetParticipants() []*PhoneParticipantSDP { - if x != nil { - return x.Participants - } - return nil -} - -func (x *PhoneAcceptCall) GetDeviceType() CallDeviceType { - if x != nil { - return x.DeviceType - } - return CallDeviceType_CallDeviceUnknown -} - -// PhoneDiscardCall -// @Function -// @Return: Bool -type PhoneDiscardCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` - Duration int32 `protobuf:"varint,4,opt,name=Duration,proto3" json:"Duration,omitempty"` - Reason DiscardReason `protobuf:"varint,5,opt,name=Reason,proto3,enum=msg.DiscardReason" json:"Reason,omitempty"` -} - -func (x *PhoneDiscardCall) Reset() { - *x = PhoneDiscardCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneDiscardCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneDiscardCall) ProtoMessage() {} - -func (x *PhoneDiscardCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneDiscardCall.ProtoReflect.Descriptor instead. -func (*PhoneDiscardCall) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{3} -} - -func (x *PhoneDiscardCall) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneDiscardCall) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *PhoneDiscardCall) GetDuration() int32 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *PhoneDiscardCall) GetReason() DiscardReason { - if x != nil { - return x.Reason - } - return DiscardReason_DiscardReasonUnknown -} - -// PhoneGetCall -// @Function -// @Return: Bool -type PhoneGetCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *PhoneGetCall) Reset() { - *x = PhoneGetCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneGetCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneGetCall) ProtoMessage() {} - -func (x *PhoneGetCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneGetCall.ProtoReflect.Descriptor instead. -func (*PhoneGetCall) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{4} -} - -func (x *PhoneGetCall) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneGetCall) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// PhoneAddParticipant -// @Function -// @Return: PhoneParticipants -type PhoneJoinCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *PhoneJoinCall) Reset() { - *x = PhoneJoinCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneJoinCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneJoinCall) ProtoMessage() {} - -func (x *PhoneJoinCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneJoinCall.ProtoReflect.Descriptor instead. -func (*PhoneJoinCall) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{5} -} - -func (x *PhoneJoinCall) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneJoinCall) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// PhoneAddParticipant -// @Function -// @Return: Bool -type PhoneAddParticipant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` - Participants []*InputUser `protobuf:"bytes,3,rep,name=Participants,proto3" json:"Participants,omitempty"` -} - -func (x *PhoneAddParticipant) Reset() { - *x = PhoneAddParticipant{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneAddParticipant) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneAddParticipant) ProtoMessage() {} - -func (x *PhoneAddParticipant) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneAddParticipant.ProtoReflect.Descriptor instead. -func (*PhoneAddParticipant) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{6} -} - -func (x *PhoneAddParticipant) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneAddParticipant) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *PhoneAddParticipant) GetParticipants() []*InputUser { - if x != nil { - return x.Participants - } - return nil -} - -// PhoneRemoveParticipant -// @Function -// @Return: Bool -type PhoneRemoveParticipant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` - Participants []*InputUser `protobuf:"bytes,3,rep,name=Participants,proto3" json:"Participants,omitempty"` - Timeout bool `protobuf:"varint,4,opt,name=Timeout,proto3" json:"Timeout,omitempty"` -} - -func (x *PhoneRemoveParticipant) Reset() { - *x = PhoneRemoveParticipant{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneRemoveParticipant) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneRemoveParticipant) ProtoMessage() {} - -func (x *PhoneRemoveParticipant) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneRemoveParticipant.ProtoReflect.Descriptor instead. -func (*PhoneRemoveParticipant) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{7} -} - -func (x *PhoneRemoveParticipant) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneRemoveParticipant) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *PhoneRemoveParticipant) GetParticipants() []*InputUser { - if x != nil { - return x.Participants - } - return nil -} - -func (x *PhoneRemoveParticipant) GetTimeout() bool { - if x != nil { - return x.Timeout - } - return false -} - -// PhoneGetParticipants -// @Function -// @Return: PhoneParticipants -type PhoneGetParticipants struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *PhoneGetParticipants) Reset() { - *x = PhoneGetParticipants{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneGetParticipants) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneGetParticipants) ProtoMessage() {} - -func (x *PhoneGetParticipants) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneGetParticipants.ProtoReflect.Descriptor instead. -func (*PhoneGetParticipants) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{8} -} - -func (x *PhoneGetParticipants) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneGetParticipants) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// PhoneUpdateCall -// @Function -// @Return: Bool -type PhoneUpdateCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` - Participants []*InputUser `protobuf:"bytes,3,rep,name=Participants,proto3" json:"Participants,omitempty"` - Action PhoneCallAction `protobuf:"varint,7,opt,name=Action,proto3,enum=msg.PhoneCallAction" json:"Action,omitempty"` - ActionData []byte `protobuf:"bytes,8,opt,name=ActionData,proto3" json:"ActionData,omitempty"` -} - -func (x *PhoneUpdateCall) Reset() { - *x = PhoneUpdateCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneUpdateCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneUpdateCall) ProtoMessage() {} - -func (x *PhoneUpdateCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneUpdateCall.ProtoReflect.Descriptor instead. -func (*PhoneUpdateCall) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{9} -} - -func (x *PhoneUpdateCall) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneUpdateCall) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *PhoneUpdateCall) GetParticipants() []*InputUser { - if x != nil { - return x.Participants - } - return nil -} - -func (x *PhoneUpdateCall) GetAction() PhoneCallAction { - if x != nil { - return x.Action - } - return PhoneCallAction_PhoneCallEmpty -} - -func (x *PhoneUpdateCall) GetActionData() []byte { - if x != nil { - return x.ActionData - } - return nil -} - -// PhoneRateCall -// @Function -// @Return: Bool -type PhoneRateCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` - Rate int32 `protobuf:"varint,3,opt,name=Rate,proto3" json:"Rate,omitempty"` - ReasonType PhoneCallRateReason `protobuf:"varint,4,opt,name=ReasonType,proto3,enum=msg.PhoneCallRateReason" json:"ReasonType,omitempty"` - ReasonData []byte `protobuf:"bytes,5,opt,name=ReasonData,proto3" json:"ReasonData,omitempty"` -} - -func (x *PhoneRateCall) Reset() { - *x = PhoneRateCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneRateCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneRateCall) ProtoMessage() {} - -func (x *PhoneRateCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneRateCall.ProtoReflect.Descriptor instead. -func (*PhoneRateCall) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{10} -} - -func (x *PhoneRateCall) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneRateCall) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *PhoneRateCall) GetRate() int32 { - if x != nil { - return x.Rate - } - return 0 -} - -func (x *PhoneRateCall) GetReasonType() PhoneCallRateReason { - if x != nil { - return x.ReasonType - } - return PhoneCallRateReason_PhoneCallRateReasonEmpty -} - -func (x *PhoneRateCall) GetReasonData() []byte { - if x != nil { - return x.ReasonData - } - return nil -} - -// PhoneGetHistory -// @Function -// Returns: PhoneCallsMany -type PhoneGetHistory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Limit int32 `protobuf:"varint,1,opt,name=Limit,proto3" json:"Limit,omitempty"` - After int64 `protobuf:"varint,2,opt,name=After,proto3" json:"After,omitempty"` -} - -func (x *PhoneGetHistory) Reset() { - *x = PhoneGetHistory{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneGetHistory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneGetHistory) ProtoMessage() {} - -func (x *PhoneGetHistory) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneGetHistory.ProtoReflect.Descriptor instead. -func (*PhoneGetHistory) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{11} -} - -func (x *PhoneGetHistory) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *PhoneGetHistory) GetAfter() int64 { - if x != nil { - return x.After - } - return 0 -} - -// PhoneDeleteHistory -// @Function -// Returns: Bool -type PhoneDeleteHistory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallIDs []int64 `protobuf:"varint,1,rep,packed,name=CallIDs,proto3" json:"CallIDs,omitempty"` -} - -func (x *PhoneDeleteHistory) Reset() { - *x = PhoneDeleteHistory{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneDeleteHistory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneDeleteHistory) ProtoMessage() {} - -func (x *PhoneDeleteHistory) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneDeleteHistory.ProtoReflect.Descriptor instead. -func (*PhoneDeleteHistory) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{12} -} - -func (x *PhoneDeleteHistory) GetCallIDs() []int64 { - if x != nil { - return x.CallIDs - } - return nil -} - -type PhoneCallRecord struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - TeamID int64 `protobuf:"varint,2,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - CallID int64 `protobuf:"varint,3,opt,name=CallID,proto3" json:"CallID,omitempty"` - CreatedOn int64 `protobuf:"varint,4,opt,name=CreatedOn,proto3" json:"CreatedOn,omitempty"` - EndedOn int64 `protobuf:"varint,5,opt,name=EndedOn,proto3" json:"EndedOn,omitempty"` - Incoming bool `protobuf:"varint,6,opt,name=Incoming,proto3" json:"Incoming,omitempty"` - PeerID int64 `protobuf:"varint,7,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,8,opt,name=PeerType,proto3" json:"PeerType,omitempty"` - Status int32 `protobuf:"varint,9,opt,name=Status,proto3" json:"Status,omitempty"` -} - -func (x *PhoneCallRecord) Reset() { - *x = PhoneCallRecord{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneCallRecord) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneCallRecord) ProtoMessage() {} - -func (x *PhoneCallRecord) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneCallRecord.ProtoReflect.Descriptor instead. -func (*PhoneCallRecord) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{13} -} - -func (x *PhoneCallRecord) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *PhoneCallRecord) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *PhoneCallRecord) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *PhoneCallRecord) GetCreatedOn() int64 { - if x != nil { - return x.CreatedOn - } - return 0 -} - -func (x *PhoneCallRecord) GetEndedOn() int64 { - if x != nil { - return x.EndedOn - } - return 0 -} - -func (x *PhoneCallRecord) GetIncoming() bool { - if x != nil { - return x.Incoming - } - return false -} - -func (x *PhoneCallRecord) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *PhoneCallRecord) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -func (x *PhoneCallRecord) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -type PhoneCallsMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PhoneCalls []*PhoneCallRecord `protobuf:"bytes,1,rep,name=PhoneCalls,proto3" json:"PhoneCalls,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Groups []*Group `protobuf:"bytes,3,rep,name=Groups,proto3" json:"Groups,omitempty"` - Continuous bool `protobuf:"varint,4,opt,name=Continuous,proto3" json:"Continuous,omitempty"` - Empty bool `protobuf:"varint,5,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *PhoneCallsMany) Reset() { - *x = PhoneCallsMany{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneCallsMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneCallsMany) ProtoMessage() {} - -func (x *PhoneCallsMany) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneCallsMany.ProtoReflect.Descriptor instead. -func (*PhoneCallsMany) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{14} -} - -func (x *PhoneCallsMany) GetPhoneCalls() []*PhoneCallRecord { - if x != nil { - return x.PhoneCalls - } - return nil -} - -func (x *PhoneCallsMany) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *PhoneCallsMany) GetGroups() []*Group { - if x != nil { - return x.Groups - } - return nil -} - -func (x *PhoneCallsMany) GetContinuous() bool { - if x != nil { - return x.Continuous - } - return false -} - -func (x *PhoneCallsMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// PhoneUpdateAdmin -// @Function -// @Return: Bool -type PhoneUpdateAdmin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` - User *InputUser `protobuf:"bytes,3,opt,name=User,proto3" json:"User,omitempty"` - Admin bool `protobuf:"varint,4,opt,name=Admin,proto3" json:"Admin,omitempty"` -} - -func (x *PhoneUpdateAdmin) Reset() { - *x = PhoneUpdateAdmin{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneUpdateAdmin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneUpdateAdmin) ProtoMessage() {} - -func (x *PhoneUpdateAdmin) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneUpdateAdmin.ProtoReflect.Descriptor instead. -func (*PhoneUpdateAdmin) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{15} -} - -func (x *PhoneUpdateAdmin) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneUpdateAdmin) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *PhoneUpdateAdmin) GetUser() *InputUser { - if x != nil { - return x.User - } - return nil -} - -func (x *PhoneUpdateAdmin) GetAdmin() bool { - if x != nil { - return x.Admin - } - return false -} - -// PhoneCall -type PhoneCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - CreatedOn int64 `protobuf:"varint,2,opt,name=CreatedOn,proto3" json:"CreatedOn,omitempty"` -} - -func (x *PhoneCall) Reset() { - *x = PhoneCall{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneCall) ProtoMessage() {} - -func (x *PhoneCall) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneCall.ProtoReflect.Descriptor instead. -func (*PhoneCall) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{16} -} - -func (x *PhoneCall) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *PhoneCall) GetCreatedOn() int64 { - if x != nil { - return x.CreatedOn - } - return 0 -} - -// PhoneInit -type PhoneInit struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - IceServers []*IceServer `protobuf:"bytes,1,rep,name=IceServers,proto3" json:"IceServers,omitempty"` -} - -func (x *PhoneInit) Reset() { - *x = PhoneInit{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneInit) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneInit) ProtoMessage() {} - -func (x *PhoneInit) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneInit.ProtoReflect.Descriptor instead. -func (*PhoneInit) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{17} -} - -func (x *PhoneInit) GetIceServers() []*IceServer { - if x != nil { - return x.IceServers - } - return nil -} - -// PhoneParticipants -type PhoneParticipants struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Participants []*PhoneParticipant `protobuf:"bytes,1,rep,name=Participants,proto3" json:"Participants,omitempty"` -} - -func (x *PhoneParticipants) Reset() { - *x = PhoneParticipants{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneParticipants) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneParticipants) ProtoMessage() {} - -func (x *PhoneParticipants) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneParticipants.ProtoReflect.Descriptor instead. -func (*PhoneParticipants) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{18} -} - -func (x *PhoneParticipants) GetParticipants() []*PhoneParticipant { - if x != nil { - return x.Participants - } - return nil -} - -// IceServer -type IceServer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Urls []string `protobuf:"bytes,1,rep,name=Urls,proto3" json:"Urls,omitempty"` - Username string `protobuf:"bytes,2,opt,name=Username,proto3" json:"Username,omitempty"` - Credential string `protobuf:"bytes,3,opt,name=Credential,proto3" json:"Credential,omitempty"` -} - -func (x *IceServer) Reset() { - *x = IceServer{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IceServer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*IceServer) ProtoMessage() {} - -func (x *IceServer) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use IceServer.ProtoReflect.Descriptor instead. -func (*IceServer) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{19} -} - -func (x *IceServer) GetUrls() []string { - if x != nil { - return x.Urls - } - return nil -} - -func (x *IceServer) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *IceServer) GetCredential() string { - if x != nil { - return x.Credential - } - return "" -} - -// PhoneParticipant -type PhoneParticipant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnectionId int32 `protobuf:"varint,1,opt,name=ConnectionId,proto3" json:"ConnectionId,omitempty"` - Peer *InputUser `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Initiator bool `protobuf:"varint,3,opt,name=Initiator,proto3" json:"Initiator,omitempty"` - Admin bool `protobuf:"varint,4,opt,name=Admin,proto3" json:"Admin,omitempty"` -} - -func (x *PhoneParticipant) Reset() { - *x = PhoneParticipant{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneParticipant) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneParticipant) ProtoMessage() {} - -func (x *PhoneParticipant) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneParticipant.ProtoReflect.Descriptor instead. -func (*PhoneParticipant) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{20} -} - -func (x *PhoneParticipant) GetConnectionId() int32 { - if x != nil { - return x.ConnectionId - } - return 0 -} - -func (x *PhoneParticipant) GetPeer() *InputUser { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneParticipant) GetInitiator() bool { - if x != nil { - return x.Initiator - } - return false -} - -func (x *PhoneParticipant) GetAdmin() bool { - if x != nil { - return x.Admin - } - return false -} - -// PhoneParticipantSDP -type PhoneParticipantSDP struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnectionId int32 `protobuf:"varint,1,opt,name=ConnectionId,proto3" json:"ConnectionId,omitempty"` - Peer *InputUser `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - SDP string `protobuf:"bytes,3,opt,name=SDP,proto3" json:"SDP,omitempty"` - Type string `protobuf:"bytes,4,opt,name=Type,proto3" json:"Type,omitempty"` -} - -func (x *PhoneParticipantSDP) Reset() { - *x = PhoneParticipantSDP{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneParticipantSDP) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneParticipantSDP) ProtoMessage() {} - -func (x *PhoneParticipantSDP) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneParticipantSDP.ProtoReflect.Descriptor instead. -func (*PhoneParticipantSDP) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{21} -} - -func (x *PhoneParticipantSDP) GetConnectionId() int32 { - if x != nil { - return x.ConnectionId - } - return 0 -} - -func (x *PhoneParticipantSDP) GetPeer() *InputUser { - if x != nil { - return x.Peer - } - return nil -} - -func (x *PhoneParticipantSDP) GetSDP() string { - if x != nil { - return x.SDP - } - return "" -} - -func (x *PhoneParticipantSDP) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -// PhoneActionCallEmpty -type PhoneActionCallEmpty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Empty bool `protobuf:"varint,1,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *PhoneActionCallEmpty) Reset() { - *x = PhoneActionCallEmpty{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionCallEmpty) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionCallEmpty) ProtoMessage() {} - -func (x *PhoneActionCallEmpty) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionCallEmpty.ProtoReflect.Descriptor instead. -func (*PhoneActionCallEmpty) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{22} -} - -func (x *PhoneActionCallEmpty) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// PhoneActionAccepted -type PhoneActionAccepted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SDP string `protobuf:"bytes,1,opt,name=SDP,proto3" json:"SDP,omitempty"` - Type string `protobuf:"bytes,2,opt,name=Type,proto3" json:"Type,omitempty"` - DeviceType CallDeviceType `protobuf:"varint,3,opt,name=DeviceType,proto3,enum=msg.CallDeviceType" json:"DeviceType,omitempty"` -} - -func (x *PhoneActionAccepted) Reset() { - *x = PhoneActionAccepted{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionAccepted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionAccepted) ProtoMessage() {} - -func (x *PhoneActionAccepted) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionAccepted.ProtoReflect.Descriptor instead. -func (*PhoneActionAccepted) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{23} -} - -func (x *PhoneActionAccepted) GetSDP() string { - if x != nil { - return x.SDP - } - return "" -} - -func (x *PhoneActionAccepted) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *PhoneActionAccepted) GetDeviceType() CallDeviceType { - if x != nil { - return x.DeviceType - } - return CallDeviceType_CallDeviceUnknown -} - -// PhoneActionRequested -type PhoneActionRequested struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SDP string `protobuf:"bytes,1,opt,name=SDP,proto3" json:"SDP,omitempty"` - Type string `protobuf:"bytes,2,opt,name=Type,proto3" json:"Type,omitempty"` - Participants []*PhoneParticipant `protobuf:"bytes,3,rep,name=Participants,proto3" json:"Participants,omitempty"` - DeviceType CallDeviceType `protobuf:"varint,4,opt,name=DeviceType,proto3,enum=msg.CallDeviceType" json:"DeviceType,omitempty"` - Video bool `protobuf:"varint,5,opt,name=Video,proto3" json:"Video,omitempty"` -} - -func (x *PhoneActionRequested) Reset() { - *x = PhoneActionRequested{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionRequested) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionRequested) ProtoMessage() {} - -func (x *PhoneActionRequested) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionRequested.ProtoReflect.Descriptor instead. -func (*PhoneActionRequested) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{24} -} - -func (x *PhoneActionRequested) GetSDP() string { - if x != nil { - return x.SDP - } - return "" -} - -func (x *PhoneActionRequested) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *PhoneActionRequested) GetParticipants() []*PhoneParticipant { - if x != nil { - return x.Participants - } - return nil -} - -func (x *PhoneActionRequested) GetDeviceType() CallDeviceType { - if x != nil { - return x.DeviceType - } - return CallDeviceType_CallDeviceUnknown -} - -func (x *PhoneActionRequested) GetVideo() bool { - if x != nil { - return x.Video - } - return false -} - -// PhoneActionCallWaiting -type PhoneActionCallWaiting struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Empty bool `protobuf:"varint,1,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *PhoneActionCallWaiting) Reset() { - *x = PhoneActionCallWaiting{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionCallWaiting) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionCallWaiting) ProtoMessage() {} - -func (x *PhoneActionCallWaiting) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionCallWaiting.ProtoReflect.Descriptor instead. -func (*PhoneActionCallWaiting) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{25} -} - -func (x *PhoneActionCallWaiting) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// PhoneActionDiscarded -type PhoneActionDiscarded struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Duration int32 `protobuf:"varint,1,opt,name=Duration,proto3" json:"Duration,omitempty"` - Video bool `protobuf:"varint,2,opt,name=Video,proto3" json:"Video,omitempty"` - Reason DiscardReason `protobuf:"varint,3,opt,name=Reason,proto3,enum=msg.DiscardReason" json:"Reason,omitempty"` - Terminate bool `protobuf:"varint,4,opt,name=Terminate,proto3" json:"Terminate,omitempty"` -} - -func (x *PhoneActionDiscarded) Reset() { - *x = PhoneActionDiscarded{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionDiscarded) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionDiscarded) ProtoMessage() {} - -func (x *PhoneActionDiscarded) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionDiscarded.ProtoReflect.Descriptor instead. -func (*PhoneActionDiscarded) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{26} -} - -func (x *PhoneActionDiscarded) GetDuration() int32 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *PhoneActionDiscarded) GetVideo() bool { - if x != nil { - return x.Video - } - return false -} - -func (x *PhoneActionDiscarded) GetReason() DiscardReason { - if x != nil { - return x.Reason - } - return DiscardReason_DiscardReasonUnknown -} - -func (x *PhoneActionDiscarded) GetTerminate() bool { - if x != nil { - return x.Terminate - } - return false -} - -// PhoneActionIceExchange -type PhoneActionIceExchange struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Candidate string `protobuf:"bytes,1,opt,name=Candidate,proto3" json:"Candidate,omitempty"` - SdpMLineIndex int64 `protobuf:"varint,2,opt,name=SdpMLineIndex,proto3" json:"SdpMLineIndex,omitempty"` - SdpMid string `protobuf:"bytes,3,opt,name=SdpMid,proto3" json:"SdpMid,omitempty"` - UsernameFragment string `protobuf:"bytes,4,opt,name=UsernameFragment,proto3" json:"UsernameFragment,omitempty"` -} - -func (x *PhoneActionIceExchange) Reset() { - *x = PhoneActionIceExchange{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionIceExchange) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionIceExchange) ProtoMessage() {} - -func (x *PhoneActionIceExchange) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionIceExchange.ProtoReflect.Descriptor instead. -func (*PhoneActionIceExchange) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{27} -} - -func (x *PhoneActionIceExchange) GetCandidate() string { - if x != nil { - return x.Candidate - } - return "" -} - -func (x *PhoneActionIceExchange) GetSdpMLineIndex() int64 { - if x != nil { - return x.SdpMLineIndex - } - return 0 -} - -func (x *PhoneActionIceExchange) GetSdpMid() string { - if x != nil { - return x.SdpMid - } - return "" -} - -func (x *PhoneActionIceExchange) GetUsernameFragment() string { - if x != nil { - return x.UsernameFragment - } - return "" -} - -// PhoneActionAck -type PhoneActionAck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *PhoneActionAck) Reset() { - *x = PhoneActionAck{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionAck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionAck) ProtoMessage() {} - -func (x *PhoneActionAck) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionAck.ProtoReflect.Descriptor instead. -func (*PhoneActionAck) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{28} -} - -// PhoneActionParticipantAdded -type PhoneActionParticipantAdded struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Participants []*PhoneParticipant `protobuf:"bytes,1,rep,name=Participants,proto3" json:"Participants,omitempty"` -} - -func (x *PhoneActionParticipantAdded) Reset() { - *x = PhoneActionParticipantAdded{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionParticipantAdded) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionParticipantAdded) ProtoMessage() {} - -func (x *PhoneActionParticipantAdded) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionParticipantAdded.ProtoReflect.Descriptor instead. -func (*PhoneActionParticipantAdded) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{29} -} - -func (x *PhoneActionParticipantAdded) GetParticipants() []*PhoneParticipant { - if x != nil { - return x.Participants - } - return nil -} - -// PhoneActionParticipantRemoved -type PhoneActionParticipantRemoved struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIDs []int64 `protobuf:"varint,1,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` - Timeout bool `protobuf:"varint,2,opt,name=Timeout,proto3" json:"Timeout,omitempty"` -} - -func (x *PhoneActionParticipantRemoved) Reset() { - *x = PhoneActionParticipantRemoved{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionParticipantRemoved) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionParticipantRemoved) ProtoMessage() {} - -func (x *PhoneActionParticipantRemoved) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionParticipantRemoved.ProtoReflect.Descriptor instead. -func (*PhoneActionParticipantRemoved) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{30} -} - -func (x *PhoneActionParticipantRemoved) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -func (x *PhoneActionParticipantRemoved) GetTimeout() bool { - if x != nil { - return x.Timeout - } - return false -} - -// PhoneActionJoinRequested -type PhoneActionJoinRequested struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIDs []int64 `protobuf:"varint,1,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` -} - -func (x *PhoneActionJoinRequested) Reset() { - *x = PhoneActionJoinRequested{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionJoinRequested) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionJoinRequested) ProtoMessage() {} - -func (x *PhoneActionJoinRequested) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionJoinRequested.ProtoReflect.Descriptor instead. -func (*PhoneActionJoinRequested) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{31} -} - -func (x *PhoneActionJoinRequested) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -// PhoneActionAdminUpdated -type PhoneActionAdminUpdated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Admin bool `protobuf:"varint,2,opt,name=Admin,proto3" json:"Admin,omitempty"` -} - -func (x *PhoneActionAdminUpdated) Reset() { - *x = PhoneActionAdminUpdated{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionAdminUpdated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionAdminUpdated) ProtoMessage() {} - -func (x *PhoneActionAdminUpdated) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionAdminUpdated.ProtoReflect.Descriptor instead. -func (*PhoneActionAdminUpdated) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{32} -} - -func (x *PhoneActionAdminUpdated) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *PhoneActionAdminUpdated) GetAdmin() bool { - if x != nil { - return x.Admin - } - return false -} - -// PhoneActionScreenShare -type PhoneActionScreenShare struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Enable bool `protobuf:"varint,1,opt,name=Enable,proto3" json:"Enable,omitempty"` - TrackIDs []string `protobuf:"bytes,2,rep,name=TrackIDs,proto3" json:"TrackIDs,omitempty"` -} - -func (x *PhoneActionScreenShare) Reset() { - *x = PhoneActionScreenShare{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionScreenShare) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionScreenShare) ProtoMessage() {} - -func (x *PhoneActionScreenShare) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionScreenShare.ProtoReflect.Descriptor instead. -func (*PhoneActionScreenShare) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{33} -} - -func (x *PhoneActionScreenShare) GetEnable() bool { - if x != nil { - return x.Enable - } - return false -} - -func (x *PhoneActionScreenShare) GetTrackIDs() []string { - if x != nil { - return x.TrackIDs - } - return nil -} - -// PhoneActionPicked -type PhoneActionPicked struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthID int64 `protobuf:"varint,1,opt,name=AuthID,proto3" json:"AuthID,omitempty"` -} - -func (x *PhoneActionPicked) Reset() { - *x = PhoneActionPicked{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionPicked) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionPicked) ProtoMessage() {} - -func (x *PhoneActionPicked) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionPicked.ProtoReflect.Descriptor instead. -func (*PhoneActionPicked) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{34} -} - -func (x *PhoneActionPicked) GetAuthID() int64 { - if x != nil { - return x.AuthID - } - return 0 -} - -// PhoneActionRestarted -type PhoneActionRestarted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Sender bool `protobuf:"varint,1,opt,name=Sender,proto3" json:"Sender,omitempty"` -} - -func (x *PhoneActionRestarted) Reset() { - *x = PhoneActionRestarted{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionRestarted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionRestarted) ProtoMessage() {} - -func (x *PhoneActionRestarted) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionRestarted.ProtoReflect.Descriptor instead. -func (*PhoneActionRestarted) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{35} -} - -func (x *PhoneActionRestarted) GetSender() bool { - if x != nil { - return x.Sender - } - return false -} - -// PhoneActionMediaSettingsUpdated -type PhoneActionMediaSettingsUpdated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Video bool `protobuf:"varint,1,opt,name=Video,proto3" json:"Video,omitempty"` - Audio bool `protobuf:"varint,2,opt,name=Audio,proto3" json:"Audio,omitempty"` - ScreenShare bool `protobuf:"varint,3,opt,name=ScreenShare,proto3" json:"ScreenShare,omitempty"` -} - -func (x *PhoneActionMediaSettingsUpdated) Reset() { - *x = PhoneActionMediaSettingsUpdated{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionMediaSettingsUpdated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionMediaSettingsUpdated) ProtoMessage() {} - -func (x *PhoneActionMediaSettingsUpdated) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionMediaSettingsUpdated.ProtoReflect.Descriptor instead. -func (*PhoneActionMediaSettingsUpdated) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{36} -} - -func (x *PhoneActionMediaSettingsUpdated) GetVideo() bool { - if x != nil { - return x.Video - } - return false -} - -func (x *PhoneActionMediaSettingsUpdated) GetAudio() bool { - if x != nil { - return x.Audio - } - return false -} - -func (x *PhoneActionMediaSettingsUpdated) GetScreenShare() bool { - if x != nil { - return x.ScreenShare - } - return false -} - -// PhoneActionReactionSet -type PhoneActionReactionSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Reaction string `protobuf:"bytes,1,opt,name=Reaction,proto3" json:"Reaction,omitempty"` -} - -func (x *PhoneActionReactionSet) Reset() { - *x = PhoneActionReactionSet{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionReactionSet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionReactionSet) ProtoMessage() {} - -func (x *PhoneActionReactionSet) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionReactionSet.ProtoReflect.Descriptor instead. -func (*PhoneActionReactionSet) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{37} -} - -func (x *PhoneActionReactionSet) GetReaction() string { - if x != nil { - return x.Reaction - } - return "" -} - -// PhoneActionSDPOffer -type PhoneActionSDPOffer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SDP string `protobuf:"bytes,1,opt,name=SDP,proto3" json:"SDP,omitempty"` - Type string `protobuf:"bytes,2,opt,name=Type,proto3" json:"Type,omitempty"` -} - -func (x *PhoneActionSDPOffer) Reset() { - *x = PhoneActionSDPOffer{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionSDPOffer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionSDPOffer) ProtoMessage() {} - -func (x *PhoneActionSDPOffer) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionSDPOffer.ProtoReflect.Descriptor instead. -func (*PhoneActionSDPOffer) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{38} -} - -func (x *PhoneActionSDPOffer) GetSDP() string { - if x != nil { - return x.SDP - } - return "" -} - -func (x *PhoneActionSDPOffer) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -// PhoneActionSDPAnswer -type PhoneActionSDPAnswer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SDP string `protobuf:"bytes,1,opt,name=SDP,proto3" json:"SDP,omitempty"` - Type string `protobuf:"bytes,2,opt,name=Type,proto3" json:"Type,omitempty"` -} - -func (x *PhoneActionSDPAnswer) Reset() { - *x = PhoneActionSDPAnswer{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_phone_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneActionSDPAnswer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneActionSDPAnswer) ProtoMessage() {} - -func (x *PhoneActionSDPAnswer) ProtoReflect() protoreflect.Message { - mi := &file_chat_phone_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneActionSDPAnswer.ProtoReflect.Descriptor instead. -func (*PhoneActionSDPAnswer) Descriptor() ([]byte, []int) { - return file_chat_phone_proto_rawDescGZIP(), []int{39} -} - -func (x *PhoneActionSDPAnswer) GetSDP() string { - if x != nil { - return x.SDP - } - return "" -} - -func (x *PhoneActionSDPAnswer) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -var File_chat_phone_proto protoreflect.FileDescriptor - -var file_chat_phone_proto_rawDesc = []byte{ - 0x0a, 0x10, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4f, 0x0a, 0x0d, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, - 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, - 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x95, 0x02, 0x0a, 0x10, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x12, - 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, - 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, - 0x1c, 0x0a, 0x09, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x09, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x3c, 0x0a, - 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x53, 0x44, 0x50, 0x52, 0x0c, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x06, 0x43, - 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, - 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x33, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x56, 0x69, 0x64, - 0x65, 0x6f, 0x22, 0xc4, 0x01, 0x0a, 0x0f, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x63, 0x65, - 0x70, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, - 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, - 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x3c, 0x0a, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, - 0x61, 0x6e, 0x74, 0x53, 0x44, 0x50, 0x52, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, - 0x61, 0x6e, 0x74, 0x73, 0x12, 0x33, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, - 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x10, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x22, - 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x1a, - 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x52, 0x65, - 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, - 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x4e, 0x0a, 0x0c, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x47, - 0x65, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, - 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, - 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x4f, 0x0a, 0x0d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4a, - 0x6f, 0x69, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x43, - 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, - 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x89, 0x01, 0x0a, 0x13, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x41, 0x64, 0x64, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, - 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, - 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, - 0x32, 0x0a, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, - 0x6e, 0x74, 0x73, 0x22, 0xa6, 0x01, 0x0a, 0x16, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x22, - 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x32, - 0x0a, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, - 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x56, 0x0a, 0x14, - 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, - 0x61, 0x6e, 0x74, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, - 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, - 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, - 0x6c, 0x6c, 0x49, 0x44, 0x22, 0xd3, 0x01, 0x0a, 0x0f, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, - 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x0c, 0x50, 0x61, 0x72, 0x74, - 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x0c, - 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x06, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x22, 0xbd, 0x01, 0x0a, 0x0d, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x52, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x22, 0x0a, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, - 0x52, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x52, 0x61, 0x74, 0x65, - 0x12, 0x38, 0x0a, 0x0a, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x0a, - 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, - 0x61, 0x73, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, - 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x22, 0x3d, 0x0a, 0x0f, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x47, 0x65, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x66, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x05, 0x41, 0x66, 0x74, 0x65, 0x72, 0x22, 0x32, 0x0a, 0x12, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, - 0x1c, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x73, 0x22, 0x89, 0x02, - 0x0a, 0x0f, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, - 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, - 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, - 0x6c, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, - 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x4f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x64, 0x4f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x45, 0x6e, 0x64, 0x65, 0x64, 0x4f, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x45, 0x6e, 0x64, 0x65, 0x64, 0x4f, 0x6e, 0x12, 0x1a, 0x0a, - 0x08, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a, 0x06, 0x50, 0x65, 0x65, - 0x72, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x50, - 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, - 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xc1, 0x01, 0x0a, 0x0e, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x34, 0x0a, 0x0a, - 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, - 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x0a, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, - 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x12, 0x22, 0x0a, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, - 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x74, 0x69, - 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x43, 0x6f, 0x6e, - 0x74, 0x69, 0x6e, 0x75, 0x6f, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x8c, 0x01, - 0x0a, 0x10, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x64, 0x6d, - 0x69, 0x6e, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, - 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x52, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x3d, 0x0a, 0x09, - 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x12, 0x0a, 0x02, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, 0x44, 0x12, 0x1c, 0x0a, - 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x22, 0x3b, 0x0a, 0x09, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x2e, 0x0a, 0x0a, 0x49, 0x63, 0x65, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x49, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x0a, 0x49, 0x63, - 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x22, 0x4e, 0x0a, 0x11, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x39, 0x0a, - 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x0c, 0x50, 0x61, 0x72, 0x74, - 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x5b, 0x0a, 0x09, 0x49, 0x63, 0x65, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x55, 0x72, 0x6c, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x04, 0x55, 0x72, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, - 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, - 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x22, 0x8e, 0x01, 0x0a, 0x10, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x43, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x22, - 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x74, 0x6f, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x74, 0x6f, 0x72, - 0x12, 0x14, 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x83, 0x01, 0x0a, 0x13, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x53, 0x44, 0x50, 0x12, 0x22, - 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x49, 0x64, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x53, 0x44, 0x50, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x53, 0x44, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2c, 0x0a, 0x14, - 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x70, 0x0a, 0x13, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, - 0x64, 0x12, 0x10, 0x0a, 0x03, 0x53, 0x44, 0x50, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x53, 0x44, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0xc2, 0x01, 0x0a, - 0x14, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x53, 0x44, 0x50, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x53, 0x44, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x39, 0x0a, 0x0c, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x50, 0x61, 0x72, - 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x33, 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x56, - 0x69, 0x64, 0x65, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x56, 0x69, 0x64, 0x65, - 0x6f, 0x22, 0x2e, 0x0a, 0x16, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x43, 0x61, 0x6c, 0x6c, 0x57, 0x61, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x22, 0x92, 0x01, 0x0a, 0x14, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x2a, 0x0a, 0x06, - 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, - 0x52, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x65, 0x72, 0x6d, - 0x69, 0x6e, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x54, 0x65, 0x72, - 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x16, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x63, 0x65, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, - 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x12, - 0x24, 0x0a, 0x0d, 0x53, 0x64, 0x70, 0x4d, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x53, 0x64, 0x70, 0x4d, 0x4c, 0x69, 0x6e, 0x65, - 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x64, 0x70, 0x4d, 0x69, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x64, 0x70, 0x4d, 0x69, 0x64, 0x12, 0x2a, 0x0a, - 0x10, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, - 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x10, 0x0a, 0x0e, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x63, 0x6b, 0x22, 0x58, 0x0a, 0x1b, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x39, 0x0a, 0x0c, 0x50, 0x61, - 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x50, 0x61, 0x72, 0x74, - 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x57, 0x0a, 0x1d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x55, 0x73, 0x65, - 0x72, 0x49, 0x44, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x38, - 0x0a, 0x18, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4a, 0x6f, 0x69, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x07, 0x55, 0x73, - 0x65, 0x72, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, - 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x22, 0x4b, 0x0a, 0x17, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, - 0x14, 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, - 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x4c, 0x0a, 0x16, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x06, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x63, 0x6b, - 0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x54, 0x72, 0x61, 0x63, 0x6b, - 0x49, 0x44, 0x73, 0x22, 0x2f, 0x0a, 0x11, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x50, 0x69, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x06, 0x41, 0x75, 0x74, 0x68, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x41, 0x75, - 0x74, 0x68, 0x49, 0x44, 0x22, 0x2e, 0x0a, 0x14, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, - 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x53, 0x65, - 0x6e, 0x64, 0x65, 0x72, 0x22, 0x6f, 0x0a, 0x1f, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x14, 0x0a, - 0x05, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x41, 0x75, - 0x64, 0x69, 0x6f, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x22, 0x34, 0x0a, 0x16, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, 0x12, - 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3b, 0x0a, 0x13, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x44, 0x50, 0x4f, 0x66, 0x66, - 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x53, 0x44, 0x50, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x53, 0x44, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3c, 0x0a, 0x14, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x44, 0x50, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, - 0x12, 0x10, 0x0a, 0x03, 0x53, 0x44, 0x50, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x53, - 0x44, 0x50, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x2a, 0x8b, 0x03, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x63, 0x61, - 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x14, 0x44, 0x69, 0x73, 0x63, - 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, - 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, - 0x73, 0x6f, 0x6e, 0x4d, 0x69, 0x73, 0x73, 0x65, 0x64, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x44, - 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x42, 0x75, 0x73, 0x79, - 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, - 0x73, 0x6f, 0x6e, 0x48, 0x61, 0x6e, 0x67, 0x75, 0x70, 0x10, 0x03, 0x12, 0x1b, 0x0a, 0x17, 0x44, - 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x44, 0x69, 0x73, 0x63, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x63, - 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x31, 0x10, 0x05, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, - 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x10, 0x06, - 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x33, 0x10, 0x07, 0x12, 0x1a, 0x0a, 0x16, - 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x34, 0x10, 0x08, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x63, - 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x35, 0x10, 0x09, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, - 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x36, 0x10, 0x0a, - 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x37, 0x10, 0x0b, 0x12, 0x1a, 0x0a, 0x16, - 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x38, 0x10, 0x0c, 0x12, 0x1a, 0x0a, 0x16, 0x44, 0x69, 0x73, 0x63, - 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x39, 0x10, 0x0d, 0x2a, 0x91, 0x02, 0x0a, 0x0e, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x61, 0x6c, 0x6c, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x15, - 0x0a, 0x11, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x44, 0x65, 0x73, 0x6b, - 0x74, 0x6f, 0x70, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x57, 0x65, 0x62, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x61, 0x6c, 0x6c, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x4f, 0x53, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x43, - 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, - 0x10, 0x04, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x10, 0x05, 0x12, 0x17, 0x0a, 0x13, 0x43, - 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x32, 0x10, 0x06, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, - 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x33, 0x10, 0x07, 0x12, 0x17, 0x0a, - 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x34, 0x10, 0x08, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, - 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x35, 0x10, 0x09, 0x12, - 0x17, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x36, 0x10, 0x0a, 0x2a, 0xb7, 0x04, 0x0a, 0x13, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, - 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0x00, 0x12, 0x20, - 0x0a, 0x1c, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x10, 0x01, - 0x12, 0x20, 0x0a, 0x1c, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, - 0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x33, 0x10, 0x03, 0x12, 0x20, 0x0a, 0x1c, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, - 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x34, 0x10, 0x04, 0x12, 0x20, 0x0a, 0x1c, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, - 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x35, 0x10, 0x05, 0x12, 0x20, 0x0a, 0x1c, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x36, 0x10, 0x06, 0x12, 0x20, 0x0a, 0x1c, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x37, 0x10, 0x07, 0x12, 0x20, 0x0a, 0x1c, - 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, - 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x38, 0x10, 0x08, 0x12, 0x20, - 0x0a, 0x1c, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x39, 0x10, 0x09, - 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, - 0x30, 0x10, 0x0a, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, - 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x31, 0x31, 0x10, 0x0b, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, - 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x32, 0x10, 0x0c, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x33, 0x10, 0x0d, 0x12, 0x21, 0x0a, 0x1d, - 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, - 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x34, 0x10, 0x0e, 0x12, - 0x21, 0x0a, 0x1d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x61, 0x74, 0x65, - 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x35, - 0x10, 0x0f, 0x2a, 0xf2, 0x04, 0x0a, 0x0f, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, - 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, - 0x61, 0x6c, 0x6c, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x10, - 0x01, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x10, 0x02, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x43, 0x61, 0x6c, 0x6c, 0x57, 0x61, 0x69, 0x74, 0x69, 0x6e, - 0x67, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, - 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x65, 0x64, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x63, 0x65, 0x45, 0x78, 0x63, 0x68, 0x61, - 0x6e, 0x67, 0x65, 0x10, 0x05, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, - 0x6c, 0x6c, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x43, - 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x10, 0x06, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x74, - 0x10, 0x07, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x53, - 0x44, 0x50, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x44, 0x50, 0x41, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x10, - 0x09, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x63, - 0x6b, 0x10, 0x0a, 0x12, 0x1d, 0x0a, 0x19, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, - 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x65, 0x64, - 0x10, 0x0b, 0x12, 0x1f, 0x0a, 0x1b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, - 0x64, 0x10, 0x0c, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, - 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x10, 0x0d, 0x12, - 0x19, 0x0a, 0x15, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x64, 0x6d, 0x69, - 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x10, 0x0e, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x10, 0x0f, 0x12, 0x13, 0x0a, 0x0f, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, - 0x6c, 0x50, 0x69, 0x63, 0x6b, 0x65, 0x64, 0x10, 0x10, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x10, - 0x11, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x34, 0x10, 0x12, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, - 0x35, 0x10, 0x13, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x36, 0x10, 0x14, 0x12, 0x17, 0x0a, 0x13, - 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x31, 0x37, 0x10, 0x15, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, - 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x38, 0x10, 0x16, 0x12, 0x17, - 0x0a, 0x13, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x31, 0x39, 0x10, 0x17, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, - 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_chat_phone_proto_rawDescOnce sync.Once - file_chat_phone_proto_rawDescData = file_chat_phone_proto_rawDesc -) - -func file_chat_phone_proto_rawDescGZIP() []byte { - file_chat_phone_proto_rawDescOnce.Do(func() { - file_chat_phone_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_phone_proto_rawDescData) - }) - return file_chat_phone_proto_rawDescData -} - -var file_chat_phone_proto_enumTypes = make([]protoimpl.EnumInfo, 4) -var file_chat_phone_proto_msgTypes = make([]protoimpl.MessageInfo, 40) -var file_chat_phone_proto_goTypes = []interface{}{ - (DiscardReason)(0), // 0: msg.DiscardReason - (CallDeviceType)(0), // 1: msg.CallDeviceType - (PhoneCallRateReason)(0), // 2: msg.PhoneCallRateReason - (PhoneCallAction)(0), // 3: msg.PhoneCallAction - (*PhoneInitCall)(nil), // 4: msg.PhoneInitCall - (*PhoneRequestCall)(nil), // 5: msg.PhoneRequestCall - (*PhoneAcceptCall)(nil), // 6: msg.PhoneAcceptCall - (*PhoneDiscardCall)(nil), // 7: msg.PhoneDiscardCall - (*PhoneGetCall)(nil), // 8: msg.PhoneGetCall - (*PhoneJoinCall)(nil), // 9: msg.PhoneJoinCall - (*PhoneAddParticipant)(nil), // 10: msg.PhoneAddParticipant - (*PhoneRemoveParticipant)(nil), // 11: msg.PhoneRemoveParticipant - (*PhoneGetParticipants)(nil), // 12: msg.PhoneGetParticipants - (*PhoneUpdateCall)(nil), // 13: msg.PhoneUpdateCall - (*PhoneRateCall)(nil), // 14: msg.PhoneRateCall - (*PhoneGetHistory)(nil), // 15: msg.PhoneGetHistory - (*PhoneDeleteHistory)(nil), // 16: msg.PhoneDeleteHistory - (*PhoneCallRecord)(nil), // 17: msg.PhoneCallRecord - (*PhoneCallsMany)(nil), // 18: msg.PhoneCallsMany - (*PhoneUpdateAdmin)(nil), // 19: msg.PhoneUpdateAdmin - (*PhoneCall)(nil), // 20: msg.PhoneCall - (*PhoneInit)(nil), // 21: msg.PhoneInit - (*PhoneParticipants)(nil), // 22: msg.PhoneParticipants - (*IceServer)(nil), // 23: msg.IceServer - (*PhoneParticipant)(nil), // 24: msg.PhoneParticipant - (*PhoneParticipantSDP)(nil), // 25: msg.PhoneParticipantSDP - (*PhoneActionCallEmpty)(nil), // 26: msg.PhoneActionCallEmpty - (*PhoneActionAccepted)(nil), // 27: msg.PhoneActionAccepted - (*PhoneActionRequested)(nil), // 28: msg.PhoneActionRequested - (*PhoneActionCallWaiting)(nil), // 29: msg.PhoneActionCallWaiting - (*PhoneActionDiscarded)(nil), // 30: msg.PhoneActionDiscarded - (*PhoneActionIceExchange)(nil), // 31: msg.PhoneActionIceExchange - (*PhoneActionAck)(nil), // 32: msg.PhoneActionAck - (*PhoneActionParticipantAdded)(nil), // 33: msg.PhoneActionParticipantAdded - (*PhoneActionParticipantRemoved)(nil), // 34: msg.PhoneActionParticipantRemoved - (*PhoneActionJoinRequested)(nil), // 35: msg.PhoneActionJoinRequested - (*PhoneActionAdminUpdated)(nil), // 36: msg.PhoneActionAdminUpdated - (*PhoneActionScreenShare)(nil), // 37: msg.PhoneActionScreenShare - (*PhoneActionPicked)(nil), // 38: msg.PhoneActionPicked - (*PhoneActionRestarted)(nil), // 39: msg.PhoneActionRestarted - (*PhoneActionMediaSettingsUpdated)(nil), // 40: msg.PhoneActionMediaSettingsUpdated - (*PhoneActionReactionSet)(nil), // 41: msg.PhoneActionReactionSet - (*PhoneActionSDPOffer)(nil), // 42: msg.PhoneActionSDPOffer - (*PhoneActionSDPAnswer)(nil), // 43: msg.PhoneActionSDPAnswer - (*InputPeer)(nil), // 44: msg.InputPeer - (*InputUser)(nil), // 45: msg.InputUser - (*User)(nil), // 46: msg.User - (*Group)(nil), // 47: msg.Group -} -var file_chat_phone_proto_depIdxs = []int32{ - 44, // 0: msg.PhoneInitCall.Peer:type_name -> msg.InputPeer - 44, // 1: msg.PhoneRequestCall.Peer:type_name -> msg.InputPeer - 25, // 2: msg.PhoneRequestCall.Participants:type_name -> msg.PhoneParticipantSDP - 1, // 3: msg.PhoneRequestCall.DeviceType:type_name -> msg.CallDeviceType - 44, // 4: msg.PhoneAcceptCall.Peer:type_name -> msg.InputPeer - 25, // 5: msg.PhoneAcceptCall.Participants:type_name -> msg.PhoneParticipantSDP - 1, // 6: msg.PhoneAcceptCall.DeviceType:type_name -> msg.CallDeviceType - 44, // 7: msg.PhoneDiscardCall.Peer:type_name -> msg.InputPeer - 0, // 8: msg.PhoneDiscardCall.Reason:type_name -> msg.DiscardReason - 44, // 9: msg.PhoneGetCall.Peer:type_name -> msg.InputPeer - 44, // 10: msg.PhoneJoinCall.Peer:type_name -> msg.InputPeer - 44, // 11: msg.PhoneAddParticipant.Peer:type_name -> msg.InputPeer - 45, // 12: msg.PhoneAddParticipant.Participants:type_name -> msg.InputUser - 44, // 13: msg.PhoneRemoveParticipant.Peer:type_name -> msg.InputPeer - 45, // 14: msg.PhoneRemoveParticipant.Participants:type_name -> msg.InputUser - 44, // 15: msg.PhoneGetParticipants.Peer:type_name -> msg.InputPeer - 44, // 16: msg.PhoneUpdateCall.Peer:type_name -> msg.InputPeer - 45, // 17: msg.PhoneUpdateCall.Participants:type_name -> msg.InputUser - 3, // 18: msg.PhoneUpdateCall.Action:type_name -> msg.PhoneCallAction - 44, // 19: msg.PhoneRateCall.Peer:type_name -> msg.InputPeer - 2, // 20: msg.PhoneRateCall.ReasonType:type_name -> msg.PhoneCallRateReason - 17, // 21: msg.PhoneCallsMany.PhoneCalls:type_name -> msg.PhoneCallRecord - 46, // 22: msg.PhoneCallsMany.Users:type_name -> msg.User - 47, // 23: msg.PhoneCallsMany.Groups:type_name -> msg.Group - 44, // 24: msg.PhoneUpdateAdmin.Peer:type_name -> msg.InputPeer - 45, // 25: msg.PhoneUpdateAdmin.User:type_name -> msg.InputUser - 23, // 26: msg.PhoneInit.IceServers:type_name -> msg.IceServer - 24, // 27: msg.PhoneParticipants.Participants:type_name -> msg.PhoneParticipant - 45, // 28: msg.PhoneParticipant.Peer:type_name -> msg.InputUser - 45, // 29: msg.PhoneParticipantSDP.Peer:type_name -> msg.InputUser - 1, // 30: msg.PhoneActionAccepted.DeviceType:type_name -> msg.CallDeviceType - 24, // 31: msg.PhoneActionRequested.Participants:type_name -> msg.PhoneParticipant - 1, // 32: msg.PhoneActionRequested.DeviceType:type_name -> msg.CallDeviceType - 0, // 33: msg.PhoneActionDiscarded.Reason:type_name -> msg.DiscardReason - 24, // 34: msg.PhoneActionParticipantAdded.Participants:type_name -> msg.PhoneParticipant - 35, // [35:35] is the sub-list for method output_type - 35, // [35:35] is the sub-list for method input_type - 35, // [35:35] is the sub-list for extension type_name - 35, // [35:35] is the sub-list for extension extendee - 0, // [0:35] is the sub-list for field type_name -} - -func init() { file_chat_phone_proto_init() } -func file_chat_phone_proto_init() { - if File_chat_phone_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_chat_phone_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneInitCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneRequestCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneAcceptCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneDiscardCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneGetCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneJoinCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneAddParticipant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneRemoveParticipant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneGetParticipants); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneUpdateCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneRateCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneGetHistory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneDeleteHistory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneCallRecord); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneCallsMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneUpdateAdmin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneInit); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneParticipants); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IceServer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneParticipant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneParticipantSDP); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionCallEmpty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionAccepted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionRequested); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionCallWaiting); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionDiscarded); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionIceExchange); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionAck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionParticipantAdded); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionParticipantRemoved); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionJoinRequested); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionAdminUpdated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionScreenShare); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionPicked); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionRestarted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionMediaSettingsUpdated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionReactionSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionSDPOffer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_phone_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneActionSDPAnswer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_phone_proto_rawDesc, - NumEnums: 4, - NumMessages: 40, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_phone_proto_goTypes, - DependencyIndexes: file_chat_phone_proto_depIdxs, - EnumInfos: file_chat_phone_proto_enumTypes, - MessageInfos: file_chat_phone_proto_msgTypes, - }.Build() - File_chat_phone_proto = out.File - file_chat_phone_proto_rawDesc = nil - file_chat_phone_proto_goTypes = nil - file_chat_phone_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.phone.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.phone.rony.go deleted file mode 100644 index 397531ad..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.phone.rony.go +++ /dev/null @@ -1,2756 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.phone.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_PhoneInitCall int64 = 2975617068 - -type poolPhoneInitCall struct { - pool sync.Pool -} - -func (p *poolPhoneInitCall) Get() *PhoneInitCall { - x, ok := p.pool.Get().(*PhoneInitCall) - if !ok { - x = &PhoneInitCall{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneInitCall) Put(x *PhoneInitCall) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolPhoneInitCall = poolPhoneInitCall{} - -func (x *PhoneInitCall) DeepCopy(z *PhoneInitCall) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID -} - -func (x *PhoneInitCall) Clone() *PhoneInitCall { - z := &PhoneInitCall{} - x.DeepCopy(z) - return z -} - -func (x *PhoneInitCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneInitCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneInitCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneInitCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneInitCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneInitCall, x) -} - -const C_PhoneRequestCall int64 = 907942641 - -type poolPhoneRequestCall struct { - pool sync.Pool -} - -func (p *poolPhoneRequestCall) Get() *PhoneRequestCall { - x, ok := p.pool.Get().(*PhoneRequestCall) - if !ok { - x = &PhoneRequestCall{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneRequestCall) Put(x *PhoneRequestCall) { - if x == nil { - return - } - - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.Initiator = false - for _, z := range x.Participants { - PoolPhoneParticipantSDP.Put(z) - } - x.Participants = x.Participants[:0] - x.CallID = 0 - x.DeviceType = 0 - x.Video = false - - p.pool.Put(x) -} - -var PoolPhoneRequestCall = poolPhoneRequestCall{} - -func (x *PhoneRequestCall) DeepCopy(z *PhoneRequestCall) { - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Initiator = x.Initiator - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolPhoneParticipantSDP.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } - z.CallID = x.CallID - z.DeviceType = x.DeviceType - z.Video = x.Video -} - -func (x *PhoneRequestCall) Clone() *PhoneRequestCall { - z := &PhoneRequestCall{} - x.DeepCopy(z) - return z -} - -func (x *PhoneRequestCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneRequestCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneRequestCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneRequestCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneRequestCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneRequestCall, x) -} - -const C_PhoneAcceptCall int64 = 4133092858 - -type poolPhoneAcceptCall struct { - pool sync.Pool -} - -func (p *poolPhoneAcceptCall) Get() *PhoneAcceptCall { - x, ok := p.pool.Get().(*PhoneAcceptCall) - if !ok { - x = &PhoneAcceptCall{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneAcceptCall) Put(x *PhoneAcceptCall) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - for _, z := range x.Participants { - PoolPhoneParticipantSDP.Put(z) - } - x.Participants = x.Participants[:0] - x.DeviceType = 0 - - p.pool.Put(x) -} - -var PoolPhoneAcceptCall = poolPhoneAcceptCall{} - -func (x *PhoneAcceptCall) DeepCopy(z *PhoneAcceptCall) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolPhoneParticipantSDP.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } - z.DeviceType = x.DeviceType -} - -func (x *PhoneAcceptCall) Clone() *PhoneAcceptCall { - z := &PhoneAcceptCall{} - x.DeepCopy(z) - return z -} - -func (x *PhoneAcceptCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneAcceptCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneAcceptCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneAcceptCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneAcceptCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneAcceptCall, x) -} - -const C_PhoneDiscardCall int64 = 2712700137 - -type poolPhoneDiscardCall struct { - pool sync.Pool -} - -func (p *poolPhoneDiscardCall) Get() *PhoneDiscardCall { - x, ok := p.pool.Get().(*PhoneDiscardCall) - if !ok { - x = &PhoneDiscardCall{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneDiscardCall) Put(x *PhoneDiscardCall) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - x.Duration = 0 - x.Reason = 0 - - p.pool.Put(x) -} - -var PoolPhoneDiscardCall = poolPhoneDiscardCall{} - -func (x *PhoneDiscardCall) DeepCopy(z *PhoneDiscardCall) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID - z.Duration = x.Duration - z.Reason = x.Reason -} - -func (x *PhoneDiscardCall) Clone() *PhoneDiscardCall { - z := &PhoneDiscardCall{} - x.DeepCopy(z) - return z -} - -func (x *PhoneDiscardCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneDiscardCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneDiscardCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneDiscardCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneDiscardCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneDiscardCall, x) -} - -const C_PhoneGetCall int64 = 432049159 - -type poolPhoneGetCall struct { - pool sync.Pool -} - -func (p *poolPhoneGetCall) Get() *PhoneGetCall { - x, ok := p.pool.Get().(*PhoneGetCall) - if !ok { - x = &PhoneGetCall{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneGetCall) Put(x *PhoneGetCall) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolPhoneGetCall = poolPhoneGetCall{} - -func (x *PhoneGetCall) DeepCopy(z *PhoneGetCall) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID -} - -func (x *PhoneGetCall) Clone() *PhoneGetCall { - z := &PhoneGetCall{} - x.DeepCopy(z) - return z -} - -func (x *PhoneGetCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneGetCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneGetCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneGetCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneGetCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneGetCall, x) -} - -const C_PhoneJoinCall int64 = 3019166552 - -type poolPhoneJoinCall struct { - pool sync.Pool -} - -func (p *poolPhoneJoinCall) Get() *PhoneJoinCall { - x, ok := p.pool.Get().(*PhoneJoinCall) - if !ok { - x = &PhoneJoinCall{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneJoinCall) Put(x *PhoneJoinCall) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolPhoneJoinCall = poolPhoneJoinCall{} - -func (x *PhoneJoinCall) DeepCopy(z *PhoneJoinCall) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID -} - -func (x *PhoneJoinCall) Clone() *PhoneJoinCall { - z := &PhoneJoinCall{} - x.DeepCopy(z) - return z -} - -func (x *PhoneJoinCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneJoinCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneJoinCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneJoinCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneJoinCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneJoinCall, x) -} - -const C_PhoneAddParticipant int64 = 2867411100 - -type poolPhoneAddParticipant struct { - pool sync.Pool -} - -func (p *poolPhoneAddParticipant) Get() *PhoneAddParticipant { - x, ok := p.pool.Get().(*PhoneAddParticipant) - if !ok { - x = &PhoneAddParticipant{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneAddParticipant) Put(x *PhoneAddParticipant) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - for _, z := range x.Participants { - PoolInputUser.Put(z) - } - x.Participants = x.Participants[:0] - - p.pool.Put(x) -} - -var PoolPhoneAddParticipant = poolPhoneAddParticipant{} - -func (x *PhoneAddParticipant) DeepCopy(z *PhoneAddParticipant) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolInputUser.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } -} - -func (x *PhoneAddParticipant) Clone() *PhoneAddParticipant { - z := &PhoneAddParticipant{} - x.DeepCopy(z) - return z -} - -func (x *PhoneAddParticipant) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneAddParticipant) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneAddParticipant) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneAddParticipant) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneAddParticipant) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneAddParticipant, x) -} - -const C_PhoneRemoveParticipant int64 = 188662172 - -type poolPhoneRemoveParticipant struct { - pool sync.Pool -} - -func (p *poolPhoneRemoveParticipant) Get() *PhoneRemoveParticipant { - x, ok := p.pool.Get().(*PhoneRemoveParticipant) - if !ok { - x = &PhoneRemoveParticipant{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneRemoveParticipant) Put(x *PhoneRemoveParticipant) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - for _, z := range x.Participants { - PoolInputUser.Put(z) - } - x.Participants = x.Participants[:0] - x.Timeout = false - - p.pool.Put(x) -} - -var PoolPhoneRemoveParticipant = poolPhoneRemoveParticipant{} - -func (x *PhoneRemoveParticipant) DeepCopy(z *PhoneRemoveParticipant) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolInputUser.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } - z.Timeout = x.Timeout -} - -func (x *PhoneRemoveParticipant) Clone() *PhoneRemoveParticipant { - z := &PhoneRemoveParticipant{} - x.DeepCopy(z) - return z -} - -func (x *PhoneRemoveParticipant) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneRemoveParticipant) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneRemoveParticipant) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneRemoveParticipant) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneRemoveParticipant) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneRemoveParticipant, x) -} - -const C_PhoneGetParticipants int64 = 3924781570 - -type poolPhoneGetParticipants struct { - pool sync.Pool -} - -func (p *poolPhoneGetParticipants) Get() *PhoneGetParticipants { - x, ok := p.pool.Get().(*PhoneGetParticipants) - if !ok { - x = &PhoneGetParticipants{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneGetParticipants) Put(x *PhoneGetParticipants) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolPhoneGetParticipants = poolPhoneGetParticipants{} - -func (x *PhoneGetParticipants) DeepCopy(z *PhoneGetParticipants) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID -} - -func (x *PhoneGetParticipants) Clone() *PhoneGetParticipants { - z := &PhoneGetParticipants{} - x.DeepCopy(z) - return z -} - -func (x *PhoneGetParticipants) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneGetParticipants) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneGetParticipants) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneGetParticipants) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneGetParticipants) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneGetParticipants, x) -} - -const C_PhoneUpdateCall int64 = 1976202226 - -type poolPhoneUpdateCall struct { - pool sync.Pool -} - -func (p *poolPhoneUpdateCall) Get() *PhoneUpdateCall { - x, ok := p.pool.Get().(*PhoneUpdateCall) - if !ok { - x = &PhoneUpdateCall{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneUpdateCall) Put(x *PhoneUpdateCall) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - for _, z := range x.Participants { - PoolInputUser.Put(z) - } - x.Participants = x.Participants[:0] - x.Action = 0 - x.ActionData = x.ActionData[:0] - - p.pool.Put(x) -} - -var PoolPhoneUpdateCall = poolPhoneUpdateCall{} - -func (x *PhoneUpdateCall) DeepCopy(z *PhoneUpdateCall) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolInputUser.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } - z.Action = x.Action - z.ActionData = append(z.ActionData[:0], x.ActionData...) -} - -func (x *PhoneUpdateCall) Clone() *PhoneUpdateCall { - z := &PhoneUpdateCall{} - x.DeepCopy(z) - return z -} - -func (x *PhoneUpdateCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneUpdateCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneUpdateCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneUpdateCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneUpdateCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneUpdateCall, x) -} - -const C_PhoneRateCall int64 = 2215486159 - -type poolPhoneRateCall struct { - pool sync.Pool -} - -func (p *poolPhoneRateCall) Get() *PhoneRateCall { - x, ok := p.pool.Get().(*PhoneRateCall) - if !ok { - x = &PhoneRateCall{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolPhoneRateCall) Put(x *PhoneRateCall) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - x.Rate = 0 - x.ReasonType = 0 - x.ReasonData = x.ReasonData[:0] - - p.pool.Put(x) -} - -var PoolPhoneRateCall = poolPhoneRateCall{} - -func (x *PhoneRateCall) DeepCopy(z *PhoneRateCall) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID - z.Rate = x.Rate - z.ReasonType = x.ReasonType - z.ReasonData = append(z.ReasonData[:0], x.ReasonData...) -} - -func (x *PhoneRateCall) Clone() *PhoneRateCall { - z := &PhoneRateCall{} - x.DeepCopy(z) - return z -} - -func (x *PhoneRateCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneRateCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneRateCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneRateCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneRateCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneRateCall, x) -} - -const C_PhoneGetHistory int64 = 407776572 - -type poolPhoneGetHistory struct { - pool sync.Pool -} - -func (p *poolPhoneGetHistory) Get() *PhoneGetHistory { - x, ok := p.pool.Get().(*PhoneGetHistory) - if !ok { - x = &PhoneGetHistory{} - } - - return x -} - -func (p *poolPhoneGetHistory) Put(x *PhoneGetHistory) { - if x == nil { - return - } - - x.Limit = 0 - x.After = 0 - - p.pool.Put(x) -} - -var PoolPhoneGetHistory = poolPhoneGetHistory{} - -func (x *PhoneGetHistory) DeepCopy(z *PhoneGetHistory) { - z.Limit = x.Limit - z.After = x.After -} - -func (x *PhoneGetHistory) Clone() *PhoneGetHistory { - z := &PhoneGetHistory{} - x.DeepCopy(z) - return z -} - -func (x *PhoneGetHistory) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneGetHistory) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneGetHistory) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneGetHistory) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneGetHistory) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneGetHistory, x) -} - -const C_PhoneDeleteHistory int64 = 2528259211 - -type poolPhoneDeleteHistory struct { - pool sync.Pool -} - -func (p *poolPhoneDeleteHistory) Get() *PhoneDeleteHistory { - x, ok := p.pool.Get().(*PhoneDeleteHistory) - if !ok { - x = &PhoneDeleteHistory{} - } - - return x -} - -func (p *poolPhoneDeleteHistory) Put(x *PhoneDeleteHistory) { - if x == nil { - return - } - - x.CallIDs = x.CallIDs[:0] - - p.pool.Put(x) -} - -var PoolPhoneDeleteHistory = poolPhoneDeleteHistory{} - -func (x *PhoneDeleteHistory) DeepCopy(z *PhoneDeleteHistory) { - z.CallIDs = append(z.CallIDs[:0], x.CallIDs...) -} - -func (x *PhoneDeleteHistory) Clone() *PhoneDeleteHistory { - z := &PhoneDeleteHistory{} - x.DeepCopy(z) - return z -} - -func (x *PhoneDeleteHistory) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneDeleteHistory) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneDeleteHistory) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneDeleteHistory) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneDeleteHistory) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneDeleteHistory, x) -} - -const C_PhoneCallRecord int64 = 4147150312 - -type poolPhoneCallRecord struct { - pool sync.Pool -} - -func (p *poolPhoneCallRecord) Get() *PhoneCallRecord { - x, ok := p.pool.Get().(*PhoneCallRecord) - if !ok { - x = &PhoneCallRecord{} - } - - return x -} - -func (p *poolPhoneCallRecord) Put(x *PhoneCallRecord) { - if x == nil { - return - } - - x.UserID = 0 - x.TeamID = 0 - x.CallID = 0 - x.CreatedOn = 0 - x.EndedOn = 0 - x.Incoming = false - x.PeerID = 0 - x.PeerType = 0 - x.Status = 0 - - p.pool.Put(x) -} - -var PoolPhoneCallRecord = poolPhoneCallRecord{} - -func (x *PhoneCallRecord) DeepCopy(z *PhoneCallRecord) { - z.UserID = x.UserID - z.TeamID = x.TeamID - z.CallID = x.CallID - z.CreatedOn = x.CreatedOn - z.EndedOn = x.EndedOn - z.Incoming = x.Incoming - z.PeerID = x.PeerID - z.PeerType = x.PeerType - z.Status = x.Status -} - -func (x *PhoneCallRecord) Clone() *PhoneCallRecord { - z := &PhoneCallRecord{} - x.DeepCopy(z) - return z -} - -func (x *PhoneCallRecord) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneCallRecord) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneCallRecord) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneCallRecord) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneCallRecord) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneCallRecord, x) -} - -const C_PhoneCallsMany int64 = 1227520020 - -type poolPhoneCallsMany struct { - pool sync.Pool -} - -func (p *poolPhoneCallsMany) Get() *PhoneCallsMany { - x, ok := p.pool.Get().(*PhoneCallsMany) - if !ok { - x = &PhoneCallsMany{} - } - - return x -} - -func (p *poolPhoneCallsMany) Put(x *PhoneCallsMany) { - if x == nil { - return - } - - for _, z := range x.PhoneCalls { - PoolPhoneCallRecord.Put(z) - } - x.PhoneCalls = x.PhoneCalls[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Groups { - PoolGroup.Put(z) - } - x.Groups = x.Groups[:0] - x.Continuous = false - x.Empty = false - - p.pool.Put(x) -} - -var PoolPhoneCallsMany = poolPhoneCallsMany{} - -func (x *PhoneCallsMany) DeepCopy(z *PhoneCallsMany) { - for idx := range x.PhoneCalls { - if x.PhoneCalls[idx] == nil { - continue - } - xx := PoolPhoneCallRecord.Get() - x.PhoneCalls[idx].DeepCopy(xx) - z.PhoneCalls = append(z.PhoneCalls, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Groups { - if x.Groups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.Groups[idx].DeepCopy(xx) - z.Groups = append(z.Groups, xx) - } - z.Continuous = x.Continuous - z.Empty = x.Empty -} - -func (x *PhoneCallsMany) Clone() *PhoneCallsMany { - z := &PhoneCallsMany{} - x.DeepCopy(z) - return z -} - -func (x *PhoneCallsMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneCallsMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneCallsMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneCallsMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneCallsMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneCallsMany, x) -} - -const C_PhoneUpdateAdmin int64 = 442877873 - -type poolPhoneUpdateAdmin struct { - pool sync.Pool -} - -func (p *poolPhoneUpdateAdmin) Get() *PhoneUpdateAdmin { - x, ok := p.pool.Get().(*PhoneUpdateAdmin) - if !ok { - x = &PhoneUpdateAdmin{} - } - - x.Peer = PoolInputPeer.Get() - - x.User = PoolInputUser.Get() - - return x -} - -func (p *poolPhoneUpdateAdmin) Put(x *PhoneUpdateAdmin) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - PoolInputUser.Put(x.User) - x.Admin = false - - p.pool.Put(x) -} - -var PoolPhoneUpdateAdmin = poolPhoneUpdateAdmin{} - -func (x *PhoneUpdateAdmin) DeepCopy(z *PhoneUpdateAdmin) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID - if x.User != nil { - if z.User == nil { - z.User = PoolInputUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolInputUser.Put(z.User) - z.User = nil - } - z.Admin = x.Admin -} - -func (x *PhoneUpdateAdmin) Clone() *PhoneUpdateAdmin { - z := &PhoneUpdateAdmin{} - x.DeepCopy(z) - return z -} - -func (x *PhoneUpdateAdmin) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneUpdateAdmin) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneUpdateAdmin) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneUpdateAdmin) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneUpdateAdmin) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneUpdateAdmin, x) -} - -const C_PhoneCall int64 = 3296664529 - -type poolPhoneCall struct { - pool sync.Pool -} - -func (p *poolPhoneCall) Get() *PhoneCall { - x, ok := p.pool.Get().(*PhoneCall) - if !ok { - x = &PhoneCall{} - } - - return x -} - -func (p *poolPhoneCall) Put(x *PhoneCall) { - if x == nil { - return - } - - x.ID = 0 - x.CreatedOn = 0 - - p.pool.Put(x) -} - -var PoolPhoneCall = poolPhoneCall{} - -func (x *PhoneCall) DeepCopy(z *PhoneCall) { - z.ID = x.ID - z.CreatedOn = x.CreatedOn -} - -func (x *PhoneCall) Clone() *PhoneCall { - z := &PhoneCall{} - x.DeepCopy(z) - return z -} - -func (x *PhoneCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneCall, x) -} - -const C_PhoneInit int64 = 3464876187 - -type poolPhoneInit struct { - pool sync.Pool -} - -func (p *poolPhoneInit) Get() *PhoneInit { - x, ok := p.pool.Get().(*PhoneInit) - if !ok { - x = &PhoneInit{} - } - - return x -} - -func (p *poolPhoneInit) Put(x *PhoneInit) { - if x == nil { - return - } - - for _, z := range x.IceServers { - PoolIceServer.Put(z) - } - x.IceServers = x.IceServers[:0] - - p.pool.Put(x) -} - -var PoolPhoneInit = poolPhoneInit{} - -func (x *PhoneInit) DeepCopy(z *PhoneInit) { - for idx := range x.IceServers { - if x.IceServers[idx] == nil { - continue - } - xx := PoolIceServer.Get() - x.IceServers[idx].DeepCopy(xx) - z.IceServers = append(z.IceServers, xx) - } -} - -func (x *PhoneInit) Clone() *PhoneInit { - z := &PhoneInit{} - x.DeepCopy(z) - return z -} - -func (x *PhoneInit) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneInit) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneInit) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneInit) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneInit) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneInit, x) -} - -const C_PhoneParticipants int64 = 2567653219 - -type poolPhoneParticipants struct { - pool sync.Pool -} - -func (p *poolPhoneParticipants) Get() *PhoneParticipants { - x, ok := p.pool.Get().(*PhoneParticipants) - if !ok { - x = &PhoneParticipants{} - } - - return x -} - -func (p *poolPhoneParticipants) Put(x *PhoneParticipants) { - if x == nil { - return - } - - for _, z := range x.Participants { - PoolPhoneParticipant.Put(z) - } - x.Participants = x.Participants[:0] - - p.pool.Put(x) -} - -var PoolPhoneParticipants = poolPhoneParticipants{} - -func (x *PhoneParticipants) DeepCopy(z *PhoneParticipants) { - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolPhoneParticipant.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } -} - -func (x *PhoneParticipants) Clone() *PhoneParticipants { - z := &PhoneParticipants{} - x.DeepCopy(z) - return z -} - -func (x *PhoneParticipants) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneParticipants) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneParticipants) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneParticipants) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneParticipants) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneParticipants, x) -} - -const C_IceServer int64 = 4291892363 - -type poolIceServer struct { - pool sync.Pool -} - -func (p *poolIceServer) Get() *IceServer { - x, ok := p.pool.Get().(*IceServer) - if !ok { - x = &IceServer{} - } - - return x -} - -func (p *poolIceServer) Put(x *IceServer) { - if x == nil { - return - } - - x.Urls = x.Urls[:0] - x.Username = "" - x.Credential = "" - - p.pool.Put(x) -} - -var PoolIceServer = poolIceServer{} - -func (x *IceServer) DeepCopy(z *IceServer) { - z.Urls = append(z.Urls[:0], x.Urls...) - z.Username = x.Username - z.Credential = x.Credential -} - -func (x *IceServer) Clone() *IceServer { - z := &IceServer{} - x.DeepCopy(z) - return z -} - -func (x *IceServer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *IceServer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *IceServer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *IceServer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *IceServer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_IceServer, x) -} - -const C_PhoneParticipant int64 = 226273622 - -type poolPhoneParticipant struct { - pool sync.Pool -} - -func (p *poolPhoneParticipant) Get() *PhoneParticipant { - x, ok := p.pool.Get().(*PhoneParticipant) - if !ok { - x = &PhoneParticipant{} - } - - x.Peer = PoolInputUser.Get() - - return x -} - -func (p *poolPhoneParticipant) Put(x *PhoneParticipant) { - if x == nil { - return - } - - x.ConnectionId = 0 - PoolInputUser.Put(x.Peer) - x.Initiator = false - x.Admin = false - - p.pool.Put(x) -} - -var PoolPhoneParticipant = poolPhoneParticipant{} - -func (x *PhoneParticipant) DeepCopy(z *PhoneParticipant) { - z.ConnectionId = x.ConnectionId - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputUser.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputUser.Put(z.Peer) - z.Peer = nil - } - z.Initiator = x.Initiator - z.Admin = x.Admin -} - -func (x *PhoneParticipant) Clone() *PhoneParticipant { - z := &PhoneParticipant{} - x.DeepCopy(z) - return z -} - -func (x *PhoneParticipant) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneParticipant) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneParticipant) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneParticipant) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneParticipant) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneParticipant, x) -} - -const C_PhoneParticipantSDP int64 = 545454774 - -type poolPhoneParticipantSDP struct { - pool sync.Pool -} - -func (p *poolPhoneParticipantSDP) Get() *PhoneParticipantSDP { - x, ok := p.pool.Get().(*PhoneParticipantSDP) - if !ok { - x = &PhoneParticipantSDP{} - } - - x.Peer = PoolInputUser.Get() - - return x -} - -func (p *poolPhoneParticipantSDP) Put(x *PhoneParticipantSDP) { - if x == nil { - return - } - - x.ConnectionId = 0 - PoolInputUser.Put(x.Peer) - x.SDP = "" - x.Type = "" - - p.pool.Put(x) -} - -var PoolPhoneParticipantSDP = poolPhoneParticipantSDP{} - -func (x *PhoneParticipantSDP) DeepCopy(z *PhoneParticipantSDP) { - z.ConnectionId = x.ConnectionId - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputUser.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputUser.Put(z.Peer) - z.Peer = nil - } - z.SDP = x.SDP - z.Type = x.Type -} - -func (x *PhoneParticipantSDP) Clone() *PhoneParticipantSDP { - z := &PhoneParticipantSDP{} - x.DeepCopy(z) - return z -} - -func (x *PhoneParticipantSDP) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneParticipantSDP) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneParticipantSDP) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneParticipantSDP) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneParticipantSDP) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneParticipantSDP, x) -} - -const C_PhoneActionCallEmpty int64 = 1073285997 - -type poolPhoneActionCallEmpty struct { - pool sync.Pool -} - -func (p *poolPhoneActionCallEmpty) Get() *PhoneActionCallEmpty { - x, ok := p.pool.Get().(*PhoneActionCallEmpty) - if !ok { - x = &PhoneActionCallEmpty{} - } - - return x -} - -func (p *poolPhoneActionCallEmpty) Put(x *PhoneActionCallEmpty) { - if x == nil { - return - } - - x.Empty = false - - p.pool.Put(x) -} - -var PoolPhoneActionCallEmpty = poolPhoneActionCallEmpty{} - -func (x *PhoneActionCallEmpty) DeepCopy(z *PhoneActionCallEmpty) { - z.Empty = x.Empty -} - -func (x *PhoneActionCallEmpty) Clone() *PhoneActionCallEmpty { - z := &PhoneActionCallEmpty{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionCallEmpty) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionCallEmpty) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionCallEmpty) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionCallEmpty) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionCallEmpty) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionCallEmpty, x) -} - -const C_PhoneActionAccepted int64 = 2493210645 - -type poolPhoneActionAccepted struct { - pool sync.Pool -} - -func (p *poolPhoneActionAccepted) Get() *PhoneActionAccepted { - x, ok := p.pool.Get().(*PhoneActionAccepted) - if !ok { - x = &PhoneActionAccepted{} - } - - return x -} - -func (p *poolPhoneActionAccepted) Put(x *PhoneActionAccepted) { - if x == nil { - return - } - - x.SDP = "" - x.Type = "" - x.DeviceType = 0 - - p.pool.Put(x) -} - -var PoolPhoneActionAccepted = poolPhoneActionAccepted{} - -func (x *PhoneActionAccepted) DeepCopy(z *PhoneActionAccepted) { - z.SDP = x.SDP - z.Type = x.Type - z.DeviceType = x.DeviceType -} - -func (x *PhoneActionAccepted) Clone() *PhoneActionAccepted { - z := &PhoneActionAccepted{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionAccepted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionAccepted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionAccepted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionAccepted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionAccepted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionAccepted, x) -} - -const C_PhoneActionRequested int64 = 1678316869 - -type poolPhoneActionRequested struct { - pool sync.Pool -} - -func (p *poolPhoneActionRequested) Get() *PhoneActionRequested { - x, ok := p.pool.Get().(*PhoneActionRequested) - if !ok { - x = &PhoneActionRequested{} - } - - return x -} - -func (p *poolPhoneActionRequested) Put(x *PhoneActionRequested) { - if x == nil { - return - } - - x.SDP = "" - x.Type = "" - for _, z := range x.Participants { - PoolPhoneParticipant.Put(z) - } - x.Participants = x.Participants[:0] - x.DeviceType = 0 - x.Video = false - - p.pool.Put(x) -} - -var PoolPhoneActionRequested = poolPhoneActionRequested{} - -func (x *PhoneActionRequested) DeepCopy(z *PhoneActionRequested) { - z.SDP = x.SDP - z.Type = x.Type - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolPhoneParticipant.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } - z.DeviceType = x.DeviceType - z.Video = x.Video -} - -func (x *PhoneActionRequested) Clone() *PhoneActionRequested { - z := &PhoneActionRequested{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionRequested) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionRequested) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionRequested) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionRequested) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionRequested) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionRequested, x) -} - -const C_PhoneActionCallWaiting int64 = 3634710697 - -type poolPhoneActionCallWaiting struct { - pool sync.Pool -} - -func (p *poolPhoneActionCallWaiting) Get() *PhoneActionCallWaiting { - x, ok := p.pool.Get().(*PhoneActionCallWaiting) - if !ok { - x = &PhoneActionCallWaiting{} - } - - return x -} - -func (p *poolPhoneActionCallWaiting) Put(x *PhoneActionCallWaiting) { - if x == nil { - return - } - - x.Empty = false - - p.pool.Put(x) -} - -var PoolPhoneActionCallWaiting = poolPhoneActionCallWaiting{} - -func (x *PhoneActionCallWaiting) DeepCopy(z *PhoneActionCallWaiting) { - z.Empty = x.Empty -} - -func (x *PhoneActionCallWaiting) Clone() *PhoneActionCallWaiting { - z := &PhoneActionCallWaiting{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionCallWaiting) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionCallWaiting) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionCallWaiting) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionCallWaiting) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionCallWaiting) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionCallWaiting, x) -} - -const C_PhoneActionDiscarded int64 = 4285966731 - -type poolPhoneActionDiscarded struct { - pool sync.Pool -} - -func (p *poolPhoneActionDiscarded) Get() *PhoneActionDiscarded { - x, ok := p.pool.Get().(*PhoneActionDiscarded) - if !ok { - x = &PhoneActionDiscarded{} - } - - return x -} - -func (p *poolPhoneActionDiscarded) Put(x *PhoneActionDiscarded) { - if x == nil { - return - } - - x.Duration = 0 - x.Video = false - x.Reason = 0 - x.Terminate = false - - p.pool.Put(x) -} - -var PoolPhoneActionDiscarded = poolPhoneActionDiscarded{} - -func (x *PhoneActionDiscarded) DeepCopy(z *PhoneActionDiscarded) { - z.Duration = x.Duration - z.Video = x.Video - z.Reason = x.Reason - z.Terminate = x.Terminate -} - -func (x *PhoneActionDiscarded) Clone() *PhoneActionDiscarded { - z := &PhoneActionDiscarded{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionDiscarded) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionDiscarded) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionDiscarded) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionDiscarded) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionDiscarded) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionDiscarded, x) -} - -const C_PhoneActionIceExchange int64 = 1618781621 - -type poolPhoneActionIceExchange struct { - pool sync.Pool -} - -func (p *poolPhoneActionIceExchange) Get() *PhoneActionIceExchange { - x, ok := p.pool.Get().(*PhoneActionIceExchange) - if !ok { - x = &PhoneActionIceExchange{} - } - - return x -} - -func (p *poolPhoneActionIceExchange) Put(x *PhoneActionIceExchange) { - if x == nil { - return - } - - x.Candidate = "" - x.SdpMLineIndex = 0 - x.SdpMid = "" - x.UsernameFragment = "" - - p.pool.Put(x) -} - -var PoolPhoneActionIceExchange = poolPhoneActionIceExchange{} - -func (x *PhoneActionIceExchange) DeepCopy(z *PhoneActionIceExchange) { - z.Candidate = x.Candidate - z.SdpMLineIndex = x.SdpMLineIndex - z.SdpMid = x.SdpMid - z.UsernameFragment = x.UsernameFragment -} - -func (x *PhoneActionIceExchange) Clone() *PhoneActionIceExchange { - z := &PhoneActionIceExchange{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionIceExchange) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionIceExchange) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionIceExchange) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionIceExchange) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionIceExchange) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionIceExchange, x) -} - -const C_PhoneActionAck int64 = 1221076803 - -type poolPhoneActionAck struct { - pool sync.Pool -} - -func (p *poolPhoneActionAck) Get() *PhoneActionAck { - x, ok := p.pool.Get().(*PhoneActionAck) - if !ok { - x = &PhoneActionAck{} - } - - return x -} - -func (p *poolPhoneActionAck) Put(x *PhoneActionAck) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolPhoneActionAck = poolPhoneActionAck{} - -func (x *PhoneActionAck) DeepCopy(z *PhoneActionAck) { -} - -func (x *PhoneActionAck) Clone() *PhoneActionAck { - z := &PhoneActionAck{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionAck) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionAck) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionAck) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionAck) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionAck) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionAck, x) -} - -const C_PhoneActionParticipantAdded int64 = 2638615078 - -type poolPhoneActionParticipantAdded struct { - pool sync.Pool -} - -func (p *poolPhoneActionParticipantAdded) Get() *PhoneActionParticipantAdded { - x, ok := p.pool.Get().(*PhoneActionParticipantAdded) - if !ok { - x = &PhoneActionParticipantAdded{} - } - - return x -} - -func (p *poolPhoneActionParticipantAdded) Put(x *PhoneActionParticipantAdded) { - if x == nil { - return - } - - for _, z := range x.Participants { - PoolPhoneParticipant.Put(z) - } - x.Participants = x.Participants[:0] - - p.pool.Put(x) -} - -var PoolPhoneActionParticipantAdded = poolPhoneActionParticipantAdded{} - -func (x *PhoneActionParticipantAdded) DeepCopy(z *PhoneActionParticipantAdded) { - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolPhoneParticipant.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } -} - -func (x *PhoneActionParticipantAdded) Clone() *PhoneActionParticipantAdded { - z := &PhoneActionParticipantAdded{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionParticipantAdded) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionParticipantAdded) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionParticipantAdded) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionParticipantAdded) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionParticipantAdded) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionParticipantAdded, x) -} - -const C_PhoneActionParticipantRemoved int64 = 3280922507 - -type poolPhoneActionParticipantRemoved struct { - pool sync.Pool -} - -func (p *poolPhoneActionParticipantRemoved) Get() *PhoneActionParticipantRemoved { - x, ok := p.pool.Get().(*PhoneActionParticipantRemoved) - if !ok { - x = &PhoneActionParticipantRemoved{} - } - - return x -} - -func (p *poolPhoneActionParticipantRemoved) Put(x *PhoneActionParticipantRemoved) { - if x == nil { - return - } - - x.UserIDs = x.UserIDs[:0] - x.Timeout = false - - p.pool.Put(x) -} - -var PoolPhoneActionParticipantRemoved = poolPhoneActionParticipantRemoved{} - -func (x *PhoneActionParticipantRemoved) DeepCopy(z *PhoneActionParticipantRemoved) { - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) - z.Timeout = x.Timeout -} - -func (x *PhoneActionParticipantRemoved) Clone() *PhoneActionParticipantRemoved { - z := &PhoneActionParticipantRemoved{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionParticipantRemoved) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionParticipantRemoved) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionParticipantRemoved) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionParticipantRemoved) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionParticipantRemoved) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionParticipantRemoved, x) -} - -const C_PhoneActionJoinRequested int64 = 656125601 - -type poolPhoneActionJoinRequested struct { - pool sync.Pool -} - -func (p *poolPhoneActionJoinRequested) Get() *PhoneActionJoinRequested { - x, ok := p.pool.Get().(*PhoneActionJoinRequested) - if !ok { - x = &PhoneActionJoinRequested{} - } - - return x -} - -func (p *poolPhoneActionJoinRequested) Put(x *PhoneActionJoinRequested) { - if x == nil { - return - } - - x.UserIDs = x.UserIDs[:0] - - p.pool.Put(x) -} - -var PoolPhoneActionJoinRequested = poolPhoneActionJoinRequested{} - -func (x *PhoneActionJoinRequested) DeepCopy(z *PhoneActionJoinRequested) { - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) -} - -func (x *PhoneActionJoinRequested) Clone() *PhoneActionJoinRequested { - z := &PhoneActionJoinRequested{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionJoinRequested) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionJoinRequested) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionJoinRequested) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionJoinRequested) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionJoinRequested) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionJoinRequested, x) -} - -const C_PhoneActionAdminUpdated int64 = 1804765545 - -type poolPhoneActionAdminUpdated struct { - pool sync.Pool -} - -func (p *poolPhoneActionAdminUpdated) Get() *PhoneActionAdminUpdated { - x, ok := p.pool.Get().(*PhoneActionAdminUpdated) - if !ok { - x = &PhoneActionAdminUpdated{} - } - - return x -} - -func (p *poolPhoneActionAdminUpdated) Put(x *PhoneActionAdminUpdated) { - if x == nil { - return - } - - x.UserID = 0 - x.Admin = false - - p.pool.Put(x) -} - -var PoolPhoneActionAdminUpdated = poolPhoneActionAdminUpdated{} - -func (x *PhoneActionAdminUpdated) DeepCopy(z *PhoneActionAdminUpdated) { - z.UserID = x.UserID - z.Admin = x.Admin -} - -func (x *PhoneActionAdminUpdated) Clone() *PhoneActionAdminUpdated { - z := &PhoneActionAdminUpdated{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionAdminUpdated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionAdminUpdated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionAdminUpdated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionAdminUpdated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionAdminUpdated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionAdminUpdated, x) -} - -const C_PhoneActionScreenShare int64 = 813039088 - -type poolPhoneActionScreenShare struct { - pool sync.Pool -} - -func (p *poolPhoneActionScreenShare) Get() *PhoneActionScreenShare { - x, ok := p.pool.Get().(*PhoneActionScreenShare) - if !ok { - x = &PhoneActionScreenShare{} - } - - return x -} - -func (p *poolPhoneActionScreenShare) Put(x *PhoneActionScreenShare) { - if x == nil { - return - } - - x.Enable = false - x.TrackIDs = x.TrackIDs[:0] - - p.pool.Put(x) -} - -var PoolPhoneActionScreenShare = poolPhoneActionScreenShare{} - -func (x *PhoneActionScreenShare) DeepCopy(z *PhoneActionScreenShare) { - z.Enable = x.Enable - z.TrackIDs = append(z.TrackIDs[:0], x.TrackIDs...) -} - -func (x *PhoneActionScreenShare) Clone() *PhoneActionScreenShare { - z := &PhoneActionScreenShare{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionScreenShare) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionScreenShare) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionScreenShare) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionScreenShare) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionScreenShare) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionScreenShare, x) -} - -const C_PhoneActionPicked int64 = 2478763318 - -type poolPhoneActionPicked struct { - pool sync.Pool -} - -func (p *poolPhoneActionPicked) Get() *PhoneActionPicked { - x, ok := p.pool.Get().(*PhoneActionPicked) - if !ok { - x = &PhoneActionPicked{} - } - - return x -} - -func (p *poolPhoneActionPicked) Put(x *PhoneActionPicked) { - if x == nil { - return - } - - x.AuthID = 0 - - p.pool.Put(x) -} - -var PoolPhoneActionPicked = poolPhoneActionPicked{} - -func (x *PhoneActionPicked) DeepCopy(z *PhoneActionPicked) { - z.AuthID = x.AuthID -} - -func (x *PhoneActionPicked) Clone() *PhoneActionPicked { - z := &PhoneActionPicked{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionPicked) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionPicked) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionPicked) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionPicked) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionPicked) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionPicked, x) -} - -const C_PhoneActionRestarted int64 = 1979061868 - -type poolPhoneActionRestarted struct { - pool sync.Pool -} - -func (p *poolPhoneActionRestarted) Get() *PhoneActionRestarted { - x, ok := p.pool.Get().(*PhoneActionRestarted) - if !ok { - x = &PhoneActionRestarted{} - } - - return x -} - -func (p *poolPhoneActionRestarted) Put(x *PhoneActionRestarted) { - if x == nil { - return - } - - x.Sender = false - - p.pool.Put(x) -} - -var PoolPhoneActionRestarted = poolPhoneActionRestarted{} - -func (x *PhoneActionRestarted) DeepCopy(z *PhoneActionRestarted) { - z.Sender = x.Sender -} - -func (x *PhoneActionRestarted) Clone() *PhoneActionRestarted { - z := &PhoneActionRestarted{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionRestarted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionRestarted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionRestarted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionRestarted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionRestarted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionRestarted, x) -} - -const C_PhoneActionMediaSettingsUpdated int64 = 2310335221 - -type poolPhoneActionMediaSettingsUpdated struct { - pool sync.Pool -} - -func (p *poolPhoneActionMediaSettingsUpdated) Get() *PhoneActionMediaSettingsUpdated { - x, ok := p.pool.Get().(*PhoneActionMediaSettingsUpdated) - if !ok { - x = &PhoneActionMediaSettingsUpdated{} - } - - return x -} - -func (p *poolPhoneActionMediaSettingsUpdated) Put(x *PhoneActionMediaSettingsUpdated) { - if x == nil { - return - } - - x.Video = false - x.Audio = false - x.ScreenShare = false - - p.pool.Put(x) -} - -var PoolPhoneActionMediaSettingsUpdated = poolPhoneActionMediaSettingsUpdated{} - -func (x *PhoneActionMediaSettingsUpdated) DeepCopy(z *PhoneActionMediaSettingsUpdated) { - z.Video = x.Video - z.Audio = x.Audio - z.ScreenShare = x.ScreenShare -} - -func (x *PhoneActionMediaSettingsUpdated) Clone() *PhoneActionMediaSettingsUpdated { - z := &PhoneActionMediaSettingsUpdated{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionMediaSettingsUpdated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionMediaSettingsUpdated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionMediaSettingsUpdated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionMediaSettingsUpdated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionMediaSettingsUpdated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionMediaSettingsUpdated, x) -} - -const C_PhoneActionReactionSet int64 = 2047679815 - -type poolPhoneActionReactionSet struct { - pool sync.Pool -} - -func (p *poolPhoneActionReactionSet) Get() *PhoneActionReactionSet { - x, ok := p.pool.Get().(*PhoneActionReactionSet) - if !ok { - x = &PhoneActionReactionSet{} - } - - return x -} - -func (p *poolPhoneActionReactionSet) Put(x *PhoneActionReactionSet) { - if x == nil { - return - } - - x.Reaction = "" - - p.pool.Put(x) -} - -var PoolPhoneActionReactionSet = poolPhoneActionReactionSet{} - -func (x *PhoneActionReactionSet) DeepCopy(z *PhoneActionReactionSet) { - z.Reaction = x.Reaction -} - -func (x *PhoneActionReactionSet) Clone() *PhoneActionReactionSet { - z := &PhoneActionReactionSet{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionReactionSet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionReactionSet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionReactionSet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionReactionSet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionReactionSet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionReactionSet, x) -} - -const C_PhoneActionSDPOffer int64 = 931453435 - -type poolPhoneActionSDPOffer struct { - pool sync.Pool -} - -func (p *poolPhoneActionSDPOffer) Get() *PhoneActionSDPOffer { - x, ok := p.pool.Get().(*PhoneActionSDPOffer) - if !ok { - x = &PhoneActionSDPOffer{} - } - - return x -} - -func (p *poolPhoneActionSDPOffer) Put(x *PhoneActionSDPOffer) { - if x == nil { - return - } - - x.SDP = "" - x.Type = "" - - p.pool.Put(x) -} - -var PoolPhoneActionSDPOffer = poolPhoneActionSDPOffer{} - -func (x *PhoneActionSDPOffer) DeepCopy(z *PhoneActionSDPOffer) { - z.SDP = x.SDP - z.Type = x.Type -} - -func (x *PhoneActionSDPOffer) Clone() *PhoneActionSDPOffer { - z := &PhoneActionSDPOffer{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionSDPOffer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionSDPOffer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionSDPOffer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionSDPOffer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionSDPOffer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionSDPOffer, x) -} - -const C_PhoneActionSDPAnswer int64 = 835530308 - -type poolPhoneActionSDPAnswer struct { - pool sync.Pool -} - -func (p *poolPhoneActionSDPAnswer) Get() *PhoneActionSDPAnswer { - x, ok := p.pool.Get().(*PhoneActionSDPAnswer) - if !ok { - x = &PhoneActionSDPAnswer{} - } - - return x -} - -func (p *poolPhoneActionSDPAnswer) Put(x *PhoneActionSDPAnswer) { - if x == nil { - return - } - - x.SDP = "" - x.Type = "" - - p.pool.Put(x) -} - -var PoolPhoneActionSDPAnswer = poolPhoneActionSDPAnswer{} - -func (x *PhoneActionSDPAnswer) DeepCopy(z *PhoneActionSDPAnswer) { - z.SDP = x.SDP - z.Type = x.Type -} - -func (x *PhoneActionSDPAnswer) Clone() *PhoneActionSDPAnswer { - z := &PhoneActionSDPAnswer{} - x.DeepCopy(z) - return z -} - -func (x *PhoneActionSDPAnswer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneActionSDPAnswer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneActionSDPAnswer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneActionSDPAnswer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneActionSDPAnswer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneActionSDPAnswer, x) -} - -func init() { - registry.RegisterConstructor(2975617068, "PhoneInitCall") - registry.RegisterConstructor(907942641, "PhoneRequestCall") - registry.RegisterConstructor(4133092858, "PhoneAcceptCall") - registry.RegisterConstructor(2712700137, "PhoneDiscardCall") - registry.RegisterConstructor(432049159, "PhoneGetCall") - registry.RegisterConstructor(3019166552, "PhoneJoinCall") - registry.RegisterConstructor(2867411100, "PhoneAddParticipant") - registry.RegisterConstructor(188662172, "PhoneRemoveParticipant") - registry.RegisterConstructor(3924781570, "PhoneGetParticipants") - registry.RegisterConstructor(1976202226, "PhoneUpdateCall") - registry.RegisterConstructor(2215486159, "PhoneRateCall") - registry.RegisterConstructor(407776572, "PhoneGetHistory") - registry.RegisterConstructor(2528259211, "PhoneDeleteHistory") - registry.RegisterConstructor(4147150312, "PhoneCallRecord") - registry.RegisterConstructor(1227520020, "PhoneCallsMany") - registry.RegisterConstructor(442877873, "PhoneUpdateAdmin") - registry.RegisterConstructor(3296664529, "PhoneCall") - registry.RegisterConstructor(3464876187, "PhoneInit") - registry.RegisterConstructor(2567653219, "PhoneParticipants") - registry.RegisterConstructor(4291892363, "IceServer") - registry.RegisterConstructor(226273622, "PhoneParticipant") - registry.RegisterConstructor(545454774, "PhoneParticipantSDP") - registry.RegisterConstructor(1073285997, "PhoneActionCallEmpty") - registry.RegisterConstructor(2493210645, "PhoneActionAccepted") - registry.RegisterConstructor(1678316869, "PhoneActionRequested") - registry.RegisterConstructor(3634710697, "PhoneActionCallWaiting") - registry.RegisterConstructor(4285966731, "PhoneActionDiscarded") - registry.RegisterConstructor(1618781621, "PhoneActionIceExchange") - registry.RegisterConstructor(1221076803, "PhoneActionAck") - registry.RegisterConstructor(2638615078, "PhoneActionParticipantAdded") - registry.RegisterConstructor(3280922507, "PhoneActionParticipantRemoved") - registry.RegisterConstructor(656125601, "PhoneActionJoinRequested") - registry.RegisterConstructor(1804765545, "PhoneActionAdminUpdated") - registry.RegisterConstructor(813039088, "PhoneActionScreenShare") - registry.RegisterConstructor(2478763318, "PhoneActionPicked") - registry.RegisterConstructor(1979061868, "PhoneActionRestarted") - registry.RegisterConstructor(2310335221, "PhoneActionMediaSettingsUpdated") - registry.RegisterConstructor(2047679815, "PhoneActionReactionSet") - registry.RegisterConstructor(931453435, "PhoneActionSDPOffer") - registry.RegisterConstructor(835530308, "PhoneActionSDPAnswer") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.wallpaper.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.wallpaper.pb.go deleted file mode 100644 index 14a6b230..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.wallpaper.pb.go +++ /dev/null @@ -1,877 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: chat.wallpaper.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// WallPaperGetAll -// @Function -// @Return: WallPapersMany -type WallPaperGet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Crc32Hash uint32 `protobuf:"varint,2,opt,name=Crc32Hash,proto3" json:"Crc32Hash,omitempty"` -} - -func (x *WallPaperGet) Reset() { - *x = WallPaperGet{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_wallpaper_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WallPaperGet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WallPaperGet) ProtoMessage() {} - -func (x *WallPaperGet) ProtoReflect() protoreflect.Message { - mi := &file_chat_wallpaper_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WallPaperGet.ProtoReflect.Descriptor instead. -func (*WallPaperGet) Descriptor() ([]byte, []int) { - return file_chat_wallpaper_proto_rawDescGZIP(), []int{0} -} - -func (x *WallPaperGet) GetCrc32Hash() uint32 { - if x != nil { - return x.Crc32Hash - } - return 0 -} - -// WallPaperSave -// @Function -// @Return: Bool -type WallPaperSave struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WallPaper *InputWallPaper `protobuf:"bytes,1,opt,name=WallPaper,proto3" json:"WallPaper,omitempty"` - Settings *WallPaperSettings `protobuf:"bytes,2,opt,name=Settings,proto3" json:"Settings,omitempty"` -} - -func (x *WallPaperSave) Reset() { - *x = WallPaperSave{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_wallpaper_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WallPaperSave) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WallPaperSave) ProtoMessage() {} - -func (x *WallPaperSave) ProtoReflect() protoreflect.Message { - mi := &file_chat_wallpaper_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WallPaperSave.ProtoReflect.Descriptor instead. -func (*WallPaperSave) Descriptor() ([]byte, []int) { - return file_chat_wallpaper_proto_rawDescGZIP(), []int{1} -} - -func (x *WallPaperSave) GetWallPaper() *InputWallPaper { - if x != nil { - return x.WallPaper - } - return nil -} - -func (x *WallPaperSave) GetSettings() *WallPaperSettings { - if x != nil { - return x.Settings - } - return nil -} - -// WallPaperDelete -// @Function -// @Return: Bool -type WallPaperDelete struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WallPaper *InputWallPaper `protobuf:"bytes,1,opt,name=WallPaper,proto3" json:"WallPaper,omitempty"` -} - -func (x *WallPaperDelete) Reset() { - *x = WallPaperDelete{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_wallpaper_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WallPaperDelete) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WallPaperDelete) ProtoMessage() {} - -func (x *WallPaperDelete) ProtoReflect() protoreflect.Message { - mi := &file_chat_wallpaper_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WallPaperDelete.ProtoReflect.Descriptor instead. -func (*WallPaperDelete) Descriptor() ([]byte, []int) { - return file_chat_wallpaper_proto_rawDescGZIP(), []int{2} -} - -func (x *WallPaperDelete) GetWallPaper() *InputWallPaper { - if x != nil { - return x.WallPaper - } - return nil -} - -// WallPaperUpload -// @Function -// @Return: WallPaper -type WallPaperUpload struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UploadedFile *InputFile `protobuf:"bytes,1,opt,name=UploadedFile,proto3" json:"UploadedFile,omitempty"` - File *InputDocument `protobuf:"bytes,2,opt,name=File,proto3" json:"File,omitempty"` - MimeType string `protobuf:"bytes,3,opt,name=MimeType,proto3" json:"MimeType,omitempty"` - Settings *WallPaperSettings `protobuf:"bytes,4,opt,name=Settings,proto3" json:"Settings,omitempty"` -} - -func (x *WallPaperUpload) Reset() { - *x = WallPaperUpload{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_wallpaper_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WallPaperUpload) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WallPaperUpload) ProtoMessage() {} - -func (x *WallPaperUpload) ProtoReflect() protoreflect.Message { - mi := &file_chat_wallpaper_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WallPaperUpload.ProtoReflect.Descriptor instead. -func (*WallPaperUpload) Descriptor() ([]byte, []int) { - return file_chat_wallpaper_proto_rawDescGZIP(), []int{3} -} - -func (x *WallPaperUpload) GetUploadedFile() *InputFile { - if x != nil { - return x.UploadedFile - } - return nil -} - -func (x *WallPaperUpload) GetFile() *InputDocument { - if x != nil { - return x.File - } - return nil -} - -func (x *WallPaperUpload) GetMimeType() string { - if x != nil { - return x.MimeType - } - return "" -} - -func (x *WallPaperUpload) GetSettings() *WallPaperSettings { - if x != nil { - return x.Settings - } - return nil -} - -// WallPaperReset -// @Function -// @Return: Bool -type WallPaperReset struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *WallPaperReset) Reset() { - *x = WallPaperReset{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_wallpaper_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WallPaperReset) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WallPaperReset) ProtoMessage() {} - -func (x *WallPaperReset) ProtoReflect() protoreflect.Message { - mi := &file_chat_wallpaper_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WallPaperReset.ProtoReflect.Descriptor instead. -func (*WallPaperReset) Descriptor() ([]byte, []int) { - return file_chat_wallpaper_proto_rawDescGZIP(), []int{4} -} - -// InputWallPaper -type InputWallPaper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,2,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` -} - -func (x *InputWallPaper) Reset() { - *x = InputWallPaper{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_wallpaper_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputWallPaper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputWallPaper) ProtoMessage() {} - -func (x *InputWallPaper) ProtoReflect() protoreflect.Message { - mi := &file_chat_wallpaper_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputWallPaper.ProtoReflect.Descriptor instead. -func (*InputWallPaper) Descriptor() ([]byte, []int) { - return file_chat_wallpaper_proto_rawDescGZIP(), []int{5} -} - -func (x *InputWallPaper) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *InputWallPaper) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -// WallPaperSettings -type WallPaperSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Blur bool `protobuf:"varint,1,opt,name=Blur,proto3" json:"Blur,omitempty"` - Motion bool `protobuf:"varint,2,opt,name=Motion,proto3" json:"Motion,omitempty"` - BackgroundColour int64 `protobuf:"varint,3,opt,name=BackgroundColour,proto3" json:"BackgroundColour,omitempty"` - BackgroundSecondColour int64 `protobuf:"varint,4,opt,name=BackgroundSecondColour,proto3" json:"BackgroundSecondColour,omitempty"` - Opacity int64 `protobuf:"varint,5,opt,name=Opacity,proto3" json:"Opacity,omitempty"` - Rotation int64 `protobuf:"varint,6,opt,name=Rotation,proto3" json:"Rotation,omitempty"` -} - -func (x *WallPaperSettings) Reset() { - *x = WallPaperSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_wallpaper_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WallPaperSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WallPaperSettings) ProtoMessage() {} - -func (x *WallPaperSettings) ProtoReflect() protoreflect.Message { - mi := &file_chat_wallpaper_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WallPaperSettings.ProtoReflect.Descriptor instead. -func (*WallPaperSettings) Descriptor() ([]byte, []int) { - return file_chat_wallpaper_proto_rawDescGZIP(), []int{6} -} - -func (x *WallPaperSettings) GetBlur() bool { - if x != nil { - return x.Blur - } - return false -} - -func (x *WallPaperSettings) GetMotion() bool { - if x != nil { - return x.Motion - } - return false -} - -func (x *WallPaperSettings) GetBackgroundColour() int64 { - if x != nil { - return x.BackgroundColour - } - return 0 -} - -func (x *WallPaperSettings) GetBackgroundSecondColour() int64 { - if x != nil { - return x.BackgroundSecondColour - } - return 0 -} - -func (x *WallPaperSettings) GetOpacity() int64 { - if x != nil { - return x.Opacity - } - return 0 -} - -func (x *WallPaperSettings) GetRotation() int64 { - if x != nil { - return x.Rotation - } - return 0 -} - -// WallPaper -type WallPaper struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,2,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Creator bool `protobuf:"varint,3,opt,name=Creator,proto3" json:"Creator,omitempty"` - Default bool `protobuf:"varint,4,opt,name=Default,proto3" json:"Default,omitempty"` - Pattern bool `protobuf:"varint,5,opt,name=Pattern,proto3" json:"Pattern,omitempty"` - Dark bool `protobuf:"varint,6,opt,name=Dark,proto3" json:"Dark,omitempty"` - Document *Document `protobuf:"bytes,7,opt,name=Document,proto3" json:"Document,omitempty"` - Settings *WallPaperSettings `protobuf:"bytes,8,opt,name=Settings,proto3" json:"Settings,omitempty"` -} - -func (x *WallPaper) Reset() { - *x = WallPaper{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_wallpaper_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WallPaper) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WallPaper) ProtoMessage() {} - -func (x *WallPaper) ProtoReflect() protoreflect.Message { - mi := &file_chat_wallpaper_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WallPaper.ProtoReflect.Descriptor instead. -func (*WallPaper) Descriptor() ([]byte, []int) { - return file_chat_wallpaper_proto_rawDescGZIP(), []int{7} -} - -func (x *WallPaper) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *WallPaper) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *WallPaper) GetCreator() bool { - if x != nil { - return x.Creator - } - return false -} - -func (x *WallPaper) GetDefault() bool { - if x != nil { - return x.Default - } - return false -} - -func (x *WallPaper) GetPattern() bool { - if x != nil { - return x.Pattern - } - return false -} - -func (x *WallPaper) GetDark() bool { - if x != nil { - return x.Dark - } - return false -} - -func (x *WallPaper) GetDocument() *Document { - if x != nil { - return x.Document - } - return nil -} - -func (x *WallPaper) GetSettings() *WallPaperSettings { - if x != nil { - return x.Settings - } - return nil -} - -// WallPapersMany -type WallPapersMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WallPapers []*WallPaper `protobuf:"bytes,1,rep,name=WallPapers,proto3" json:"WallPapers,omitempty"` - Count int32 `protobuf:"varint,2,opt,name=Count,proto3" json:"Count,omitempty"` - Crc32Hash uint32 `protobuf:"varint,3,opt,name=Crc32Hash,proto3" json:"Crc32Hash,omitempty"` - Empty bool `protobuf:"varint,5,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *WallPapersMany) Reset() { - *x = WallPapersMany{} - if protoimpl.UnsafeEnabled { - mi := &file_chat_wallpaper_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WallPapersMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WallPapersMany) ProtoMessage() {} - -func (x *WallPapersMany) ProtoReflect() protoreflect.Message { - mi := &file_chat_wallpaper_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WallPapersMany.ProtoReflect.Descriptor instead. -func (*WallPapersMany) Descriptor() ([]byte, []int) { - return file_chat_wallpaper_proto_rawDescGZIP(), []int{8} -} - -func (x *WallPapersMany) GetWallPapers() []*WallPaper { - if x != nil { - return x.WallPapers - } - return nil -} - -func (x *WallPapersMany) GetCount() int32 { - if x != nil { - return x.Count - } - return 0 -} - -func (x *WallPapersMany) GetCrc32Hash() uint32 { - if x != nil { - return x.Crc32Hash - } - return 0 -} - -func (x *WallPapersMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -var File_chat_wallpaper_proto protoreflect.FileDescriptor - -var file_chat_wallpaper_proto_rawDesc = []byte{ - 0x0a, 0x14, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x70, 0x61, 0x70, 0x65, 0x72, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x63, - 0x68, 0x61, 0x74, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x6d, 0x65, 0x64, - 0x69, 0x61, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x0c, 0x57, 0x61, 0x6c, - 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x63, - 0x33, 0x32, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x43, 0x72, - 0x63, 0x33, 0x32, 0x48, 0x61, 0x73, 0x68, 0x22, 0x76, 0x0a, 0x0d, 0x57, 0x61, 0x6c, 0x6c, 0x50, - 0x61, 0x70, 0x65, 0x72, 0x53, 0x61, 0x76, 0x65, 0x12, 0x31, 0x0a, 0x09, 0x57, 0x61, 0x6c, 0x6c, - 0x50, 0x61, 0x70, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, - 0x52, 0x09, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x08, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, - 0x44, 0x0a, 0x0f, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x12, 0x31, 0x0a, 0x09, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x52, 0x09, 0x57, 0x61, 0x6c, 0x6c, - 0x50, 0x61, 0x70, 0x65, 0x72, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, - 0x70, 0x65, 0x72, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x32, 0x0a, 0x0c, 0x55, 0x70, 0x6c, - 0x6f, 0x61, 0x64, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, - 0x0c, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x26, 0x0a, - 0x04, 0x46, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x32, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, - 0x70, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, - 0x65, 0x72, 0x52, 0x65, 0x73, 0x65, 0x74, 0x22, 0x40, 0x0a, 0x0e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0a, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x22, 0xd9, 0x01, 0x0a, 0x11, 0x57, 0x61, - 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, - 0x12, 0x0a, 0x04, 0x42, 0x6c, 0x75, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x42, - 0x6c, 0x75, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x4d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x06, 0x4d, 0x6f, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x10, 0x42, - 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x75, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x42, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, - 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x75, 0x72, 0x12, 0x36, 0x0a, 0x16, 0x42, 0x61, 0x63, 0x6b, 0x67, - 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x75, - 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, 0x42, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, - 0x75, 0x6e, 0x64, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x75, 0x72, 0x12, - 0x18, 0x0a, 0x07, 0x4f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x07, 0x4f, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x6f, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xfc, 0x01, 0x0a, 0x09, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, - 0x70, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x02, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, - 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, - 0x61, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x18, 0x0a, - 0x07, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x72, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x04, 0x44, 0x61, 0x72, 0x6b, 0x12, 0x29, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, - 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x32, 0x0a, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, - 0x65, 0x72, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x22, 0x8a, 0x01, 0x0a, 0x0e, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, - 0x65, 0x72, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x2e, 0x0a, 0x0a, 0x57, 0x61, 0x6c, 0x6c, 0x50, - 0x61, 0x70, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x57, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x52, 0x0a, 0x57, 0x61, 0x6c, - 0x6c, 0x50, 0x61, 0x70, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, - 0x09, 0x43, 0x72, 0x63, 0x33, 0x32, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x09, 0x43, 0x72, 0x63, 0x33, 0x32, 0x48, 0x61, 0x73, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_chat_wallpaper_proto_rawDescOnce sync.Once - file_chat_wallpaper_proto_rawDescData = file_chat_wallpaper_proto_rawDesc -) - -func file_chat_wallpaper_proto_rawDescGZIP() []byte { - file_chat_wallpaper_proto_rawDescOnce.Do(func() { - file_chat_wallpaper_proto_rawDescData = protoimpl.X.CompressGZIP(file_chat_wallpaper_proto_rawDescData) - }) - return file_chat_wallpaper_proto_rawDescData -} - -var file_chat_wallpaper_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_chat_wallpaper_proto_goTypes = []interface{}{ - (*WallPaperGet)(nil), // 0: msg.WallPaperGet - (*WallPaperSave)(nil), // 1: msg.WallPaperSave - (*WallPaperDelete)(nil), // 2: msg.WallPaperDelete - (*WallPaperUpload)(nil), // 3: msg.WallPaperUpload - (*WallPaperReset)(nil), // 4: msg.WallPaperReset - (*InputWallPaper)(nil), // 5: msg.InputWallPaper - (*WallPaperSettings)(nil), // 6: msg.WallPaperSettings - (*WallPaper)(nil), // 7: msg.WallPaper - (*WallPapersMany)(nil), // 8: msg.WallPapersMany - (*InputFile)(nil), // 9: msg.InputFile - (*InputDocument)(nil), // 10: msg.InputDocument - (*Document)(nil), // 11: msg.Document -} -var file_chat_wallpaper_proto_depIdxs = []int32{ - 5, // 0: msg.WallPaperSave.WallPaper:type_name -> msg.InputWallPaper - 6, // 1: msg.WallPaperSave.Settings:type_name -> msg.WallPaperSettings - 5, // 2: msg.WallPaperDelete.WallPaper:type_name -> msg.InputWallPaper - 9, // 3: msg.WallPaperUpload.UploadedFile:type_name -> msg.InputFile - 10, // 4: msg.WallPaperUpload.File:type_name -> msg.InputDocument - 6, // 5: msg.WallPaperUpload.Settings:type_name -> msg.WallPaperSettings - 11, // 6: msg.WallPaper.Document:type_name -> msg.Document - 6, // 7: msg.WallPaper.Settings:type_name -> msg.WallPaperSettings - 7, // 8: msg.WallPapersMany.WallPapers:type_name -> msg.WallPaper - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_chat_wallpaper_proto_init() } -func file_chat_wallpaper_proto_init() { - if File_chat_wallpaper_proto != nil { - return - } - file_core_types_proto_init() - file_chat_messages_medias_proto_init() - if !protoimpl.UnsafeEnabled { - file_chat_wallpaper_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WallPaperGet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_wallpaper_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WallPaperSave); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_wallpaper_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WallPaperDelete); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_wallpaper_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WallPaperUpload); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_wallpaper_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WallPaperReset); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_wallpaper_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputWallPaper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_wallpaper_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WallPaperSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_wallpaper_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WallPaper); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_chat_wallpaper_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WallPapersMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_chat_wallpaper_proto_rawDesc, - NumEnums: 0, - NumMessages: 9, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_chat_wallpaper_proto_goTypes, - DependencyIndexes: file_chat_wallpaper_proto_depIdxs, - MessageInfos: file_chat_wallpaper_proto_msgTypes, - }.Build() - File_chat_wallpaper_proto = out.File - file_chat_wallpaper_proto_rawDesc = nil - file_chat_wallpaper_proto_goTypes = nil - file_chat_wallpaper_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.wallpaper.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/chat.wallpaper.rony.go deleted file mode 100644 index 5f5704b7..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/chat.wallpaper.rony.go +++ /dev/null @@ -1,672 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: chat.wallpaper.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_WallPaperGet int64 = 183906980 - -type poolWallPaperGet struct { - pool sync.Pool -} - -func (p *poolWallPaperGet) Get() *WallPaperGet { - x, ok := p.pool.Get().(*WallPaperGet) - if !ok { - x = &WallPaperGet{} - } - - return x -} - -func (p *poolWallPaperGet) Put(x *WallPaperGet) { - if x == nil { - return - } - - x.Crc32Hash = 0 - - p.pool.Put(x) -} - -var PoolWallPaperGet = poolWallPaperGet{} - -func (x *WallPaperGet) DeepCopy(z *WallPaperGet) { - z.Crc32Hash = x.Crc32Hash -} - -func (x *WallPaperGet) Clone() *WallPaperGet { - z := &WallPaperGet{} - x.DeepCopy(z) - return z -} - -func (x *WallPaperGet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WallPaperGet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WallPaperGet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WallPaperGet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WallPaperGet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WallPaperGet, x) -} - -const C_WallPaperSave int64 = 3559907599 - -type poolWallPaperSave struct { - pool sync.Pool -} - -func (p *poolWallPaperSave) Get() *WallPaperSave { - x, ok := p.pool.Get().(*WallPaperSave) - if !ok { - x = &WallPaperSave{} - } - - x.WallPaper = PoolInputWallPaper.Get() - - x.Settings = PoolWallPaperSettings.Get() - - return x -} - -func (p *poolWallPaperSave) Put(x *WallPaperSave) { - if x == nil { - return - } - - PoolInputWallPaper.Put(x.WallPaper) - PoolWallPaperSettings.Put(x.Settings) - - p.pool.Put(x) -} - -var PoolWallPaperSave = poolWallPaperSave{} - -func (x *WallPaperSave) DeepCopy(z *WallPaperSave) { - if x.WallPaper != nil { - if z.WallPaper == nil { - z.WallPaper = PoolInputWallPaper.Get() - } - x.WallPaper.DeepCopy(z.WallPaper) - } else { - PoolInputWallPaper.Put(z.WallPaper) - z.WallPaper = nil - } - if x.Settings != nil { - if z.Settings == nil { - z.Settings = PoolWallPaperSettings.Get() - } - x.Settings.DeepCopy(z.Settings) - } else { - PoolWallPaperSettings.Put(z.Settings) - z.Settings = nil - } -} - -func (x *WallPaperSave) Clone() *WallPaperSave { - z := &WallPaperSave{} - x.DeepCopy(z) - return z -} - -func (x *WallPaperSave) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WallPaperSave) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WallPaperSave) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WallPaperSave) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WallPaperSave) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WallPaperSave, x) -} - -const C_WallPaperDelete int64 = 3006268108 - -type poolWallPaperDelete struct { - pool sync.Pool -} - -func (p *poolWallPaperDelete) Get() *WallPaperDelete { - x, ok := p.pool.Get().(*WallPaperDelete) - if !ok { - x = &WallPaperDelete{} - } - - x.WallPaper = PoolInputWallPaper.Get() - - return x -} - -func (p *poolWallPaperDelete) Put(x *WallPaperDelete) { - if x == nil { - return - } - - PoolInputWallPaper.Put(x.WallPaper) - - p.pool.Put(x) -} - -var PoolWallPaperDelete = poolWallPaperDelete{} - -func (x *WallPaperDelete) DeepCopy(z *WallPaperDelete) { - if x.WallPaper != nil { - if z.WallPaper == nil { - z.WallPaper = PoolInputWallPaper.Get() - } - x.WallPaper.DeepCopy(z.WallPaper) - } else { - PoolInputWallPaper.Put(z.WallPaper) - z.WallPaper = nil - } -} - -func (x *WallPaperDelete) Clone() *WallPaperDelete { - z := &WallPaperDelete{} - x.DeepCopy(z) - return z -} - -func (x *WallPaperDelete) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WallPaperDelete) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WallPaperDelete) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WallPaperDelete) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WallPaperDelete) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WallPaperDelete, x) -} - -const C_WallPaperUpload int64 = 2661259348 - -type poolWallPaperUpload struct { - pool sync.Pool -} - -func (p *poolWallPaperUpload) Get() *WallPaperUpload { - x, ok := p.pool.Get().(*WallPaperUpload) - if !ok { - x = &WallPaperUpload{} - } - - x.UploadedFile = PoolInputFile.Get() - - x.File = PoolInputDocument.Get() - - x.Settings = PoolWallPaperSettings.Get() - - return x -} - -func (p *poolWallPaperUpload) Put(x *WallPaperUpload) { - if x == nil { - return - } - - PoolInputFile.Put(x.UploadedFile) - PoolInputDocument.Put(x.File) - x.MimeType = "" - PoolWallPaperSettings.Put(x.Settings) - - p.pool.Put(x) -} - -var PoolWallPaperUpload = poolWallPaperUpload{} - -func (x *WallPaperUpload) DeepCopy(z *WallPaperUpload) { - if x.UploadedFile != nil { - if z.UploadedFile == nil { - z.UploadedFile = PoolInputFile.Get() - } - x.UploadedFile.DeepCopy(z.UploadedFile) - } else { - PoolInputFile.Put(z.UploadedFile) - z.UploadedFile = nil - } - if x.File != nil { - if z.File == nil { - z.File = PoolInputDocument.Get() - } - x.File.DeepCopy(z.File) - } else { - PoolInputDocument.Put(z.File) - z.File = nil - } - z.MimeType = x.MimeType - if x.Settings != nil { - if z.Settings == nil { - z.Settings = PoolWallPaperSettings.Get() - } - x.Settings.DeepCopy(z.Settings) - } else { - PoolWallPaperSettings.Put(z.Settings) - z.Settings = nil - } -} - -func (x *WallPaperUpload) Clone() *WallPaperUpload { - z := &WallPaperUpload{} - x.DeepCopy(z) - return z -} - -func (x *WallPaperUpload) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WallPaperUpload) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WallPaperUpload) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WallPaperUpload) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WallPaperUpload) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WallPaperUpload, x) -} - -const C_WallPaperReset int64 = 2714244308 - -type poolWallPaperReset struct { - pool sync.Pool -} - -func (p *poolWallPaperReset) Get() *WallPaperReset { - x, ok := p.pool.Get().(*WallPaperReset) - if !ok { - x = &WallPaperReset{} - } - - return x -} - -func (p *poolWallPaperReset) Put(x *WallPaperReset) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolWallPaperReset = poolWallPaperReset{} - -func (x *WallPaperReset) DeepCopy(z *WallPaperReset) { -} - -func (x *WallPaperReset) Clone() *WallPaperReset { - z := &WallPaperReset{} - x.DeepCopy(z) - return z -} - -func (x *WallPaperReset) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WallPaperReset) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WallPaperReset) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WallPaperReset) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WallPaperReset) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WallPaperReset, x) -} - -const C_InputWallPaper int64 = 4000784410 - -type poolInputWallPaper struct { - pool sync.Pool -} - -func (p *poolInputWallPaper) Get() *InputWallPaper { - x, ok := p.pool.Get().(*InputWallPaper) - if !ok { - x = &InputWallPaper{} - } - - return x -} - -func (p *poolInputWallPaper) Put(x *InputWallPaper) { - if x == nil { - return - } - - x.ID = 0 - x.AccessHash = 0 - - p.pool.Put(x) -} - -var PoolInputWallPaper = poolInputWallPaper{} - -func (x *InputWallPaper) DeepCopy(z *InputWallPaper) { - z.ID = x.ID - z.AccessHash = x.AccessHash -} - -func (x *InputWallPaper) Clone() *InputWallPaper { - z := &InputWallPaper{} - x.DeepCopy(z) - return z -} - -func (x *InputWallPaper) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputWallPaper) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputWallPaper) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputWallPaper) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputWallPaper) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputWallPaper, x) -} - -const C_WallPaperSettings int64 = 1098244882 - -type poolWallPaperSettings struct { - pool sync.Pool -} - -func (p *poolWallPaperSettings) Get() *WallPaperSettings { - x, ok := p.pool.Get().(*WallPaperSettings) - if !ok { - x = &WallPaperSettings{} - } - - return x -} - -func (p *poolWallPaperSettings) Put(x *WallPaperSettings) { - if x == nil { - return - } - - x.Blur = false - x.Motion = false - x.BackgroundColour = 0 - x.BackgroundSecondColour = 0 - x.Opacity = 0 - x.Rotation = 0 - - p.pool.Put(x) -} - -var PoolWallPaperSettings = poolWallPaperSettings{} - -func (x *WallPaperSettings) DeepCopy(z *WallPaperSettings) { - z.Blur = x.Blur - z.Motion = x.Motion - z.BackgroundColour = x.BackgroundColour - z.BackgroundSecondColour = x.BackgroundSecondColour - z.Opacity = x.Opacity - z.Rotation = x.Rotation -} - -func (x *WallPaperSettings) Clone() *WallPaperSettings { - z := &WallPaperSettings{} - x.DeepCopy(z) - return z -} - -func (x *WallPaperSettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WallPaperSettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WallPaperSettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WallPaperSettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WallPaperSettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WallPaperSettings, x) -} - -const C_WallPaper int64 = 2527250827 - -type poolWallPaper struct { - pool sync.Pool -} - -func (p *poolWallPaper) Get() *WallPaper { - x, ok := p.pool.Get().(*WallPaper) - if !ok { - x = &WallPaper{} - } - - x.Document = PoolDocument.Get() - - x.Settings = PoolWallPaperSettings.Get() - - return x -} - -func (p *poolWallPaper) Put(x *WallPaper) { - if x == nil { - return - } - - x.ID = 0 - x.AccessHash = 0 - x.Creator = false - x.Default = false - x.Pattern = false - x.Dark = false - PoolDocument.Put(x.Document) - PoolWallPaperSettings.Put(x.Settings) - - p.pool.Put(x) -} - -var PoolWallPaper = poolWallPaper{} - -func (x *WallPaper) DeepCopy(z *WallPaper) { - z.ID = x.ID - z.AccessHash = x.AccessHash - z.Creator = x.Creator - z.Default = x.Default - z.Pattern = x.Pattern - z.Dark = x.Dark - if x.Document != nil { - if z.Document == nil { - z.Document = PoolDocument.Get() - } - x.Document.DeepCopy(z.Document) - } else { - PoolDocument.Put(z.Document) - z.Document = nil - } - if x.Settings != nil { - if z.Settings == nil { - z.Settings = PoolWallPaperSettings.Get() - } - x.Settings.DeepCopy(z.Settings) - } else { - PoolWallPaperSettings.Put(z.Settings) - z.Settings = nil - } -} - -func (x *WallPaper) Clone() *WallPaper { - z := &WallPaper{} - x.DeepCopy(z) - return z -} - -func (x *WallPaper) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WallPaper) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WallPaper) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WallPaper) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WallPaper) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WallPaper, x) -} - -const C_WallPapersMany int64 = 3121104857 - -type poolWallPapersMany struct { - pool sync.Pool -} - -func (p *poolWallPapersMany) Get() *WallPapersMany { - x, ok := p.pool.Get().(*WallPapersMany) - if !ok { - x = &WallPapersMany{} - } - - return x -} - -func (p *poolWallPapersMany) Put(x *WallPapersMany) { - if x == nil { - return - } - - for _, z := range x.WallPapers { - PoolWallPaper.Put(z) - } - x.WallPapers = x.WallPapers[:0] - x.Count = 0 - x.Crc32Hash = 0 - x.Empty = false - - p.pool.Put(x) -} - -var PoolWallPapersMany = poolWallPapersMany{} - -func (x *WallPapersMany) DeepCopy(z *WallPapersMany) { - for idx := range x.WallPapers { - if x.WallPapers[idx] == nil { - continue - } - xx := PoolWallPaper.Get() - x.WallPapers[idx].DeepCopy(xx) - z.WallPapers = append(z.WallPapers, xx) - } - z.Count = x.Count - z.Crc32Hash = x.Crc32Hash - z.Empty = x.Empty -} - -func (x *WallPapersMany) Clone() *WallPapersMany { - z := &WallPapersMany{} - x.DeepCopy(z) - return z -} - -func (x *WallPapersMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WallPapersMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WallPapersMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WallPapersMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WallPapersMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WallPapersMany, x) -} - -func init() { - registry.RegisterConstructor(183906980, "WallPaperGet") - registry.RegisterConstructor(3559907599, "WallPaperSave") - registry.RegisterConstructor(3006268108, "WallPaperDelete") - registry.RegisterConstructor(2661259348, "WallPaperUpload") - registry.RegisterConstructor(2714244308, "WallPaperReset") - registry.RegisterConstructor(4000784410, "InputWallPaper") - registry.RegisterConstructor(1098244882, "WallPaperSettings") - registry.RegisterConstructor(2527250827, "WallPaper") - registry.RegisterConstructor(3121104857, "WallPapersMany") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/client.call.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/client.call.pb.go deleted file mode 100644 index 54102239..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/client.call.pb.go +++ /dev/null @@ -1,4340 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: client.call.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// CallUpdate -type CallUpdate int32 - -const ( - CallUpdate_CallEmpty CallUpdate = 0 - CallUpdate_CallRequested CallUpdate = 1 - CallUpdate_CallAccepted CallUpdate = 2 - CallUpdate_StreamUpdated CallUpdate = 3 - CallUpdate_CallRejected CallUpdate = 4 - CallUpdate_MediaSettingsUpdated CallUpdate = 5 - CallUpdate_LocalStreamUpdated CallUpdate = 6 - CallUpdate_CallTimeout CallUpdate = 7 - CallUpdate_CallAck CallUpdate = 8 - CallUpdate_ParticipantJoined CallUpdate = 9 - CallUpdate_ParticipantLeft CallUpdate = 10 - CallUpdate_ParticipantAdded CallUpdate = 11 - CallUpdate_ParticipantRemoved CallUpdate = 12 - CallUpdate_CallPreview CallUpdate = 13 - CallUpdate_CallCancelled CallUpdate = 14 - CallUpdate_CallJoinRequested CallUpdate = 15 - CallUpdate_ParticipantAdminUpdated CallUpdate = 16 - CallUpdate_ShareScreenStreamUpdated CallUpdate = 17 - CallUpdate_AllConnected CallUpdate = 18 - CallUpdate_ConnectionStatusChanged CallUpdate = 19 - CallUpdate_ParticipantMuted CallUpdate = 20 - CallUpdate_CallDestroyed CallUpdate = 21 - CallUpdate_LocalMediaSettingsUpdated CallUpdate = 22 - CallUpdate_Destroyed CallUpdate = 23 - CallUpdate_CallStatusChanged CallUpdate = 24 - CallUpdate_CallUpdateReserved6 CallUpdate = 25 - CallUpdate_CallUpdateReserved7 CallUpdate = 26 - CallUpdate_CallUpdateReserved8 CallUpdate = 27 - CallUpdate_CallUpdateReserved9 CallUpdate = 28 -) - -// Enum value maps for CallUpdate. -var ( - CallUpdate_name = map[int32]string{ - 0: "CallEmpty", - 1: "CallRequested", - 2: "CallAccepted", - 3: "StreamUpdated", - 4: "CallRejected", - 5: "MediaSettingsUpdated", - 6: "LocalStreamUpdated", - 7: "CallTimeout", - 8: "CallAck", - 9: "ParticipantJoined", - 10: "ParticipantLeft", - 11: "ParticipantAdded", - 12: "ParticipantRemoved", - 13: "CallPreview", - 14: "CallCancelled", - 15: "CallJoinRequested", - 16: "ParticipantAdminUpdated", - 17: "ShareScreenStreamUpdated", - 18: "AllConnected", - 19: "ConnectionStatusChanged", - 20: "ParticipantMuted", - 21: "CallDestroyed", - 22: "LocalMediaSettingsUpdated", - 23: "Destroyed", - 24: "CallStatusChanged", - 25: "CallUpdateReserved6", - 26: "CallUpdateReserved7", - 27: "CallUpdateReserved8", - 28: "CallUpdateReserved9", - } - CallUpdate_value = map[string]int32{ - "CallEmpty": 0, - "CallRequested": 1, - "CallAccepted": 2, - "StreamUpdated": 3, - "CallRejected": 4, - "MediaSettingsUpdated": 5, - "LocalStreamUpdated": 6, - "CallTimeout": 7, - "CallAck": 8, - "ParticipantJoined": 9, - "ParticipantLeft": 10, - "ParticipantAdded": 11, - "ParticipantRemoved": 12, - "CallPreview": 13, - "CallCancelled": 14, - "CallJoinRequested": 15, - "ParticipantAdminUpdated": 16, - "ShareScreenStreamUpdated": 17, - "AllConnected": 18, - "ConnectionStatusChanged": 19, - "ParticipantMuted": 20, - "CallDestroyed": 21, - "LocalMediaSettingsUpdated": 22, - "Destroyed": 23, - "CallStatusChanged": 24, - "CallUpdateReserved6": 25, - "CallUpdateReserved7": 26, - "CallUpdateReserved8": 27, - "CallUpdateReserved9": 28, - } -) - -func (x CallUpdate) Enum() *CallUpdate { - p := new(CallUpdate) - *p = x - return p -} - -func (x CallUpdate) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CallUpdate) Descriptor() protoreflect.EnumDescriptor { - return file_client_call_proto_enumTypes[0].Descriptor() -} - -func (CallUpdate) Type() protoreflect.EnumType { - return &file_client_call_proto_enumTypes[0] -} - -func (x CallUpdate) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CallUpdate.Descriptor instead. -func (CallUpdate) EnumDescriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{0} -} - -// CallStatus -type CallStatus int32 - -const ( - CallStatus_Empty CallStatus = 0 - CallStatus_Calling CallStatus = 1 - CallStatus_Ringing CallStatus = 2 - CallStatus_Connecting CallStatus = 3 - CallStatus_Connected CallStatus = 4 - CallStatus_Reconnecting CallStatus = 5 - CallStatus_Failed CallStatus = 6 - CallStatus_Ended CallStatus = 7 - CallStatus_CallStatusReserve2 CallStatus = 8 - CallStatus_CallStatusReserve3 CallStatus = 9 - CallStatus_CallStatusReserve4 CallStatus = 10 - CallStatus_CallStatusReserve5 CallStatus = 11 -) - -// Enum value maps for CallStatus. -var ( - CallStatus_name = map[int32]string{ - 0: "Empty", - 1: "Calling", - 2: "Ringing", - 3: "Connecting", - 4: "Connected", - 5: "Reconnecting", - 6: "Failed", - 7: "Ended", - 8: "CallStatusReserve2", - 9: "CallStatusReserve3", - 10: "CallStatusReserve4", - 11: "CallStatusReserve5", - } - CallStatus_value = map[string]int32{ - "Empty": 0, - "Calling": 1, - "Ringing": 2, - "Connecting": 3, - "Connected": 4, - "Reconnecting": 5, - "Failed": 6, - "Ended": 7, - "CallStatusReserve2": 8, - "CallStatusReserve3": 9, - "CallStatusReserve4": 10, - "CallStatusReserve5": 11, - } -) - -func (x CallStatus) Enum() *CallStatus { - p := new(CallStatus) - *p = x - return p -} - -func (x CallStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (CallStatus) Descriptor() protoreflect.EnumDescriptor { - return file_client_call_proto_enumTypes[1].Descriptor() -} - -func (CallStatus) Type() protoreflect.EnumType { - return &file_client_call_proto_enumTypes[1] -} - -func (x CallStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use CallStatus.Descriptor instead. -func (CallStatus) EnumDescriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{1} -} - -// ClientCallToggleVideo -// @Function -// @Return: Bool -type ClientCallToggleVideo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Video bool `protobuf:"varint,1,opt,name=Video,proto3" json:"Video,omitempty"` -} - -func (x *ClientCallToggleVideo) Reset() { - *x = ClientCallToggleVideo{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallToggleVideo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallToggleVideo) ProtoMessage() {} - -func (x *ClientCallToggleVideo) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallToggleVideo.ProtoReflect.Descriptor instead. -func (*ClientCallToggleVideo) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{0} -} - -func (x *ClientCallToggleVideo) GetVideo() bool { - if x != nil { - return x.Video - } - return false -} - -// ClientCallToggleAudio -// @Function -// @Return: Bool -type ClientCallToggleAudio struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Audio bool `protobuf:"varint,1,opt,name=Audio,proto3" json:"Audio,omitempty"` -} - -func (x *ClientCallToggleAudio) Reset() { - *x = ClientCallToggleAudio{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallToggleAudio) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallToggleAudio) ProtoMessage() {} - -func (x *ClientCallToggleAudio) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallToggleAudio.ProtoReflect.Descriptor instead. -func (*ClientCallToggleAudio) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{1} -} - -func (x *ClientCallToggleAudio) GetAudio() bool { - if x != nil { - return x.Audio - } - return false -} - -// ClientCallTryReconnect -// @Function -// @Return: Bool -type ClientCallTryReconnect struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnId int32 `protobuf:"varint,1,opt,name=ConnId,proto3" json:"ConnId,omitempty"` -} - -func (x *ClientCallTryReconnect) Reset() { - *x = ClientCallTryReconnect{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallTryReconnect) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallTryReconnect) ProtoMessage() {} - -func (x *ClientCallTryReconnect) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallTryReconnect.ProtoReflect.Descriptor instead. -func (*ClientCallTryReconnect) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{2} -} - -func (x *ClientCallTryReconnect) GetConnId() int32 { - if x != nil { - return x.ConnId - } - return 0 -} - -// ClientCallDestroy -// @Function -// @Return: Bool -type ClientCallDestroy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *ClientCallDestroy) Reset() { - *x = ClientCallDestroy{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallDestroy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallDestroy) ProtoMessage() {} - -func (x *ClientCallDestroy) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallDestroy.ProtoReflect.Descriptor instead. -func (*ClientCallDestroy) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{3} -} - -func (x *ClientCallDestroy) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// ClientCallAreAllAudio -// @Function -// @Return: Bool -type ClientCallAreAllAudio struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ClientCallAreAllAudio) Reset() { - *x = ClientCallAreAllAudio{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallAreAllAudio) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallAreAllAudio) ProtoMessage() {} - -func (x *ClientCallAreAllAudio) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallAreAllAudio.ProtoReflect.Descriptor instead. -func (*ClientCallAreAllAudio) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{4} -} - -// ClientCallSendIceCandidate -// @Function -// @Return: Bool -type ClientCallSendIceCandidate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnId int32 `protobuf:"varint,1,opt,name=ConnId,proto3" json:"ConnId,omitempty"` - Candidate *CallRTCIceCandidate `protobuf:"bytes,2,opt,name=Candidate,proto3" json:"Candidate,omitempty"` -} - -func (x *ClientCallSendIceCandidate) Reset() { - *x = ClientCallSendIceCandidate{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallSendIceCandidate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallSendIceCandidate) ProtoMessage() {} - -func (x *ClientCallSendIceCandidate) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallSendIceCandidate.ProtoReflect.Descriptor instead. -func (*ClientCallSendIceCandidate) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{5} -} - -func (x *ClientCallSendIceCandidate) GetConnId() int32 { - if x != nil { - return x.ConnId - } - return 0 -} - -func (x *ClientCallSendIceCandidate) GetCandidate() *CallRTCIceCandidate { - if x != nil { - return x.Candidate - } - return nil -} - -// ClientCallSendIceConnectionStatus -// @Function -// @Return: Bool -type ClientCallSendIceConnectionStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnId int32 `protobuf:"varint,1,opt,name=ConnId,proto3" json:"ConnId,omitempty"` - State string `protobuf:"bytes,2,opt,name=State,proto3" json:"State,omitempty"` - HasIceError bool `protobuf:"varint,3,opt,name=HasIceError,proto3" json:"HasIceError,omitempty"` - IceError string `protobuf:"bytes,4,opt,name=IceError,proto3" json:"IceError,omitempty"` -} - -func (x *ClientCallSendIceConnectionStatus) Reset() { - *x = ClientCallSendIceConnectionStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallSendIceConnectionStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallSendIceConnectionStatus) ProtoMessage() {} - -func (x *ClientCallSendIceConnectionStatus) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallSendIceConnectionStatus.ProtoReflect.Descriptor instead. -func (*ClientCallSendIceConnectionStatus) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{6} -} - -func (x *ClientCallSendIceConnectionStatus) GetConnId() int32 { - if x != nil { - return x.ConnId - } - return 0 -} - -func (x *ClientCallSendIceConnectionStatus) GetState() string { - if x != nil { - return x.State - } - return "" -} - -func (x *ClientCallSendIceConnectionStatus) GetHasIceError() bool { - if x != nil { - return x.HasIceError - } - return false -} - -func (x *ClientCallSendIceConnectionStatus) GetIceError() string { - if x != nil { - return x.IceError - } - return "" -} - -// ClientCallSendTrack -// @Function -// @Return: Bool -type ClientCallSendTrack struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnId int32 `protobuf:"varint,1,opt,name=ConnId,proto3" json:"ConnId,omitempty"` - StreamID string `protobuf:"bytes,2,opt,name=StreamID,proto3" json:"StreamID,omitempty"` -} - -func (x *ClientCallSendTrack) Reset() { - *x = ClientCallSendTrack{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallSendTrack) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallSendTrack) ProtoMessage() {} - -func (x *ClientCallSendTrack) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallSendTrack.ProtoReflect.Descriptor instead. -func (*ClientCallSendTrack) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{7} -} - -func (x *ClientCallSendTrack) GetConnId() int32 { - if x != nil { - return x.ConnId - } - return 0 -} - -func (x *ClientCallSendTrack) GetStreamID() string { - if x != nil { - return x.StreamID - } - return "" -} - -// ClientCallSendAck -// @Function -// @Return: Bool -type ClientCallSendAck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *ClientCallSendAck) Reset() { - *x = ClientCallSendAck{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallSendAck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallSendAck) ProtoMessage() {} - -func (x *ClientCallSendAck) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallSendAck.ProtoReflect.Descriptor instead. -func (*ClientCallSendAck) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{8} -} - -func (x *ClientCallSendAck) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// ClientCallSendIceConnectionStatus -// @Function -// @Return: Bool -type ClientCallSendMediaSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MediaSettings *CallMediaSettings `protobuf:"bytes,1,opt,name=MediaSettings,proto3" json:"MediaSettings,omitempty"` -} - -func (x *ClientCallSendMediaSettings) Reset() { - *x = ClientCallSendMediaSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallSendMediaSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallSendMediaSettings) ProtoMessage() {} - -func (x *ClientCallSendMediaSettings) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallSendMediaSettings.ProtoReflect.Descriptor instead. -func (*ClientCallSendMediaSettings) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{9} -} - -func (x *ClientCallSendMediaSettings) GetMediaSettings() *CallMediaSettings { - if x != nil { - return x.MediaSettings - } - return nil -} - -// ClientCallGetDuration -// @Function -// @Return: ClientCallDuration -type ClientCallGetDuration struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *ClientCallGetDuration) Reset() { - *x = ClientCallGetDuration{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallGetDuration) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallGetDuration) ProtoMessage() {} - -func (x *ClientCallGetDuration) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallGetDuration.ProtoReflect.Descriptor instead. -func (*ClientCallGetDuration) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{10} -} - -func (x *ClientCallGetDuration) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// ClientCallStart -// @Function -// @Return: ClientCallStarted -type ClientCallStart struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - InputUsers []*InputUser `protobuf:"bytes,2,rep,name=InputUsers,proto3" json:"InputUsers,omitempty"` - Video bool `protobuf:"varint,3,opt,name=Video,proto3" json:"Video,omitempty"` - CallID int64 `protobuf:"varint,4,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *ClientCallStart) Reset() { - *x = ClientCallStart{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallStart) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallStart) ProtoMessage() {} - -func (x *ClientCallStart) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallStart.ProtoReflect.Descriptor instead. -func (*ClientCallStart) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{11} -} - -func (x *ClientCallStart) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *ClientCallStart) GetInputUsers() []*InputUser { - if x != nil { - return x.InputUsers - } - return nil -} - -func (x *ClientCallStart) GetVideo() bool { - if x != nil { - return x.Video - } - return false -} - -func (x *ClientCallStart) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// ClientCallStarted -type ClientCallStarted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *ClientCallStarted) Reset() { - *x = ClientCallStarted{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallStarted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallStarted) ProtoMessage() {} - -func (x *ClientCallStarted) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallStarted.ProtoReflect.Descriptor instead. -func (*ClientCallStarted) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{12} -} - -func (x *ClientCallStarted) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// ClientCallDuration -type ClientCallDuration struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Duration int64 `protobuf:"varint,1,opt,name=Duration,proto3" json:"Duration,omitempty"` -} - -func (x *ClientCallDuration) Reset() { - *x = ClientCallDuration{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallDuration) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallDuration) ProtoMessage() {} - -func (x *ClientCallDuration) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallDuration.ProtoReflect.Descriptor instead. -func (*ClientCallDuration) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{13} -} - -func (x *ClientCallDuration) GetDuration() int64 { - if x != nil { - return x.Duration - } - return 0 -} - -// ClientCallJoin -// @Function -// @Return: Bool -type ClientCallJoin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *ClientCallJoin) Reset() { - *x = ClientCallJoin{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallJoin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallJoin) ProtoMessage() {} - -func (x *ClientCallJoin) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallJoin.ProtoReflect.Descriptor instead. -func (*ClientCallJoin) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{14} -} - -func (x *ClientCallJoin) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *ClientCallJoin) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// ClientCallAccept -// @Function -// @Return: Bool -type ClientCallAccept struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - Video bool `protobuf:"varint,2,opt,name=Video,proto3" json:"Video,omitempty"` -} - -func (x *ClientCallAccept) Reset() { - *x = ClientCallAccept{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallAccept) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallAccept) ProtoMessage() {} - -func (x *ClientCallAccept) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallAccept.ProtoReflect.Descriptor instead. -func (*ClientCallAccept) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{15} -} - -func (x *ClientCallAccept) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *ClientCallAccept) GetVideo() bool { - if x != nil { - return x.Video - } - return false -} - -// ClientCallReject -// @Function -// @Return: Bool -type ClientCallReject struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - Duration int32 `protobuf:"varint,2,opt,name=Duration,proto3" json:"Duration,omitempty"` - Reason DiscardReason `protobuf:"varint,3,opt,name=Reason,proto3,enum=msg.DiscardReason" json:"Reason,omitempty"` - TargetPeer *InputPeer `protobuf:"bytes,4,opt,name=TargetPeer,proto3" json:"TargetPeer,omitempty"` - Force bool `protobuf:"varint,5,opt,name=Force,proto3" json:"Force,omitempty"` -} - -func (x *ClientCallReject) Reset() { - *x = ClientCallReject{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallReject) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallReject) ProtoMessage() {} - -func (x *ClientCallReject) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallReject.ProtoReflect.Descriptor instead. -func (*ClientCallReject) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{16} -} - -func (x *ClientCallReject) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *ClientCallReject) GetDuration() int32 { - if x != nil { - return x.Duration - } - return 0 -} - -func (x *ClientCallReject) GetReason() DiscardReason { - if x != nil { - return x.Reason - } - return DiscardReason_DiscardReasonUnknown -} - -func (x *ClientCallReject) GetTargetPeer() *InputPeer { - if x != nil { - return x.TargetPeer - } - return nil -} - -func (x *ClientCallReject) GetForce() bool { - if x != nil { - return x.Force - } - return false -} - -// ClientCallGetParticipantByUserID -// @Function -// @Return: CallParticipant -type ClientCallGetParticipantByUserID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` -} - -func (x *ClientCallGetParticipantByUserID) Reset() { - *x = ClientCallGetParticipantByUserID{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallGetParticipantByUserID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallGetParticipantByUserID) ProtoMessage() {} - -func (x *ClientCallGetParticipantByUserID) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallGetParticipantByUserID.ProtoReflect.Descriptor instead. -func (*ClientCallGetParticipantByUserID) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{17} -} - -func (x *ClientCallGetParticipantByUserID) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *ClientCallGetParticipantByUserID) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -// ClientCallGetParticipantByConnId -// @Function -// @Return: CallParticipant -type ClientCallGetParticipantByConnId struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnId int32 `protobuf:"varint,1,opt,name=ConnId,proto3" json:"ConnId,omitempty"` -} - -func (x *ClientCallGetParticipantByConnId) Reset() { - *x = ClientCallGetParticipantByConnId{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallGetParticipantByConnId) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallGetParticipantByConnId) ProtoMessage() {} - -func (x *ClientCallGetParticipantByConnId) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallGetParticipantByConnId.ProtoReflect.Descriptor instead. -func (*ClientCallGetParticipantByConnId) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{18} -} - -func (x *ClientCallGetParticipantByConnId) GetConnId() int32 { - if x != nil { - return x.ConnId - } - return 0 -} - -// ClientCallGetParticipantList -// @Function -// @Return: CallParticipants -type ClientCallGetParticipantList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - ExcludeCurrent bool `protobuf:"varint,2,opt,name=ExcludeCurrent,proto3" json:"ExcludeCurrent,omitempty"` -} - -func (x *ClientCallGetParticipantList) Reset() { - *x = ClientCallGetParticipantList{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallGetParticipantList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallGetParticipantList) ProtoMessage() {} - -func (x *ClientCallGetParticipantList) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallGetParticipantList.ProtoReflect.Descriptor instead. -func (*ClientCallGetParticipantList) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{19} -} - -func (x *ClientCallGetParticipantList) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *ClientCallGetParticipantList) GetExcludeCurrent() bool { - if x != nil { - return x.ExcludeCurrent - } - return false -} - -// ClientCallMuteParticipant -// @Function -// @Return: Bool -type ClientCallMuteParticipant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Muted bool `protobuf:"varint,2,opt,name=Muted,proto3" json:"Muted,omitempty"` -} - -func (x *ClientCallMuteParticipant) Reset() { - *x = ClientCallMuteParticipant{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallMuteParticipant) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallMuteParticipant) ProtoMessage() {} - -func (x *ClientCallMuteParticipant) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallMuteParticipant.ProtoReflect.Descriptor instead. -func (*ClientCallMuteParticipant) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{20} -} - -func (x *ClientCallMuteParticipant) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *ClientCallMuteParticipant) GetMuted() bool { - if x != nil { - return x.Muted - } - return false -} - -// ClientCallGroupAddParticipant -// @Function -// @Return: Bool -type ClientCallGroupAddParticipant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - Participants []*InputUser `protobuf:"bytes,2,rep,name=Participants,proto3" json:"Participants,omitempty"` -} - -func (x *ClientCallGroupAddParticipant) Reset() { - *x = ClientCallGroupAddParticipant{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallGroupAddParticipant) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallGroupAddParticipant) ProtoMessage() {} - -func (x *ClientCallGroupAddParticipant) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallGroupAddParticipant.ProtoReflect.Descriptor instead. -func (*ClientCallGroupAddParticipant) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{21} -} - -func (x *ClientCallGroupAddParticipant) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *ClientCallGroupAddParticipant) GetParticipants() []*InputUser { - if x != nil { - return x.Participants - } - return nil -} - -// ClientCallGroupRemoveParticipant -// @Function -// @Return: Bool -type ClientCallGroupRemoveParticipant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - UserIDs []int64 `protobuf:"varint,2,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` - Timeout bool `protobuf:"varint,3,opt,name=Timeout,proto3" json:"Timeout,omitempty"` -} - -func (x *ClientCallGroupRemoveParticipant) Reset() { - *x = ClientCallGroupRemoveParticipant{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallGroupRemoveParticipant) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallGroupRemoveParticipant) ProtoMessage() {} - -func (x *ClientCallGroupRemoveParticipant) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallGroupRemoveParticipant.ProtoReflect.Descriptor instead. -func (*ClientCallGroupRemoveParticipant) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{22} -} - -func (x *ClientCallGroupRemoveParticipant) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *ClientCallGroupRemoveParticipant) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -func (x *ClientCallGroupRemoveParticipant) GetTimeout() bool { - if x != nil { - return x.Timeout - } - return false -} - -// ClientCallGroupUpdateAdmin -// @Function -// @Return: Bool -type ClientCallGroupUpdateAdmin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - Admin bool `protobuf:"varint,3,opt,name=Admin,proto3" json:"Admin,omitempty"` -} - -func (x *ClientCallGroupUpdateAdmin) Reset() { - *x = ClientCallGroupUpdateAdmin{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCallGroupUpdateAdmin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCallGroupUpdateAdmin) ProtoMessage() {} - -func (x *ClientCallGroupUpdateAdmin) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCallGroupUpdateAdmin.ProtoReflect.Descriptor instead. -func (*ClientCallGroupUpdateAdmin) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{23} -} - -func (x *ClientCallGroupUpdateAdmin) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *ClientCallGroupUpdateAdmin) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *ClientCallGroupUpdateAdmin) GetAdmin() bool { - if x != nil { - return x.Admin - } - return false -} - -// CallMediaSettings -type CallMediaSettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Audio bool `protobuf:"varint,1,opt,name=Audio,proto3" json:"Audio,omitempty"` - ScreenShare bool `protobuf:"varint,2,opt,name=ScreenShare,proto3" json:"ScreenShare,omitempty"` - Video bool `protobuf:"varint,3,opt,name=Video,proto3" json:"Video,omitempty"` -} - -func (x *CallMediaSettings) Reset() { - *x = CallMediaSettings{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallMediaSettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallMediaSettings) ProtoMessage() {} - -func (x *CallMediaSettings) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallMediaSettings.ProtoReflect.Descriptor instead. -func (*CallMediaSettings) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{24} -} - -func (x *CallMediaSettings) GetAudio() bool { - if x != nil { - return x.Audio - } - return false -} - -func (x *CallMediaSettings) GetScreenShare() bool { - if x != nil { - return x.ScreenShare - } - return false -} - -func (x *CallMediaSettings) GetVideo() bool { - if x != nil { - return x.Video - } - return false -} - -// CallParticipant -type CallParticipant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PhoneParticipant *PhoneParticipant `protobuf:"bytes,1,opt,name=PhoneParticipant,proto3" json:"PhoneParticipant,omitempty"` - DeviceType CallDeviceType `protobuf:"varint,2,opt,name=DeviceType,proto3,enum=msg.CallDeviceType" json:"DeviceType,omitempty"` - MediaSettings *CallMediaSettings `protobuf:"bytes,3,opt,name=MediaSettings,proto3" json:"MediaSettings,omitempty"` - Muted bool `protobuf:"varint,4,opt,name=Muted,proto3" json:"Muted,omitempty"` - Started bool `protobuf:"varint,5,opt,name=Started,proto3" json:"Started,omitempty"` -} - -func (x *CallParticipant) Reset() { - *x = CallParticipant{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallParticipant) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallParticipant) ProtoMessage() {} - -func (x *CallParticipant) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallParticipant.ProtoReflect.Descriptor instead. -func (*CallParticipant) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{25} -} - -func (x *CallParticipant) GetPhoneParticipant() *PhoneParticipant { - if x != nil { - return x.PhoneParticipant - } - return nil -} - -func (x *CallParticipant) GetDeviceType() CallDeviceType { - if x != nil { - return x.DeviceType - } - return CallDeviceType_CallDeviceUnknown -} - -func (x *CallParticipant) GetMediaSettings() *CallMediaSettings { - if x != nil { - return x.MediaSettings - } - return nil -} - -func (x *CallParticipant) GetMuted() bool { - if x != nil { - return x.Muted - } - return false -} - -func (x *CallParticipant) GetStarted() bool { - if x != nil { - return x.Started - } - return false -} - -// CallParticipants -type CallParticipants struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallParticipants []*CallParticipant `protobuf:"bytes,1,rep,name=CallParticipants,proto3" json:"CallParticipants,omitempty"` -} - -func (x *CallParticipants) Reset() { - *x = CallParticipants{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallParticipants) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallParticipants) ProtoMessage() {} - -func (x *CallParticipants) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallParticipants.ProtoReflect.Descriptor instead. -func (*CallParticipants) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{26} -} - -func (x *CallParticipants) GetCallParticipants() []*CallParticipant { - if x != nil { - return x.CallParticipants - } - return nil -} - -// CallRTCIceCandidate -type CallRTCIceCandidate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Candidate string `protobuf:"bytes,1,opt,name=Candidate,proto3" json:"Candidate,omitempty"` - SdpMLineIndex int64 `protobuf:"varint,2,opt,name=SdpMLineIndex,proto3" json:"SdpMLineIndex,omitempty"` - SdpMid string `protobuf:"bytes,3,opt,name=SdpMid,proto3" json:"SdpMid,omitempty"` - UsernameFragment string `protobuf:"bytes,4,opt,name=UsernameFragment,proto3" json:"UsernameFragment,omitempty"` -} - -func (x *CallRTCIceCandidate) Reset() { - *x = CallRTCIceCandidate{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallRTCIceCandidate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallRTCIceCandidate) ProtoMessage() {} - -func (x *CallRTCIceCandidate) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallRTCIceCandidate.ProtoReflect.Descriptor instead. -func (*CallRTCIceCandidate) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{27} -} - -func (x *CallRTCIceCandidate) GetCandidate() string { - if x != nil { - return x.Candidate - } - return "" -} - -func (x *CallRTCIceCandidate) GetSdpMLineIndex() int64 { - if x != nil { - return x.SdpMLineIndex - } - return 0 -} - -func (x *CallRTCIceCandidate) GetSdpMid() string { - if x != nil { - return x.SdpMid - } - return "" -} - -func (x *CallRTCIceCandidate) GetUsernameFragment() string { - if x != nil { - return x.UsernameFragment - } - return "" -} - -// CallConnection -type CallConnection struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnId int32 `protobuf:"varint,1,opt,name=ConnId,proto3" json:"ConnId,omitempty"` - Accepted bool `protobuf:"varint,2,opt,name=Accepted,proto3" json:"Accepted,omitempty"` - RTCPeerConnectionID int64 `protobuf:"varint,3,opt,name=RTCPeerConnectionID,proto3" json:"RTCPeerConnectionID,omitempty"` - IceConnectionState string `protobuf:"bytes,4,opt,name=IceConnectionState,proto3" json:"IceConnectionState,omitempty"` - IceQueue []*CallRTCIceCandidate `protobuf:"bytes,5,rep,name=IceQueue,proto3" json:"IceQueue,omitempty"` - IceServers []*IceServer `protobuf:"bytes,6,rep,name=IceServers,proto3" json:"IceServers,omitempty"` - Init bool `protobuf:"varint,7,opt,name=Init,proto3" json:"Init,omitempty"` - Try int32 `protobuf:"varint,8,opt,name=Try,proto3" json:"Try,omitempty"` - Reconnecting bool `protobuf:"varint,9,opt,name=Reconnecting,proto3" json:"Reconnecting,omitempty"` - ReconnectingTry int32 `protobuf:"varint,10,opt,name=ReconnectingTry,proto3" json:"ReconnectingTry,omitempty"` - ScreenShareStreamID int64 `protobuf:"varint,11,opt,name=ScreenShareStreamID,proto3" json:"ScreenShareStreamID,omitempty"` - StreamID string `protobuf:"bytes,12,opt,name=StreamID,proto3" json:"StreamID,omitempty"` - IntervalID int64 `protobuf:"varint,13,opt,name=IntervalID,proto3" json:"IntervalID,omitempty"` -} - -func (x *CallConnection) Reset() { - *x = CallConnection{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallConnection) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallConnection) ProtoMessage() {} - -func (x *CallConnection) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallConnection.ProtoReflect.Descriptor instead. -func (*CallConnection) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{28} -} - -func (x *CallConnection) GetConnId() int32 { - if x != nil { - return x.ConnId - } - return 0 -} - -func (x *CallConnection) GetAccepted() bool { - if x != nil { - return x.Accepted - } - return false -} - -func (x *CallConnection) GetRTCPeerConnectionID() int64 { - if x != nil { - return x.RTCPeerConnectionID - } - return 0 -} - -func (x *CallConnection) GetIceConnectionState() string { - if x != nil { - return x.IceConnectionState - } - return "" -} - -func (x *CallConnection) GetIceQueue() []*CallRTCIceCandidate { - if x != nil { - return x.IceQueue - } - return nil -} - -func (x *CallConnection) GetIceServers() []*IceServer { - if x != nil { - return x.IceServers - } - return nil -} - -func (x *CallConnection) GetInit() bool { - if x != nil { - return x.Init - } - return false -} - -func (x *CallConnection) GetTry() int32 { - if x != nil { - return x.Try - } - return 0 -} - -func (x *CallConnection) GetReconnecting() bool { - if x != nil { - return x.Reconnecting - } - return false -} - -func (x *CallConnection) GetReconnectingTry() int32 { - if x != nil { - return x.ReconnectingTry - } - return 0 -} - -func (x *CallConnection) GetScreenShareStreamID() int64 { - if x != nil { - return x.ScreenShareStreamID - } - return 0 -} - -func (x *CallConnection) GetStreamID() string { - if x != nil { - return x.StreamID - } - return "" -} - -func (x *CallConnection) GetIntervalID() int64 { - if x != nil { - return x.IntervalID - } - return 0 -} - -// CallUpdateCallRequested -type CallUpdateCallRequested struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallID int64 `protobuf:"varint,2,opt,name=CallID,proto3" json:"CallID,omitempty"` - Video bool `protobuf:"varint,3,opt,name=Video,proto3" json:"Video,omitempty"` -} - -func (x *CallUpdateCallRequested) Reset() { - *x = CallUpdateCallRequested{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateCallRequested) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateCallRequested) ProtoMessage() {} - -func (x *CallUpdateCallRequested) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateCallRequested.ProtoReflect.Descriptor instead. -func (*CallUpdateCallRequested) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{29} -} - -func (x *CallUpdateCallRequested) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *CallUpdateCallRequested) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *CallUpdateCallRequested) GetVideo() bool { - if x != nil { - return x.Video - } - return false -} - -// CallUpdateCallAccepted -type CallUpdateCallAccepted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnectionID int32 `protobuf:"varint,1,opt,name=ConnectionID,proto3" json:"ConnectionID,omitempty"` -} - -func (x *CallUpdateCallAccepted) Reset() { - *x = CallUpdateCallAccepted{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateCallAccepted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateCallAccepted) ProtoMessage() {} - -func (x *CallUpdateCallAccepted) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateCallAccepted.ProtoReflect.Descriptor instead. -func (*CallUpdateCallAccepted) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{30} -} - -func (x *CallUpdateCallAccepted) GetConnectionID() int32 { - if x != nil { - return x.ConnectionID - } - return 0 -} - -// CallUpdateStreamUpdated -type CallUpdateStreamUpdated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnectionID int32 `protobuf:"varint,1,opt,name=ConnectionID,proto3" json:"ConnectionID,omitempty"` - StreamID string `protobuf:"bytes,2,opt,name=StreamID,proto3" json:"StreamID,omitempty"` -} - -func (x *CallUpdateStreamUpdated) Reset() { - *x = CallUpdateStreamUpdated{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateStreamUpdated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateStreamUpdated) ProtoMessage() {} - -func (x *CallUpdateStreamUpdated) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateStreamUpdated.ProtoReflect.Descriptor instead. -func (*CallUpdateStreamUpdated) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{31} -} - -func (x *CallUpdateStreamUpdated) GetConnectionID() int32 { - if x != nil { - return x.ConnectionID - } - return 0 -} - -func (x *CallUpdateStreamUpdated) GetStreamID() string { - if x != nil { - return x.StreamID - } - return "" -} - -// CallUpdateCallRejected -type CallUpdateCallRejected struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - Reason DiscardReason `protobuf:"varint,2,opt,name=Reason,proto3,enum=msg.DiscardReason" json:"Reason,omitempty"` -} - -func (x *CallUpdateCallRejected) Reset() { - *x = CallUpdateCallRejected{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateCallRejected) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateCallRejected) ProtoMessage() {} - -func (x *CallUpdateCallRejected) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateCallRejected.ProtoReflect.Descriptor instead. -func (*CallUpdateCallRejected) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{32} -} - -func (x *CallUpdateCallRejected) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *CallUpdateCallRejected) GetReason() DiscardReason { - if x != nil { - return x.Reason - } - return DiscardReason_DiscardReasonUnknown -} - -// CallUpdateMediaSettingsUpdated -type CallUpdateMediaSettingsUpdated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnectionID int32 `protobuf:"varint,1,opt,name=ConnectionID,proto3" json:"ConnectionID,omitempty"` - MediaSettings *CallMediaSettings `protobuf:"bytes,2,opt,name=MediaSettings,proto3" json:"MediaSettings,omitempty"` -} - -func (x *CallUpdateMediaSettingsUpdated) Reset() { - *x = CallUpdateMediaSettingsUpdated{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateMediaSettingsUpdated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateMediaSettingsUpdated) ProtoMessage() {} - -func (x *CallUpdateMediaSettingsUpdated) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateMediaSettingsUpdated.ProtoReflect.Descriptor instead. -func (*CallUpdateMediaSettingsUpdated) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{33} -} - -func (x *CallUpdateMediaSettingsUpdated) GetConnectionID() int32 { - if x != nil { - return x.ConnectionID - } - return 0 -} - -func (x *CallUpdateMediaSettingsUpdated) GetMediaSettings() *CallMediaSettings { - if x != nil { - return x.MediaSettings - } - return nil -} - -// CallUpdateLocalStreamUpdated -type CallUpdateLocalStreamUpdated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - StreamID string `protobuf:"bytes,1,opt,name=StreamID,proto3" json:"StreamID,omitempty"` -} - -func (x *CallUpdateLocalStreamUpdated) Reset() { - *x = CallUpdateLocalStreamUpdated{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateLocalStreamUpdated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateLocalStreamUpdated) ProtoMessage() {} - -func (x *CallUpdateLocalStreamUpdated) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateLocalStreamUpdated.ProtoReflect.Descriptor instead. -func (*CallUpdateLocalStreamUpdated) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{34} -} - -func (x *CallUpdateLocalStreamUpdated) GetStreamID() string { - if x != nil { - return x.StreamID - } - return "" -} - -// CallUpdateCallTimeout -type CallUpdateCallTimeout struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *CallUpdateCallTimeout) Reset() { - *x = CallUpdateCallTimeout{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateCallTimeout) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateCallTimeout) ProtoMessage() {} - -func (x *CallUpdateCallTimeout) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateCallTimeout.ProtoReflect.Descriptor instead. -func (*CallUpdateCallTimeout) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{35} -} - -// CallUpdateCallAck -type CallUpdateCallAck struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnectionID int32 `protobuf:"varint,1,opt,name=ConnectionID,proto3" json:"ConnectionID,omitempty"` -} - -func (x *CallUpdateCallAck) Reset() { - *x = CallUpdateCallAck{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateCallAck) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateCallAck) ProtoMessage() {} - -func (x *CallUpdateCallAck) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateCallAck.ProtoReflect.Descriptor instead. -func (*CallUpdateCallAck) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{36} -} - -func (x *CallUpdateCallAck) GetConnectionID() int32 { - if x != nil { - return x.ConnectionID - } - return 0 -} - -// CallUpdateParticipantJoined -type CallUpdateParticipantJoined struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIDs []int64 `protobuf:"varint,1,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` -} - -func (x *CallUpdateParticipantJoined) Reset() { - *x = CallUpdateParticipantJoined{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateParticipantJoined) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateParticipantJoined) ProtoMessage() {} - -func (x *CallUpdateParticipantJoined) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateParticipantJoined.ProtoReflect.Descriptor instead. -func (*CallUpdateParticipantJoined) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{37} -} - -func (x *CallUpdateParticipantJoined) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -// CallUpdateParticipantLeft -type CallUpdateParticipantLeft struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` -} - -func (x *CallUpdateParticipantLeft) Reset() { - *x = CallUpdateParticipantLeft{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateParticipantLeft) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateParticipantLeft) ProtoMessage() {} - -func (x *CallUpdateParticipantLeft) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateParticipantLeft.ProtoReflect.Descriptor instead. -func (*CallUpdateParticipantLeft) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{38} -} - -func (x *CallUpdateParticipantLeft) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -// CallUpdateParticipantRemoved -type CallUpdateParticipantRemoved struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIDs []int64 `protobuf:"varint,1,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` - Timeout bool `protobuf:"varint,2,opt,name=Timeout,proto3" json:"Timeout,omitempty"` -} - -func (x *CallUpdateParticipantRemoved) Reset() { - *x = CallUpdateParticipantRemoved{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateParticipantRemoved) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateParticipantRemoved) ProtoMessage() {} - -func (x *CallUpdateParticipantRemoved) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateParticipantRemoved.ProtoReflect.Descriptor instead. -func (*CallUpdateParticipantRemoved) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{39} -} - -func (x *CallUpdateParticipantRemoved) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -func (x *CallUpdateParticipantRemoved) GetTimeout() bool { - if x != nil { - return x.Timeout - } - return false -} - -// CallUpdateCallPreview -type CallUpdateCallPreview struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *CallUpdateCallPreview) Reset() { - *x = CallUpdateCallPreview{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateCallPreview) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateCallPreview) ProtoMessage() {} - -func (x *CallUpdateCallPreview) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateCallPreview.ProtoReflect.Descriptor instead. -func (*CallUpdateCallPreview) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{40} -} - -func (x *CallUpdateCallPreview) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *CallUpdateCallPreview) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// CallUpdateCallCancelled -type CallUpdateCallCancelled struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *CallUpdateCallCancelled) Reset() { - *x = CallUpdateCallCancelled{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateCallCancelled) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateCallCancelled) ProtoMessage() {} - -func (x *CallUpdateCallCancelled) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateCallCancelled.ProtoReflect.Descriptor instead. -func (*CallUpdateCallCancelled) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{41} -} - -func (x *CallUpdateCallCancelled) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// CallUpdateCallJoinRequested -type CallUpdateCallJoinRequested struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - CalleeID int64 `protobuf:"varint,2,opt,name=CalleeID,proto3" json:"CalleeID,omitempty"` - Peer *InputPeer `protobuf:"bytes,3,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *CallUpdateCallJoinRequested) Reset() { - *x = CallUpdateCallJoinRequested{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateCallJoinRequested) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateCallJoinRequested) ProtoMessage() {} - -func (x *CallUpdateCallJoinRequested) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[42] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateCallJoinRequested.ProtoReflect.Descriptor instead. -func (*CallUpdateCallJoinRequested) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{42} -} - -func (x *CallUpdateCallJoinRequested) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *CallUpdateCallJoinRequested) GetCalleeID() int64 { - if x != nil { - return x.CalleeID - } - return 0 -} - -func (x *CallUpdateCallJoinRequested) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// CallUpdateParticipantAdminUpdated -type CallUpdateParticipantAdminUpdated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Admin bool `protobuf:"varint,2,opt,name=Admin,proto3" json:"Admin,omitempty"` -} - -func (x *CallUpdateParticipantAdminUpdated) Reset() { - *x = CallUpdateParticipantAdminUpdated{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateParticipantAdminUpdated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateParticipantAdminUpdated) ProtoMessage() {} - -func (x *CallUpdateParticipantAdminUpdated) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateParticipantAdminUpdated.ProtoReflect.Descriptor instead. -func (*CallUpdateParticipantAdminUpdated) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{43} -} - -func (x *CallUpdateParticipantAdminUpdated) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *CallUpdateParticipantAdminUpdated) GetAdmin() bool { - if x != nil { - return x.Admin - } - return false -} - -// CallUpdateShareScreenStreamUpdated -type CallUpdateShareScreenStreamUpdated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - ConnectionID int32 `protobuf:"varint,2,opt,name=ConnectionID,proto3" json:"ConnectionID,omitempty"` - StreamID string `protobuf:"bytes,3,opt,name=StreamID,proto3" json:"StreamID,omitempty"` -} - -func (x *CallUpdateShareScreenStreamUpdated) Reset() { - *x = CallUpdateShareScreenStreamUpdated{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateShareScreenStreamUpdated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateShareScreenStreamUpdated) ProtoMessage() {} - -func (x *CallUpdateShareScreenStreamUpdated) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateShareScreenStreamUpdated.ProtoReflect.Descriptor instead. -func (*CallUpdateShareScreenStreamUpdated) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{44} -} - -func (x *CallUpdateShareScreenStreamUpdated) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *CallUpdateShareScreenStreamUpdated) GetConnectionID() int32 { - if x != nil { - return x.ConnectionID - } - return 0 -} - -func (x *CallUpdateShareScreenStreamUpdated) GetStreamID() string { - if x != nil { - return x.StreamID - } - return "" -} - -// CallUpdateAllConnected -type CallUpdateAllConnected struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *CallUpdateAllConnected) Reset() { - *x = CallUpdateAllConnected{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateAllConnected) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateAllConnected) ProtoMessage() {} - -func (x *CallUpdateAllConnected) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateAllConnected.ProtoReflect.Descriptor instead. -func (*CallUpdateAllConnected) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{45} -} - -// CallUpdateConnectionStatusChanged -type CallUpdateConnectionStatusChanged struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnectionID int32 `protobuf:"varint,1,opt,name=ConnectionID,proto3" json:"ConnectionID,omitempty"` - State string `protobuf:"bytes,2,opt,name=State,proto3" json:"State,omitempty"` -} - -func (x *CallUpdateConnectionStatusChanged) Reset() { - *x = CallUpdateConnectionStatusChanged{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateConnectionStatusChanged) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateConnectionStatusChanged) ProtoMessage() {} - -func (x *CallUpdateConnectionStatusChanged) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateConnectionStatusChanged.ProtoReflect.Descriptor instead. -func (*CallUpdateConnectionStatusChanged) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{46} -} - -func (x *CallUpdateConnectionStatusChanged) GetConnectionID() int32 { - if x != nil { - return x.ConnectionID - } - return 0 -} - -func (x *CallUpdateConnectionStatusChanged) GetState() string { - if x != nil { - return x.State - } - return "" -} - -// CallUpdateParticipantMuted -type CallUpdateParticipantMuted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ConnectionID int32 `protobuf:"varint,1,opt,name=ConnectionID,proto3" json:"ConnectionID,omitempty"` - Muted bool `protobuf:"varint,2,opt,name=Muted,proto3" json:"Muted,omitempty"` - UserID int64 `protobuf:"varint,3,opt,name=UserID,proto3" json:"UserID,omitempty"` -} - -func (x *CallUpdateParticipantMuted) Reset() { - *x = CallUpdateParticipantMuted{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateParticipantMuted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateParticipantMuted) ProtoMessage() {} - -func (x *CallUpdateParticipantMuted) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateParticipantMuted.ProtoReflect.Descriptor instead. -func (*CallUpdateParticipantMuted) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{47} -} - -func (x *CallUpdateParticipantMuted) GetConnectionID() int32 { - if x != nil { - return x.ConnectionID - } - return 0 -} - -func (x *CallUpdateParticipantMuted) GetMuted() bool { - if x != nil { - return x.Muted - } - return false -} - -func (x *CallUpdateParticipantMuted) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -// CallUpdateCallDestroyed -type CallUpdateCallDestroyed struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` -} - -func (x *CallUpdateCallDestroyed) Reset() { - *x = CallUpdateCallDestroyed{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateCallDestroyed) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateCallDestroyed) ProtoMessage() {} - -func (x *CallUpdateCallDestroyed) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateCallDestroyed.ProtoReflect.Descriptor instead. -func (*CallUpdateCallDestroyed) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{48} -} - -func (x *CallUpdateCallDestroyed) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -// CallUpdateLocalMediaSettingsUpdated -type CallUpdateLocalMediaSettingsUpdated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MediaSettings *CallMediaSettings `protobuf:"bytes,1,opt,name=MediaSettings,proto3" json:"MediaSettings,omitempty"` -} - -func (x *CallUpdateLocalMediaSettingsUpdated) Reset() { - *x = CallUpdateLocalMediaSettingsUpdated{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateLocalMediaSettingsUpdated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateLocalMediaSettingsUpdated) ProtoMessage() {} - -func (x *CallUpdateLocalMediaSettingsUpdated) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[49] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateLocalMediaSettingsUpdated.ProtoReflect.Descriptor instead. -func (*CallUpdateLocalMediaSettingsUpdated) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{49} -} - -func (x *CallUpdateLocalMediaSettingsUpdated) GetMediaSettings() *CallMediaSettings { - if x != nil { - return x.MediaSettings - } - return nil -} - -// CallUpdateDestroyed -type CallUpdateDestroyed struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *CallUpdateDestroyed) Reset() { - *x = CallUpdateDestroyed{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[50] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateDestroyed) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateDestroyed) ProtoMessage() {} - -func (x *CallUpdateDestroyed) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[50] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateDestroyed.ProtoReflect.Descriptor instead. -func (*CallUpdateDestroyed) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{50} -} - -// CallStatusChanged -type CallUpdateStatusChanged struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CallID int64 `protobuf:"varint,1,opt,name=CallID,proto3" json:"CallID,omitempty"` - ConnId int32 `protobuf:"varint,2,opt,name=ConnId,proto3" json:"ConnId,omitempty"` - Status CallStatus `protobuf:"varint,3,opt,name=Status,proto3,enum=msg.CallStatus" json:"Status,omitempty"` -} - -func (x *CallUpdateStatusChanged) Reset() { - *x = CallUpdateStatusChanged{} - if protoimpl.UnsafeEnabled { - mi := &file_client_call_proto_msgTypes[51] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CallUpdateStatusChanged) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CallUpdateStatusChanged) ProtoMessage() {} - -func (x *CallUpdateStatusChanged) ProtoReflect() protoreflect.Message { - mi := &file_client_call_proto_msgTypes[51] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CallUpdateStatusChanged.ProtoReflect.Descriptor instead. -func (*CallUpdateStatusChanged) Descriptor() ([]byte, []int) { - return file_client_call_proto_rawDescGZIP(), []int{51} -} - -func (x *CallUpdateStatusChanged) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *CallUpdateStatusChanged) GetConnId() int32 { - if x != nil { - return x.ConnId - } - return 0 -} - -func (x *CallUpdateStatusChanged) GetStatus() CallStatus { - if x != nil { - return x.Status - } - return CallStatus_Empty -} - -var File_client_call_proto protoreflect.FileDescriptor - -var file_client_call_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x61, 0x6c, 0x6c, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x70, - 0x68, 0x6f, 0x6e, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x15, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x22, 0x2d, 0x0a, 0x15, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x54, 0x6f, 0x67, 0x67, 0x6c, 0x65, 0x41, - 0x75, 0x64, 0x69, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x05, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x22, 0x30, 0x0a, 0x16, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x54, 0x72, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x22, 0x2b, 0x0a, 0x11, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, - 0x79, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x17, 0x0a, 0x15, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x72, 0x65, 0x41, 0x6c, 0x6c, 0x41, 0x75, 0x64, - 0x69, 0x6f, 0x22, 0x6c, 0x0a, 0x1a, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, - 0x53, 0x65, 0x6e, 0x64, 0x49, 0x63, 0x65, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x09, 0x43, 0x61, 0x6e, 0x64, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x54, 0x43, 0x49, 0x63, 0x65, 0x43, 0x61, 0x6e, 0x64, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x09, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, - 0x22, 0x8f, 0x01, 0x0a, 0x21, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x53, - 0x65, 0x6e, 0x64, 0x49, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x48, 0x61, 0x73, 0x49, 0x63, 0x65, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x48, 0x61, 0x73, 0x49, 0x63, - 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x63, 0x65, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x49, 0x63, 0x65, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x22, 0x49, 0x0a, 0x13, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, - 0x53, 0x65, 0x6e, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6e, - 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, - 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x22, 0x2b, 0x0a, - 0x11, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x65, 0x6e, 0x64, 0x41, - 0x63, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x5b, 0x0a, 0x1b, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x3c, 0x0a, 0x0d, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x0d, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x2f, 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x47, 0x65, 0x74, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x93, 0x01, 0x0a, 0x0f, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x22, 0x0a, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x12, 0x2e, 0x0a, 0x0a, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x0a, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, - 0x12, 0x14, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x2b, - 0x0a, 0x11, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x72, - 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x30, 0x0a, 0x12, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4c, 0x0a, - 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x4a, 0x6f, 0x69, 0x6e, 0x12, - 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, - 0x65, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x40, 0x0a, 0x10, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x22, 0xb8, 0x01, - 0x0a, 0x10, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6a, 0x65, - 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x44, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x06, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x69, 0x73, - 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x52, 0x65, 0x61, 0x73, - 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x05, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x22, 0x52, 0x0a, 0x20, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x47, 0x65, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x42, 0x79, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, - 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, - 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0x3a, 0x0a, 0x20, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x47, 0x65, 0x74, 0x50, 0x61, 0x72, - 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x42, 0x79, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, - 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x22, 0x5e, 0x0a, 0x1c, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x47, 0x65, 0x74, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, - 0x12, 0x26, 0x0a, 0x0e, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x43, 0x75, 0x72, 0x72, 0x65, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x45, 0x78, 0x63, 0x6c, 0x75, 0x64, - 0x65, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x22, 0x49, 0x0a, 0x19, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x4d, 0x75, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, - 0x05, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x4d, 0x75, - 0x74, 0x65, 0x64, 0x22, 0x6b, 0x0a, 0x1d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, - 0x6c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x0c, - 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, - 0x65, 0x72, 0x52, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, - 0x22, 0x6e, 0x0a, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x52, 0x07, 0x55, - 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x22, 0x62, 0x0a, 0x1a, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x16, - 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, - 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, - 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x41, - 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x61, 0x0a, 0x11, 0x43, 0x61, 0x6c, 0x6c, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x75, 0x64, - 0x69, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x12, - 0x20, 0x0a, 0x0b, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x53, 0x68, 0x61, 0x72, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x22, 0xf7, 0x01, 0x0a, 0x0f, 0x43, 0x61, 0x6c, 0x6c, - 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x10, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, - 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x10, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x33, - 0x0a, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x3c, 0x0a, 0x0d, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, - 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x52, 0x0d, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x05, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x74, 0x61, 0x72, 0x74, - 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, - 0x64, 0x22, 0x54, 0x0a, 0x10, 0x43, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x40, 0x0a, 0x10, 0x43, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x72, - 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, - 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x10, 0x43, 0x61, 0x6c, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x69, - 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x9d, 0x01, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, - 0x52, 0x54, 0x43, 0x49, 0x63, 0x65, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x12, 0x24, 0x0a, - 0x0d, 0x53, 0x64, 0x70, 0x4d, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x53, 0x64, 0x70, 0x4d, 0x4c, 0x69, 0x6e, 0x65, 0x49, 0x6e, - 0x64, 0x65, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x64, 0x70, 0x4d, 0x69, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x64, 0x70, 0x4d, 0x69, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x55, - 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x46, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x46, - 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0xee, 0x03, 0x0a, 0x0e, 0x43, 0x61, 0x6c, 0x6c, - 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, - 0x6e, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x6e, - 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x12, 0x30, - 0x0a, 0x13, 0x52, 0x54, 0x43, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x52, 0x54, 0x43, - 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, - 0x12, 0x2e, 0x0a, 0x12, 0x49, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x49, 0x63, - 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x12, 0x34, 0x0a, 0x08, 0x49, 0x63, 0x65, 0x51, 0x75, 0x65, 0x75, 0x65, 0x18, 0x05, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x54, 0x43, - 0x49, 0x63, 0x65, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x08, 0x49, 0x63, - 0x65, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x2e, 0x0a, 0x0a, 0x49, 0x63, 0x65, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x49, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x0a, 0x49, 0x63, 0x65, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x54, 0x72, - 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x54, 0x72, 0x79, 0x12, 0x22, 0x0a, 0x0c, - 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0c, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, - 0x12, 0x28, 0x0a, 0x0f, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, - 0x54, 0x72, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x52, 0x65, 0x63, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x72, 0x79, 0x12, 0x30, 0x0a, 0x13, 0x53, 0x63, - 0x72, 0x65, 0x65, 0x6e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, - 0x44, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x76, 0x61, 0x6c, 0x49, 0x44, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x49, 0x44, 0x22, 0x6f, 0x0a, 0x17, 0x43, 0x61, 0x6c, 0x6c, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, - 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, - 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, - 0x6c, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x05, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x22, 0x3c, 0x0a, 0x16, 0x43, 0x61, 0x6c, - 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x63, 0x63, 0x65, 0x70, - 0x74, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x22, 0x59, 0x0a, 0x17, 0x43, 0x61, 0x6c, 0x6c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x49, 0x44, 0x22, 0x60, 0x0a, 0x16, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x06, - 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x06, 0x52, 0x65, 0x61, 0x73, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, - 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x06, 0x52, 0x65, - 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x82, 0x01, 0x0a, 0x1e, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x3c, 0x0a, 0x0d, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x0d, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x3a, 0x0a, 0x1c, 0x43, 0x61, 0x6c, - 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x49, 0x44, 0x22, 0x17, 0x0a, 0x15, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x37, - 0x0a, 0x11, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, - 0x41, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x22, 0x3b, 0x0a, 0x1b, 0x43, 0x61, 0x6c, 0x6c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, - 0x4a, 0x6f, 0x69, 0x6e, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x55, 0x73, 0x65, - 0x72, 0x49, 0x44, 0x73, 0x22, 0x37, 0x0a, 0x19, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4c, 0x65, 0x66, - 0x74, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0x56, 0x0a, - 0x1c, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, - 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x1c, 0x0a, - 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, - 0x30, 0x01, 0x52, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x54, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x54, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x57, 0x0a, 0x15, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x12, 0x1a, - 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, - 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x22, 0x35, - 0x0a, 0x17, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, - 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, - 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x22, 0x7d, 0x0a, 0x1b, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, - 0x12, 0x1e, 0x0a, 0x08, 0x43, 0x61, 0x6c, 0x6c, 0x65, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x08, 0x43, 0x61, 0x6c, 0x6c, 0x65, 0x65, 0x49, 0x44, - 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x22, 0x55, 0x0a, 0x21, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x64, 0x6d, - 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, - 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, - 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x80, 0x01, 0x0a, 0x22, - 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x53, - 0x63, 0x72, 0x65, 0x65, 0x6e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x22, - 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x22, 0x18, - 0x0a, 0x16, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x6c, 0x6c, 0x43, - 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x22, 0x5d, 0x0a, 0x21, 0x43, 0x61, 0x6c, 0x6c, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x22, 0x0a, - 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, - 0x44, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x72, 0x0a, 0x1a, 0x43, 0x61, 0x6c, 0x6c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, - 0x4d, 0x75, 0x74, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x43, 0x6f, 0x6e, - 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x75, 0x74, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x4d, 0x75, 0x74, 0x65, 0x64, 0x12, - 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0x35, 0x0a, 0x17, 0x43, - 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x73, - 0x74, 0x72, 0x6f, 0x79, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, - 0x49, 0x44, 0x22, 0x63, 0x0a, 0x23, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, - 0x67, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x3c, 0x0a, 0x0d, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x0d, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x15, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x65, 0x64, 0x22, 0x76, - 0x0a, 0x17, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, 0x6c, - 0x6c, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x43, - 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x6e, 0x49, 0x64, 0x12, 0x27, 0x0a, - 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 0x86, 0x05, 0x0a, 0x0a, 0x43, 0x61, 0x6c, 0x6c, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x43, 0x61, 0x6c, 0x6c, 0x41, - 0x63, 0x63, 0x65, 0x70, 0x74, 0x65, 0x64, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, - 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x65, 0x64, 0x10, 0x04, 0x12, 0x18, - 0x0a, 0x14, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x10, 0x05, 0x12, 0x16, 0x0a, 0x12, 0x4c, 0x6f, 0x63, 0x61, - 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x10, 0x06, - 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x61, 0x6c, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x10, - 0x07, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x63, 0x6b, 0x10, 0x08, 0x12, 0x15, - 0x0a, 0x11, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4a, 0x6f, 0x69, - 0x6e, 0x65, 0x64, 0x10, 0x09, 0x12, 0x13, 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x4c, 0x65, 0x66, 0x74, 0x10, 0x0a, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x61, - 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x65, 0x64, 0x10, 0x0b, - 0x12, 0x16, 0x0a, 0x12, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, - 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x10, 0x0c, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x61, 0x6c, 0x6c, - 0x50, 0x72, 0x65, 0x76, 0x69, 0x65, 0x77, 0x10, 0x0d, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x61, 0x6c, - 0x6c, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x64, 0x10, 0x0e, 0x12, 0x15, 0x0a, 0x11, - 0x43, 0x61, 0x6c, 0x6c, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, - 0x64, 0x10, 0x0f, 0x12, 0x1b, 0x0a, 0x17, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, - 0x6e, 0x74, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x10, 0x10, - 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x68, 0x61, 0x72, 0x65, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x10, 0x11, 0x12, 0x10, - 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x10, 0x12, - 0x12, 0x1b, 0x0a, 0x17, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x10, 0x13, 0x12, 0x14, 0x0a, - 0x10, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4d, 0x75, 0x74, 0x65, - 0x64, 0x10, 0x14, 0x12, 0x11, 0x0a, 0x0d, 0x43, 0x61, 0x6c, 0x6c, 0x44, 0x65, 0x73, 0x74, 0x72, - 0x6f, 0x79, 0x65, 0x64, 0x10, 0x15, 0x12, 0x1d, 0x0a, 0x19, 0x4c, 0x6f, 0x63, 0x61, 0x6c, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x64, 0x10, 0x16, 0x12, 0x0d, 0x0a, 0x09, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, - 0x65, 0x64, 0x10, 0x17, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x10, 0x18, 0x12, 0x17, 0x0a, 0x13, 0x43, - 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x36, 0x10, 0x19, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x37, 0x10, 0x1a, 0x12, 0x17, 0x0a, - 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x38, 0x10, 0x1b, 0x12, 0x17, 0x0a, 0x13, 0x43, 0x61, 0x6c, 0x6c, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x39, 0x10, 0x1c, 0x2a, - 0xd9, 0x01, 0x0a, 0x0a, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09, - 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x61, 0x6c, - 0x6c, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x69, 0x6e, 0x67, 0x69, 0x6e, - 0x67, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6e, - 0x67, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, - 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, - 0x6e, 0x67, 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x06, - 0x12, 0x09, 0x0a, 0x05, 0x45, 0x6e, 0x64, 0x65, 0x64, 0x10, 0x07, 0x12, 0x16, 0x0a, 0x12, 0x43, - 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x32, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x33, 0x10, 0x09, 0x12, 0x16, 0x0a, 0x12, 0x43, - 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x34, 0x10, 0x0a, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x35, 0x10, 0x0b, 0x42, 0x08, 0x5a, 0x06, 0x2e, - 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_client_call_proto_rawDescOnce sync.Once - file_client_call_proto_rawDescData = file_client_call_proto_rawDesc -) - -func file_client_call_proto_rawDescGZIP() []byte { - file_client_call_proto_rawDescOnce.Do(func() { - file_client_call_proto_rawDescData = protoimpl.X.CompressGZIP(file_client_call_proto_rawDescData) - }) - return file_client_call_proto_rawDescData -} - -var file_client_call_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_client_call_proto_msgTypes = make([]protoimpl.MessageInfo, 52) -var file_client_call_proto_goTypes = []interface{}{ - (CallUpdate)(0), // 0: msg.CallUpdate - (CallStatus)(0), // 1: msg.CallStatus - (*ClientCallToggleVideo)(nil), // 2: msg.ClientCallToggleVideo - (*ClientCallToggleAudio)(nil), // 3: msg.ClientCallToggleAudio - (*ClientCallTryReconnect)(nil), // 4: msg.ClientCallTryReconnect - (*ClientCallDestroy)(nil), // 5: msg.ClientCallDestroy - (*ClientCallAreAllAudio)(nil), // 6: msg.ClientCallAreAllAudio - (*ClientCallSendIceCandidate)(nil), // 7: msg.ClientCallSendIceCandidate - (*ClientCallSendIceConnectionStatus)(nil), // 8: msg.ClientCallSendIceConnectionStatus - (*ClientCallSendTrack)(nil), // 9: msg.ClientCallSendTrack - (*ClientCallSendAck)(nil), // 10: msg.ClientCallSendAck - (*ClientCallSendMediaSettings)(nil), // 11: msg.ClientCallSendMediaSettings - (*ClientCallGetDuration)(nil), // 12: msg.ClientCallGetDuration - (*ClientCallStart)(nil), // 13: msg.ClientCallStart - (*ClientCallStarted)(nil), // 14: msg.ClientCallStarted - (*ClientCallDuration)(nil), // 15: msg.ClientCallDuration - (*ClientCallJoin)(nil), // 16: msg.ClientCallJoin - (*ClientCallAccept)(nil), // 17: msg.ClientCallAccept - (*ClientCallReject)(nil), // 18: msg.ClientCallReject - (*ClientCallGetParticipantByUserID)(nil), // 19: msg.ClientCallGetParticipantByUserID - (*ClientCallGetParticipantByConnId)(nil), // 20: msg.ClientCallGetParticipantByConnId - (*ClientCallGetParticipantList)(nil), // 21: msg.ClientCallGetParticipantList - (*ClientCallMuteParticipant)(nil), // 22: msg.ClientCallMuteParticipant - (*ClientCallGroupAddParticipant)(nil), // 23: msg.ClientCallGroupAddParticipant - (*ClientCallGroupRemoveParticipant)(nil), // 24: msg.ClientCallGroupRemoveParticipant - (*ClientCallGroupUpdateAdmin)(nil), // 25: msg.ClientCallGroupUpdateAdmin - (*CallMediaSettings)(nil), // 26: msg.CallMediaSettings - (*CallParticipant)(nil), // 27: msg.CallParticipant - (*CallParticipants)(nil), // 28: msg.CallParticipants - (*CallRTCIceCandidate)(nil), // 29: msg.CallRTCIceCandidate - (*CallConnection)(nil), // 30: msg.CallConnection - (*CallUpdateCallRequested)(nil), // 31: msg.CallUpdateCallRequested - (*CallUpdateCallAccepted)(nil), // 32: msg.CallUpdateCallAccepted - (*CallUpdateStreamUpdated)(nil), // 33: msg.CallUpdateStreamUpdated - (*CallUpdateCallRejected)(nil), // 34: msg.CallUpdateCallRejected - (*CallUpdateMediaSettingsUpdated)(nil), // 35: msg.CallUpdateMediaSettingsUpdated - (*CallUpdateLocalStreamUpdated)(nil), // 36: msg.CallUpdateLocalStreamUpdated - (*CallUpdateCallTimeout)(nil), // 37: msg.CallUpdateCallTimeout - (*CallUpdateCallAck)(nil), // 38: msg.CallUpdateCallAck - (*CallUpdateParticipantJoined)(nil), // 39: msg.CallUpdateParticipantJoined - (*CallUpdateParticipantLeft)(nil), // 40: msg.CallUpdateParticipantLeft - (*CallUpdateParticipantRemoved)(nil), // 41: msg.CallUpdateParticipantRemoved - (*CallUpdateCallPreview)(nil), // 42: msg.CallUpdateCallPreview - (*CallUpdateCallCancelled)(nil), // 43: msg.CallUpdateCallCancelled - (*CallUpdateCallJoinRequested)(nil), // 44: msg.CallUpdateCallJoinRequested - (*CallUpdateParticipantAdminUpdated)(nil), // 45: msg.CallUpdateParticipantAdminUpdated - (*CallUpdateShareScreenStreamUpdated)(nil), // 46: msg.CallUpdateShareScreenStreamUpdated - (*CallUpdateAllConnected)(nil), // 47: msg.CallUpdateAllConnected - (*CallUpdateConnectionStatusChanged)(nil), // 48: msg.CallUpdateConnectionStatusChanged - (*CallUpdateParticipantMuted)(nil), // 49: msg.CallUpdateParticipantMuted - (*CallUpdateCallDestroyed)(nil), // 50: msg.CallUpdateCallDestroyed - (*CallUpdateLocalMediaSettingsUpdated)(nil), // 51: msg.CallUpdateLocalMediaSettingsUpdated - (*CallUpdateDestroyed)(nil), // 52: msg.CallUpdateDestroyed - (*CallUpdateStatusChanged)(nil), // 53: msg.CallUpdateStatusChanged - (*InputPeer)(nil), // 54: msg.InputPeer - (*InputUser)(nil), // 55: msg.InputUser - (DiscardReason)(0), // 56: msg.DiscardReason - (*PhoneParticipant)(nil), // 57: msg.PhoneParticipant - (CallDeviceType)(0), // 58: msg.CallDeviceType - (*IceServer)(nil), // 59: msg.IceServer -} -var file_client_call_proto_depIdxs = []int32{ - 29, // 0: msg.ClientCallSendIceCandidate.Candidate:type_name -> msg.CallRTCIceCandidate - 26, // 1: msg.ClientCallSendMediaSettings.MediaSettings:type_name -> msg.CallMediaSettings - 54, // 2: msg.ClientCallStart.Peer:type_name -> msg.InputPeer - 55, // 3: msg.ClientCallStart.InputUsers:type_name -> msg.InputUser - 54, // 4: msg.ClientCallJoin.Peer:type_name -> msg.InputPeer - 56, // 5: msg.ClientCallReject.Reason:type_name -> msg.DiscardReason - 54, // 6: msg.ClientCallReject.TargetPeer:type_name -> msg.InputPeer - 55, // 7: msg.ClientCallGroupAddParticipant.Participants:type_name -> msg.InputUser - 57, // 8: msg.CallParticipant.PhoneParticipant:type_name -> msg.PhoneParticipant - 58, // 9: msg.CallParticipant.DeviceType:type_name -> msg.CallDeviceType - 26, // 10: msg.CallParticipant.MediaSettings:type_name -> msg.CallMediaSettings - 27, // 11: msg.CallParticipants.CallParticipants:type_name -> msg.CallParticipant - 29, // 12: msg.CallConnection.IceQueue:type_name -> msg.CallRTCIceCandidate - 59, // 13: msg.CallConnection.IceServers:type_name -> msg.IceServer - 54, // 14: msg.CallUpdateCallRequested.Peer:type_name -> msg.InputPeer - 56, // 15: msg.CallUpdateCallRejected.Reason:type_name -> msg.DiscardReason - 26, // 16: msg.CallUpdateMediaSettingsUpdated.MediaSettings:type_name -> msg.CallMediaSettings - 54, // 17: msg.CallUpdateCallPreview.Peer:type_name -> msg.InputPeer - 54, // 18: msg.CallUpdateCallJoinRequested.Peer:type_name -> msg.InputPeer - 26, // 19: msg.CallUpdateLocalMediaSettingsUpdated.MediaSettings:type_name -> msg.CallMediaSettings - 1, // 20: msg.CallUpdateStatusChanged.Status:type_name -> msg.CallStatus - 21, // [21:21] is the sub-list for method output_type - 21, // [21:21] is the sub-list for method input_type - 21, // [21:21] is the sub-list for extension type_name - 21, // [21:21] is the sub-list for extension extendee - 0, // [0:21] is the sub-list for field type_name -} - -func init() { file_client_call_proto_init() } -func file_client_call_proto_init() { - if File_client_call_proto != nil { - return - } - file_chat_phone_proto_init() - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_client_call_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallToggleVideo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallToggleAudio); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallTryReconnect); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallDestroy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallAreAllAudio); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallSendIceCandidate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallSendIceConnectionStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallSendTrack); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallSendAck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallSendMediaSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallGetDuration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallStart); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallStarted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallDuration); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallJoin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallAccept); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallReject); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallGetParticipantByUserID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallGetParticipantByConnId); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallGetParticipantList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallMuteParticipant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallGroupAddParticipant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallGroupRemoveParticipant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCallGroupUpdateAdmin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallMediaSettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallParticipant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallParticipants); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallRTCIceCandidate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallConnection); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateCallRequested); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateCallAccepted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateStreamUpdated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateCallRejected); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateMediaSettingsUpdated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateLocalStreamUpdated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateCallTimeout); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateCallAck); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateParticipantJoined); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateParticipantLeft); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateParticipantRemoved); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateCallPreview); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateCallCancelled); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateCallJoinRequested); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateParticipantAdminUpdated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateShareScreenStreamUpdated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateAllConnected); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateConnectionStatusChanged); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateParticipantMuted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateCallDestroyed); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateLocalMediaSettingsUpdated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateDestroyed); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_call_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CallUpdateStatusChanged); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_client_call_proto_rawDesc, - NumEnums: 2, - NumMessages: 52, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_client_call_proto_goTypes, - DependencyIndexes: file_client_call_proto_depIdxs, - EnumInfos: file_client_call_proto_enumTypes, - MessageInfos: file_client_call_proto_msgTypes, - }.Build() - File_client_call_proto = out.File - file_client_call_proto_rawDesc = nil - file_client_call_proto_goTypes = nil - file_client_call_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/client.call.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/client.call.rony.go deleted file mode 100644 index de887dc9..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/client.call.rony.go +++ /dev/null @@ -1,3317 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: client.call.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_ClientCallToggleVideo int64 = 2873625233 - -type poolClientCallToggleVideo struct { - pool sync.Pool -} - -func (p *poolClientCallToggleVideo) Get() *ClientCallToggleVideo { - x, ok := p.pool.Get().(*ClientCallToggleVideo) - if !ok { - x = &ClientCallToggleVideo{} - } - - return x -} - -func (p *poolClientCallToggleVideo) Put(x *ClientCallToggleVideo) { - if x == nil { - return - } - - x.Video = false - - p.pool.Put(x) -} - -var PoolClientCallToggleVideo = poolClientCallToggleVideo{} - -func (x *ClientCallToggleVideo) DeepCopy(z *ClientCallToggleVideo) { - z.Video = x.Video -} - -func (x *ClientCallToggleVideo) Clone() *ClientCallToggleVideo { - z := &ClientCallToggleVideo{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallToggleVideo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallToggleVideo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallToggleVideo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallToggleVideo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallToggleVideo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallToggleVideo, x) -} - -const C_ClientCallToggleAudio int64 = 3488802344 - -type poolClientCallToggleAudio struct { - pool sync.Pool -} - -func (p *poolClientCallToggleAudio) Get() *ClientCallToggleAudio { - x, ok := p.pool.Get().(*ClientCallToggleAudio) - if !ok { - x = &ClientCallToggleAudio{} - } - - return x -} - -func (p *poolClientCallToggleAudio) Put(x *ClientCallToggleAudio) { - if x == nil { - return - } - - x.Audio = false - - p.pool.Put(x) -} - -var PoolClientCallToggleAudio = poolClientCallToggleAudio{} - -func (x *ClientCallToggleAudio) DeepCopy(z *ClientCallToggleAudio) { - z.Audio = x.Audio -} - -func (x *ClientCallToggleAudio) Clone() *ClientCallToggleAudio { - z := &ClientCallToggleAudio{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallToggleAudio) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallToggleAudio) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallToggleAudio) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallToggleAudio) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallToggleAudio) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallToggleAudio, x) -} - -const C_ClientCallTryReconnect int64 = 346556278 - -type poolClientCallTryReconnect struct { - pool sync.Pool -} - -func (p *poolClientCallTryReconnect) Get() *ClientCallTryReconnect { - x, ok := p.pool.Get().(*ClientCallTryReconnect) - if !ok { - x = &ClientCallTryReconnect{} - } - - return x -} - -func (p *poolClientCallTryReconnect) Put(x *ClientCallTryReconnect) { - if x == nil { - return - } - - x.ConnId = 0 - - p.pool.Put(x) -} - -var PoolClientCallTryReconnect = poolClientCallTryReconnect{} - -func (x *ClientCallTryReconnect) DeepCopy(z *ClientCallTryReconnect) { - z.ConnId = x.ConnId -} - -func (x *ClientCallTryReconnect) Clone() *ClientCallTryReconnect { - z := &ClientCallTryReconnect{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallTryReconnect) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallTryReconnect) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallTryReconnect) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallTryReconnect) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallTryReconnect) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallTryReconnect, x) -} - -const C_ClientCallDestroy int64 = 3560765778 - -type poolClientCallDestroy struct { - pool sync.Pool -} - -func (p *poolClientCallDestroy) Get() *ClientCallDestroy { - x, ok := p.pool.Get().(*ClientCallDestroy) - if !ok { - x = &ClientCallDestroy{} - } - - return x -} - -func (p *poolClientCallDestroy) Put(x *ClientCallDestroy) { - if x == nil { - return - } - - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolClientCallDestroy = poolClientCallDestroy{} - -func (x *ClientCallDestroy) DeepCopy(z *ClientCallDestroy) { - z.CallID = x.CallID -} - -func (x *ClientCallDestroy) Clone() *ClientCallDestroy { - z := &ClientCallDestroy{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallDestroy) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallDestroy) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallDestroy) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallDestroy) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallDestroy) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallDestroy, x) -} - -const C_ClientCallAreAllAudio int64 = 4108555878 - -type poolClientCallAreAllAudio struct { - pool sync.Pool -} - -func (p *poolClientCallAreAllAudio) Get() *ClientCallAreAllAudio { - x, ok := p.pool.Get().(*ClientCallAreAllAudio) - if !ok { - x = &ClientCallAreAllAudio{} - } - - return x -} - -func (p *poolClientCallAreAllAudio) Put(x *ClientCallAreAllAudio) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolClientCallAreAllAudio = poolClientCallAreAllAudio{} - -func (x *ClientCallAreAllAudio) DeepCopy(z *ClientCallAreAllAudio) { -} - -func (x *ClientCallAreAllAudio) Clone() *ClientCallAreAllAudio { - z := &ClientCallAreAllAudio{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallAreAllAudio) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallAreAllAudio) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallAreAllAudio) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallAreAllAudio) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallAreAllAudio) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallAreAllAudio, x) -} - -const C_ClientCallSendIceCandidate int64 = 1007531716 - -type poolClientCallSendIceCandidate struct { - pool sync.Pool -} - -func (p *poolClientCallSendIceCandidate) Get() *ClientCallSendIceCandidate { - x, ok := p.pool.Get().(*ClientCallSendIceCandidate) - if !ok { - x = &ClientCallSendIceCandidate{} - } - - x.Candidate = PoolCallRTCIceCandidate.Get() - - return x -} - -func (p *poolClientCallSendIceCandidate) Put(x *ClientCallSendIceCandidate) { - if x == nil { - return - } - - x.ConnId = 0 - PoolCallRTCIceCandidate.Put(x.Candidate) - - p.pool.Put(x) -} - -var PoolClientCallSendIceCandidate = poolClientCallSendIceCandidate{} - -func (x *ClientCallSendIceCandidate) DeepCopy(z *ClientCallSendIceCandidate) { - z.ConnId = x.ConnId - if x.Candidate != nil { - if z.Candidate == nil { - z.Candidate = PoolCallRTCIceCandidate.Get() - } - x.Candidate.DeepCopy(z.Candidate) - } else { - PoolCallRTCIceCandidate.Put(z.Candidate) - z.Candidate = nil - } -} - -func (x *ClientCallSendIceCandidate) Clone() *ClientCallSendIceCandidate { - z := &ClientCallSendIceCandidate{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallSendIceCandidate) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallSendIceCandidate) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallSendIceCandidate) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallSendIceCandidate) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallSendIceCandidate) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallSendIceCandidate, x) -} - -const C_ClientCallSendIceConnectionStatus int64 = 3421647876 - -type poolClientCallSendIceConnectionStatus struct { - pool sync.Pool -} - -func (p *poolClientCallSendIceConnectionStatus) Get() *ClientCallSendIceConnectionStatus { - x, ok := p.pool.Get().(*ClientCallSendIceConnectionStatus) - if !ok { - x = &ClientCallSendIceConnectionStatus{} - } - - return x -} - -func (p *poolClientCallSendIceConnectionStatus) Put(x *ClientCallSendIceConnectionStatus) { - if x == nil { - return - } - - x.ConnId = 0 - x.State = "" - x.HasIceError = false - x.IceError = "" - - p.pool.Put(x) -} - -var PoolClientCallSendIceConnectionStatus = poolClientCallSendIceConnectionStatus{} - -func (x *ClientCallSendIceConnectionStatus) DeepCopy(z *ClientCallSendIceConnectionStatus) { - z.ConnId = x.ConnId - z.State = x.State - z.HasIceError = x.HasIceError - z.IceError = x.IceError -} - -func (x *ClientCallSendIceConnectionStatus) Clone() *ClientCallSendIceConnectionStatus { - z := &ClientCallSendIceConnectionStatus{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallSendIceConnectionStatus) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallSendIceConnectionStatus) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallSendIceConnectionStatus) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallSendIceConnectionStatus) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallSendIceConnectionStatus) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallSendIceConnectionStatus, x) -} - -const C_ClientCallSendTrack int64 = 2856076314 - -type poolClientCallSendTrack struct { - pool sync.Pool -} - -func (p *poolClientCallSendTrack) Get() *ClientCallSendTrack { - x, ok := p.pool.Get().(*ClientCallSendTrack) - if !ok { - x = &ClientCallSendTrack{} - } - - return x -} - -func (p *poolClientCallSendTrack) Put(x *ClientCallSendTrack) { - if x == nil { - return - } - - x.ConnId = 0 - x.StreamID = "" - - p.pool.Put(x) -} - -var PoolClientCallSendTrack = poolClientCallSendTrack{} - -func (x *ClientCallSendTrack) DeepCopy(z *ClientCallSendTrack) { - z.ConnId = x.ConnId - z.StreamID = x.StreamID -} - -func (x *ClientCallSendTrack) Clone() *ClientCallSendTrack { - z := &ClientCallSendTrack{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallSendTrack) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallSendTrack) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallSendTrack) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallSendTrack) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallSendTrack) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallSendTrack, x) -} - -const C_ClientCallSendAck int64 = 3339532851 - -type poolClientCallSendAck struct { - pool sync.Pool -} - -func (p *poolClientCallSendAck) Get() *ClientCallSendAck { - x, ok := p.pool.Get().(*ClientCallSendAck) - if !ok { - x = &ClientCallSendAck{} - } - - return x -} - -func (p *poolClientCallSendAck) Put(x *ClientCallSendAck) { - if x == nil { - return - } - - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolClientCallSendAck = poolClientCallSendAck{} - -func (x *ClientCallSendAck) DeepCopy(z *ClientCallSendAck) { - z.CallID = x.CallID -} - -func (x *ClientCallSendAck) Clone() *ClientCallSendAck { - z := &ClientCallSendAck{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallSendAck) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallSendAck) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallSendAck) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallSendAck) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallSendAck) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallSendAck, x) -} - -const C_ClientCallSendMediaSettings int64 = 2959794351 - -type poolClientCallSendMediaSettings struct { - pool sync.Pool -} - -func (p *poolClientCallSendMediaSettings) Get() *ClientCallSendMediaSettings { - x, ok := p.pool.Get().(*ClientCallSendMediaSettings) - if !ok { - x = &ClientCallSendMediaSettings{} - } - - x.MediaSettings = PoolCallMediaSettings.Get() - - return x -} - -func (p *poolClientCallSendMediaSettings) Put(x *ClientCallSendMediaSettings) { - if x == nil { - return - } - - PoolCallMediaSettings.Put(x.MediaSettings) - - p.pool.Put(x) -} - -var PoolClientCallSendMediaSettings = poolClientCallSendMediaSettings{} - -func (x *ClientCallSendMediaSettings) DeepCopy(z *ClientCallSendMediaSettings) { - if x.MediaSettings != nil { - if z.MediaSettings == nil { - z.MediaSettings = PoolCallMediaSettings.Get() - } - x.MediaSettings.DeepCopy(z.MediaSettings) - } else { - PoolCallMediaSettings.Put(z.MediaSettings) - z.MediaSettings = nil - } -} - -func (x *ClientCallSendMediaSettings) Clone() *ClientCallSendMediaSettings { - z := &ClientCallSendMediaSettings{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallSendMediaSettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallSendMediaSettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallSendMediaSettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallSendMediaSettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallSendMediaSettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallSendMediaSettings, x) -} - -const C_ClientCallGetDuration int64 = 2971494454 - -type poolClientCallGetDuration struct { - pool sync.Pool -} - -func (p *poolClientCallGetDuration) Get() *ClientCallGetDuration { - x, ok := p.pool.Get().(*ClientCallGetDuration) - if !ok { - x = &ClientCallGetDuration{} - } - - return x -} - -func (p *poolClientCallGetDuration) Put(x *ClientCallGetDuration) { - if x == nil { - return - } - - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolClientCallGetDuration = poolClientCallGetDuration{} - -func (x *ClientCallGetDuration) DeepCopy(z *ClientCallGetDuration) { - z.CallID = x.CallID -} - -func (x *ClientCallGetDuration) Clone() *ClientCallGetDuration { - z := &ClientCallGetDuration{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallGetDuration) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallGetDuration) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallGetDuration) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallGetDuration) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallGetDuration) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallGetDuration, x) -} - -const C_ClientCallStart int64 = 1041146964 - -type poolClientCallStart struct { - pool sync.Pool -} - -func (p *poolClientCallStart) Get() *ClientCallStart { - x, ok := p.pool.Get().(*ClientCallStart) - if !ok { - x = &ClientCallStart{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientCallStart) Put(x *ClientCallStart) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - for _, z := range x.InputUsers { - PoolInputUser.Put(z) - } - x.InputUsers = x.InputUsers[:0] - x.Video = false - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolClientCallStart = poolClientCallStart{} - -func (x *ClientCallStart) DeepCopy(z *ClientCallStart) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - for idx := range x.InputUsers { - if x.InputUsers[idx] == nil { - continue - } - xx := PoolInputUser.Get() - x.InputUsers[idx].DeepCopy(xx) - z.InputUsers = append(z.InputUsers, xx) - } - z.Video = x.Video - z.CallID = x.CallID -} - -func (x *ClientCallStart) Clone() *ClientCallStart { - z := &ClientCallStart{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallStart) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallStart) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallStart) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallStart) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallStart) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallStart, x) -} - -const C_ClientCallStarted int64 = 484502003 - -type poolClientCallStarted struct { - pool sync.Pool -} - -func (p *poolClientCallStarted) Get() *ClientCallStarted { - x, ok := p.pool.Get().(*ClientCallStarted) - if !ok { - x = &ClientCallStarted{} - } - - return x -} - -func (p *poolClientCallStarted) Put(x *ClientCallStarted) { - if x == nil { - return - } - - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolClientCallStarted = poolClientCallStarted{} - -func (x *ClientCallStarted) DeepCopy(z *ClientCallStarted) { - z.CallID = x.CallID -} - -func (x *ClientCallStarted) Clone() *ClientCallStarted { - z := &ClientCallStarted{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallStarted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallStarted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallStarted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallStarted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallStarted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallStarted, x) -} - -const C_ClientCallDuration int64 = 3292884691 - -type poolClientCallDuration struct { - pool sync.Pool -} - -func (p *poolClientCallDuration) Get() *ClientCallDuration { - x, ok := p.pool.Get().(*ClientCallDuration) - if !ok { - x = &ClientCallDuration{} - } - - return x -} - -func (p *poolClientCallDuration) Put(x *ClientCallDuration) { - if x == nil { - return - } - - x.Duration = 0 - - p.pool.Put(x) -} - -var PoolClientCallDuration = poolClientCallDuration{} - -func (x *ClientCallDuration) DeepCopy(z *ClientCallDuration) { - z.Duration = x.Duration -} - -func (x *ClientCallDuration) Clone() *ClientCallDuration { - z := &ClientCallDuration{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallDuration) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallDuration) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallDuration) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallDuration) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallDuration) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallDuration, x) -} - -const C_ClientCallJoin int64 = 2382593398 - -type poolClientCallJoin struct { - pool sync.Pool -} - -func (p *poolClientCallJoin) Get() *ClientCallJoin { - x, ok := p.pool.Get().(*ClientCallJoin) - if !ok { - x = &ClientCallJoin{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientCallJoin) Put(x *ClientCallJoin) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolClientCallJoin = poolClientCallJoin{} - -func (x *ClientCallJoin) DeepCopy(z *ClientCallJoin) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID -} - -func (x *ClientCallJoin) Clone() *ClientCallJoin { - z := &ClientCallJoin{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallJoin) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallJoin) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallJoin) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallJoin) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallJoin) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallJoin, x) -} - -const C_ClientCallAccept int64 = 2726334873 - -type poolClientCallAccept struct { - pool sync.Pool -} - -func (p *poolClientCallAccept) Get() *ClientCallAccept { - x, ok := p.pool.Get().(*ClientCallAccept) - if !ok { - x = &ClientCallAccept{} - } - - return x -} - -func (p *poolClientCallAccept) Put(x *ClientCallAccept) { - if x == nil { - return - } - - x.CallID = 0 - x.Video = false - - p.pool.Put(x) -} - -var PoolClientCallAccept = poolClientCallAccept{} - -func (x *ClientCallAccept) DeepCopy(z *ClientCallAccept) { - z.CallID = x.CallID - z.Video = x.Video -} - -func (x *ClientCallAccept) Clone() *ClientCallAccept { - z := &ClientCallAccept{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallAccept) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallAccept) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallAccept) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallAccept) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallAccept) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallAccept, x) -} - -const C_ClientCallReject int64 = 3026524692 - -type poolClientCallReject struct { - pool sync.Pool -} - -func (p *poolClientCallReject) Get() *ClientCallReject { - x, ok := p.pool.Get().(*ClientCallReject) - if !ok { - x = &ClientCallReject{} - } - - x.TargetPeer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientCallReject) Put(x *ClientCallReject) { - if x == nil { - return - } - - x.CallID = 0 - x.Duration = 0 - x.Reason = 0 - PoolInputPeer.Put(x.TargetPeer) - x.Force = false - - p.pool.Put(x) -} - -var PoolClientCallReject = poolClientCallReject{} - -func (x *ClientCallReject) DeepCopy(z *ClientCallReject) { - z.CallID = x.CallID - z.Duration = x.Duration - z.Reason = x.Reason - if x.TargetPeer != nil { - if z.TargetPeer == nil { - z.TargetPeer = PoolInputPeer.Get() - } - x.TargetPeer.DeepCopy(z.TargetPeer) - } else { - PoolInputPeer.Put(z.TargetPeer) - z.TargetPeer = nil - } - z.Force = x.Force -} - -func (x *ClientCallReject) Clone() *ClientCallReject { - z := &ClientCallReject{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallReject) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallReject) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallReject) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallReject) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallReject) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallReject, x) -} - -const C_ClientCallGetParticipantByUserID int64 = 1253505450 - -type poolClientCallGetParticipantByUserID struct { - pool sync.Pool -} - -func (p *poolClientCallGetParticipantByUserID) Get() *ClientCallGetParticipantByUserID { - x, ok := p.pool.Get().(*ClientCallGetParticipantByUserID) - if !ok { - x = &ClientCallGetParticipantByUserID{} - } - - return x -} - -func (p *poolClientCallGetParticipantByUserID) Put(x *ClientCallGetParticipantByUserID) { - if x == nil { - return - } - - x.CallID = 0 - x.UserID = 0 - - p.pool.Put(x) -} - -var PoolClientCallGetParticipantByUserID = poolClientCallGetParticipantByUserID{} - -func (x *ClientCallGetParticipantByUserID) DeepCopy(z *ClientCallGetParticipantByUserID) { - z.CallID = x.CallID - z.UserID = x.UserID -} - -func (x *ClientCallGetParticipantByUserID) Clone() *ClientCallGetParticipantByUserID { - z := &ClientCallGetParticipantByUserID{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallGetParticipantByUserID) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallGetParticipantByUserID) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallGetParticipantByUserID) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallGetParticipantByUserID) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallGetParticipantByUserID) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallGetParticipantByUserID, x) -} - -const C_ClientCallGetParticipantByConnId int64 = 3279593330 - -type poolClientCallGetParticipantByConnId struct { - pool sync.Pool -} - -func (p *poolClientCallGetParticipantByConnId) Get() *ClientCallGetParticipantByConnId { - x, ok := p.pool.Get().(*ClientCallGetParticipantByConnId) - if !ok { - x = &ClientCallGetParticipantByConnId{} - } - - return x -} - -func (p *poolClientCallGetParticipantByConnId) Put(x *ClientCallGetParticipantByConnId) { - if x == nil { - return - } - - x.ConnId = 0 - - p.pool.Put(x) -} - -var PoolClientCallGetParticipantByConnId = poolClientCallGetParticipantByConnId{} - -func (x *ClientCallGetParticipantByConnId) DeepCopy(z *ClientCallGetParticipantByConnId) { - z.ConnId = x.ConnId -} - -func (x *ClientCallGetParticipantByConnId) Clone() *ClientCallGetParticipantByConnId { - z := &ClientCallGetParticipantByConnId{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallGetParticipantByConnId) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallGetParticipantByConnId) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallGetParticipantByConnId) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallGetParticipantByConnId) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallGetParticipantByConnId) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallGetParticipantByConnId, x) -} - -const C_ClientCallGetParticipantList int64 = 348508034 - -type poolClientCallGetParticipantList struct { - pool sync.Pool -} - -func (p *poolClientCallGetParticipantList) Get() *ClientCallGetParticipantList { - x, ok := p.pool.Get().(*ClientCallGetParticipantList) - if !ok { - x = &ClientCallGetParticipantList{} - } - - return x -} - -func (p *poolClientCallGetParticipantList) Put(x *ClientCallGetParticipantList) { - if x == nil { - return - } - - x.CallID = 0 - x.ExcludeCurrent = false - - p.pool.Put(x) -} - -var PoolClientCallGetParticipantList = poolClientCallGetParticipantList{} - -func (x *ClientCallGetParticipantList) DeepCopy(z *ClientCallGetParticipantList) { - z.CallID = x.CallID - z.ExcludeCurrent = x.ExcludeCurrent -} - -func (x *ClientCallGetParticipantList) Clone() *ClientCallGetParticipantList { - z := &ClientCallGetParticipantList{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallGetParticipantList) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallGetParticipantList) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallGetParticipantList) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallGetParticipantList) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallGetParticipantList) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallGetParticipantList, x) -} - -const C_ClientCallMuteParticipant int64 = 2518831668 - -type poolClientCallMuteParticipant struct { - pool sync.Pool -} - -func (p *poolClientCallMuteParticipant) Get() *ClientCallMuteParticipant { - x, ok := p.pool.Get().(*ClientCallMuteParticipant) - if !ok { - x = &ClientCallMuteParticipant{} - } - - return x -} - -func (p *poolClientCallMuteParticipant) Put(x *ClientCallMuteParticipant) { - if x == nil { - return - } - - x.UserID = 0 - x.Muted = false - - p.pool.Put(x) -} - -var PoolClientCallMuteParticipant = poolClientCallMuteParticipant{} - -func (x *ClientCallMuteParticipant) DeepCopy(z *ClientCallMuteParticipant) { - z.UserID = x.UserID - z.Muted = x.Muted -} - -func (x *ClientCallMuteParticipant) Clone() *ClientCallMuteParticipant { - z := &ClientCallMuteParticipant{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallMuteParticipant) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallMuteParticipant) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallMuteParticipant) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallMuteParticipant) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallMuteParticipant) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallMuteParticipant, x) -} - -const C_ClientCallGroupAddParticipant int64 = 1850196430 - -type poolClientCallGroupAddParticipant struct { - pool sync.Pool -} - -func (p *poolClientCallGroupAddParticipant) Get() *ClientCallGroupAddParticipant { - x, ok := p.pool.Get().(*ClientCallGroupAddParticipant) - if !ok { - x = &ClientCallGroupAddParticipant{} - } - - return x -} - -func (p *poolClientCallGroupAddParticipant) Put(x *ClientCallGroupAddParticipant) { - if x == nil { - return - } - - x.CallID = 0 - for _, z := range x.Participants { - PoolInputUser.Put(z) - } - x.Participants = x.Participants[:0] - - p.pool.Put(x) -} - -var PoolClientCallGroupAddParticipant = poolClientCallGroupAddParticipant{} - -func (x *ClientCallGroupAddParticipant) DeepCopy(z *ClientCallGroupAddParticipant) { - z.CallID = x.CallID - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolInputUser.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } -} - -func (x *ClientCallGroupAddParticipant) Clone() *ClientCallGroupAddParticipant { - z := &ClientCallGroupAddParticipant{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallGroupAddParticipant) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallGroupAddParticipant) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallGroupAddParticipant) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallGroupAddParticipant) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallGroupAddParticipant) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallGroupAddParticipant, x) -} - -const C_ClientCallGroupRemoveParticipant int64 = 2417422237 - -type poolClientCallGroupRemoveParticipant struct { - pool sync.Pool -} - -func (p *poolClientCallGroupRemoveParticipant) Get() *ClientCallGroupRemoveParticipant { - x, ok := p.pool.Get().(*ClientCallGroupRemoveParticipant) - if !ok { - x = &ClientCallGroupRemoveParticipant{} - } - - return x -} - -func (p *poolClientCallGroupRemoveParticipant) Put(x *ClientCallGroupRemoveParticipant) { - if x == nil { - return - } - - x.CallID = 0 - x.UserIDs = x.UserIDs[:0] - x.Timeout = false - - p.pool.Put(x) -} - -var PoolClientCallGroupRemoveParticipant = poolClientCallGroupRemoveParticipant{} - -func (x *ClientCallGroupRemoveParticipant) DeepCopy(z *ClientCallGroupRemoveParticipant) { - z.CallID = x.CallID - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) - z.Timeout = x.Timeout -} - -func (x *ClientCallGroupRemoveParticipant) Clone() *ClientCallGroupRemoveParticipant { - z := &ClientCallGroupRemoveParticipant{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallGroupRemoveParticipant) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallGroupRemoveParticipant) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallGroupRemoveParticipant) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallGroupRemoveParticipant) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallGroupRemoveParticipant) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallGroupRemoveParticipant, x) -} - -const C_ClientCallGroupUpdateAdmin int64 = 3544832701 - -type poolClientCallGroupUpdateAdmin struct { - pool sync.Pool -} - -func (p *poolClientCallGroupUpdateAdmin) Get() *ClientCallGroupUpdateAdmin { - x, ok := p.pool.Get().(*ClientCallGroupUpdateAdmin) - if !ok { - x = &ClientCallGroupUpdateAdmin{} - } - - return x -} - -func (p *poolClientCallGroupUpdateAdmin) Put(x *ClientCallGroupUpdateAdmin) { - if x == nil { - return - } - - x.CallID = 0 - x.UserID = 0 - x.Admin = false - - p.pool.Put(x) -} - -var PoolClientCallGroupUpdateAdmin = poolClientCallGroupUpdateAdmin{} - -func (x *ClientCallGroupUpdateAdmin) DeepCopy(z *ClientCallGroupUpdateAdmin) { - z.CallID = x.CallID - z.UserID = x.UserID - z.Admin = x.Admin -} - -func (x *ClientCallGroupUpdateAdmin) Clone() *ClientCallGroupUpdateAdmin { - z := &ClientCallGroupUpdateAdmin{} - x.DeepCopy(z) - return z -} - -func (x *ClientCallGroupUpdateAdmin) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCallGroupUpdateAdmin) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCallGroupUpdateAdmin) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCallGroupUpdateAdmin) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCallGroupUpdateAdmin) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCallGroupUpdateAdmin, x) -} - -const C_CallMediaSettings int64 = 1147111688 - -type poolCallMediaSettings struct { - pool sync.Pool -} - -func (p *poolCallMediaSettings) Get() *CallMediaSettings { - x, ok := p.pool.Get().(*CallMediaSettings) - if !ok { - x = &CallMediaSettings{} - } - - return x -} - -func (p *poolCallMediaSettings) Put(x *CallMediaSettings) { - if x == nil { - return - } - - x.Audio = false - x.ScreenShare = false - x.Video = false - - p.pool.Put(x) -} - -var PoolCallMediaSettings = poolCallMediaSettings{} - -func (x *CallMediaSettings) DeepCopy(z *CallMediaSettings) { - z.Audio = x.Audio - z.ScreenShare = x.ScreenShare - z.Video = x.Video -} - -func (x *CallMediaSettings) Clone() *CallMediaSettings { - z := &CallMediaSettings{} - x.DeepCopy(z) - return z -} - -func (x *CallMediaSettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallMediaSettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallMediaSettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallMediaSettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallMediaSettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallMediaSettings, x) -} - -const C_CallParticipant int64 = 2652007354 - -type poolCallParticipant struct { - pool sync.Pool -} - -func (p *poolCallParticipant) Get() *CallParticipant { - x, ok := p.pool.Get().(*CallParticipant) - if !ok { - x = &CallParticipant{} - } - - x.PhoneParticipant = PoolPhoneParticipant.Get() - - x.MediaSettings = PoolCallMediaSettings.Get() - - return x -} - -func (p *poolCallParticipant) Put(x *CallParticipant) { - if x == nil { - return - } - - PoolPhoneParticipant.Put(x.PhoneParticipant) - x.DeviceType = 0 - PoolCallMediaSettings.Put(x.MediaSettings) - x.Muted = false - x.Started = false - - p.pool.Put(x) -} - -var PoolCallParticipant = poolCallParticipant{} - -func (x *CallParticipant) DeepCopy(z *CallParticipant) { - if x.PhoneParticipant != nil { - if z.PhoneParticipant == nil { - z.PhoneParticipant = PoolPhoneParticipant.Get() - } - x.PhoneParticipant.DeepCopy(z.PhoneParticipant) - } else { - PoolPhoneParticipant.Put(z.PhoneParticipant) - z.PhoneParticipant = nil - } - z.DeviceType = x.DeviceType - if x.MediaSettings != nil { - if z.MediaSettings == nil { - z.MediaSettings = PoolCallMediaSettings.Get() - } - x.MediaSettings.DeepCopy(z.MediaSettings) - } else { - PoolCallMediaSettings.Put(z.MediaSettings) - z.MediaSettings = nil - } - z.Muted = x.Muted - z.Started = x.Started -} - -func (x *CallParticipant) Clone() *CallParticipant { - z := &CallParticipant{} - x.DeepCopy(z) - return z -} - -func (x *CallParticipant) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallParticipant) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallParticipant) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallParticipant) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallParticipant) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallParticipant, x) -} - -const C_CallParticipants int64 = 807700466 - -type poolCallParticipants struct { - pool sync.Pool -} - -func (p *poolCallParticipants) Get() *CallParticipants { - x, ok := p.pool.Get().(*CallParticipants) - if !ok { - x = &CallParticipants{} - } - - return x -} - -func (p *poolCallParticipants) Put(x *CallParticipants) { - if x == nil { - return - } - - for _, z := range x.CallParticipants { - PoolCallParticipant.Put(z) - } - x.CallParticipants = x.CallParticipants[:0] - - p.pool.Put(x) -} - -var PoolCallParticipants = poolCallParticipants{} - -func (x *CallParticipants) DeepCopy(z *CallParticipants) { - for idx := range x.CallParticipants { - if x.CallParticipants[idx] == nil { - continue - } - xx := PoolCallParticipant.Get() - x.CallParticipants[idx].DeepCopy(xx) - z.CallParticipants = append(z.CallParticipants, xx) - } -} - -func (x *CallParticipants) Clone() *CallParticipants { - z := &CallParticipants{} - x.DeepCopy(z) - return z -} - -func (x *CallParticipants) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallParticipants) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallParticipants) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallParticipants) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallParticipants) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallParticipants, x) -} - -const C_CallRTCIceCandidate int64 = 2748774954 - -type poolCallRTCIceCandidate struct { - pool sync.Pool -} - -func (p *poolCallRTCIceCandidate) Get() *CallRTCIceCandidate { - x, ok := p.pool.Get().(*CallRTCIceCandidate) - if !ok { - x = &CallRTCIceCandidate{} - } - - return x -} - -func (p *poolCallRTCIceCandidate) Put(x *CallRTCIceCandidate) { - if x == nil { - return - } - - x.Candidate = "" - x.SdpMLineIndex = 0 - x.SdpMid = "" - x.UsernameFragment = "" - - p.pool.Put(x) -} - -var PoolCallRTCIceCandidate = poolCallRTCIceCandidate{} - -func (x *CallRTCIceCandidate) DeepCopy(z *CallRTCIceCandidate) { - z.Candidate = x.Candidate - z.SdpMLineIndex = x.SdpMLineIndex - z.SdpMid = x.SdpMid - z.UsernameFragment = x.UsernameFragment -} - -func (x *CallRTCIceCandidate) Clone() *CallRTCIceCandidate { - z := &CallRTCIceCandidate{} - x.DeepCopy(z) - return z -} - -func (x *CallRTCIceCandidate) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallRTCIceCandidate) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallRTCIceCandidate) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallRTCIceCandidate) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallRTCIceCandidate) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallRTCIceCandidate, x) -} - -const C_CallConnection int64 = 3450901888 - -type poolCallConnection struct { - pool sync.Pool -} - -func (p *poolCallConnection) Get() *CallConnection { - x, ok := p.pool.Get().(*CallConnection) - if !ok { - x = &CallConnection{} - } - - return x -} - -func (p *poolCallConnection) Put(x *CallConnection) { - if x == nil { - return - } - - x.ConnId = 0 - x.Accepted = false - x.RTCPeerConnectionID = 0 - x.IceConnectionState = "" - for _, z := range x.IceQueue { - PoolCallRTCIceCandidate.Put(z) - } - x.IceQueue = x.IceQueue[:0] - for _, z := range x.IceServers { - PoolIceServer.Put(z) - } - x.IceServers = x.IceServers[:0] - x.Init = false - x.Try = 0 - x.Reconnecting = false - x.ReconnectingTry = 0 - x.ScreenShareStreamID = 0 - x.StreamID = "" - x.IntervalID = 0 - - p.pool.Put(x) -} - -var PoolCallConnection = poolCallConnection{} - -func (x *CallConnection) DeepCopy(z *CallConnection) { - z.ConnId = x.ConnId - z.Accepted = x.Accepted - z.RTCPeerConnectionID = x.RTCPeerConnectionID - z.IceConnectionState = x.IceConnectionState - for idx := range x.IceQueue { - if x.IceQueue[idx] == nil { - continue - } - xx := PoolCallRTCIceCandidate.Get() - x.IceQueue[idx].DeepCopy(xx) - z.IceQueue = append(z.IceQueue, xx) - } - for idx := range x.IceServers { - if x.IceServers[idx] == nil { - continue - } - xx := PoolIceServer.Get() - x.IceServers[idx].DeepCopy(xx) - z.IceServers = append(z.IceServers, xx) - } - z.Init = x.Init - z.Try = x.Try - z.Reconnecting = x.Reconnecting - z.ReconnectingTry = x.ReconnectingTry - z.ScreenShareStreamID = x.ScreenShareStreamID - z.StreamID = x.StreamID - z.IntervalID = x.IntervalID -} - -func (x *CallConnection) Clone() *CallConnection { - z := &CallConnection{} - x.DeepCopy(z) - return z -} - -func (x *CallConnection) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallConnection) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallConnection) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallConnection) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallConnection) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallConnection, x) -} - -const C_CallUpdateCallRequested int64 = 2556114354 - -type poolCallUpdateCallRequested struct { - pool sync.Pool -} - -func (p *poolCallUpdateCallRequested) Get() *CallUpdateCallRequested { - x, ok := p.pool.Get().(*CallUpdateCallRequested) - if !ok { - x = &CallUpdateCallRequested{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolCallUpdateCallRequested) Put(x *CallUpdateCallRequested) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.CallID = 0 - x.Video = false - - p.pool.Put(x) -} - -var PoolCallUpdateCallRequested = poolCallUpdateCallRequested{} - -func (x *CallUpdateCallRequested) DeepCopy(z *CallUpdateCallRequested) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.CallID = x.CallID - z.Video = x.Video -} - -func (x *CallUpdateCallRequested) Clone() *CallUpdateCallRequested { - z := &CallUpdateCallRequested{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateCallRequested) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateCallRequested) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateCallRequested) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateCallRequested) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateCallRequested) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateCallRequested, x) -} - -const C_CallUpdateCallAccepted int64 = 2134109006 - -type poolCallUpdateCallAccepted struct { - pool sync.Pool -} - -func (p *poolCallUpdateCallAccepted) Get() *CallUpdateCallAccepted { - x, ok := p.pool.Get().(*CallUpdateCallAccepted) - if !ok { - x = &CallUpdateCallAccepted{} - } - - return x -} - -func (p *poolCallUpdateCallAccepted) Put(x *CallUpdateCallAccepted) { - if x == nil { - return - } - - x.ConnectionID = 0 - - p.pool.Put(x) -} - -var PoolCallUpdateCallAccepted = poolCallUpdateCallAccepted{} - -func (x *CallUpdateCallAccepted) DeepCopy(z *CallUpdateCallAccepted) { - z.ConnectionID = x.ConnectionID -} - -func (x *CallUpdateCallAccepted) Clone() *CallUpdateCallAccepted { - z := &CallUpdateCallAccepted{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateCallAccepted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateCallAccepted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateCallAccepted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateCallAccepted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateCallAccepted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateCallAccepted, x) -} - -const C_CallUpdateStreamUpdated int64 = 3496218809 - -type poolCallUpdateStreamUpdated struct { - pool sync.Pool -} - -func (p *poolCallUpdateStreamUpdated) Get() *CallUpdateStreamUpdated { - x, ok := p.pool.Get().(*CallUpdateStreamUpdated) - if !ok { - x = &CallUpdateStreamUpdated{} - } - - return x -} - -func (p *poolCallUpdateStreamUpdated) Put(x *CallUpdateStreamUpdated) { - if x == nil { - return - } - - x.ConnectionID = 0 - x.StreamID = "" - - p.pool.Put(x) -} - -var PoolCallUpdateStreamUpdated = poolCallUpdateStreamUpdated{} - -func (x *CallUpdateStreamUpdated) DeepCopy(z *CallUpdateStreamUpdated) { - z.ConnectionID = x.ConnectionID - z.StreamID = x.StreamID -} - -func (x *CallUpdateStreamUpdated) Clone() *CallUpdateStreamUpdated { - z := &CallUpdateStreamUpdated{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateStreamUpdated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateStreamUpdated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateStreamUpdated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateStreamUpdated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateStreamUpdated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateStreamUpdated, x) -} - -const C_CallUpdateCallRejected int64 = 2339651845 - -type poolCallUpdateCallRejected struct { - pool sync.Pool -} - -func (p *poolCallUpdateCallRejected) Get() *CallUpdateCallRejected { - x, ok := p.pool.Get().(*CallUpdateCallRejected) - if !ok { - x = &CallUpdateCallRejected{} - } - - return x -} - -func (p *poolCallUpdateCallRejected) Put(x *CallUpdateCallRejected) { - if x == nil { - return - } - - x.CallID = 0 - x.Reason = 0 - - p.pool.Put(x) -} - -var PoolCallUpdateCallRejected = poolCallUpdateCallRejected{} - -func (x *CallUpdateCallRejected) DeepCopy(z *CallUpdateCallRejected) { - z.CallID = x.CallID - z.Reason = x.Reason -} - -func (x *CallUpdateCallRejected) Clone() *CallUpdateCallRejected { - z := &CallUpdateCallRejected{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateCallRejected) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateCallRejected) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateCallRejected) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateCallRejected) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateCallRejected) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateCallRejected, x) -} - -const C_CallUpdateMediaSettingsUpdated int64 = 3922101985 - -type poolCallUpdateMediaSettingsUpdated struct { - pool sync.Pool -} - -func (p *poolCallUpdateMediaSettingsUpdated) Get() *CallUpdateMediaSettingsUpdated { - x, ok := p.pool.Get().(*CallUpdateMediaSettingsUpdated) - if !ok { - x = &CallUpdateMediaSettingsUpdated{} - } - - x.MediaSettings = PoolCallMediaSettings.Get() - - return x -} - -func (p *poolCallUpdateMediaSettingsUpdated) Put(x *CallUpdateMediaSettingsUpdated) { - if x == nil { - return - } - - x.ConnectionID = 0 - PoolCallMediaSettings.Put(x.MediaSettings) - - p.pool.Put(x) -} - -var PoolCallUpdateMediaSettingsUpdated = poolCallUpdateMediaSettingsUpdated{} - -func (x *CallUpdateMediaSettingsUpdated) DeepCopy(z *CallUpdateMediaSettingsUpdated) { - z.ConnectionID = x.ConnectionID - if x.MediaSettings != nil { - if z.MediaSettings == nil { - z.MediaSettings = PoolCallMediaSettings.Get() - } - x.MediaSettings.DeepCopy(z.MediaSettings) - } else { - PoolCallMediaSettings.Put(z.MediaSettings) - z.MediaSettings = nil - } -} - -func (x *CallUpdateMediaSettingsUpdated) Clone() *CallUpdateMediaSettingsUpdated { - z := &CallUpdateMediaSettingsUpdated{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateMediaSettingsUpdated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateMediaSettingsUpdated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateMediaSettingsUpdated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateMediaSettingsUpdated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateMediaSettingsUpdated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateMediaSettingsUpdated, x) -} - -const C_CallUpdateLocalStreamUpdated int64 = 1043624904 - -type poolCallUpdateLocalStreamUpdated struct { - pool sync.Pool -} - -func (p *poolCallUpdateLocalStreamUpdated) Get() *CallUpdateLocalStreamUpdated { - x, ok := p.pool.Get().(*CallUpdateLocalStreamUpdated) - if !ok { - x = &CallUpdateLocalStreamUpdated{} - } - - return x -} - -func (p *poolCallUpdateLocalStreamUpdated) Put(x *CallUpdateLocalStreamUpdated) { - if x == nil { - return - } - - x.StreamID = "" - - p.pool.Put(x) -} - -var PoolCallUpdateLocalStreamUpdated = poolCallUpdateLocalStreamUpdated{} - -func (x *CallUpdateLocalStreamUpdated) DeepCopy(z *CallUpdateLocalStreamUpdated) { - z.StreamID = x.StreamID -} - -func (x *CallUpdateLocalStreamUpdated) Clone() *CallUpdateLocalStreamUpdated { - z := &CallUpdateLocalStreamUpdated{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateLocalStreamUpdated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateLocalStreamUpdated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateLocalStreamUpdated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateLocalStreamUpdated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateLocalStreamUpdated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateLocalStreamUpdated, x) -} - -const C_CallUpdateCallTimeout int64 = 420503198 - -type poolCallUpdateCallTimeout struct { - pool sync.Pool -} - -func (p *poolCallUpdateCallTimeout) Get() *CallUpdateCallTimeout { - x, ok := p.pool.Get().(*CallUpdateCallTimeout) - if !ok { - x = &CallUpdateCallTimeout{} - } - - return x -} - -func (p *poolCallUpdateCallTimeout) Put(x *CallUpdateCallTimeout) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolCallUpdateCallTimeout = poolCallUpdateCallTimeout{} - -func (x *CallUpdateCallTimeout) DeepCopy(z *CallUpdateCallTimeout) { -} - -func (x *CallUpdateCallTimeout) Clone() *CallUpdateCallTimeout { - z := &CallUpdateCallTimeout{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateCallTimeout) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateCallTimeout) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateCallTimeout) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateCallTimeout) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateCallTimeout) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateCallTimeout, x) -} - -const C_CallUpdateCallAck int64 = 1424725011 - -type poolCallUpdateCallAck struct { - pool sync.Pool -} - -func (p *poolCallUpdateCallAck) Get() *CallUpdateCallAck { - x, ok := p.pool.Get().(*CallUpdateCallAck) - if !ok { - x = &CallUpdateCallAck{} - } - - return x -} - -func (p *poolCallUpdateCallAck) Put(x *CallUpdateCallAck) { - if x == nil { - return - } - - x.ConnectionID = 0 - - p.pool.Put(x) -} - -var PoolCallUpdateCallAck = poolCallUpdateCallAck{} - -func (x *CallUpdateCallAck) DeepCopy(z *CallUpdateCallAck) { - z.ConnectionID = x.ConnectionID -} - -func (x *CallUpdateCallAck) Clone() *CallUpdateCallAck { - z := &CallUpdateCallAck{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateCallAck) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateCallAck) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateCallAck) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateCallAck) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateCallAck) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateCallAck, x) -} - -const C_CallUpdateParticipantJoined int64 = 1005455524 - -type poolCallUpdateParticipantJoined struct { - pool sync.Pool -} - -func (p *poolCallUpdateParticipantJoined) Get() *CallUpdateParticipantJoined { - x, ok := p.pool.Get().(*CallUpdateParticipantJoined) - if !ok { - x = &CallUpdateParticipantJoined{} - } - - return x -} - -func (p *poolCallUpdateParticipantJoined) Put(x *CallUpdateParticipantJoined) { - if x == nil { - return - } - - x.UserIDs = x.UserIDs[:0] - - p.pool.Put(x) -} - -var PoolCallUpdateParticipantJoined = poolCallUpdateParticipantJoined{} - -func (x *CallUpdateParticipantJoined) DeepCopy(z *CallUpdateParticipantJoined) { - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) -} - -func (x *CallUpdateParticipantJoined) Clone() *CallUpdateParticipantJoined { - z := &CallUpdateParticipantJoined{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateParticipantJoined) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantJoined) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateParticipantJoined) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantJoined) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateParticipantJoined) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateParticipantJoined, x) -} - -const C_CallUpdateParticipantLeft int64 = 2062471712 - -type poolCallUpdateParticipantLeft struct { - pool sync.Pool -} - -func (p *poolCallUpdateParticipantLeft) Get() *CallUpdateParticipantLeft { - x, ok := p.pool.Get().(*CallUpdateParticipantLeft) - if !ok { - x = &CallUpdateParticipantLeft{} - } - - return x -} - -func (p *poolCallUpdateParticipantLeft) Put(x *CallUpdateParticipantLeft) { - if x == nil { - return - } - - x.UserID = 0 - - p.pool.Put(x) -} - -var PoolCallUpdateParticipantLeft = poolCallUpdateParticipantLeft{} - -func (x *CallUpdateParticipantLeft) DeepCopy(z *CallUpdateParticipantLeft) { - z.UserID = x.UserID -} - -func (x *CallUpdateParticipantLeft) Clone() *CallUpdateParticipantLeft { - z := &CallUpdateParticipantLeft{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateParticipantLeft) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantLeft) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateParticipantLeft) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantLeft) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateParticipantLeft) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateParticipantLeft, x) -} - -const C_CallUpdateParticipantRemoved int64 = 4138786615 - -type poolCallUpdateParticipantRemoved struct { - pool sync.Pool -} - -func (p *poolCallUpdateParticipantRemoved) Get() *CallUpdateParticipantRemoved { - x, ok := p.pool.Get().(*CallUpdateParticipantRemoved) - if !ok { - x = &CallUpdateParticipantRemoved{} - } - - return x -} - -func (p *poolCallUpdateParticipantRemoved) Put(x *CallUpdateParticipantRemoved) { - if x == nil { - return - } - - x.UserIDs = x.UserIDs[:0] - x.Timeout = false - - p.pool.Put(x) -} - -var PoolCallUpdateParticipantRemoved = poolCallUpdateParticipantRemoved{} - -func (x *CallUpdateParticipantRemoved) DeepCopy(z *CallUpdateParticipantRemoved) { - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) - z.Timeout = x.Timeout -} - -func (x *CallUpdateParticipantRemoved) Clone() *CallUpdateParticipantRemoved { - z := &CallUpdateParticipantRemoved{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateParticipantRemoved) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantRemoved) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateParticipantRemoved) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantRemoved) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateParticipantRemoved) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateParticipantRemoved, x) -} - -const C_CallUpdateCallPreview int64 = 567542844 - -type poolCallUpdateCallPreview struct { - pool sync.Pool -} - -func (p *poolCallUpdateCallPreview) Get() *CallUpdateCallPreview { - x, ok := p.pool.Get().(*CallUpdateCallPreview) - if !ok { - x = &CallUpdateCallPreview{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolCallUpdateCallPreview) Put(x *CallUpdateCallPreview) { - if x == nil { - return - } - - x.CallID = 0 - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolCallUpdateCallPreview = poolCallUpdateCallPreview{} - -func (x *CallUpdateCallPreview) DeepCopy(z *CallUpdateCallPreview) { - z.CallID = x.CallID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *CallUpdateCallPreview) Clone() *CallUpdateCallPreview { - z := &CallUpdateCallPreview{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateCallPreview) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateCallPreview) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateCallPreview) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateCallPreview) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateCallPreview) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateCallPreview, x) -} - -const C_CallUpdateCallCancelled int64 = 4194096602 - -type poolCallUpdateCallCancelled struct { - pool sync.Pool -} - -func (p *poolCallUpdateCallCancelled) Get() *CallUpdateCallCancelled { - x, ok := p.pool.Get().(*CallUpdateCallCancelled) - if !ok { - x = &CallUpdateCallCancelled{} - } - - return x -} - -func (p *poolCallUpdateCallCancelled) Put(x *CallUpdateCallCancelled) { - if x == nil { - return - } - - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolCallUpdateCallCancelled = poolCallUpdateCallCancelled{} - -func (x *CallUpdateCallCancelled) DeepCopy(z *CallUpdateCallCancelled) { - z.CallID = x.CallID -} - -func (x *CallUpdateCallCancelled) Clone() *CallUpdateCallCancelled { - z := &CallUpdateCallCancelled{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateCallCancelled) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateCallCancelled) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateCallCancelled) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateCallCancelled) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateCallCancelled) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateCallCancelled, x) -} - -const C_CallUpdateCallJoinRequested int64 = 945899454 - -type poolCallUpdateCallJoinRequested struct { - pool sync.Pool -} - -func (p *poolCallUpdateCallJoinRequested) Get() *CallUpdateCallJoinRequested { - x, ok := p.pool.Get().(*CallUpdateCallJoinRequested) - if !ok { - x = &CallUpdateCallJoinRequested{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolCallUpdateCallJoinRequested) Put(x *CallUpdateCallJoinRequested) { - if x == nil { - return - } - - x.CallID = 0 - x.CalleeID = 0 - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolCallUpdateCallJoinRequested = poolCallUpdateCallJoinRequested{} - -func (x *CallUpdateCallJoinRequested) DeepCopy(z *CallUpdateCallJoinRequested) { - z.CallID = x.CallID - z.CalleeID = x.CalleeID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *CallUpdateCallJoinRequested) Clone() *CallUpdateCallJoinRequested { - z := &CallUpdateCallJoinRequested{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateCallJoinRequested) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateCallJoinRequested) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateCallJoinRequested) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateCallJoinRequested) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateCallJoinRequested) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateCallJoinRequested, x) -} - -const C_CallUpdateParticipantAdminUpdated int64 = 2487316396 - -type poolCallUpdateParticipantAdminUpdated struct { - pool sync.Pool -} - -func (p *poolCallUpdateParticipantAdminUpdated) Get() *CallUpdateParticipantAdminUpdated { - x, ok := p.pool.Get().(*CallUpdateParticipantAdminUpdated) - if !ok { - x = &CallUpdateParticipantAdminUpdated{} - } - - return x -} - -func (p *poolCallUpdateParticipantAdminUpdated) Put(x *CallUpdateParticipantAdminUpdated) { - if x == nil { - return - } - - x.UserID = 0 - x.Admin = false - - p.pool.Put(x) -} - -var PoolCallUpdateParticipantAdminUpdated = poolCallUpdateParticipantAdminUpdated{} - -func (x *CallUpdateParticipantAdminUpdated) DeepCopy(z *CallUpdateParticipantAdminUpdated) { - z.UserID = x.UserID - z.Admin = x.Admin -} - -func (x *CallUpdateParticipantAdminUpdated) Clone() *CallUpdateParticipantAdminUpdated { - z := &CallUpdateParticipantAdminUpdated{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateParticipantAdminUpdated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantAdminUpdated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateParticipantAdminUpdated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantAdminUpdated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateParticipantAdminUpdated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateParticipantAdminUpdated, x) -} - -const C_CallUpdateShareScreenStreamUpdated int64 = 2763784404 - -type poolCallUpdateShareScreenStreamUpdated struct { - pool sync.Pool -} - -func (p *poolCallUpdateShareScreenStreamUpdated) Get() *CallUpdateShareScreenStreamUpdated { - x, ok := p.pool.Get().(*CallUpdateShareScreenStreamUpdated) - if !ok { - x = &CallUpdateShareScreenStreamUpdated{} - } - - return x -} - -func (p *poolCallUpdateShareScreenStreamUpdated) Put(x *CallUpdateShareScreenStreamUpdated) { - if x == nil { - return - } - - x.CallID = 0 - x.ConnectionID = 0 - x.StreamID = "" - - p.pool.Put(x) -} - -var PoolCallUpdateShareScreenStreamUpdated = poolCallUpdateShareScreenStreamUpdated{} - -func (x *CallUpdateShareScreenStreamUpdated) DeepCopy(z *CallUpdateShareScreenStreamUpdated) { - z.CallID = x.CallID - z.ConnectionID = x.ConnectionID - z.StreamID = x.StreamID -} - -func (x *CallUpdateShareScreenStreamUpdated) Clone() *CallUpdateShareScreenStreamUpdated { - z := &CallUpdateShareScreenStreamUpdated{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateShareScreenStreamUpdated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateShareScreenStreamUpdated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateShareScreenStreamUpdated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateShareScreenStreamUpdated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateShareScreenStreamUpdated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateShareScreenStreamUpdated, x) -} - -const C_CallUpdateAllConnected int64 = 1993183151 - -type poolCallUpdateAllConnected struct { - pool sync.Pool -} - -func (p *poolCallUpdateAllConnected) Get() *CallUpdateAllConnected { - x, ok := p.pool.Get().(*CallUpdateAllConnected) - if !ok { - x = &CallUpdateAllConnected{} - } - - return x -} - -func (p *poolCallUpdateAllConnected) Put(x *CallUpdateAllConnected) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolCallUpdateAllConnected = poolCallUpdateAllConnected{} - -func (x *CallUpdateAllConnected) DeepCopy(z *CallUpdateAllConnected) { -} - -func (x *CallUpdateAllConnected) Clone() *CallUpdateAllConnected { - z := &CallUpdateAllConnected{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateAllConnected) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateAllConnected) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateAllConnected) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateAllConnected) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateAllConnected) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateAllConnected, x) -} - -const C_CallUpdateConnectionStatusChanged int64 = 4028141073 - -type poolCallUpdateConnectionStatusChanged struct { - pool sync.Pool -} - -func (p *poolCallUpdateConnectionStatusChanged) Get() *CallUpdateConnectionStatusChanged { - x, ok := p.pool.Get().(*CallUpdateConnectionStatusChanged) - if !ok { - x = &CallUpdateConnectionStatusChanged{} - } - - return x -} - -func (p *poolCallUpdateConnectionStatusChanged) Put(x *CallUpdateConnectionStatusChanged) { - if x == nil { - return - } - - x.ConnectionID = 0 - x.State = "" - - p.pool.Put(x) -} - -var PoolCallUpdateConnectionStatusChanged = poolCallUpdateConnectionStatusChanged{} - -func (x *CallUpdateConnectionStatusChanged) DeepCopy(z *CallUpdateConnectionStatusChanged) { - z.ConnectionID = x.ConnectionID - z.State = x.State -} - -func (x *CallUpdateConnectionStatusChanged) Clone() *CallUpdateConnectionStatusChanged { - z := &CallUpdateConnectionStatusChanged{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateConnectionStatusChanged) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateConnectionStatusChanged) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateConnectionStatusChanged) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateConnectionStatusChanged) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateConnectionStatusChanged) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateConnectionStatusChanged, x) -} - -const C_CallUpdateParticipantMuted int64 = 2194386679 - -type poolCallUpdateParticipantMuted struct { - pool sync.Pool -} - -func (p *poolCallUpdateParticipantMuted) Get() *CallUpdateParticipantMuted { - x, ok := p.pool.Get().(*CallUpdateParticipantMuted) - if !ok { - x = &CallUpdateParticipantMuted{} - } - - return x -} - -func (p *poolCallUpdateParticipantMuted) Put(x *CallUpdateParticipantMuted) { - if x == nil { - return - } - - x.ConnectionID = 0 - x.Muted = false - x.UserID = 0 - - p.pool.Put(x) -} - -var PoolCallUpdateParticipantMuted = poolCallUpdateParticipantMuted{} - -func (x *CallUpdateParticipantMuted) DeepCopy(z *CallUpdateParticipantMuted) { - z.ConnectionID = x.ConnectionID - z.Muted = x.Muted - z.UserID = x.UserID -} - -func (x *CallUpdateParticipantMuted) Clone() *CallUpdateParticipantMuted { - z := &CallUpdateParticipantMuted{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateParticipantMuted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantMuted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateParticipantMuted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateParticipantMuted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateParticipantMuted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateParticipantMuted, x) -} - -const C_CallUpdateCallDestroyed int64 = 3684039715 - -type poolCallUpdateCallDestroyed struct { - pool sync.Pool -} - -func (p *poolCallUpdateCallDestroyed) Get() *CallUpdateCallDestroyed { - x, ok := p.pool.Get().(*CallUpdateCallDestroyed) - if !ok { - x = &CallUpdateCallDestroyed{} - } - - return x -} - -func (p *poolCallUpdateCallDestroyed) Put(x *CallUpdateCallDestroyed) { - if x == nil { - return - } - - x.CallID = 0 - - p.pool.Put(x) -} - -var PoolCallUpdateCallDestroyed = poolCallUpdateCallDestroyed{} - -func (x *CallUpdateCallDestroyed) DeepCopy(z *CallUpdateCallDestroyed) { - z.CallID = x.CallID -} - -func (x *CallUpdateCallDestroyed) Clone() *CallUpdateCallDestroyed { - z := &CallUpdateCallDestroyed{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateCallDestroyed) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateCallDestroyed) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateCallDestroyed) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateCallDestroyed) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateCallDestroyed) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateCallDestroyed, x) -} - -const C_CallUpdateLocalMediaSettingsUpdated int64 = 587913546 - -type poolCallUpdateLocalMediaSettingsUpdated struct { - pool sync.Pool -} - -func (p *poolCallUpdateLocalMediaSettingsUpdated) Get() *CallUpdateLocalMediaSettingsUpdated { - x, ok := p.pool.Get().(*CallUpdateLocalMediaSettingsUpdated) - if !ok { - x = &CallUpdateLocalMediaSettingsUpdated{} - } - - x.MediaSettings = PoolCallMediaSettings.Get() - - return x -} - -func (p *poolCallUpdateLocalMediaSettingsUpdated) Put(x *CallUpdateLocalMediaSettingsUpdated) { - if x == nil { - return - } - - PoolCallMediaSettings.Put(x.MediaSettings) - - p.pool.Put(x) -} - -var PoolCallUpdateLocalMediaSettingsUpdated = poolCallUpdateLocalMediaSettingsUpdated{} - -func (x *CallUpdateLocalMediaSettingsUpdated) DeepCopy(z *CallUpdateLocalMediaSettingsUpdated) { - if x.MediaSettings != nil { - if z.MediaSettings == nil { - z.MediaSettings = PoolCallMediaSettings.Get() - } - x.MediaSettings.DeepCopy(z.MediaSettings) - } else { - PoolCallMediaSettings.Put(z.MediaSettings) - z.MediaSettings = nil - } -} - -func (x *CallUpdateLocalMediaSettingsUpdated) Clone() *CallUpdateLocalMediaSettingsUpdated { - z := &CallUpdateLocalMediaSettingsUpdated{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateLocalMediaSettingsUpdated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateLocalMediaSettingsUpdated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateLocalMediaSettingsUpdated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateLocalMediaSettingsUpdated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateLocalMediaSettingsUpdated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateLocalMediaSettingsUpdated, x) -} - -const C_CallUpdateDestroyed int64 = 2831970154 - -type poolCallUpdateDestroyed struct { - pool sync.Pool -} - -func (p *poolCallUpdateDestroyed) Get() *CallUpdateDestroyed { - x, ok := p.pool.Get().(*CallUpdateDestroyed) - if !ok { - x = &CallUpdateDestroyed{} - } - - return x -} - -func (p *poolCallUpdateDestroyed) Put(x *CallUpdateDestroyed) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolCallUpdateDestroyed = poolCallUpdateDestroyed{} - -func (x *CallUpdateDestroyed) DeepCopy(z *CallUpdateDestroyed) { -} - -func (x *CallUpdateDestroyed) Clone() *CallUpdateDestroyed { - z := &CallUpdateDestroyed{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateDestroyed) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateDestroyed) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateDestroyed) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateDestroyed) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateDestroyed) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateDestroyed, x) -} - -const C_CallUpdateStatusChanged int64 = 3530146764 - -type poolCallUpdateStatusChanged struct { - pool sync.Pool -} - -func (p *poolCallUpdateStatusChanged) Get() *CallUpdateStatusChanged { - x, ok := p.pool.Get().(*CallUpdateStatusChanged) - if !ok { - x = &CallUpdateStatusChanged{} - } - - return x -} - -func (p *poolCallUpdateStatusChanged) Put(x *CallUpdateStatusChanged) { - if x == nil { - return - } - - x.CallID = 0 - x.ConnId = 0 - x.Status = 0 - - p.pool.Put(x) -} - -var PoolCallUpdateStatusChanged = poolCallUpdateStatusChanged{} - -func (x *CallUpdateStatusChanged) DeepCopy(z *CallUpdateStatusChanged) { - z.CallID = x.CallID - z.ConnId = x.ConnId - z.Status = x.Status -} - -func (x *CallUpdateStatusChanged) Clone() *CallUpdateStatusChanged { - z := &CallUpdateStatusChanged{} - x.DeepCopy(z) - return z -} - -func (x *CallUpdateStatusChanged) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *CallUpdateStatusChanged) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *CallUpdateStatusChanged) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *CallUpdateStatusChanged) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *CallUpdateStatusChanged) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_CallUpdateStatusChanged, x) -} - -func init() { - registry.RegisterConstructor(2873625233, "ClientCallToggleVideo") - registry.RegisterConstructor(3488802344, "ClientCallToggleAudio") - registry.RegisterConstructor(346556278, "ClientCallTryReconnect") - registry.RegisterConstructor(3560765778, "ClientCallDestroy") - registry.RegisterConstructor(4108555878, "ClientCallAreAllAudio") - registry.RegisterConstructor(1007531716, "ClientCallSendIceCandidate") - registry.RegisterConstructor(3421647876, "ClientCallSendIceConnectionStatus") - registry.RegisterConstructor(2856076314, "ClientCallSendTrack") - registry.RegisterConstructor(3339532851, "ClientCallSendAck") - registry.RegisterConstructor(2959794351, "ClientCallSendMediaSettings") - registry.RegisterConstructor(2971494454, "ClientCallGetDuration") - registry.RegisterConstructor(1041146964, "ClientCallStart") - registry.RegisterConstructor(484502003, "ClientCallStarted") - registry.RegisterConstructor(3292884691, "ClientCallDuration") - registry.RegisterConstructor(2382593398, "ClientCallJoin") - registry.RegisterConstructor(2726334873, "ClientCallAccept") - registry.RegisterConstructor(3026524692, "ClientCallReject") - registry.RegisterConstructor(1253505450, "ClientCallGetParticipantByUserID") - registry.RegisterConstructor(3279593330, "ClientCallGetParticipantByConnId") - registry.RegisterConstructor(348508034, "ClientCallGetParticipantList") - registry.RegisterConstructor(2518831668, "ClientCallMuteParticipant") - registry.RegisterConstructor(1850196430, "ClientCallGroupAddParticipant") - registry.RegisterConstructor(2417422237, "ClientCallGroupRemoveParticipant") - registry.RegisterConstructor(3544832701, "ClientCallGroupUpdateAdmin") - registry.RegisterConstructor(1147111688, "CallMediaSettings") - registry.RegisterConstructor(2652007354, "CallParticipant") - registry.RegisterConstructor(807700466, "CallParticipants") - registry.RegisterConstructor(2748774954, "CallRTCIceCandidate") - registry.RegisterConstructor(3450901888, "CallConnection") - registry.RegisterConstructor(2556114354, "CallUpdateCallRequested") - registry.RegisterConstructor(2134109006, "CallUpdateCallAccepted") - registry.RegisterConstructor(3496218809, "CallUpdateStreamUpdated") - registry.RegisterConstructor(2339651845, "CallUpdateCallRejected") - registry.RegisterConstructor(3922101985, "CallUpdateMediaSettingsUpdated") - registry.RegisterConstructor(1043624904, "CallUpdateLocalStreamUpdated") - registry.RegisterConstructor(420503198, "CallUpdateCallTimeout") - registry.RegisterConstructor(1424725011, "CallUpdateCallAck") - registry.RegisterConstructor(1005455524, "CallUpdateParticipantJoined") - registry.RegisterConstructor(2062471712, "CallUpdateParticipantLeft") - registry.RegisterConstructor(4138786615, "CallUpdateParticipantRemoved") - registry.RegisterConstructor(567542844, "CallUpdateCallPreview") - registry.RegisterConstructor(4194096602, "CallUpdateCallCancelled") - registry.RegisterConstructor(945899454, "CallUpdateCallJoinRequested") - registry.RegisterConstructor(2487316396, "CallUpdateParticipantAdminUpdated") - registry.RegisterConstructor(2763784404, "CallUpdateShareScreenStreamUpdated") - registry.RegisterConstructor(1993183151, "CallUpdateAllConnected") - registry.RegisterConstructor(4028141073, "CallUpdateConnectionStatusChanged") - registry.RegisterConstructor(2194386679, "CallUpdateParticipantMuted") - registry.RegisterConstructor(3684039715, "CallUpdateCallDestroyed") - registry.RegisterConstructor(587913546, "CallUpdateLocalMediaSettingsUpdated") - registry.RegisterConstructor(2831970154, "CallUpdateDestroyed") - registry.RegisterConstructor(3530146764, "CallUpdateStatusChanged") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/client.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/client.pb.go deleted file mode 100644 index 4f3a27f1..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/client.pb.go +++ /dev/null @@ -1,3332 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: client.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// ClientMediaType -type ClientMediaType int32 - -const ( - ClientMediaType_ClientMediaNone ClientMediaType = 0 - ClientMediaType_ClientMediaFile ClientMediaType = 1 - ClientMediaType_ClientMediaMedia ClientMediaType = 2 - ClientMediaType_ClientMediaVoice ClientMediaType = 3 - ClientMediaType_ClientMediaAudio ClientMediaType = 4 - ClientMediaType_ClientMediaLink ClientMediaType = 5 - ClientMediaType_ClientMediaGif ClientMediaType = 6 -) - -// Enum value maps for ClientMediaType. -var ( - ClientMediaType_name = map[int32]string{ - 0: "ClientMediaNone", - 1: "ClientMediaFile", - 2: "ClientMediaMedia", - 3: "ClientMediaVoice", - 4: "ClientMediaAudio", - 5: "ClientMediaLink", - 6: "ClientMediaGif", - } - ClientMediaType_value = map[string]int32{ - "ClientMediaNone": 0, - "ClientMediaFile": 1, - "ClientMediaMedia": 2, - "ClientMediaVoice": 3, - "ClientMediaAudio": 4, - "ClientMediaLink": 5, - "ClientMediaGif": 6, - } -) - -func (x ClientMediaType) Enum() *ClientMediaType { - p := new(ClientMediaType) - *p = x - return p -} - -func (x ClientMediaType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ClientMediaType) Descriptor() protoreflect.EnumDescriptor { - return file_client_proto_enumTypes[0].Descriptor() -} - -func (ClientMediaType) Type() protoreflect.EnumType { - return &file_client_proto_enumTypes[0] -} - -func (x ClientMediaType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ClientMediaType.Descriptor instead. -func (ClientMediaType) EnumDescriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{0} -} - -// ClientFileType -type ClientFileType int32 - -const ( - ClientFileType_Unknown ClientFileType = 0 - ClientFileType_Message ClientFileType = 1 - ClientFileType_AccountProfilePhoto ClientFileType = 2 - ClientFileType_GroupProfilePhoto ClientFileType = 3 - ClientFileType_Sticker ClientFileType = 4 - ClientFileType_Thumbnail ClientFileType = 5 - ClientFileType_Wallpaper ClientFileType = 6 - ClientFileType_Gif ClientFileType = 7 -) - -// Enum value maps for ClientFileType. -var ( - ClientFileType_name = map[int32]string{ - 0: "Unknown", - 1: "Message", - 2: "AccountProfilePhoto", - 3: "GroupProfilePhoto", - 4: "Sticker", - 5: "Thumbnail", - 6: "Wallpaper", - 7: "Gif", - } - ClientFileType_value = map[string]int32{ - "Unknown": 0, - "Message": 1, - "AccountProfilePhoto": 2, - "GroupProfilePhoto": 3, - "Sticker": 4, - "Thumbnail": 5, - "Wallpaper": 6, - "Gif": 7, - } -) - -func (x ClientFileType) Enum() *ClientFileType { - p := new(ClientFileType) - *p = x - return p -} - -func (x ClientFileType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ClientFileType) Descriptor() protoreflect.EnumDescriptor { - return file_client_proto_enumTypes[1].Descriptor() -} - -func (ClientFileType) Type() protoreflect.EnumType { - return &file_client_proto_enumTypes[1] -} - -func (x ClientFileType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ClientFileType.Descriptor instead. -func (ClientFileType) EnumDescriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{1} -} - -// ClientGetMediaHistory -// @Function -// @Return: MessagesMany -type ClientGetMediaHistory struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Cat MediaCategory `protobuf:"varint,1,opt,name=Cat,proto3,enum=msg.MediaCategory" json:"Cat,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Limit int32 `protobuf:"varint,3,opt,name=Limit,proto3" json:"Limit,omitempty"` - MaxID int64 `protobuf:"varint,4,opt,name=MaxID,proto3" json:"MaxID,omitempty"` - MinID int64 `protobuf:"varint,5,opt,name=MinID,proto3" json:"MinID,omitempty"` -} - -func (x *ClientGetMediaHistory) Reset() { - *x = ClientGetMediaHistory{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGetMediaHistory) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGetMediaHistory) ProtoMessage() {} - -func (x *ClientGetMediaHistory) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGetMediaHistory.ProtoReflect.Descriptor instead. -func (*ClientGetMediaHistory) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{0} -} - -func (x *ClientGetMediaHistory) GetCat() MediaCategory { - if x != nil { - return x.Cat - } - return MediaCategory_MediaCategoryNone -} - -func (x *ClientGetMediaHistory) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *ClientGetMediaHistory) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *ClientGetMediaHistory) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -func (x *ClientGetMediaHistory) GetMinID() int64 { - if x != nil { - return x.MinID - } - return 0 -} - -// ClientSendMessageMedia -// @Function -// @Returns: ClientPendingMessage -type ClientSendMessageMedia struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MediaType InputMediaType `protobuf:"varint,2,opt,name=MediaType,proto3,enum=msg.InputMediaType" json:"MediaType,omitempty"` - Caption string `protobuf:"bytes,3,opt,name=Caption,proto3" json:"Caption,omitempty"` - FileName string `protobuf:"bytes,4,opt,name=FileName,proto3" json:"FileName,omitempty"` - FilePath string `protobuf:"bytes,5,opt,name=FilePath,proto3" json:"FilePath,omitempty"` - ThumbFilePath string `protobuf:"bytes,6,opt,name=ThumbFilePath,proto3" json:"ThumbFilePath,omitempty"` - FileMIME string `protobuf:"bytes,7,opt,name=FileMIME,proto3" json:"FileMIME,omitempty"` - ThumbMIME string `protobuf:"bytes,8,opt,name=ThumbMIME,proto3" json:"ThumbMIME,omitempty"` - ReplyTo int64 `protobuf:"varint,9,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - ClearDraft bool `protobuf:"varint,10,opt,name=ClearDraft,proto3" json:"ClearDraft,omitempty"` - Attributes []*DocumentAttribute `protobuf:"bytes,11,rep,name=Attributes,proto3" json:"Attributes,omitempty"` - FileUploadID string `protobuf:"bytes,12,opt,name=FileUploadID,proto3" json:"FileUploadID,omitempty"` - ThumbUploadID string `protobuf:"bytes,13,opt,name=ThumbUploadID,proto3" json:"ThumbUploadID,omitempty"` - FileID int64 `protobuf:"varint,14,opt,name=FileID,proto3" json:"FileID,omitempty"` - ThumbID int64 `protobuf:"varint,15,opt,name=ThumbID,proto3" json:"ThumbID,omitempty"` - FileTotalParts int32 `protobuf:"varint,16,opt,name=FileTotalParts,proto3" json:"FileTotalParts,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,17,rep,name=Entities,proto3" json:"Entities,omitempty"` - TinyThumb []byte `protobuf:"bytes,18,opt,name=TinyThumb,proto3" json:"TinyThumb,omitempty"` -} - -func (x *ClientSendMessageMedia) Reset() { - *x = ClientSendMessageMedia{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientSendMessageMedia) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientSendMessageMedia) ProtoMessage() {} - -func (x *ClientSendMessageMedia) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientSendMessageMedia.ProtoReflect.Descriptor instead. -func (*ClientSendMessageMedia) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{1} -} - -func (x *ClientSendMessageMedia) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *ClientSendMessageMedia) GetMediaType() InputMediaType { - if x != nil { - return x.MediaType - } - return InputMediaType_InputMediaTypeEmpty -} - -func (x *ClientSendMessageMedia) GetCaption() string { - if x != nil { - return x.Caption - } - return "" -} - -func (x *ClientSendMessageMedia) GetFileName() string { - if x != nil { - return x.FileName - } - return "" -} - -func (x *ClientSendMessageMedia) GetFilePath() string { - if x != nil { - return x.FilePath - } - return "" -} - -func (x *ClientSendMessageMedia) GetThumbFilePath() string { - if x != nil { - return x.ThumbFilePath - } - return "" -} - -func (x *ClientSendMessageMedia) GetFileMIME() string { - if x != nil { - return x.FileMIME - } - return "" -} - -func (x *ClientSendMessageMedia) GetThumbMIME() string { - if x != nil { - return x.ThumbMIME - } - return "" -} - -func (x *ClientSendMessageMedia) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *ClientSendMessageMedia) GetClearDraft() bool { - if x != nil { - return x.ClearDraft - } - return false -} - -func (x *ClientSendMessageMedia) GetAttributes() []*DocumentAttribute { - if x != nil { - return x.Attributes - } - return nil -} - -func (x *ClientSendMessageMedia) GetFileUploadID() string { - if x != nil { - return x.FileUploadID - } - return "" -} - -func (x *ClientSendMessageMedia) GetThumbUploadID() string { - if x != nil { - return x.ThumbUploadID - } - return "" -} - -func (x *ClientSendMessageMedia) GetFileID() int64 { - if x != nil { - return x.FileID - } - return 0 -} - -func (x *ClientSendMessageMedia) GetThumbID() int64 { - if x != nil { - return x.ThumbID - } - return 0 -} - -func (x *ClientSendMessageMedia) GetFileTotalParts() int32 { - if x != nil { - return x.FileTotalParts - } - return 0 -} - -func (x *ClientSendMessageMedia) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *ClientSendMessageMedia) GetTinyThumb() []byte { - if x != nil { - return x.TinyThumb - } - return nil -} - -// ClientGlobalSearch -// @Function -// @Return: ClientSearchResult -type ClientGlobalSearch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` - LabelIDs []int32 `protobuf:"varint,2,rep,packed,name=LabelIDs,proto3" json:"LabelIDs,omitempty"` - Peer *InputPeer `protobuf:"bytes,3,opt,name=Peer,proto3" json:"Peer,omitempty"` - Limit int32 `protobuf:"varint,4,opt,name=Limit,proto3" json:"Limit,omitempty"` - SenderID int64 `protobuf:"varint,5,opt,name=SenderID,proto3" json:"SenderID,omitempty"` -} - -func (x *ClientGlobalSearch) Reset() { - *x = ClientGlobalSearch{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGlobalSearch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGlobalSearch) ProtoMessage() {} - -func (x *ClientGlobalSearch) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGlobalSearch.ProtoReflect.Descriptor instead. -func (*ClientGlobalSearch) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{2} -} - -func (x *ClientGlobalSearch) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -func (x *ClientGlobalSearch) GetLabelIDs() []int32 { - if x != nil { - return x.LabelIDs - } - return nil -} - -func (x *ClientGlobalSearch) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *ClientGlobalSearch) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *ClientGlobalSearch) GetSenderID() int64 { - if x != nil { - return x.SenderID - } - return 0 -} - -// ClientSearchResult -type ClientSearchResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Messages []*UserMessage `protobuf:"bytes,1,rep,name=Messages,proto3" json:"Messages,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Groups []*Group `protobuf:"bytes,3,rep,name=Groups,proto3" json:"Groups,omitempty"` - MatchedUsers []*User `protobuf:"bytes,4,rep,name=MatchedUsers,proto3" json:"MatchedUsers,omitempty"` - MatchedGroups []*Group `protobuf:"bytes,5,rep,name=MatchedGroups,proto3" json:"MatchedGroups,omitempty"` -} - -func (x *ClientSearchResult) Reset() { - *x = ClientSearchResult{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientSearchResult) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientSearchResult) ProtoMessage() {} - -func (x *ClientSearchResult) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientSearchResult.ProtoReflect.Descriptor instead. -func (*ClientSearchResult) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{3} -} - -func (x *ClientSearchResult) GetMessages() []*UserMessage { - if x != nil { - return x.Messages - } - return nil -} - -func (x *ClientSearchResult) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *ClientSearchResult) GetGroups() []*Group { - if x != nil { - return x.Groups - } - return nil -} - -func (x *ClientSearchResult) GetMatchedUsers() []*User { - if x != nil { - return x.MatchedUsers - } - return nil -} - -func (x *ClientSearchResult) GetMatchedGroups() []*Group { - if x != nil { - return x.MatchedGroups - } - return nil -} - -// ClientContactSearch -// @Function -// @Return: ClientSearchResult -type ClientContactSearch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"` -} - -func (x *ClientContactSearch) Reset() { - *x = ClientContactSearch{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientContactSearch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientContactSearch) ProtoMessage() {} - -func (x *ClientContactSearch) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientContactSearch.ProtoReflect.Descriptor instead. -func (*ClientContactSearch) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{4} -} - -func (x *ClientContactSearch) GetText() string { - if x != nil { - return x.Text - } - return "" -} - -// ClientGetCachedMedia -// @Function -// @Return: ClientCachedMedia -type ClientGetCachedMedia struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ClientGetCachedMedia) Reset() { - *x = ClientGetCachedMedia{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGetCachedMedia) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGetCachedMedia) ProtoMessage() {} - -func (x *ClientGetCachedMedia) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGetCachedMedia.ProtoReflect.Descriptor instead. -func (*ClientGetCachedMedia) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{5} -} - -// CachedMediaInfo -type ClientCachedMediaInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MediaInfo []*ClientPeerMediaInfo `protobuf:"bytes,1,rep,name=MediaInfo,proto3" json:"MediaInfo,omitempty"` -} - -func (x *ClientCachedMediaInfo) Reset() { - *x = ClientCachedMediaInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientCachedMediaInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientCachedMediaInfo) ProtoMessage() {} - -func (x *ClientCachedMediaInfo) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientCachedMediaInfo.ProtoReflect.Descriptor instead. -func (*ClientCachedMediaInfo) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{6} -} - -func (x *ClientCachedMediaInfo) GetMediaInfo() []*ClientPeerMediaInfo { - if x != nil { - return x.MediaInfo - } - return nil -} - -// PeerMediaInfo -type ClientPeerMediaInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PeerID int64 `protobuf:"varint,1,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType PeerType `protobuf:"varint,2,opt,name=PeerType,proto3,enum=msg.PeerType" json:"PeerType,omitempty"` - Media []*ClientMediaSize `protobuf:"bytes,3,rep,name=Media,proto3" json:"Media,omitempty"` -} - -func (x *ClientPeerMediaInfo) Reset() { - *x = ClientPeerMediaInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientPeerMediaInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientPeerMediaInfo) ProtoMessage() {} - -func (x *ClientPeerMediaInfo) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientPeerMediaInfo.ProtoReflect.Descriptor instead. -func (*ClientPeerMediaInfo) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{7} -} - -func (x *ClientPeerMediaInfo) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *ClientPeerMediaInfo) GetPeerType() PeerType { - if x != nil { - return x.PeerType - } - return PeerType_PeerSelf -} - -func (x *ClientPeerMediaInfo) GetMedia() []*ClientMediaSize { - if x != nil { - return x.Media - } - return nil -} - -// ClientMediaSize -type ClientMediaSize struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MediaType ClientMediaType `protobuf:"varint,1,opt,name=MediaType,proto3,enum=msg.ClientMediaType" json:"MediaType,omitempty"` - TotalSize int64 `protobuf:"varint,2,opt,name=TotalSize,proto3" json:"TotalSize,omitempty"` -} - -func (x *ClientMediaSize) Reset() { - *x = ClientMediaSize{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientMediaSize) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientMediaSize) ProtoMessage() {} - -func (x *ClientMediaSize) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientMediaSize.ProtoReflect.Descriptor instead. -func (*ClientMediaSize) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{8} -} - -func (x *ClientMediaSize) GetMediaType() ClientMediaType { - if x != nil { - return x.MediaType - } - return ClientMediaType_ClientMediaNone -} - -func (x *ClientMediaSize) GetTotalSize() int64 { - if x != nil { - return x.TotalSize - } - return 0 -} - -// ClientClearCachedMedia -// @Function -// @Return: Bool -type ClientClearCachedMedia struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MediaTypes []ClientMediaType `protobuf:"varint,2,rep,packed,name=MediaTypes,proto3,enum=msg.ClientMediaType" json:"MediaTypes,omitempty"` -} - -func (x *ClientClearCachedMedia) Reset() { - *x = ClientClearCachedMedia{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientClearCachedMedia) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientClearCachedMedia) ProtoMessage() {} - -func (x *ClientClearCachedMedia) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientClearCachedMedia.ProtoReflect.Descriptor instead. -func (*ClientClearCachedMedia) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{9} -} - -func (x *ClientClearCachedMedia) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *ClientClearCachedMedia) GetMediaTypes() []ClientMediaType { - if x != nil { - return x.MediaTypes - } - return nil -} - -// ClientGetLastBotKeyboard -// @Return: UserMessage -type ClientGetLastBotKeyboard struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *ClientGetLastBotKeyboard) Reset() { - *x = ClientGetLastBotKeyboard{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGetLastBotKeyboard) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGetLastBotKeyboard) ProtoMessage() {} - -func (x *ClientGetLastBotKeyboard) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGetLastBotKeyboard.ProtoReflect.Descriptor instead. -func (*ClientGetLastBotKeyboard) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{10} -} - -func (x *ClientGetLastBotKeyboard) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// ClientGetAllDownloadedMedia -// @Function -// @Return: MessagesMany -type ClientGetAllDownloadedMedia struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MediaType ClientMediaType `protobuf:"varint,1,opt,name=MediaType,proto3,enum=msg.ClientMediaType" json:"MediaType,omitempty"` -} - -func (x *ClientGetAllDownloadedMedia) Reset() { - *x = ClientGetAllDownloadedMedia{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGetAllDownloadedMedia) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGetAllDownloadedMedia) ProtoMessage() {} - -func (x *ClientGetAllDownloadedMedia) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGetAllDownloadedMedia.ProtoReflect.Descriptor instead. -func (*ClientGetAllDownloadedMedia) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{11} -} - -func (x *ClientGetAllDownloadedMedia) GetMediaType() ClientMediaType { - if x != nil { - return x.MediaType - } - return ClientMediaType_ClientMediaNone -} - -// ClientGetRecentSearch -// @Function -// @Return: RecentSearchMany -type ClientGetRecentSearch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Limit int32 `protobuf:"varint,1,opt,name=Limit,proto3" json:"Limit,omitempty"` -} - -func (x *ClientGetRecentSearch) Reset() { - *x = ClientGetRecentSearch{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGetRecentSearch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGetRecentSearch) ProtoMessage() {} - -func (x *ClientGetRecentSearch) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGetRecentSearch.ProtoReflect.Descriptor instead. -func (*ClientGetRecentSearch) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{12} -} - -func (x *ClientGetRecentSearch) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -// ClientRecentSearch -type ClientRecentSearch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - Date int32 `protobuf:"varint,2,opt,name=Date,proto3" json:"Date,omitempty"` -} - -func (x *ClientRecentSearch) Reset() { - *x = ClientRecentSearch{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientRecentSearch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientRecentSearch) ProtoMessage() {} - -func (x *ClientRecentSearch) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientRecentSearch.ProtoReflect.Descriptor instead. -func (*ClientRecentSearch) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{13} -} - -func (x *ClientRecentSearch) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *ClientRecentSearch) GetDate() int32 { - if x != nil { - return x.Date - } - return 0 -} - -// RecentSearchMany -type ClientRecentSearchMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RecentSearches []*ClientRecentSearch `protobuf:"bytes,1,rep,name=RecentSearches,proto3" json:"RecentSearches,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Groups []*Group `protobuf:"bytes,3,rep,name=Groups,proto3" json:"Groups,omitempty"` -} - -func (x *ClientRecentSearchMany) Reset() { - *x = ClientRecentSearchMany{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientRecentSearchMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientRecentSearchMany) ProtoMessage() {} - -func (x *ClientRecentSearchMany) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientRecentSearchMany.ProtoReflect.Descriptor instead. -func (*ClientRecentSearchMany) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{14} -} - -func (x *ClientRecentSearchMany) GetRecentSearches() []*ClientRecentSearch { - if x != nil { - return x.RecentSearches - } - return nil -} - -func (x *ClientRecentSearchMany) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *ClientRecentSearchMany) GetGroups() []*Group { - if x != nil { - return x.Groups - } - return nil -} - -// ClientPutRecentSearch -// @Function -// @Return: Bool -type ClientPutRecentSearch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *ClientPutRecentSearch) Reset() { - *x = ClientPutRecentSearch{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientPutRecentSearch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientPutRecentSearch) ProtoMessage() {} - -func (x *ClientPutRecentSearch) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientPutRecentSearch.ProtoReflect.Descriptor instead. -func (*ClientPutRecentSearch) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{15} -} - -func (x *ClientPutRecentSearch) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// ClientPutRecentSearch -// @Function -// @Return: Bool -type ClientRemoveRecentSearch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *ClientRemoveRecentSearch) Reset() { - *x = ClientRemoveRecentSearch{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientRemoveRecentSearch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientRemoveRecentSearch) ProtoMessage() {} - -func (x *ClientRemoveRecentSearch) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientRemoveRecentSearch.ProtoReflect.Descriptor instead. -func (*ClientRemoveRecentSearch) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{16} -} - -func (x *ClientRemoveRecentSearch) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// ClientRemoveAllRecentSearches -// @Function -// @Return: Bool -type ClientRemoveAllRecentSearches struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Extra bool `protobuf:"varint,1,opt,name=Extra,proto3" json:"Extra,omitempty"` -} - -func (x *ClientRemoveAllRecentSearches) Reset() { - *x = ClientRemoveAllRecentSearches{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientRemoveAllRecentSearches) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientRemoveAllRecentSearches) ProtoMessage() {} - -func (x *ClientRemoveAllRecentSearches) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientRemoveAllRecentSearches.ProtoReflect.Descriptor instead. -func (*ClientRemoveAllRecentSearches) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{17} -} - -func (x *ClientRemoveAllRecentSearches) GetExtra() bool { - if x != nil { - return x.Extra - } - return false -} - -// ClientGetSavedGifs -// @Function -// @Return: ClientFilesMany -type ClientGetSavedGifs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ClientGetSavedGifs) Reset() { - *x = ClientGetSavedGifs{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGetSavedGifs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGetSavedGifs) ProtoMessage() {} - -func (x *ClientGetSavedGifs) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGetSavedGifs.ProtoReflect.Descriptor instead. -func (*ClientGetSavedGifs) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{18} -} - -// ClientGetTeamCounters -// @Function -// @Return: ClientTeamCounters -type ClientGetTeamCounters struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Team *InputTeam `protobuf:"bytes,1,opt,name=Team,proto3" json:"Team,omitempty"` - WithMutes bool `protobuf:"varint,2,opt,name=WithMutes,proto3" json:"WithMutes,omitempty"` -} - -func (x *ClientGetTeamCounters) Reset() { - *x = ClientGetTeamCounters{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGetTeamCounters) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGetTeamCounters) ProtoMessage() {} - -func (x *ClientGetTeamCounters) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGetTeamCounters.ProtoReflect.Descriptor instead. -func (*ClientGetTeamCounters) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{19} -} - -func (x *ClientGetTeamCounters) GetTeam() *InputTeam { - if x != nil { - return x.Team - } - return nil -} - -func (x *ClientGetTeamCounters) GetWithMutes() bool { - if x != nil { - return x.WithMutes - } - return false -} - -// ClientTeamCounters -type ClientTeamCounters struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UnreadCount int64 `protobuf:"varint,1,opt,name=UnreadCount,proto3" json:"UnreadCount,omitempty"` - MentionCount int64 `protobuf:"varint,2,opt,name=MentionCount,proto3" json:"MentionCount,omitempty"` -} - -func (x *ClientTeamCounters) Reset() { - *x = ClientTeamCounters{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientTeamCounters) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientTeamCounters) ProtoMessage() {} - -func (x *ClientTeamCounters) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientTeamCounters.ProtoReflect.Descriptor instead. -func (*ClientTeamCounters) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{20} -} - -func (x *ClientTeamCounters) GetUnreadCount() int64 { - if x != nil { - return x.UnreadCount - } - return 0 -} - -func (x *ClientTeamCounters) GetMentionCount() int64 { - if x != nil { - return x.MentionCount - } - return 0 -} - -// ClientPendingMessage -type ClientPendingMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - RequestID int64 `protobuf:"varint,2,opt,name=RequestID,proto3" json:"RequestID,omitempty"` - PeerID int64 `protobuf:"varint,3,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,4,opt,name=PeerType,proto3" json:"PeerType,omitempty"` - AccessHash uint64 `protobuf:"fixed64,5,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - CreatedOn int64 `protobuf:"varint,6,opt,name=CreatedOn,proto3" json:"CreatedOn,omitempty"` - ReplyTo int64 `protobuf:"varint,7,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - Body string `protobuf:"bytes,8,opt,name=Body,proto3" json:"Body,omitempty"` - SenderID int64 `protobuf:"varint,9,opt,name=SenderID,proto3" json:"SenderID,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,10,rep,name=Entities,proto3" json:"Entities,omitempty"` - MediaType InputMediaType `protobuf:"varint,11,opt,name=MediaType,proto3,enum=msg.InputMediaType" json:"MediaType,omitempty"` - Media []byte `protobuf:"bytes,12,opt,name=Media,proto3" json:"Media,omitempty"` - ClearDraft bool `protobuf:"varint,13,opt,name=ClearDraft,proto3" json:"ClearDraft,omitempty"` - FileUploadID string `protobuf:"bytes,14,opt,name=FileUploadID,proto3" json:"FileUploadID,omitempty"` - ThumbUploadID string `protobuf:"bytes,15,opt,name=ThumbUploadID,proto3" json:"ThumbUploadID,omitempty"` - FileID int64 `protobuf:"varint,16,opt,name=FileID,proto3" json:"FileID,omitempty"` - ThumbID int64 `protobuf:"varint,17,opt,name=ThumbID,proto3" json:"ThumbID,omitempty"` - Sha256 []byte `protobuf:"bytes,18,opt,name=Sha256,proto3" json:"Sha256,omitempty"` - ServerFile *FileLocation `protobuf:"bytes,19,opt,name=ServerFile,proto3" json:"ServerFile,omitempty"` - TeamID int64 `protobuf:"varint,20,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - TeamAccessHash uint64 `protobuf:"varint,21,opt,name=TeamAccessHash,proto3" json:"TeamAccessHash,omitempty"` - TinyThumb []byte `protobuf:"bytes,22,opt,name=TinyThumb,proto3" json:"TinyThumb,omitempty"` -} - -func (x *ClientPendingMessage) Reset() { - *x = ClientPendingMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientPendingMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientPendingMessage) ProtoMessage() {} - -func (x *ClientPendingMessage) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientPendingMessage.ProtoReflect.Descriptor instead. -func (*ClientPendingMessage) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{21} -} - -func (x *ClientPendingMessage) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *ClientPendingMessage) GetRequestID() int64 { - if x != nil { - return x.RequestID - } - return 0 -} - -func (x *ClientPendingMessage) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *ClientPendingMessage) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -func (x *ClientPendingMessage) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *ClientPendingMessage) GetCreatedOn() int64 { - if x != nil { - return x.CreatedOn - } - return 0 -} - -func (x *ClientPendingMessage) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *ClientPendingMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *ClientPendingMessage) GetSenderID() int64 { - if x != nil { - return x.SenderID - } - return 0 -} - -func (x *ClientPendingMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *ClientPendingMessage) GetMediaType() InputMediaType { - if x != nil { - return x.MediaType - } - return InputMediaType_InputMediaTypeEmpty -} - -func (x *ClientPendingMessage) GetMedia() []byte { - if x != nil { - return x.Media - } - return nil -} - -func (x *ClientPendingMessage) GetClearDraft() bool { - if x != nil { - return x.ClearDraft - } - return false -} - -func (x *ClientPendingMessage) GetFileUploadID() string { - if x != nil { - return x.FileUploadID - } - return "" -} - -func (x *ClientPendingMessage) GetThumbUploadID() string { - if x != nil { - return x.ThumbUploadID - } - return "" -} - -func (x *ClientPendingMessage) GetFileID() int64 { - if x != nil { - return x.FileID - } - return 0 -} - -func (x *ClientPendingMessage) GetThumbID() int64 { - if x != nil { - return x.ThumbID - } - return 0 -} - -func (x *ClientPendingMessage) GetSha256() []byte { - if x != nil { - return x.Sha256 - } - return nil -} - -func (x *ClientPendingMessage) GetServerFile() *FileLocation { - if x != nil { - return x.ServerFile - } - return nil -} - -func (x *ClientPendingMessage) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *ClientPendingMessage) GetTeamAccessHash() uint64 { - if x != nil { - return x.TeamAccessHash - } - return 0 -} - -func (x *ClientPendingMessage) GetTinyThumb() []byte { - if x != nil { - return x.TinyThumb - } - return nil -} - -// ClientFilesMany -type ClientFilesMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Gifs []*ClientFile `protobuf:"bytes,1,rep,name=Gifs,proto3" json:"Gifs,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=Total,proto3" json:"Total,omitempty"` -} - -func (x *ClientFilesMany) Reset() { - *x = ClientFilesMany{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientFilesMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientFilesMany) ProtoMessage() {} - -func (x *ClientFilesMany) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientFilesMany.ProtoReflect.Descriptor instead. -func (*ClientFilesMany) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{22} -} - -func (x *ClientFilesMany) GetGifs() []*ClientFile { - if x != nil { - return x.Gifs - } - return nil -} - -func (x *ClientFilesMany) GetTotal() int32 { - if x != nil { - return x.Total - } - return 0 -} - -// ClientFile -type ClientFile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClusterID int32 `protobuf:"varint,1,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"` - FileID int64 `protobuf:"varint,2,opt,name=FileID,proto3" json:"FileID,omitempty"` - AccessHash uint64 `protobuf:"varint,3,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Type ClientFileType `protobuf:"varint,4,opt,name=Type,proto3,enum=msg.ClientFileType" json:"Type,omitempty"` - MimeType string `protobuf:"bytes,5,opt,name=MimeType,proto3" json:"MimeType,omitempty"` - UserID int64 `protobuf:"varint,6,opt,name=UserID,proto3" json:"UserID,omitempty"` - GroupID int64 `protobuf:"varint,7,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - FileSize int64 `protobuf:"varint,8,opt,name=FileSize,proto3" json:"FileSize,omitempty"` - MessageID int64 `protobuf:"varint,9,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - PeerID int64 `protobuf:"varint,10,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,11,opt,name=PeerType,proto3" json:"PeerType,omitempty"` - Version int32 `protobuf:"varint,12,opt,name=Version,proto3" json:"Version,omitempty"` - Extension string `protobuf:"bytes,13,opt,name=Extension,proto3" json:"Extension,omitempty"` - MD5Checksum string `protobuf:"bytes,14,opt,name=MD5Checksum,proto3" json:"MD5Checksum,omitempty"` - WallpaperID int64 `protobuf:"varint,15,opt,name=WallpaperID,proto3" json:"WallpaperID,omitempty"` - Attributes []*DocumentAttribute `protobuf:"bytes,16,rep,name=Attributes,proto3" json:"Attributes,omitempty"` -} - -func (x *ClientFile) Reset() { - *x = ClientFile{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientFile) ProtoMessage() {} - -func (x *ClientFile) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientFile.ProtoReflect.Descriptor instead. -func (*ClientFile) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{23} -} - -func (x *ClientFile) GetClusterID() int32 { - if x != nil { - return x.ClusterID - } - return 0 -} - -func (x *ClientFile) GetFileID() int64 { - if x != nil { - return x.FileID - } - return 0 -} - -func (x *ClientFile) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *ClientFile) GetType() ClientFileType { - if x != nil { - return x.Type - } - return ClientFileType_Unknown -} - -func (x *ClientFile) GetMimeType() string { - if x != nil { - return x.MimeType - } - return "" -} - -func (x *ClientFile) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *ClientFile) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *ClientFile) GetFileSize() int64 { - if x != nil { - return x.FileSize - } - return 0 -} - -func (x *ClientFile) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *ClientFile) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *ClientFile) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -func (x *ClientFile) GetVersion() int32 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *ClientFile) GetExtension() string { - if x != nil { - return x.Extension - } - return "" -} - -func (x *ClientFile) GetMD5Checksum() string { - if x != nil { - return x.MD5Checksum - } - return "" -} - -func (x *ClientFile) GetWallpaperID() int64 { - if x != nil { - return x.WallpaperID - } - return 0 -} - -func (x *ClientFile) GetAttributes() []*DocumentAttribute { - if x != nil { - return x.Attributes - } - return nil -} - -// ClientFileRequest -type ClientFileRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Next *ClientFileRequest `protobuf:"bytes,100,opt,name=Next,proto3" json:"Next,omitempty"` - // Logical Location - PeerID int64 `protobuf:"varint,1,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,2,opt,name=PeerType,proto3" json:"PeerType,omitempty"` - MessageID int64 `protobuf:"varint,3,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - // Storage Location - ClusterID int32 `protobuf:"varint,4,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"` - FileID int64 `protobuf:"varint,5,opt,name=FileID,proto3" json:"FileID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,6,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Version int32 `protobuf:"varint,7,opt,name=Version,proto3" json:"Version,omitempty"` - FileSize int64 `protobuf:"varint,8,opt,name=FileSize,proto3" json:"FileSize,omitempty"` // FileSize (Optional) if is set then progress will be calculated - ChunkSize int32 `protobuf:"varint,9,opt,name=ChunkSize,proto3" json:"ChunkSize,omitempty"` // ChunkSize identifies how many request we need to send to server to Download a file. - FinishedParts []int32 `protobuf:"varint,10,rep,packed,name=FinishedParts,proto3" json:"FinishedParts,omitempty"` - TotalParts int32 `protobuf:"varint,11,opt,name=TotalParts,proto3" json:"TotalParts,omitempty"` - SkipDelegateCall bool `protobuf:"varint,12,opt,name=SkipDelegateCall,proto3" json:"SkipDelegateCall,omitempty"` - FilePath string `protobuf:"bytes,13,opt,name=FilePath,proto3" json:"FilePath,omitempty"` - TempPath string `protobuf:"bytes,14,opt,name=TempPath,proto3" json:"TempPath,omitempty"` - CheckSha256 bool `protobuf:"varint,15,opt,name=CheckSha256,proto3" json:"CheckSha256,omitempty"` - FileSha256 []byte `protobuf:"bytes,16,opt,name=FileSha256,proto3" json:"FileSha256,omitempty"` - IsProfilePhoto bool `protobuf:"varint,17,opt,name=IsProfilePhoto,proto3" json:"IsProfilePhoto,omitempty"` - GroupID int64 `protobuf:"varint,18,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - ThumbID int64 `protobuf:"varint,19,opt,name=ThumbID,proto3" json:"ThumbID,omitempty"` - ThumbPath string `protobuf:"bytes,20,opt,name=ThumbPath,proto3" json:"ThumbPath,omitempty"` -} - -func (x *ClientFileRequest) Reset() { - *x = ClientFileRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientFileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientFileRequest) ProtoMessage() {} - -func (x *ClientFileRequest) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientFileRequest.ProtoReflect.Descriptor instead. -func (*ClientFileRequest) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{24} -} - -func (x *ClientFileRequest) GetNext() *ClientFileRequest { - if x != nil { - return x.Next - } - return nil -} - -func (x *ClientFileRequest) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *ClientFileRequest) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -func (x *ClientFileRequest) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *ClientFileRequest) GetClusterID() int32 { - if x != nil { - return x.ClusterID - } - return 0 -} - -func (x *ClientFileRequest) GetFileID() int64 { - if x != nil { - return x.FileID - } - return 0 -} - -func (x *ClientFileRequest) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *ClientFileRequest) GetVersion() int32 { - if x != nil { - return x.Version - } - return 0 -} - -func (x *ClientFileRequest) GetFileSize() int64 { - if x != nil { - return x.FileSize - } - return 0 -} - -func (x *ClientFileRequest) GetChunkSize() int32 { - if x != nil { - return x.ChunkSize - } - return 0 -} - -func (x *ClientFileRequest) GetFinishedParts() []int32 { - if x != nil { - return x.FinishedParts - } - return nil -} - -func (x *ClientFileRequest) GetTotalParts() int32 { - if x != nil { - return x.TotalParts - } - return 0 -} - -func (x *ClientFileRequest) GetSkipDelegateCall() bool { - if x != nil { - return x.SkipDelegateCall - } - return false -} - -func (x *ClientFileRequest) GetFilePath() string { - if x != nil { - return x.FilePath - } - return "" -} - -func (x *ClientFileRequest) GetTempPath() string { - if x != nil { - return x.TempPath - } - return "" -} - -func (x *ClientFileRequest) GetCheckSha256() bool { - if x != nil { - return x.CheckSha256 - } - return false -} - -func (x *ClientFileRequest) GetFileSha256() []byte { - if x != nil { - return x.FileSha256 - } - return nil -} - -func (x *ClientFileRequest) GetIsProfilePhoto() bool { - if x != nil { - return x.IsProfilePhoto - } - return false -} - -func (x *ClientFileRequest) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *ClientFileRequest) GetThumbID() int64 { - if x != nil { - return x.ThumbID - } - return 0 -} - -func (x *ClientFileRequest) GetThumbPath() string { - if x != nil { - return x.ThumbPath - } - return "" -} - -// ClientFileStatus -type ClientFileStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status int32 `protobuf:"varint,1,opt,name=Status,proto3" json:"Status,omitempty"` - Progress int64 `protobuf:"varint,2,opt,name=Progress,proto3" json:"Progress,omitempty"` - FilePath string `protobuf:"bytes,3,opt,name=FilePath,proto3" json:"FilePath,omitempty"` -} - -func (x *ClientFileStatus) Reset() { - *x = ClientFileStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientFileStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientFileStatus) ProtoMessage() {} - -func (x *ClientFileStatus) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientFileStatus.ProtoReflect.Descriptor instead. -func (*ClientFileStatus) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{25} -} - -func (x *ClientFileStatus) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -func (x *ClientFileStatus) GetProgress() int64 { - if x != nil { - return x.Progress - } - return 0 -} - -func (x *ClientFileStatus) GetFilePath() string { - if x != nil { - return x.FilePath - } - return "" -} - -// ClientGetFrequentReactions -// @Function -// @Return: ClientFrequentReactions -type ClientGetFrequentReactions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ClientGetFrequentReactions) Reset() { - *x = ClientGetFrequentReactions{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGetFrequentReactions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGetFrequentReactions) ProtoMessage() {} - -func (x *ClientGetFrequentReactions) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGetFrequentReactions.ProtoReflect.Descriptor instead. -func (*ClientGetFrequentReactions) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{26} -} - -// ClientFrequentReactions -type ClientFrequentReactions struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Reactions []string `protobuf:"bytes,1,rep,name=Reactions,proto3" json:"Reactions,omitempty"` -} - -func (x *ClientFrequentReactions) Reset() { - *x = ClientFrequentReactions{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientFrequentReactions) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientFrequentReactions) ProtoMessage() {} - -func (x *ClientFrequentReactions) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientFrequentReactions.ProtoReflect.Descriptor instead. -func (*ClientFrequentReactions) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{27} -} - -func (x *ClientFrequentReactions) GetReactions() []string { - if x != nil { - return x.Reactions - } - return nil -} - -// ClientDismissNotification -// @Function -// @Return: Bool -type ClientDismissNotification struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - Ts int64 `protobuf:"varint,2,opt,name=Ts,proto3" json:"Ts,omitempty"` -} - -func (x *ClientDismissNotification) Reset() { - *x = ClientDismissNotification{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientDismissNotification) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientDismissNotification) ProtoMessage() {} - -func (x *ClientDismissNotification) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientDismissNotification.ProtoReflect.Descriptor instead. -func (*ClientDismissNotification) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{28} -} - -func (x *ClientDismissNotification) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *ClientDismissNotification) GetTs() int64 { - if x != nil { - return x.Ts - } - return 0 -} - -// ClientGetNotificationDismissTime -// @Function -// @Return: ClientNotificationDismissTime -type ClientGetNotificationDismissTime struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peer *InputPeer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *ClientGetNotificationDismissTime) Reset() { - *x = ClientGetNotificationDismissTime{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientGetNotificationDismissTime) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientGetNotificationDismissTime) ProtoMessage() {} - -func (x *ClientGetNotificationDismissTime) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientGetNotificationDismissTime.ProtoReflect.Descriptor instead. -func (*ClientGetNotificationDismissTime) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{29} -} - -func (x *ClientGetNotificationDismissTime) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -type ClientNotificationDismissTime struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Ts int64 `protobuf:"varint,1,opt,name=Ts,proto3" json:"Ts,omitempty"` -} - -func (x *ClientNotificationDismissTime) Reset() { - *x = ClientNotificationDismissTime{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientNotificationDismissTime) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientNotificationDismissTime) ProtoMessage() {} - -func (x *ClientNotificationDismissTime) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientNotificationDismissTime.ProtoReflect.Descriptor instead. -func (*ClientNotificationDismissTime) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{30} -} - -func (x *ClientNotificationDismissTime) GetTs() int64 { - if x != nil { - return x.Ts - } - return 0 -} - -// ClientError -type ClientError struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Error string `protobuf:"bytes,1,opt,name=Error,proto3" json:"Error,omitempty"` -} - -func (x *ClientError) Reset() { - *x = ClientError{} - if protoimpl.UnsafeEnabled { - mi := &file_client_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientError) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientError) ProtoMessage() {} - -func (x *ClientError) ProtoReflect() protoreflect.Message { - mi := &file_client_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientError.ProtoReflect.Descriptor instead. -func (*ClientError) Descriptor() ([]byte, []int) { - return file_client_proto_rawDescGZIP(), []int{31} -} - -func (x *ClientError) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -var File_client_proto protoreflect.FileDescriptor - -var file_client_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, - 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xa3, 0x01, 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x24, 0x0a, 0x03, 0x43, - 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x03, 0x43, 0x61, - 0x74, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x4d, - 0x61, 0x78, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, 0x49, - 0x44, 0x12, 0x14, 0x0a, 0x05, 0x4d, 0x69, 0x6e, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x4d, 0x69, 0x6e, 0x49, 0x44, 0x22, 0x85, 0x05, 0x0a, 0x16, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x31, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x61, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x61, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0d, 0x54, - 0x68, 0x75, 0x6d, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, - 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x49, 0x4d, 0x45, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x49, 0x4d, 0x45, 0x12, 0x1c, 0x0a, - 0x09, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x4d, 0x49, 0x4d, 0x45, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x4d, 0x49, 0x4d, 0x45, 0x12, 0x18, 0x0a, 0x07, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, - 0x61, 0x66, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, - 0x44, 0x72, 0x61, 0x66, 0x74, 0x12, 0x36, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, - 0x65, 0x52, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x22, 0x0a, - 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x44, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, - 0x44, 0x12, 0x24, 0x0a, 0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, - 0x49, 0x44, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x55, - 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, - 0x44, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, - 0x18, 0x0a, 0x07, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x49, 0x44, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x07, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x49, 0x44, 0x12, 0x26, 0x0a, 0x0e, 0x46, 0x69, 0x6c, - 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0e, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x61, 0x72, 0x74, - 0x73, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x11, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, - 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x69, 0x6e, 0x79, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x18, 0x12, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x54, 0x69, 0x6e, 0x79, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x22, - 0x9a, 0x01, 0x0a, 0x12, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, - 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, - 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x22, 0xe8, 0x01, 0x0a, - 0x12, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x12, 0x22, 0x0a, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x2d, 0x0a, 0x0c, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x0c, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x30, 0x0a, 0x0d, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, 0x64, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0d, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x65, - 0x64, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x29, 0x0a, 0x13, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x12, - 0x0a, 0x04, 0x54, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x65, - 0x78, 0x74, 0x22, 0x16, 0x0a, 0x14, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x43, - 0x61, 0x63, 0x68, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x22, 0x4f, 0x0a, 0x15, 0x43, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x36, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x49, 0x6e, 0x66, 0x6f, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x84, 0x01, 0x0a, 0x13, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x29, 0x0a, 0x08, 0x50, - 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x50, 0x65, - 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x69, 0x7a, 0x65, 0x52, 0x05, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x22, 0x63, 0x0a, 0x0f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x32, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x6f, 0x74, - 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x54, 0x6f, - 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x72, 0x0a, 0x16, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x43, 0x61, 0x63, 0x68, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x34, 0x0a, 0x0a, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x0a, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x73, 0x22, 0x3e, 0x0a, 0x18, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x42, 0x6f, 0x74, 0x4b, - 0x65, 0x79, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x22, 0x51, 0x0a, 0x1b, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x44, 0x6f, 0x77, 0x6e, 0x6c, - 0x6f, 0x61, 0x64, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x32, 0x0a, 0x09, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2d, - 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x52, 0x65, 0x63, 0x65, 0x6e, - 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x47, 0x0a, - 0x12, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x61, - 0x72, 0x63, 0x68, 0x12, 0x1d, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x04, 0x44, 0x61, 0x74, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x16, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4d, 0x61, 0x6e, - 0x79, 0x12, 0x3f, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, - 0x68, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x61, 0x72, - 0x63, 0x68, 0x52, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, - 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x12, 0x22, 0x0a, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, - 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x3b, 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x50, 0x75, 0x74, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, - 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x22, 0x3e, 0x0a, 0x18, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, - 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x22, 0x35, 0x0a, 0x1d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x6c, 0x6c, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x61, - 0x72, 0x63, 0x68, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x22, 0x14, 0x0a, 0x12, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x53, 0x61, 0x76, 0x65, 0x64, 0x47, 0x69, 0x66, - 0x73, 0x22, 0x59, 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x54, 0x65, - 0x61, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x73, 0x12, 0x22, 0x0a, 0x04, 0x54, 0x65, - 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x1c, - 0x0a, 0x09, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x09, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x75, 0x74, 0x65, 0x73, 0x22, 0x5a, 0x0a, 0x12, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x4d, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x4d, 0x65, 0x6e, 0x74, - 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xbe, 0x05, 0x0a, 0x14, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, - 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x12, - 0x16, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, - 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, - 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, - 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, - 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x42, - 0x6f, 0x64, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, - 0x1a, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x12, 0x2e, 0x0a, 0x08, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x09, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, 0x72, 0x61, - 0x66, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x44, - 0x72, 0x61, 0x66, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x49, 0x44, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x46, 0x69, 0x6c, 0x65, - 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x44, 0x12, 0x24, 0x0a, 0x0d, 0x54, 0x68, 0x75, 0x6d, - 0x62, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x44, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0d, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x49, 0x44, 0x12, 0x16, - 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, - 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x49, - 0x44, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x49, 0x44, - 0x12, 0x16, 0x0a, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x31, 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x46, 0x69, 0x6c, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x0a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x54, - 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x14, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x54, 0x65, 0x61, - 0x6d, 0x49, 0x44, 0x12, 0x26, 0x0a, 0x0e, 0x54, 0x65, 0x61, 0x6d, 0x41, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x15, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x54, 0x65, 0x61, - 0x6d, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x54, - 0x69, 0x6e, 0x79, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, - 0x54, 0x69, 0x6e, 0x79, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x22, 0x4c, 0x0a, 0x0f, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x23, 0x0a, 0x04, - 0x47, 0x69, 0x66, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x47, 0x69, 0x66, - 0x73, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xfb, 0x03, 0x0a, 0x0a, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, - 0x65, 0x72, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x27, 0x0a, 0x04, - 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x16, 0x0a, - 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x50, - 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, - 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x44, 0x35, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x4d, 0x44, 0x35, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x57, - 0x61, 0x6c, 0x6c, 0x70, 0x61, 0x70, 0x65, 0x72, 0x49, 0x44, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0b, 0x57, 0x61, 0x6c, 0x6c, 0x70, 0x61, 0x70, 0x65, 0x72, 0x49, 0x44, 0x12, 0x36, 0x0a, - 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, - 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0xa1, 0x05, 0x0a, 0x11, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x4e, - 0x65, 0x78, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x52, 0x04, 0x4e, 0x65, 0x78, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, - 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x43, 0x6c, - 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, - 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, - 0x1e, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x06, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, - 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, - 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x46, 0x69, 0x6c, - 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x53, 0x69, - 0x7a, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x53, - 0x69, 0x7a, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x50, - 0x61, 0x72, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0d, 0x46, 0x69, 0x6e, 0x69, - 0x73, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x74, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x54, 0x6f, 0x74, - 0x61, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x54, - 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x53, 0x6b, 0x69, - 0x70, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x10, 0x53, 0x6b, 0x69, 0x70, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, - 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, - 0x68, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, - 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x65, 0x6d, 0x70, 0x50, 0x61, 0x74, 0x68, 0x18, 0x0e, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x54, 0x65, 0x6d, 0x70, 0x50, 0x61, 0x74, 0x68, 0x12, 0x20, 0x0a, - 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, - 0x1e, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x10, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, - 0x26, 0x0a, 0x0e, 0x49, 0x73, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x68, 0x6f, 0x74, - 0x6f, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x49, 0x73, 0x50, 0x72, 0x6f, 0x66, 0x69, - 0x6c, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x49, 0x44, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, - 0x44, 0x12, 0x18, 0x0a, 0x07, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x49, 0x44, 0x18, 0x13, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x07, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x54, - 0x68, 0x75, 0x6d, 0x62, 0x50, 0x61, 0x74, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x54, 0x68, 0x75, 0x6d, 0x62, 0x50, 0x61, 0x74, 0x68, 0x22, 0x62, 0x0a, 0x10, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, - 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x22, 0x1c, 0x0a, - 0x1a, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, 0x65, 0x74, 0x46, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x6e, 0x74, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x37, 0x0a, 0x17, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x52, 0x65, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x4f, 0x0a, 0x19, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x44, 0x69, - 0x73, 0x6d, 0x69, 0x73, 0x73, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x02, 0x54, 0x73, 0x22, 0x46, 0x0a, 0x20, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x47, - 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x69, - 0x73, 0x6d, 0x69, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x22, 0x2f, 0x0a, - 0x1d, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x54, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x54, 0x73, 0x22, 0x23, - 0x0a, 0x0b, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x14, 0x0a, - 0x05, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x45, 0x72, - 0x72, 0x6f, 0x72, 0x2a, 0xa6, 0x01, 0x0a, 0x0f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x46, 0x69, 0x6c, 0x65, 0x10, - 0x01, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x56, 0x6f, 0x69, 0x63, 0x65, 0x10, 0x03, 0x12, 0x14, 0x0a, - 0x10, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x41, 0x75, 0x64, 0x69, - 0x6f, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x4c, 0x69, 0x6e, 0x6b, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x47, 0x69, 0x66, 0x10, 0x06, 0x2a, 0x8e, 0x01, 0x0a, - 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x0b, 0x0a, 0x07, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x63, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, - 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x72, 0x6f, 0x66, 0x69, - 0x6c, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x74, 0x69, - 0x63, 0x6b, 0x65, 0x72, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x6e, - 0x61, 0x69, 0x6c, 0x10, 0x05, 0x12, 0x0d, 0x0a, 0x09, 0x57, 0x61, 0x6c, 0x6c, 0x70, 0x61, 0x70, - 0x65, 0x72, 0x10, 0x06, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x69, 0x66, 0x10, 0x07, 0x42, 0x08, 0x5a, - 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_client_proto_rawDescOnce sync.Once - file_client_proto_rawDescData = file_client_proto_rawDesc -) - -func file_client_proto_rawDescGZIP() []byte { - file_client_proto_rawDescOnce.Do(func() { - file_client_proto_rawDescData = protoimpl.X.CompressGZIP(file_client_proto_rawDescData) - }) - return file_client_proto_rawDescData -} - -var file_client_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 32) -var file_client_proto_goTypes = []interface{}{ - (ClientMediaType)(0), // 0: msg.ClientMediaType - (ClientFileType)(0), // 1: msg.ClientFileType - (*ClientGetMediaHistory)(nil), // 2: msg.ClientGetMediaHistory - (*ClientSendMessageMedia)(nil), // 3: msg.ClientSendMessageMedia - (*ClientGlobalSearch)(nil), // 4: msg.ClientGlobalSearch - (*ClientSearchResult)(nil), // 5: msg.ClientSearchResult - (*ClientContactSearch)(nil), // 6: msg.ClientContactSearch - (*ClientGetCachedMedia)(nil), // 7: msg.ClientGetCachedMedia - (*ClientCachedMediaInfo)(nil), // 8: msg.ClientCachedMediaInfo - (*ClientPeerMediaInfo)(nil), // 9: msg.ClientPeerMediaInfo - (*ClientMediaSize)(nil), // 10: msg.ClientMediaSize - (*ClientClearCachedMedia)(nil), // 11: msg.ClientClearCachedMedia - (*ClientGetLastBotKeyboard)(nil), // 12: msg.ClientGetLastBotKeyboard - (*ClientGetAllDownloadedMedia)(nil), // 13: msg.ClientGetAllDownloadedMedia - (*ClientGetRecentSearch)(nil), // 14: msg.ClientGetRecentSearch - (*ClientRecentSearch)(nil), // 15: msg.ClientRecentSearch - (*ClientRecentSearchMany)(nil), // 16: msg.ClientRecentSearchMany - (*ClientPutRecentSearch)(nil), // 17: msg.ClientPutRecentSearch - (*ClientRemoveRecentSearch)(nil), // 18: msg.ClientRemoveRecentSearch - (*ClientRemoveAllRecentSearches)(nil), // 19: msg.ClientRemoveAllRecentSearches - (*ClientGetSavedGifs)(nil), // 20: msg.ClientGetSavedGifs - (*ClientGetTeamCounters)(nil), // 21: msg.ClientGetTeamCounters - (*ClientTeamCounters)(nil), // 22: msg.ClientTeamCounters - (*ClientPendingMessage)(nil), // 23: msg.ClientPendingMessage - (*ClientFilesMany)(nil), // 24: msg.ClientFilesMany - (*ClientFile)(nil), // 25: msg.ClientFile - (*ClientFileRequest)(nil), // 26: msg.ClientFileRequest - (*ClientFileStatus)(nil), // 27: msg.ClientFileStatus - (*ClientGetFrequentReactions)(nil), // 28: msg.ClientGetFrequentReactions - (*ClientFrequentReactions)(nil), // 29: msg.ClientFrequentReactions - (*ClientDismissNotification)(nil), // 30: msg.ClientDismissNotification - (*ClientGetNotificationDismissTime)(nil), // 31: msg.ClientGetNotificationDismissTime - (*ClientNotificationDismissTime)(nil), // 32: msg.ClientNotificationDismissTime - (*ClientError)(nil), // 33: msg.ClientError - (MediaCategory)(0), // 34: msg.MediaCategory - (*InputPeer)(nil), // 35: msg.InputPeer - (InputMediaType)(0), // 36: msg.InputMediaType - (*DocumentAttribute)(nil), // 37: msg.DocumentAttribute - (*MessageEntity)(nil), // 38: msg.MessageEntity - (*UserMessage)(nil), // 39: msg.UserMessage - (*User)(nil), // 40: msg.User - (*Group)(nil), // 41: msg.Group - (PeerType)(0), // 42: msg.PeerType - (*Peer)(nil), // 43: msg.Peer - (*InputTeam)(nil), // 44: msg.InputTeam - (*FileLocation)(nil), // 45: msg.FileLocation -} -var file_client_proto_depIdxs = []int32{ - 34, // 0: msg.ClientGetMediaHistory.Cat:type_name -> msg.MediaCategory - 35, // 1: msg.ClientGetMediaHistory.Peer:type_name -> msg.InputPeer - 35, // 2: msg.ClientSendMessageMedia.Peer:type_name -> msg.InputPeer - 36, // 3: msg.ClientSendMessageMedia.MediaType:type_name -> msg.InputMediaType - 37, // 4: msg.ClientSendMessageMedia.Attributes:type_name -> msg.DocumentAttribute - 38, // 5: msg.ClientSendMessageMedia.Entities:type_name -> msg.MessageEntity - 35, // 6: msg.ClientGlobalSearch.Peer:type_name -> msg.InputPeer - 39, // 7: msg.ClientSearchResult.Messages:type_name -> msg.UserMessage - 40, // 8: msg.ClientSearchResult.Users:type_name -> msg.User - 41, // 9: msg.ClientSearchResult.Groups:type_name -> msg.Group - 40, // 10: msg.ClientSearchResult.MatchedUsers:type_name -> msg.User - 41, // 11: msg.ClientSearchResult.MatchedGroups:type_name -> msg.Group - 9, // 12: msg.ClientCachedMediaInfo.MediaInfo:type_name -> msg.ClientPeerMediaInfo - 42, // 13: msg.ClientPeerMediaInfo.PeerType:type_name -> msg.PeerType - 10, // 14: msg.ClientPeerMediaInfo.Media:type_name -> msg.ClientMediaSize - 0, // 15: msg.ClientMediaSize.MediaType:type_name -> msg.ClientMediaType - 35, // 16: msg.ClientClearCachedMedia.Peer:type_name -> msg.InputPeer - 0, // 17: msg.ClientClearCachedMedia.MediaTypes:type_name -> msg.ClientMediaType - 35, // 18: msg.ClientGetLastBotKeyboard.Peer:type_name -> msg.InputPeer - 0, // 19: msg.ClientGetAllDownloadedMedia.MediaType:type_name -> msg.ClientMediaType - 43, // 20: msg.ClientRecentSearch.Peer:type_name -> msg.Peer - 15, // 21: msg.ClientRecentSearchMany.RecentSearches:type_name -> msg.ClientRecentSearch - 40, // 22: msg.ClientRecentSearchMany.Users:type_name -> msg.User - 41, // 23: msg.ClientRecentSearchMany.Groups:type_name -> msg.Group - 35, // 24: msg.ClientPutRecentSearch.Peer:type_name -> msg.InputPeer - 35, // 25: msg.ClientRemoveRecentSearch.Peer:type_name -> msg.InputPeer - 44, // 26: msg.ClientGetTeamCounters.Team:type_name -> msg.InputTeam - 38, // 27: msg.ClientPendingMessage.Entities:type_name -> msg.MessageEntity - 36, // 28: msg.ClientPendingMessage.MediaType:type_name -> msg.InputMediaType - 45, // 29: msg.ClientPendingMessage.ServerFile:type_name -> msg.FileLocation - 25, // 30: msg.ClientFilesMany.Gifs:type_name -> msg.ClientFile - 1, // 31: msg.ClientFile.Type:type_name -> msg.ClientFileType - 37, // 32: msg.ClientFile.Attributes:type_name -> msg.DocumentAttribute - 26, // 33: msg.ClientFileRequest.Next:type_name -> msg.ClientFileRequest - 35, // 34: msg.ClientDismissNotification.Peer:type_name -> msg.InputPeer - 35, // 35: msg.ClientGetNotificationDismissTime.Peer:type_name -> msg.InputPeer - 36, // [36:36] is the sub-list for method output_type - 36, // [36:36] is the sub-list for method input_type - 36, // [36:36] is the sub-list for extension type_name - 36, // [36:36] is the sub-list for extension extendee - 0, // [0:36] is the sub-list for field type_name -} - -func init() { file_client_proto_init() } -func file_client_proto_init() { - if File_client_proto != nil { - return - } - file_core_types_proto_init() - file_chat_messages_medias_proto_init() - if !protoimpl.UnsafeEnabled { - file_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGetMediaHistory); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientSendMessageMedia); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGlobalSearch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientSearchResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientContactSearch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGetCachedMedia); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientCachedMediaInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPeerMediaInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientMediaSize); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientClearCachedMedia); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGetLastBotKeyboard); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGetAllDownloadedMedia); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGetRecentSearch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientRecentSearch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientRecentSearchMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPutRecentSearch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientRemoveRecentSearch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientRemoveAllRecentSearches); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGetSavedGifs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGetTeamCounters); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientTeamCounters); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientPendingMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientFilesMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientFile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientFileRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientFileStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGetFrequentReactions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientFrequentReactions); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientDismissNotification); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientGetNotificationDismissTime); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientNotificationDismissTime); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientError); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_client_proto_rawDesc, - NumEnums: 2, - NumMessages: 32, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_client_proto_goTypes, - DependencyIndexes: file_client_proto_depIdxs, - EnumInfos: file_client_proto_enumTypes, - MessageInfos: file_client_proto_msgTypes, - }.Build() - File_client_proto = out.File - file_client_proto_rawDesc = nil - file_client_proto_goTypes = nil - file_client_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/client.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/client.rony.go deleted file mode 100644 index e6c459d3..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/client.rony.go +++ /dev/null @@ -1,2346 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: client.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_ClientGetMediaHistory int64 = 1354863379 - -type poolClientGetMediaHistory struct { - pool sync.Pool -} - -func (p *poolClientGetMediaHistory) Get() *ClientGetMediaHistory { - x, ok := p.pool.Get().(*ClientGetMediaHistory) - if !ok { - x = &ClientGetMediaHistory{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientGetMediaHistory) Put(x *ClientGetMediaHistory) { - if x == nil { - return - } - - x.Cat = 0 - PoolInputPeer.Put(x.Peer) - x.Limit = 0 - x.MaxID = 0 - x.MinID = 0 - - p.pool.Put(x) -} - -var PoolClientGetMediaHistory = poolClientGetMediaHistory{} - -func (x *ClientGetMediaHistory) DeepCopy(z *ClientGetMediaHistory) { - z.Cat = x.Cat - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Limit = x.Limit - z.MaxID = x.MaxID - z.MinID = x.MinID -} - -func (x *ClientGetMediaHistory) Clone() *ClientGetMediaHistory { - z := &ClientGetMediaHistory{} - x.DeepCopy(z) - return z -} - -func (x *ClientGetMediaHistory) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGetMediaHistory) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGetMediaHistory) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGetMediaHistory) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGetMediaHistory) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGetMediaHistory, x) -} - -const C_ClientSendMessageMedia int64 = 1095038539 - -type poolClientSendMessageMedia struct { - pool sync.Pool -} - -func (p *poolClientSendMessageMedia) Get() *ClientSendMessageMedia { - x, ok := p.pool.Get().(*ClientSendMessageMedia) - if !ok { - x = &ClientSendMessageMedia{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientSendMessageMedia) Put(x *ClientSendMessageMedia) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MediaType = 0 - x.Caption = "" - x.FileName = "" - x.FilePath = "" - x.ThumbFilePath = "" - x.FileMIME = "" - x.ThumbMIME = "" - x.ReplyTo = 0 - x.ClearDraft = false - for _, z := range x.Attributes { - PoolDocumentAttribute.Put(z) - } - x.Attributes = x.Attributes[:0] - x.FileUploadID = "" - x.ThumbUploadID = "" - x.FileID = 0 - x.ThumbID = 0 - x.FileTotalParts = 0 - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.TinyThumb = x.TinyThumb[:0] - - p.pool.Put(x) -} - -var PoolClientSendMessageMedia = poolClientSendMessageMedia{} - -func (x *ClientSendMessageMedia) DeepCopy(z *ClientSendMessageMedia) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MediaType = x.MediaType - z.Caption = x.Caption - z.FileName = x.FileName - z.FilePath = x.FilePath - z.ThumbFilePath = x.ThumbFilePath - z.FileMIME = x.FileMIME - z.ThumbMIME = x.ThumbMIME - z.ReplyTo = x.ReplyTo - z.ClearDraft = x.ClearDraft - for idx := range x.Attributes { - if x.Attributes[idx] == nil { - continue - } - xx := PoolDocumentAttribute.Get() - x.Attributes[idx].DeepCopy(xx) - z.Attributes = append(z.Attributes, xx) - } - z.FileUploadID = x.FileUploadID - z.ThumbUploadID = x.ThumbUploadID - z.FileID = x.FileID - z.ThumbID = x.ThumbID - z.FileTotalParts = x.FileTotalParts - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.TinyThumb = append(z.TinyThumb[:0], x.TinyThumb...) -} - -func (x *ClientSendMessageMedia) Clone() *ClientSendMessageMedia { - z := &ClientSendMessageMedia{} - x.DeepCopy(z) - return z -} - -func (x *ClientSendMessageMedia) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientSendMessageMedia) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientSendMessageMedia) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientSendMessageMedia) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientSendMessageMedia) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientSendMessageMedia, x) -} - -const C_ClientGlobalSearch int64 = 1742781507 - -type poolClientGlobalSearch struct { - pool sync.Pool -} - -func (p *poolClientGlobalSearch) Get() *ClientGlobalSearch { - x, ok := p.pool.Get().(*ClientGlobalSearch) - if !ok { - x = &ClientGlobalSearch{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientGlobalSearch) Put(x *ClientGlobalSearch) { - if x == nil { - return - } - - x.Text = "" - x.LabelIDs = x.LabelIDs[:0] - PoolInputPeer.Put(x.Peer) - x.Limit = 0 - x.SenderID = 0 - - p.pool.Put(x) -} - -var PoolClientGlobalSearch = poolClientGlobalSearch{} - -func (x *ClientGlobalSearch) DeepCopy(z *ClientGlobalSearch) { - z.Text = x.Text - z.LabelIDs = append(z.LabelIDs[:0], x.LabelIDs...) - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Limit = x.Limit - z.SenderID = x.SenderID -} - -func (x *ClientGlobalSearch) Clone() *ClientGlobalSearch { - z := &ClientGlobalSearch{} - x.DeepCopy(z) - return z -} - -func (x *ClientGlobalSearch) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGlobalSearch) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGlobalSearch) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGlobalSearch) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGlobalSearch) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGlobalSearch, x) -} - -const C_ClientSearchResult int64 = 2957647709 - -type poolClientSearchResult struct { - pool sync.Pool -} - -func (p *poolClientSearchResult) Get() *ClientSearchResult { - x, ok := p.pool.Get().(*ClientSearchResult) - if !ok { - x = &ClientSearchResult{} - } - - return x -} - -func (p *poolClientSearchResult) Put(x *ClientSearchResult) { - if x == nil { - return - } - - for _, z := range x.Messages { - PoolUserMessage.Put(z) - } - x.Messages = x.Messages[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Groups { - PoolGroup.Put(z) - } - x.Groups = x.Groups[:0] - for _, z := range x.MatchedUsers { - PoolUser.Put(z) - } - x.MatchedUsers = x.MatchedUsers[:0] - for _, z := range x.MatchedGroups { - PoolGroup.Put(z) - } - x.MatchedGroups = x.MatchedGroups[:0] - - p.pool.Put(x) -} - -var PoolClientSearchResult = poolClientSearchResult{} - -func (x *ClientSearchResult) DeepCopy(z *ClientSearchResult) { - for idx := range x.Messages { - if x.Messages[idx] == nil { - continue - } - xx := PoolUserMessage.Get() - x.Messages[idx].DeepCopy(xx) - z.Messages = append(z.Messages, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Groups { - if x.Groups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.Groups[idx].DeepCopy(xx) - z.Groups = append(z.Groups, xx) - } - for idx := range x.MatchedUsers { - if x.MatchedUsers[idx] == nil { - continue - } - xx := PoolUser.Get() - x.MatchedUsers[idx].DeepCopy(xx) - z.MatchedUsers = append(z.MatchedUsers, xx) - } - for idx := range x.MatchedGroups { - if x.MatchedGroups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.MatchedGroups[idx].DeepCopy(xx) - z.MatchedGroups = append(z.MatchedGroups, xx) - } -} - -func (x *ClientSearchResult) Clone() *ClientSearchResult { - z := &ClientSearchResult{} - x.DeepCopy(z) - return z -} - -func (x *ClientSearchResult) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientSearchResult) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientSearchResult) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientSearchResult) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientSearchResult) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientSearchResult, x) -} - -const C_ClientContactSearch int64 = 1793449803 - -type poolClientContactSearch struct { - pool sync.Pool -} - -func (p *poolClientContactSearch) Get() *ClientContactSearch { - x, ok := p.pool.Get().(*ClientContactSearch) - if !ok { - x = &ClientContactSearch{} - } - - return x -} - -func (p *poolClientContactSearch) Put(x *ClientContactSearch) { - if x == nil { - return - } - - x.Text = "" - - p.pool.Put(x) -} - -var PoolClientContactSearch = poolClientContactSearch{} - -func (x *ClientContactSearch) DeepCopy(z *ClientContactSearch) { - z.Text = x.Text -} - -func (x *ClientContactSearch) Clone() *ClientContactSearch { - z := &ClientContactSearch{} - x.DeepCopy(z) - return z -} - -func (x *ClientContactSearch) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientContactSearch) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientContactSearch) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientContactSearch) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientContactSearch) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientContactSearch, x) -} - -const C_ClientGetCachedMedia int64 = 856595701 - -type poolClientGetCachedMedia struct { - pool sync.Pool -} - -func (p *poolClientGetCachedMedia) Get() *ClientGetCachedMedia { - x, ok := p.pool.Get().(*ClientGetCachedMedia) - if !ok { - x = &ClientGetCachedMedia{} - } - - return x -} - -func (p *poolClientGetCachedMedia) Put(x *ClientGetCachedMedia) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolClientGetCachedMedia = poolClientGetCachedMedia{} - -func (x *ClientGetCachedMedia) DeepCopy(z *ClientGetCachedMedia) { -} - -func (x *ClientGetCachedMedia) Clone() *ClientGetCachedMedia { - z := &ClientGetCachedMedia{} - x.DeepCopy(z) - return z -} - -func (x *ClientGetCachedMedia) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGetCachedMedia) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGetCachedMedia) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGetCachedMedia) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGetCachedMedia) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGetCachedMedia, x) -} - -const C_ClientCachedMediaInfo int64 = 442767121 - -type poolClientCachedMediaInfo struct { - pool sync.Pool -} - -func (p *poolClientCachedMediaInfo) Get() *ClientCachedMediaInfo { - x, ok := p.pool.Get().(*ClientCachedMediaInfo) - if !ok { - x = &ClientCachedMediaInfo{} - } - - return x -} - -func (p *poolClientCachedMediaInfo) Put(x *ClientCachedMediaInfo) { - if x == nil { - return - } - - for _, z := range x.MediaInfo { - PoolClientPeerMediaInfo.Put(z) - } - x.MediaInfo = x.MediaInfo[:0] - - p.pool.Put(x) -} - -var PoolClientCachedMediaInfo = poolClientCachedMediaInfo{} - -func (x *ClientCachedMediaInfo) DeepCopy(z *ClientCachedMediaInfo) { - for idx := range x.MediaInfo { - if x.MediaInfo[idx] == nil { - continue - } - xx := PoolClientPeerMediaInfo.Get() - x.MediaInfo[idx].DeepCopy(xx) - z.MediaInfo = append(z.MediaInfo, xx) - } -} - -func (x *ClientCachedMediaInfo) Clone() *ClientCachedMediaInfo { - z := &ClientCachedMediaInfo{} - x.DeepCopy(z) - return z -} - -func (x *ClientCachedMediaInfo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientCachedMediaInfo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientCachedMediaInfo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientCachedMediaInfo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientCachedMediaInfo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientCachedMediaInfo, x) -} - -const C_ClientPeerMediaInfo int64 = 2711408875 - -type poolClientPeerMediaInfo struct { - pool sync.Pool -} - -func (p *poolClientPeerMediaInfo) Get() *ClientPeerMediaInfo { - x, ok := p.pool.Get().(*ClientPeerMediaInfo) - if !ok { - x = &ClientPeerMediaInfo{} - } - - return x -} - -func (p *poolClientPeerMediaInfo) Put(x *ClientPeerMediaInfo) { - if x == nil { - return - } - - x.PeerID = 0 - x.PeerType = 0 - for _, z := range x.Media { - PoolClientMediaSize.Put(z) - } - x.Media = x.Media[:0] - - p.pool.Put(x) -} - -var PoolClientPeerMediaInfo = poolClientPeerMediaInfo{} - -func (x *ClientPeerMediaInfo) DeepCopy(z *ClientPeerMediaInfo) { - z.PeerID = x.PeerID - z.PeerType = x.PeerType - for idx := range x.Media { - if x.Media[idx] == nil { - continue - } - xx := PoolClientMediaSize.Get() - x.Media[idx].DeepCopy(xx) - z.Media = append(z.Media, xx) - } -} - -func (x *ClientPeerMediaInfo) Clone() *ClientPeerMediaInfo { - z := &ClientPeerMediaInfo{} - x.DeepCopy(z) - return z -} - -func (x *ClientPeerMediaInfo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientPeerMediaInfo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientPeerMediaInfo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientPeerMediaInfo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientPeerMediaInfo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientPeerMediaInfo, x) -} - -const C_ClientMediaSize int64 = 1541024203 - -type poolClientMediaSize struct { - pool sync.Pool -} - -func (p *poolClientMediaSize) Get() *ClientMediaSize { - x, ok := p.pool.Get().(*ClientMediaSize) - if !ok { - x = &ClientMediaSize{} - } - - return x -} - -func (p *poolClientMediaSize) Put(x *ClientMediaSize) { - if x == nil { - return - } - - x.MediaType = 0 - x.TotalSize = 0 - - p.pool.Put(x) -} - -var PoolClientMediaSize = poolClientMediaSize{} - -func (x *ClientMediaSize) DeepCopy(z *ClientMediaSize) { - z.MediaType = x.MediaType - z.TotalSize = x.TotalSize -} - -func (x *ClientMediaSize) Clone() *ClientMediaSize { - z := &ClientMediaSize{} - x.DeepCopy(z) - return z -} - -func (x *ClientMediaSize) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientMediaSize) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientMediaSize) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientMediaSize) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientMediaSize) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientMediaSize, x) -} - -const C_ClientClearCachedMedia int64 = 1199927718 - -type poolClientClearCachedMedia struct { - pool sync.Pool -} - -func (p *poolClientClearCachedMedia) Get() *ClientClearCachedMedia { - x, ok := p.pool.Get().(*ClientClearCachedMedia) - if !ok { - x = &ClientClearCachedMedia{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientClearCachedMedia) Put(x *ClientClearCachedMedia) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.MediaTypes = x.MediaTypes[:0] - - p.pool.Put(x) -} - -var PoolClientClearCachedMedia = poolClientClearCachedMedia{} - -func (x *ClientClearCachedMedia) DeepCopy(z *ClientClearCachedMedia) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.MediaTypes = append(z.MediaTypes[:0], x.MediaTypes...) -} - -func (x *ClientClearCachedMedia) Clone() *ClientClearCachedMedia { - z := &ClientClearCachedMedia{} - x.DeepCopy(z) - return z -} - -func (x *ClientClearCachedMedia) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientClearCachedMedia) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientClearCachedMedia) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientClearCachedMedia) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientClearCachedMedia) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientClearCachedMedia, x) -} - -const C_ClientGetLastBotKeyboard int64 = 177544569 - -type poolClientGetLastBotKeyboard struct { - pool sync.Pool -} - -func (p *poolClientGetLastBotKeyboard) Get() *ClientGetLastBotKeyboard { - x, ok := p.pool.Get().(*ClientGetLastBotKeyboard) - if !ok { - x = &ClientGetLastBotKeyboard{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientGetLastBotKeyboard) Put(x *ClientGetLastBotKeyboard) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolClientGetLastBotKeyboard = poolClientGetLastBotKeyboard{} - -func (x *ClientGetLastBotKeyboard) DeepCopy(z *ClientGetLastBotKeyboard) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *ClientGetLastBotKeyboard) Clone() *ClientGetLastBotKeyboard { - z := &ClientGetLastBotKeyboard{} - x.DeepCopy(z) - return z -} - -func (x *ClientGetLastBotKeyboard) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGetLastBotKeyboard) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGetLastBotKeyboard) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGetLastBotKeyboard) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGetLastBotKeyboard) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGetLastBotKeyboard, x) -} - -const C_ClientGetAllDownloadedMedia int64 = 729082453 - -type poolClientGetAllDownloadedMedia struct { - pool sync.Pool -} - -func (p *poolClientGetAllDownloadedMedia) Get() *ClientGetAllDownloadedMedia { - x, ok := p.pool.Get().(*ClientGetAllDownloadedMedia) - if !ok { - x = &ClientGetAllDownloadedMedia{} - } - - return x -} - -func (p *poolClientGetAllDownloadedMedia) Put(x *ClientGetAllDownloadedMedia) { - if x == nil { - return - } - - x.MediaType = 0 - - p.pool.Put(x) -} - -var PoolClientGetAllDownloadedMedia = poolClientGetAllDownloadedMedia{} - -func (x *ClientGetAllDownloadedMedia) DeepCopy(z *ClientGetAllDownloadedMedia) { - z.MediaType = x.MediaType -} - -func (x *ClientGetAllDownloadedMedia) Clone() *ClientGetAllDownloadedMedia { - z := &ClientGetAllDownloadedMedia{} - x.DeepCopy(z) - return z -} - -func (x *ClientGetAllDownloadedMedia) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGetAllDownloadedMedia) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGetAllDownloadedMedia) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGetAllDownloadedMedia) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGetAllDownloadedMedia) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGetAllDownloadedMedia, x) -} - -const C_ClientGetRecentSearch int64 = 2622949116 - -type poolClientGetRecentSearch struct { - pool sync.Pool -} - -func (p *poolClientGetRecentSearch) Get() *ClientGetRecentSearch { - x, ok := p.pool.Get().(*ClientGetRecentSearch) - if !ok { - x = &ClientGetRecentSearch{} - } - - return x -} - -func (p *poolClientGetRecentSearch) Put(x *ClientGetRecentSearch) { - if x == nil { - return - } - - x.Limit = 0 - - p.pool.Put(x) -} - -var PoolClientGetRecentSearch = poolClientGetRecentSearch{} - -func (x *ClientGetRecentSearch) DeepCopy(z *ClientGetRecentSearch) { - z.Limit = x.Limit -} - -func (x *ClientGetRecentSearch) Clone() *ClientGetRecentSearch { - z := &ClientGetRecentSearch{} - x.DeepCopy(z) - return z -} - -func (x *ClientGetRecentSearch) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGetRecentSearch) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGetRecentSearch) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGetRecentSearch) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGetRecentSearch) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGetRecentSearch, x) -} - -const C_ClientRecentSearch int64 = 2069517672 - -type poolClientRecentSearch struct { - pool sync.Pool -} - -func (p *poolClientRecentSearch) Get() *ClientRecentSearch { - x, ok := p.pool.Get().(*ClientRecentSearch) - if !ok { - x = &ClientRecentSearch{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolClientRecentSearch) Put(x *ClientRecentSearch) { - if x == nil { - return - } - - PoolPeer.Put(x.Peer) - x.Date = 0 - - p.pool.Put(x) -} - -var PoolClientRecentSearch = poolClientRecentSearch{} - -func (x *ClientRecentSearch) DeepCopy(z *ClientRecentSearch) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.Date = x.Date -} - -func (x *ClientRecentSearch) Clone() *ClientRecentSearch { - z := &ClientRecentSearch{} - x.DeepCopy(z) - return z -} - -func (x *ClientRecentSearch) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientRecentSearch) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientRecentSearch) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientRecentSearch) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientRecentSearch) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientRecentSearch, x) -} - -const C_ClientRecentSearchMany int64 = 3236847495 - -type poolClientRecentSearchMany struct { - pool sync.Pool -} - -func (p *poolClientRecentSearchMany) Get() *ClientRecentSearchMany { - x, ok := p.pool.Get().(*ClientRecentSearchMany) - if !ok { - x = &ClientRecentSearchMany{} - } - - return x -} - -func (p *poolClientRecentSearchMany) Put(x *ClientRecentSearchMany) { - if x == nil { - return - } - - for _, z := range x.RecentSearches { - PoolClientRecentSearch.Put(z) - } - x.RecentSearches = x.RecentSearches[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Groups { - PoolGroup.Put(z) - } - x.Groups = x.Groups[:0] - - p.pool.Put(x) -} - -var PoolClientRecentSearchMany = poolClientRecentSearchMany{} - -func (x *ClientRecentSearchMany) DeepCopy(z *ClientRecentSearchMany) { - for idx := range x.RecentSearches { - if x.RecentSearches[idx] == nil { - continue - } - xx := PoolClientRecentSearch.Get() - x.RecentSearches[idx].DeepCopy(xx) - z.RecentSearches = append(z.RecentSearches, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Groups { - if x.Groups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.Groups[idx].DeepCopy(xx) - z.Groups = append(z.Groups, xx) - } -} - -func (x *ClientRecentSearchMany) Clone() *ClientRecentSearchMany { - z := &ClientRecentSearchMany{} - x.DeepCopy(z) - return z -} - -func (x *ClientRecentSearchMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientRecentSearchMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientRecentSearchMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientRecentSearchMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientRecentSearchMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientRecentSearchMany, x) -} - -const C_ClientPutRecentSearch int64 = 629582533 - -type poolClientPutRecentSearch struct { - pool sync.Pool -} - -func (p *poolClientPutRecentSearch) Get() *ClientPutRecentSearch { - x, ok := p.pool.Get().(*ClientPutRecentSearch) - if !ok { - x = &ClientPutRecentSearch{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientPutRecentSearch) Put(x *ClientPutRecentSearch) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolClientPutRecentSearch = poolClientPutRecentSearch{} - -func (x *ClientPutRecentSearch) DeepCopy(z *ClientPutRecentSearch) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *ClientPutRecentSearch) Clone() *ClientPutRecentSearch { - z := &ClientPutRecentSearch{} - x.DeepCopy(z) - return z -} - -func (x *ClientPutRecentSearch) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientPutRecentSearch) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientPutRecentSearch) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientPutRecentSearch) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientPutRecentSearch) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientPutRecentSearch, x) -} - -const C_ClientRemoveRecentSearch int64 = 1281490259 - -type poolClientRemoveRecentSearch struct { - pool sync.Pool -} - -func (p *poolClientRemoveRecentSearch) Get() *ClientRemoveRecentSearch { - x, ok := p.pool.Get().(*ClientRemoveRecentSearch) - if !ok { - x = &ClientRemoveRecentSearch{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientRemoveRecentSearch) Put(x *ClientRemoveRecentSearch) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolClientRemoveRecentSearch = poolClientRemoveRecentSearch{} - -func (x *ClientRemoveRecentSearch) DeepCopy(z *ClientRemoveRecentSearch) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *ClientRemoveRecentSearch) Clone() *ClientRemoveRecentSearch { - z := &ClientRemoveRecentSearch{} - x.DeepCopy(z) - return z -} - -func (x *ClientRemoveRecentSearch) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientRemoveRecentSearch) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientRemoveRecentSearch) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientRemoveRecentSearch) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientRemoveRecentSearch) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientRemoveRecentSearch, x) -} - -const C_ClientRemoveAllRecentSearches int64 = 3599155822 - -type poolClientRemoveAllRecentSearches struct { - pool sync.Pool -} - -func (p *poolClientRemoveAllRecentSearches) Get() *ClientRemoveAllRecentSearches { - x, ok := p.pool.Get().(*ClientRemoveAllRecentSearches) - if !ok { - x = &ClientRemoveAllRecentSearches{} - } - - return x -} - -func (p *poolClientRemoveAllRecentSearches) Put(x *ClientRemoveAllRecentSearches) { - if x == nil { - return - } - - x.Extra = false - - p.pool.Put(x) -} - -var PoolClientRemoveAllRecentSearches = poolClientRemoveAllRecentSearches{} - -func (x *ClientRemoveAllRecentSearches) DeepCopy(z *ClientRemoveAllRecentSearches) { - z.Extra = x.Extra -} - -func (x *ClientRemoveAllRecentSearches) Clone() *ClientRemoveAllRecentSearches { - z := &ClientRemoveAllRecentSearches{} - x.DeepCopy(z) - return z -} - -func (x *ClientRemoveAllRecentSearches) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientRemoveAllRecentSearches) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientRemoveAllRecentSearches) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientRemoveAllRecentSearches) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientRemoveAllRecentSearches) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientRemoveAllRecentSearches, x) -} - -const C_ClientGetSavedGifs int64 = 3028067090 - -type poolClientGetSavedGifs struct { - pool sync.Pool -} - -func (p *poolClientGetSavedGifs) Get() *ClientGetSavedGifs { - x, ok := p.pool.Get().(*ClientGetSavedGifs) - if !ok { - x = &ClientGetSavedGifs{} - } - - return x -} - -func (p *poolClientGetSavedGifs) Put(x *ClientGetSavedGifs) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolClientGetSavedGifs = poolClientGetSavedGifs{} - -func (x *ClientGetSavedGifs) DeepCopy(z *ClientGetSavedGifs) { -} - -func (x *ClientGetSavedGifs) Clone() *ClientGetSavedGifs { - z := &ClientGetSavedGifs{} - x.DeepCopy(z) - return z -} - -func (x *ClientGetSavedGifs) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGetSavedGifs) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGetSavedGifs) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGetSavedGifs) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGetSavedGifs) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGetSavedGifs, x) -} - -const C_ClientGetTeamCounters int64 = 3403301140 - -type poolClientGetTeamCounters struct { - pool sync.Pool -} - -func (p *poolClientGetTeamCounters) Get() *ClientGetTeamCounters { - x, ok := p.pool.Get().(*ClientGetTeamCounters) - if !ok { - x = &ClientGetTeamCounters{} - } - - x.Team = PoolInputTeam.Get() - - return x -} - -func (p *poolClientGetTeamCounters) Put(x *ClientGetTeamCounters) { - if x == nil { - return - } - - PoolInputTeam.Put(x.Team) - x.WithMutes = false - - p.pool.Put(x) -} - -var PoolClientGetTeamCounters = poolClientGetTeamCounters{} - -func (x *ClientGetTeamCounters) DeepCopy(z *ClientGetTeamCounters) { - if x.Team != nil { - if z.Team == nil { - z.Team = PoolInputTeam.Get() - } - x.Team.DeepCopy(z.Team) - } else { - PoolInputTeam.Put(z.Team) - z.Team = nil - } - z.WithMutes = x.WithMutes -} - -func (x *ClientGetTeamCounters) Clone() *ClientGetTeamCounters { - z := &ClientGetTeamCounters{} - x.DeepCopy(z) - return z -} - -func (x *ClientGetTeamCounters) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGetTeamCounters) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGetTeamCounters) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGetTeamCounters) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGetTeamCounters) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGetTeamCounters, x) -} - -const C_ClientTeamCounters int64 = 769069696 - -type poolClientTeamCounters struct { - pool sync.Pool -} - -func (p *poolClientTeamCounters) Get() *ClientTeamCounters { - x, ok := p.pool.Get().(*ClientTeamCounters) - if !ok { - x = &ClientTeamCounters{} - } - - return x -} - -func (p *poolClientTeamCounters) Put(x *ClientTeamCounters) { - if x == nil { - return - } - - x.UnreadCount = 0 - x.MentionCount = 0 - - p.pool.Put(x) -} - -var PoolClientTeamCounters = poolClientTeamCounters{} - -func (x *ClientTeamCounters) DeepCopy(z *ClientTeamCounters) { - z.UnreadCount = x.UnreadCount - z.MentionCount = x.MentionCount -} - -func (x *ClientTeamCounters) Clone() *ClientTeamCounters { - z := &ClientTeamCounters{} - x.DeepCopy(z) - return z -} - -func (x *ClientTeamCounters) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientTeamCounters) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientTeamCounters) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientTeamCounters) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientTeamCounters) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientTeamCounters, x) -} - -const C_ClientPendingMessage int64 = 2164891929 - -type poolClientPendingMessage struct { - pool sync.Pool -} - -func (p *poolClientPendingMessage) Get() *ClientPendingMessage { - x, ok := p.pool.Get().(*ClientPendingMessage) - if !ok { - x = &ClientPendingMessage{} - } - - x.ServerFile = PoolFileLocation.Get() - - return x -} - -func (p *poolClientPendingMessage) Put(x *ClientPendingMessage) { - if x == nil { - return - } - - x.ID = 0 - x.RequestID = 0 - x.PeerID = 0 - x.PeerType = 0 - x.AccessHash = 0 - x.CreatedOn = 0 - x.ReplyTo = 0 - x.Body = "" - x.SenderID = 0 - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.MediaType = 0 - x.Media = x.Media[:0] - x.ClearDraft = false - x.FileUploadID = "" - x.ThumbUploadID = "" - x.FileID = 0 - x.ThumbID = 0 - x.Sha256 = x.Sha256[:0] - PoolFileLocation.Put(x.ServerFile) - x.TeamID = 0 - x.TeamAccessHash = 0 - x.TinyThumb = x.TinyThumb[:0] - - p.pool.Put(x) -} - -var PoolClientPendingMessage = poolClientPendingMessage{} - -func (x *ClientPendingMessage) DeepCopy(z *ClientPendingMessage) { - z.ID = x.ID - z.RequestID = x.RequestID - z.PeerID = x.PeerID - z.PeerType = x.PeerType - z.AccessHash = x.AccessHash - z.CreatedOn = x.CreatedOn - z.ReplyTo = x.ReplyTo - z.Body = x.Body - z.SenderID = x.SenderID - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.MediaType = x.MediaType - z.Media = append(z.Media[:0], x.Media...) - z.ClearDraft = x.ClearDraft - z.FileUploadID = x.FileUploadID - z.ThumbUploadID = x.ThumbUploadID - z.FileID = x.FileID - z.ThumbID = x.ThumbID - z.Sha256 = append(z.Sha256[:0], x.Sha256...) - if x.ServerFile != nil { - if z.ServerFile == nil { - z.ServerFile = PoolFileLocation.Get() - } - x.ServerFile.DeepCopy(z.ServerFile) - } else { - PoolFileLocation.Put(z.ServerFile) - z.ServerFile = nil - } - z.TeamID = x.TeamID - z.TeamAccessHash = x.TeamAccessHash - z.TinyThumb = append(z.TinyThumb[:0], x.TinyThumb...) -} - -func (x *ClientPendingMessage) Clone() *ClientPendingMessage { - z := &ClientPendingMessage{} - x.DeepCopy(z) - return z -} - -func (x *ClientPendingMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientPendingMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientPendingMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientPendingMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientPendingMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientPendingMessage, x) -} - -const C_ClientFilesMany int64 = 1414992553 - -type poolClientFilesMany struct { - pool sync.Pool -} - -func (p *poolClientFilesMany) Get() *ClientFilesMany { - x, ok := p.pool.Get().(*ClientFilesMany) - if !ok { - x = &ClientFilesMany{} - } - - return x -} - -func (p *poolClientFilesMany) Put(x *ClientFilesMany) { - if x == nil { - return - } - - for _, z := range x.Gifs { - PoolClientFile.Put(z) - } - x.Gifs = x.Gifs[:0] - x.Total = 0 - - p.pool.Put(x) -} - -var PoolClientFilesMany = poolClientFilesMany{} - -func (x *ClientFilesMany) DeepCopy(z *ClientFilesMany) { - for idx := range x.Gifs { - if x.Gifs[idx] == nil { - continue - } - xx := PoolClientFile.Get() - x.Gifs[idx].DeepCopy(xx) - z.Gifs = append(z.Gifs, xx) - } - z.Total = x.Total -} - -func (x *ClientFilesMany) Clone() *ClientFilesMany { - z := &ClientFilesMany{} - x.DeepCopy(z) - return z -} - -func (x *ClientFilesMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientFilesMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientFilesMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientFilesMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientFilesMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientFilesMany, x) -} - -const C_ClientFile int64 = 155127968 - -type poolClientFile struct { - pool sync.Pool -} - -func (p *poolClientFile) Get() *ClientFile { - x, ok := p.pool.Get().(*ClientFile) - if !ok { - x = &ClientFile{} - } - - return x -} - -func (p *poolClientFile) Put(x *ClientFile) { - if x == nil { - return - } - - x.ClusterID = 0 - x.FileID = 0 - x.AccessHash = 0 - x.Type = 0 - x.MimeType = "" - x.UserID = 0 - x.GroupID = 0 - x.FileSize = 0 - x.MessageID = 0 - x.PeerID = 0 - x.PeerType = 0 - x.Version = 0 - x.Extension = "" - x.MD5Checksum = "" - x.WallpaperID = 0 - for _, z := range x.Attributes { - PoolDocumentAttribute.Put(z) - } - x.Attributes = x.Attributes[:0] - - p.pool.Put(x) -} - -var PoolClientFile = poolClientFile{} - -func (x *ClientFile) DeepCopy(z *ClientFile) { - z.ClusterID = x.ClusterID - z.FileID = x.FileID - z.AccessHash = x.AccessHash - z.Type = x.Type - z.MimeType = x.MimeType - z.UserID = x.UserID - z.GroupID = x.GroupID - z.FileSize = x.FileSize - z.MessageID = x.MessageID - z.PeerID = x.PeerID - z.PeerType = x.PeerType - z.Version = x.Version - z.Extension = x.Extension - z.MD5Checksum = x.MD5Checksum - z.WallpaperID = x.WallpaperID - for idx := range x.Attributes { - if x.Attributes[idx] == nil { - continue - } - xx := PoolDocumentAttribute.Get() - x.Attributes[idx].DeepCopy(xx) - z.Attributes = append(z.Attributes, xx) - } -} - -func (x *ClientFile) Clone() *ClientFile { - z := &ClientFile{} - x.DeepCopy(z) - return z -} - -func (x *ClientFile) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientFile) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientFile) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientFile) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientFile) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientFile, x) -} - -const C_ClientFileRequest int64 = 3995993899 - -type poolClientFileRequest struct { - pool sync.Pool -} - -func (p *poolClientFileRequest) Get() *ClientFileRequest { - x, ok := p.pool.Get().(*ClientFileRequest) - if !ok { - x = &ClientFileRequest{} - } - - x.Next = PoolClientFileRequest.Get() - - return x -} - -func (p *poolClientFileRequest) Put(x *ClientFileRequest) { - if x == nil { - return - } - - PoolClientFileRequest.Put(x.Next) - x.PeerID = 0 - x.PeerType = 0 - x.MessageID = 0 - x.ClusterID = 0 - x.FileID = 0 - x.AccessHash = 0 - x.Version = 0 - x.FileSize = 0 - x.ChunkSize = 0 - x.FinishedParts = x.FinishedParts[:0] - x.TotalParts = 0 - x.SkipDelegateCall = false - x.FilePath = "" - x.TempPath = "" - x.CheckSha256 = false - x.FileSha256 = x.FileSha256[:0] - x.IsProfilePhoto = false - x.GroupID = 0 - x.ThumbID = 0 - x.ThumbPath = "" - - p.pool.Put(x) -} - -var PoolClientFileRequest = poolClientFileRequest{} - -func (x *ClientFileRequest) DeepCopy(z *ClientFileRequest) { - if x.Next != nil { - if z.Next == nil { - z.Next = PoolClientFileRequest.Get() - } - x.Next.DeepCopy(z.Next) - } else { - PoolClientFileRequest.Put(z.Next) - z.Next = nil - } - z.PeerID = x.PeerID - z.PeerType = x.PeerType - z.MessageID = x.MessageID - z.ClusterID = x.ClusterID - z.FileID = x.FileID - z.AccessHash = x.AccessHash - z.Version = x.Version - z.FileSize = x.FileSize - z.ChunkSize = x.ChunkSize - z.FinishedParts = append(z.FinishedParts[:0], x.FinishedParts...) - z.TotalParts = x.TotalParts - z.SkipDelegateCall = x.SkipDelegateCall - z.FilePath = x.FilePath - z.TempPath = x.TempPath - z.CheckSha256 = x.CheckSha256 - z.FileSha256 = append(z.FileSha256[:0], x.FileSha256...) - z.IsProfilePhoto = x.IsProfilePhoto - z.GroupID = x.GroupID - z.ThumbID = x.ThumbID - z.ThumbPath = x.ThumbPath -} - -func (x *ClientFileRequest) Clone() *ClientFileRequest { - z := &ClientFileRequest{} - x.DeepCopy(z) - return z -} - -func (x *ClientFileRequest) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientFileRequest) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientFileRequest) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientFileRequest) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientFileRequest) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientFileRequest, x) -} - -const C_ClientFileStatus int64 = 2731095358 - -type poolClientFileStatus struct { - pool sync.Pool -} - -func (p *poolClientFileStatus) Get() *ClientFileStatus { - x, ok := p.pool.Get().(*ClientFileStatus) - if !ok { - x = &ClientFileStatus{} - } - - return x -} - -func (p *poolClientFileStatus) Put(x *ClientFileStatus) { - if x == nil { - return - } - - x.Status = 0 - x.Progress = 0 - x.FilePath = "" - - p.pool.Put(x) -} - -var PoolClientFileStatus = poolClientFileStatus{} - -func (x *ClientFileStatus) DeepCopy(z *ClientFileStatus) { - z.Status = x.Status - z.Progress = x.Progress - z.FilePath = x.FilePath -} - -func (x *ClientFileStatus) Clone() *ClientFileStatus { - z := &ClientFileStatus{} - x.DeepCopy(z) - return z -} - -func (x *ClientFileStatus) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientFileStatus) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientFileStatus) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientFileStatus) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientFileStatus) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientFileStatus, x) -} - -const C_ClientGetFrequentReactions int64 = 2954334910 - -type poolClientGetFrequentReactions struct { - pool sync.Pool -} - -func (p *poolClientGetFrequentReactions) Get() *ClientGetFrequentReactions { - x, ok := p.pool.Get().(*ClientGetFrequentReactions) - if !ok { - x = &ClientGetFrequentReactions{} - } - - return x -} - -func (p *poolClientGetFrequentReactions) Put(x *ClientGetFrequentReactions) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolClientGetFrequentReactions = poolClientGetFrequentReactions{} - -func (x *ClientGetFrequentReactions) DeepCopy(z *ClientGetFrequentReactions) { -} - -func (x *ClientGetFrequentReactions) Clone() *ClientGetFrequentReactions { - z := &ClientGetFrequentReactions{} - x.DeepCopy(z) - return z -} - -func (x *ClientGetFrequentReactions) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGetFrequentReactions) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGetFrequentReactions) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGetFrequentReactions) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGetFrequentReactions) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGetFrequentReactions, x) -} - -const C_ClientFrequentReactions int64 = 1422804314 - -type poolClientFrequentReactions struct { - pool sync.Pool -} - -func (p *poolClientFrequentReactions) Get() *ClientFrequentReactions { - x, ok := p.pool.Get().(*ClientFrequentReactions) - if !ok { - x = &ClientFrequentReactions{} - } - - return x -} - -func (p *poolClientFrequentReactions) Put(x *ClientFrequentReactions) { - if x == nil { - return - } - - x.Reactions = x.Reactions[:0] - - p.pool.Put(x) -} - -var PoolClientFrequentReactions = poolClientFrequentReactions{} - -func (x *ClientFrequentReactions) DeepCopy(z *ClientFrequentReactions) { - z.Reactions = append(z.Reactions[:0], x.Reactions...) -} - -func (x *ClientFrequentReactions) Clone() *ClientFrequentReactions { - z := &ClientFrequentReactions{} - x.DeepCopy(z) - return z -} - -func (x *ClientFrequentReactions) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientFrequentReactions) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientFrequentReactions) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientFrequentReactions) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientFrequentReactions) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientFrequentReactions, x) -} - -const C_ClientDismissNotification int64 = 1698398006 - -type poolClientDismissNotification struct { - pool sync.Pool -} - -func (p *poolClientDismissNotification) Get() *ClientDismissNotification { - x, ok := p.pool.Get().(*ClientDismissNotification) - if !ok { - x = &ClientDismissNotification{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientDismissNotification) Put(x *ClientDismissNotification) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - x.Ts = 0 - - p.pool.Put(x) -} - -var PoolClientDismissNotification = poolClientDismissNotification{} - -func (x *ClientDismissNotification) DeepCopy(z *ClientDismissNotification) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Ts = x.Ts -} - -func (x *ClientDismissNotification) Clone() *ClientDismissNotification { - z := &ClientDismissNotification{} - x.DeepCopy(z) - return z -} - -func (x *ClientDismissNotification) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientDismissNotification) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientDismissNotification) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientDismissNotification) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientDismissNotification) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientDismissNotification, x) -} - -const C_ClientGetNotificationDismissTime int64 = 4106535811 - -type poolClientGetNotificationDismissTime struct { - pool sync.Pool -} - -func (p *poolClientGetNotificationDismissTime) Get() *ClientGetNotificationDismissTime { - x, ok := p.pool.Get().(*ClientGetNotificationDismissTime) - if !ok { - x = &ClientGetNotificationDismissTime{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolClientGetNotificationDismissTime) Put(x *ClientGetNotificationDismissTime) { - if x == nil { - return - } - - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolClientGetNotificationDismissTime = poolClientGetNotificationDismissTime{} - -func (x *ClientGetNotificationDismissTime) DeepCopy(z *ClientGetNotificationDismissTime) { - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *ClientGetNotificationDismissTime) Clone() *ClientGetNotificationDismissTime { - z := &ClientGetNotificationDismissTime{} - x.DeepCopy(z) - return z -} - -func (x *ClientGetNotificationDismissTime) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientGetNotificationDismissTime) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientGetNotificationDismissTime) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientGetNotificationDismissTime) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientGetNotificationDismissTime) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientGetNotificationDismissTime, x) -} - -const C_ClientNotificationDismissTime int64 = 3077814065 - -type poolClientNotificationDismissTime struct { - pool sync.Pool -} - -func (p *poolClientNotificationDismissTime) Get() *ClientNotificationDismissTime { - x, ok := p.pool.Get().(*ClientNotificationDismissTime) - if !ok { - x = &ClientNotificationDismissTime{} - } - - return x -} - -func (p *poolClientNotificationDismissTime) Put(x *ClientNotificationDismissTime) { - if x == nil { - return - } - - x.Ts = 0 - - p.pool.Put(x) -} - -var PoolClientNotificationDismissTime = poolClientNotificationDismissTime{} - -func (x *ClientNotificationDismissTime) DeepCopy(z *ClientNotificationDismissTime) { - z.Ts = x.Ts -} - -func (x *ClientNotificationDismissTime) Clone() *ClientNotificationDismissTime { - z := &ClientNotificationDismissTime{} - x.DeepCopy(z) - return z -} - -func (x *ClientNotificationDismissTime) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientNotificationDismissTime) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientNotificationDismissTime) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientNotificationDismissTime) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientNotificationDismissTime) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientNotificationDismissTime, x) -} - -const C_ClientError int64 = 2520362971 - -type poolClientError struct { - pool sync.Pool -} - -func (p *poolClientError) Get() *ClientError { - x, ok := p.pool.Get().(*ClientError) - if !ok { - x = &ClientError{} - } - - return x -} - -func (p *poolClientError) Put(x *ClientError) { - if x == nil { - return - } - - x.Error = "" - - p.pool.Put(x) -} - -var PoolClientError = poolClientError{} - -func (x *ClientError) DeepCopy(z *ClientError) { - z.Error = x.Error -} - -func (x *ClientError) Clone() *ClientError { - z := &ClientError{} - x.DeepCopy(z) - return z -} - -func (x *ClientError) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientError) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientError) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientError) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientError) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientError, x) -} - -func init() { - registry.RegisterConstructor(1354863379, "ClientGetMediaHistory") - registry.RegisterConstructor(1095038539, "ClientSendMessageMedia") - registry.RegisterConstructor(1742781507, "ClientGlobalSearch") - registry.RegisterConstructor(2957647709, "ClientSearchResult") - registry.RegisterConstructor(1793449803, "ClientContactSearch") - registry.RegisterConstructor(856595701, "ClientGetCachedMedia") - registry.RegisterConstructor(442767121, "ClientCachedMediaInfo") - registry.RegisterConstructor(2711408875, "ClientPeerMediaInfo") - registry.RegisterConstructor(1541024203, "ClientMediaSize") - registry.RegisterConstructor(1199927718, "ClientClearCachedMedia") - registry.RegisterConstructor(177544569, "ClientGetLastBotKeyboard") - registry.RegisterConstructor(729082453, "ClientGetAllDownloadedMedia") - registry.RegisterConstructor(2622949116, "ClientGetRecentSearch") - registry.RegisterConstructor(2069517672, "ClientRecentSearch") - registry.RegisterConstructor(3236847495, "ClientRecentSearchMany") - registry.RegisterConstructor(629582533, "ClientPutRecentSearch") - registry.RegisterConstructor(1281490259, "ClientRemoveRecentSearch") - registry.RegisterConstructor(3599155822, "ClientRemoveAllRecentSearches") - registry.RegisterConstructor(3028067090, "ClientGetSavedGifs") - registry.RegisterConstructor(3403301140, "ClientGetTeamCounters") - registry.RegisterConstructor(769069696, "ClientTeamCounters") - registry.RegisterConstructor(2164891929, "ClientPendingMessage") - registry.RegisterConstructor(1414992553, "ClientFilesMany") - registry.RegisterConstructor(155127968, "ClientFile") - registry.RegisterConstructor(3995993899, "ClientFileRequest") - registry.RegisterConstructor(2731095358, "ClientFileStatus") - registry.RegisterConstructor(2954334910, "ClientGetFrequentReactions") - registry.RegisterConstructor(1422804314, "ClientFrequentReactions") - registry.RegisterConstructor(1698398006, "ClientDismissNotification") - registry.RegisterConstructor(4106535811, "ClientGetNotificationDismissTime") - registry.RegisterConstructor(3077814065, "ClientNotificationDismissTime") - registry.RegisterConstructor(2520362971, "ClientError") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/client.updates.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/client.updates.pb.go deleted file mode 100644 index cf8c366a..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/client.updates.pb.go +++ /dev/null @@ -1,260 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: client.updates.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// ClientPendingMessageDelivery -type ClientUpdatePendingMessageDelivery struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Messages *UserMessage `protobuf:"bytes,1,opt,name=Messages,proto3" json:"Messages,omitempty"` - PendingMessage *ClientPendingMessage `protobuf:"bytes,2,opt,name=PendingMessage,proto3" json:"PendingMessage,omitempty"` - Success bool `protobuf:"varint,3,opt,name=Success,proto3" json:"Success,omitempty"` -} - -func (x *ClientUpdatePendingMessageDelivery) Reset() { - *x = ClientUpdatePendingMessageDelivery{} - if protoimpl.UnsafeEnabled { - mi := &file_client_updates_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientUpdatePendingMessageDelivery) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientUpdatePendingMessageDelivery) ProtoMessage() {} - -func (x *ClientUpdatePendingMessageDelivery) ProtoReflect() protoreflect.Message { - mi := &file_client_updates_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientUpdatePendingMessageDelivery.ProtoReflect.Descriptor instead. -func (*ClientUpdatePendingMessageDelivery) Descriptor() ([]byte, []int) { - return file_client_updates_proto_rawDescGZIP(), []int{0} -} - -func (x *ClientUpdatePendingMessageDelivery) GetMessages() *UserMessage { - if x != nil { - return x.Messages - } - return nil -} - -func (x *ClientUpdatePendingMessageDelivery) GetPendingMessage() *ClientPendingMessage { - if x != nil { - return x.PendingMessage - } - return nil -} - -func (x *ClientUpdatePendingMessageDelivery) GetSuccess() bool { - if x != nil { - return x.Success - } - return false -} - -// ClientUpdateMessageDeleted -type ClientUpdateMessagesDeleted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PeerID int64 `protobuf:"varint,1,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,2,opt,name=PeerType,proto3" json:"PeerType,omitempty"` - MessageIDs []int64 `protobuf:"varint,3,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` -} - -func (x *ClientUpdateMessagesDeleted) Reset() { - *x = ClientUpdateMessagesDeleted{} - if protoimpl.UnsafeEnabled { - mi := &file_client_updates_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientUpdateMessagesDeleted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientUpdateMessagesDeleted) ProtoMessage() {} - -func (x *ClientUpdateMessagesDeleted) ProtoReflect() protoreflect.Message { - mi := &file_client_updates_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientUpdateMessagesDeleted.ProtoReflect.Descriptor instead. -func (*ClientUpdateMessagesDeleted) Descriptor() ([]byte, []int) { - return file_client_updates_proto_rawDescGZIP(), []int{1} -} - -func (x *ClientUpdateMessagesDeleted) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *ClientUpdateMessagesDeleted) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -func (x *ClientUpdateMessagesDeleted) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -var File_client_updates_proto protoreflect.FileDescriptor - -var file_client_updates_proto_rawDesc = []byte{ - 0x0a, 0x14, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x01, 0x0a, 0x22, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x65, 0x6e, 0x64, - 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, - 0x72, 0x79, 0x12, 0x2c, 0x0a, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, - 0x12, 0x41, 0x0a, 0x0e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x52, 0x0e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x71, 0x0a, - 0x1b, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, - 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x50, 0x65, - 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, - 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_client_updates_proto_rawDescOnce sync.Once - file_client_updates_proto_rawDescData = file_client_updates_proto_rawDesc -) - -func file_client_updates_proto_rawDescGZIP() []byte { - file_client_updates_proto_rawDescOnce.Do(func() { - file_client_updates_proto_rawDescData = protoimpl.X.CompressGZIP(file_client_updates_proto_rawDescData) - }) - return file_client_updates_proto_rawDescData -} - -var file_client_updates_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_client_updates_proto_goTypes = []interface{}{ - (*ClientUpdatePendingMessageDelivery)(nil), // 0: msg.ClientUpdatePendingMessageDelivery - (*ClientUpdateMessagesDeleted)(nil), // 1: msg.ClientUpdateMessagesDeleted - (*UserMessage)(nil), // 2: msg.UserMessage - (*ClientPendingMessage)(nil), // 3: msg.ClientPendingMessage -} -var file_client_updates_proto_depIdxs = []int32{ - 2, // 0: msg.ClientUpdatePendingMessageDelivery.Messages:type_name -> msg.UserMessage - 3, // 1: msg.ClientUpdatePendingMessageDelivery.PendingMessage:type_name -> msg.ClientPendingMessage - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_client_updates_proto_init() } -func file_client_updates_proto_init() { - if File_client_updates_proto != nil { - return - } - file_core_types_proto_init() - file_client_proto_init() - if !protoimpl.UnsafeEnabled { - file_client_updates_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientUpdatePendingMessageDelivery); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_client_updates_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientUpdateMessagesDeleted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_client_updates_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_client_updates_proto_goTypes, - DependencyIndexes: file_client_updates_proto_depIdxs, - MessageInfos: file_client_updates_proto_msgTypes, - }.Build() - File_client_updates_proto = out.File - file_client_updates_proto_rawDesc = nil - file_client_updates_proto_goTypes = nil - file_client_updates_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/client.updates.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/client.updates.rony.go deleted file mode 100644 index 61527e76..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/client.updates.rony.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: client.updates.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_ClientUpdatePendingMessageDelivery int64 = 3828722061 - -type poolClientUpdatePendingMessageDelivery struct { - pool sync.Pool -} - -func (p *poolClientUpdatePendingMessageDelivery) Get() *ClientUpdatePendingMessageDelivery { - x, ok := p.pool.Get().(*ClientUpdatePendingMessageDelivery) - if !ok { - x = &ClientUpdatePendingMessageDelivery{} - } - - x.Messages = PoolUserMessage.Get() - - x.PendingMessage = PoolClientPendingMessage.Get() - - return x -} - -func (p *poolClientUpdatePendingMessageDelivery) Put(x *ClientUpdatePendingMessageDelivery) { - if x == nil { - return - } - - PoolUserMessage.Put(x.Messages) - PoolClientPendingMessage.Put(x.PendingMessage) - x.Success = false - - p.pool.Put(x) -} - -var PoolClientUpdatePendingMessageDelivery = poolClientUpdatePendingMessageDelivery{} - -func (x *ClientUpdatePendingMessageDelivery) DeepCopy(z *ClientUpdatePendingMessageDelivery) { - if x.Messages != nil { - if z.Messages == nil { - z.Messages = PoolUserMessage.Get() - } - x.Messages.DeepCopy(z.Messages) - } else { - PoolUserMessage.Put(z.Messages) - z.Messages = nil - } - if x.PendingMessage != nil { - if z.PendingMessage == nil { - z.PendingMessage = PoolClientPendingMessage.Get() - } - x.PendingMessage.DeepCopy(z.PendingMessage) - } else { - PoolClientPendingMessage.Put(z.PendingMessage) - z.PendingMessage = nil - } - z.Success = x.Success -} - -func (x *ClientUpdatePendingMessageDelivery) Clone() *ClientUpdatePendingMessageDelivery { - z := &ClientUpdatePendingMessageDelivery{} - x.DeepCopy(z) - return z -} - -func (x *ClientUpdatePendingMessageDelivery) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientUpdatePendingMessageDelivery) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientUpdatePendingMessageDelivery) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientUpdatePendingMessageDelivery) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientUpdatePendingMessageDelivery) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientUpdatePendingMessageDelivery, x) -} - -const C_ClientUpdateMessagesDeleted int64 = 3060926862 - -type poolClientUpdateMessagesDeleted struct { - pool sync.Pool -} - -func (p *poolClientUpdateMessagesDeleted) Get() *ClientUpdateMessagesDeleted { - x, ok := p.pool.Get().(*ClientUpdateMessagesDeleted) - if !ok { - x = &ClientUpdateMessagesDeleted{} - } - - return x -} - -func (p *poolClientUpdateMessagesDeleted) Put(x *ClientUpdateMessagesDeleted) { - if x == nil { - return - } - - x.PeerID = 0 - x.PeerType = 0 - x.MessageIDs = x.MessageIDs[:0] - - p.pool.Put(x) -} - -var PoolClientUpdateMessagesDeleted = poolClientUpdateMessagesDeleted{} - -func (x *ClientUpdateMessagesDeleted) DeepCopy(z *ClientUpdateMessagesDeleted) { - z.PeerID = x.PeerID - z.PeerType = x.PeerType - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) -} - -func (x *ClientUpdateMessagesDeleted) Clone() *ClientUpdateMessagesDeleted { - z := &ClientUpdateMessagesDeleted{} - x.DeepCopy(z) - return z -} - -func (x *ClientUpdateMessagesDeleted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientUpdateMessagesDeleted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientUpdateMessagesDeleted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientUpdateMessagesDeleted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientUpdateMessagesDeleted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientUpdateMessagesDeleted, x) -} - -func init() { - registry.RegisterConstructor(3828722061, "ClientUpdatePendingMessageDelivery") - registry.RegisterConstructor(3060926862, "ClientUpdateMessagesDeleted") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/constructors.json b/vendor/git.ronaksoft.com/river/msg/go/msg/constructors.json deleted file mode 100644 index 0e1bd386..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/constructors.json +++ /dev/null @@ -1,1126 +0,0 @@ - - { - "ConstructorsByName": { - "AccountAuthorization": 275571966, - "AccountAuthorizations": 1092320500, - "AccountChangePhone": 4285969474, - "AccountCheckUsername": 1501406413, - "AccountDelete": 846661545, - "AccountGetAuthorizations": 2112646192, - "AccountGetNotifySettings": 477008681, - "AccountGetPassword": 1702207851, - "AccountGetPasswordSettings": 2052309739, - "AccountGetPrivacy": 1897044856, - "AccountGetTeams": 2881489378, - "AccountPassword": 4178767656, - "AccountPasswordSettings": 3362978866, - "AccountPrivacyRules": 3802018092, - "AccountRecoverPassword": 1086766738, - "AccountRegisterDevice": 946059841, - "AccountRemovePhoto": 3728692172, - "AccountResendVerifyPhoneCode": 3140772691, - "AccountResetAuthorization": 1045069116, - "AccountSendChangePhoneCode": 1389121902, - "AccountSendVerifyPhoneCode": 328900044, - "AccountSetLang": 2015777242, - "AccountSetNotifySettings": 2016882075, - "AccountSetPrivacy": 1599585002, - "AccountSetWebPhoto": 46761477, - "AccountUnregisterDevice": 3981251588, - "AccountUpdatePasswordSettings": 3193945896, - "AccountUpdatePhoto": 406174115, - "AccountUpdateProfile": 3725499887, - "AccountUpdateStatus": 666864933, - "AccountUpdateUsername": 1477164344, - "AccountUploadPhoto": 1222469957, - "Ack": 447331921, - "AdminAddBannedSubnet": 1018562272, - "AdminBroadcastMessage": 3981417409, - "AdminDeleteBannedSubnet": 4271915141, - "AdminDeletePushProvider": 1864898932, - "AdminDeleteToken": 3154441897, - "AdminDeleteWelcomeMessage": 3940015991, - "AdminGetBannedSubnets": 937432341, - "AdminGetClusterInfo": 52432287, - "AdminGetPushProviders": 4257963974, - "AdminGetReservedUsernames": 1588181579, - "AdminGetStorageNode": 2297643227, - "AdminGetStorageNodes": 176633623, - "AdminGetVersions": 934752256, - "AdminGetWelcomeMessages": 2794709448, - "AdminReserveUsername": 1947723452, - "AdminSetPushProvider": 1758606947, - "AdminSetStorageNode": 4159566764, - "AdminSetToken": 2892519162, - "AdminSetVersion": 1311023404, - "AdminSetWelcomeMessage": 1149591874, - "AdminTeamCreate": 2797066608, - "AdminToken": 2895609620, - "AppUpdate": 1100207036, - "AuthAuthorization": 1140037965, - "AuthBotAuthorization": 3304560814, - "AuthBotRegister": 1579606687, - "AuthCheckPassword": 3346962908, - "AuthCheckPhone": 4134648516, - "AuthCheckedPhone": 2236203131, - "AuthDestroyKey": 3673422656, - "AuthLogin": 2587620888, - "AuthLoginByToken": 2851553023, - "AuthLogout": 992431648, - "AuthPasswordRecovery": 3813475914, - "AuthRecall": 1172029049, - "AuthRecalled": 3249025459, - "AuthRecoverPassword": 2711231991, - "AuthRegister": 2228369460, - "AuthResendCode": 2682713491, - "AuthSendCode": 3984043365, - "AuthSentCode": 2375498471, - "BannedSubnets": 1393688488, - "BlockedContact": 53788553, - "BlockedContactsMany": 2067026404, - "Bool": 4122188204, - "Bot": 961692401, - "BotCallbackAnswer": 3344545062, - "BotCommands": 1852470005, - "BotCommandsMany": 6153347, - "BotDeleteMessage": 3523077017, - "BotEditMessage": 1007063252, - "BotGet": 911895569, - "BotGetCallbackAnswer": 345706640, - "BotGetCommands": 473628905, - "BotGetInlineResults": 4192114308, - "BotInfo": 4059496923, - "BotInlineMessage": 3297841032, - "BotInlineResult": 942846933, - "BotInlineSwitchPM": 3014743726, - "BotRecall": 4208974051, - "BotRecalled": 4007077962, - "BotResults": 527920130, - "BotRevokeToken": 1804706614, - "BotSaveFilePart": 905437522, - "BotSendInlineResults": 923160988, - "BotSendMedia": 1844738193, - "BotSendMessage": 2371725696, - "BotSetCallbackAnswer": 1891806754, - "BotSetInfo": 3735815245, - "BotSetInlineResults": 3418940573, - "BotStart": 2068702388, - "BotToken": 3137540096, - "BotUpdatePhoto": 3464973784, - "BotUpdateProfile": 2820005221, - "BotUploadGif": 3473872836, - "BotUploadWallPaper": 3329295900, - "BotsMany": 2942918011, - "Button": 1034594571, - "ButtonBuy": 2992465437, - "ButtonCallback": 4007711268, - "ButtonRequestGeoLocation": 323515934, - "ButtonRequestPhone": 630958494, - "ButtonSwitchInline": 3842667878, - "ButtonUrl": 2309530052, - "CalendarEditEvent": 2440838922, - "CalendarEvent": 1185062169, - "CalendarEventInstance": 3586847608, - "CalendarGetEvents": 1010730154, - "CalendarRemoveEvent": 3761579510, - "CalendarSetEvent": 3405460640, - "CallConnection": 3450901888, - "CallMediaSettings": 1147111688, - "CallParticipant": 2652007354, - "CallParticipants": 807700466, - "CallRTCIceCandidate": 2748774954, - "CallUpdateAllConnected": 1993183151, - "CallUpdateCallAccepted": 2134109006, - "CallUpdateCallAck": 1424725011, - "CallUpdateCallCancelled": 4194096602, - "CallUpdateCallDestroyed": 3684039715, - "CallUpdateCallJoinRequested": 945899454, - "CallUpdateCallPreview": 567542844, - "CallUpdateCallRejected": 2339651845, - "CallUpdateCallRequested": 2556114354, - "CallUpdateCallTimeout": 420503198, - "CallUpdateConnectionStatusChanged": 4028141073, - "CallUpdateDestroyed": 2831970154, - "CallUpdateLocalMediaSettingsUpdated": 587913546, - "CallUpdateLocalStreamUpdated": 1043624904, - "CallUpdateMediaSettingsUpdated": 3922101985, - "CallUpdateParticipantAdminUpdated": 2487316396, - "CallUpdateParticipantJoined": 1005455524, - "CallUpdateParticipantLeft": 2062471712, - "CallUpdateParticipantMuted": 2194386679, - "CallUpdateParticipantRemoved": 4138786615, - "CallUpdateShareScreenStreamUpdated": 2763784404, - "CallUpdateStatusChanged": 3530146764, - "CallUpdateStreamUpdated": 3496218809, - "ClientCachedMediaInfo": 442767121, - "ClientCallAccept": 2726334873, - "ClientCallAreAllAudio": 4108555878, - "ClientCallDestroy": 3560765778, - "ClientCallDuration": 3292884691, - "ClientCallGetDuration": 2971494454, - "ClientCallGetParticipantByConnId": 3279593330, - "ClientCallGetParticipantByUserID": 1253505450, - "ClientCallGetParticipantList": 348508034, - "ClientCallGroupAddParticipant": 1850196430, - "ClientCallGroupRemoveParticipant": 2417422237, - "ClientCallGroupUpdateAdmin": 3544832701, - "ClientCallJoin": 2382593398, - "ClientCallMuteParticipant": 2518831668, - "ClientCallReject": 3026524692, - "ClientCallSendAck": 3339532851, - "ClientCallSendIceCandidate": 1007531716, - "ClientCallSendIceConnectionStatus": 3421647876, - "ClientCallSendMediaSettings": 2959794351, - "ClientCallSendTrack": 2856076314, - "ClientCallStart": 1041146964, - "ClientCallStarted": 484502003, - "ClientCallToggleAudio": 3488802344, - "ClientCallToggleVideo": 2873625233, - "ClientCallTryReconnect": 346556278, - "ClientClearCachedMedia": 1199927718, - "ClientContactSearch": 1793449803, - "ClientDismissNotification": 1698398006, - "ClientError": 2520362971, - "ClientFile": 155127968, - "ClientFileRequest": 3995993899, - "ClientFileStatus": 2731095358, - "ClientFilesMany": 1414992553, - "ClientFrequentReactions": 1422804314, - "ClientGetAllDownloadedMedia": 729082453, - "ClientGetCachedMedia": 856595701, - "ClientGetFrequentReactions": 2954334910, - "ClientGetLastBotKeyboard": 177544569, - "ClientGetMediaHistory": 1354863379, - "ClientGetNotificationDismissTime": 4106535811, - "ClientGetRecentSearch": 2622949116, - "ClientGetSavedGifs": 3028067090, - "ClientGetTeamCounters": 3403301140, - "ClientGlobalSearch": 1742781507, - "ClientMediaSize": 1541024203, - "ClientNotificationDismissTime": 3077814065, - "ClientPeerMediaInfo": 2711408875, - "ClientPendingMessage": 2164891929, - "ClientPutRecentSearch": 629582533, - "ClientRecentSearch": 2069517672, - "ClientRecentSearchMany": 3236847495, - "ClientRedirect": 3513459109, - "ClientRemoveAllRecentSearches": 3599155822, - "ClientRemoveRecentSearch": 1281490259, - "ClientSearchResult": 2957647709, - "ClientSendMessageMedia": 1095038539, - "ClientTeamCounters": 769069696, - "ClientUpdateMessagesDeleted": 3060926862, - "ClientUpdatePendingMessageDelivery": 3828722061, - "ClientUsage": 453987802, - "CommunityAuthorizeUser": 1452766231, - "CommunityGetMembers": 2022915988, - "CommunityGetUpdates": 2021391963, - "CommunityRecall": 890349574, - "CommunitySendMedia": 2436824148, - "CommunitySendMessage": 3506778488, - "CommunitySetTyping": 3413516595, - "CommunityUpdateContainer": 918339432, - "CommunityUpdateEnvelope": 1076119993, - "CommunityUser": 3812837958, - "ContactUser": 460099170, - "ContactsAdd": 1410714478, - "ContactsBlock": 2900371089, - "ContactsDelete": 1750426880, - "ContactsDeleteAll": 14552524, - "ContactsGet": 1412732665, - "ContactsGetBlocked": 1073733371, - "ContactsGetTopPeers": 1378126220, - "ContactsImport": 3473528730, - "ContactsImported": 2157298354, - "ContactsMany": 3883395672, - "ContactsResetTopPeer": 1114887378, - "ContactsSearch": 3870802464, - "ContactsTopPeers": 2243919622, - "ContactsUnblock": 662011773, - "DHGroup": 2751503049, - "DataCenter": 3431386561, - "Dialog": 1120787796, - "Document": 555739168, - "DocumentAttribute": 4146719643, - "DocumentAttributeAnimated": 1040723836, - "DocumentAttributeAudio": 309707708, - "DocumentAttributeFile": 2227452062, - "DocumentAttributePhoto": 515862833, - "DocumentAttributeVideo": 1993289477, - "DocumentAttributeVoiceCall": 2787573148, - "DraftMessage": 869564229, - "EchoWithDelay": 2861516000, - "Edge": 3576986712, - "Edges": 2120950449, - "Error": 2619118453, - "File": 749574446, - "FileGet": 4282510672, - "FileGetBySha256": 2768049463, - "FileLocation": 2432133155, - "FileSavePart": 3766876582, - "FoundGif": 1539084995, - "FoundGifs": 423157907, - "GeoLocation": 3794405429, - "GetAllNodes": 3267106379, - "GetNodes": 362407405, - "GifDelete": 4148453437, - "GifGetSaved": 35292745, - "GifSave": 4049142282, - "GifSearch": 2040973085, - "Group": 2885774273, - "GroupFull": 205850814, - "GroupParticipant": 4072279665, - "GroupPhoto": 3998516135, - "GroupsAddUser": 394654713, - "GroupsCreate": 1271969037, - "GroupsDeleteUser": 3172322223, - "GroupsEditTitle": 2582813461, - "GroupsGetFull": 2986704909, - "GroupsGetReadHistoryStats": 719309439, - "GroupsHistoryStats": 1080267574, - "GroupsRemovePhoto": 176771682, - "GroupsToggleAdminOnly": 3440147323, - "GroupsToggleAdmins": 1581076909, - "GroupsUpdateAdmin": 1345991011, - "GroupsUpdatePhoto": 3431184397, - "GroupsUploadPhoto": 2624284907, - "HttpBody": 3032622721, - "IceServer": 4291892363, - "InitAuthCompleted": 627708982, - "InitBindUser": 1933549113, - "InitCompleteAuth": 1583178320, - "InitCompleteAuthInternal": 2360982492, - "InitConnect": 4150793517, - "InitConnectTest": 3188015450, - "InitResponse": 4130340247, - "InitTestAuth": 2762878006, - "InitUserBound": 128391141, - "InputBotInlineMessage": 1408974864, - "InputBotInlineResult": 2158273502, - "InputDocument": 4081048424, - "InputFile": 3882180383, - "InputFileLocation": 354669666, - "InputGeoLocation": 1403425127, - "InputMediaContact": 1534117184, - "InputMediaDocument": 2258657627, - "InputMediaGeoLocation": 185664060, - "InputMediaMessageDocument": 3638653559, - "InputMediaPoll": 3633337678, - "InputMediaUploadedDocument": 870692909, - "InputMediaWebDocument": 3529450013, - "InputPassword": 513021899, - "InputPeer": 3374092470, - "InputTeam": 2937769744, - "InputUser": 3865689926, - "InputWallPaper": 4000784410, - "InputWebLocation": 203404027, - "KeyValue": 4276272820, - "KeyboardButtonEnvelope": 2639543624, - "KeyboardButtonRow": 2222403758, - "Label": 3479601132, - "LabelItems": 4271841358, - "LabelsAddToMessage": 180144503, - "LabelsCreate": 2138857068, - "LabelsDelete": 3401105936, - "LabelsEdit": 2790466877, - "LabelsGet": 2575409921, - "LabelsListItems": 2351763198, - "LabelsMany": 1423713603, - "LabelsRemoveFromMessage": 4195197703, - "MediaContact": 3735320833, - "MediaDocument": 2281620705, - "MediaGeoLocation": 2625326500, - "MediaPoll": 2688924895, - "MediaWebDocument": 1161129349, - "MediaWebPage": 148034084, - "MessageActionCallEnded": 62258227, - "MessageActionCallStarted": 3970382785, - "MessageActionClearHistory": 1270465696, - "MessageActionContactRegistered": 2399156016, - "MessageActionGroupAddUser": 1949386261, - "MessageActionGroupCreated": 2241024808, - "MessageActionGroupDeleteUser": 1213452128, - "MessageActionGroupPhotoChanged": 188265964, - "MessageActionGroupTitleChanged": 2418464749, - "MessageActionScreenShotTaken": 2637201461, - "MessageActionThreadClosed": 1366382890, - "MessageContainer": 1972016308, - "MessageEntity": 3479443932, - "MessageEnvelope": 535232465, - "MessagesClearDraft": 2164204563, - "MessagesClearHistory": 1981246180, - "MessagesDelete": 3487616910, - "MessagesDeleteReaction": 1547991459, - "MessagesDialogs": 3252610224, - "MessagesEdit": 2492658432, - "MessagesEditMedia": 3565425857, - "MessagesForward": 2662884753, - "MessagesGet": 2151382317, - "MessagesGetDialog": 1050840034, - "MessagesGetDialogs": 1429532372, - "MessagesGetHistory": 3396939832, - "MessagesGetMediaHistory": 4027732752, - "MessagesGetPinnedDialogs": 1963188912, - "MessagesGetReactionList": 3097050126, - "MessagesMany": 1713238910, - "MessagesReactionList": 181278607, - "MessagesReadContents": 1781251275, - "MessagesReadHistory": 1300826534, - "MessagesReadReaction": 2047257163, - "MessagesReorderPinnedDialogs": 1409872986, - "MessagesSaveDraft": 921840607, - "MessagesSend": 3000244183, - "MessagesSendMedia": 25498545, - "MessagesSendReaction": 279494057, - "MessagesSendScreenShotNotification": 3682116055, - "MessagesSent": 2942502835, - "MessagesSetTyping": 1540214486, - "MessagesToggleDialogPin": 1352871220, - "MessagesTogglePin": 2824078244, - "PasswordAlgorithmVer6A": 341860043, - "Peer": 47470215, - "PeerNotifySettings": 3475030132, - "PhoneAcceptCall": 4133092858, - "PhoneActionAccepted": 2493210645, - "PhoneActionAck": 1221076803, - "PhoneActionAdminUpdated": 1804765545, - "PhoneActionCallEmpty": 1073285997, - "PhoneActionCallWaiting": 3634710697, - "PhoneActionDiscarded": 4285966731, - "PhoneActionIceExchange": 1618781621, - "PhoneActionJoinRequested": 656125601, - "PhoneActionMediaSettingsUpdated": 2310335221, - "PhoneActionParticipantAdded": 2638615078, - "PhoneActionParticipantRemoved": 3280922507, - "PhoneActionPicked": 2478763318, - "PhoneActionReactionSet": 2047679815, - "PhoneActionRequested": 1678316869, - "PhoneActionRestarted": 1979061868, - "PhoneActionSDPAnswer": 835530308, - "PhoneActionSDPOffer": 931453435, - "PhoneActionScreenShare": 813039088, - "PhoneAddParticipant": 2867411100, - "PhoneCall": 3296664529, - "PhoneCallRecord": 4147150312, - "PhoneCallsMany": 1227520020, - "PhoneContact": 2672574672, - "PhoneDeleteHistory": 2528259211, - "PhoneDiscardCall": 2712700137, - "PhoneGetCall": 432049159, - "PhoneGetHistory": 407776572, - "PhoneGetParticipants": 3924781570, - "PhoneInit": 3464876187, - "PhoneInitCall": 2975617068, - "PhoneJoinCall": 3019166552, - "PhoneParticipant": 226273622, - "PhoneParticipantSDP": 545454774, - "PhoneParticipants": 2567653219, - "PhoneRateCall": 2215486159, - "PhoneRemoveParticipant": 188662172, - "PhoneRequestCall": 907942641, - "PhoneUpdateAdmin": 442877873, - "PhoneUpdateCall": 1976202226, - "Ping": 2246546115, - "PollAnswer": 2124799390, - "PollAnswerVoters": 2095107985, - "PollResults": 3283416711, - "Pong": 2171268721, - "PrivacyRule": 3954700912, - "ProtoEncryptedPayload": 2668405547, - "ProtoMessage": 2179260159, - "PublicGetUserInfo": 2292051365, - "PushProvider": 1015984470, - "PushProvidersMany": 5873573, - "RSAPublicKey": 1046601890, - "ReactionCounter": 3277490830, - "ReactionList": 4260855916, - "ReadHistoryStat": 3486960061, - "RecoveryQuestion": 1697591959, - "Redirect": 981138557, - "ReplyInlineMarkup": 2436413989, - "ReplyKeyboardForceReply": 258469686, - "ReplyKeyboardHide": 3134153306, - "ReplyKeyboardMarkup": 3207405102, - "ReservedUsernames": 1388055751, - "SavedGifs": 2982813633, - "SecurityAnswer": 1989228797, - "SecurityQuestion": 1092467205, - "SecurityQuestions": 1797596734, - "ServiceSendMessage": 824547051, - "StorageNode": 1966993242, - "StorageNodeMany": 2667693068, - "SystemConfig": 367036084, - "SystemGetConfig": 1910333714, - "SystemGetInfo": 1486296237, - "SystemGetResponse": 1415676946, - "SystemGetSalts": 1705203315, - "SystemGetServerKeys": 2510636156, - "SystemGetServerTime": 1321179349, - "SystemInfo": 2754948760, - "SystemKeys": 3677510435, - "SystemSalts": 871116906, - "SystemServerTime": 2854614486, - "SystemUploadUsage": 3056393082, - "Team": 1691486497, - "TeamAddMember": 3889056091, - "TeamDemote": 2331393294, - "TeamEdit": 3481894956, - "TeamGet": 1172720786, - "TeamJoin": 1725794017, - "TeamLeave": 1413785879, - "TeamListMembers": 3107323194, - "TeamMember": 1965775170, - "TeamMembers": 2208941294, - "TeamPhoto": 3678645727, - "TeamPromote": 382328820, - "TeamRemoveMember": 4200364613, - "TeamRemovePhoto": 3388888323, - "TeamUploadPhoto": 1595699082, - "TeamsMany": 2225718663, - "TestRequest": 475847033, - "TestRequestWithString": 3760062575, - "TestResponse": 1999996896, - "TestResponseWithString": 556112423, - "TopPeer": 1763100161, - "UpdateAccountPrivacy": 629173761, - "UpdateAuthorizationReset": 2359297647, - "UpdateBotCallbackQuery": 3408999713, - "UpdateBotInlineQuery": 4065328876, - "UpdateBotInlineSend": 2208028013, - "UpdateCalendarEventAdded": 297964741, - "UpdateCalendarEventEdited": 516349098, - "UpdateCalendarEventRemoved": 2986798389, - "UpdateCommunityMessage": 983926580, - "UpdateCommunityReadOutbox": 2094301834, - "UpdateCommunityTyping": 451491445, - "UpdateContainer": 661712615, - "UpdateDialogPinned": 231538299, - "UpdateDialogPinnedReorder": 1567423539, - "UpdateDifference": 1742546619, - "UpdateDraftMessage": 3453026195, - "UpdateDraftMessageCleared": 2011635602, - "UpdateEnvelope": 2373884514, - "UpdateGetDifference": 556775761, - "UpdateGetState": 1437250230, - "UpdateGroupAdminOnly": 691550776, - "UpdateGroupAdmins": 694155405, - "UpdateGroupParticipantAdd": 1623827837, - "UpdateGroupParticipantAdmin": 1813022164, - "UpdateGroupParticipantDeleted": 2489941844, - "UpdateGroupPhoto": 367193154, - "UpdateLabelDeleted": 3702192307, - "UpdateLabelItemsAdded": 2216022057, - "UpdateLabelItemsRemoved": 830226827, - "UpdateLabelSet": 2353687359, - "UpdateMessageEdited": 1825079988, - "UpdateMessageID": 2139063022, - "UpdateMessagePinned": 1260768050, - "UpdateMessagePoll": 383248674, - "UpdateMessagesDeleted": 670568714, - "UpdateNewMessage": 3426925183, - "UpdateNotifySettings": 3187524885, - "UpdatePhoneCall": 2791086990, - "UpdatePhoneCallEnded": 1764711846, - "UpdatePhoneCallStarted": 1094761594, - "UpdateReaction": 2738677245, - "UpdateReadHistoryInbox": 1529128378, - "UpdateReadHistoryOutbox": 510866108, - "UpdateReadMessagesContents": 2991403048, - "UpdateRedirect": 3303504929, - "UpdateState": 1837585836, - "UpdateTeam": 2978180712, - "UpdateTeamCreated": 2762932529, - "UpdateTeamMemberAdded": 1307755890, - "UpdateTeamMemberRemoved": 99543064, - "UpdateTeamMemberStatus": 4065657769, - "UpdateTeamPhoto": 3110088064, - "UpdateTooLong": 1531755547, - "UpdateUserBlocked": 3750625773, - "UpdateUserPhoto": 302028082, - "UpdateUserStatus": 2696747995, - "UpdateUserTyping": 178254060, - "UpdateUsername": 4290110589, - "User": 765557111, - "UserInfo": 883983438, - "UserMessage": 1677556362, - "UserPhoto": 1881347437, - "UsersGet": 1039301579, - "UsersGetFull": 3343342086, - "UsersMany": 801733941, - "Version": 1889659487, - "VersionsMany": 2123920547, - "WallPaper": 2527250827, - "WallPaperDelete": 3006268108, - "WallPaperGet": 183906980, - "WallPaperReset": 2714244308, - "WallPaperSave": 3559907599, - "WallPaperSettings": 1098244882, - "WallPaperUpload": 2661259348, - "WallPapersMany": 3121104857, - "WebLocation": 3180538793, - "WelcomeMessage": 2506678571, - "WelcomeMessagesMany": 414982091, - }, - "ConstructorsByValue": { - 275571966: "AccountAuthorization", - 1092320500: "AccountAuthorizations", - 4285969474: "AccountChangePhone", - 1501406413: "AccountCheckUsername", - 846661545: "AccountDelete", - 2112646192: "AccountGetAuthorizations", - 477008681: "AccountGetNotifySettings", - 1702207851: "AccountGetPassword", - 2052309739: "AccountGetPasswordSettings", - 1897044856: "AccountGetPrivacy", - 2881489378: "AccountGetTeams", - 4178767656: "AccountPassword", - 3362978866: "AccountPasswordSettings", - 3802018092: "AccountPrivacyRules", - 1086766738: "AccountRecoverPassword", - 946059841: "AccountRegisterDevice", - 3728692172: "AccountRemovePhoto", - 3140772691: "AccountResendVerifyPhoneCode", - 1045069116: "AccountResetAuthorization", - 1389121902: "AccountSendChangePhoneCode", - 328900044: "AccountSendVerifyPhoneCode", - 2015777242: "AccountSetLang", - 2016882075: "AccountSetNotifySettings", - 1599585002: "AccountSetPrivacy", - 46761477: "AccountSetWebPhoto", - 3981251588: "AccountUnregisterDevice", - 3193945896: "AccountUpdatePasswordSettings", - 406174115: "AccountUpdatePhoto", - 3725499887: "AccountUpdateProfile", - 666864933: "AccountUpdateStatus", - 1477164344: "AccountUpdateUsername", - 1222469957: "AccountUploadPhoto", - 447331921: "Ack", - 1018562272: "AdminAddBannedSubnet", - 3981417409: "AdminBroadcastMessage", - 4271915141: "AdminDeleteBannedSubnet", - 1864898932: "AdminDeletePushProvider", - 3154441897: "AdminDeleteToken", - 3940015991: "AdminDeleteWelcomeMessage", - 937432341: "AdminGetBannedSubnets", - 52432287: "AdminGetClusterInfo", - 4257963974: "AdminGetPushProviders", - 1588181579: "AdminGetReservedUsernames", - 2297643227: "AdminGetStorageNode", - 176633623: "AdminGetStorageNodes", - 934752256: "AdminGetVersions", - 2794709448: "AdminGetWelcomeMessages", - 1947723452: "AdminReserveUsername", - 1758606947: "AdminSetPushProvider", - 4159566764: "AdminSetStorageNode", - 2892519162: "AdminSetToken", - 1311023404: "AdminSetVersion", - 1149591874: "AdminSetWelcomeMessage", - 2797066608: "AdminTeamCreate", - 2895609620: "AdminToken", - 1100207036: "AppUpdate", - 1140037965: "AuthAuthorization", - 3304560814: "AuthBotAuthorization", - 1579606687: "AuthBotRegister", - 3346962908: "AuthCheckPassword", - 4134648516: "AuthCheckPhone", - 2236203131: "AuthCheckedPhone", - 3673422656: "AuthDestroyKey", - 2587620888: "AuthLogin", - 2851553023: "AuthLoginByToken", - 992431648: "AuthLogout", - 3813475914: "AuthPasswordRecovery", - 1172029049: "AuthRecall", - 3249025459: "AuthRecalled", - 2711231991: "AuthRecoverPassword", - 2228369460: "AuthRegister", - 2682713491: "AuthResendCode", - 3984043365: "AuthSendCode", - 2375498471: "AuthSentCode", - 1393688488: "BannedSubnets", - 53788553: "BlockedContact", - 2067026404: "BlockedContactsMany", - 4122188204: "Bool", - 961692401: "Bot", - 3344545062: "BotCallbackAnswer", - 1852470005: "BotCommands", - 6153347: "BotCommandsMany", - 3523077017: "BotDeleteMessage", - 1007063252: "BotEditMessage", - 911895569: "BotGet", - 345706640: "BotGetCallbackAnswer", - 473628905: "BotGetCommands", - 4192114308: "BotGetInlineResults", - 4059496923: "BotInfo", - 3297841032: "BotInlineMessage", - 942846933: "BotInlineResult", - 3014743726: "BotInlineSwitchPM", - 4208974051: "BotRecall", - 4007077962: "BotRecalled", - 527920130: "BotResults", - 1804706614: "BotRevokeToken", - 905437522: "BotSaveFilePart", - 923160988: "BotSendInlineResults", - 1844738193: "BotSendMedia", - 2371725696: "BotSendMessage", - 1891806754: "BotSetCallbackAnswer", - 3735815245: "BotSetInfo", - 3418940573: "BotSetInlineResults", - 2068702388: "BotStart", - 3137540096: "BotToken", - 3464973784: "BotUpdatePhoto", - 2820005221: "BotUpdateProfile", - 3473872836: "BotUploadGif", - 3329295900: "BotUploadWallPaper", - 2942918011: "BotsMany", - 1034594571: "Button", - 2992465437: "ButtonBuy", - 4007711268: "ButtonCallback", - 323515934: "ButtonRequestGeoLocation", - 630958494: "ButtonRequestPhone", - 3842667878: "ButtonSwitchInline", - 2309530052: "ButtonUrl", - 2440838922: "CalendarEditEvent", - 1185062169: "CalendarEvent", - 3586847608: "CalendarEventInstance", - 1010730154: "CalendarGetEvents", - 3761579510: "CalendarRemoveEvent", - 3405460640: "CalendarSetEvent", - 3450901888: "CallConnection", - 1147111688: "CallMediaSettings", - 2652007354: "CallParticipant", - 807700466: "CallParticipants", - 2748774954: "CallRTCIceCandidate", - 1993183151: "CallUpdateAllConnected", - 2134109006: "CallUpdateCallAccepted", - 1424725011: "CallUpdateCallAck", - 4194096602: "CallUpdateCallCancelled", - 3684039715: "CallUpdateCallDestroyed", - 945899454: "CallUpdateCallJoinRequested", - 567542844: "CallUpdateCallPreview", - 2339651845: "CallUpdateCallRejected", - 2556114354: "CallUpdateCallRequested", - 420503198: "CallUpdateCallTimeout", - 4028141073: "CallUpdateConnectionStatusChanged", - 2831970154: "CallUpdateDestroyed", - 587913546: "CallUpdateLocalMediaSettingsUpdated", - 1043624904: "CallUpdateLocalStreamUpdated", - 3922101985: "CallUpdateMediaSettingsUpdated", - 2487316396: "CallUpdateParticipantAdminUpdated", - 1005455524: "CallUpdateParticipantJoined", - 2062471712: "CallUpdateParticipantLeft", - 2194386679: "CallUpdateParticipantMuted", - 4138786615: "CallUpdateParticipantRemoved", - 2763784404: "CallUpdateShareScreenStreamUpdated", - 3530146764: "CallUpdateStatusChanged", - 3496218809: "CallUpdateStreamUpdated", - 442767121: "ClientCachedMediaInfo", - 2726334873: "ClientCallAccept", - 4108555878: "ClientCallAreAllAudio", - 3560765778: "ClientCallDestroy", - 3292884691: "ClientCallDuration", - 2971494454: "ClientCallGetDuration", - 3279593330: "ClientCallGetParticipantByConnId", - 1253505450: "ClientCallGetParticipantByUserID", - 348508034: "ClientCallGetParticipantList", - 1850196430: "ClientCallGroupAddParticipant", - 2417422237: "ClientCallGroupRemoveParticipant", - 3544832701: "ClientCallGroupUpdateAdmin", - 2382593398: "ClientCallJoin", - 2518831668: "ClientCallMuteParticipant", - 3026524692: "ClientCallReject", - 3339532851: "ClientCallSendAck", - 1007531716: "ClientCallSendIceCandidate", - 3421647876: "ClientCallSendIceConnectionStatus", - 2959794351: "ClientCallSendMediaSettings", - 2856076314: "ClientCallSendTrack", - 1041146964: "ClientCallStart", - 484502003: "ClientCallStarted", - 3488802344: "ClientCallToggleAudio", - 2873625233: "ClientCallToggleVideo", - 346556278: "ClientCallTryReconnect", - 1199927718: "ClientClearCachedMedia", - 1793449803: "ClientContactSearch", - 1698398006: "ClientDismissNotification", - 2520362971: "ClientError", - 155127968: "ClientFile", - 3995993899: "ClientFileRequest", - 2731095358: "ClientFileStatus", - 1414992553: "ClientFilesMany", - 1422804314: "ClientFrequentReactions", - 729082453: "ClientGetAllDownloadedMedia", - 856595701: "ClientGetCachedMedia", - 2954334910: "ClientGetFrequentReactions", - 177544569: "ClientGetLastBotKeyboard", - 1354863379: "ClientGetMediaHistory", - 4106535811: "ClientGetNotificationDismissTime", - 2622949116: "ClientGetRecentSearch", - 3028067090: "ClientGetSavedGifs", - 3403301140: "ClientGetTeamCounters", - 1742781507: "ClientGlobalSearch", - 1541024203: "ClientMediaSize", - 3077814065: "ClientNotificationDismissTime", - 2711408875: "ClientPeerMediaInfo", - 2164891929: "ClientPendingMessage", - 629582533: "ClientPutRecentSearch", - 2069517672: "ClientRecentSearch", - 3236847495: "ClientRecentSearchMany", - 3513459109: "ClientRedirect", - 3599155822: "ClientRemoveAllRecentSearches", - 1281490259: "ClientRemoveRecentSearch", - 2957647709: "ClientSearchResult", - 1095038539: "ClientSendMessageMedia", - 769069696: "ClientTeamCounters", - 3060926862: "ClientUpdateMessagesDeleted", - 3828722061: "ClientUpdatePendingMessageDelivery", - 453987802: "ClientUsage", - 1452766231: "CommunityAuthorizeUser", - 2022915988: "CommunityGetMembers", - 2021391963: "CommunityGetUpdates", - 890349574: "CommunityRecall", - 2436824148: "CommunitySendMedia", - 3506778488: "CommunitySendMessage", - 3413516595: "CommunitySetTyping", - 918339432: "CommunityUpdateContainer", - 1076119993: "CommunityUpdateEnvelope", - 3812837958: "CommunityUser", - 460099170: "ContactUser", - 1410714478: "ContactsAdd", - 2900371089: "ContactsBlock", - 1750426880: "ContactsDelete", - 14552524: "ContactsDeleteAll", - 1412732665: "ContactsGet", - 1073733371: "ContactsGetBlocked", - 1378126220: "ContactsGetTopPeers", - 3473528730: "ContactsImport", - 2157298354: "ContactsImported", - 3883395672: "ContactsMany", - 1114887378: "ContactsResetTopPeer", - 3870802464: "ContactsSearch", - 2243919622: "ContactsTopPeers", - 662011773: "ContactsUnblock", - 2751503049: "DHGroup", - 3431386561: "DataCenter", - 1120787796: "Dialog", - 555739168: "Document", - 4146719643: "DocumentAttribute", - 1040723836: "DocumentAttributeAnimated", - 309707708: "DocumentAttributeAudio", - 2227452062: "DocumentAttributeFile", - 515862833: "DocumentAttributePhoto", - 1993289477: "DocumentAttributeVideo", - 2787573148: "DocumentAttributeVoiceCall", - 869564229: "DraftMessage", - 2861516000: "EchoWithDelay", - 3576986712: "Edge", - 2120950449: "Edges", - 2619118453: "Error", - 749574446: "File", - 4282510672: "FileGet", - 2768049463: "FileGetBySha256", - 2432133155: "FileLocation", - 3766876582: "FileSavePart", - 1539084995: "FoundGif", - 423157907: "FoundGifs", - 3794405429: "GeoLocation", - 3267106379: "GetAllNodes", - 362407405: "GetNodes", - 4148453437: "GifDelete", - 35292745: "GifGetSaved", - 4049142282: "GifSave", - 2040973085: "GifSearch", - 2885774273: "Group", - 205850814: "GroupFull", - 4072279665: "GroupParticipant", - 3998516135: "GroupPhoto", - 394654713: "GroupsAddUser", - 1271969037: "GroupsCreate", - 3172322223: "GroupsDeleteUser", - 2582813461: "GroupsEditTitle", - 2986704909: "GroupsGetFull", - 719309439: "GroupsGetReadHistoryStats", - 1080267574: "GroupsHistoryStats", - 176771682: "GroupsRemovePhoto", - 3440147323: "GroupsToggleAdminOnly", - 1581076909: "GroupsToggleAdmins", - 1345991011: "GroupsUpdateAdmin", - 3431184397: "GroupsUpdatePhoto", - 2624284907: "GroupsUploadPhoto", - 3032622721: "HttpBody", - 4291892363: "IceServer", - 627708982: "InitAuthCompleted", - 1933549113: "InitBindUser", - 1583178320: "InitCompleteAuth", - 2360982492: "InitCompleteAuthInternal", - 4150793517: "InitConnect", - 3188015450: "InitConnectTest", - 4130340247: "InitResponse", - 2762878006: "InitTestAuth", - 128391141: "InitUserBound", - 1408974864: "InputBotInlineMessage", - 2158273502: "InputBotInlineResult", - 4081048424: "InputDocument", - 3882180383: "InputFile", - 354669666: "InputFileLocation", - 1403425127: "InputGeoLocation", - 1534117184: "InputMediaContact", - 2258657627: "InputMediaDocument", - 185664060: "InputMediaGeoLocation", - 3638653559: "InputMediaMessageDocument", - 3633337678: "InputMediaPoll", - 870692909: "InputMediaUploadedDocument", - 3529450013: "InputMediaWebDocument", - 513021899: "InputPassword", - 3374092470: "InputPeer", - 2937769744: "InputTeam", - 3865689926: "InputUser", - 4000784410: "InputWallPaper", - 203404027: "InputWebLocation", - 4276272820: "KeyValue", - 2639543624: "KeyboardButtonEnvelope", - 2222403758: "KeyboardButtonRow", - 3479601132: "Label", - 4271841358: "LabelItems", - 180144503: "LabelsAddToMessage", - 2138857068: "LabelsCreate", - 3401105936: "LabelsDelete", - 2790466877: "LabelsEdit", - 2575409921: "LabelsGet", - 2351763198: "LabelsListItems", - 1423713603: "LabelsMany", - 4195197703: "LabelsRemoveFromMessage", - 3735320833: "MediaContact", - 2281620705: "MediaDocument", - 2625326500: "MediaGeoLocation", - 2688924895: "MediaPoll", - 1161129349: "MediaWebDocument", - 148034084: "MediaWebPage", - 62258227: "MessageActionCallEnded", - 3970382785: "MessageActionCallStarted", - 1270465696: "MessageActionClearHistory", - 2399156016: "MessageActionContactRegistered", - 1949386261: "MessageActionGroupAddUser", - 2241024808: "MessageActionGroupCreated", - 1213452128: "MessageActionGroupDeleteUser", - 188265964: "MessageActionGroupPhotoChanged", - 2418464749: "MessageActionGroupTitleChanged", - 2637201461: "MessageActionScreenShotTaken", - 1366382890: "MessageActionThreadClosed", - 1972016308: "MessageContainer", - 3479443932: "MessageEntity", - 535232465: "MessageEnvelope", - 2164204563: "MessagesClearDraft", - 1981246180: "MessagesClearHistory", - 3487616910: "MessagesDelete", - 1547991459: "MessagesDeleteReaction", - 3252610224: "MessagesDialogs", - 2492658432: "MessagesEdit", - 3565425857: "MessagesEditMedia", - 2662884753: "MessagesForward", - 2151382317: "MessagesGet", - 1050840034: "MessagesGetDialog", - 1429532372: "MessagesGetDialogs", - 3396939832: "MessagesGetHistory", - 4027732752: "MessagesGetMediaHistory", - 1963188912: "MessagesGetPinnedDialogs", - 3097050126: "MessagesGetReactionList", - 1713238910: "MessagesMany", - 181278607: "MessagesReactionList", - 1781251275: "MessagesReadContents", - 1300826534: "MessagesReadHistory", - 2047257163: "MessagesReadReaction", - 1409872986: "MessagesReorderPinnedDialogs", - 921840607: "MessagesSaveDraft", - 3000244183: "MessagesSend", - 25498545: "MessagesSendMedia", - 279494057: "MessagesSendReaction", - 3682116055: "MessagesSendScreenShotNotification", - 2942502835: "MessagesSent", - 1540214486: "MessagesSetTyping", - 1352871220: "MessagesToggleDialogPin", - 2824078244: "MessagesTogglePin", - 341860043: "PasswordAlgorithmVer6A", - 47470215: "Peer", - 3475030132: "PeerNotifySettings", - 4133092858: "PhoneAcceptCall", - 2493210645: "PhoneActionAccepted", - 1221076803: "PhoneActionAck", - 1804765545: "PhoneActionAdminUpdated", - 1073285997: "PhoneActionCallEmpty", - 3634710697: "PhoneActionCallWaiting", - 4285966731: "PhoneActionDiscarded", - 1618781621: "PhoneActionIceExchange", - 656125601: "PhoneActionJoinRequested", - 2310335221: "PhoneActionMediaSettingsUpdated", - 2638615078: "PhoneActionParticipantAdded", - 3280922507: "PhoneActionParticipantRemoved", - 2478763318: "PhoneActionPicked", - 2047679815: "PhoneActionReactionSet", - 1678316869: "PhoneActionRequested", - 1979061868: "PhoneActionRestarted", - 835530308: "PhoneActionSDPAnswer", - 931453435: "PhoneActionSDPOffer", - 813039088: "PhoneActionScreenShare", - 2867411100: "PhoneAddParticipant", - 3296664529: "PhoneCall", - 4147150312: "PhoneCallRecord", - 1227520020: "PhoneCallsMany", - 2672574672: "PhoneContact", - 2528259211: "PhoneDeleteHistory", - 2712700137: "PhoneDiscardCall", - 432049159: "PhoneGetCall", - 407776572: "PhoneGetHistory", - 3924781570: "PhoneGetParticipants", - 3464876187: "PhoneInit", - 2975617068: "PhoneInitCall", - 3019166552: "PhoneJoinCall", - 226273622: "PhoneParticipant", - 545454774: "PhoneParticipantSDP", - 2567653219: "PhoneParticipants", - 2215486159: "PhoneRateCall", - 188662172: "PhoneRemoveParticipant", - 907942641: "PhoneRequestCall", - 442877873: "PhoneUpdateAdmin", - 1976202226: "PhoneUpdateCall", - 2246546115: "Ping", - 2124799390: "PollAnswer", - 2095107985: "PollAnswerVoters", - 3283416711: "PollResults", - 2171268721: "Pong", - 3954700912: "PrivacyRule", - 2668405547: "ProtoEncryptedPayload", - 2179260159: "ProtoMessage", - 2292051365: "PublicGetUserInfo", - 1015984470: "PushProvider", - 5873573: "PushProvidersMany", - 1046601890: "RSAPublicKey", - 3277490830: "ReactionCounter", - 4260855916: "ReactionList", - 3486960061: "ReadHistoryStat", - 1697591959: "RecoveryQuestion", - 981138557: "Redirect", - 2436413989: "ReplyInlineMarkup", - 258469686: "ReplyKeyboardForceReply", - 3134153306: "ReplyKeyboardHide", - 3207405102: "ReplyKeyboardMarkup", - 1388055751: "ReservedUsernames", - 2982813633: "SavedGifs", - 1989228797: "SecurityAnswer", - 1092467205: "SecurityQuestion", - 1797596734: "SecurityQuestions", - 824547051: "ServiceSendMessage", - 1966993242: "StorageNode", - 2667693068: "StorageNodeMany", - 367036084: "SystemConfig", - 1910333714: "SystemGetConfig", - 1486296237: "SystemGetInfo", - 1415676946: "SystemGetResponse", - 1705203315: "SystemGetSalts", - 2510636156: "SystemGetServerKeys", - 1321179349: "SystemGetServerTime", - 2754948760: "SystemInfo", - 3677510435: "SystemKeys", - 871116906: "SystemSalts", - 2854614486: "SystemServerTime", - 3056393082: "SystemUploadUsage", - 1691486497: "Team", - 3889056091: "TeamAddMember", - 2331393294: "TeamDemote", - 3481894956: "TeamEdit", - 1172720786: "TeamGet", - 1725794017: "TeamJoin", - 1413785879: "TeamLeave", - 3107323194: "TeamListMembers", - 1965775170: "TeamMember", - 2208941294: "TeamMembers", - 3678645727: "TeamPhoto", - 382328820: "TeamPromote", - 4200364613: "TeamRemoveMember", - 3388888323: "TeamRemovePhoto", - 1595699082: "TeamUploadPhoto", - 2225718663: "TeamsMany", - 475847033: "TestRequest", - 3760062575: "TestRequestWithString", - 1999996896: "TestResponse", - 556112423: "TestResponseWithString", - 1763100161: "TopPeer", - 629173761: "UpdateAccountPrivacy", - 2359297647: "UpdateAuthorizationReset", - 3408999713: "UpdateBotCallbackQuery", - 4065328876: "UpdateBotInlineQuery", - 2208028013: "UpdateBotInlineSend", - 297964741: "UpdateCalendarEventAdded", - 516349098: "UpdateCalendarEventEdited", - 2986798389: "UpdateCalendarEventRemoved", - 983926580: "UpdateCommunityMessage", - 2094301834: "UpdateCommunityReadOutbox", - 451491445: "UpdateCommunityTyping", - 661712615: "UpdateContainer", - 231538299: "UpdateDialogPinned", - 1567423539: "UpdateDialogPinnedReorder", - 1742546619: "UpdateDifference", - 3453026195: "UpdateDraftMessage", - 2011635602: "UpdateDraftMessageCleared", - 2373884514: "UpdateEnvelope", - 556775761: "UpdateGetDifference", - 1437250230: "UpdateGetState", - 691550776: "UpdateGroupAdminOnly", - 694155405: "UpdateGroupAdmins", - 1623827837: "UpdateGroupParticipantAdd", - 1813022164: "UpdateGroupParticipantAdmin", - 2489941844: "UpdateGroupParticipantDeleted", - 367193154: "UpdateGroupPhoto", - 3702192307: "UpdateLabelDeleted", - 2216022057: "UpdateLabelItemsAdded", - 830226827: "UpdateLabelItemsRemoved", - 2353687359: "UpdateLabelSet", - 1825079988: "UpdateMessageEdited", - 2139063022: "UpdateMessageID", - 1260768050: "UpdateMessagePinned", - 383248674: "UpdateMessagePoll", - 670568714: "UpdateMessagesDeleted", - 3426925183: "UpdateNewMessage", - 3187524885: "UpdateNotifySettings", - 2791086990: "UpdatePhoneCall", - 1764711846: "UpdatePhoneCallEnded", - 1094761594: "UpdatePhoneCallStarted", - 2738677245: "UpdateReaction", - 1529128378: "UpdateReadHistoryInbox", - 510866108: "UpdateReadHistoryOutbox", - 2991403048: "UpdateReadMessagesContents", - 3303504929: "UpdateRedirect", - 1837585836: "UpdateState", - 2978180712: "UpdateTeam", - 2762932529: "UpdateTeamCreated", - 1307755890: "UpdateTeamMemberAdded", - 99543064: "UpdateTeamMemberRemoved", - 4065657769: "UpdateTeamMemberStatus", - 3110088064: "UpdateTeamPhoto", - 1531755547: "UpdateTooLong", - 3750625773: "UpdateUserBlocked", - 302028082: "UpdateUserPhoto", - 2696747995: "UpdateUserStatus", - 178254060: "UpdateUserTyping", - 4290110589: "UpdateUsername", - 765557111: "User", - 883983438: "UserInfo", - 1677556362: "UserMessage", - 1881347437: "UserPhoto", - 1039301579: "UsersGet", - 3343342086: "UsersGetFull", - 801733941: "UsersMany", - 1889659487: "Version", - 2123920547: "VersionsMany", - 2527250827: "WallPaper", - 3006268108: "WallPaperDelete", - 183906980: "WallPaperGet", - 2714244308: "WallPaperReset", - 3559907599: "WallPaperSave", - 1098244882: "WallPaperSettings", - 2661259348: "WallPaperUpload", - 3121104857: "WallPapersMany", - 3180538793: "WebLocation", - 2506678571: "WelcomeMessage", - 414982091: "WelcomeMessagesMany", - } - } - \ No newline at end of file diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/contacts.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/contacts.pb.go deleted file mode 100644 index 632b4ec9..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/contacts.pb.go +++ /dev/null @@ -1,1524 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: contacts.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// TopPeerCategory -type TopPeerCategory int32 - -const ( - TopPeerCategory_Users TopPeerCategory = 0 - TopPeerCategory_Groups TopPeerCategory = 1 - TopPeerCategory_Forwards TopPeerCategory = 2 - TopPeerCategory_BotsMessage TopPeerCategory = 3 - TopPeerCategory_BotsInline TopPeerCategory = 4 -) - -// Enum value maps for TopPeerCategory. -var ( - TopPeerCategory_name = map[int32]string{ - 0: "Users", - 1: "Groups", - 2: "Forwards", - 3: "BotsMessage", - 4: "BotsInline", - } - TopPeerCategory_value = map[string]int32{ - "Users": 0, - "Groups": 1, - "Forwards": 2, - "BotsMessage": 3, - "BotsInline": 4, - } -) - -func (x TopPeerCategory) Enum() *TopPeerCategory { - p := new(TopPeerCategory) - *p = x - return p -} - -func (x TopPeerCategory) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (TopPeerCategory) Descriptor() protoreflect.EnumDescriptor { - return file_contacts_proto_enumTypes[0].Descriptor() -} - -func (TopPeerCategory) Type() protoreflect.EnumType { - return &file_contacts_proto_enumTypes[0] -} - -func (x TopPeerCategory) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use TopPeerCategory.Descriptor instead. -func (TopPeerCategory) EnumDescriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{0} -} - -// ContactsImport -// @Function -// @Return: ContactsImported -type ContactsImport struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Contacts []*PhoneContact `protobuf:"bytes,1,rep,name=Contacts,proto3" json:"Contacts,omitempty"` - Replace bool `protobuf:"varint,2,opt,name=Replace,proto3" json:"Replace,omitempty"` -} - -func (x *ContactsImport) Reset() { - *x = ContactsImport{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsImport) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsImport) ProtoMessage() {} - -func (x *ContactsImport) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsImport.ProtoReflect.Descriptor instead. -func (*ContactsImport) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{0} -} - -func (x *ContactsImport) GetContacts() []*PhoneContact { - if x != nil { - return x.Contacts - } - return nil -} - -func (x *ContactsImport) GetReplace() bool { - if x != nil { - return x.Replace - } - return false -} - -// ContactsAdd -// @Function -// @Return: Bool -type ContactsAdd struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - User *InputUser `protobuf:"bytes,1,opt,name=User,proto3" json:"User,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - Phone string `protobuf:"bytes,4,opt,name=Phone,proto3" json:"Phone,omitempty"` -} - -func (x *ContactsAdd) Reset() { - *x = ContactsAdd{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsAdd) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsAdd) ProtoMessage() {} - -func (x *ContactsAdd) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsAdd.ProtoReflect.Descriptor instead. -func (*ContactsAdd) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{1} -} - -func (x *ContactsAdd) GetUser() *InputUser { - if x != nil { - return x.User - } - return nil -} - -func (x *ContactsAdd) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *ContactsAdd) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *ContactsAdd) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -// ContactsGet -// @Function -// @Return: ContactsMany -type ContactsGet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Crc32Hash uint32 `protobuf:"varint,2,opt,name=Crc32Hash,proto3" json:"Crc32Hash,omitempty"` -} - -func (x *ContactsGet) Reset() { - *x = ContactsGet{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsGet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsGet) ProtoMessage() {} - -func (x *ContactsGet) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsGet.ProtoReflect.Descriptor instead. -func (*ContactsGet) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{2} -} - -func (x *ContactsGet) GetCrc32Hash() uint32 { - if x != nil { - return x.Crc32Hash - } - return 0 -} - -// ContactsDelete -// @Function -// @Return: Bool -type ContactsDelete struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserIDs []int64 `protobuf:"varint,1,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` -} - -func (x *ContactsDelete) Reset() { - *x = ContactsDelete{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsDelete) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsDelete) ProtoMessage() {} - -func (x *ContactsDelete) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsDelete.ProtoReflect.Descriptor instead. -func (*ContactsDelete) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{3} -} - -func (x *ContactsDelete) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -// ContactsDeleteAll -// @Function: ContactsDeleteAll -// @Return: Bool -type ContactsDeleteAll struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ContactsDeleteAll) Reset() { - *x = ContactsDeleteAll{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsDeleteAll) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsDeleteAll) ProtoMessage() {} - -func (x *ContactsDeleteAll) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsDeleteAll.ProtoReflect.Descriptor instead. -func (*ContactsDeleteAll) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{4} -} - -// ContactsBlock -// @Function -// @Return: Bool -type ContactsBlock struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - User *InputUser `protobuf:"bytes,1,opt,name=User,proto3" json:"User,omitempty"` -} - -func (x *ContactsBlock) Reset() { - *x = ContactsBlock{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsBlock) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsBlock) ProtoMessage() {} - -func (x *ContactsBlock) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsBlock.ProtoReflect.Descriptor instead. -func (*ContactsBlock) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{5} -} - -func (x *ContactsBlock) GetUser() *InputUser { - if x != nil { - return x.User - } - return nil -} - -// ContactsUnblock -// @Function -// @Return: Bool -type ContactsUnblock struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - User *InputUser `protobuf:"bytes,2,opt,name=User,proto3" json:"User,omitempty"` -} - -func (x *ContactsUnblock) Reset() { - *x = ContactsUnblock{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsUnblock) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsUnblock) ProtoMessage() {} - -func (x *ContactsUnblock) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsUnblock.ProtoReflect.Descriptor instead. -func (*ContactsUnblock) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{6} -} - -func (x *ContactsUnblock) GetUser() *InputUser { - if x != nil { - return x.User - } - return nil -} - -// ContactsGetBlocked -// @Function -// @Returns: BlockedContacts -type ContactsGetBlocked struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Offset int32 `protobuf:"varint,1,opt,name=Offset,proto3" json:"Offset,omitempty"` - Limit int32 `protobuf:"varint,2,opt,name=Limit,proto3" json:"Limit,omitempty"` -} - -func (x *ContactsGetBlocked) Reset() { - *x = ContactsGetBlocked{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsGetBlocked) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsGetBlocked) ProtoMessage() {} - -func (x *ContactsGetBlocked) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsGetBlocked.ProtoReflect.Descriptor instead. -func (*ContactsGetBlocked) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{7} -} - -func (x *ContactsGetBlocked) GetOffset() int32 { - if x != nil { - return x.Offset - } - return 0 -} - -func (x *ContactsGetBlocked) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -// ContactsSearch -// @Function -// @Returns: UsersMany -type ContactsSearch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Q string `protobuf:"bytes,1,opt,name=Q,proto3" json:"Q,omitempty"` -} - -func (x *ContactsSearch) Reset() { - *x = ContactsSearch{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsSearch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsSearch) ProtoMessage() {} - -func (x *ContactsSearch) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsSearch.ProtoReflect.Descriptor instead. -func (*ContactsSearch) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{8} -} - -func (x *ContactsSearch) GetQ() string { - if x != nil { - return x.Q - } - return "" -} - -// ContactsGetTopPeers -// @Function -// @Returns: ContactsTopPeers -type ContactsGetTopPeers struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Offset int32 `protobuf:"varint,1,opt,name=Offset,proto3" json:"Offset,omitempty"` - Limit int32 `protobuf:"varint,2,opt,name=Limit,proto3" json:"Limit,omitempty"` - Category TopPeerCategory `protobuf:"varint,3,opt,name=Category,proto3,enum=msg.TopPeerCategory" json:"Category,omitempty"` -} - -func (x *ContactsGetTopPeers) Reset() { - *x = ContactsGetTopPeers{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsGetTopPeers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsGetTopPeers) ProtoMessage() {} - -func (x *ContactsGetTopPeers) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsGetTopPeers.ProtoReflect.Descriptor instead. -func (*ContactsGetTopPeers) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{9} -} - -func (x *ContactsGetTopPeers) GetOffset() int32 { - if x != nil { - return x.Offset - } - return 0 -} - -func (x *ContactsGetTopPeers) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *ContactsGetTopPeers) GetCategory() TopPeerCategory { - if x != nil { - return x.Category - } - return TopPeerCategory_Users -} - -// ContactsResetTopPeer -// @Function -// @Returns: Bool -type ContactsResetTopPeer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Category TopPeerCategory `protobuf:"varint,1,opt,name=Category,proto3,enum=msg.TopPeerCategory" json:"Category,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *ContactsResetTopPeer) Reset() { - *x = ContactsResetTopPeer{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsResetTopPeer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsResetTopPeer) ProtoMessage() {} - -func (x *ContactsResetTopPeer) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsResetTopPeer.ProtoReflect.Descriptor instead. -func (*ContactsResetTopPeer) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{10} -} - -func (x *ContactsResetTopPeer) GetCategory() TopPeerCategory { - if x != nil { - return x.Category - } - return TopPeerCategory_Users -} - -func (x *ContactsResetTopPeer) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -// ContactsTopPeer -type ContactsTopPeers struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Category TopPeerCategory `protobuf:"varint,1,opt,name=Category,proto3,enum=msg.TopPeerCategory" json:"Category,omitempty"` - Count int32 `protobuf:"varint,2,opt,name=Count,proto3" json:"Count,omitempty"` - Peers []*TopPeer `protobuf:"bytes,3,rep,name=Peers,proto3" json:"Peers,omitempty"` - Users []*User `protobuf:"bytes,4,rep,name=Users,proto3" json:"Users,omitempty"` - Groups []*Group `protobuf:"bytes,5,rep,name=Groups,proto3" json:"Groups,omitempty"` -} - -func (x *ContactsTopPeers) Reset() { - *x = ContactsTopPeers{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsTopPeers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsTopPeers) ProtoMessage() {} - -func (x *ContactsTopPeers) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsTopPeers.ProtoReflect.Descriptor instead. -func (*ContactsTopPeers) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{11} -} - -func (x *ContactsTopPeers) GetCategory() TopPeerCategory { - if x != nil { - return x.Category - } - return TopPeerCategory_Users -} - -func (x *ContactsTopPeers) GetCount() int32 { - if x != nil { - return x.Count - } - return 0 -} - -func (x *ContactsTopPeers) GetPeers() []*TopPeer { - if x != nil { - return x.Peers - } - return nil -} - -func (x *ContactsTopPeers) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *ContactsTopPeers) GetGroups() []*Group { - if x != nil { - return x.Groups - } - return nil -} - -// TopPeer -type TopPeer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,100,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - Rate float32 `protobuf:"fixed32,2,opt,name=Rate,proto3" json:"Rate,omitempty"` - LastUpdate int64 `protobuf:"varint,3,opt,name=LastUpdate,proto3" json:"LastUpdate,omitempty"` -} - -func (x *TopPeer) Reset() { - *x = TopPeer{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TopPeer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TopPeer) ProtoMessage() {} - -func (x *TopPeer) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TopPeer.ProtoReflect.Descriptor instead. -func (*TopPeer) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{12} -} - -func (x *TopPeer) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *TopPeer) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *TopPeer) GetRate() float32 { - if x != nil { - return x.Rate - } - return 0 -} - -func (x *TopPeer) GetLastUpdate() int64 { - if x != nil { - return x.LastUpdate - } - return 0 -} - -// BlockedContactsMany -type BlockedContactsMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Contacts []*BlockedContact `protobuf:"bytes,1,rep,name=Contacts,proto3" json:"Contacts,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Total int32 `protobuf:"varint,3,opt,name=Total,proto3" json:"Total,omitempty"` -} - -func (x *BlockedContactsMany) Reset() { - *x = BlockedContactsMany{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BlockedContactsMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BlockedContactsMany) ProtoMessage() {} - -func (x *BlockedContactsMany) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BlockedContactsMany.ProtoReflect.Descriptor instead. -func (*BlockedContactsMany) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{13} -} - -func (x *BlockedContactsMany) GetContacts() []*BlockedContact { - if x != nil { - return x.Contacts - } - return nil -} - -func (x *BlockedContactsMany) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *BlockedContactsMany) GetTotal() int32 { - if x != nil { - return x.Total - } - return 0 -} - -// BlockedContact -type BlockedContact struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Date int64 `protobuf:"varint,2,opt,name=Date,proto3" json:"Date,omitempty"` -} - -func (x *BlockedContact) Reset() { - *x = BlockedContact{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BlockedContact) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BlockedContact) ProtoMessage() {} - -func (x *BlockedContact) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BlockedContact.ProtoReflect.Descriptor instead. -func (*BlockedContact) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{14} -} - -func (x *BlockedContact) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *BlockedContact) GetDate() int64 { - if x != nil { - return x.Date - } - return 0 -} - -// ContactsImported -type ContactsImported struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ContactUsers []*ContactUser `protobuf:"bytes,1,rep,name=ContactUsers,proto3" json:"ContactUsers,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Empty bool `protobuf:"varint,3,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *ContactsImported) Reset() { - *x = ContactsImported{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsImported) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsImported) ProtoMessage() {} - -func (x *ContactsImported) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsImported.ProtoReflect.Descriptor instead. -func (*ContactsImported) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{15} -} - -func (x *ContactsImported) GetContactUsers() []*ContactUser { - if x != nil { - return x.ContactUsers - } - return nil -} - -func (x *ContactsImported) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *ContactsImported) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// ContactsMany -type ContactsMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Contacts []*PhoneContact `protobuf:"bytes,1,rep,name=Contacts,proto3" json:"Contacts,omitempty"` - ContactUsers []*ContactUser `protobuf:"bytes,2,rep,name=ContactUsers,proto3" json:"ContactUsers,omitempty"` - Modified bool `protobuf:"varint,3,opt,name=Modified,proto3" json:"Modified,omitempty"` - Users []*User `protobuf:"bytes,4,rep,name=Users,proto3" json:"Users,omitempty"` - Empty bool `protobuf:"varint,5,opt,name=Empty,proto3" json:"Empty,omitempty"` - Hash uint32 `protobuf:"varint,6,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *ContactsMany) Reset() { - *x = ContactsMany{} - if protoimpl.UnsafeEnabled { - mi := &file_contacts_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactsMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactsMany) ProtoMessage() {} - -func (x *ContactsMany) ProtoReflect() protoreflect.Message { - mi := &file_contacts_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactsMany.ProtoReflect.Descriptor instead. -func (*ContactsMany) Descriptor() ([]byte, []int) { - return file_contacts_proto_rawDescGZIP(), []int{16} -} - -func (x *ContactsMany) GetContacts() []*PhoneContact { - if x != nil { - return x.Contacts - } - return nil -} - -func (x *ContactsMany) GetContactUsers() []*ContactUser { - if x != nil { - return x.ContactUsers - } - return nil -} - -func (x *ContactsMany) GetModified() bool { - if x != nil { - return x.Modified - } - return false -} - -func (x *ContactsMany) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *ContactsMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -func (x *ContactsMany) GetHash() uint32 { - if x != nil { - return x.Hash - } - return 0 -} - -var File_contacts_proto protoreflect.FileDescriptor - -var file_contacts_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x59, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x74, 0x61, - 0x63, 0x74, 0x73, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x2d, 0x0a, 0x08, 0x43, 0x6f, 0x6e, - 0x74, 0x61, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x08, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, - 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x61, - 0x63, 0x65, 0x22, 0x81, 0x01, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x41, - 0x64, 0x64, 0x12, 0x22, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x52, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0x2b, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, - 0x74, 0x73, 0x47, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x63, 0x33, 0x32, 0x48, 0x61, - 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x43, 0x72, 0x63, 0x33, 0x32, 0x48, - 0x61, 0x73, 0x68, 0x22, 0x2e, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x55, 0x73, 0x65, 0x72, - 0x49, 0x44, 0x73, 0x22, 0x13, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x6c, 0x6c, 0x22, 0x33, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x74, - 0x61, 0x63, 0x74, 0x73, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, 0x04, 0x55, 0x73, 0x65, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x55, 0x73, 0x65, 0x72, 0x22, 0x35, 0x0a, - 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x55, 0x6e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x12, 0x22, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, - 0x55, 0x73, 0x65, 0x72, 0x22, 0x42, 0x0a, 0x12, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, - 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x1e, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x74, - 0x61, 0x63, 0x74, 0x73, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x0c, 0x0a, 0x01, 0x51, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x51, 0x22, 0x75, 0x0a, 0x13, 0x43, 0x6f, 0x6e, 0x74, - 0x61, 0x63, 0x74, 0x73, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, - 0x16, 0x0a, 0x06, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x30, 0x0a, - 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, 0x6f, 0x70, 0x50, 0x65, 0x65, 0x72, 0x43, 0x61, 0x74, - 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x22, - 0x6c, 0x0a, 0x14, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x65, 0x74, - 0x54, 0x6f, 0x70, 0x50, 0x65, 0x65, 0x72, 0x12, 0x30, 0x0a, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, - 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x54, 0x6f, 0x70, 0x50, 0x65, 0x65, 0x72, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, - 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, - 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x22, 0xc3, 0x01, - 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x54, 0x6f, 0x70, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, 0x6f, 0x70, 0x50, 0x65, - 0x65, 0x72, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x08, 0x43, 0x61, 0x74, 0x65, - 0x67, 0x6f, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x05, 0x50, 0x65, - 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x54, 0x6f, 0x70, 0x50, 0x65, 0x65, 0x72, 0x52, 0x05, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1f, - 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, - 0x22, 0x0a, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x06, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x73, 0x22, 0x78, 0x0a, 0x07, 0x54, 0x6f, 0x70, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, - 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x64, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, - 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, - 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x61, 0x74, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x52, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, - 0x0a, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0a, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x7d, 0x0a, - 0x13, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, - 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x2f, 0x0a, 0x08, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, 0x6c, 0x6f, - 0x63, 0x6b, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x52, 0x08, 0x43, 0x6f, 0x6e, - 0x74, 0x61, 0x63, 0x74, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0x3c, 0x0a, 0x0e, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x16, - 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x44, 0x61, 0x74, 0x65, 0x22, 0x7f, 0x0a, 0x10, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x12, 0x34, - 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, - 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x55, - 0x73, 0x65, 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xda, 0x01, 0x0a, 0x0c, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x2d, 0x0a, 0x08, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, - 0x74, 0x52, 0x08, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x12, 0x34, 0x0a, 0x0c, 0x43, - 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x0c, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, - 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x08, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12, 0x1f, 0x0a, - 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x2a, 0x57, 0x0a, 0x0f, 0x54, 0x6f, 0x70, 0x50, - 0x65, 0x65, 0x72, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x09, 0x0a, 0x05, 0x55, - 0x73, 0x65, 0x72, 0x73, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, - 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x73, 0x10, 0x02, - 0x12, 0x0f, 0x0a, 0x0b, 0x42, 0x6f, 0x74, 0x73, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x10, - 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x42, 0x6f, 0x74, 0x73, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x10, - 0x04, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_contacts_proto_rawDescOnce sync.Once - file_contacts_proto_rawDescData = file_contacts_proto_rawDesc -) - -func file_contacts_proto_rawDescGZIP() []byte { - file_contacts_proto_rawDescOnce.Do(func() { - file_contacts_proto_rawDescData = protoimpl.X.CompressGZIP(file_contacts_proto_rawDescData) - }) - return file_contacts_proto_rawDescData -} - -var file_contacts_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_contacts_proto_msgTypes = make([]protoimpl.MessageInfo, 17) -var file_contacts_proto_goTypes = []interface{}{ - (TopPeerCategory)(0), // 0: msg.TopPeerCategory - (*ContactsImport)(nil), // 1: msg.ContactsImport - (*ContactsAdd)(nil), // 2: msg.ContactsAdd - (*ContactsGet)(nil), // 3: msg.ContactsGet - (*ContactsDelete)(nil), // 4: msg.ContactsDelete - (*ContactsDeleteAll)(nil), // 5: msg.ContactsDeleteAll - (*ContactsBlock)(nil), // 6: msg.ContactsBlock - (*ContactsUnblock)(nil), // 7: msg.ContactsUnblock - (*ContactsGetBlocked)(nil), // 8: msg.ContactsGetBlocked - (*ContactsSearch)(nil), // 9: msg.ContactsSearch - (*ContactsGetTopPeers)(nil), // 10: msg.ContactsGetTopPeers - (*ContactsResetTopPeer)(nil), // 11: msg.ContactsResetTopPeer - (*ContactsTopPeers)(nil), // 12: msg.ContactsTopPeers - (*TopPeer)(nil), // 13: msg.TopPeer - (*BlockedContactsMany)(nil), // 14: msg.BlockedContactsMany - (*BlockedContact)(nil), // 15: msg.BlockedContact - (*ContactsImported)(nil), // 16: msg.ContactsImported - (*ContactsMany)(nil), // 17: msg.ContactsMany - (*PhoneContact)(nil), // 18: msg.PhoneContact - (*InputUser)(nil), // 19: msg.InputUser - (*InputPeer)(nil), // 20: msg.InputPeer - (*User)(nil), // 21: msg.User - (*Group)(nil), // 22: msg.Group - (*Peer)(nil), // 23: msg.Peer - (*ContactUser)(nil), // 24: msg.ContactUser -} -var file_contacts_proto_depIdxs = []int32{ - 18, // 0: msg.ContactsImport.Contacts:type_name -> msg.PhoneContact - 19, // 1: msg.ContactsAdd.User:type_name -> msg.InputUser - 19, // 2: msg.ContactsBlock.User:type_name -> msg.InputUser - 19, // 3: msg.ContactsUnblock.User:type_name -> msg.InputUser - 0, // 4: msg.ContactsGetTopPeers.Category:type_name -> msg.TopPeerCategory - 0, // 5: msg.ContactsResetTopPeer.Category:type_name -> msg.TopPeerCategory - 20, // 6: msg.ContactsResetTopPeer.Peer:type_name -> msg.InputPeer - 0, // 7: msg.ContactsTopPeers.Category:type_name -> msg.TopPeerCategory - 13, // 8: msg.ContactsTopPeers.Peers:type_name -> msg.TopPeer - 21, // 9: msg.ContactsTopPeers.Users:type_name -> msg.User - 22, // 10: msg.ContactsTopPeers.Groups:type_name -> msg.Group - 23, // 11: msg.TopPeer.Peer:type_name -> msg.Peer - 15, // 12: msg.BlockedContactsMany.Contacts:type_name -> msg.BlockedContact - 21, // 13: msg.BlockedContactsMany.Users:type_name -> msg.User - 24, // 14: msg.ContactsImported.ContactUsers:type_name -> msg.ContactUser - 21, // 15: msg.ContactsImported.Users:type_name -> msg.User - 18, // 16: msg.ContactsMany.Contacts:type_name -> msg.PhoneContact - 24, // 17: msg.ContactsMany.ContactUsers:type_name -> msg.ContactUser - 21, // 18: msg.ContactsMany.Users:type_name -> msg.User - 19, // [19:19] is the sub-list for method output_type - 19, // [19:19] is the sub-list for method input_type - 19, // [19:19] is the sub-list for extension type_name - 19, // [19:19] is the sub-list for extension extendee - 0, // [0:19] is the sub-list for field type_name -} - -func init() { file_contacts_proto_init() } -func file_contacts_proto_init() { - if File_contacts_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_contacts_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsImport); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsAdd); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsGet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsDelete); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsDeleteAll); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsBlock); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsUnblock); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsGetBlocked); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsSearch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsGetTopPeers); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsResetTopPeer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsTopPeers); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TopPeer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BlockedContactsMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BlockedContact); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsImported); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_contacts_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactsMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_contacts_proto_rawDesc, - NumEnums: 1, - NumMessages: 17, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_contacts_proto_goTypes, - DependencyIndexes: file_contacts_proto_depIdxs, - EnumInfos: file_contacts_proto_enumTypes, - MessageInfos: file_contacts_proto_msgTypes, - }.Build() - File_contacts_proto = out.File - file_contacts_proto_rawDesc = nil - file_contacts_proto_goTypes = nil - file_contacts_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/contacts.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/contacts.rony.go deleted file mode 100644 index 8d13b596..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/contacts.rony.go +++ /dev/null @@ -1,1216 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: contacts.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_ContactsImport int64 = 3473528730 - -type poolContactsImport struct { - pool sync.Pool -} - -func (p *poolContactsImport) Get() *ContactsImport { - x, ok := p.pool.Get().(*ContactsImport) - if !ok { - x = &ContactsImport{} - } - - return x -} - -func (p *poolContactsImport) Put(x *ContactsImport) { - if x == nil { - return - } - - for _, z := range x.Contacts { - PoolPhoneContact.Put(z) - } - x.Contacts = x.Contacts[:0] - x.Replace = false - - p.pool.Put(x) -} - -var PoolContactsImport = poolContactsImport{} - -func (x *ContactsImport) DeepCopy(z *ContactsImport) { - for idx := range x.Contacts { - if x.Contacts[idx] == nil { - continue - } - xx := PoolPhoneContact.Get() - x.Contacts[idx].DeepCopy(xx) - z.Contacts = append(z.Contacts, xx) - } - z.Replace = x.Replace -} - -func (x *ContactsImport) Clone() *ContactsImport { - z := &ContactsImport{} - x.DeepCopy(z) - return z -} - -func (x *ContactsImport) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsImport) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsImport) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsImport) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsImport) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsImport, x) -} - -const C_ContactsAdd int64 = 1410714478 - -type poolContactsAdd struct { - pool sync.Pool -} - -func (p *poolContactsAdd) Get() *ContactsAdd { - x, ok := p.pool.Get().(*ContactsAdd) - if !ok { - x = &ContactsAdd{} - } - - x.User = PoolInputUser.Get() - - return x -} - -func (p *poolContactsAdd) Put(x *ContactsAdd) { - if x == nil { - return - } - - PoolInputUser.Put(x.User) - x.FirstName = "" - x.LastName = "" - x.Phone = "" - - p.pool.Put(x) -} - -var PoolContactsAdd = poolContactsAdd{} - -func (x *ContactsAdd) DeepCopy(z *ContactsAdd) { - if x.User != nil { - if z.User == nil { - z.User = PoolInputUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolInputUser.Put(z.User) - z.User = nil - } - z.FirstName = x.FirstName - z.LastName = x.LastName - z.Phone = x.Phone -} - -func (x *ContactsAdd) Clone() *ContactsAdd { - z := &ContactsAdd{} - x.DeepCopy(z) - return z -} - -func (x *ContactsAdd) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsAdd) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsAdd) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsAdd) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsAdd) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsAdd, x) -} - -const C_ContactsGet int64 = 1412732665 - -type poolContactsGet struct { - pool sync.Pool -} - -func (p *poolContactsGet) Get() *ContactsGet { - x, ok := p.pool.Get().(*ContactsGet) - if !ok { - x = &ContactsGet{} - } - - return x -} - -func (p *poolContactsGet) Put(x *ContactsGet) { - if x == nil { - return - } - - x.Crc32Hash = 0 - - p.pool.Put(x) -} - -var PoolContactsGet = poolContactsGet{} - -func (x *ContactsGet) DeepCopy(z *ContactsGet) { - z.Crc32Hash = x.Crc32Hash -} - -func (x *ContactsGet) Clone() *ContactsGet { - z := &ContactsGet{} - x.DeepCopy(z) - return z -} - -func (x *ContactsGet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsGet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsGet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsGet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsGet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsGet, x) -} - -const C_ContactsDelete int64 = 1750426880 - -type poolContactsDelete struct { - pool sync.Pool -} - -func (p *poolContactsDelete) Get() *ContactsDelete { - x, ok := p.pool.Get().(*ContactsDelete) - if !ok { - x = &ContactsDelete{} - } - - return x -} - -func (p *poolContactsDelete) Put(x *ContactsDelete) { - if x == nil { - return - } - - x.UserIDs = x.UserIDs[:0] - - p.pool.Put(x) -} - -var PoolContactsDelete = poolContactsDelete{} - -func (x *ContactsDelete) DeepCopy(z *ContactsDelete) { - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) -} - -func (x *ContactsDelete) Clone() *ContactsDelete { - z := &ContactsDelete{} - x.DeepCopy(z) - return z -} - -func (x *ContactsDelete) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsDelete) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsDelete) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsDelete) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsDelete) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsDelete, x) -} - -const C_ContactsDeleteAll int64 = 14552524 - -type poolContactsDeleteAll struct { - pool sync.Pool -} - -func (p *poolContactsDeleteAll) Get() *ContactsDeleteAll { - x, ok := p.pool.Get().(*ContactsDeleteAll) - if !ok { - x = &ContactsDeleteAll{} - } - - return x -} - -func (p *poolContactsDeleteAll) Put(x *ContactsDeleteAll) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolContactsDeleteAll = poolContactsDeleteAll{} - -func (x *ContactsDeleteAll) DeepCopy(z *ContactsDeleteAll) { -} - -func (x *ContactsDeleteAll) Clone() *ContactsDeleteAll { - z := &ContactsDeleteAll{} - x.DeepCopy(z) - return z -} - -func (x *ContactsDeleteAll) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsDeleteAll) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsDeleteAll) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsDeleteAll) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsDeleteAll) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsDeleteAll, x) -} - -const C_ContactsBlock int64 = 2900371089 - -type poolContactsBlock struct { - pool sync.Pool -} - -func (p *poolContactsBlock) Get() *ContactsBlock { - x, ok := p.pool.Get().(*ContactsBlock) - if !ok { - x = &ContactsBlock{} - } - - x.User = PoolInputUser.Get() - - return x -} - -func (p *poolContactsBlock) Put(x *ContactsBlock) { - if x == nil { - return - } - - PoolInputUser.Put(x.User) - - p.pool.Put(x) -} - -var PoolContactsBlock = poolContactsBlock{} - -func (x *ContactsBlock) DeepCopy(z *ContactsBlock) { - if x.User != nil { - if z.User == nil { - z.User = PoolInputUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolInputUser.Put(z.User) - z.User = nil - } -} - -func (x *ContactsBlock) Clone() *ContactsBlock { - z := &ContactsBlock{} - x.DeepCopy(z) - return z -} - -func (x *ContactsBlock) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsBlock) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsBlock) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsBlock) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsBlock) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsBlock, x) -} - -const C_ContactsUnblock int64 = 662011773 - -type poolContactsUnblock struct { - pool sync.Pool -} - -func (p *poolContactsUnblock) Get() *ContactsUnblock { - x, ok := p.pool.Get().(*ContactsUnblock) - if !ok { - x = &ContactsUnblock{} - } - - x.User = PoolInputUser.Get() - - return x -} - -func (p *poolContactsUnblock) Put(x *ContactsUnblock) { - if x == nil { - return - } - - PoolInputUser.Put(x.User) - - p.pool.Put(x) -} - -var PoolContactsUnblock = poolContactsUnblock{} - -func (x *ContactsUnblock) DeepCopy(z *ContactsUnblock) { - if x.User != nil { - if z.User == nil { - z.User = PoolInputUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolInputUser.Put(z.User) - z.User = nil - } -} - -func (x *ContactsUnblock) Clone() *ContactsUnblock { - z := &ContactsUnblock{} - x.DeepCopy(z) - return z -} - -func (x *ContactsUnblock) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsUnblock) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsUnblock) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsUnblock) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsUnblock) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsUnblock, x) -} - -const C_ContactsGetBlocked int64 = 1073733371 - -type poolContactsGetBlocked struct { - pool sync.Pool -} - -func (p *poolContactsGetBlocked) Get() *ContactsGetBlocked { - x, ok := p.pool.Get().(*ContactsGetBlocked) - if !ok { - x = &ContactsGetBlocked{} - } - - return x -} - -func (p *poolContactsGetBlocked) Put(x *ContactsGetBlocked) { - if x == nil { - return - } - - x.Offset = 0 - x.Limit = 0 - - p.pool.Put(x) -} - -var PoolContactsGetBlocked = poolContactsGetBlocked{} - -func (x *ContactsGetBlocked) DeepCopy(z *ContactsGetBlocked) { - z.Offset = x.Offset - z.Limit = x.Limit -} - -func (x *ContactsGetBlocked) Clone() *ContactsGetBlocked { - z := &ContactsGetBlocked{} - x.DeepCopy(z) - return z -} - -func (x *ContactsGetBlocked) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsGetBlocked) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsGetBlocked) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsGetBlocked) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsGetBlocked) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsGetBlocked, x) -} - -const C_ContactsSearch int64 = 3870802464 - -type poolContactsSearch struct { - pool sync.Pool -} - -func (p *poolContactsSearch) Get() *ContactsSearch { - x, ok := p.pool.Get().(*ContactsSearch) - if !ok { - x = &ContactsSearch{} - } - - return x -} - -func (p *poolContactsSearch) Put(x *ContactsSearch) { - if x == nil { - return - } - - x.Q = "" - - p.pool.Put(x) -} - -var PoolContactsSearch = poolContactsSearch{} - -func (x *ContactsSearch) DeepCopy(z *ContactsSearch) { - z.Q = x.Q -} - -func (x *ContactsSearch) Clone() *ContactsSearch { - z := &ContactsSearch{} - x.DeepCopy(z) - return z -} - -func (x *ContactsSearch) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsSearch) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsSearch) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsSearch) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsSearch) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsSearch, x) -} - -const C_ContactsGetTopPeers int64 = 1378126220 - -type poolContactsGetTopPeers struct { - pool sync.Pool -} - -func (p *poolContactsGetTopPeers) Get() *ContactsGetTopPeers { - x, ok := p.pool.Get().(*ContactsGetTopPeers) - if !ok { - x = &ContactsGetTopPeers{} - } - - return x -} - -func (p *poolContactsGetTopPeers) Put(x *ContactsGetTopPeers) { - if x == nil { - return - } - - x.Offset = 0 - x.Limit = 0 - x.Category = 0 - - p.pool.Put(x) -} - -var PoolContactsGetTopPeers = poolContactsGetTopPeers{} - -func (x *ContactsGetTopPeers) DeepCopy(z *ContactsGetTopPeers) { - z.Offset = x.Offset - z.Limit = x.Limit - z.Category = x.Category -} - -func (x *ContactsGetTopPeers) Clone() *ContactsGetTopPeers { - z := &ContactsGetTopPeers{} - x.DeepCopy(z) - return z -} - -func (x *ContactsGetTopPeers) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsGetTopPeers) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsGetTopPeers) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsGetTopPeers) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsGetTopPeers) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsGetTopPeers, x) -} - -const C_ContactsResetTopPeer int64 = 1114887378 - -type poolContactsResetTopPeer struct { - pool sync.Pool -} - -func (p *poolContactsResetTopPeer) Get() *ContactsResetTopPeer { - x, ok := p.pool.Get().(*ContactsResetTopPeer) - if !ok { - x = &ContactsResetTopPeer{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolContactsResetTopPeer) Put(x *ContactsResetTopPeer) { - if x == nil { - return - } - - x.Category = 0 - PoolInputPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolContactsResetTopPeer = poolContactsResetTopPeer{} - -func (x *ContactsResetTopPeer) DeepCopy(z *ContactsResetTopPeer) { - z.Category = x.Category - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *ContactsResetTopPeer) Clone() *ContactsResetTopPeer { - z := &ContactsResetTopPeer{} - x.DeepCopy(z) - return z -} - -func (x *ContactsResetTopPeer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsResetTopPeer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsResetTopPeer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsResetTopPeer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsResetTopPeer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsResetTopPeer, x) -} - -const C_ContactsTopPeers int64 = 2243919622 - -type poolContactsTopPeers struct { - pool sync.Pool -} - -func (p *poolContactsTopPeers) Get() *ContactsTopPeers { - x, ok := p.pool.Get().(*ContactsTopPeers) - if !ok { - x = &ContactsTopPeers{} - } - - return x -} - -func (p *poolContactsTopPeers) Put(x *ContactsTopPeers) { - if x == nil { - return - } - - x.Category = 0 - x.Count = 0 - for _, z := range x.Peers { - PoolTopPeer.Put(z) - } - x.Peers = x.Peers[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Groups { - PoolGroup.Put(z) - } - x.Groups = x.Groups[:0] - - p.pool.Put(x) -} - -var PoolContactsTopPeers = poolContactsTopPeers{} - -func (x *ContactsTopPeers) DeepCopy(z *ContactsTopPeers) { - z.Category = x.Category - z.Count = x.Count - for idx := range x.Peers { - if x.Peers[idx] == nil { - continue - } - xx := PoolTopPeer.Get() - x.Peers[idx].DeepCopy(xx) - z.Peers = append(z.Peers, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Groups { - if x.Groups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.Groups[idx].DeepCopy(xx) - z.Groups = append(z.Groups, xx) - } -} - -func (x *ContactsTopPeers) Clone() *ContactsTopPeers { - z := &ContactsTopPeers{} - x.DeepCopy(z) - return z -} - -func (x *ContactsTopPeers) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsTopPeers) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsTopPeers) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsTopPeers) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsTopPeers) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsTopPeers, x) -} - -const C_TopPeer int64 = 1763100161 - -type poolTopPeer struct { - pool sync.Pool -} - -func (p *poolTopPeer) Get() *TopPeer { - x, ok := p.pool.Get().(*TopPeer) - if !ok { - x = &TopPeer{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolTopPeer) Put(x *TopPeer) { - if x == nil { - return - } - - x.TeamID = 0 - PoolPeer.Put(x.Peer) - x.Rate = 0 - x.LastUpdate = 0 - - p.pool.Put(x) -} - -var PoolTopPeer = poolTopPeer{} - -func (x *TopPeer) DeepCopy(z *TopPeer) { - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.Rate = x.Rate - z.LastUpdate = x.LastUpdate -} - -func (x *TopPeer) Clone() *TopPeer { - z := &TopPeer{} - x.DeepCopy(z) - return z -} - -func (x *TopPeer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TopPeer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TopPeer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TopPeer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TopPeer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TopPeer, x) -} - -const C_BlockedContactsMany int64 = 2067026404 - -type poolBlockedContactsMany struct { - pool sync.Pool -} - -func (p *poolBlockedContactsMany) Get() *BlockedContactsMany { - x, ok := p.pool.Get().(*BlockedContactsMany) - if !ok { - x = &BlockedContactsMany{} - } - - return x -} - -func (p *poolBlockedContactsMany) Put(x *BlockedContactsMany) { - if x == nil { - return - } - - for _, z := range x.Contacts { - PoolBlockedContact.Put(z) - } - x.Contacts = x.Contacts[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - x.Total = 0 - - p.pool.Put(x) -} - -var PoolBlockedContactsMany = poolBlockedContactsMany{} - -func (x *BlockedContactsMany) DeepCopy(z *BlockedContactsMany) { - for idx := range x.Contacts { - if x.Contacts[idx] == nil { - continue - } - xx := PoolBlockedContact.Get() - x.Contacts[idx].DeepCopy(xx) - z.Contacts = append(z.Contacts, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - z.Total = x.Total -} - -func (x *BlockedContactsMany) Clone() *BlockedContactsMany { - z := &BlockedContactsMany{} - x.DeepCopy(z) - return z -} - -func (x *BlockedContactsMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BlockedContactsMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BlockedContactsMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BlockedContactsMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BlockedContactsMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BlockedContactsMany, x) -} - -const C_BlockedContact int64 = 53788553 - -type poolBlockedContact struct { - pool sync.Pool -} - -func (p *poolBlockedContact) Get() *BlockedContact { - x, ok := p.pool.Get().(*BlockedContact) - if !ok { - x = &BlockedContact{} - } - - return x -} - -func (p *poolBlockedContact) Put(x *BlockedContact) { - if x == nil { - return - } - - x.UserID = 0 - x.Date = 0 - - p.pool.Put(x) -} - -var PoolBlockedContact = poolBlockedContact{} - -func (x *BlockedContact) DeepCopy(z *BlockedContact) { - z.UserID = x.UserID - z.Date = x.Date -} - -func (x *BlockedContact) Clone() *BlockedContact { - z := &BlockedContact{} - x.DeepCopy(z) - return z -} - -func (x *BlockedContact) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BlockedContact) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BlockedContact) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BlockedContact) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BlockedContact) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BlockedContact, x) -} - -const C_ContactsImported int64 = 2157298354 - -type poolContactsImported struct { - pool sync.Pool -} - -func (p *poolContactsImported) Get() *ContactsImported { - x, ok := p.pool.Get().(*ContactsImported) - if !ok { - x = &ContactsImported{} - } - - return x -} - -func (p *poolContactsImported) Put(x *ContactsImported) { - if x == nil { - return - } - - for _, z := range x.ContactUsers { - PoolContactUser.Put(z) - } - x.ContactUsers = x.ContactUsers[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolContactsImported = poolContactsImported{} - -func (x *ContactsImported) DeepCopy(z *ContactsImported) { - for idx := range x.ContactUsers { - if x.ContactUsers[idx] == nil { - continue - } - xx := PoolContactUser.Get() - x.ContactUsers[idx].DeepCopy(xx) - z.ContactUsers = append(z.ContactUsers, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - z.Empty = x.Empty -} - -func (x *ContactsImported) Clone() *ContactsImported { - z := &ContactsImported{} - x.DeepCopy(z) - return z -} - -func (x *ContactsImported) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsImported) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsImported) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsImported) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsImported) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsImported, x) -} - -const C_ContactsMany int64 = 3883395672 - -type poolContactsMany struct { - pool sync.Pool -} - -func (p *poolContactsMany) Get() *ContactsMany { - x, ok := p.pool.Get().(*ContactsMany) - if !ok { - x = &ContactsMany{} - } - - return x -} - -func (p *poolContactsMany) Put(x *ContactsMany) { - if x == nil { - return - } - - for _, z := range x.Contacts { - PoolPhoneContact.Put(z) - } - x.Contacts = x.Contacts[:0] - for _, z := range x.ContactUsers { - PoolContactUser.Put(z) - } - x.ContactUsers = x.ContactUsers[:0] - x.Modified = false - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - x.Empty = false - x.Hash = 0 - - p.pool.Put(x) -} - -var PoolContactsMany = poolContactsMany{} - -func (x *ContactsMany) DeepCopy(z *ContactsMany) { - for idx := range x.Contacts { - if x.Contacts[idx] == nil { - continue - } - xx := PoolPhoneContact.Get() - x.Contacts[idx].DeepCopy(xx) - z.Contacts = append(z.Contacts, xx) - } - for idx := range x.ContactUsers { - if x.ContactUsers[idx] == nil { - continue - } - xx := PoolContactUser.Get() - x.ContactUsers[idx].DeepCopy(xx) - z.ContactUsers = append(z.ContactUsers, xx) - } - z.Modified = x.Modified - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - z.Empty = x.Empty - z.Hash = x.Hash -} - -func (x *ContactsMany) Clone() *ContactsMany { - z := &ContactsMany{} - x.DeepCopy(z) - return z -} - -func (x *ContactsMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactsMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactsMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactsMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactsMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactsMany, x) -} - -func init() { - registry.RegisterConstructor(3473528730, "ContactsImport") - registry.RegisterConstructor(1410714478, "ContactsAdd") - registry.RegisterConstructor(1412732665, "ContactsGet") - registry.RegisterConstructor(1750426880, "ContactsDelete") - registry.RegisterConstructor(14552524, "ContactsDeleteAll") - registry.RegisterConstructor(2900371089, "ContactsBlock") - registry.RegisterConstructor(662011773, "ContactsUnblock") - registry.RegisterConstructor(1073733371, "ContactsGetBlocked") - registry.RegisterConstructor(3870802464, "ContactsSearch") - registry.RegisterConstructor(1378126220, "ContactsGetTopPeers") - registry.RegisterConstructor(1114887378, "ContactsResetTopPeer") - registry.RegisterConstructor(2243919622, "ContactsTopPeers") - registry.RegisterConstructor(1763100161, "TopPeer") - registry.RegisterConstructor(2067026404, "BlockedContactsMany") - registry.RegisterConstructor(53788553, "BlockedContact") - registry.RegisterConstructor(2157298354, "ContactsImported") - registry.RegisterConstructor(3883395672, "ContactsMany") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/core.types.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/core.types.pb.go deleted file mode 100644 index 3d64bb61..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/core.types.pb.go +++ /dev/null @@ -1,5753 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: core.types.proto - -package msg - -import ( - rony "github.com/ronaksoft/rony" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// TypingAction -type TypingAction int32 - -const ( - TypingAction_TypingActionTyping TypingAction = 0 - TypingAction_TypingActionRecordingVoice TypingAction = 1 - TypingAction_TypingActionRecordingVideo TypingAction = 2 - TypingAction_TypingActionUploading TypingAction = 3 - TypingAction_TypingActionCancel TypingAction = 4 -) - -// Enum value maps for TypingAction. -var ( - TypingAction_name = map[int32]string{ - 0: "TypingActionTyping", - 1: "TypingActionRecordingVoice", - 2: "TypingActionRecordingVideo", - 3: "TypingActionUploading", - 4: "TypingActionCancel", - } - TypingAction_value = map[string]int32{ - "TypingActionTyping": 0, - "TypingActionRecordingVoice": 1, - "TypingActionRecordingVideo": 2, - "TypingActionUploading": 3, - "TypingActionCancel": 4, - } -) - -func (x TypingAction) Enum() *TypingAction { - p := new(TypingAction) - *p = x - return p -} - -func (x TypingAction) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (TypingAction) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[0].Descriptor() -} - -func (TypingAction) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[0] -} - -func (x TypingAction) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use TypingAction.Descriptor instead. -func (TypingAction) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{0} -} - -// PeerType -type PeerType int32 - -const ( - PeerType_PeerSelf PeerType = 0 - PeerType_PeerUser PeerType = 1 - PeerType_PeerGroup PeerType = 2 - PeerType_PeerExternalUser PeerType = 3 - PeerType_PeerChannel PeerType = 4 -) - -// Enum value maps for PeerType. -var ( - PeerType_name = map[int32]string{ - 0: "PeerSelf", - 1: "PeerUser", - 2: "PeerGroup", - 3: "PeerExternalUser", - 4: "PeerChannel", - } - PeerType_value = map[string]int32{ - "PeerSelf": 0, - "PeerUser": 1, - "PeerGroup": 2, - "PeerExternalUser": 3, - "PeerChannel": 4, - } -) - -func (x PeerType) Enum() *PeerType { - p := new(PeerType) - *p = x - return p -} - -func (x PeerType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PeerType) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[1].Descriptor() -} - -func (PeerType) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[1] -} - -func (x PeerType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PeerType.Descriptor instead. -func (PeerType) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{1} -} - -// UserStatus -type UserStatus int32 - -const ( - UserStatus_UserStatusOffline UserStatus = 0 - UserStatus_UserStatusOnline UserStatus = 1 - UserStatus_UserStatusRecently UserStatus = 2 - UserStatus_UserStatusLastWeek UserStatus = 3 - UserStatus_UserStatusLastMonth UserStatus = 4 -) - -// Enum value maps for UserStatus. -var ( - UserStatus_name = map[int32]string{ - 0: "UserStatusOffline", - 1: "UserStatusOnline", - 2: "UserStatusRecently", - 3: "UserStatusLastWeek", - 4: "UserStatusLastMonth", - } - UserStatus_value = map[string]int32{ - "UserStatusOffline": 0, - "UserStatusOnline": 1, - "UserStatusRecently": 2, - "UserStatusLastWeek": 3, - "UserStatusLastMonth": 4, - } -) - -func (x UserStatus) Enum() *UserStatus { - p := new(UserStatus) - *p = x - return p -} - -func (x UserStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (UserStatus) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[2].Descriptor() -} - -func (UserStatus) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[2] -} - -func (x UserStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use UserStatus.Descriptor instead. -func (UserStatus) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{2} -} - -// GroupFlags -type GroupFlags int32 - -const ( - GroupFlags_GroupFlagsEmpty GroupFlags = 0 - GroupFlags_GroupFlagsCreator GroupFlags = 1 - GroupFlags_GroupFlagsNonParticipant GroupFlags = 2 - GroupFlags_GroupFlagsAdmin GroupFlags = 3 - GroupFlags_GroupFlagsAdminsEnabled GroupFlags = 4 - GroupFlags_GroupFlagsDeactivated GroupFlags = 5 - GroupFlags_GroupFlagsAdminOnly GroupFlags = 6 - GroupFlags_GroupFlagsReserved1 GroupFlags = 7 - GroupFlags_GroupFlagsReserved2 GroupFlags = 8 - GroupFlags_GroupFlagsReserved3 GroupFlags = 9 - GroupFlags_GroupFlagsReserved4 GroupFlags = 10 -) - -// Enum value maps for GroupFlags. -var ( - GroupFlags_name = map[int32]string{ - 0: "GroupFlagsEmpty", - 1: "GroupFlagsCreator", - 2: "GroupFlagsNonParticipant", - 3: "GroupFlagsAdmin", - 4: "GroupFlagsAdminsEnabled", - 5: "GroupFlagsDeactivated", - 6: "GroupFlagsAdminOnly", - 7: "GroupFlagsReserved1", - 8: "GroupFlagsReserved2", - 9: "GroupFlagsReserved3", - 10: "GroupFlagsReserved4", - } - GroupFlags_value = map[string]int32{ - "GroupFlagsEmpty": 0, - "GroupFlagsCreator": 1, - "GroupFlagsNonParticipant": 2, - "GroupFlagsAdmin": 3, - "GroupFlagsAdminsEnabled": 4, - "GroupFlagsDeactivated": 5, - "GroupFlagsAdminOnly": 6, - "GroupFlagsReserved1": 7, - "GroupFlagsReserved2": 8, - "GroupFlagsReserved3": 9, - "GroupFlagsReserved4": 10, - } -) - -func (x GroupFlags) Enum() *GroupFlags { - p := new(GroupFlags) - *p = x - return p -} - -func (x GroupFlags) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (GroupFlags) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[3].Descriptor() -} - -func (GroupFlags) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[3] -} - -func (x GroupFlags) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use GroupFlags.Descriptor instead. -func (GroupFlags) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{3} -} - -// ParticipantType -type ParticipantType int32 - -const ( - ParticipantType_ParticipantTypeMember ParticipantType = 0 - ParticipantType_ParticipantTypeAdmin ParticipantType = 1 - ParticipantType_ParticipantTypeCreator ParticipantType = 2 -) - -// Enum value maps for ParticipantType. -var ( - ParticipantType_name = map[int32]string{ - 0: "ParticipantTypeMember", - 1: "ParticipantTypeAdmin", - 2: "ParticipantTypeCreator", - } - ParticipantType_value = map[string]int32{ - "ParticipantTypeMember": 0, - "ParticipantTypeAdmin": 1, - "ParticipantTypeCreator": 2, - } -) - -func (x ParticipantType) Enum() *ParticipantType { - p := new(ParticipantType) - *p = x - return p -} - -func (x ParticipantType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ParticipantType) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[4].Descriptor() -} - -func (ParticipantType) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[4] -} - -func (x ParticipantType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ParticipantType.Descriptor instead. -func (ParticipantType) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{4} -} - -// InputMediaType -type InputMediaType int32 - -const ( - InputMediaType_InputMediaTypeEmpty InputMediaType = 0 - InputMediaType_InputMediaTypeInvoice InputMediaType = 1 - InputMediaType_InputMediaTypePoll InputMediaType = 2 - InputMediaType_InputMediaTypeContact InputMediaType = 3 - InputMediaType_InputMediaTypeUploadedDocument InputMediaType = 4 - InputMediaType_InputMediaTypeDocument InputMediaType = 5 - InputMediaType_InputMediaTypeGeoLocation InputMediaType = 6 - InputMediaType_InputMediaTypeWebDocument InputMediaType = 7 - InputMediaType_InputMediaTypeSealed InputMediaType = 8 - InputMediaType_InputMediaTypeMessageDocument InputMediaType = 9 - InputMediaType_InputMediaTypeReserved4 InputMediaType = 10 - InputMediaType_InputMediaTypeReserved5 InputMediaType = 11 - InputMediaType_InputMediaTypeReserved6 InputMediaType = 12 - InputMediaType_InputMediaTypeReserved7 InputMediaType = 13 - InputMediaType_InputMediaTypeReserved8 InputMediaType = 14 -) - -// Enum value maps for InputMediaType. -var ( - InputMediaType_name = map[int32]string{ - 0: "InputMediaTypeEmpty", - 1: "InputMediaTypeInvoice", - 2: "InputMediaTypePoll", - 3: "InputMediaTypeContact", - 4: "InputMediaTypeUploadedDocument", - 5: "InputMediaTypeDocument", - 6: "InputMediaTypeGeoLocation", - 7: "InputMediaTypeWebDocument", - 8: "InputMediaTypeSealed", - 9: "InputMediaTypeMessageDocument", - 10: "InputMediaTypeReserved4", - 11: "InputMediaTypeReserved5", - 12: "InputMediaTypeReserved6", - 13: "InputMediaTypeReserved7", - 14: "InputMediaTypeReserved8", - } - InputMediaType_value = map[string]int32{ - "InputMediaTypeEmpty": 0, - "InputMediaTypeInvoice": 1, - "InputMediaTypePoll": 2, - "InputMediaTypeContact": 3, - "InputMediaTypeUploadedDocument": 4, - "InputMediaTypeDocument": 5, - "InputMediaTypeGeoLocation": 6, - "InputMediaTypeWebDocument": 7, - "InputMediaTypeSealed": 8, - "InputMediaTypeMessageDocument": 9, - "InputMediaTypeReserved4": 10, - "InputMediaTypeReserved5": 11, - "InputMediaTypeReserved6": 12, - "InputMediaTypeReserved7": 13, - "InputMediaTypeReserved8": 14, - } -) - -func (x InputMediaType) Enum() *InputMediaType { - p := new(InputMediaType) - *p = x - return p -} - -func (x InputMediaType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (InputMediaType) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[5].Descriptor() -} - -func (InputMediaType) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[5] -} - -func (x InputMediaType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use InputMediaType.Descriptor instead. -func (InputMediaType) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{5} -} - -// MediaType -type MediaType int32 - -const ( - MediaType_MediaTypeEmpty MediaType = 0 - MediaType_MediaTypePoll MediaType = 1 - MediaType_MediaTypeDocument MediaType = 2 - MediaType_MediaTypeContact MediaType = 3 - MediaType_MediaTypeGeoLocation MediaType = 4 - MediaType_MediaTypeInvoice MediaType = 5 - MediaType_MediaTypeWebDocument MediaType = 6 - MediaType_MediaTypeSealed MediaType = 7 - MediaType_MediaTypeReserved1 MediaType = 8 - MediaType_MediaTypeReserved2 MediaType = 9 - MediaType_MediaTypeReserved3 MediaType = 10 - MediaType_MediaTypeReserved4 MediaType = 11 - MediaType_MediaTypeReserved5 MediaType = 12 - MediaType_MediaTypeReserved6 MediaType = 13 -) - -// Enum value maps for MediaType. -var ( - MediaType_name = map[int32]string{ - 0: "MediaTypeEmpty", - 1: "MediaTypePoll", - 2: "MediaTypeDocument", - 3: "MediaTypeContact", - 4: "MediaTypeGeoLocation", - 5: "MediaTypeInvoice", - 6: "MediaTypeWebDocument", - 7: "MediaTypeSealed", - 8: "MediaTypeReserved1", - 9: "MediaTypeReserved2", - 10: "MediaTypeReserved3", - 11: "MediaTypeReserved4", - 12: "MediaTypeReserved5", - 13: "MediaTypeReserved6", - } - MediaType_value = map[string]int32{ - "MediaTypeEmpty": 0, - "MediaTypePoll": 1, - "MediaTypeDocument": 2, - "MediaTypeContact": 3, - "MediaTypeGeoLocation": 4, - "MediaTypeInvoice": 5, - "MediaTypeWebDocument": 6, - "MediaTypeSealed": 7, - "MediaTypeReserved1": 8, - "MediaTypeReserved2": 9, - "MediaTypeReserved3": 10, - "MediaTypeReserved4": 11, - "MediaTypeReserved5": 12, - "MediaTypeReserved6": 13, - } -) - -func (x MediaType) Enum() *MediaType { - p := new(MediaType) - *p = x - return p -} - -func (x MediaType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MediaType) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[6].Descriptor() -} - -func (MediaType) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[6] -} - -func (x MediaType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MediaType.Descriptor instead. -func (MediaType) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{6} -} - -// MediaCategory -type MediaCategory int32 - -const ( - MediaCategory_MediaCategoryNone MediaCategory = 0 - MediaCategory_MediaCategoryAudio MediaCategory = 1 - MediaCategory_MediaCategoryVoice MediaCategory = 2 - MediaCategory_MediaCategoryMedia MediaCategory = 3 - MediaCategory_MediaCategoryFile MediaCategory = 4 - MediaCategory_MediaCategoryGif MediaCategory = 5 - MediaCategory_MediaCategoryWeb MediaCategory = 6 - MediaCategory_MediaCategoryContact MediaCategory = 7 - MediaCategory_MediaCategoryLocation MediaCategory = 8 - MediaCategory_MediaCategoryPoll MediaCategory = 9 - MediaCategory_MediaCategoryReserved0 MediaCategory = 10 - MediaCategory_MediaCategoryReserved1 MediaCategory = 11 - MediaCategory_MediaCategoryReserved2 MediaCategory = 12 - MediaCategory_MediaCategoryReserved3 MediaCategory = 13 - MediaCategory_MediaCategoryReserved4 MediaCategory = 14 - MediaCategory_MediaCategoryReserved5 MediaCategory = 15 -) - -// Enum value maps for MediaCategory. -var ( - MediaCategory_name = map[int32]string{ - 0: "MediaCategoryNone", - 1: "MediaCategoryAudio", - 2: "MediaCategoryVoice", - 3: "MediaCategoryMedia", - 4: "MediaCategoryFile", - 5: "MediaCategoryGif", - 6: "MediaCategoryWeb", - 7: "MediaCategoryContact", - 8: "MediaCategoryLocation", - 9: "MediaCategoryPoll", - 10: "MediaCategoryReserved0", - 11: "MediaCategoryReserved1", - 12: "MediaCategoryReserved2", - 13: "MediaCategoryReserved3", - 14: "MediaCategoryReserved4", - 15: "MediaCategoryReserved5", - } - MediaCategory_value = map[string]int32{ - "MediaCategoryNone": 0, - "MediaCategoryAudio": 1, - "MediaCategoryVoice": 2, - "MediaCategoryMedia": 3, - "MediaCategoryFile": 4, - "MediaCategoryGif": 5, - "MediaCategoryWeb": 6, - "MediaCategoryContact": 7, - "MediaCategoryLocation": 8, - "MediaCategoryPoll": 9, - "MediaCategoryReserved0": 10, - "MediaCategoryReserved1": 11, - "MediaCategoryReserved2": 12, - "MediaCategoryReserved3": 13, - "MediaCategoryReserved4": 14, - "MediaCategoryReserved5": 15, - } -) - -func (x MediaCategory) Enum() *MediaCategory { - p := new(MediaCategory) - *p = x - return p -} - -func (x MediaCategory) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MediaCategory) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[7].Descriptor() -} - -func (MediaCategory) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[7] -} - -func (x MediaCategory) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MediaCategory.Descriptor instead. -func (MediaCategory) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{7} -} - -// MessageEntityType -type MessageEntityType int32 - -const ( - MessageEntityType_MessageEntityTypeBold MessageEntityType = 0 - MessageEntityType_MessageEntityTypeItalic MessageEntityType = 1 - MessageEntityType_MessageEntityTypeMention MessageEntityType = 2 - MessageEntityType_MessageEntityTypeUrl MessageEntityType = 3 - MessageEntityType_MessageEntityTypeEmail MessageEntityType = 4 - MessageEntityType_MessageEntityTypeHashTag MessageEntityType = 5 - MessageEntityType_MessageEntityTypeCode MessageEntityType = 6 - MessageEntityType_MessageEntityTypeBotCommand MessageEntityType = 7 - MessageEntityType_MessageEntityTypeMentionAll MessageEntityType = 8 - MessageEntityType_MessageEntityTypeReserved4 MessageEntityType = 9 - MessageEntityType_MessageEntityTypeReserved5 MessageEntityType = 10 - MessageEntityType_MessageEntityTypeReserved6 MessageEntityType = 11 - MessageEntityType_MessageEntityTypeReserved7 MessageEntityType = 12 - MessageEntityType_MessageEntityTypeReserved8 MessageEntityType = 13 -) - -// Enum value maps for MessageEntityType. -var ( - MessageEntityType_name = map[int32]string{ - 0: "MessageEntityTypeBold", - 1: "MessageEntityTypeItalic", - 2: "MessageEntityTypeMention", - 3: "MessageEntityTypeUrl", - 4: "MessageEntityTypeEmail", - 5: "MessageEntityTypeHashTag", - 6: "MessageEntityTypeCode", - 7: "MessageEntityTypeBotCommand", - 8: "MessageEntityTypeMentionAll", - 9: "MessageEntityTypeReserved4", - 10: "MessageEntityTypeReserved5", - 11: "MessageEntityTypeReserved6", - 12: "MessageEntityTypeReserved7", - 13: "MessageEntityTypeReserved8", - } - MessageEntityType_value = map[string]int32{ - "MessageEntityTypeBold": 0, - "MessageEntityTypeItalic": 1, - "MessageEntityTypeMention": 2, - "MessageEntityTypeUrl": 3, - "MessageEntityTypeEmail": 4, - "MessageEntityTypeHashTag": 5, - "MessageEntityTypeCode": 6, - "MessageEntityTypeBotCommand": 7, - "MessageEntityTypeMentionAll": 8, - "MessageEntityTypeReserved4": 9, - "MessageEntityTypeReserved5": 10, - "MessageEntityTypeReserved6": 11, - "MessageEntityTypeReserved7": 12, - "MessageEntityTypeReserved8": 13, - } -) - -func (x MessageEntityType) Enum() *MessageEntityType { - p := new(MessageEntityType) - *p = x - return p -} - -func (x MessageEntityType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MessageEntityType) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[8].Descriptor() -} - -func (MessageEntityType) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[8] -} - -func (x MessageEntityType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MessageEntityType.Descriptor instead. -func (MessageEntityType) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{8} -} - -// NotificationType -type PushTokenProvider int32 - -const ( - PushTokenProvider_PushTokenFirebase PushTokenProvider = 0 - PushTokenProvider_PushTokenApn PushTokenProvider = 1 - PushTokenProvider_PushTokenPushKit PushTokenProvider = 2 -) - -// Enum value maps for PushTokenProvider. -var ( - PushTokenProvider_name = map[int32]string{ - 0: "PushTokenFirebase", - 1: "PushTokenApn", - 2: "PushTokenPushKit", - } - PushTokenProvider_value = map[string]int32{ - "PushTokenFirebase": 0, - "PushTokenApn": 1, - "PushTokenPushKit": 2, - } -) - -func (x PushTokenProvider) Enum() *PushTokenProvider { - p := new(PushTokenProvider) - *p = x - return p -} - -func (x PushTokenProvider) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PushTokenProvider) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[9].Descriptor() -} - -func (PushTokenProvider) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[9] -} - -func (x PushTokenProvider) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PushTokenProvider.Descriptor instead. -func (PushTokenProvider) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{9} -} - -// AccountPrivacyKey -type PrivacyKey int32 - -const ( - PrivacyKey_PrivacyKeyNone PrivacyKey = 0 - PrivacyKey_PrivacyKeyChatInvite PrivacyKey = 1 - PrivacyKey_PrivacyKeyLastSeen PrivacyKey = 2 - PrivacyKey_PrivacyKeyPhoneNumber PrivacyKey = 3 - PrivacyKey_PrivacyKeyProfilePhoto PrivacyKey = 4 - PrivacyKey_PrivacyKeyForwardedMessage PrivacyKey = 5 - PrivacyKey_PrivacyKeyCall PrivacyKey = 6 - PrivacyKey_PrivacyKeyReserved1 PrivacyKey = 7 - PrivacyKey_PrivacyKeyReserved2 PrivacyKey = 8 - PrivacyKey_PrivacyKeyReserved3 PrivacyKey = 9 - PrivacyKey_PrivacyKeyReserved4 PrivacyKey = 10 - PrivacyKey_PrivacyKeyReserved5 PrivacyKey = 11 - PrivacyKey_PrivacyKeyReserved6 PrivacyKey = 12 -) - -// Enum value maps for PrivacyKey. -var ( - PrivacyKey_name = map[int32]string{ - 0: "PrivacyKeyNone", - 1: "PrivacyKeyChatInvite", - 2: "PrivacyKeyLastSeen", - 3: "PrivacyKeyPhoneNumber", - 4: "PrivacyKeyProfilePhoto", - 5: "PrivacyKeyForwardedMessage", - 6: "PrivacyKeyCall", - 7: "PrivacyKeyReserved1", - 8: "PrivacyKeyReserved2", - 9: "PrivacyKeyReserved3", - 10: "PrivacyKeyReserved4", - 11: "PrivacyKeyReserved5", - 12: "PrivacyKeyReserved6", - } - PrivacyKey_value = map[string]int32{ - "PrivacyKeyNone": 0, - "PrivacyKeyChatInvite": 1, - "PrivacyKeyLastSeen": 2, - "PrivacyKeyPhoneNumber": 3, - "PrivacyKeyProfilePhoto": 4, - "PrivacyKeyForwardedMessage": 5, - "PrivacyKeyCall": 6, - "PrivacyKeyReserved1": 7, - "PrivacyKeyReserved2": 8, - "PrivacyKeyReserved3": 9, - "PrivacyKeyReserved4": 10, - "PrivacyKeyReserved5": 11, - "PrivacyKeyReserved6": 12, - } -) - -func (x PrivacyKey) Enum() *PrivacyKey { - p := new(PrivacyKey) - *p = x - return p -} - -func (x PrivacyKey) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PrivacyKey) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[10].Descriptor() -} - -func (PrivacyKey) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[10] -} - -func (x PrivacyKey) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PrivacyKey.Descriptor instead. -func (PrivacyKey) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{10} -} - -// AccountPrivacyValue -type PrivacyType int32 - -const ( - PrivacyType_PrivacyTypeAllowAll PrivacyType = 0 - PrivacyType_PrivacyTypeAllowContacts PrivacyType = 1 - PrivacyType_PrivacyTypeDisallowAll PrivacyType = 2 - // Order is very important, exceptions are started from 101 - PrivacyType_PrivacyTypeAllowUsers PrivacyType = 101 - PrivacyType_PrivacyTypeDisallowUsers PrivacyType = 102 -) - -// Enum value maps for PrivacyType. -var ( - PrivacyType_name = map[int32]string{ - 0: "PrivacyTypeAllowAll", - 1: "PrivacyTypeAllowContacts", - 2: "PrivacyTypeDisallowAll", - 101: "PrivacyTypeAllowUsers", - 102: "PrivacyTypeDisallowUsers", - } - PrivacyType_value = map[string]int32{ - "PrivacyTypeAllowAll": 0, - "PrivacyTypeAllowContacts": 1, - "PrivacyTypeDisallowAll": 2, - "PrivacyTypeAllowUsers": 101, - "PrivacyTypeDisallowUsers": 102, - } -) - -func (x PrivacyType) Enum() *PrivacyType { - p := new(PrivacyType) - *p = x - return p -} - -func (x PrivacyType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (PrivacyType) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[11].Descriptor() -} - -func (PrivacyType) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[11] -} - -func (x PrivacyType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use PrivacyType.Descriptor instead. -func (PrivacyType) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{11} -} - -// TeamFlags -type TeamFlags int32 - -const ( - TeamFlags_TeamFlagsEmpty TeamFlags = 0 - TeamFlags_TeamFlagsCreator TeamFlags = 1 - TeamFlags_TeamFlagsAdmin TeamFlags = 2 - TeamFlags_TeamFlagsReserved1 TeamFlags = 3 - TeamFlags_TeamFlagsReserved2 TeamFlags = 4 - TeamFlags_TeamFlagsReserved3 TeamFlags = 5 - TeamFlags_TeamFlagsReserved4 TeamFlags = 6 - TeamFlags_TeamFlagsReserved5 TeamFlags = 7 -) - -// Enum value maps for TeamFlags. -var ( - TeamFlags_name = map[int32]string{ - 0: "TeamFlagsEmpty", - 1: "TeamFlagsCreator", - 2: "TeamFlagsAdmin", - 3: "TeamFlagsReserved1", - 4: "TeamFlagsReserved2", - 5: "TeamFlagsReserved3", - 6: "TeamFlagsReserved4", - 7: "TeamFlagsReserved5", - } - TeamFlags_value = map[string]int32{ - "TeamFlagsEmpty": 0, - "TeamFlagsCreator": 1, - "TeamFlagsAdmin": 2, - "TeamFlagsReserved1": 3, - "TeamFlagsReserved2": 4, - "TeamFlagsReserved3": 5, - "TeamFlagsReserved4": 6, - "TeamFlagsReserved5": 7, - } -) - -func (x TeamFlags) Enum() *TeamFlags { - p := new(TeamFlags) - *p = x - return p -} - -func (x TeamFlags) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (TeamFlags) Descriptor() protoreflect.EnumDescriptor { - return file_core_types_proto_enumTypes[12].Descriptor() -} - -func (TeamFlags) Type() protoreflect.EnumType { - return &file_core_types_proto_enumTypes[12] -} - -func (x TeamFlags) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use TeamFlags.Descriptor instead. -func (TeamFlags) EnumDescriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{12} -} - -// Ping -type Ping struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` -} - -func (x *Ping) Reset() { - *x = Ping{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Ping) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Ping) ProtoMessage() {} - -func (x *Ping) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Ping.ProtoReflect.Descriptor instead. -func (*Ping) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{0} -} - -func (x *Ping) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -// Pong -type Pong struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` -} - -func (x *Pong) Reset() { - *x = Pong{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Pong) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Pong) ProtoMessage() {} - -func (x *Pong) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Pong.ProtoReflect.Descriptor instead. -func (*Pong) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{1} -} - -func (x *Pong) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -// UpdateEnvelope -type UpdateEnvelope struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Constructor int64 `protobuf:"varint,1,opt,name=Constructor,proto3" json:"Constructor,omitempty"` - Update []byte `protobuf:"bytes,2,opt,name=Update,proto3" json:"Update,omitempty"` - UCount int32 `protobuf:"varint,3,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,4,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Timestamp int64 `protobuf:"varint,5,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` - Deadline int64 `protobuf:"varint,6,opt,name=Deadline,proto3" json:"Deadline,omitempty"` -} - -func (x *UpdateEnvelope) Reset() { - *x = UpdateEnvelope{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateEnvelope) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateEnvelope) ProtoMessage() {} - -func (x *UpdateEnvelope) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateEnvelope.ProtoReflect.Descriptor instead. -func (*UpdateEnvelope) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{2} -} - -func (x *UpdateEnvelope) GetConstructor() int64 { - if x != nil { - return x.Constructor - } - return 0 -} - -func (x *UpdateEnvelope) GetUpdate() []byte { - if x != nil { - return x.Update - } - return nil -} - -func (x *UpdateEnvelope) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateEnvelope) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateEnvelope) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *UpdateEnvelope) GetDeadline() int64 { - if x != nil { - return x.Deadline - } - return 0 -} - -// UpdateContainer -// It is very similar to MessageContainer but holding a list of Updates -type UpdateContainer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Length int32 `protobuf:"varint,1,opt,name=Length,proto3" json:"Length,omitempty"` - Updates []*UpdateEnvelope `protobuf:"bytes,2,rep,name=Updates,proto3" json:"Updates,omitempty"` - MinUpdateID int64 `protobuf:"varint,3,opt,name=MinUpdateID,proto3" json:"MinUpdateID,omitempty"` - MaxUpdateID int64 `protobuf:"varint,4,opt,name=MaxUpdateID,proto3" json:"MaxUpdateID,omitempty"` - Users []*User `protobuf:"bytes,5,rep,name=Users,proto3" json:"Users,omitempty"` - Groups []*Group `protobuf:"bytes,6,rep,name=Groups,proto3" json:"Groups,omitempty"` -} - -func (x *UpdateContainer) Reset() { - *x = UpdateContainer{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateContainer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateContainer) ProtoMessage() {} - -func (x *UpdateContainer) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateContainer.ProtoReflect.Descriptor instead. -func (*UpdateContainer) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{3} -} - -func (x *UpdateContainer) GetLength() int32 { - if x != nil { - return x.Length - } - return 0 -} - -func (x *UpdateContainer) GetUpdates() []*UpdateEnvelope { - if x != nil { - return x.Updates - } - return nil -} - -func (x *UpdateContainer) GetMinUpdateID() int64 { - if x != nil { - return x.MinUpdateID - } - return 0 -} - -func (x *UpdateContainer) GetMaxUpdateID() int64 { - if x != nil { - return x.MaxUpdateID - } - return 0 -} - -func (x *UpdateContainer) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *UpdateContainer) GetGroups() []*Group { - if x != nil { - return x.Groups - } - return nil -} - -// ProtoMessage -// If AuthID == 0 then Payload is a MessageEnvelop otherwise Payload is a ProtoEncryptedPayload -type ProtoMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AuthID int64 `protobuf:"varint,1,opt,name=AuthID,proto3" json:"AuthID,omitempty"` - MessageKey []byte `protobuf:"bytes,2,opt,name=MessageKey,proto3" json:"MessageKey,omitempty"` // 32 bytes - Payload []byte `protobuf:"bytes,3,opt,name=Payload,proto3" json:"Payload,omitempty"` -} - -func (x *ProtoMessage) Reset() { - *x = ProtoMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ProtoMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProtoMessage) ProtoMessage() {} - -func (x *ProtoMessage) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProtoMessage.ProtoReflect.Descriptor instead. -func (*ProtoMessage) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{4} -} - -func (x *ProtoMessage) GetAuthID() int64 { - if x != nil { - return x.AuthID - } - return 0 -} - -func (x *ProtoMessage) GetMessageKey() []byte { - if x != nil { - return x.MessageKey - } - return nil -} - -func (x *ProtoMessage) GetPayload() []byte { - if x != nil { - return x.Payload - } - return nil -} - -// ProtoMessageEncryptedPayload -type ProtoEncryptedPayload struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServerSalt int64 `protobuf:"varint,1,opt,name=ServerSalt,proto3" json:"ServerSalt,omitempty"` - MessageID uint64 `protobuf:"varint,2,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - SessionID int64 `protobuf:"varint,3,opt,name=SessionID,proto3" json:"SessionID,omitempty"` - Envelope *rony.MessageEnvelope `protobuf:"bytes,4,opt,name=Envelope,proto3" json:"Envelope,omitempty"` -} - -func (x *ProtoEncryptedPayload) Reset() { - *x = ProtoEncryptedPayload{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ProtoEncryptedPayload) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProtoEncryptedPayload) ProtoMessage() {} - -func (x *ProtoEncryptedPayload) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ProtoEncryptedPayload.ProtoReflect.Descriptor instead. -func (*ProtoEncryptedPayload) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{5} -} - -func (x *ProtoEncryptedPayload) GetServerSalt() int64 { - if x != nil { - return x.ServerSalt - } - return 0 -} - -func (x *ProtoEncryptedPayload) GetMessageID() uint64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *ProtoEncryptedPayload) GetSessionID() int64 { - if x != nil { - return x.SessionID - } - return 0 -} - -func (x *ProtoEncryptedPayload) GetEnvelope() *rony.MessageEnvelope { - if x != nil { - return x.Envelope - } - return nil -} - -// Ack -type Ack struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - MessageIDs []uint64 `protobuf:"varint,1,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` -} - -func (x *Ack) Reset() { - *x = Ack{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Ack) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Ack) ProtoMessage() {} - -func (x *Ack) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Ack.ProtoReflect.Descriptor instead. -func (*Ack) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{6} -} - -func (x *Ack) GetMessageIDs() []uint64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -// Bool -type Bool struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Result bool `protobuf:"varint,1,opt,name=Result,proto3" json:"Result,omitempty"` -} - -func (x *Bool) Reset() { - *x = Bool{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Bool) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Bool) ProtoMessage() {} - -func (x *Bool) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Bool.ProtoReflect.Descriptor instead. -func (*Bool) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{7} -} - -func (x *Bool) GetResult() bool { - if x != nil { - return x.Result - } - return false -} - -// Dialog -type Dialog struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,100,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - PeerID int64 `protobuf:"varint,1,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,2,opt,name=PeerType,proto3" json:"PeerType,omitempty"` - TopMessageID int64 `protobuf:"varint,3,opt,name=TopMessageID,proto3" json:"TopMessageID,omitempty"` - ReadInboxMaxID int64 `protobuf:"varint,4,opt,name=ReadInboxMaxID,proto3" json:"ReadInboxMaxID,omitempty"` - ReadOutboxMaxID int64 `protobuf:"varint,5,opt,name=ReadOutboxMaxID,proto3" json:"ReadOutboxMaxID,omitempty"` - UnreadCount int32 `protobuf:"varint,6,opt,name=UnreadCount,proto3" json:"UnreadCount,omitempty"` - AccessHash uint64 `protobuf:"fixed64,7,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - NotifySettings *PeerNotifySettings `protobuf:"bytes,8,opt,name=NotifySettings,proto3" json:"NotifySettings,omitempty"` - MentionedCount int32 `protobuf:"varint,9,opt,name=MentionedCount,proto3" json:"MentionedCount,omitempty"` - Pinned bool `protobuf:"varint,10,opt,name=Pinned,proto3" json:"Pinned,omitempty"` - Draft *DraftMessage `protobuf:"bytes,11,opt,name=Draft,proto3" json:"Draft,omitempty"` - PinnedMessageID int64 `protobuf:"varint,12,opt,name=PinnedMessageID,proto3" json:"PinnedMessageID,omitempty"` - ActiveCallID int64 `protobuf:"varint,13,opt,name=ActiveCallID,proto3" json:"ActiveCallID,omitempty"` - ReadOnly bool `protobuf:"varint,14,opt,name=ReadOnly,proto3" json:"ReadOnly,omitempty"` -} - -func (x *Dialog) Reset() { - *x = Dialog{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Dialog) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Dialog) ProtoMessage() {} - -func (x *Dialog) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Dialog.ProtoReflect.Descriptor instead. -func (*Dialog) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{8} -} - -func (x *Dialog) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *Dialog) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *Dialog) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -func (x *Dialog) GetTopMessageID() int64 { - if x != nil { - return x.TopMessageID - } - return 0 -} - -func (x *Dialog) GetReadInboxMaxID() int64 { - if x != nil { - return x.ReadInboxMaxID - } - return 0 -} - -func (x *Dialog) GetReadOutboxMaxID() int64 { - if x != nil { - return x.ReadOutboxMaxID - } - return 0 -} - -func (x *Dialog) GetUnreadCount() int32 { - if x != nil { - return x.UnreadCount - } - return 0 -} - -func (x *Dialog) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *Dialog) GetNotifySettings() *PeerNotifySettings { - if x != nil { - return x.NotifySettings - } - return nil -} - -func (x *Dialog) GetMentionedCount() int32 { - if x != nil { - return x.MentionedCount - } - return 0 -} - -func (x *Dialog) GetPinned() bool { - if x != nil { - return x.Pinned - } - return false -} - -func (x *Dialog) GetDraft() *DraftMessage { - if x != nil { - return x.Draft - } - return nil -} - -func (x *Dialog) GetPinnedMessageID() int64 { - if x != nil { - return x.PinnedMessageID - } - return 0 -} - -func (x *Dialog) GetActiveCallID() int64 { - if x != nil { - return x.ActiveCallID - } - return 0 -} - -func (x *Dialog) GetReadOnly() bool { - if x != nil { - return x.ReadOnly - } - return false -} - -// InputPeer -type InputPeer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Type PeerType `protobuf:"varint,2,opt,name=Type,proto3,enum=msg.PeerType" json:"Type,omitempty"` - AccessHash uint64 `protobuf:"fixed64,3,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` -} - -func (x *InputPeer) Reset() { - *x = InputPeer{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputPeer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputPeer) ProtoMessage() {} - -func (x *InputPeer) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputPeer.ProtoReflect.Descriptor instead. -func (*InputPeer) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{9} -} - -func (x *InputPeer) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *InputPeer) GetType() PeerType { - if x != nil { - return x.Type - } - return PeerType_PeerSelf -} - -func (x *InputPeer) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -// Peer -type Peer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Type int32 `protobuf:"varint,2,opt,name=Type,proto3" json:"Type,omitempty"` - AccessHash uint64 `protobuf:"fixed64,3,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` -} - -func (x *Peer) Reset() { - *x = Peer{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Peer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Peer) ProtoMessage() {} - -func (x *Peer) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Peer.ProtoReflect.Descriptor instead. -func (*Peer) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{10} -} - -func (x *Peer) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *Peer) GetType() int32 { - if x != nil { - return x.Type - } - return 0 -} - -func (x *Peer) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -// InputPassword -type InputPassword struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - SrpID int64 `protobuf:"varint,1,opt,name=SrpID,proto3" json:"SrpID,omitempty"` - A []byte `protobuf:"bytes,2,opt,name=A,proto3" json:"A,omitempty"` - M1 []byte `protobuf:"bytes,3,opt,name=M1,proto3" json:"M1,omitempty"` -} - -func (x *InputPassword) Reset() { - *x = InputPassword{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputPassword) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputPassword) ProtoMessage() {} - -func (x *InputPassword) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputPassword.ProtoReflect.Descriptor instead. -func (*InputPassword) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{11} -} - -func (x *InputPassword) GetSrpID() int64 { - if x != nil { - return x.SrpID - } - return 0 -} - -func (x *InputPassword) GetA() []byte { - if x != nil { - return x.A - } - return nil -} - -func (x *InputPassword) GetM1() []byte { - if x != nil { - return x.M1 - } - return nil -} - -// InputFileLocation -type InputFileLocation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClusterID int32 `protobuf:"varint,1,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"` - FileID int64 `protobuf:"varint,2,opt,name=FileID,proto3" json:"FileID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,3,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Version int32 `protobuf:"varint,4,opt,name=Version,proto3" json:"Version,omitempty"` -} - -func (x *InputFileLocation) Reset() { - *x = InputFileLocation{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputFileLocation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputFileLocation) ProtoMessage() {} - -func (x *InputFileLocation) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputFileLocation.ProtoReflect.Descriptor instead. -func (*InputFileLocation) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{12} -} - -func (x *InputFileLocation) GetClusterID() int32 { - if x != nil { - return x.ClusterID - } - return 0 -} - -func (x *InputFileLocation) GetFileID() int64 { - if x != nil { - return x.FileID - } - return 0 -} - -func (x *InputFileLocation) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *InputFileLocation) GetVersion() int32 { - if x != nil { - return x.Version - } - return 0 -} - -// FileLocation -type FileLocation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClusterID int32 `protobuf:"varint,1,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"` - FileID int64 `protobuf:"varint,2,opt,name=FileID,proto3" json:"FileID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,3,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` -} - -func (x *FileLocation) Reset() { - *x = FileLocation{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileLocation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileLocation) ProtoMessage() {} - -func (x *FileLocation) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileLocation.ProtoReflect.Descriptor instead. -func (*FileLocation) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{13} -} - -func (x *FileLocation) GetClusterID() int32 { - if x != nil { - return x.ClusterID - } - return 0 -} - -func (x *FileLocation) GetFileID() int64 { - if x != nil { - return x.FileID - } - return 0 -} - -func (x *FileLocation) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -// WebLocation -type WebLocation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=Url,proto3" json:"Url,omitempty"` -} - -func (x *WebLocation) Reset() { - *x = WebLocation{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WebLocation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WebLocation) ProtoMessage() {} - -func (x *WebLocation) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use WebLocation.ProtoReflect.Descriptor instead. -func (*WebLocation) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{14} -} - -func (x *WebLocation) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -// InputWebLocation -type InputWebLocation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=Url,proto3" json:"Url,omitempty"` -} - -func (x *InputWebLocation) Reset() { - *x = InputWebLocation{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputWebLocation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputWebLocation) ProtoMessage() {} - -func (x *InputWebLocation) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputWebLocation.ProtoReflect.Descriptor instead. -func (*InputWebLocation) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{15} -} - -func (x *InputWebLocation) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -// UserPhoto -type UserPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PhotoBig *FileLocation `protobuf:"bytes,1,opt,name=PhotoBig,proto3" json:"PhotoBig,omitempty"` - PhotoSmall *FileLocation `protobuf:"bytes,2,opt,name=PhotoSmall,proto3" json:"PhotoSmall,omitempty"` - PhotoID int64 `protobuf:"varint,3,opt,name=PhotoID,proto3" json:"PhotoID,omitempty"` - PhotoBigWeb *WebLocation `protobuf:"bytes,4,opt,name=PhotoBigWeb,proto3" json:"PhotoBigWeb,omitempty"` - PhotoSmallWeb *WebLocation `protobuf:"bytes,5,opt,name=PhotoSmallWeb,proto3" json:"PhotoSmallWeb,omitempty"` -} - -func (x *UserPhoto) Reset() { - *x = UserPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UserPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserPhoto) ProtoMessage() {} - -func (x *UserPhoto) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UserPhoto.ProtoReflect.Descriptor instead. -func (*UserPhoto) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{16} -} - -func (x *UserPhoto) GetPhotoBig() *FileLocation { - if x != nil { - return x.PhotoBig - } - return nil -} - -func (x *UserPhoto) GetPhotoSmall() *FileLocation { - if x != nil { - return x.PhotoSmall - } - return nil -} - -func (x *UserPhoto) GetPhotoID() int64 { - if x != nil { - return x.PhotoID - } - return 0 -} - -func (x *UserPhoto) GetPhotoBigWeb() *WebLocation { - if x != nil { - return x.PhotoBigWeb - } - return nil -} - -func (x *UserPhoto) GetPhotoSmallWeb() *WebLocation { - if x != nil { - return x.PhotoSmallWeb - } - return nil -} - -// InputUser -type InputUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,2,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` -} - -func (x *InputUser) Reset() { - *x = InputUser{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputUser) ProtoMessage() {} - -func (x *InputUser) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputUser.ProtoReflect.Descriptor instead. -func (*InputUser) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{17} -} - -func (x *InputUser) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *InputUser) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -// User -type User struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - Username string `protobuf:"bytes,4,opt,name=Username,proto3" json:"Username,omitempty"` - Status UserStatus `protobuf:"varint,5,opt,name=Status,proto3,enum=msg.UserStatus" json:"Status,omitempty"` - Restricted bool `protobuf:"varint,6,opt,name=Restricted,proto3" json:"Restricted,omitempty"` - AccessHash uint64 `protobuf:"fixed64,7,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Photo *UserPhoto `protobuf:"bytes,8,opt,name=Photo,proto3" json:"Photo,omitempty"` - Bio string `protobuf:"bytes,9,opt,name=Bio,proto3" json:"Bio,omitempty"` - Phone string `protobuf:"bytes,10,opt,name=Phone,proto3" json:"Phone,omitempty"` - LastSeen int64 `protobuf:"varint,11,opt,name=LastSeen,proto3" json:"LastSeen,omitempty"` - PhotoGallery []*UserPhoto `protobuf:"bytes,12,rep,name=PhotoGallery,proto3" json:"PhotoGallery,omitempty"` - IsBot bool `protobuf:"varint,13,opt,name=IsBot,proto3" json:"IsBot,omitempty"` - Deleted bool `protobuf:"varint,14,opt,name=Deleted,proto3" json:"Deleted,omitempty"` - Blocked bool `protobuf:"varint,15,opt,name=Blocked,proto3" json:"Blocked,omitempty"` - BotInfo *BotInfo `protobuf:"bytes,16,opt,name=BotInfo,proto3" json:"BotInfo,omitempty"` - Official bool `protobuf:"varint,17,opt,name=Official,proto3" json:"Official,omitempty"` -} - -func (x *User) Reset() { - *x = User{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *User) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*User) ProtoMessage() {} - -func (x *User) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use User.ProtoReflect.Descriptor instead. -func (*User) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{18} -} - -func (x *User) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *User) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *User) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *User) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *User) GetStatus() UserStatus { - if x != nil { - return x.Status - } - return UserStatus_UserStatusOffline -} - -func (x *User) GetRestricted() bool { - if x != nil { - return x.Restricted - } - return false -} - -func (x *User) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *User) GetPhoto() *UserPhoto { - if x != nil { - return x.Photo - } - return nil -} - -func (x *User) GetBio() string { - if x != nil { - return x.Bio - } - return "" -} - -func (x *User) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *User) GetLastSeen() int64 { - if x != nil { - return x.LastSeen - } - return 0 -} - -func (x *User) GetPhotoGallery() []*UserPhoto { - if x != nil { - return x.PhotoGallery - } - return nil -} - -func (x *User) GetIsBot() bool { - if x != nil { - return x.IsBot - } - return false -} - -func (x *User) GetDeleted() bool { - if x != nil { - return x.Deleted - } - return false -} - -func (x *User) GetBlocked() bool { - if x != nil { - return x.Blocked - } - return false -} - -func (x *User) GetBotInfo() *BotInfo { - if x != nil { - return x.BotInfo - } - return nil -} - -func (x *User) GetOfficial() bool { - if x != nil { - return x.Official - } - return false -} - -// ContactUser -type ContactUser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - AccessHash uint64 `protobuf:"fixed64,4,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Phone string `protobuf:"bytes,5,opt,name=Phone,proto3" json:"Phone,omitempty"` - Username string `protobuf:"bytes,6,opt,name=Username,proto3" json:"Username,omitempty"` - ClientID int64 `protobuf:"varint,7,opt,name=ClientID,proto3" json:"ClientID,omitempty"` - Photo *UserPhoto `protobuf:"bytes,8,opt,name=Photo,proto3" json:"Photo,omitempty"` -} - -func (x *ContactUser) Reset() { - *x = ContactUser{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ContactUser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ContactUser) ProtoMessage() {} - -func (x *ContactUser) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ContactUser.ProtoReflect.Descriptor instead. -func (*ContactUser) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{19} -} - -func (x *ContactUser) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *ContactUser) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *ContactUser) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *ContactUser) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *ContactUser) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -func (x *ContactUser) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *ContactUser) GetClientID() int64 { - if x != nil { - return x.ClientID - } - return 0 -} - -func (x *ContactUser) GetPhoto() *UserPhoto { - if x != nil { - return x.Photo - } - return nil -} - -// Bot -type Bot struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Username string `protobuf:"bytes,3,opt,name=Username,proto3" json:"Username,omitempty"` - Bio string `protobuf:"bytes,4,opt,name=Bio,proto3" json:"Bio,omitempty"` -} - -func (x *Bot) Reset() { - *x = Bot{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Bot) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Bot) ProtoMessage() {} - -func (x *Bot) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Bot.ProtoReflect.Descriptor instead. -func (*Bot) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{20} -} - -func (x *Bot) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *Bot) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Bot) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *Bot) GetBio() string { - if x != nil { - return x.Bio - } - return "" -} - -// BotCommands -type BotCommands struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Command string `protobuf:"bytes,1,opt,name=Command,proto3" json:"Command,omitempty"` - Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty"` -} - -func (x *BotCommands) Reset() { - *x = BotCommands{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotCommands) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotCommands) ProtoMessage() {} - -func (x *BotCommands) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotCommands.ProtoReflect.Descriptor instead. -func (*BotCommands) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{21} -} - -func (x *BotCommands) GetCommand() string { - if x != nil { - return x.Command - } - return "" -} - -func (x *BotCommands) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -// BotInfo -type BotInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Bot *Bot `protobuf:"bytes,1,opt,name=Bot,proto3" json:"Bot,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - Description string `protobuf:"bytes,3,opt,name=Description,proto3" json:"Description,omitempty"` - BotCommands []*BotCommands `protobuf:"bytes,4,rep,name=BotCommands,proto3" json:"BotCommands,omitempty"` - InlineGeo bool `protobuf:"varint,5,opt,name=InlineGeo,proto3" json:"InlineGeo,omitempty"` - InlinePlaceHolder string `protobuf:"bytes,6,opt,name=InlinePlaceHolder,proto3" json:"InlinePlaceHolder,omitempty"` - InlineQuery bool `protobuf:"varint,7,opt,name=InlineQuery,proto3" json:"InlineQuery,omitempty"` -} - -func (x *BotInfo) Reset() { - *x = BotInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *BotInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BotInfo) ProtoMessage() {} - -func (x *BotInfo) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BotInfo.ProtoReflect.Descriptor instead. -func (*BotInfo) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{22} -} - -func (x *BotInfo) GetBot() *Bot { - if x != nil { - return x.Bot - } - return nil -} - -func (x *BotInfo) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *BotInfo) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *BotInfo) GetBotCommands() []*BotCommands { - if x != nil { - return x.BotCommands - } - return nil -} - -func (x *BotInfo) GetInlineGeo() bool { - if x != nil { - return x.InlineGeo - } - return false -} - -func (x *BotInfo) GetInlinePlaceHolder() string { - if x != nil { - return x.InlinePlaceHolder - } - return "" -} - -func (x *BotInfo) GetInlineQuery() bool { - if x != nil { - return x.InlineQuery - } - return false -} - -// GroupPhoto -type GroupPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PhotoBig *FileLocation `protobuf:"bytes,1,opt,name=PhotoBig,proto3" json:"PhotoBig,omitempty"` - PhotoSmall *FileLocation `protobuf:"bytes,2,opt,name=PhotoSmall,proto3" json:"PhotoSmall,omitempty"` - PhotoID int64 `protobuf:"varint,3,opt,name=PhotoID,proto3" json:"PhotoID,omitempty"` -} - -func (x *GroupPhoto) Reset() { - *x = GroupPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupPhoto) ProtoMessage() {} - -func (x *GroupPhoto) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupPhoto.ProtoReflect.Descriptor instead. -func (*GroupPhoto) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{23} -} - -func (x *GroupPhoto) GetPhotoBig() *FileLocation { - if x != nil { - return x.PhotoBig - } - return nil -} - -func (x *GroupPhoto) GetPhotoSmall() *FileLocation { - if x != nil { - return x.PhotoSmall - } - return nil -} - -func (x *GroupPhoto) GetPhotoID() int64 { - if x != nil { - return x.PhotoID - } - return 0 -} - -// Group -type Group struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,100,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Title string `protobuf:"bytes,2,opt,name=Title,proto3" json:"Title,omitempty"` - CreatedOn int64 `protobuf:"varint,3,opt,name=CreatedOn,proto3" json:"CreatedOn,omitempty"` - Participants int32 `protobuf:"varint,4,opt,name=Participants,proto3" json:"Participants,omitempty"` - EditedOn int64 `protobuf:"varint,5,opt,name=EditedOn,proto3" json:"EditedOn,omitempty"` - Flags []GroupFlags `protobuf:"varint,6,rep,packed,name=Flags,proto3,enum=msg.GroupFlags" json:"Flags,omitempty"` - Photo *GroupPhoto `protobuf:"bytes,7,opt,name=Photo,proto3" json:"Photo,omitempty"` -} - -func (x *Group) Reset() { - *x = Group{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Group) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Group) ProtoMessage() {} - -func (x *Group) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Group.ProtoReflect.Descriptor instead. -func (*Group) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{24} -} - -func (x *Group) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *Group) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *Group) GetTitle() string { - if x != nil { - return x.Title - } - return "" -} - -func (x *Group) GetCreatedOn() int64 { - if x != nil { - return x.CreatedOn - } - return 0 -} - -func (x *Group) GetParticipants() int32 { - if x != nil { - return x.Participants - } - return 0 -} - -func (x *Group) GetEditedOn() int64 { - if x != nil { - return x.EditedOn - } - return 0 -} - -func (x *Group) GetFlags() []GroupFlags { - if x != nil { - return x.Flags - } - return nil -} - -func (x *Group) GetPhoto() *GroupPhoto { - if x != nil { - return x.Photo - } - return nil -} - -// GroupFull -type GroupFull struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Group *Group `protobuf:"bytes,1,opt,name=Group,proto3" json:"Group,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Participants []*GroupParticipant `protobuf:"bytes,3,rep,name=Participants,proto3" json:"Participants,omitempty"` - NotifySettings *PeerNotifySettings `protobuf:"bytes,4,opt,name=NotifySettings,proto3" json:"NotifySettings,omitempty"` - PhotoGallery []*GroupPhoto `protobuf:"bytes,5,rep,name=PhotoGallery,proto3" json:"PhotoGallery,omitempty"` -} - -func (x *GroupFull) Reset() { - *x = GroupFull{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupFull) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupFull) ProtoMessage() {} - -func (x *GroupFull) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupFull.ProtoReflect.Descriptor instead. -func (*GroupFull) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{25} -} - -func (x *GroupFull) GetGroup() *Group { - if x != nil { - return x.Group - } - return nil -} - -func (x *GroupFull) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *GroupFull) GetParticipants() []*GroupParticipant { - if x != nil { - return x.Participants - } - return nil -} - -func (x *GroupFull) GetNotifySettings() *PeerNotifySettings { - if x != nil { - return x.NotifySettings - } - return nil -} - -func (x *GroupFull) GetPhotoGallery() []*GroupPhoto { - if x != nil { - return x.PhotoGallery - } - return nil -} - -// GroupParticipant -type GroupParticipant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - Type ParticipantType `protobuf:"varint,4,opt,name=Type,proto3,enum=msg.ParticipantType" json:"Type,omitempty"` - AccessHash uint64 `protobuf:"varint,5,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Username string `protobuf:"bytes,6,opt,name=Username,proto3" json:"Username,omitempty"` - Photo *UserPhoto `protobuf:"bytes,8,opt,name=Photo,proto3" json:"Photo,omitempty"` -} - -func (x *GroupParticipant) Reset() { - *x = GroupParticipant{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GroupParticipant) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GroupParticipant) ProtoMessage() {} - -func (x *GroupParticipant) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GroupParticipant.ProtoReflect.Descriptor instead. -func (*GroupParticipant) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{26} -} - -func (x *GroupParticipant) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *GroupParticipant) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *GroupParticipant) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *GroupParticipant) GetType() ParticipantType { - if x != nil { - return x.Type - } - return ParticipantType_ParticipantTypeMember -} - -func (x *GroupParticipant) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *GroupParticipant) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *GroupParticipant) GetPhoto() *UserPhoto { - if x != nil { - return x.Photo - } - return nil -} - -// UserMessage -type UserMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,100,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - PeerID int64 `protobuf:"varint,2,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,3,opt,name=PeerType,proto3" json:"PeerType,omitempty"` - CreatedOn int64 `protobuf:"varint,4,opt,name=CreatedOn,proto3" json:"CreatedOn,omitempty"` - EditedOn int64 `protobuf:"varint,5,opt,name=EditedOn,proto3" json:"EditedOn,omitempty"` - Fwd bool `protobuf:"varint,601,opt,name=Fwd,proto3" json:"Fwd,omitempty"` - FwdSenderID int64 `protobuf:"varint,6,opt,name=FwdSenderID,proto3" json:"FwdSenderID,omitempty"` - FwdChannelID int64 `protobuf:"varint,7,opt,name=FwdChannelID,proto3" json:"FwdChannelID,omitempty"` - FwdChannelMessageID int64 `protobuf:"varint,8,opt,name=FwdChannelMessageID,proto3" json:"FwdChannelMessageID,omitempty"` - Flags int32 `protobuf:"varint,9,opt,name=Flags,proto3" json:"Flags,omitempty"` - MessageType int64 `protobuf:"varint,10,opt,name=MessageType,proto3" json:"MessageType,omitempty"` - Body string `protobuf:"bytes,11,opt,name=Body,proto3" json:"Body,omitempty"` - SenderID int64 `protobuf:"varint,12,opt,name=SenderID,proto3" json:"SenderID,omitempty"` - ContentRead bool `protobuf:"varint,13,opt,name=ContentRead,proto3" json:"ContentRead,omitempty"` - Inbox bool `protobuf:"varint,14,opt,name=Inbox,proto3" json:"Inbox,omitempty"` - ReplyTo int64 `protobuf:"varint,15,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - MessageAction int32 `protobuf:"varint,16,opt,name=MessageAction,proto3" json:"MessageAction,omitempty"` - MessageActionData []byte `protobuf:"bytes,17,opt,name=MessageActionData,proto3" json:"MessageActionData,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,18,rep,name=Entities,proto3" json:"Entities,omitempty"` - MediaType MediaType `protobuf:"varint,19,opt,name=MediaType,proto3,enum=msg.MediaType" json:"MediaType,omitempty"` - Media []byte `protobuf:"bytes,20,opt,name=Media,proto3" json:"Media,omitempty"` - ReplyMarkup int64 `protobuf:"varint,21,opt,name=ReplyMarkup,proto3" json:"ReplyMarkup,omitempty"` - ReplyMarkupData []byte `protobuf:"bytes,22,opt,name=ReplyMarkupData,proto3" json:"ReplyMarkupData,omitempty"` - LabelIDs []int32 `protobuf:"varint,23,rep,packed,name=LabelIDs,proto3" json:"LabelIDs,omitempty"` - ViaBotID int64 `protobuf:"varint,24,opt,name=ViaBotID,proto3" json:"ViaBotID,omitempty"` - Reactions []*ReactionCounter `protobuf:"bytes,25,rep,name=Reactions,proto3" json:"Reactions,omitempty"` - YourReactions []string `protobuf:"bytes,26,rep,name=YourReactions,proto3" json:"YourReactions,omitempty"` - MediaCat MediaCategory `protobuf:"varint,27,opt,name=MediaCat,proto3,enum=msg.MediaCategory" json:"MediaCat,omitempty"` -} - -func (x *UserMessage) Reset() { - *x = UserMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UserMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserMessage) ProtoMessage() {} - -func (x *UserMessage) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UserMessage.ProtoReflect.Descriptor instead. -func (*UserMessage) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{27} -} - -func (x *UserMessage) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UserMessage) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *UserMessage) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *UserMessage) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -func (x *UserMessage) GetCreatedOn() int64 { - if x != nil { - return x.CreatedOn - } - return 0 -} - -func (x *UserMessage) GetEditedOn() int64 { - if x != nil { - return x.EditedOn - } - return 0 -} - -func (x *UserMessage) GetFwd() bool { - if x != nil { - return x.Fwd - } - return false -} - -func (x *UserMessage) GetFwdSenderID() int64 { - if x != nil { - return x.FwdSenderID - } - return 0 -} - -func (x *UserMessage) GetFwdChannelID() int64 { - if x != nil { - return x.FwdChannelID - } - return 0 -} - -func (x *UserMessage) GetFwdChannelMessageID() int64 { - if x != nil { - return x.FwdChannelMessageID - } - return 0 -} - -func (x *UserMessage) GetFlags() int32 { - if x != nil { - return x.Flags - } - return 0 -} - -func (x *UserMessage) GetMessageType() int64 { - if x != nil { - return x.MessageType - } - return 0 -} - -func (x *UserMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *UserMessage) GetSenderID() int64 { - if x != nil { - return x.SenderID - } - return 0 -} - -func (x *UserMessage) GetContentRead() bool { - if x != nil { - return x.ContentRead - } - return false -} - -func (x *UserMessage) GetInbox() bool { - if x != nil { - return x.Inbox - } - return false -} - -func (x *UserMessage) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *UserMessage) GetMessageAction() int32 { - if x != nil { - return x.MessageAction - } - return 0 -} - -func (x *UserMessage) GetMessageActionData() []byte { - if x != nil { - return x.MessageActionData - } - return nil -} - -func (x *UserMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *UserMessage) GetMediaType() MediaType { - if x != nil { - return x.MediaType - } - return MediaType_MediaTypeEmpty -} - -func (x *UserMessage) GetMedia() []byte { - if x != nil { - return x.Media - } - return nil -} - -func (x *UserMessage) GetReplyMarkup() int64 { - if x != nil { - return x.ReplyMarkup - } - return 0 -} - -func (x *UserMessage) GetReplyMarkupData() []byte { - if x != nil { - return x.ReplyMarkupData - } - return nil -} - -func (x *UserMessage) GetLabelIDs() []int32 { - if x != nil { - return x.LabelIDs - } - return nil -} - -func (x *UserMessage) GetViaBotID() int64 { - if x != nil { - return x.ViaBotID - } - return 0 -} - -func (x *UserMessage) GetReactions() []*ReactionCounter { - if x != nil { - return x.Reactions - } - return nil -} - -func (x *UserMessage) GetYourReactions() []string { - if x != nil { - return x.YourReactions - } - return nil -} - -func (x *UserMessage) GetMediaCat() MediaCategory { - if x != nil { - return x.MediaCat - } - return MediaCategory_MediaCategoryNone -} - -// ReactionCounter -type ReactionCounter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Reaction string `protobuf:"bytes,1,opt,name=Reaction,proto3" json:"Reaction,omitempty"` - Total int32 `protobuf:"varint,2,opt,name=Total,proto3" json:"Total,omitempty"` -} - -func (x *ReactionCounter) Reset() { - *x = ReactionCounter{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReactionCounter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReactionCounter) ProtoMessage() {} - -func (x *ReactionCounter) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReactionCounter.ProtoReflect.Descriptor instead. -func (*ReactionCounter) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{28} -} - -func (x *ReactionCounter) GetReaction() string { - if x != nil { - return x.Reaction - } - return "" -} - -func (x *ReactionCounter) GetTotal() int32 { - if x != nil { - return x.Total - } - return 0 -} - -// DraftMessage -type DraftMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,100,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - PeerID int64 `protobuf:"varint,2,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,3,opt,name=PeerType,proto3" json:"PeerType,omitempty"` - Date int64 `protobuf:"varint,4,opt,name=Date,proto3" json:"Date,omitempty"` - Body string `protobuf:"bytes,5,opt,name=Body,proto3" json:"Body,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,6,rep,name=Entities,proto3" json:"Entities,omitempty"` - ReplyTo int64 `protobuf:"varint,7,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - EditedID int64 `protobuf:"varint,8,opt,name=EditedID,proto3" json:"EditedID,omitempty"` -} - -func (x *DraftMessage) Reset() { - *x = DraftMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DraftMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DraftMessage) ProtoMessage() {} - -func (x *DraftMessage) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DraftMessage.ProtoReflect.Descriptor instead. -func (*DraftMessage) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{29} -} - -func (x *DraftMessage) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *DraftMessage) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *DraftMessage) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -func (x *DraftMessage) GetDate() int64 { - if x != nil { - return x.Date - } - return 0 -} - -func (x *DraftMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *DraftMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *DraftMessage) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *DraftMessage) GetEditedID() int64 { - if x != nil { - return x.EditedID - } - return 0 -} - -// MessageEntity -type MessageEntity struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type MessageEntityType `protobuf:"varint,1,opt,name=Type,proto3,enum=msg.MessageEntityType" json:"Type,omitempty"` - Offset int32 `protobuf:"varint,2,opt,name=Offset,proto3" json:"Offset,omitempty"` - Length int32 `protobuf:"varint,3,opt,name=Length,proto3" json:"Length,omitempty"` - UserID int64 `protobuf:"varint,4,opt,name=UserID,proto3" json:"UserID,omitempty"` -} - -func (x *MessageEntity) Reset() { - *x = MessageEntity{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MessageEntity) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MessageEntity) ProtoMessage() {} - -func (x *MessageEntity) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MessageEntity.ProtoReflect.Descriptor instead. -func (*MessageEntity) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{30} -} - -func (x *MessageEntity) GetType() MessageEntityType { - if x != nil { - return x.Type - } - return MessageEntityType_MessageEntityTypeBold -} - -func (x *MessageEntity) GetOffset() int32 { - if x != nil { - return x.Offset - } - return 0 -} - -func (x *MessageEntity) GetLength() int32 { - if x != nil { - return x.Length - } - return 0 -} - -func (x *MessageEntity) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -// RSAPublicKey -type RSAPublicKey struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FingerPrint int64 `protobuf:"varint,1,opt,name=FingerPrint,proto3" json:"FingerPrint,omitempty"` - N string `protobuf:"bytes,2,opt,name=N,proto3" json:"N,omitempty"` - E uint32 `protobuf:"varint,3,opt,name=E,proto3" json:"E,omitempty"` -} - -func (x *RSAPublicKey) Reset() { - *x = RSAPublicKey{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *RSAPublicKey) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*RSAPublicKey) ProtoMessage() {} - -func (x *RSAPublicKey) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use RSAPublicKey.ProtoReflect.Descriptor instead. -func (*RSAPublicKey) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{31} -} - -func (x *RSAPublicKey) GetFingerPrint() int64 { - if x != nil { - return x.FingerPrint - } - return 0 -} - -func (x *RSAPublicKey) GetN() string { - if x != nil { - return x.N - } - return "" -} - -func (x *RSAPublicKey) GetE() uint32 { - if x != nil { - return x.E - } - return 0 -} - -// DHGroup -type DHGroup struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FingerPrint int64 `protobuf:"varint,1,opt,name=FingerPrint,proto3" json:"FingerPrint,omitempty"` - Prime string `protobuf:"bytes,2,opt,name=Prime,proto3" json:"Prime,omitempty"` - Gen int32 `protobuf:"varint,3,opt,name=Gen,proto3" json:"Gen,omitempty"` -} - -func (x *DHGroup) Reset() { - *x = DHGroup{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DHGroup) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DHGroup) ProtoMessage() {} - -func (x *DHGroup) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DHGroup.ProtoReflect.Descriptor instead. -func (*DHGroup) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{32} -} - -func (x *DHGroup) GetFingerPrint() int64 { - if x != nil { - return x.FingerPrint - } - return 0 -} - -func (x *DHGroup) GetPrime() string { - if x != nil { - return x.Prime - } - return "" -} - -func (x *DHGroup) GetGen() int32 { - if x != nil { - return x.Gen - } - return 0 -} - -// PhoneContact -type PhoneContact struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ClientID int64 `protobuf:"varint,1,opt,name=ClientID,proto3" json:"ClientID,omitempty"` - FirstName string `protobuf:"bytes,2,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,3,opt,name=LastName,proto3" json:"LastName,omitempty"` - Phone string `protobuf:"bytes,4,opt,name=Phone,proto3" json:"Phone,omitempty"` -} - -func (x *PhoneContact) Reset() { - *x = PhoneContact{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PhoneContact) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PhoneContact) ProtoMessage() {} - -func (x *PhoneContact) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PhoneContact.ProtoReflect.Descriptor instead. -func (*PhoneContact) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{33} -} - -func (x *PhoneContact) GetClientID() int64 { - if x != nil { - return x.ClientID - } - return 0 -} - -func (x *PhoneContact) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *PhoneContact) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *PhoneContact) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -// PeerNotifySettings -type PeerNotifySettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Flags int32 `protobuf:"varint,1,opt,name=Flags,proto3" json:"Flags,omitempty"` - MuteUntil int64 `protobuf:"varint,2,opt,name=MuteUntil,proto3" json:"MuteUntil,omitempty"` - Sound string `protobuf:"bytes,3,opt,name=Sound,proto3" json:"Sound,omitempty"` -} - -func (x *PeerNotifySettings) Reset() { - *x = PeerNotifySettings{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerNotifySettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PeerNotifySettings) ProtoMessage() {} - -func (x *PeerNotifySettings) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PeerNotifySettings.ProtoReflect.Descriptor instead. -func (*PeerNotifySettings) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{34} -} - -func (x *PeerNotifySettings) GetFlags() int32 { - if x != nil { - return x.Flags - } - return 0 -} - -func (x *PeerNotifySettings) GetMuteUntil() int64 { - if x != nil { - return x.MuteUntil - } - return 0 -} - -func (x *PeerNotifySettings) GetSound() string { - if x != nil { - return x.Sound - } - return "" -} - -// InputFile -type InputFile struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FileID int64 `protobuf:"varint,1,opt,name=FileID,proto3" json:"FileID,omitempty"` - TotalParts int32 `protobuf:"varint,2,opt,name=TotalParts,proto3" json:"TotalParts,omitempty"` - FileName string `protobuf:"bytes,3,opt,name=FileName,proto3" json:"FileName,omitempty"` - MD5Checksum string `protobuf:"bytes,4,opt,name=MD5Checksum,proto3" json:"MD5Checksum,omitempty"` -} - -func (x *InputFile) Reset() { - *x = InputFile{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputFile) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputFile) ProtoMessage() {} - -func (x *InputFile) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputFile.ProtoReflect.Descriptor instead. -func (*InputFile) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{35} -} - -func (x *InputFile) GetFileID() int64 { - if x != nil { - return x.FileID - } - return 0 -} - -func (x *InputFile) GetTotalParts() int32 { - if x != nil { - return x.TotalParts - } - return 0 -} - -func (x *InputFile) GetFileName() string { - if x != nil { - return x.FileName - } - return "" -} - -func (x *InputFile) GetMD5Checksum() string { - if x != nil { - return x.MD5Checksum - } - return "" -} - -// InputDocument -type InputDocument struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,2,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - ClusterID int32 `protobuf:"varint,3,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"` -} - -func (x *InputDocument) Reset() { - *x = InputDocument{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputDocument) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputDocument) ProtoMessage() {} - -func (x *InputDocument) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputDocument.ProtoReflect.Descriptor instead. -func (*InputDocument) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{36} -} - -func (x *InputDocument) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *InputDocument) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *InputDocument) GetClusterID() int32 { - if x != nil { - return x.ClusterID - } - return 0 -} - -// PrivacyRule -type PrivacyRule struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PrivacyType PrivacyType `protobuf:"varint,1,opt,name=PrivacyType,proto3,enum=msg.PrivacyType" json:"PrivacyType,omitempty"` - UserIDs []int64 `protobuf:"varint,2,rep,packed,name=UserIDs,proto3" json:"UserIDs,omitempty"` -} - -func (x *PrivacyRule) Reset() { - *x = PrivacyRule{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrivacyRule) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrivacyRule) ProtoMessage() {} - -func (x *PrivacyRule) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PrivacyRule.ProtoReflect.Descriptor instead. -func (*PrivacyRule) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{37} -} - -func (x *PrivacyRule) GetPrivacyType() PrivacyType { - if x != nil { - return x.PrivacyType - } - return PrivacyType_PrivacyTypeAllowAll -} - -func (x *PrivacyRule) GetUserIDs() []int64 { - if x != nil { - return x.UserIDs - } - return nil -} - -// Label -type Label struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int32 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - Colour string `protobuf:"bytes,3,opt,name=Colour,proto3" json:"Colour,omitempty"` - Count int32 `protobuf:"varint,4,opt,name=Count,proto3" json:"Count,omitempty"` -} - -func (x *Label) Reset() { - *x = Label{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Label) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Label) ProtoMessage() {} - -func (x *Label) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Label.ProtoReflect.Descriptor instead. -func (*Label) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{38} -} - -func (x *Label) GetID() int32 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *Label) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Label) GetColour() string { - if x != nil { - return x.Colour - } - return "" -} - -func (x *Label) GetCount() int32 { - if x != nil { - return x.Count - } - return 0 -} - -// LabelsMany -type LabelsMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Labels []*Label `protobuf:"bytes,1,rep,name=Labels,proto3" json:"Labels,omitempty"` - Empty bool `protobuf:"varint,5,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *LabelsMany) Reset() { - *x = LabelsMany{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LabelsMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LabelsMany) ProtoMessage() {} - -func (x *LabelsMany) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LabelsMany.ProtoReflect.Descriptor instead. -func (*LabelsMany) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{39} -} - -func (x *LabelsMany) GetLabels() []*Label { - if x != nil { - return x.Labels - } - return nil -} - -func (x *LabelsMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// InputGeoLocation -type InputGeoLocation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Lat float32 `protobuf:"fixed32,1,opt,name=Lat,proto3" json:"Lat,omitempty"` - Long float32 `protobuf:"fixed32,2,opt,name=Long,proto3" json:"Long,omitempty"` -} - -func (x *InputGeoLocation) Reset() { - *x = InputGeoLocation{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputGeoLocation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputGeoLocation) ProtoMessage() {} - -func (x *InputGeoLocation) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputGeoLocation.ProtoReflect.Descriptor instead. -func (*InputGeoLocation) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{40} -} - -func (x *InputGeoLocation) GetLat() float32 { - if x != nil { - return x.Lat - } - return 0 -} - -func (x *InputGeoLocation) GetLong() float32 { - if x != nil { - return x.Long - } - return 0 -} - -// GeoLocation -type GeoLocation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Lat float32 `protobuf:"fixed32,1,opt,name=Lat,proto3" json:"Lat,omitempty"` - Long float32 `protobuf:"fixed32,2,opt,name=Long,proto3" json:"Long,omitempty"` -} - -func (x *GeoLocation) Reset() { - *x = GeoLocation{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GeoLocation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GeoLocation) ProtoMessage() {} - -func (x *GeoLocation) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GeoLocation.ProtoReflect.Descriptor instead. -func (*GeoLocation) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{41} -} - -func (x *GeoLocation) GetLat() float32 { - if x != nil { - return x.Lat - } - return 0 -} - -func (x *GeoLocation) GetLong() float32 { - if x != nil { - return x.Long - } - return 0 -} - -// InputTeam -type InputTeam struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,2,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` -} - -func (x *InputTeam) Reset() { - *x = InputTeam{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *InputTeam) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InputTeam) ProtoMessage() {} - -func (x *InputTeam) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[42] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InputTeam.ProtoReflect.Descriptor instead. -func (*InputTeam) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{42} -} - -func (x *InputTeam) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *InputTeam) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -// TeamPhoto -type TeamPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PhotoBig *FileLocation `protobuf:"bytes,1,opt,name=PhotoBig,proto3" json:"PhotoBig,omitempty"` - PhotoSmall *FileLocation `protobuf:"bytes,2,opt,name=PhotoSmall,proto3" json:"PhotoSmall,omitempty"` -} - -func (x *TeamPhoto) Reset() { - *x = TeamPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamPhoto) ProtoMessage() {} - -func (x *TeamPhoto) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamPhoto.ProtoReflect.Descriptor instead. -func (*TeamPhoto) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{43} -} - -func (x *TeamPhoto) GetPhotoBig() *FileLocation { - if x != nil { - return x.PhotoBig - } - return nil -} - -func (x *TeamPhoto) GetPhotoSmall() *FileLocation { - if x != nil { - return x.PhotoSmall - } - return nil -} - -// Team -type Team struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - CreatorID int64 `protobuf:"varint,3,opt,name=CreatorID,proto3" json:"CreatorID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,6,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Flags []TeamFlags `protobuf:"varint,7,rep,packed,name=Flags,proto3,enum=msg.TeamFlags" json:"Flags,omitempty"` - Capacity int32 `protobuf:"varint,8,opt,name=Capacity,proto3" json:"Capacity,omitempty"` - Community bool `protobuf:"varint,9,opt,name=Community,proto3" json:"Community,omitempty"` - Photo *TeamPhoto `protobuf:"bytes,10,opt,name=Photo,proto3" json:"Photo,omitempty"` -} - -func (x *Team) Reset() { - *x = Team{} - if protoimpl.UnsafeEnabled { - mi := &file_core_types_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Team) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Team) ProtoMessage() {} - -func (x *Team) ProtoReflect() protoreflect.Message { - mi := &file_core_types_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Team.ProtoReflect.Descriptor instead. -func (*Team) Descriptor() ([]byte, []int) { - return file_core_types_proto_rawDescGZIP(), []int{44} -} - -func (x *Team) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -func (x *Team) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Team) GetCreatorID() int64 { - if x != nil { - return x.CreatorID - } - return 0 -} - -func (x *Team) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *Team) GetFlags() []TeamFlags { - if x != nil { - return x.Flags - } - return nil -} - -func (x *Team) GetCapacity() int32 { - if x != nil { - return x.Capacity - } - return 0 -} - -func (x *Team) GetCommunity() bool { - if x != nil { - return x.Community - } - return false -} - -func (x *Team) GetPhoto() *TeamPhoto { - if x != nil { - return x.Photo - } - return nil -} - -var File_core_types_proto protoreflect.FileDescriptor - -var file_core_types_proto_rawDesc = []byte{ - 0x0a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x6f, 0x6e, 0x61, 0x6b, 0x73, 0x6f, 0x66, 0x74, 0x2f, 0x72, 0x6f, - 0x6e, 0x79, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x16, 0x0a, 0x04, - 0x50, 0x69, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x02, 0x49, 0x44, 0x22, 0x16, 0x0a, 0x04, 0x50, 0x6f, 0x6e, 0x67, 0x12, 0x0e, 0x0a, 0x02, - 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x44, 0x22, 0xb8, 0x01, 0x0a, - 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, - 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x6f, - 0x72, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, - 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x44, - 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x44, - 0x65, 0x61, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0xe1, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x12, 0x2d, 0x0a, 0x07, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x07, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x4d, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x61, 0x78, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x4d, 0x61, 0x78, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, - 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x22, 0x0a, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x52, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x60, 0x0a, 0x0c, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, - 0x75, 0x74, 0x68, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x75, 0x74, - 0x68, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0xa6, 0x01, - 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, - 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x53, 0x61, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x53, 0x61, 0x6c, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x49, 0x44, 0x12, 0x31, 0x0a, 0x08, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x72, 0x6f, 0x6e, 0x79, 0x2e, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x08, 0x45, 0x6e, - 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x22, 0x25, 0x0a, 0x03, 0x41, 0x63, 0x6b, 0x12, 0x1e, 0x0a, - 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x04, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x22, 0x1e, 0x0a, - 0x04, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0xb0, 0x04, - 0x0a, 0x06, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, - 0x49, 0x44, 0x18, 0x64, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, - 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, - 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, - 0x54, 0x6f, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x0c, 0x54, 0x6f, 0x70, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, - 0x12, 0x26, 0x0a, 0x0e, 0x52, 0x65, 0x61, 0x64, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x4d, 0x61, 0x78, - 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x52, 0x65, 0x61, 0x64, 0x49, 0x6e, - 0x62, 0x6f, 0x78, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x12, 0x28, 0x0a, 0x0f, 0x52, 0x65, 0x61, 0x64, - 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x78, 0x4d, 0x61, 0x78, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0f, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x78, 0x4d, 0x61, 0x78, - 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, - 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x3f, 0x0a, 0x0e, 0x4e, 0x6f, 0x74, 0x69, - 0x66, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, - 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x0e, 0x4e, 0x6f, 0x74, 0x69, 0x66, - 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x4d, 0x65, 0x6e, - 0x74, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0e, 0x4d, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x06, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x12, 0x27, 0x0a, 0x05, 0x44, 0x72, 0x61, - 0x66, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, - 0x72, 0x61, 0x66, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x05, 0x44, 0x72, 0x61, - 0x66, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x50, 0x69, 0x6e, - 0x6e, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x26, 0x0a, 0x0c, - 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x0d, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0c, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x43, 0x61, - 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, - 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, 0x79, - 0x22, 0x66, 0x0a, 0x09, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x65, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, - 0x44, 0x12, 0x21, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x0d, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, - 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x22, 0x52, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x12, 0x12, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x22, 0x47, 0x0a, 0x0d, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x18, 0x0a, - 0x05, 0x53, 0x72, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x05, 0x53, 0x72, 0x70, 0x49, 0x44, 0x12, 0x0c, 0x0a, 0x01, 0x41, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x01, 0x41, 0x12, 0x0e, 0x0a, 0x02, 0x4d, 0x31, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x02, 0x4d, 0x31, 0x22, 0x8b, 0x01, 0x0a, 0x11, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, - 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x43, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, - 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x46, 0x69, 0x6c, - 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x46, - 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, - 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x22, 0x6c, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, - 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, 0x22, 0x0a, - 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x06, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, - 0x68, 0x22, 0x1f, 0x0a, 0x0b, 0x57, 0x65, 0x62, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, - 0x72, 0x6c, 0x22, 0x24, 0x0a, 0x10, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x57, 0x65, 0x62, 0x4c, 0x6f, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, 0x72, 0x6c, 0x22, 0xf7, 0x01, 0x0a, 0x09, 0x55, 0x73, 0x65, - 0x72, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x2d, 0x0a, 0x08, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x42, - 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x50, 0x68, 0x6f, - 0x74, 0x6f, 0x42, 0x69, 0x67, 0x12, 0x31, 0x0a, 0x0a, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x53, 0x6d, - 0x61, 0x6c, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x50, 0x68, - 0x6f, 0x74, 0x6f, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x12, 0x1c, 0x0a, 0x07, 0x50, 0x68, 0x6f, 0x74, - 0x6f, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x50, - 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x0b, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x42, - 0x69, 0x67, 0x57, 0x65, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x57, 0x65, 0x62, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x50, - 0x68, 0x6f, 0x74, 0x6f, 0x42, 0x69, 0x67, 0x57, 0x65, 0x62, 0x12, 0x36, 0x0a, 0x0d, 0x50, 0x68, - 0x6f, 0x74, 0x6f, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x57, 0x65, 0x62, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x57, 0x65, 0x62, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x57, - 0x65, 0x62, 0x22, 0x4b, 0x0a, 0x09, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, - 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0a, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x22, - 0x89, 0x04, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, - 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, - 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x61, - 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x52, - 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0a, 0x52, 0x65, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0a, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x06, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, - 0x24, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x05, - 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x42, 0x69, 0x6f, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x42, 0x69, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x65, 0x65, 0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x65, 0x65, 0x6e, 0x12, 0x32, 0x0a, 0x0c, 0x50, 0x68, 0x6f, - 0x74, 0x6f, 0x47, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x79, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, - 0x0c, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x47, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, - 0x05, 0x49, 0x73, 0x42, 0x6f, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x49, 0x73, - 0x42, 0x6f, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x0e, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, - 0x07, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x12, 0x26, 0x0a, 0x07, 0x42, 0x6f, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, - 0x6f, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x1a, 0x0a, 0x08, 0x4f, 0x66, 0x66, 0x69, 0x63, 0x69, 0x61, 0x6c, 0x18, 0x11, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x08, 0x4f, 0x66, 0x66, 0x69, 0x63, 0x69, 0x61, 0x6c, 0x22, 0xf7, 0x01, 0x0a, 0x0b, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x02, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, 0x44, 0x12, - 0x1c, 0x0a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x06, 0x42, 0x02, 0x30, - 0x01, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x14, 0x0a, - 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x1e, 0x0a, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, - 0x24, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x05, - 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x22, 0x5b, 0x0a, 0x03, 0x42, 0x6f, 0x74, 0x12, 0x12, 0x0a, 0x02, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, 0x44, - 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x42, 0x69, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x42, - 0x69, 0x6f, 0x22, 0x49, 0x0a, 0x0b, 0x42, 0x6f, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, - 0x73, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x44, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x02, - 0x0a, 0x07, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x03, 0x42, 0x6f, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, 0x6f, 0x74, - 0x52, 0x03, 0x42, 0x6f, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x20, 0x0a, - 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x32, 0x0a, 0x0b, 0x42, 0x6f, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x18, 0x04, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x42, 0x6f, 0x74, 0x43, 0x6f, - 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x52, 0x0b, 0x42, 0x6f, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x47, 0x65, 0x6f, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x47, 0x65, - 0x6f, 0x12, 0x2c, 0x0a, 0x11, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, - 0x48, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x49, 0x6e, - 0x6c, 0x69, 0x6e, 0x65, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x48, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, - 0x20, 0x0a, 0x0b, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x22, 0x8c, 0x01, 0x0a, 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x68, 0x6f, 0x74, 0x6f, - 0x12, 0x2d, 0x0a, 0x08, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x42, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x42, 0x69, 0x67, 0x12, - 0x31, 0x0a, 0x0a, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x53, 0x6d, 0x61, - 0x6c, 0x6c, 0x12, 0x1c, 0x0a, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, - 0x22, 0xf9, 0x01, 0x0a, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, - 0x61, 0x6d, 0x49, 0x44, 0x18, 0x64, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, - 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, - 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, - 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x12, 0x22, - 0x0a, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, - 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x45, 0x64, 0x69, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x45, 0x64, 0x69, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x12, 0x25, - 0x0a, 0x05, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0f, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x05, - 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x25, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x22, 0xff, 0x01, 0x0a, - 0x09, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x75, 0x6c, 0x6c, 0x12, 0x20, 0x0a, 0x05, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x05, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1f, 0x0a, 0x05, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x39, 0x0a, - 0x0c, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x0c, 0x50, 0x61, 0x72, 0x74, - 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x3f, 0x0a, 0x0e, 0x4e, 0x6f, 0x74, 0x69, - 0x66, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x17, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, - 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x0e, 0x4e, 0x6f, 0x74, 0x69, 0x66, - 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x33, 0x0a, 0x0c, 0x50, 0x68, 0x6f, - 0x74, 0x6f, 0x47, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0f, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x68, 0x6f, 0x74, 0x6f, - 0x52, 0x0c, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x47, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x79, 0x22, 0xf8, - 0x01, 0x0a, 0x10, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, - 0x61, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, - 0x1c, 0x0a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x54, 0x79, 0x70, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x61, - 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, - 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x6e, - 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x50, 0x68, 0x6f, - 0x74, 0x6f, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x07, 0x0a, 0x0b, 0x55, 0x73, - 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, - 0x6d, 0x49, 0x44, 0x18, 0x64, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, - 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x02, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, - 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, - 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x45, - 0x64, 0x69, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x45, - 0x64, 0x69, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x12, 0x11, 0x0a, 0x03, 0x46, 0x77, 0x64, 0x18, 0xd9, - 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x46, 0x77, 0x64, 0x12, 0x24, 0x0a, 0x0b, 0x46, 0x77, - 0x64, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x0b, 0x46, 0x77, 0x64, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, - 0x12, 0x26, 0x0a, 0x0c, 0x46, 0x77, 0x64, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x44, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0c, 0x46, 0x77, 0x64, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x44, 0x12, 0x34, 0x0a, 0x13, 0x46, 0x77, 0x64, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x13, 0x46, 0x77, 0x64, 0x43, 0x68, - 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x14, - 0x0a, 0x05, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x46, - 0x6c, 0x61, 0x67, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x0b, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1e, 0x0a, 0x08, 0x53, 0x65, - 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x0b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x61, 0x64, 0x12, 0x14, 0x0a, 0x05, - 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x49, 0x6e, 0x62, - 0x6f, 0x78, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x0f, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x24, 0x0a, 0x0d, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x10, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x12, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, - 0x12, 0x2c, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x18, 0x13, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x12, 0x20, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, - 0x6b, 0x75, 0x70, 0x18, 0x15, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x12, 0x28, 0x0a, 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, - 0x61, 0x72, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x0f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x4d, 0x61, 0x72, 0x6b, 0x75, 0x70, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x18, 0x17, 0x20, 0x03, - 0x28, 0x05, 0x52, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x12, 0x1e, 0x0a, 0x08, - 0x56, 0x69, 0x61, 0x42, 0x6f, 0x74, 0x49, 0x44, 0x18, 0x18, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, - 0x30, 0x01, 0x52, 0x08, 0x56, 0x69, 0x61, 0x42, 0x6f, 0x74, 0x49, 0x44, 0x12, 0x32, 0x0a, 0x09, - 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x19, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x12, 0x24, 0x0a, 0x0d, 0x59, 0x6f, 0x75, 0x72, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x59, 0x6f, 0x75, 0x72, 0x52, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x08, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, - 0x61, 0x74, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x08, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x22, 0x43, 0x0a, 0x0f, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xf0, 0x01, 0x0a, 0x0c, - 0x44, 0x72, 0x61, 0x66, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x06, - 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x64, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, - 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x50, 0x65, - 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, - 0x44, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, - 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x54, 0x6f, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x54, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x45, 0x64, 0x69, 0x74, 0x65, 0x64, 0x49, 0x44, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x45, 0x64, 0x69, 0x74, 0x65, 0x64, 0x49, 0x44, 0x22, 0x87, - 0x01, 0x0a, 0x0d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x12, 0x2a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, - 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x06, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0x4c, 0x0a, 0x0c, 0x52, 0x53, 0x41, 0x50, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x46, 0x69, 0x6e, 0x67, - 0x65, 0x72, 0x50, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x46, - 0x69, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x72, 0x69, 0x6e, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x4e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x4e, 0x12, 0x0c, 0x0a, 0x01, 0x45, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x01, 0x45, 0x22, 0x53, 0x0a, 0x07, 0x44, 0x48, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x12, 0x20, 0x0a, 0x0b, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x72, 0x69, 0x6e, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x50, 0x72, - 0x69, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x72, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x50, 0x72, 0x69, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x47, 0x65, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x47, 0x65, 0x6e, 0x22, 0x7e, 0x0a, 0x0c, 0x50, - 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x1e, 0x0a, 0x08, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, - 0x01, 0x52, 0x08, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x46, - 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x73, - 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x61, 0x73, - 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0x5e, 0x0a, 0x12, 0x50, - 0x65, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x12, 0x14, 0x0a, 0x05, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x75, 0x74, 0x65, 0x55, - 0x6e, 0x74, 0x69, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x75, 0x74, 0x65, - 0x55, 0x6e, 0x74, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x85, 0x01, 0x0a, 0x09, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x06, 0x46, 0x69, 0x6c, - 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x46, - 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x61, - 0x72, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x54, 0x6f, 0x74, 0x61, 0x6c, - 0x50, 0x61, 0x72, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x44, 0x35, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4d, 0x44, 0x35, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x75, 0x6d, 0x22, 0x65, 0x0a, 0x0d, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x44, 0x6f, 0x63, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, - 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x09, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x44, 0x22, 0x5f, 0x0a, 0x0b, 0x50, 0x72, - 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x32, 0x0a, 0x0b, 0x50, 0x72, 0x69, - 0x76, 0x61, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x0b, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, - 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, - 0x30, 0x01, 0x52, 0x07, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x73, 0x22, 0x59, 0x0a, 0x05, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x6f, - 0x75, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x6f, 0x6c, 0x6f, 0x75, 0x72, - 0x12, 0x14, 0x0a, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x46, 0x0a, 0x0a, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x22, 0x0a, 0x06, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x52, 0x06, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x38, - 0x0a, 0x10, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x47, 0x65, 0x6f, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x4c, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, - 0x03, 0x4c, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x6f, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x02, 0x52, 0x04, 0x4c, 0x6f, 0x6e, 0x67, 0x22, 0x33, 0x0a, 0x0b, 0x47, 0x65, 0x6f, 0x4c, - 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x4c, 0x61, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x02, 0x52, 0x03, 0x4c, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x6f, 0x6e, - 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x04, 0x4c, 0x6f, 0x6e, 0x67, 0x22, 0x43, 0x0a, - 0x09, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x12, 0x0a, 0x02, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, 0x44, 0x12, 0x22, - 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, - 0x73, 0x68, 0x22, 0x6d, 0x0a, 0x09, 0x54, 0x65, 0x61, 0x6d, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, - 0x2d, 0x0a, 0x08, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x42, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x42, 0x69, 0x67, 0x12, 0x31, - 0x0a, 0x0a, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x53, 0x6d, 0x61, 0x6c, - 0x6c, 0x22, 0xfa, 0x01, 0x0a, 0x04, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x12, 0x0a, 0x02, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, 0x49, 0x44, 0x12, 0x12, - 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x44, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x6f, 0x72, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, - 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x24, 0x0a, 0x05, 0x46, 0x6c, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, 0x65, - 0x61, 0x6d, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x05, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x1a, - 0x0a, 0x08, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x43, 0x6f, - 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x43, - 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x74, - 0x6f, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, 0x65, - 0x61, 0x6d, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x2a, 0x99, - 0x01, 0x0a, 0x0c, 0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x16, 0x0a, 0x12, 0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x79, 0x70, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x79, 0x70, 0x69, 0x6e, - 0x67, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x67, - 0x56, 0x6f, 0x69, 0x63, 0x65, 0x10, 0x01, 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x79, 0x70, 0x69, 0x6e, - 0x67, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x67, - 0x56, 0x69, 0x64, 0x65, 0x6f, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x54, 0x79, 0x70, 0x69, 0x6e, - 0x67, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, - 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x10, 0x04, 0x2a, 0x5c, 0x0a, 0x08, 0x50, 0x65, - 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x53, 0x65, - 0x6c, 0x66, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, - 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x50, 0x65, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x10, - 0x02, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x65, 0x65, 0x72, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x55, 0x73, 0x65, 0x72, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x43, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x10, 0x04, 0x2a, 0x82, 0x01, 0x0a, 0x0a, 0x55, 0x73, 0x65, - 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x15, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x4f, 0x66, 0x66, 0x6c, 0x69, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x14, - 0x0a, 0x10, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4f, 0x6e, 0x6c, 0x69, - 0x6e, 0x65, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, - 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4c, 0x61, 0x73, 0x74, 0x57, 0x65, - 0x65, 0x6b, 0x10, 0x03, 0x12, 0x17, 0x0a, 0x13, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x4c, 0x61, 0x73, 0x74, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x10, 0x04, 0x2a, 0xa0, 0x02, - 0x0a, 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x13, 0x0a, 0x0f, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, - 0x00, 0x12, 0x15, 0x0a, 0x11, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x4e, 0x6f, 0x6e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, - 0x70, 0x61, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, - 0x6c, 0x61, 0x67, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x10, 0x03, 0x12, 0x1b, 0x0a, 0x17, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x73, 0x45, - 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x10, 0x04, 0x12, 0x19, 0x0a, 0x15, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x44, 0x65, 0x61, 0x63, 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, - 0x64, 0x10, 0x05, 0x12, 0x17, 0x0a, 0x13, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, - 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x10, 0x06, 0x12, 0x17, 0x0a, 0x13, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x31, 0x10, 0x07, 0x12, 0x17, 0x0a, 0x13, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, - 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x10, 0x08, 0x12, 0x17, - 0x0a, 0x13, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x33, 0x10, 0x09, 0x12, 0x17, 0x0a, 0x13, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x34, 0x10, 0x0a, - 0x2a, 0x62, 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, - 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x10, 0x00, 0x12, 0x18, - 0x0a, 0x14, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x54, 0x79, 0x70, - 0x65, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x61, 0x72, 0x74, - 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x6f, 0x72, 0x10, 0x02, 0x2a, 0xc3, 0x03, 0x0a, 0x0e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0x00, - 0x12, 0x19, 0x0a, 0x15, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, - 0x70, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x49, - 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x50, 0x6f, 0x6c, - 0x6c, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x10, 0x03, 0x12, 0x22, - 0x0a, 0x1e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, - 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x1a, 0x0a, 0x16, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x54, 0x79, 0x70, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x12, 0x1d, - 0x0a, 0x19, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, - 0x47, 0x65, 0x6f, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x06, 0x12, 0x1d, 0x0a, - 0x19, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x57, - 0x65, 0x62, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x07, 0x12, 0x18, 0x0a, 0x14, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x53, 0x65, - 0x61, 0x6c, 0x65, 0x64, 0x10, 0x08, 0x12, 0x21, 0x0a, 0x1d, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, - 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x09, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x6e, 0x70, - 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x34, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x35, 0x10, 0x0b, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x36, 0x10, 0x0c, - 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x37, 0x10, 0x0d, 0x12, 0x1b, 0x0a, - 0x17, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x38, 0x10, 0x0e, 0x2a, 0xce, 0x02, 0x0a, 0x09, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x65, 0x64, 0x69, - 0x61, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x50, 0x6f, 0x6c, 0x6c, 0x10, 0x01, 0x12, - 0x15, 0x0a, 0x11, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x44, 0x6f, 0x63, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x10, 0x03, 0x12, 0x18, 0x0a, 0x14, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x47, 0x65, 0x6f, 0x4c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x10, 0x05, 0x12, 0x18, 0x0a, 0x14, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x57, 0x65, 0x62, 0x44, 0x6f, 0x63, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x06, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, - 0x79, 0x70, 0x65, 0x53, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x10, 0x07, 0x12, 0x16, 0x0a, 0x12, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x31, 0x10, 0x08, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x10, 0x09, 0x12, 0x16, 0x0a, 0x12, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x33, 0x10, 0x0a, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x34, 0x10, 0x0b, 0x12, 0x16, 0x0a, 0x12, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x35, 0x10, 0x0c, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x36, 0x10, 0x0d, 0x2a, 0xa5, 0x03, 0x0a, 0x0d, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x12, 0x15, 0x0a, - 0x11, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x4e, 0x6f, - 0x6e, 0x65, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, - 0x65, 0x67, 0x6f, 0x72, 0x79, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x56, 0x6f, 0x69, - 0x63, 0x65, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, - 0x65, 0x67, 0x6f, 0x72, 0x79, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, - 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x46, 0x69, 0x6c, - 0x65, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, - 0x67, 0x6f, 0x72, 0x79, 0x47, 0x69, 0x66, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x57, 0x65, 0x62, 0x10, 0x06, 0x12, - 0x18, 0x0a, 0x14, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, - 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x10, 0x07, 0x12, 0x19, 0x0a, 0x15, 0x4d, 0x65, 0x64, - 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x10, 0x08, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, - 0x65, 0x67, 0x6f, 0x72, 0x79, 0x50, 0x6f, 0x6c, 0x6c, 0x10, 0x09, 0x12, 0x1a, 0x0a, 0x16, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x30, 0x10, 0x0a, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x31, 0x10, 0x0b, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, - 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x10, 0x0c, 0x12, - 0x1a, 0x0a, 0x16, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x33, 0x10, 0x0d, 0x12, 0x1a, 0x0a, 0x16, 0x4d, - 0x65, 0x64, 0x69, 0x61, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x34, 0x10, 0x0e, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x65, 0x64, 0x69, 0x61, - 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x35, 0x10, 0x0f, 0x2a, 0xba, 0x03, 0x0a, 0x11, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x42, 0x6f, - 0x6c, 0x64, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x10, - 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, - 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x02, 0x12, - 0x18, 0x0a, 0x14, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x54, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x45, 0x6d, - 0x61, 0x69, 0x6c, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x48, 0x61, 0x73, 0x68, 0x54, 0x61, - 0x67, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, - 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x10, 0x06, 0x12, 0x1f, - 0x0a, 0x1b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, - 0x79, 0x70, 0x65, 0x42, 0x6f, 0x74, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x10, 0x07, 0x12, - 0x1f, 0x0a, 0x1b, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, - 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x6e, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6c, 0x6c, 0x10, 0x08, - 0x12, 0x1e, 0x0a, 0x1a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x34, 0x10, 0x09, - 0x12, 0x1e, 0x0a, 0x1a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x35, 0x10, 0x0a, - 0x12, 0x1e, 0x0a, 0x1a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x36, 0x10, 0x0b, - 0x12, 0x1e, 0x0a, 0x1a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x37, 0x10, 0x0c, - 0x12, 0x1e, 0x0a, 0x1a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x38, 0x10, 0x0d, - 0x2a, 0x52, 0x0a, 0x11, 0x50, 0x75, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x75, 0x73, 0x68, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x46, 0x69, 0x72, 0x65, 0x62, 0x61, 0x73, 0x65, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, - 0x50, 0x75, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x41, 0x70, 0x6e, 0x10, 0x01, 0x12, 0x14, - 0x0a, 0x10, 0x50, 0x75, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x75, 0x73, 0x68, 0x4b, - 0x69, 0x74, 0x10, 0x02, 0x2a, 0xd3, 0x02, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, - 0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, 0x65, - 0x79, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x50, 0x72, 0x69, 0x76, 0x61, - 0x63, 0x79, 0x4b, 0x65, 0x79, 0x43, 0x68, 0x61, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x10, - 0x01, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x4c, - 0x61, 0x73, 0x74, 0x53, 0x65, 0x65, 0x6e, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x50, 0x72, 0x69, - 0x76, 0x61, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x10, 0x03, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, - 0x65, 0x79, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x10, 0x04, - 0x12, 0x1e, 0x0a, 0x1a, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x46, 0x6f, - 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x10, 0x05, - 0x12, 0x12, 0x0a, 0x0e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x43, 0x61, - 0x6c, 0x6c, 0x10, 0x06, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, - 0x65, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x10, 0x07, 0x12, 0x17, 0x0a, - 0x13, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x32, 0x10, 0x08, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, - 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x33, 0x10, 0x09, 0x12, - 0x17, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x34, 0x10, 0x0a, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, - 0x61, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x35, 0x10, - 0x0b, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x4b, 0x65, 0x79, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x36, 0x10, 0x0c, 0x2a, 0x99, 0x01, 0x0a, 0x0b, 0x50, - 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x72, - 0x69, 0x76, 0x61, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, - 0x6c, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x54, 0x79, - 0x70, 0x65, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x73, 0x10, - 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, - 0x44, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x6c, 0x10, 0x02, 0x12, 0x19, 0x0a, - 0x15, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x41, 0x6c, 0x6c, 0x6f, - 0x77, 0x55, 0x73, 0x65, 0x72, 0x73, 0x10, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x72, 0x69, 0x76, - 0x61, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x44, 0x69, 0x73, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x55, - 0x73, 0x65, 0x72, 0x73, 0x10, 0x66, 0x2a, 0xc1, 0x01, 0x0a, 0x09, 0x54, 0x65, 0x61, 0x6d, 0x46, - 0x6c, 0x61, 0x67, 0x73, 0x12, 0x12, 0x0a, 0x0e, 0x54, 0x65, 0x61, 0x6d, 0x46, 0x6c, 0x61, 0x67, - 0x73, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x65, 0x61, 0x6d, - 0x46, 0x6c, 0x61, 0x67, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x12, - 0x0a, 0x0e, 0x54, 0x65, 0x61, 0x6d, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x65, 0x61, 0x6d, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x65, - 0x61, 0x6d, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, - 0x10, 0x04, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x65, 0x61, 0x6d, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x33, 0x10, 0x05, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x65, - 0x61, 0x6d, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x34, - 0x10, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x65, 0x61, 0x6d, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x35, 0x10, 0x07, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, - 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_core_types_proto_rawDescOnce sync.Once - file_core_types_proto_rawDescData = file_core_types_proto_rawDesc -) - -func file_core_types_proto_rawDescGZIP() []byte { - file_core_types_proto_rawDescOnce.Do(func() { - file_core_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_core_types_proto_rawDescData) - }) - return file_core_types_proto_rawDescData -} - -var file_core_types_proto_enumTypes = make([]protoimpl.EnumInfo, 13) -var file_core_types_proto_msgTypes = make([]protoimpl.MessageInfo, 45) -var file_core_types_proto_goTypes = []interface{}{ - (TypingAction)(0), // 0: msg.TypingAction - (PeerType)(0), // 1: msg.PeerType - (UserStatus)(0), // 2: msg.UserStatus - (GroupFlags)(0), // 3: msg.GroupFlags - (ParticipantType)(0), // 4: msg.ParticipantType - (InputMediaType)(0), // 5: msg.InputMediaType - (MediaType)(0), // 6: msg.MediaType - (MediaCategory)(0), // 7: msg.MediaCategory - (MessageEntityType)(0), // 8: msg.MessageEntityType - (PushTokenProvider)(0), // 9: msg.PushTokenProvider - (PrivacyKey)(0), // 10: msg.PrivacyKey - (PrivacyType)(0), // 11: msg.PrivacyType - (TeamFlags)(0), // 12: msg.TeamFlags - (*Ping)(nil), // 13: msg.Ping - (*Pong)(nil), // 14: msg.Pong - (*UpdateEnvelope)(nil), // 15: msg.UpdateEnvelope - (*UpdateContainer)(nil), // 16: msg.UpdateContainer - (*ProtoMessage)(nil), // 17: msg.ProtoMessage - (*ProtoEncryptedPayload)(nil), // 18: msg.ProtoEncryptedPayload - (*Ack)(nil), // 19: msg.Ack - (*Bool)(nil), // 20: msg.Bool - (*Dialog)(nil), // 21: msg.Dialog - (*InputPeer)(nil), // 22: msg.InputPeer - (*Peer)(nil), // 23: msg.Peer - (*InputPassword)(nil), // 24: msg.InputPassword - (*InputFileLocation)(nil), // 25: msg.InputFileLocation - (*FileLocation)(nil), // 26: msg.FileLocation - (*WebLocation)(nil), // 27: msg.WebLocation - (*InputWebLocation)(nil), // 28: msg.InputWebLocation - (*UserPhoto)(nil), // 29: msg.UserPhoto - (*InputUser)(nil), // 30: msg.InputUser - (*User)(nil), // 31: msg.User - (*ContactUser)(nil), // 32: msg.ContactUser - (*Bot)(nil), // 33: msg.Bot - (*BotCommands)(nil), // 34: msg.BotCommands - (*BotInfo)(nil), // 35: msg.BotInfo - (*GroupPhoto)(nil), // 36: msg.GroupPhoto - (*Group)(nil), // 37: msg.Group - (*GroupFull)(nil), // 38: msg.GroupFull - (*GroupParticipant)(nil), // 39: msg.GroupParticipant - (*UserMessage)(nil), // 40: msg.UserMessage - (*ReactionCounter)(nil), // 41: msg.ReactionCounter - (*DraftMessage)(nil), // 42: msg.DraftMessage - (*MessageEntity)(nil), // 43: msg.MessageEntity - (*RSAPublicKey)(nil), // 44: msg.RSAPublicKey - (*DHGroup)(nil), // 45: msg.DHGroup - (*PhoneContact)(nil), // 46: msg.PhoneContact - (*PeerNotifySettings)(nil), // 47: msg.PeerNotifySettings - (*InputFile)(nil), // 48: msg.InputFile - (*InputDocument)(nil), // 49: msg.InputDocument - (*PrivacyRule)(nil), // 50: msg.PrivacyRule - (*Label)(nil), // 51: msg.Label - (*LabelsMany)(nil), // 52: msg.LabelsMany - (*InputGeoLocation)(nil), // 53: msg.InputGeoLocation - (*GeoLocation)(nil), // 54: msg.GeoLocation - (*InputTeam)(nil), // 55: msg.InputTeam - (*TeamPhoto)(nil), // 56: msg.TeamPhoto - (*Team)(nil), // 57: msg.Team - (*rony.MessageEnvelope)(nil), // 58: rony.MessageEnvelope -} -var file_core_types_proto_depIdxs = []int32{ - 15, // 0: msg.UpdateContainer.Updates:type_name -> msg.UpdateEnvelope - 31, // 1: msg.UpdateContainer.Users:type_name -> msg.User - 37, // 2: msg.UpdateContainer.Groups:type_name -> msg.Group - 58, // 3: msg.ProtoEncryptedPayload.Envelope:type_name -> rony.MessageEnvelope - 47, // 4: msg.Dialog.NotifySettings:type_name -> msg.PeerNotifySettings - 42, // 5: msg.Dialog.Draft:type_name -> msg.DraftMessage - 1, // 6: msg.InputPeer.Type:type_name -> msg.PeerType - 26, // 7: msg.UserPhoto.PhotoBig:type_name -> msg.FileLocation - 26, // 8: msg.UserPhoto.PhotoSmall:type_name -> msg.FileLocation - 27, // 9: msg.UserPhoto.PhotoBigWeb:type_name -> msg.WebLocation - 27, // 10: msg.UserPhoto.PhotoSmallWeb:type_name -> msg.WebLocation - 2, // 11: msg.User.Status:type_name -> msg.UserStatus - 29, // 12: msg.User.Photo:type_name -> msg.UserPhoto - 29, // 13: msg.User.PhotoGallery:type_name -> msg.UserPhoto - 35, // 14: msg.User.BotInfo:type_name -> msg.BotInfo - 29, // 15: msg.ContactUser.Photo:type_name -> msg.UserPhoto - 33, // 16: msg.BotInfo.Bot:type_name -> msg.Bot - 34, // 17: msg.BotInfo.BotCommands:type_name -> msg.BotCommands - 26, // 18: msg.GroupPhoto.PhotoBig:type_name -> msg.FileLocation - 26, // 19: msg.GroupPhoto.PhotoSmall:type_name -> msg.FileLocation - 3, // 20: msg.Group.Flags:type_name -> msg.GroupFlags - 36, // 21: msg.Group.Photo:type_name -> msg.GroupPhoto - 37, // 22: msg.GroupFull.Group:type_name -> msg.Group - 31, // 23: msg.GroupFull.Users:type_name -> msg.User - 39, // 24: msg.GroupFull.Participants:type_name -> msg.GroupParticipant - 47, // 25: msg.GroupFull.NotifySettings:type_name -> msg.PeerNotifySettings - 36, // 26: msg.GroupFull.PhotoGallery:type_name -> msg.GroupPhoto - 4, // 27: msg.GroupParticipant.Type:type_name -> msg.ParticipantType - 29, // 28: msg.GroupParticipant.Photo:type_name -> msg.UserPhoto - 43, // 29: msg.UserMessage.Entities:type_name -> msg.MessageEntity - 6, // 30: msg.UserMessage.MediaType:type_name -> msg.MediaType - 41, // 31: msg.UserMessage.Reactions:type_name -> msg.ReactionCounter - 7, // 32: msg.UserMessage.MediaCat:type_name -> msg.MediaCategory - 43, // 33: msg.DraftMessage.Entities:type_name -> msg.MessageEntity - 8, // 34: msg.MessageEntity.Type:type_name -> msg.MessageEntityType - 11, // 35: msg.PrivacyRule.PrivacyType:type_name -> msg.PrivacyType - 51, // 36: msg.LabelsMany.Labels:type_name -> msg.Label - 26, // 37: msg.TeamPhoto.PhotoBig:type_name -> msg.FileLocation - 26, // 38: msg.TeamPhoto.PhotoSmall:type_name -> msg.FileLocation - 12, // 39: msg.Team.Flags:type_name -> msg.TeamFlags - 56, // 40: msg.Team.Photo:type_name -> msg.TeamPhoto - 41, // [41:41] is the sub-list for method output_type - 41, // [41:41] is the sub-list for method input_type - 41, // [41:41] is the sub-list for extension type_name - 41, // [41:41] is the sub-list for extension extendee - 0, // [0:41] is the sub-list for field type_name -} - -func init() { file_core_types_proto_init() } -func file_core_types_proto_init() { - if File_core_types_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_core_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Ping); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Pong); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateEnvelope); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateContainer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProtoMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProtoEncryptedPayload); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Ack); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Bool); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Dialog); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputPeer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Peer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputPassword); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputFileLocation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileLocation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebLocation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputWebLocation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*User); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ContactUser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Bot); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotCommands); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*BotInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Group); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupFull); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GroupParticipant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ReactionCounter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DraftMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MessageEntity); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*RSAPublicKey); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DHGroup); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PhoneContact); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerNotifySettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputFile); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputDocument); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PrivacyRule); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Label); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LabelsMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputGeoLocation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GeoLocation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InputTeam); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_core_types_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Team); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_core_types_proto_rawDesc, - NumEnums: 13, - NumMessages: 45, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_core_types_proto_goTypes, - DependencyIndexes: file_core_types_proto_depIdxs, - EnumInfos: file_core_types_proto_enumTypes, - MessageInfos: file_core_types_proto_msgTypes, - }.Build() - File_core_types_proto = out.File - file_core_types_proto_rawDesc = nil - file_core_types_proto_goTypes = nil - file_core_types_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/core.types.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/core.types.rony.go deleted file mode 100644 index f7773c47..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/core.types.rony.go +++ /dev/null @@ -1,3286 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: core.types.proto - -package msg - -import ( - bytes "bytes" - rony "github.com/ronaksoft/rony" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_Ping int64 = 2246546115 - -type poolPing struct { - pool sync.Pool -} - -func (p *poolPing) Get() *Ping { - x, ok := p.pool.Get().(*Ping) - if !ok { - x = &Ping{} - } - - return x -} - -func (p *poolPing) Put(x *Ping) { - if x == nil { - return - } - - x.ID = 0 - - p.pool.Put(x) -} - -var PoolPing = poolPing{} - -func (x *Ping) DeepCopy(z *Ping) { - z.ID = x.ID -} - -func (x *Ping) Clone() *Ping { - z := &Ping{} - x.DeepCopy(z) - return z -} - -func (x *Ping) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Ping) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Ping) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Ping) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Ping) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Ping, x) -} - -const C_Pong int64 = 2171268721 - -type poolPong struct { - pool sync.Pool -} - -func (p *poolPong) Get() *Pong { - x, ok := p.pool.Get().(*Pong) - if !ok { - x = &Pong{} - } - - return x -} - -func (p *poolPong) Put(x *Pong) { - if x == nil { - return - } - - x.ID = 0 - - p.pool.Put(x) -} - -var PoolPong = poolPong{} - -func (x *Pong) DeepCopy(z *Pong) { - z.ID = x.ID -} - -func (x *Pong) Clone() *Pong { - z := &Pong{} - x.DeepCopy(z) - return z -} - -func (x *Pong) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Pong) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Pong) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Pong) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Pong) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Pong, x) -} - -const C_UpdateEnvelope int64 = 2373884514 - -type poolUpdateEnvelope struct { - pool sync.Pool -} - -func (p *poolUpdateEnvelope) Get() *UpdateEnvelope { - x, ok := p.pool.Get().(*UpdateEnvelope) - if !ok { - x = &UpdateEnvelope{} - } - - return x -} - -func (p *poolUpdateEnvelope) Put(x *UpdateEnvelope) { - if x == nil { - return - } - - x.Constructor = 0 - x.Update = x.Update[:0] - x.UCount = 0 - x.UpdateID = 0 - x.Timestamp = 0 - x.Deadline = 0 - - p.pool.Put(x) -} - -var PoolUpdateEnvelope = poolUpdateEnvelope{} - -func (x *UpdateEnvelope) DeepCopy(z *UpdateEnvelope) { - z.Constructor = x.Constructor - z.Update = append(z.Update[:0], x.Update...) - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.Timestamp = x.Timestamp - z.Deadline = x.Deadline -} - -func (x *UpdateEnvelope) Clone() *UpdateEnvelope { - z := &UpdateEnvelope{} - x.DeepCopy(z) - return z -} - -func (x *UpdateEnvelope) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateEnvelope) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateEnvelope) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateEnvelope) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateEnvelope) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateEnvelope, x) -} - -const C_UpdateContainer int64 = 661712615 - -type poolUpdateContainer struct { - pool sync.Pool -} - -func (p *poolUpdateContainer) Get() *UpdateContainer { - x, ok := p.pool.Get().(*UpdateContainer) - if !ok { - x = &UpdateContainer{} - } - - return x -} - -func (p *poolUpdateContainer) Put(x *UpdateContainer) { - if x == nil { - return - } - - x.Length = 0 - for _, z := range x.Updates { - PoolUpdateEnvelope.Put(z) - } - x.Updates = x.Updates[:0] - x.MinUpdateID = 0 - x.MaxUpdateID = 0 - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Groups { - PoolGroup.Put(z) - } - x.Groups = x.Groups[:0] - - p.pool.Put(x) -} - -var PoolUpdateContainer = poolUpdateContainer{} - -func (x *UpdateContainer) DeepCopy(z *UpdateContainer) { - z.Length = x.Length - for idx := range x.Updates { - if x.Updates[idx] == nil { - continue - } - xx := PoolUpdateEnvelope.Get() - x.Updates[idx].DeepCopy(xx) - z.Updates = append(z.Updates, xx) - } - z.MinUpdateID = x.MinUpdateID - z.MaxUpdateID = x.MaxUpdateID - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Groups { - if x.Groups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.Groups[idx].DeepCopy(xx) - z.Groups = append(z.Groups, xx) - } -} - -func (x *UpdateContainer) Clone() *UpdateContainer { - z := &UpdateContainer{} - x.DeepCopy(z) - return z -} - -func (x *UpdateContainer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateContainer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateContainer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateContainer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateContainer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateContainer, x) -} - -const C_ProtoMessage int64 = 2179260159 - -type poolProtoMessage struct { - pool sync.Pool -} - -func (p *poolProtoMessage) Get() *ProtoMessage { - x, ok := p.pool.Get().(*ProtoMessage) - if !ok { - x = &ProtoMessage{} - } - - return x -} - -func (p *poolProtoMessage) Put(x *ProtoMessage) { - if x == nil { - return - } - - x.AuthID = 0 - x.MessageKey = x.MessageKey[:0] - x.Payload = x.Payload[:0] - - p.pool.Put(x) -} - -var PoolProtoMessage = poolProtoMessage{} - -func (x *ProtoMessage) DeepCopy(z *ProtoMessage) { - z.AuthID = x.AuthID - z.MessageKey = append(z.MessageKey[:0], x.MessageKey...) - z.Payload = append(z.Payload[:0], x.Payload...) -} - -func (x *ProtoMessage) Clone() *ProtoMessage { - z := &ProtoMessage{} - x.DeepCopy(z) - return z -} - -func (x *ProtoMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ProtoMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ProtoMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ProtoMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ProtoMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ProtoMessage, x) -} - -const C_ProtoEncryptedPayload int64 = 2668405547 - -type poolProtoEncryptedPayload struct { - pool sync.Pool -} - -func (p *poolProtoEncryptedPayload) Get() *ProtoEncryptedPayload { - x, ok := p.pool.Get().(*ProtoEncryptedPayload) - if !ok { - x = &ProtoEncryptedPayload{} - } - - x.Envelope = rony.PoolMessageEnvelope.Get() - - return x -} - -func (p *poolProtoEncryptedPayload) Put(x *ProtoEncryptedPayload) { - if x == nil { - return - } - - x.ServerSalt = 0 - x.MessageID = 0 - x.SessionID = 0 - rony.PoolMessageEnvelope.Put(x.Envelope) - - p.pool.Put(x) -} - -var PoolProtoEncryptedPayload = poolProtoEncryptedPayload{} - -func (x *ProtoEncryptedPayload) DeepCopy(z *ProtoEncryptedPayload) { - z.ServerSalt = x.ServerSalt - z.MessageID = x.MessageID - z.SessionID = x.SessionID - if x.Envelope != nil { - if z.Envelope == nil { - z.Envelope = rony.PoolMessageEnvelope.Get() - } - x.Envelope.DeepCopy(z.Envelope) - } else { - rony.PoolMessageEnvelope.Put(z.Envelope) - z.Envelope = nil - } -} - -func (x *ProtoEncryptedPayload) Clone() *ProtoEncryptedPayload { - z := &ProtoEncryptedPayload{} - x.DeepCopy(z) - return z -} - -func (x *ProtoEncryptedPayload) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ProtoEncryptedPayload) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ProtoEncryptedPayload) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ProtoEncryptedPayload) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ProtoEncryptedPayload) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ProtoEncryptedPayload, x) -} - -const C_Ack int64 = 447331921 - -type poolAck struct { - pool sync.Pool -} - -func (p *poolAck) Get() *Ack { - x, ok := p.pool.Get().(*Ack) - if !ok { - x = &Ack{} - } - - return x -} - -func (p *poolAck) Put(x *Ack) { - if x == nil { - return - } - - x.MessageIDs = x.MessageIDs[:0] - - p.pool.Put(x) -} - -var PoolAck = poolAck{} - -func (x *Ack) DeepCopy(z *Ack) { - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) -} - -func (x *Ack) Clone() *Ack { - z := &Ack{} - x.DeepCopy(z) - return z -} - -func (x *Ack) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Ack) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Ack) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Ack) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Ack) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Ack, x) -} - -const C_Bool int64 = 4122188204 - -type poolBool struct { - pool sync.Pool -} - -func (p *poolBool) Get() *Bool { - x, ok := p.pool.Get().(*Bool) - if !ok { - x = &Bool{} - } - - return x -} - -func (p *poolBool) Put(x *Bool) { - if x == nil { - return - } - - x.Result = false - - p.pool.Put(x) -} - -var PoolBool = poolBool{} - -func (x *Bool) DeepCopy(z *Bool) { - z.Result = x.Result -} - -func (x *Bool) Clone() *Bool { - z := &Bool{} - x.DeepCopy(z) - return z -} - -func (x *Bool) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Bool) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Bool) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Bool) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Bool) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Bool, x) -} - -const C_Dialog int64 = 1120787796 - -type poolDialog struct { - pool sync.Pool -} - -func (p *poolDialog) Get() *Dialog { - x, ok := p.pool.Get().(*Dialog) - if !ok { - x = &Dialog{} - } - - x.NotifySettings = PoolPeerNotifySettings.Get() - - x.Draft = PoolDraftMessage.Get() - - return x -} - -func (p *poolDialog) Put(x *Dialog) { - if x == nil { - return - } - - x.TeamID = 0 - x.PeerID = 0 - x.PeerType = 0 - x.TopMessageID = 0 - x.ReadInboxMaxID = 0 - x.ReadOutboxMaxID = 0 - x.UnreadCount = 0 - x.AccessHash = 0 - PoolPeerNotifySettings.Put(x.NotifySettings) - x.MentionedCount = 0 - x.Pinned = false - PoolDraftMessage.Put(x.Draft) - x.PinnedMessageID = 0 - x.ActiveCallID = 0 - x.ReadOnly = false - - p.pool.Put(x) -} - -var PoolDialog = poolDialog{} - -func (x *Dialog) DeepCopy(z *Dialog) { - z.TeamID = x.TeamID - z.PeerID = x.PeerID - z.PeerType = x.PeerType - z.TopMessageID = x.TopMessageID - z.ReadInboxMaxID = x.ReadInboxMaxID - z.ReadOutboxMaxID = x.ReadOutboxMaxID - z.UnreadCount = x.UnreadCount - z.AccessHash = x.AccessHash - if x.NotifySettings != nil { - if z.NotifySettings == nil { - z.NotifySettings = PoolPeerNotifySettings.Get() - } - x.NotifySettings.DeepCopy(z.NotifySettings) - } else { - PoolPeerNotifySettings.Put(z.NotifySettings) - z.NotifySettings = nil - } - z.MentionedCount = x.MentionedCount - z.Pinned = x.Pinned - if x.Draft != nil { - if z.Draft == nil { - z.Draft = PoolDraftMessage.Get() - } - x.Draft.DeepCopy(z.Draft) - } else { - PoolDraftMessage.Put(z.Draft) - z.Draft = nil - } - z.PinnedMessageID = x.PinnedMessageID - z.ActiveCallID = x.ActiveCallID - z.ReadOnly = x.ReadOnly -} - -func (x *Dialog) Clone() *Dialog { - z := &Dialog{} - x.DeepCopy(z) - return z -} - -func (x *Dialog) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Dialog) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Dialog) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Dialog) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Dialog) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Dialog, x) -} - -const C_InputPeer int64 = 3374092470 - -type poolInputPeer struct { - pool sync.Pool -} - -func (p *poolInputPeer) Get() *InputPeer { - x, ok := p.pool.Get().(*InputPeer) - if !ok { - x = &InputPeer{} - } - - return x -} - -func (p *poolInputPeer) Put(x *InputPeer) { - if x == nil { - return - } - - x.ID = 0 - x.Type = 0 - x.AccessHash = 0 - - p.pool.Put(x) -} - -var PoolInputPeer = poolInputPeer{} - -func (x *InputPeer) DeepCopy(z *InputPeer) { - z.ID = x.ID - z.Type = x.Type - z.AccessHash = x.AccessHash -} - -func (x *InputPeer) Clone() *InputPeer { - z := &InputPeer{} - x.DeepCopy(z) - return z -} - -func (x *InputPeer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputPeer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputPeer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputPeer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputPeer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputPeer, x) -} - -const C_Peer int64 = 47470215 - -type poolPeer struct { - pool sync.Pool -} - -func (p *poolPeer) Get() *Peer { - x, ok := p.pool.Get().(*Peer) - if !ok { - x = &Peer{} - } - - return x -} - -func (p *poolPeer) Put(x *Peer) { - if x == nil { - return - } - - x.ID = 0 - x.Type = 0 - x.AccessHash = 0 - - p.pool.Put(x) -} - -var PoolPeer = poolPeer{} - -func (x *Peer) DeepCopy(z *Peer) { - z.ID = x.ID - z.Type = x.Type - z.AccessHash = x.AccessHash -} - -func (x *Peer) Clone() *Peer { - z := &Peer{} - x.DeepCopy(z) - return z -} - -func (x *Peer) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Peer) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Peer) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Peer) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Peer) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Peer, x) -} - -const C_InputPassword int64 = 513021899 - -type poolInputPassword struct { - pool sync.Pool -} - -func (p *poolInputPassword) Get() *InputPassword { - x, ok := p.pool.Get().(*InputPassword) - if !ok { - x = &InputPassword{} - } - - return x -} - -func (p *poolInputPassword) Put(x *InputPassword) { - if x == nil { - return - } - - x.SrpID = 0 - x.A = x.A[:0] - x.M1 = x.M1[:0] - - p.pool.Put(x) -} - -var PoolInputPassword = poolInputPassword{} - -func (x *InputPassword) DeepCopy(z *InputPassword) { - z.SrpID = x.SrpID - z.A = append(z.A[:0], x.A...) - z.M1 = append(z.M1[:0], x.M1...) -} - -func (x *InputPassword) Clone() *InputPassword { - z := &InputPassword{} - x.DeepCopy(z) - return z -} - -func (x *InputPassword) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputPassword) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputPassword) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputPassword) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputPassword) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputPassword, x) -} - -const C_InputFileLocation int64 = 354669666 - -type poolInputFileLocation struct { - pool sync.Pool -} - -func (p *poolInputFileLocation) Get() *InputFileLocation { - x, ok := p.pool.Get().(*InputFileLocation) - if !ok { - x = &InputFileLocation{} - } - - return x -} - -func (p *poolInputFileLocation) Put(x *InputFileLocation) { - if x == nil { - return - } - - x.ClusterID = 0 - x.FileID = 0 - x.AccessHash = 0 - x.Version = 0 - - p.pool.Put(x) -} - -var PoolInputFileLocation = poolInputFileLocation{} - -func (x *InputFileLocation) DeepCopy(z *InputFileLocation) { - z.ClusterID = x.ClusterID - z.FileID = x.FileID - z.AccessHash = x.AccessHash - z.Version = x.Version -} - -func (x *InputFileLocation) Clone() *InputFileLocation { - z := &InputFileLocation{} - x.DeepCopy(z) - return z -} - -func (x *InputFileLocation) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputFileLocation) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputFileLocation) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputFileLocation) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputFileLocation) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputFileLocation, x) -} - -const C_FileLocation int64 = 2432133155 - -type poolFileLocation struct { - pool sync.Pool -} - -func (p *poolFileLocation) Get() *FileLocation { - x, ok := p.pool.Get().(*FileLocation) - if !ok { - x = &FileLocation{} - } - - return x -} - -func (p *poolFileLocation) Put(x *FileLocation) { - if x == nil { - return - } - - x.ClusterID = 0 - x.FileID = 0 - x.AccessHash = 0 - - p.pool.Put(x) -} - -var PoolFileLocation = poolFileLocation{} - -func (x *FileLocation) DeepCopy(z *FileLocation) { - z.ClusterID = x.ClusterID - z.FileID = x.FileID - z.AccessHash = x.AccessHash -} - -func (x *FileLocation) Clone() *FileLocation { - z := &FileLocation{} - x.DeepCopy(z) - return z -} - -func (x *FileLocation) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *FileLocation) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *FileLocation) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *FileLocation) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *FileLocation) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_FileLocation, x) -} - -const C_WebLocation int64 = 3180538793 - -type poolWebLocation struct { - pool sync.Pool -} - -func (p *poolWebLocation) Get() *WebLocation { - x, ok := p.pool.Get().(*WebLocation) - if !ok { - x = &WebLocation{} - } - - return x -} - -func (p *poolWebLocation) Put(x *WebLocation) { - if x == nil { - return - } - - x.Url = "" - - p.pool.Put(x) -} - -var PoolWebLocation = poolWebLocation{} - -func (x *WebLocation) DeepCopy(z *WebLocation) { - z.Url = x.Url -} - -func (x *WebLocation) Clone() *WebLocation { - z := &WebLocation{} - x.DeepCopy(z) - return z -} - -func (x *WebLocation) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *WebLocation) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *WebLocation) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *WebLocation) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *WebLocation) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_WebLocation, x) -} - -const C_InputWebLocation int64 = 203404027 - -type poolInputWebLocation struct { - pool sync.Pool -} - -func (p *poolInputWebLocation) Get() *InputWebLocation { - x, ok := p.pool.Get().(*InputWebLocation) - if !ok { - x = &InputWebLocation{} - } - - return x -} - -func (p *poolInputWebLocation) Put(x *InputWebLocation) { - if x == nil { - return - } - - x.Url = "" - - p.pool.Put(x) -} - -var PoolInputWebLocation = poolInputWebLocation{} - -func (x *InputWebLocation) DeepCopy(z *InputWebLocation) { - z.Url = x.Url -} - -func (x *InputWebLocation) Clone() *InputWebLocation { - z := &InputWebLocation{} - x.DeepCopy(z) - return z -} - -func (x *InputWebLocation) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputWebLocation) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputWebLocation) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputWebLocation) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputWebLocation) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputWebLocation, x) -} - -const C_UserPhoto int64 = 1881347437 - -type poolUserPhoto struct { - pool sync.Pool -} - -func (p *poolUserPhoto) Get() *UserPhoto { - x, ok := p.pool.Get().(*UserPhoto) - if !ok { - x = &UserPhoto{} - } - - x.PhotoBig = PoolFileLocation.Get() - - x.PhotoSmall = PoolFileLocation.Get() - - x.PhotoBigWeb = PoolWebLocation.Get() - - x.PhotoSmallWeb = PoolWebLocation.Get() - - return x -} - -func (p *poolUserPhoto) Put(x *UserPhoto) { - if x == nil { - return - } - - PoolFileLocation.Put(x.PhotoBig) - PoolFileLocation.Put(x.PhotoSmall) - x.PhotoID = 0 - PoolWebLocation.Put(x.PhotoBigWeb) - PoolWebLocation.Put(x.PhotoSmallWeb) - - p.pool.Put(x) -} - -var PoolUserPhoto = poolUserPhoto{} - -func (x *UserPhoto) DeepCopy(z *UserPhoto) { - if x.PhotoBig != nil { - if z.PhotoBig == nil { - z.PhotoBig = PoolFileLocation.Get() - } - x.PhotoBig.DeepCopy(z.PhotoBig) - } else { - PoolFileLocation.Put(z.PhotoBig) - z.PhotoBig = nil - } - if x.PhotoSmall != nil { - if z.PhotoSmall == nil { - z.PhotoSmall = PoolFileLocation.Get() - } - x.PhotoSmall.DeepCopy(z.PhotoSmall) - } else { - PoolFileLocation.Put(z.PhotoSmall) - z.PhotoSmall = nil - } - z.PhotoID = x.PhotoID - if x.PhotoBigWeb != nil { - if z.PhotoBigWeb == nil { - z.PhotoBigWeb = PoolWebLocation.Get() - } - x.PhotoBigWeb.DeepCopy(z.PhotoBigWeb) - } else { - PoolWebLocation.Put(z.PhotoBigWeb) - z.PhotoBigWeb = nil - } - if x.PhotoSmallWeb != nil { - if z.PhotoSmallWeb == nil { - z.PhotoSmallWeb = PoolWebLocation.Get() - } - x.PhotoSmallWeb.DeepCopy(z.PhotoSmallWeb) - } else { - PoolWebLocation.Put(z.PhotoSmallWeb) - z.PhotoSmallWeb = nil - } -} - -func (x *UserPhoto) Clone() *UserPhoto { - z := &UserPhoto{} - x.DeepCopy(z) - return z -} - -func (x *UserPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UserPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UserPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UserPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UserPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UserPhoto, x) -} - -const C_InputUser int64 = 3865689926 - -type poolInputUser struct { - pool sync.Pool -} - -func (p *poolInputUser) Get() *InputUser { - x, ok := p.pool.Get().(*InputUser) - if !ok { - x = &InputUser{} - } - - return x -} - -func (p *poolInputUser) Put(x *InputUser) { - if x == nil { - return - } - - x.UserID = 0 - x.AccessHash = 0 - - p.pool.Put(x) -} - -var PoolInputUser = poolInputUser{} - -func (x *InputUser) DeepCopy(z *InputUser) { - z.UserID = x.UserID - z.AccessHash = x.AccessHash -} - -func (x *InputUser) Clone() *InputUser { - z := &InputUser{} - x.DeepCopy(z) - return z -} - -func (x *InputUser) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputUser) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputUser) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputUser) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputUser) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputUser, x) -} - -const C_User int64 = 765557111 - -type poolUser struct { - pool sync.Pool -} - -func (p *poolUser) Get() *User { - x, ok := p.pool.Get().(*User) - if !ok { - x = &User{} - } - - x.Photo = PoolUserPhoto.Get() - - x.BotInfo = PoolBotInfo.Get() - - return x -} - -func (p *poolUser) Put(x *User) { - if x == nil { - return - } - - x.ID = 0 - x.FirstName = "" - x.LastName = "" - x.Username = "" - x.Status = 0 - x.Restricted = false - x.AccessHash = 0 - PoolUserPhoto.Put(x.Photo) - x.Bio = "" - x.Phone = "" - x.LastSeen = 0 - for _, z := range x.PhotoGallery { - PoolUserPhoto.Put(z) - } - x.PhotoGallery = x.PhotoGallery[:0] - x.IsBot = false - x.Deleted = false - x.Blocked = false - PoolBotInfo.Put(x.BotInfo) - x.Official = false - - p.pool.Put(x) -} - -var PoolUser = poolUser{} - -func (x *User) DeepCopy(z *User) { - z.ID = x.ID - z.FirstName = x.FirstName - z.LastName = x.LastName - z.Username = x.Username - z.Status = x.Status - z.Restricted = x.Restricted - z.AccessHash = x.AccessHash - if x.Photo != nil { - if z.Photo == nil { - z.Photo = PoolUserPhoto.Get() - } - x.Photo.DeepCopy(z.Photo) - } else { - PoolUserPhoto.Put(z.Photo) - z.Photo = nil - } - z.Bio = x.Bio - z.Phone = x.Phone - z.LastSeen = x.LastSeen - for idx := range x.PhotoGallery { - if x.PhotoGallery[idx] == nil { - continue - } - xx := PoolUserPhoto.Get() - x.PhotoGallery[idx].DeepCopy(xx) - z.PhotoGallery = append(z.PhotoGallery, xx) - } - z.IsBot = x.IsBot - z.Deleted = x.Deleted - z.Blocked = x.Blocked - if x.BotInfo != nil { - if z.BotInfo == nil { - z.BotInfo = PoolBotInfo.Get() - } - x.BotInfo.DeepCopy(z.BotInfo) - } else { - PoolBotInfo.Put(z.BotInfo) - z.BotInfo = nil - } - z.Official = x.Official -} - -func (x *User) Clone() *User { - z := &User{} - x.DeepCopy(z) - return z -} - -func (x *User) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *User) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *User) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *User) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *User) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_User, x) -} - -const C_ContactUser int64 = 460099170 - -type poolContactUser struct { - pool sync.Pool -} - -func (p *poolContactUser) Get() *ContactUser { - x, ok := p.pool.Get().(*ContactUser) - if !ok { - x = &ContactUser{} - } - - x.Photo = PoolUserPhoto.Get() - - return x -} - -func (p *poolContactUser) Put(x *ContactUser) { - if x == nil { - return - } - - x.ID = 0 - x.FirstName = "" - x.LastName = "" - x.AccessHash = 0 - x.Phone = "" - x.Username = "" - x.ClientID = 0 - PoolUserPhoto.Put(x.Photo) - - p.pool.Put(x) -} - -var PoolContactUser = poolContactUser{} - -func (x *ContactUser) DeepCopy(z *ContactUser) { - z.ID = x.ID - z.FirstName = x.FirstName - z.LastName = x.LastName - z.AccessHash = x.AccessHash - z.Phone = x.Phone - z.Username = x.Username - z.ClientID = x.ClientID - if x.Photo != nil { - if z.Photo == nil { - z.Photo = PoolUserPhoto.Get() - } - x.Photo.DeepCopy(z.Photo) - } else { - PoolUserPhoto.Put(z.Photo) - z.Photo = nil - } -} - -func (x *ContactUser) Clone() *ContactUser { - z := &ContactUser{} - x.DeepCopy(z) - return z -} - -func (x *ContactUser) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ContactUser) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ContactUser) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ContactUser) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ContactUser) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ContactUser, x) -} - -const C_Bot int64 = 961692401 - -type poolBot struct { - pool sync.Pool -} - -func (p *poolBot) Get() *Bot { - x, ok := p.pool.Get().(*Bot) - if !ok { - x = &Bot{} - } - - return x -} - -func (p *poolBot) Put(x *Bot) { - if x == nil { - return - } - - x.ID = 0 - x.Name = "" - x.Username = "" - x.Bio = "" - - p.pool.Put(x) -} - -var PoolBot = poolBot{} - -func (x *Bot) DeepCopy(z *Bot) { - z.ID = x.ID - z.Name = x.Name - z.Username = x.Username - z.Bio = x.Bio -} - -func (x *Bot) Clone() *Bot { - z := &Bot{} - x.DeepCopy(z) - return z -} - -func (x *Bot) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Bot) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Bot) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Bot) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Bot) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Bot, x) -} - -const C_BotCommands int64 = 1852470005 - -type poolBotCommands struct { - pool sync.Pool -} - -func (p *poolBotCommands) Get() *BotCommands { - x, ok := p.pool.Get().(*BotCommands) - if !ok { - x = &BotCommands{} - } - - return x -} - -func (p *poolBotCommands) Put(x *BotCommands) { - if x == nil { - return - } - - x.Command = "" - x.Description = "" - - p.pool.Put(x) -} - -var PoolBotCommands = poolBotCommands{} - -func (x *BotCommands) DeepCopy(z *BotCommands) { - z.Command = x.Command - z.Description = x.Description -} - -func (x *BotCommands) Clone() *BotCommands { - z := &BotCommands{} - x.DeepCopy(z) - return z -} - -func (x *BotCommands) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotCommands) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotCommands) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotCommands) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotCommands) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotCommands, x) -} - -const C_BotInfo int64 = 4059496923 - -type poolBotInfo struct { - pool sync.Pool -} - -func (p *poolBotInfo) Get() *BotInfo { - x, ok := p.pool.Get().(*BotInfo) - if !ok { - x = &BotInfo{} - } - - x.Bot = PoolBot.Get() - - return x -} - -func (p *poolBotInfo) Put(x *BotInfo) { - if x == nil { - return - } - - PoolBot.Put(x.Bot) - x.UserID = 0 - x.Description = "" - for _, z := range x.BotCommands { - PoolBotCommands.Put(z) - } - x.BotCommands = x.BotCommands[:0] - x.InlineGeo = false - x.InlinePlaceHolder = "" - x.InlineQuery = false - - p.pool.Put(x) -} - -var PoolBotInfo = poolBotInfo{} - -func (x *BotInfo) DeepCopy(z *BotInfo) { - if x.Bot != nil { - if z.Bot == nil { - z.Bot = PoolBot.Get() - } - x.Bot.DeepCopy(z.Bot) - } else { - PoolBot.Put(z.Bot) - z.Bot = nil - } - z.UserID = x.UserID - z.Description = x.Description - for idx := range x.BotCommands { - if x.BotCommands[idx] == nil { - continue - } - xx := PoolBotCommands.Get() - x.BotCommands[idx].DeepCopy(xx) - z.BotCommands = append(z.BotCommands, xx) - } - z.InlineGeo = x.InlineGeo - z.InlinePlaceHolder = x.InlinePlaceHolder - z.InlineQuery = x.InlineQuery -} - -func (x *BotInfo) Clone() *BotInfo { - z := &BotInfo{} - x.DeepCopy(z) - return z -} - -func (x *BotInfo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *BotInfo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *BotInfo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *BotInfo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *BotInfo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_BotInfo, x) -} - -const C_GroupPhoto int64 = 3998516135 - -type poolGroupPhoto struct { - pool sync.Pool -} - -func (p *poolGroupPhoto) Get() *GroupPhoto { - x, ok := p.pool.Get().(*GroupPhoto) - if !ok { - x = &GroupPhoto{} - } - - x.PhotoBig = PoolFileLocation.Get() - - x.PhotoSmall = PoolFileLocation.Get() - - return x -} - -func (p *poolGroupPhoto) Put(x *GroupPhoto) { - if x == nil { - return - } - - PoolFileLocation.Put(x.PhotoBig) - PoolFileLocation.Put(x.PhotoSmall) - x.PhotoID = 0 - - p.pool.Put(x) -} - -var PoolGroupPhoto = poolGroupPhoto{} - -func (x *GroupPhoto) DeepCopy(z *GroupPhoto) { - if x.PhotoBig != nil { - if z.PhotoBig == nil { - z.PhotoBig = PoolFileLocation.Get() - } - x.PhotoBig.DeepCopy(z.PhotoBig) - } else { - PoolFileLocation.Put(z.PhotoBig) - z.PhotoBig = nil - } - if x.PhotoSmall != nil { - if z.PhotoSmall == nil { - z.PhotoSmall = PoolFileLocation.Get() - } - x.PhotoSmall.DeepCopy(z.PhotoSmall) - } else { - PoolFileLocation.Put(z.PhotoSmall) - z.PhotoSmall = nil - } - z.PhotoID = x.PhotoID -} - -func (x *GroupPhoto) Clone() *GroupPhoto { - z := &GroupPhoto{} - x.DeepCopy(z) - return z -} - -func (x *GroupPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupPhoto, x) -} - -const C_Group int64 = 2885774273 - -type poolGroup struct { - pool sync.Pool -} - -func (p *poolGroup) Get() *Group { - x, ok := p.pool.Get().(*Group) - if !ok { - x = &Group{} - } - - x.Photo = PoolGroupPhoto.Get() - - return x -} - -func (p *poolGroup) Put(x *Group) { - if x == nil { - return - } - - x.TeamID = 0 - x.ID = 0 - x.Title = "" - x.CreatedOn = 0 - x.Participants = 0 - x.EditedOn = 0 - x.Flags = x.Flags[:0] - PoolGroupPhoto.Put(x.Photo) - - p.pool.Put(x) -} - -var PoolGroup = poolGroup{} - -func (x *Group) DeepCopy(z *Group) { - z.TeamID = x.TeamID - z.ID = x.ID - z.Title = x.Title - z.CreatedOn = x.CreatedOn - z.Participants = x.Participants - z.EditedOn = x.EditedOn - z.Flags = append(z.Flags[:0], x.Flags...) - if x.Photo != nil { - if z.Photo == nil { - z.Photo = PoolGroupPhoto.Get() - } - x.Photo.DeepCopy(z.Photo) - } else { - PoolGroupPhoto.Put(z.Photo) - z.Photo = nil - } -} - -func (x *Group) Clone() *Group { - z := &Group{} - x.DeepCopy(z) - return z -} - -func (x *Group) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Group) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Group) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Group) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Group) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Group, x) -} - -const C_GroupFull int64 = 205850814 - -type poolGroupFull struct { - pool sync.Pool -} - -func (p *poolGroupFull) Get() *GroupFull { - x, ok := p.pool.Get().(*GroupFull) - if !ok { - x = &GroupFull{} - } - - x.Group = PoolGroup.Get() - - x.NotifySettings = PoolPeerNotifySettings.Get() - - return x -} - -func (p *poolGroupFull) Put(x *GroupFull) { - if x == nil { - return - } - - PoolGroup.Put(x.Group) - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Participants { - PoolGroupParticipant.Put(z) - } - x.Participants = x.Participants[:0] - PoolPeerNotifySettings.Put(x.NotifySettings) - for _, z := range x.PhotoGallery { - PoolGroupPhoto.Put(z) - } - x.PhotoGallery = x.PhotoGallery[:0] - - p.pool.Put(x) -} - -var PoolGroupFull = poolGroupFull{} - -func (x *GroupFull) DeepCopy(z *GroupFull) { - if x.Group != nil { - if z.Group == nil { - z.Group = PoolGroup.Get() - } - x.Group.DeepCopy(z.Group) - } else { - PoolGroup.Put(z.Group) - z.Group = nil - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Participants { - if x.Participants[idx] == nil { - continue - } - xx := PoolGroupParticipant.Get() - x.Participants[idx].DeepCopy(xx) - z.Participants = append(z.Participants, xx) - } - if x.NotifySettings != nil { - if z.NotifySettings == nil { - z.NotifySettings = PoolPeerNotifySettings.Get() - } - x.NotifySettings.DeepCopy(z.NotifySettings) - } else { - PoolPeerNotifySettings.Put(z.NotifySettings) - z.NotifySettings = nil - } - for idx := range x.PhotoGallery { - if x.PhotoGallery[idx] == nil { - continue - } - xx := PoolGroupPhoto.Get() - x.PhotoGallery[idx].DeepCopy(xx) - z.PhotoGallery = append(z.PhotoGallery, xx) - } -} - -func (x *GroupFull) Clone() *GroupFull { - z := &GroupFull{} - x.DeepCopy(z) - return z -} - -func (x *GroupFull) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupFull) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupFull) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupFull) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupFull) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupFull, x) -} - -const C_GroupParticipant int64 = 4072279665 - -type poolGroupParticipant struct { - pool sync.Pool -} - -func (p *poolGroupParticipant) Get() *GroupParticipant { - x, ok := p.pool.Get().(*GroupParticipant) - if !ok { - x = &GroupParticipant{} - } - - x.Photo = PoolUserPhoto.Get() - - return x -} - -func (p *poolGroupParticipant) Put(x *GroupParticipant) { - if x == nil { - return - } - - x.UserID = 0 - x.FirstName = "" - x.LastName = "" - x.Type = 0 - x.AccessHash = 0 - x.Username = "" - PoolUserPhoto.Put(x.Photo) - - p.pool.Put(x) -} - -var PoolGroupParticipant = poolGroupParticipant{} - -func (x *GroupParticipant) DeepCopy(z *GroupParticipant) { - z.UserID = x.UserID - z.FirstName = x.FirstName - z.LastName = x.LastName - z.Type = x.Type - z.AccessHash = x.AccessHash - z.Username = x.Username - if x.Photo != nil { - if z.Photo == nil { - z.Photo = PoolUserPhoto.Get() - } - x.Photo.DeepCopy(z.Photo) - } else { - PoolUserPhoto.Put(z.Photo) - z.Photo = nil - } -} - -func (x *GroupParticipant) Clone() *GroupParticipant { - z := &GroupParticipant{} - x.DeepCopy(z) - return z -} - -func (x *GroupParticipant) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GroupParticipant) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GroupParticipant) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GroupParticipant) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GroupParticipant) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GroupParticipant, x) -} - -const C_UserMessage int64 = 1677556362 - -type poolUserMessage struct { - pool sync.Pool -} - -func (p *poolUserMessage) Get() *UserMessage { - x, ok := p.pool.Get().(*UserMessage) - if !ok { - x = &UserMessage{} - } - - return x -} - -func (p *poolUserMessage) Put(x *UserMessage) { - if x == nil { - return - } - - x.TeamID = 0 - x.ID = 0 - x.PeerID = 0 - x.PeerType = 0 - x.CreatedOn = 0 - x.EditedOn = 0 - x.Fwd = false - x.FwdSenderID = 0 - x.FwdChannelID = 0 - x.FwdChannelMessageID = 0 - x.Flags = 0 - x.MessageType = 0 - x.Body = "" - x.SenderID = 0 - x.ContentRead = false - x.Inbox = false - x.ReplyTo = 0 - x.MessageAction = 0 - x.MessageActionData = x.MessageActionData[:0] - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.MediaType = 0 - x.Media = x.Media[:0] - x.ReplyMarkup = 0 - x.ReplyMarkupData = x.ReplyMarkupData[:0] - x.LabelIDs = x.LabelIDs[:0] - x.ViaBotID = 0 - for _, z := range x.Reactions { - PoolReactionCounter.Put(z) - } - x.Reactions = x.Reactions[:0] - x.YourReactions = x.YourReactions[:0] - x.MediaCat = 0 - - p.pool.Put(x) -} - -var PoolUserMessage = poolUserMessage{} - -func (x *UserMessage) DeepCopy(z *UserMessage) { - z.TeamID = x.TeamID - z.ID = x.ID - z.PeerID = x.PeerID - z.PeerType = x.PeerType - z.CreatedOn = x.CreatedOn - z.EditedOn = x.EditedOn - z.Fwd = x.Fwd - z.FwdSenderID = x.FwdSenderID - z.FwdChannelID = x.FwdChannelID - z.FwdChannelMessageID = x.FwdChannelMessageID - z.Flags = x.Flags - z.MessageType = x.MessageType - z.Body = x.Body - z.SenderID = x.SenderID - z.ContentRead = x.ContentRead - z.Inbox = x.Inbox - z.ReplyTo = x.ReplyTo - z.MessageAction = x.MessageAction - z.MessageActionData = append(z.MessageActionData[:0], x.MessageActionData...) - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.MediaType = x.MediaType - z.Media = append(z.Media[:0], x.Media...) - z.ReplyMarkup = x.ReplyMarkup - z.ReplyMarkupData = append(z.ReplyMarkupData[:0], x.ReplyMarkupData...) - z.LabelIDs = append(z.LabelIDs[:0], x.LabelIDs...) - z.ViaBotID = x.ViaBotID - for idx := range x.Reactions { - if x.Reactions[idx] == nil { - continue - } - xx := PoolReactionCounter.Get() - x.Reactions[idx].DeepCopy(xx) - z.Reactions = append(z.Reactions, xx) - } - z.YourReactions = append(z.YourReactions[:0], x.YourReactions...) - z.MediaCat = x.MediaCat -} - -func (x *UserMessage) Clone() *UserMessage { - z := &UserMessage{} - x.DeepCopy(z) - return z -} - -func (x *UserMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UserMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UserMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UserMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UserMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UserMessage, x) -} - -const C_ReactionCounter int64 = 3277490830 - -type poolReactionCounter struct { - pool sync.Pool -} - -func (p *poolReactionCounter) Get() *ReactionCounter { - x, ok := p.pool.Get().(*ReactionCounter) - if !ok { - x = &ReactionCounter{} - } - - return x -} - -func (p *poolReactionCounter) Put(x *ReactionCounter) { - if x == nil { - return - } - - x.Reaction = "" - x.Total = 0 - - p.pool.Put(x) -} - -var PoolReactionCounter = poolReactionCounter{} - -func (x *ReactionCounter) DeepCopy(z *ReactionCounter) { - z.Reaction = x.Reaction - z.Total = x.Total -} - -func (x *ReactionCounter) Clone() *ReactionCounter { - z := &ReactionCounter{} - x.DeepCopy(z) - return z -} - -func (x *ReactionCounter) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ReactionCounter) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ReactionCounter) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ReactionCounter) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ReactionCounter) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ReactionCounter, x) -} - -const C_DraftMessage int64 = 869564229 - -type poolDraftMessage struct { - pool sync.Pool -} - -func (p *poolDraftMessage) Get() *DraftMessage { - x, ok := p.pool.Get().(*DraftMessage) - if !ok { - x = &DraftMessage{} - } - - return x -} - -func (p *poolDraftMessage) Put(x *DraftMessage) { - if x == nil { - return - } - - x.TeamID = 0 - x.PeerID = 0 - x.PeerType = 0 - x.Date = 0 - x.Body = "" - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.ReplyTo = 0 - x.EditedID = 0 - - p.pool.Put(x) -} - -var PoolDraftMessage = poolDraftMessage{} - -func (x *DraftMessage) DeepCopy(z *DraftMessage) { - z.TeamID = x.TeamID - z.PeerID = x.PeerID - z.PeerType = x.PeerType - z.Date = x.Date - z.Body = x.Body - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.ReplyTo = x.ReplyTo - z.EditedID = x.EditedID -} - -func (x *DraftMessage) Clone() *DraftMessage { - z := &DraftMessage{} - x.DeepCopy(z) - return z -} - -func (x *DraftMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DraftMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DraftMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DraftMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DraftMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DraftMessage, x) -} - -const C_MessageEntity int64 = 3479443932 - -type poolMessageEntity struct { - pool sync.Pool -} - -func (p *poolMessageEntity) Get() *MessageEntity { - x, ok := p.pool.Get().(*MessageEntity) - if !ok { - x = &MessageEntity{} - } - - return x -} - -func (p *poolMessageEntity) Put(x *MessageEntity) { - if x == nil { - return - } - - x.Type = 0 - x.Offset = 0 - x.Length = 0 - x.UserID = 0 - - p.pool.Put(x) -} - -var PoolMessageEntity = poolMessageEntity{} - -func (x *MessageEntity) DeepCopy(z *MessageEntity) { - z.Type = x.Type - z.Offset = x.Offset - z.Length = x.Length - z.UserID = x.UserID -} - -func (x *MessageEntity) Clone() *MessageEntity { - z := &MessageEntity{} - x.DeepCopy(z) - return z -} - -func (x *MessageEntity) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *MessageEntity) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *MessageEntity) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *MessageEntity) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *MessageEntity) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_MessageEntity, x) -} - -const C_RSAPublicKey int64 = 1046601890 - -type poolRSAPublicKey struct { - pool sync.Pool -} - -func (p *poolRSAPublicKey) Get() *RSAPublicKey { - x, ok := p.pool.Get().(*RSAPublicKey) - if !ok { - x = &RSAPublicKey{} - } - - return x -} - -func (p *poolRSAPublicKey) Put(x *RSAPublicKey) { - if x == nil { - return - } - - x.FingerPrint = 0 - x.N = "" - x.E = 0 - - p.pool.Put(x) -} - -var PoolRSAPublicKey = poolRSAPublicKey{} - -func (x *RSAPublicKey) DeepCopy(z *RSAPublicKey) { - z.FingerPrint = x.FingerPrint - z.N = x.N - z.E = x.E -} - -func (x *RSAPublicKey) Clone() *RSAPublicKey { - z := &RSAPublicKey{} - x.DeepCopy(z) - return z -} - -func (x *RSAPublicKey) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *RSAPublicKey) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *RSAPublicKey) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *RSAPublicKey) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *RSAPublicKey) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_RSAPublicKey, x) -} - -const C_DHGroup int64 = 2751503049 - -type poolDHGroup struct { - pool sync.Pool -} - -func (p *poolDHGroup) Get() *DHGroup { - x, ok := p.pool.Get().(*DHGroup) - if !ok { - x = &DHGroup{} - } - - return x -} - -func (p *poolDHGroup) Put(x *DHGroup) { - if x == nil { - return - } - - x.FingerPrint = 0 - x.Prime = "" - x.Gen = 0 - - p.pool.Put(x) -} - -var PoolDHGroup = poolDHGroup{} - -func (x *DHGroup) DeepCopy(z *DHGroup) { - z.FingerPrint = x.FingerPrint - z.Prime = x.Prime - z.Gen = x.Gen -} - -func (x *DHGroup) Clone() *DHGroup { - z := &DHGroup{} - x.DeepCopy(z) - return z -} - -func (x *DHGroup) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DHGroup) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DHGroup) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DHGroup) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DHGroup) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DHGroup, x) -} - -const C_PhoneContact int64 = 2672574672 - -type poolPhoneContact struct { - pool sync.Pool -} - -func (p *poolPhoneContact) Get() *PhoneContact { - x, ok := p.pool.Get().(*PhoneContact) - if !ok { - x = &PhoneContact{} - } - - return x -} - -func (p *poolPhoneContact) Put(x *PhoneContact) { - if x == nil { - return - } - - x.ClientID = 0 - x.FirstName = "" - x.LastName = "" - x.Phone = "" - - p.pool.Put(x) -} - -var PoolPhoneContact = poolPhoneContact{} - -func (x *PhoneContact) DeepCopy(z *PhoneContact) { - z.ClientID = x.ClientID - z.FirstName = x.FirstName - z.LastName = x.LastName - z.Phone = x.Phone -} - -func (x *PhoneContact) Clone() *PhoneContact { - z := &PhoneContact{} - x.DeepCopy(z) - return z -} - -func (x *PhoneContact) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PhoneContact) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PhoneContact) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PhoneContact) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PhoneContact) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PhoneContact, x) -} - -const C_PeerNotifySettings int64 = 3475030132 - -type poolPeerNotifySettings struct { - pool sync.Pool -} - -func (p *poolPeerNotifySettings) Get() *PeerNotifySettings { - x, ok := p.pool.Get().(*PeerNotifySettings) - if !ok { - x = &PeerNotifySettings{} - } - - return x -} - -func (p *poolPeerNotifySettings) Put(x *PeerNotifySettings) { - if x == nil { - return - } - - x.Flags = 0 - x.MuteUntil = 0 - x.Sound = "" - - p.pool.Put(x) -} - -var PoolPeerNotifySettings = poolPeerNotifySettings{} - -func (x *PeerNotifySettings) DeepCopy(z *PeerNotifySettings) { - z.Flags = x.Flags - z.MuteUntil = x.MuteUntil - z.Sound = x.Sound -} - -func (x *PeerNotifySettings) Clone() *PeerNotifySettings { - z := &PeerNotifySettings{} - x.DeepCopy(z) - return z -} - -func (x *PeerNotifySettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PeerNotifySettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PeerNotifySettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PeerNotifySettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PeerNotifySettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PeerNotifySettings, x) -} - -const C_InputFile int64 = 3882180383 - -type poolInputFile struct { - pool sync.Pool -} - -func (p *poolInputFile) Get() *InputFile { - x, ok := p.pool.Get().(*InputFile) - if !ok { - x = &InputFile{} - } - - return x -} - -func (p *poolInputFile) Put(x *InputFile) { - if x == nil { - return - } - - x.FileID = 0 - x.TotalParts = 0 - x.FileName = "" - x.MD5Checksum = "" - - p.pool.Put(x) -} - -var PoolInputFile = poolInputFile{} - -func (x *InputFile) DeepCopy(z *InputFile) { - z.FileID = x.FileID - z.TotalParts = x.TotalParts - z.FileName = x.FileName - z.MD5Checksum = x.MD5Checksum -} - -func (x *InputFile) Clone() *InputFile { - z := &InputFile{} - x.DeepCopy(z) - return z -} - -func (x *InputFile) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputFile) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputFile) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputFile) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputFile) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputFile, x) -} - -const C_InputDocument int64 = 4081048424 - -type poolInputDocument struct { - pool sync.Pool -} - -func (p *poolInputDocument) Get() *InputDocument { - x, ok := p.pool.Get().(*InputDocument) - if !ok { - x = &InputDocument{} - } - - return x -} - -func (p *poolInputDocument) Put(x *InputDocument) { - if x == nil { - return - } - - x.ID = 0 - x.AccessHash = 0 - x.ClusterID = 0 - - p.pool.Put(x) -} - -var PoolInputDocument = poolInputDocument{} - -func (x *InputDocument) DeepCopy(z *InputDocument) { - z.ID = x.ID - z.AccessHash = x.AccessHash - z.ClusterID = x.ClusterID -} - -func (x *InputDocument) Clone() *InputDocument { - z := &InputDocument{} - x.DeepCopy(z) - return z -} - -func (x *InputDocument) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputDocument) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputDocument) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputDocument) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputDocument) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputDocument, x) -} - -const C_PrivacyRule int64 = 3954700912 - -type poolPrivacyRule struct { - pool sync.Pool -} - -func (p *poolPrivacyRule) Get() *PrivacyRule { - x, ok := p.pool.Get().(*PrivacyRule) - if !ok { - x = &PrivacyRule{} - } - - return x -} - -func (p *poolPrivacyRule) Put(x *PrivacyRule) { - if x == nil { - return - } - - x.PrivacyType = 0 - x.UserIDs = x.UserIDs[:0] - - p.pool.Put(x) -} - -var PoolPrivacyRule = poolPrivacyRule{} - -func (x *PrivacyRule) DeepCopy(z *PrivacyRule) { - z.PrivacyType = x.PrivacyType - z.UserIDs = append(z.UserIDs[:0], x.UserIDs...) -} - -func (x *PrivacyRule) Clone() *PrivacyRule { - z := &PrivacyRule{} - x.DeepCopy(z) - return z -} - -func (x *PrivacyRule) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PrivacyRule) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PrivacyRule) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PrivacyRule) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PrivacyRule) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PrivacyRule, x) -} - -const C_Label int64 = 3479601132 - -type poolLabel struct { - pool sync.Pool -} - -func (p *poolLabel) Get() *Label { - x, ok := p.pool.Get().(*Label) - if !ok { - x = &Label{} - } - - return x -} - -func (p *poolLabel) Put(x *Label) { - if x == nil { - return - } - - x.ID = 0 - x.Name = "" - x.Colour = "" - x.Count = 0 - - p.pool.Put(x) -} - -var PoolLabel = poolLabel{} - -func (x *Label) DeepCopy(z *Label) { - z.ID = x.ID - z.Name = x.Name - z.Colour = x.Colour - z.Count = x.Count -} - -func (x *Label) Clone() *Label { - z := &Label{} - x.DeepCopy(z) - return z -} - -func (x *Label) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Label) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Label) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Label) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Label) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Label, x) -} - -const C_LabelsMany int64 = 1423713603 - -type poolLabelsMany struct { - pool sync.Pool -} - -func (p *poolLabelsMany) Get() *LabelsMany { - x, ok := p.pool.Get().(*LabelsMany) - if !ok { - x = &LabelsMany{} - } - - return x -} - -func (p *poolLabelsMany) Put(x *LabelsMany) { - if x == nil { - return - } - - for _, z := range x.Labels { - PoolLabel.Put(z) - } - x.Labels = x.Labels[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolLabelsMany = poolLabelsMany{} - -func (x *LabelsMany) DeepCopy(z *LabelsMany) { - for idx := range x.Labels { - if x.Labels[idx] == nil { - continue - } - xx := PoolLabel.Get() - x.Labels[idx].DeepCopy(xx) - z.Labels = append(z.Labels, xx) - } - z.Empty = x.Empty -} - -func (x *LabelsMany) Clone() *LabelsMany { - z := &LabelsMany{} - x.DeepCopy(z) - return z -} - -func (x *LabelsMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *LabelsMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *LabelsMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *LabelsMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *LabelsMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_LabelsMany, x) -} - -const C_InputGeoLocation int64 = 1403425127 - -type poolInputGeoLocation struct { - pool sync.Pool -} - -func (p *poolInputGeoLocation) Get() *InputGeoLocation { - x, ok := p.pool.Get().(*InputGeoLocation) - if !ok { - x = &InputGeoLocation{} - } - - return x -} - -func (p *poolInputGeoLocation) Put(x *InputGeoLocation) { - if x == nil { - return - } - - x.Lat = 0 - x.Long = 0 - - p.pool.Put(x) -} - -var PoolInputGeoLocation = poolInputGeoLocation{} - -func (x *InputGeoLocation) DeepCopy(z *InputGeoLocation) { - z.Lat = x.Lat - z.Long = x.Long -} - -func (x *InputGeoLocation) Clone() *InputGeoLocation { - z := &InputGeoLocation{} - x.DeepCopy(z) - return z -} - -func (x *InputGeoLocation) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputGeoLocation) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputGeoLocation) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputGeoLocation) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputGeoLocation) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputGeoLocation, x) -} - -const C_GeoLocation int64 = 3794405429 - -type poolGeoLocation struct { - pool sync.Pool -} - -func (p *poolGeoLocation) Get() *GeoLocation { - x, ok := p.pool.Get().(*GeoLocation) - if !ok { - x = &GeoLocation{} - } - - return x -} - -func (p *poolGeoLocation) Put(x *GeoLocation) { - if x == nil { - return - } - - x.Lat = 0 - x.Long = 0 - - p.pool.Put(x) -} - -var PoolGeoLocation = poolGeoLocation{} - -func (x *GeoLocation) DeepCopy(z *GeoLocation) { - z.Lat = x.Lat - z.Long = x.Long -} - -func (x *GeoLocation) Clone() *GeoLocation { - z := &GeoLocation{} - x.DeepCopy(z) - return z -} - -func (x *GeoLocation) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GeoLocation) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GeoLocation) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GeoLocation) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GeoLocation) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GeoLocation, x) -} - -const C_InputTeam int64 = 2937769744 - -type poolInputTeam struct { - pool sync.Pool -} - -func (p *poolInputTeam) Get() *InputTeam { - x, ok := p.pool.Get().(*InputTeam) - if !ok { - x = &InputTeam{} - } - - return x -} - -func (p *poolInputTeam) Put(x *InputTeam) { - if x == nil { - return - } - - x.ID = 0 - x.AccessHash = 0 - - p.pool.Put(x) -} - -var PoolInputTeam = poolInputTeam{} - -func (x *InputTeam) DeepCopy(z *InputTeam) { - z.ID = x.ID - z.AccessHash = x.AccessHash -} - -func (x *InputTeam) Clone() *InputTeam { - z := &InputTeam{} - x.DeepCopy(z) - return z -} - -func (x *InputTeam) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *InputTeam) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *InputTeam) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *InputTeam) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *InputTeam) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_InputTeam, x) -} - -const C_TeamPhoto int64 = 3678645727 - -type poolTeamPhoto struct { - pool sync.Pool -} - -func (p *poolTeamPhoto) Get() *TeamPhoto { - x, ok := p.pool.Get().(*TeamPhoto) - if !ok { - x = &TeamPhoto{} - } - - x.PhotoBig = PoolFileLocation.Get() - - x.PhotoSmall = PoolFileLocation.Get() - - return x -} - -func (p *poolTeamPhoto) Put(x *TeamPhoto) { - if x == nil { - return - } - - PoolFileLocation.Put(x.PhotoBig) - PoolFileLocation.Put(x.PhotoSmall) - - p.pool.Put(x) -} - -var PoolTeamPhoto = poolTeamPhoto{} - -func (x *TeamPhoto) DeepCopy(z *TeamPhoto) { - if x.PhotoBig != nil { - if z.PhotoBig == nil { - z.PhotoBig = PoolFileLocation.Get() - } - x.PhotoBig.DeepCopy(z.PhotoBig) - } else { - PoolFileLocation.Put(z.PhotoBig) - z.PhotoBig = nil - } - if x.PhotoSmall != nil { - if z.PhotoSmall == nil { - z.PhotoSmall = PoolFileLocation.Get() - } - x.PhotoSmall.DeepCopy(z.PhotoSmall) - } else { - PoolFileLocation.Put(z.PhotoSmall) - z.PhotoSmall = nil - } -} - -func (x *TeamPhoto) Clone() *TeamPhoto { - z := &TeamPhoto{} - x.DeepCopy(z) - return z -} - -func (x *TeamPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamPhoto, x) -} - -const C_Team int64 = 1691486497 - -type poolTeam struct { - pool sync.Pool -} - -func (p *poolTeam) Get() *Team { - x, ok := p.pool.Get().(*Team) - if !ok { - x = &Team{} - } - - x.Photo = PoolTeamPhoto.Get() - - return x -} - -func (p *poolTeam) Put(x *Team) { - if x == nil { - return - } - - x.ID = 0 - x.Name = "" - x.CreatorID = 0 - x.AccessHash = 0 - x.Flags = x.Flags[:0] - x.Capacity = 0 - x.Community = false - PoolTeamPhoto.Put(x.Photo) - - p.pool.Put(x) -} - -var PoolTeam = poolTeam{} - -func (x *Team) DeepCopy(z *Team) { - z.ID = x.ID - z.Name = x.Name - z.CreatorID = x.CreatorID - z.AccessHash = x.AccessHash - z.Flags = append(z.Flags[:0], x.Flags...) - z.Capacity = x.Capacity - z.Community = x.Community - if x.Photo != nil { - if z.Photo == nil { - z.Photo = PoolTeamPhoto.Get() - } - x.Photo.DeepCopy(z.Photo) - } else { - PoolTeamPhoto.Put(z.Photo) - z.Photo = nil - } -} - -func (x *Team) Clone() *Team { - z := &Team{} - x.DeepCopy(z) - return z -} - -func (x *Team) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *Team) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *Team) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *Team) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *Team) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_Team, x) -} - -func init() { - registry.RegisterConstructor(2246546115, "Ping") - registry.RegisterConstructor(2171268721, "Pong") - registry.RegisterConstructor(2373884514, "UpdateEnvelope") - registry.RegisterConstructor(661712615, "UpdateContainer") - registry.RegisterConstructor(2179260159, "ProtoMessage") - registry.RegisterConstructor(2668405547, "ProtoEncryptedPayload") - registry.RegisterConstructor(447331921, "Ack") - registry.RegisterConstructor(4122188204, "Bool") - registry.RegisterConstructor(1120787796, "Dialog") - registry.RegisterConstructor(3374092470, "InputPeer") - registry.RegisterConstructor(47470215, "Peer") - registry.RegisterConstructor(513021899, "InputPassword") - registry.RegisterConstructor(354669666, "InputFileLocation") - registry.RegisterConstructor(2432133155, "FileLocation") - registry.RegisterConstructor(3180538793, "WebLocation") - registry.RegisterConstructor(203404027, "InputWebLocation") - registry.RegisterConstructor(1881347437, "UserPhoto") - registry.RegisterConstructor(3865689926, "InputUser") - registry.RegisterConstructor(765557111, "User") - registry.RegisterConstructor(460099170, "ContactUser") - registry.RegisterConstructor(961692401, "Bot") - registry.RegisterConstructor(1852470005, "BotCommands") - registry.RegisterConstructor(4059496923, "BotInfo") - registry.RegisterConstructor(3998516135, "GroupPhoto") - registry.RegisterConstructor(2885774273, "Group") - registry.RegisterConstructor(205850814, "GroupFull") - registry.RegisterConstructor(4072279665, "GroupParticipant") - registry.RegisterConstructor(1677556362, "UserMessage") - registry.RegisterConstructor(3277490830, "ReactionCounter") - registry.RegisterConstructor(869564229, "DraftMessage") - registry.RegisterConstructor(3479443932, "MessageEntity") - registry.RegisterConstructor(1046601890, "RSAPublicKey") - registry.RegisterConstructor(2751503049, "DHGroup") - registry.RegisterConstructor(2672574672, "PhoneContact") - registry.RegisterConstructor(3475030132, "PeerNotifySettings") - registry.RegisterConstructor(3882180383, "InputFile") - registry.RegisterConstructor(4081048424, "InputDocument") - registry.RegisterConstructor(3954700912, "PrivacyRule") - registry.RegisterConstructor(3479601132, "Label") - registry.RegisterConstructor(1423713603, "LabelsMany") - registry.RegisterConstructor(1403425127, "InputGeoLocation") - registry.RegisterConstructor(3794405429, "GeoLocation") - registry.RegisterConstructor(2937769744, "InputTeam") - registry.RegisterConstructor(3678645727, "TeamPhoto") - registry.RegisterConstructor(1691486497, "Team") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/crypto.go b/vendor/git.ronaksoft.com/river/msg/go/msg/crypto.go deleted file mode 100644 index 6c4625b6..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/crypto.go +++ /dev/null @@ -1,127 +0,0 @@ -package msg - -import ( - "crypto/aes" - "crypto/cipher" - "crypto/sha512" - "github.com/gobwas/pool/pbytes" -) - -// Sha512 returns a 64bytes array which is sha512(in) -func Sha512(in []byte) ([]byte, error) { - h := sha512.New() - if _, err := h.Write(in); err != nil { - return nil, err - } - return h.Sum(nil), nil -} - -// AES256CCMEncrypt encrypts the msg according with key and iv -func AES256GCMEncrypt(key, iv []byte, msg []byte) ([]byte, error) { - block, err := aes.NewCipher(key) - if err != nil { - return nil, err - } - aesGCM, err := cipher.NewGCM(block) - if err != nil { - return nil, err - } - return aesGCM.Seal(msg[:0], iv, msg, nil), nil -} - -// AES256GCMDecrypt decrypts the msg according with key and iv -func AES256GCMDecrypt(key, iv []byte, msg []byte) ([]byte, error) { - block, err := aes.NewCipher(key) - if err != nil { - return nil, err - } - var decrypted []byte - aesGCM, err := cipher.NewGCM(block) - if err != nil { - return nil, err - } - decrypted, err = aesGCM.Open(nil, iv, msg, nil) - return decrypted, err -} - -// GenerateMessageKey -// Message Key is: Sha512(DHKey[100:140], InternalHeader, Payload)[32:64] -// The generated key will be set on the passed msgKey argument -func GenerateMessageKey(authKey, plain []byte, msgKey []byte) error { - // Message Key is: Sha512(DHKey[100:140], InternalHeader, Payload)[32:64] - keyBuffer := pbytes.GetLen(40 + len(plain)) - copy(keyBuffer, authKey[100:140]) - copy(keyBuffer[40:], plain) - if k, err := Sha512(keyBuffer); err != nil { - pbytes.Put(keyBuffer) - return err - } else { - copy(msgKey, k[32:64]) - pbytes.Put(keyBuffer) - return nil - } -} - -// Encrypt -// Generate MessageKey, AES IV and AES Key: -// 1. Message Key is: Sha512(dhKey[100:140], plain)[32:64] -// 2. AES IV: Sha512 (dhKey[180:220], MessageKey)[:32] -// 3. AES KEY: Sha512 (MessageKey, dhKey[170:210])[:32] -func Encrypt(authKey, msgKey, plain []byte) (encrypted []byte, err error) { - // AES IV: Sha512 (DHKey[180:220], MessageKey)[:32] - iv := pbytes.GetLen(72) - copy(iv, authKey[180:220]) - copy(iv[40:], msgKey) - aesIV, err := Sha512(iv) - pbytes.Put(iv) - if err != nil { - return nil, err - } - - // AES KEY: Sha512 (MessageKey, DHKey[170:210])[:32] - // key := make([]byte, 72) - key := pbytes.GetLen(72) - copy(key, msgKey) - copy(key[32:], authKey[170:210]) - aesKey, err := Sha512(key) - pbytes.Put(key) - if err != nil { - return nil, err - } - - return AES256GCMEncrypt( - aesKey[:32], - aesIV[:12], - plain, - ) - -} - -// Decrypt -// Decrypts the message: -// 1. AES IV: Sha512 (dhKey[180:220], MessageKey)[:32] -// 2. AES KEY: Sha512 (MessageKey, dhKey[170:210])[:32] -func Decrypt(authKey, msgKey, encrypted []byte) (plain []byte, err error) { - // AES IV: Sha512 (DHKey[180:220], MessageKey)[:32] - iv := pbytes.Get(40, 72) - copy(iv, authKey[180:220]) - iv = append(iv, msgKey...) - aesIV, _ := Sha512(iv) - pbytes.Put(iv) - - // AES KEY: Sha512 (MessageKey, DHKey[170:210])[:32] - key := pbytes.Get(32, 72) - copy(key, msgKey) - key = append(key, authKey[170:210]...) - aesKey, err := Sha512(key) - pbytes.Put(key) - if err != nil { - return nil, err - } - - return AES256GCMDecrypt( - aesKey[:32], - aesIV[:12], - encrypted, - ) -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/dev.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/dev.pb.go deleted file mode 100644 index 6f6a9d1b..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/dev.pb.go +++ /dev/null @@ -1,413 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: dev.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// EchoWithDelay -type EchoWithDelay struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - DelayInSeconds int32 `protobuf:"varint,1,opt,name=DelayInSeconds,proto3" json:"DelayInSeconds,omitempty"` -} - -func (x *EchoWithDelay) Reset() { - *x = EchoWithDelay{} - if protoimpl.UnsafeEnabled { - mi := &file_dev_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *EchoWithDelay) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EchoWithDelay) ProtoMessage() {} - -func (x *EchoWithDelay) ProtoReflect() protoreflect.Message { - mi := &file_dev_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EchoWithDelay.ProtoReflect.Descriptor instead. -func (*EchoWithDelay) Descriptor() ([]byte, []int) { - return file_dev_proto_rawDescGZIP(), []int{0} -} - -func (x *EchoWithDelay) GetDelayInSeconds() int32 { - if x != nil { - return x.DelayInSeconds - } - return 0 -} - -type TestRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Payload []byte `protobuf:"bytes,1,opt,name=Payload,proto3" json:"Payload,omitempty"` - Hash []byte `protobuf:"bytes,2,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *TestRequest) Reset() { - *x = TestRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_dev_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TestRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TestRequest) ProtoMessage() {} - -func (x *TestRequest) ProtoReflect() protoreflect.Message { - mi := &file_dev_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TestRequest.ProtoReflect.Descriptor instead. -func (*TestRequest) Descriptor() ([]byte, []int) { - return file_dev_proto_rawDescGZIP(), []int{1} -} - -func (x *TestRequest) GetPayload() []byte { - if x != nil { - return x.Payload - } - return nil -} - -func (x *TestRequest) GetHash() []byte { - if x != nil { - return x.Hash - } - return nil -} - -type TestResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Hash []byte `protobuf:"bytes,2,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *TestResponse) Reset() { - *x = TestResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_dev_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TestResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TestResponse) ProtoMessage() {} - -func (x *TestResponse) ProtoReflect() protoreflect.Message { - mi := &file_dev_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TestResponse.ProtoReflect.Descriptor instead. -func (*TestResponse) Descriptor() ([]byte, []int) { - return file_dev_proto_rawDescGZIP(), []int{2} -} - -func (x *TestResponse) GetHash() []byte { - if x != nil { - return x.Hash - } - return nil -} - -type TestRequestWithString struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Payload string `protobuf:"bytes,1,opt,name=Payload,proto3" json:"Payload,omitempty"` - Hash string `protobuf:"bytes,2,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *TestRequestWithString) Reset() { - *x = TestRequestWithString{} - if protoimpl.UnsafeEnabled { - mi := &file_dev_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TestRequestWithString) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TestRequestWithString) ProtoMessage() {} - -func (x *TestRequestWithString) ProtoReflect() protoreflect.Message { - mi := &file_dev_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TestRequestWithString.ProtoReflect.Descriptor instead. -func (*TestRequestWithString) Descriptor() ([]byte, []int) { - return file_dev_proto_rawDescGZIP(), []int{3} -} - -func (x *TestRequestWithString) GetPayload() string { - if x != nil { - return x.Payload - } - return "" -} - -func (x *TestRequestWithString) GetHash() string { - if x != nil { - return x.Hash - } - return "" -} - -type TestResponseWithString struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Hash []byte `protobuf:"bytes,1,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *TestResponseWithString) Reset() { - *x = TestResponseWithString{} - if protoimpl.UnsafeEnabled { - mi := &file_dev_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TestResponseWithString) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TestResponseWithString) ProtoMessage() {} - -func (x *TestResponseWithString) ProtoReflect() protoreflect.Message { - mi := &file_dev_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TestResponseWithString.ProtoReflect.Descriptor instead. -func (*TestResponseWithString) Descriptor() ([]byte, []int) { - return file_dev_proto_rawDescGZIP(), []int{4} -} - -func (x *TestResponseWithString) GetHash() []byte { - if x != nil { - return x.Hash - } - return nil -} - -var File_dev_proto protoreflect.FileDescriptor - -var file_dev_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x64, 0x65, 0x76, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, - 0x22, 0x37, 0x0a, 0x0d, 0x45, 0x63, 0x68, 0x6f, 0x57, 0x69, 0x74, 0x68, 0x44, 0x65, 0x6c, 0x61, - 0x79, 0x12, 0x26, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, - 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x44, 0x65, 0x6c, 0x61, 0x79, - 0x49, 0x6e, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x3b, 0x0a, 0x0b, 0x54, 0x65, 0x73, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, - 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x22, 0x22, 0x0a, 0x0c, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x22, 0x45, 0x0a, 0x15, 0x54, 0x65, - 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x53, 0x74, 0x72, - 0x69, 0x6e, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x48, 0x61, 0x73, - 0x68, 0x22, 0x2c, 0x0a, 0x16, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x57, 0x69, 0x74, 0x68, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x48, - 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x42, - 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_dev_proto_rawDescOnce sync.Once - file_dev_proto_rawDescData = file_dev_proto_rawDesc -) - -func file_dev_proto_rawDescGZIP() []byte { - file_dev_proto_rawDescOnce.Do(func() { - file_dev_proto_rawDescData = protoimpl.X.CompressGZIP(file_dev_proto_rawDescData) - }) - return file_dev_proto_rawDescData -} - -var file_dev_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_dev_proto_goTypes = []interface{}{ - (*EchoWithDelay)(nil), // 0: msg.EchoWithDelay - (*TestRequest)(nil), // 1: msg.TestRequest - (*TestResponse)(nil), // 2: msg.TestResponse - (*TestRequestWithString)(nil), // 3: msg.TestRequestWithString - (*TestResponseWithString)(nil), // 4: msg.TestResponseWithString -} -var file_dev_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_dev_proto_init() } -func file_dev_proto_init() { - if File_dev_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_dev_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EchoWithDelay); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dev_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dev_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dev_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestRequestWithString); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_dev_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestResponseWithString); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_dev_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_dev_proto_goTypes, - DependencyIndexes: file_dev_proto_depIdxs, - MessageInfos: file_dev_proto_msgTypes, - }.Build() - File_dev_proto = out.File - file_dev_proto_rawDesc = nil - file_dev_proto_goTypes = nil - file_dev_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/dev.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/dev.rony.go deleted file mode 100644 index 4581eb1b..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/dev.rony.go +++ /dev/null @@ -1,317 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: dev.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_EchoWithDelay int64 = 2861516000 - -type poolEchoWithDelay struct { - pool sync.Pool -} - -func (p *poolEchoWithDelay) Get() *EchoWithDelay { - x, ok := p.pool.Get().(*EchoWithDelay) - if !ok { - x = &EchoWithDelay{} - } - - return x -} - -func (p *poolEchoWithDelay) Put(x *EchoWithDelay) { - if x == nil { - return - } - - x.DelayInSeconds = 0 - - p.pool.Put(x) -} - -var PoolEchoWithDelay = poolEchoWithDelay{} - -func (x *EchoWithDelay) DeepCopy(z *EchoWithDelay) { - z.DelayInSeconds = x.DelayInSeconds -} - -func (x *EchoWithDelay) Clone() *EchoWithDelay { - z := &EchoWithDelay{} - x.DeepCopy(z) - return z -} - -func (x *EchoWithDelay) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *EchoWithDelay) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *EchoWithDelay) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *EchoWithDelay) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *EchoWithDelay) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_EchoWithDelay, x) -} - -const C_TestRequest int64 = 475847033 - -type poolTestRequest struct { - pool sync.Pool -} - -func (p *poolTestRequest) Get() *TestRequest { - x, ok := p.pool.Get().(*TestRequest) - if !ok { - x = &TestRequest{} - } - - return x -} - -func (p *poolTestRequest) Put(x *TestRequest) { - if x == nil { - return - } - - x.Payload = x.Payload[:0] - x.Hash = x.Hash[:0] - - p.pool.Put(x) -} - -var PoolTestRequest = poolTestRequest{} - -func (x *TestRequest) DeepCopy(z *TestRequest) { - z.Payload = append(z.Payload[:0], x.Payload...) - z.Hash = append(z.Hash[:0], x.Hash...) -} - -func (x *TestRequest) Clone() *TestRequest { - z := &TestRequest{} - x.DeepCopy(z) - return z -} - -func (x *TestRequest) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TestRequest) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TestRequest) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TestRequest) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TestRequest) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TestRequest, x) -} - -const C_TestResponse int64 = 1999996896 - -type poolTestResponse struct { - pool sync.Pool -} - -func (p *poolTestResponse) Get() *TestResponse { - x, ok := p.pool.Get().(*TestResponse) - if !ok { - x = &TestResponse{} - } - - return x -} - -func (p *poolTestResponse) Put(x *TestResponse) { - if x == nil { - return - } - - x.Hash = x.Hash[:0] - - p.pool.Put(x) -} - -var PoolTestResponse = poolTestResponse{} - -func (x *TestResponse) DeepCopy(z *TestResponse) { - z.Hash = append(z.Hash[:0], x.Hash...) -} - -func (x *TestResponse) Clone() *TestResponse { - z := &TestResponse{} - x.DeepCopy(z) - return z -} - -func (x *TestResponse) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TestResponse) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TestResponse) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TestResponse) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TestResponse) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TestResponse, x) -} - -const C_TestRequestWithString int64 = 3760062575 - -type poolTestRequestWithString struct { - pool sync.Pool -} - -func (p *poolTestRequestWithString) Get() *TestRequestWithString { - x, ok := p.pool.Get().(*TestRequestWithString) - if !ok { - x = &TestRequestWithString{} - } - - return x -} - -func (p *poolTestRequestWithString) Put(x *TestRequestWithString) { - if x == nil { - return - } - - x.Payload = "" - x.Hash = "" - - p.pool.Put(x) -} - -var PoolTestRequestWithString = poolTestRequestWithString{} - -func (x *TestRequestWithString) DeepCopy(z *TestRequestWithString) { - z.Payload = x.Payload - z.Hash = x.Hash -} - -func (x *TestRequestWithString) Clone() *TestRequestWithString { - z := &TestRequestWithString{} - x.DeepCopy(z) - return z -} - -func (x *TestRequestWithString) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TestRequestWithString) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TestRequestWithString) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TestRequestWithString) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TestRequestWithString) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TestRequestWithString, x) -} - -const C_TestResponseWithString int64 = 556112423 - -type poolTestResponseWithString struct { - pool sync.Pool -} - -func (p *poolTestResponseWithString) Get() *TestResponseWithString { - x, ok := p.pool.Get().(*TestResponseWithString) - if !ok { - x = &TestResponseWithString{} - } - - return x -} - -func (p *poolTestResponseWithString) Put(x *TestResponseWithString) { - if x == nil { - return - } - - x.Hash = x.Hash[:0] - - p.pool.Put(x) -} - -var PoolTestResponseWithString = poolTestResponseWithString{} - -func (x *TestResponseWithString) DeepCopy(z *TestResponseWithString) { - z.Hash = append(z.Hash[:0], x.Hash...) -} - -func (x *TestResponseWithString) Clone() *TestResponseWithString { - z := &TestResponseWithString{} - x.DeepCopy(z) - return z -} - -func (x *TestResponseWithString) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TestResponseWithString) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TestResponseWithString) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TestResponseWithString) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TestResponseWithString) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TestResponseWithString, x) -} - -func init() { - registry.RegisterConstructor(2861516000, "EchoWithDelay") - registry.RegisterConstructor(475847033, "TestRequest") - registry.RegisterConstructor(1999996896, "TestResponse") - registry.RegisterConstructor(3760062575, "TestRequestWithString") - registry.RegisterConstructor(556112423, "TestResponseWithString") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/errors.go b/vendor/git.ronaksoft.com/river/msg/go/msg/errors.go deleted file mode 100644 index b5fd334a..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/errors.go +++ /dev/null @@ -1,115 +0,0 @@ -package msg - -/* - Creation Time: 2018 - Apr - 07 - Created by: Ehsan N. Moosa (ehsan) - Maintainers: - 1. Ehsan N. Moosa (ehsan) - Auditor: Ehsan N. Moosa - Copyright Ronak Software Group 2018 -*/ - -// Error Codes -const ( - ErrCodeInternal = "E00" - ErrCodeInvalid = "E01" - ErrCodeUnavailable = "E02" - ErrCodeTooMany = "E03" - ErrCodeTooFew = "E04" - ErrCodeIncomplete = "E05" - ErrCodeTimeout = "E06" - ErrCodeAccess = "E07" - ErrCodeAlreadyExists = "E08" - ErrCodeBusy = "E09" - ErrCodeOutOfRange = "E10" - ErrCodePartiallyApplied = "E11" - ErrCodeExpired = "E12" - ErrCodeRateLimit = "E13" -) - -// Error Items -const ( - ErrItemPhone = "PHONE" - ErrItemPhoneCode = "PHONE_CODE" - ErrItemUserID = "USER_ID" - ErrItemPeer = "PEER" - ErrItemPeerType = "PEER_TYPE" - ErrItemInput = "INPUT" - ErrItemRequest = "REQUEST" - ErrItemMessage = "MESSAGE" - ErrItemMessageID = "MESSAGE_ID" - ErrItemServer = "SERVER" - ErrItemStorageServer = "STORAGE_SERVER" - ErrItemPq = "PQ" - ErrItemEncryption = "ENCRYPTION" - ErrItemRsaKey = "RSA_KEY" - ErrItemProto = "PROTO" - ErrItemDhKey = "DH_KEY" - ErrItemSignIn = "SIGN_IN" - ErrItemRandomID = "RANDOM_ID" - ErrItemAccessHash = "ACCESS_HASH" - ErrItemJobWorker = "JOB_WORKER" - ErrItemAuth = "AUTH" - ErrItemAuthID = "AUTH_ID" - ErrItemUsername = "USERNAME" - ErrItemChatText = "CHAT_TEXT" - ErrItemGroupTitle = "GROUP_TITLE" - ErrItemGroupID = "GROUP_ID" - ErrItemGroup = "GROUP" - ErrItemGroupMember = "GROUP_MEMBER" - ErrItemUsers = "USERS" - ErrItemRetractTime = "RETRACT_TIME" - ErrItemBio = "BIO" - ErrItemApi = "API" - ErrItemLastAdmin = "LAST_ADMIN" - ErrItemDeleteCreator = "DELETE_CREATOR" - ErrItemFilePartID = "FILE_PART_ID" - ErrItemFileParts = "FILE_PARTS" - ErrItemFilePartSize = "FILE_PART_SIZE" - ErrItemDeviceToken = "DEVICE_TOKEN" - ErrItemDeviceModel = "DEVICE_MODEL" - ErrItemDocument = "DOCUMENT" - ErrItemDocumentType = "DOCUMENT_TYPE" - ErrItemToken = "TOKEN" - ErrItemMedia = "MEDIA" - ErrItemPinnedDialogs = "PINNED_DIALOGS" - ErrItemSalt = "SALT" - ErrItemCounter = "COUNTER" - ErrItemAppUpdate = "APP_UPDATE" - ErrItemBindUser = "BIND_USER" - ErrItemActiveConnection = "ACTIVE_CONN" - ErrItemInputFile = "INPUT_FILE" - ErrItemPhotoID = "PHOTO_ID" - ErrItemBot = "BOT" - ErrItemPhoto = "PHOTO" - ErrItemMember = "MEMBER" - ErrItemFeature = "FEATURE" - ErrItemMarshal = "MARSHAL" - ErrItemUnMarshal = "UNMARSHAL" - ErrItemName = "NAME" - ErrItemColour = "COLOUR" - ErrItemLabelID = "LABEL_ID" - ErrItemLabelName = "LABEL_NAME" - ErrItemLabelColour = "LABEL_COLOUR" - ErrItemLabel = "LABEL" - ErrItemAlgorithm = "ALGORITHM" - ErrItemAlgorithmData = "ALGORITHM_DATA" - ErrItemPasswordHash = "PASSWORD_HASH" - ErrItemPassword = "PASSWORD" - ErrItemSrpB = "SRP_B" - ErrItemSrpID = "SRP_ID" - ErrItemLogin = "LOGIN" - ErrItemSecurityQuestion = "SECURITY_QUESTION" - ErrItemSecurityAnswer = "SECURITY_ANSWER" - ErrItemPasswordRecover = "PASSWORD_RECOVER" - ErrItemQuery = "QUERY" - ErrItemBotFather = "BOT_FATHER" - ErrItemAdminBot = "ADMIN_BOT" - ErrItemBotResult = "BOT_RESULT" - ErrItemWallPaper = "WALLPAPER" - ErrItemTeamID = "TEAM_ID" - ErrItemTeamAccess = "TEAM_ACCESS" - ErrItemTeamMember = "TEAM_MEMBER" - ErrItemTeamManager = "TEAM_MANAGER" - ErrItemCall = "CALL" -) diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/files.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/files.pb.go deleted file mode 100644 index 95779bc9..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/files.pb.go +++ /dev/null @@ -1,515 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: files.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// FileType -type FileType int32 - -const ( - FileType_FileTypeUnknown FileType = 0 - FileType_FileTypePartial FileType = 1 - FileType_FileTypeJpeg FileType = 2 - FileType_FileTypeGif FileType = 3 - FileType_FileTypePng FileType = 4 - FileType_FileTypeWebp FileType = 5 - FileType_FileTypeMp3 FileType = 6 - FileType_FileTypeMp4 FileType = 7 - FileType_FileTypeMov FileType = 8 -) - -// Enum value maps for FileType. -var ( - FileType_name = map[int32]string{ - 0: "FileTypeUnknown", - 1: "FileTypePartial", - 2: "FileTypeJpeg", - 3: "FileTypeGif", - 4: "FileTypePng", - 5: "FileTypeWebp", - 6: "FileTypeMp3", - 7: "FileTypeMp4", - 8: "FileTypeMov", - } - FileType_value = map[string]int32{ - "FileTypeUnknown": 0, - "FileTypePartial": 1, - "FileTypeJpeg": 2, - "FileTypeGif": 3, - "FileTypePng": 4, - "FileTypeWebp": 5, - "FileTypeMp3": 6, - "FileTypeMp4": 7, - "FileTypeMov": 8, - } -) - -func (x FileType) Enum() *FileType { - p := new(FileType) - *p = x - return p -} - -func (x FileType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (FileType) Descriptor() protoreflect.EnumDescriptor { - return file_files_proto_enumTypes[0].Descriptor() -} - -func (FileType) Type() protoreflect.EnumType { - return &file_files_proto_enumTypes[0] -} - -func (x FileType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use FileType.Descriptor instead. -func (FileType) EnumDescriptor() ([]byte, []int) { - return file_files_proto_rawDescGZIP(), []int{0} -} - -// FileSavePart -// @Function -// @Return: Bool -type FileSavePart struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - FileID int64 `protobuf:"varint,1,opt,name=FileID,proto3" json:"FileID,omitempty"` - PartID int32 `protobuf:"varint,2,opt,name=PartID,proto3" json:"PartID,omitempty"` - TotalParts int32 `protobuf:"varint,3,opt,name=TotalParts,proto3" json:"TotalParts,omitempty"` - Bytes []byte `protobuf:"bytes,4,opt,name=Bytes,proto3" json:"Bytes,omitempty"` -} - -func (x *FileSavePart) Reset() { - *x = FileSavePart{} - if protoimpl.UnsafeEnabled { - mi := &file_files_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileSavePart) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileSavePart) ProtoMessage() {} - -func (x *FileSavePart) ProtoReflect() protoreflect.Message { - mi := &file_files_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileSavePart.ProtoReflect.Descriptor instead. -func (*FileSavePart) Descriptor() ([]byte, []int) { - return file_files_proto_rawDescGZIP(), []int{0} -} - -func (x *FileSavePart) GetFileID() int64 { - if x != nil { - return x.FileID - } - return 0 -} - -func (x *FileSavePart) GetPartID() int32 { - if x != nil { - return x.PartID - } - return 0 -} - -func (x *FileSavePart) GetTotalParts() int32 { - if x != nil { - return x.TotalParts - } - return 0 -} - -func (x *FileSavePart) GetBytes() []byte { - if x != nil { - return x.Bytes - } - return nil -} - -// FileGetPart -// @Function -// @Return: File -type FileGet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Location *InputFileLocation `protobuf:"bytes,1,opt,name=Location,proto3" json:"Location,omitempty"` - Offset int32 `protobuf:"varint,2,opt,name=Offset,proto3" json:"Offset,omitempty"` - Limit int32 `protobuf:"varint,3,opt,name=Limit,proto3" json:"Limit,omitempty"` -} - -func (x *FileGet) Reset() { - *x = FileGet{} - if protoimpl.UnsafeEnabled { - mi := &file_files_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileGet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileGet) ProtoMessage() {} - -func (x *FileGet) ProtoReflect() protoreflect.Message { - mi := &file_files_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileGet.ProtoReflect.Descriptor instead. -func (*FileGet) Descriptor() ([]byte, []int) { - return file_files_proto_rawDescGZIP(), []int{1} -} - -func (x *FileGet) GetLocation() *InputFileLocation { - if x != nil { - return x.Location - } - return nil -} - -func (x *FileGet) GetOffset() int32 { - if x != nil { - return x.Offset - } - return 0 -} - -func (x *FileGet) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -// FileGetBySha256 -// @Function -// @Return: FileLocation -type FileGetBySha256 struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Sha256 []byte `protobuf:"bytes,1,opt,name=Sha256,proto3" json:"Sha256,omitempty"` - FileSize int32 `protobuf:"varint,2,opt,name=FileSize,proto3" json:"FileSize,omitempty"` -} - -func (x *FileGetBySha256) Reset() { - *x = FileGetBySha256{} - if protoimpl.UnsafeEnabled { - mi := &file_files_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FileGetBySha256) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FileGetBySha256) ProtoMessage() {} - -func (x *FileGetBySha256) ProtoReflect() protoreflect.Message { - mi := &file_files_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FileGetBySha256.ProtoReflect.Descriptor instead. -func (*FileGetBySha256) Descriptor() ([]byte, []int) { - return file_files_proto_rawDescGZIP(), []int{2} -} - -func (x *FileGetBySha256) GetSha256() []byte { - if x != nil { - return x.Sha256 - } - return nil -} - -func (x *FileGetBySha256) GetFileSize() int32 { - if x != nil { - return x.FileSize - } - return 0 -} - -// File -type File struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type FileType `protobuf:"varint,1,opt,name=Type,proto3,enum=msg.FileType" json:"Type,omitempty"` - ModifiedTime int64 `protobuf:"varint,2,opt,name=ModifiedTime,proto3" json:"ModifiedTime,omitempty"` - Bytes []byte `protobuf:"bytes,4,opt,name=Bytes,proto3" json:"Bytes,omitempty"` - MD5Hash string `protobuf:"bytes,5,opt,name=MD5Hash,proto3" json:"MD5Hash,omitempty"` -} - -func (x *File) Reset() { - *x = File{} - if protoimpl.UnsafeEnabled { - mi := &file_files_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *File) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*File) ProtoMessage() {} - -func (x *File) ProtoReflect() protoreflect.Message { - mi := &file_files_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use File.ProtoReflect.Descriptor instead. -func (*File) Descriptor() ([]byte, []int) { - return file_files_proto_rawDescGZIP(), []int{3} -} - -func (x *File) GetType() FileType { - if x != nil { - return x.Type - } - return FileType_FileTypeUnknown -} - -func (x *File) GetModifiedTime() int64 { - if x != nil { - return x.ModifiedTime - } - return 0 -} - -func (x *File) GetBytes() []byte { - if x != nil { - return x.Bytes - } - return nil -} - -func (x *File) GetMD5Hash() string { - if x != nil { - return x.MD5Hash - } - return "" -} - -var File_files_proto protoreflect.FileDescriptor - -var file_files_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, - 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x78, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x61, 0x76, 0x65, - 0x50, 0x61, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x44, - 0x12, 0x16, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x74, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x50, 0x61, 0x72, 0x74, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x54, 0x6f, 0x74, 0x61, - 0x6c, 0x50, 0x61, 0x72, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x54, 0x6f, - 0x74, 0x61, 0x6c, 0x50, 0x61, 0x72, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x42, 0x79, 0x74, 0x65, - 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x6b, - 0x0a, 0x07, 0x46, 0x69, 0x6c, 0x65, 0x47, 0x65, 0x74, 0x12, 0x32, 0x0a, 0x08, 0x4c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, - 0x06, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x4f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x45, 0x0a, 0x0f, 0x46, - 0x69, 0x6c, 0x65, 0x47, 0x65, 0x74, 0x42, 0x79, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x16, - 0x0a, 0x06, 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, - 0x53, 0x68, 0x61, 0x32, 0x35, 0x36, 0x12, 0x1a, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, - 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x69, - 0x7a, 0x65, 0x22, 0x7d, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x54, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, - 0x0c, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0c, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x54, 0x69, 0x6d, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x05, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x4d, 0x44, 0x35, 0x48, 0x61, - 0x73, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x4d, 0x44, 0x35, 0x48, 0x61, 0x73, - 0x68, 0x2a, 0xad, 0x01, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x13, - 0x0a, 0x0f, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, - 0x6e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x50, - 0x61, 0x72, 0x74, 0x69, 0x61, 0x6c, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x4a, 0x70, 0x65, 0x67, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x46, 0x69, - 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x47, 0x69, 0x66, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x46, - 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x50, 0x6e, 0x67, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, - 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x57, 0x65, 0x62, 0x70, 0x10, 0x05, 0x12, 0x0f, - 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x70, 0x33, 0x10, 0x06, 0x12, - 0x0f, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x70, 0x34, 0x10, 0x07, - 0x12, 0x0f, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x6f, 0x76, 0x10, - 0x08, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_files_proto_rawDescOnce sync.Once - file_files_proto_rawDescData = file_files_proto_rawDesc -) - -func file_files_proto_rawDescGZIP() []byte { - file_files_proto_rawDescOnce.Do(func() { - file_files_proto_rawDescData = protoimpl.X.CompressGZIP(file_files_proto_rawDescData) - }) - return file_files_proto_rawDescData -} - -var file_files_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_files_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_files_proto_goTypes = []interface{}{ - (FileType)(0), // 0: msg.FileType - (*FileSavePart)(nil), // 1: msg.FileSavePart - (*FileGet)(nil), // 2: msg.FileGet - (*FileGetBySha256)(nil), // 3: msg.FileGetBySha256 - (*File)(nil), // 4: msg.File - (*InputFileLocation)(nil), // 5: msg.InputFileLocation -} -var file_files_proto_depIdxs = []int32{ - 5, // 0: msg.FileGet.Location:type_name -> msg.InputFileLocation - 0, // 1: msg.File.Type:type_name -> msg.FileType - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_files_proto_init() } -func file_files_proto_init() { - if File_files_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_files_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileSavePart); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_files_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileGet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_files_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileGetBySha256); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_files_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*File); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_files_proto_rawDesc, - NumEnums: 1, - NumMessages: 4, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_files_proto_goTypes, - DependencyIndexes: file_files_proto_depIdxs, - EnumInfos: file_files_proto_enumTypes, - MessageInfos: file_files_proto_msgTypes, - }.Build() - File_files_proto = out.File - file_files_proto_rawDesc = nil - file_files_proto_goTypes = nil - file_files_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/files.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/files.rony.go deleted file mode 100644 index 57feacd1..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/files.rony.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: files.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_FileSavePart int64 = 3766876582 - -type poolFileSavePart struct { - pool sync.Pool -} - -func (p *poolFileSavePart) Get() *FileSavePart { - x, ok := p.pool.Get().(*FileSavePart) - if !ok { - x = &FileSavePart{} - } - - return x -} - -func (p *poolFileSavePart) Put(x *FileSavePart) { - if x == nil { - return - } - - x.FileID = 0 - x.PartID = 0 - x.TotalParts = 0 - x.Bytes = x.Bytes[:0] - - p.pool.Put(x) -} - -var PoolFileSavePart = poolFileSavePart{} - -func (x *FileSavePart) DeepCopy(z *FileSavePart) { - z.FileID = x.FileID - z.PartID = x.PartID - z.TotalParts = x.TotalParts - z.Bytes = append(z.Bytes[:0], x.Bytes...) -} - -func (x *FileSavePart) Clone() *FileSavePart { - z := &FileSavePart{} - x.DeepCopy(z) - return z -} - -func (x *FileSavePart) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *FileSavePart) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *FileSavePart) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *FileSavePart) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *FileSavePart) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_FileSavePart, x) -} - -const C_FileGet int64 = 4282510672 - -type poolFileGet struct { - pool sync.Pool -} - -func (p *poolFileGet) Get() *FileGet { - x, ok := p.pool.Get().(*FileGet) - if !ok { - x = &FileGet{} - } - - x.Location = PoolInputFileLocation.Get() - - return x -} - -func (p *poolFileGet) Put(x *FileGet) { - if x == nil { - return - } - - PoolInputFileLocation.Put(x.Location) - x.Offset = 0 - x.Limit = 0 - - p.pool.Put(x) -} - -var PoolFileGet = poolFileGet{} - -func (x *FileGet) DeepCopy(z *FileGet) { - if x.Location != nil { - if z.Location == nil { - z.Location = PoolInputFileLocation.Get() - } - x.Location.DeepCopy(z.Location) - } else { - PoolInputFileLocation.Put(z.Location) - z.Location = nil - } - z.Offset = x.Offset - z.Limit = x.Limit -} - -func (x *FileGet) Clone() *FileGet { - z := &FileGet{} - x.DeepCopy(z) - return z -} - -func (x *FileGet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *FileGet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *FileGet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *FileGet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *FileGet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_FileGet, x) -} - -const C_FileGetBySha256 int64 = 2768049463 - -type poolFileGetBySha256 struct { - pool sync.Pool -} - -func (p *poolFileGetBySha256) Get() *FileGetBySha256 { - x, ok := p.pool.Get().(*FileGetBySha256) - if !ok { - x = &FileGetBySha256{} - } - - return x -} - -func (p *poolFileGetBySha256) Put(x *FileGetBySha256) { - if x == nil { - return - } - - x.Sha256 = x.Sha256[:0] - x.FileSize = 0 - - p.pool.Put(x) -} - -var PoolFileGetBySha256 = poolFileGetBySha256{} - -func (x *FileGetBySha256) DeepCopy(z *FileGetBySha256) { - z.Sha256 = append(z.Sha256[:0], x.Sha256...) - z.FileSize = x.FileSize -} - -func (x *FileGetBySha256) Clone() *FileGetBySha256 { - z := &FileGetBySha256{} - x.DeepCopy(z) - return z -} - -func (x *FileGetBySha256) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *FileGetBySha256) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *FileGetBySha256) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *FileGetBySha256) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *FileGetBySha256) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_FileGetBySha256, x) -} - -const C_File int64 = 749574446 - -type poolFile struct { - pool sync.Pool -} - -func (p *poolFile) Get() *File { - x, ok := p.pool.Get().(*File) - if !ok { - x = &File{} - } - - return x -} - -func (p *poolFile) Put(x *File) { - if x == nil { - return - } - - x.Type = 0 - x.ModifiedTime = 0 - x.Bytes = x.Bytes[:0] - x.MD5Hash = "" - - p.pool.Put(x) -} - -var PoolFile = poolFile{} - -func (x *File) DeepCopy(z *File) { - z.Type = x.Type - z.ModifiedTime = x.ModifiedTime - z.Bytes = append(z.Bytes[:0], x.Bytes...) - z.MD5Hash = x.MD5Hash -} - -func (x *File) Clone() *File { - z := &File{} - x.DeepCopy(z) - return z -} - -func (x *File) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *File) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *File) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *File) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *File) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_File, x) -} - -func init() { - registry.RegisterConstructor(3766876582, "FileSavePart") - registry.RegisterConstructor(4282510672, "FileGet") - registry.RegisterConstructor(2768049463, "FileGetBySha256") - registry.RegisterConstructor(749574446, "File") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/gif.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/gif.pb.go deleted file mode 100644 index 73ad58a4..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/gif.pb.go +++ /dev/null @@ -1,617 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: gif.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// GifGetSaved -// @Function -// @Return: SavedGifs -type GifGetSaved struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Hash uint32 `protobuf:"fixed32,1,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *GifGetSaved) Reset() { - *x = GifGetSaved{} - if protoimpl.UnsafeEnabled { - mi := &file_gif_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GifGetSaved) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GifGetSaved) ProtoMessage() {} - -func (x *GifGetSaved) ProtoReflect() protoreflect.Message { - mi := &file_gif_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GifGetSaved.ProtoReflect.Descriptor instead. -func (*GifGetSaved) Descriptor() ([]byte, []int) { - return file_gif_proto_rawDescGZIP(), []int{0} -} - -func (x *GifGetSaved) GetHash() uint32 { - if x != nil { - return x.Hash - } - return 0 -} - -// GifSave -// @Function -// @Return: Bool -type GifSave struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Doc *InputDocument `protobuf:"bytes,1,opt,name=Doc,proto3" json:"Doc,omitempty"` - Attributes []*DocumentAttribute `protobuf:"bytes,2,rep,name=Attributes,proto3" json:"Attributes,omitempty"` -} - -func (x *GifSave) Reset() { - *x = GifSave{} - if protoimpl.UnsafeEnabled { - mi := &file_gif_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GifSave) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GifSave) ProtoMessage() {} - -func (x *GifSave) ProtoReflect() protoreflect.Message { - mi := &file_gif_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GifSave.ProtoReflect.Descriptor instead. -func (*GifSave) Descriptor() ([]byte, []int) { - return file_gif_proto_rawDescGZIP(), []int{1} -} - -func (x *GifSave) GetDoc() *InputDocument { - if x != nil { - return x.Doc - } - return nil -} - -func (x *GifSave) GetAttributes() []*DocumentAttribute { - if x != nil { - return x.Attributes - } - return nil -} - -// GifDelete -type GifDelete struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Doc *InputDocument `protobuf:"bytes,1,opt,name=Doc,proto3" json:"Doc,omitempty"` -} - -func (x *GifDelete) Reset() { - *x = GifDelete{} - if protoimpl.UnsafeEnabled { - mi := &file_gif_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GifDelete) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GifDelete) ProtoMessage() {} - -func (x *GifDelete) ProtoReflect() protoreflect.Message { - mi := &file_gif_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GifDelete.ProtoReflect.Descriptor instead. -func (*GifDelete) Descriptor() ([]byte, []int) { - return file_gif_proto_rawDescGZIP(), []int{2} -} - -func (x *GifDelete) GetDoc() *InputDocument { - if x != nil { - return x.Doc - } - return nil -} - -// GifSearch -// @Function -// @Return: FoundGifs -type GifSearch struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Query string `protobuf:"bytes,1,opt,name=Query,proto3" json:"Query,omitempty"` - Hash int64 `protobuf:"varint,2,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *GifSearch) Reset() { - *x = GifSearch{} - if protoimpl.UnsafeEnabled { - mi := &file_gif_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GifSearch) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GifSearch) ProtoMessage() {} - -func (x *GifSearch) ProtoReflect() protoreflect.Message { - mi := &file_gif_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use GifSearch.ProtoReflect.Descriptor instead. -func (*GifSearch) Descriptor() ([]byte, []int) { - return file_gif_proto_rawDescGZIP(), []int{3} -} - -func (x *GifSearch) GetQuery() string { - if x != nil { - return x.Query - } - return "" -} - -func (x *GifSearch) GetHash() int64 { - if x != nil { - return x.Hash - } - return 0 -} - -// FoundGifs -type FoundGifs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NextOffset int32 `protobuf:"varint,1,opt,name=NextOffset,proto3" json:"NextOffset,omitempty"` - Gifs []*FoundGif `protobuf:"bytes,2,rep,name=Gifs,proto3" json:"Gifs,omitempty"` -} - -func (x *FoundGifs) Reset() { - *x = FoundGifs{} - if protoimpl.UnsafeEnabled { - mi := &file_gif_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FoundGifs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FoundGifs) ProtoMessage() {} - -func (x *FoundGifs) ProtoReflect() protoreflect.Message { - mi := &file_gif_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FoundGifs.ProtoReflect.Descriptor instead. -func (*FoundGifs) Descriptor() ([]byte, []int) { - return file_gif_proto_rawDescGZIP(), []int{4} -} - -func (x *FoundGifs) GetNextOffset() int32 { - if x != nil { - return x.NextOffset - } - return 0 -} - -func (x *FoundGifs) GetGifs() []*FoundGif { - if x != nil { - return x.Gifs - } - return nil -} - -// FoundGif -type FoundGif struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=Url,proto3" json:"Url,omitempty"` - Doc *Document `protobuf:"bytes,2,opt,name=Doc,proto3" json:"Doc,omitempty"` - Thumb *Document `protobuf:"bytes,3,opt,name=Thumb,proto3" json:"Thumb,omitempty"` -} - -func (x *FoundGif) Reset() { - *x = FoundGif{} - if protoimpl.UnsafeEnabled { - mi := &file_gif_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FoundGif) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FoundGif) ProtoMessage() {} - -func (x *FoundGif) ProtoReflect() protoreflect.Message { - mi := &file_gif_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FoundGif.ProtoReflect.Descriptor instead. -func (*FoundGif) Descriptor() ([]byte, []int) { - return file_gif_proto_rawDescGZIP(), []int{5} -} - -func (x *FoundGif) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -func (x *FoundGif) GetDoc() *Document { - if x != nil { - return x.Doc - } - return nil -} - -func (x *FoundGif) GetThumb() *Document { - if x != nil { - return x.Thumb - } - return nil -} - -// SavedGifs -type SavedGifs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Hash uint32 `protobuf:"fixed32,1,opt,name=Hash,proto3" json:"Hash,omitempty"` - Docs []*MediaDocument `protobuf:"bytes,2,rep,name=Docs,proto3" json:"Docs,omitempty"` - NotModified bool `protobuf:"varint,3,opt,name=NotModified,proto3" json:"NotModified,omitempty"` -} - -func (x *SavedGifs) Reset() { - *x = SavedGifs{} - if protoimpl.UnsafeEnabled { - mi := &file_gif_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SavedGifs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SavedGifs) ProtoMessage() {} - -func (x *SavedGifs) ProtoReflect() protoreflect.Message { - mi := &file_gif_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SavedGifs.ProtoReflect.Descriptor instead. -func (*SavedGifs) Descriptor() ([]byte, []int) { - return file_gif_proto_rawDescGZIP(), []int{6} -} - -func (x *SavedGifs) GetHash() uint32 { - if x != nil { - return x.Hash - } - return 0 -} - -func (x *SavedGifs) GetDocs() []*MediaDocument { - if x != nil { - return x.Docs - } - return nil -} - -func (x *SavedGifs) GetNotModified() bool { - if x != nil { - return x.NotModified - } - return false -} - -var File_gif_proto protoreflect.FileDescriptor - -var file_gif_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x67, 0x69, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, 0x67, - 0x1a, 0x1a, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, - 0x6d, 0x65, 0x64, 0x69, 0x61, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x10, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x21, - 0x0a, 0x0b, 0x47, 0x69, 0x66, 0x47, 0x65, 0x74, 0x53, 0x61, 0x76, 0x65, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x07, 0x52, 0x04, 0x48, 0x61, 0x73, - 0x68, 0x22, 0x67, 0x0a, 0x07, 0x47, 0x69, 0x66, 0x53, 0x61, 0x76, 0x65, 0x12, 0x24, 0x0a, 0x03, - 0x44, 0x6f, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x49, 0x6e, 0x70, 0x75, 0x74, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x03, 0x44, - 0x6f, 0x63, 0x12, 0x36, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, - 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x22, 0x31, 0x0a, 0x09, 0x47, 0x69, - 0x66, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x24, 0x0a, 0x03, 0x44, 0x6f, 0x63, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x03, 0x44, 0x6f, 0x63, 0x22, 0x35, 0x0a, - 0x09, 0x47, 0x69, 0x66, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, - 0x48, 0x61, 0x73, 0x68, 0x22, 0x4e, 0x0a, 0x09, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x69, 0x66, - 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x4e, 0x65, 0x78, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x4e, 0x65, 0x78, 0x74, 0x4f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x12, 0x21, 0x0a, 0x04, 0x47, 0x69, 0x66, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0d, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x69, 0x66, 0x52, 0x04, - 0x47, 0x69, 0x66, 0x73, 0x22, 0x62, 0x0a, 0x08, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x47, 0x69, 0x66, - 0x12, 0x10, 0x0a, 0x03, 0x55, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x55, - 0x72, 0x6c, 0x12, 0x1f, 0x0a, 0x03, 0x44, 0x6f, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0d, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x03, - 0x44, 0x6f, 0x63, 0x12, 0x23, 0x0a, 0x05, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x52, 0x05, 0x54, 0x68, 0x75, 0x6d, 0x62, 0x22, 0x69, 0x0a, 0x09, 0x53, 0x61, 0x76, 0x65, - 0x64, 0x47, 0x69, 0x66, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x07, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x12, 0x26, 0x0a, 0x04, 0x44, 0x6f, 0x63, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, - 0x64, 0x69, 0x61, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x44, 0x6f, 0x63, - 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x4e, 0x6f, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, - 0x69, 0x65, 0x64, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_gif_proto_rawDescOnce sync.Once - file_gif_proto_rawDescData = file_gif_proto_rawDesc -) - -func file_gif_proto_rawDescGZIP() []byte { - file_gif_proto_rawDescOnce.Do(func() { - file_gif_proto_rawDescData = protoimpl.X.CompressGZIP(file_gif_proto_rawDescData) - }) - return file_gif_proto_rawDescData -} - -var file_gif_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_gif_proto_goTypes = []interface{}{ - (*GifGetSaved)(nil), // 0: msg.GifGetSaved - (*GifSave)(nil), // 1: msg.GifSave - (*GifDelete)(nil), // 2: msg.GifDelete - (*GifSearch)(nil), // 3: msg.GifSearch - (*FoundGifs)(nil), // 4: msg.FoundGifs - (*FoundGif)(nil), // 5: msg.FoundGif - (*SavedGifs)(nil), // 6: msg.SavedGifs - (*InputDocument)(nil), // 7: msg.InputDocument - (*DocumentAttribute)(nil), // 8: msg.DocumentAttribute - (*Document)(nil), // 9: msg.Document - (*MediaDocument)(nil), // 10: msg.MediaDocument -} -var file_gif_proto_depIdxs = []int32{ - 7, // 0: msg.GifSave.Doc:type_name -> msg.InputDocument - 8, // 1: msg.GifSave.Attributes:type_name -> msg.DocumentAttribute - 7, // 2: msg.GifDelete.Doc:type_name -> msg.InputDocument - 5, // 3: msg.FoundGifs.Gifs:type_name -> msg.FoundGif - 9, // 4: msg.FoundGif.Doc:type_name -> msg.Document - 9, // 5: msg.FoundGif.Thumb:type_name -> msg.Document - 10, // 6: msg.SavedGifs.Docs:type_name -> msg.MediaDocument - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_gif_proto_init() } -func file_gif_proto_init() { - if File_gif_proto != nil { - return - } - file_chat_messages_medias_proto_init() - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_gif_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GifGetSaved); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gif_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GifSave); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gif_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GifDelete); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gif_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GifSearch); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gif_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FoundGifs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gif_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FoundGif); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gif_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SavedGifs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_gif_proto_rawDesc, - NumEnums: 0, - NumMessages: 7, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_gif_proto_goTypes, - DependencyIndexes: file_gif_proto_depIdxs, - MessageInfos: file_gif_proto_msgTypes, - }.Build() - File_gif_proto = out.File - file_gif_proto_rawDesc = nil - file_gif_proto_goTypes = nil - file_gif_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/gif.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/gif.rony.go deleted file mode 100644 index 3b1bbc46..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/gif.rony.go +++ /dev/null @@ -1,513 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: gif.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_GifGetSaved int64 = 35292745 - -type poolGifGetSaved struct { - pool sync.Pool -} - -func (p *poolGifGetSaved) Get() *GifGetSaved { - x, ok := p.pool.Get().(*GifGetSaved) - if !ok { - x = &GifGetSaved{} - } - - return x -} - -func (p *poolGifGetSaved) Put(x *GifGetSaved) { - if x == nil { - return - } - - x.Hash = 0 - - p.pool.Put(x) -} - -var PoolGifGetSaved = poolGifGetSaved{} - -func (x *GifGetSaved) DeepCopy(z *GifGetSaved) { - z.Hash = x.Hash -} - -func (x *GifGetSaved) Clone() *GifGetSaved { - z := &GifGetSaved{} - x.DeepCopy(z) - return z -} - -func (x *GifGetSaved) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GifGetSaved) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GifGetSaved) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GifGetSaved) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GifGetSaved) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GifGetSaved, x) -} - -const C_GifSave int64 = 4049142282 - -type poolGifSave struct { - pool sync.Pool -} - -func (p *poolGifSave) Get() *GifSave { - x, ok := p.pool.Get().(*GifSave) - if !ok { - x = &GifSave{} - } - - x.Doc = PoolInputDocument.Get() - - return x -} - -func (p *poolGifSave) Put(x *GifSave) { - if x == nil { - return - } - - PoolInputDocument.Put(x.Doc) - for _, z := range x.Attributes { - PoolDocumentAttribute.Put(z) - } - x.Attributes = x.Attributes[:0] - - p.pool.Put(x) -} - -var PoolGifSave = poolGifSave{} - -func (x *GifSave) DeepCopy(z *GifSave) { - if x.Doc != nil { - if z.Doc == nil { - z.Doc = PoolInputDocument.Get() - } - x.Doc.DeepCopy(z.Doc) - } else { - PoolInputDocument.Put(z.Doc) - z.Doc = nil - } - for idx := range x.Attributes { - if x.Attributes[idx] == nil { - continue - } - xx := PoolDocumentAttribute.Get() - x.Attributes[idx].DeepCopy(xx) - z.Attributes = append(z.Attributes, xx) - } -} - -func (x *GifSave) Clone() *GifSave { - z := &GifSave{} - x.DeepCopy(z) - return z -} - -func (x *GifSave) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GifSave) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GifSave) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GifSave) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GifSave) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GifSave, x) -} - -const C_GifDelete int64 = 4148453437 - -type poolGifDelete struct { - pool sync.Pool -} - -func (p *poolGifDelete) Get() *GifDelete { - x, ok := p.pool.Get().(*GifDelete) - if !ok { - x = &GifDelete{} - } - - x.Doc = PoolInputDocument.Get() - - return x -} - -func (p *poolGifDelete) Put(x *GifDelete) { - if x == nil { - return - } - - PoolInputDocument.Put(x.Doc) - - p.pool.Put(x) -} - -var PoolGifDelete = poolGifDelete{} - -func (x *GifDelete) DeepCopy(z *GifDelete) { - if x.Doc != nil { - if z.Doc == nil { - z.Doc = PoolInputDocument.Get() - } - x.Doc.DeepCopy(z.Doc) - } else { - PoolInputDocument.Put(z.Doc) - z.Doc = nil - } -} - -func (x *GifDelete) Clone() *GifDelete { - z := &GifDelete{} - x.DeepCopy(z) - return z -} - -func (x *GifDelete) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GifDelete) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GifDelete) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GifDelete) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GifDelete) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GifDelete, x) -} - -const C_GifSearch int64 = 2040973085 - -type poolGifSearch struct { - pool sync.Pool -} - -func (p *poolGifSearch) Get() *GifSearch { - x, ok := p.pool.Get().(*GifSearch) - if !ok { - x = &GifSearch{} - } - - return x -} - -func (p *poolGifSearch) Put(x *GifSearch) { - if x == nil { - return - } - - x.Query = "" - x.Hash = 0 - - p.pool.Put(x) -} - -var PoolGifSearch = poolGifSearch{} - -func (x *GifSearch) DeepCopy(z *GifSearch) { - z.Query = x.Query - z.Hash = x.Hash -} - -func (x *GifSearch) Clone() *GifSearch { - z := &GifSearch{} - x.DeepCopy(z) - return z -} - -func (x *GifSearch) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *GifSearch) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *GifSearch) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *GifSearch) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *GifSearch) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_GifSearch, x) -} - -const C_FoundGifs int64 = 423157907 - -type poolFoundGifs struct { - pool sync.Pool -} - -func (p *poolFoundGifs) Get() *FoundGifs { - x, ok := p.pool.Get().(*FoundGifs) - if !ok { - x = &FoundGifs{} - } - - return x -} - -func (p *poolFoundGifs) Put(x *FoundGifs) { - if x == nil { - return - } - - x.NextOffset = 0 - for _, z := range x.Gifs { - PoolFoundGif.Put(z) - } - x.Gifs = x.Gifs[:0] - - p.pool.Put(x) -} - -var PoolFoundGifs = poolFoundGifs{} - -func (x *FoundGifs) DeepCopy(z *FoundGifs) { - z.NextOffset = x.NextOffset - for idx := range x.Gifs { - if x.Gifs[idx] == nil { - continue - } - xx := PoolFoundGif.Get() - x.Gifs[idx].DeepCopy(xx) - z.Gifs = append(z.Gifs, xx) - } -} - -func (x *FoundGifs) Clone() *FoundGifs { - z := &FoundGifs{} - x.DeepCopy(z) - return z -} - -func (x *FoundGifs) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *FoundGifs) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *FoundGifs) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *FoundGifs) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *FoundGifs) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_FoundGifs, x) -} - -const C_FoundGif int64 = 1539084995 - -type poolFoundGif struct { - pool sync.Pool -} - -func (p *poolFoundGif) Get() *FoundGif { - x, ok := p.pool.Get().(*FoundGif) - if !ok { - x = &FoundGif{} - } - - x.Doc = PoolDocument.Get() - - x.Thumb = PoolDocument.Get() - - return x -} - -func (p *poolFoundGif) Put(x *FoundGif) { - if x == nil { - return - } - - x.Url = "" - PoolDocument.Put(x.Doc) - PoolDocument.Put(x.Thumb) - - p.pool.Put(x) -} - -var PoolFoundGif = poolFoundGif{} - -func (x *FoundGif) DeepCopy(z *FoundGif) { - z.Url = x.Url - if x.Doc != nil { - if z.Doc == nil { - z.Doc = PoolDocument.Get() - } - x.Doc.DeepCopy(z.Doc) - } else { - PoolDocument.Put(z.Doc) - z.Doc = nil - } - if x.Thumb != nil { - if z.Thumb == nil { - z.Thumb = PoolDocument.Get() - } - x.Thumb.DeepCopy(z.Thumb) - } else { - PoolDocument.Put(z.Thumb) - z.Thumb = nil - } -} - -func (x *FoundGif) Clone() *FoundGif { - z := &FoundGif{} - x.DeepCopy(z) - return z -} - -func (x *FoundGif) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *FoundGif) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *FoundGif) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *FoundGif) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *FoundGif) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_FoundGif, x) -} - -const C_SavedGifs int64 = 2982813633 - -type poolSavedGifs struct { - pool sync.Pool -} - -func (p *poolSavedGifs) Get() *SavedGifs { - x, ok := p.pool.Get().(*SavedGifs) - if !ok { - x = &SavedGifs{} - } - - return x -} - -func (p *poolSavedGifs) Put(x *SavedGifs) { - if x == nil { - return - } - - x.Hash = 0 - for _, z := range x.Docs { - PoolMediaDocument.Put(z) - } - x.Docs = x.Docs[:0] - x.NotModified = false - - p.pool.Put(x) -} - -var PoolSavedGifs = poolSavedGifs{} - -func (x *SavedGifs) DeepCopy(z *SavedGifs) { - z.Hash = x.Hash - for idx := range x.Docs { - if x.Docs[idx] == nil { - continue - } - xx := PoolMediaDocument.Get() - x.Docs[idx].DeepCopy(xx) - z.Docs = append(z.Docs, xx) - } - z.NotModified = x.NotModified -} - -func (x *SavedGifs) Clone() *SavedGifs { - z := &SavedGifs{} - x.DeepCopy(z) - return z -} - -func (x *SavedGifs) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SavedGifs) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SavedGifs) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SavedGifs) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SavedGifs) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SavedGifs, x) -} - -func init() { - registry.RegisterConstructor(35292745, "GifGetSaved") - registry.RegisterConstructor(4049142282, "GifSave") - registry.RegisterConstructor(4148453437, "GifDelete") - registry.RegisterConstructor(2040973085, "GifSearch") - registry.RegisterConstructor(423157907, "FoundGifs") - registry.RegisterConstructor(1539084995, "FoundGif") - registry.RegisterConstructor(2982813633, "SavedGifs") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/public.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/public.pb.go deleted file mode 100644 index c89c0fc3..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/public.pb.go +++ /dev/null @@ -1,285 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: public.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// PublicGetUserInfo -// @Function -// @Return: UserInfo -type PublicGetUserInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Username string `protobuf:"bytes,1,opt,name=Username,proto3" json:"Username,omitempty"` - UserAgent string `protobuf:"bytes,2,opt,name=UserAgent,proto3" json:"UserAgent,omitempty"` -} - -func (x *PublicGetUserInfo) Reset() { - *x = PublicGetUserInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_public_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PublicGetUserInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PublicGetUserInfo) ProtoMessage() {} - -func (x *PublicGetUserInfo) ProtoReflect() protoreflect.Message { - mi := &file_public_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use PublicGetUserInfo.ProtoReflect.Descriptor instead. -func (*PublicGetUserInfo) Descriptor() ([]byte, []int) { - return file_public_proto_rawDescGZIP(), []int{0} -} - -func (x *PublicGetUserInfo) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *PublicGetUserInfo) GetUserAgent() string { - if x != nil { - return x.UserAgent - } - return "" -} - -// UserInfo -type UserInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Firstname string `protobuf:"bytes,1,opt,name=Firstname,proto3" json:"Firstname,omitempty"` - Lastname string `protobuf:"bytes,2,opt,name=Lastname,proto3" json:"Lastname,omitempty"` - Username string `protobuf:"bytes,3,opt,name=Username,proto3" json:"Username,omitempty"` - JoinedDate int64 `protobuf:"varint,4,opt,name=JoinedDate,proto3" json:"JoinedDate,omitempty"` - Photo []byte `protobuf:"bytes,5,opt,name=Photo,proto3" json:"Photo,omitempty"` - Official bool `protobuf:"varint,6,opt,name=Official,proto3" json:"Official,omitempty"` - Bot bool `protobuf:"varint,7,opt,name=Bot,proto3" json:"Bot,omitempty"` - Bio string `protobuf:"bytes,8,opt,name=Bio,proto3" json:"Bio,omitempty"` -} - -func (x *UserInfo) Reset() { - *x = UserInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_public_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UserInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UserInfo) ProtoMessage() {} - -func (x *UserInfo) ProtoReflect() protoreflect.Message { - mi := &file_public_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UserInfo.ProtoReflect.Descriptor instead. -func (*UserInfo) Descriptor() ([]byte, []int) { - return file_public_proto_rawDescGZIP(), []int{1} -} - -func (x *UserInfo) GetFirstname() string { - if x != nil { - return x.Firstname - } - return "" -} - -func (x *UserInfo) GetLastname() string { - if x != nil { - return x.Lastname - } - return "" -} - -func (x *UserInfo) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *UserInfo) GetJoinedDate() int64 { - if x != nil { - return x.JoinedDate - } - return 0 -} - -func (x *UserInfo) GetPhoto() []byte { - if x != nil { - return x.Photo - } - return nil -} - -func (x *UserInfo) GetOfficial() bool { - if x != nil { - return x.Official - } - return false -} - -func (x *UserInfo) GetBot() bool { - if x != nil { - return x.Bot - } - return false -} - -func (x *UserInfo) GetBio() string { - if x != nil { - return x.Bio - } - return "" -} - -var File_public_proto protoreflect.FileDescriptor - -var file_public_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, - 0x6d, 0x73, 0x67, 0x22, 0x4d, 0x0a, 0x11, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x47, 0x65, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x55, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, - 0x6e, 0x74, 0x22, 0xd6, 0x01, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x1c, 0x0a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x4c, 0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x4c, 0x61, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, - 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, - 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x4a, 0x6f, 0x69, 0x6e, 0x65, 0x64, 0x44, - 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x4a, 0x6f, 0x69, 0x6e, 0x65, - 0x64, 0x44, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x4f, - 0x66, 0x66, 0x69, 0x63, 0x69, 0x61, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x4f, - 0x66, 0x66, 0x69, 0x63, 0x69, 0x61, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x42, 0x6f, 0x74, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x42, 0x6f, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x42, 0x69, 0x6f, - 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x42, 0x69, 0x6f, 0x42, 0x08, 0x5a, 0x06, 0x2e, - 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_public_proto_rawDescOnce sync.Once - file_public_proto_rawDescData = file_public_proto_rawDesc -) - -func file_public_proto_rawDescGZIP() []byte { - file_public_proto_rawDescOnce.Do(func() { - file_public_proto_rawDescData = protoimpl.X.CompressGZIP(file_public_proto_rawDescData) - }) - return file_public_proto_rawDescData -} - -var file_public_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_public_proto_goTypes = []interface{}{ - (*PublicGetUserInfo)(nil), // 0: msg.PublicGetUserInfo - (*UserInfo)(nil), // 1: msg.UserInfo -} -var file_public_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_public_proto_init() } -func file_public_proto_init() { - if File_public_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_public_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PublicGetUserInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_public_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UserInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_public_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_public_proto_goTypes, - DependencyIndexes: file_public_proto_depIdxs, - MessageInfos: file_public_proto_msgTypes, - }.Build() - File_public_proto = out.File - file_public_proto_rawDesc = nil - file_public_proto_goTypes = nil - file_public_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/public.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/public.rony.go deleted file mode 100644 index fc07823e..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/public.rony.go +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: public.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_PublicGetUserInfo int64 = 2292051365 - -type poolPublicGetUserInfo struct { - pool sync.Pool -} - -func (p *poolPublicGetUserInfo) Get() *PublicGetUserInfo { - x, ok := p.pool.Get().(*PublicGetUserInfo) - if !ok { - x = &PublicGetUserInfo{} - } - - return x -} - -func (p *poolPublicGetUserInfo) Put(x *PublicGetUserInfo) { - if x == nil { - return - } - - x.Username = "" - x.UserAgent = "" - - p.pool.Put(x) -} - -var PoolPublicGetUserInfo = poolPublicGetUserInfo{} - -func (x *PublicGetUserInfo) DeepCopy(z *PublicGetUserInfo) { - z.Username = x.Username - z.UserAgent = x.UserAgent -} - -func (x *PublicGetUserInfo) Clone() *PublicGetUserInfo { - z := &PublicGetUserInfo{} - x.DeepCopy(z) - return z -} - -func (x *PublicGetUserInfo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *PublicGetUserInfo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *PublicGetUserInfo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *PublicGetUserInfo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *PublicGetUserInfo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_PublicGetUserInfo, x) -} - -const C_UserInfo int64 = 883983438 - -type poolUserInfo struct { - pool sync.Pool -} - -func (p *poolUserInfo) Get() *UserInfo { - x, ok := p.pool.Get().(*UserInfo) - if !ok { - x = &UserInfo{} - } - - return x -} - -func (p *poolUserInfo) Put(x *UserInfo) { - if x == nil { - return - } - - x.Firstname = "" - x.Lastname = "" - x.Username = "" - x.JoinedDate = 0 - x.Photo = x.Photo[:0] - x.Official = false - x.Bot = false - x.Bio = "" - - p.pool.Put(x) -} - -var PoolUserInfo = poolUserInfo{} - -func (x *UserInfo) DeepCopy(z *UserInfo) { - z.Firstname = x.Firstname - z.Lastname = x.Lastname - z.Username = x.Username - z.JoinedDate = x.JoinedDate - z.Photo = append(z.Photo[:0], x.Photo...) - z.Official = x.Official - z.Bot = x.Bot - z.Bio = x.Bio -} - -func (x *UserInfo) Clone() *UserInfo { - z := &UserInfo{} - x.DeepCopy(z) - return z -} - -func (x *UserInfo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UserInfo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UserInfo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UserInfo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UserInfo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UserInfo, x) -} - -func init() { - registry.RegisterConstructor(2292051365, "PublicGetUserInfo") - registry.RegisterConstructor(883983438, "UserInfo") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/rpc.go b/vendor/git.ronaksoft.com/river/msg/go/msg/rpc.go deleted file mode 100644 index b947c292..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/rpc.go +++ /dev/null @@ -1,11 +0,0 @@ -package msg - -/* - Creation Time: 2018 - Apr - 07 - Created by: Ehsan N. Moosa (ehsan) - Maintainers: - 1. Ehsan N. Moosa (ehsan) - Auditor: Ehsan N. Moosa - Copyright Ronak Software Group 2018 -*/ -var ConstructorNames = make(map[int64]string) diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/service.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/service.pb.go deleted file mode 100644 index 7b69d5cc..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/service.pb.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: service.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ServiceSendMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - OnBehalf int64 `protobuf:"varint,100,opt,name=OnBehalf,proto3" json:"OnBehalf,omitempty"` - RandomID int64 `protobuf:"varint,1,opt,name=RandomID,proto3" json:"RandomID,omitempty"` - Peer *InputPeer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` - Body string `protobuf:"bytes,5,opt,name=Body,proto3" json:"Body,omitempty"` - ReplyTo int64 `protobuf:"varint,6,opt,name=ReplyTo,proto3" json:"ReplyTo,omitempty"` - ClearDraft bool `protobuf:"varint,7,opt,name=ClearDraft,proto3" json:"ClearDraft,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,8,rep,name=Entities,proto3" json:"Entities,omitempty"` -} - -func (x *ServiceSendMessage) Reset() { - *x = ServiceSendMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_service_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServiceSendMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServiceSendMessage) ProtoMessage() {} - -func (x *ServiceSendMessage) ProtoReflect() protoreflect.Message { - mi := &file_service_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ServiceSendMessage.ProtoReflect.Descriptor instead. -func (*ServiceSendMessage) Descriptor() ([]byte, []int) { - return file_service_proto_rawDescGZIP(), []int{0} -} - -func (x *ServiceSendMessage) GetOnBehalf() int64 { - if x != nil { - return x.OnBehalf - } - return 0 -} - -func (x *ServiceSendMessage) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -func (x *ServiceSendMessage) GetPeer() *InputPeer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *ServiceSendMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *ServiceSendMessage) GetReplyTo() int64 { - if x != nil { - return x.ReplyTo - } - return 0 -} - -func (x *ServiceSendMessage) GetClearDraft() bool { - if x != nil { - return x.ClearDraft - } - return false -} - -func (x *ServiceSendMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -var File_service_proto protoreflect.FileDescriptor - -var file_service_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xee, 0x01, 0x0a, 0x12, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x4f, 0x6e, 0x42, 0x65, 0x68, 0x61, 0x6c, 0x66, 0x18, 0x64, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x4f, 0x6e, 0x42, 0x65, 0x68, 0x61, 0x6c, 0x66, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, - 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, - 0x64, 0x6f, 0x6d, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x50, - 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x42, 0x6f, 0x64, - 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x18, 0x0a, - 0x07, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x6c, 0x65, 0x61, 0x72, - 0x44, 0x72, 0x61, 0x66, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x43, 0x6c, 0x65, - 0x61, 0x72, 0x44, 0x72, 0x61, 0x66, 0x74, 0x12, 0x2e, 0x0a, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x69, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, - 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_service_proto_rawDescOnce sync.Once - file_service_proto_rawDescData = file_service_proto_rawDesc -) - -func file_service_proto_rawDescGZIP() []byte { - file_service_proto_rawDescOnce.Do(func() { - file_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_proto_rawDescData) - }) - return file_service_proto_rawDescData -} - -var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_service_proto_goTypes = []interface{}{ - (*ServiceSendMessage)(nil), // 0: msg.ServiceSendMessage - (*InputPeer)(nil), // 1: msg.InputPeer - (*MessageEntity)(nil), // 2: msg.MessageEntity -} -var file_service_proto_depIdxs = []int32{ - 1, // 0: msg.ServiceSendMessage.Peer:type_name -> msg.InputPeer - 2, // 1: msg.ServiceSendMessage.Entities:type_name -> msg.MessageEntity - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_service_proto_init() } -func file_service_proto_init() { - if File_service_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServiceSendMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_service_proto_goTypes, - DependencyIndexes: file_service_proto_depIdxs, - MessageInfos: file_service_proto_msgTypes, - }.Build() - File_service_proto = out.File - file_service_proto_rawDesc = nil - file_service_proto_goTypes = nil - file_service_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/service.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/service.rony.go deleted file mode 100644 index f1560c8c..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/service.rony.go +++ /dev/null @@ -1,113 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: service.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_ServiceSendMessage int64 = 824547051 - -type poolServiceSendMessage struct { - pool sync.Pool -} - -func (p *poolServiceSendMessage) Get() *ServiceSendMessage { - x, ok := p.pool.Get().(*ServiceSendMessage) - if !ok { - x = &ServiceSendMessage{} - } - - x.Peer = PoolInputPeer.Get() - - return x -} - -func (p *poolServiceSendMessage) Put(x *ServiceSendMessage) { - if x == nil { - return - } - - x.OnBehalf = 0 - x.RandomID = 0 - PoolInputPeer.Put(x.Peer) - x.Body = "" - x.ReplyTo = 0 - x.ClearDraft = false - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - - p.pool.Put(x) -} - -var PoolServiceSendMessage = poolServiceSendMessage{} - -func (x *ServiceSendMessage) DeepCopy(z *ServiceSendMessage) { - z.OnBehalf = x.OnBehalf - z.RandomID = x.RandomID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolInputPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolInputPeer.Put(z.Peer) - z.Peer = nil - } - z.Body = x.Body - z.ReplyTo = x.ReplyTo - z.ClearDraft = x.ClearDraft - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } -} - -func (x *ServiceSendMessage) Clone() *ServiceSendMessage { - z := &ServiceSendMessage{} - x.DeepCopy(z) - return z -} - -func (x *ServiceSendMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ServiceSendMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ServiceSendMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ServiceSendMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ServiceSendMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ServiceSendMessage, x) -} - -func init() { - registry.RegisterConstructor(824547051, "ServiceSendMessage") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/system.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/system.pb.go deleted file mode 100644 index fd91955d..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/system.pb.go +++ /dev/null @@ -1,1519 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: system.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// SystemGetServerKeys -// @Function -// @Return: SystemKeys -type SystemGetServerKeys struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SystemGetServerKeys) Reset() { - *x = SystemGetServerKeys{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemGetServerKeys) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemGetServerKeys) ProtoMessage() {} - -func (x *SystemGetServerKeys) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemGetServerKeys.ProtoReflect.Descriptor instead. -func (*SystemGetServerKeys) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{0} -} - -// SystemGetServerTime -// @Function -// @Returns: SystemServerTime -type SystemGetServerTime struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SystemGetServerTime) Reset() { - *x = SystemGetServerTime{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemGetServerTime) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemGetServerTime) ProtoMessage() {} - -func (x *SystemGetServerTime) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemGetServerTime.ProtoReflect.Descriptor instead. -func (*SystemGetServerTime) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{1} -} - -// SystemGetInfo -// @Function -// @Returns: SystemInfo -type SystemGetInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SystemGetInfo) Reset() { - *x = SystemGetInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemGetInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemGetInfo) ProtoMessage() {} - -func (x *SystemGetInfo) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemGetInfo.ProtoReflect.Descriptor instead. -func (*SystemGetInfo) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{2} -} - -// SystemGetSalts -// @Function -// @Returns: SystemSalts -type SystemGetSalts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SystemGetSalts) Reset() { - *x = SystemGetSalts{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemGetSalts) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemGetSalts) ProtoMessage() {} - -func (x *SystemGetSalts) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemGetSalts.ProtoReflect.Descriptor instead. -func (*SystemGetSalts) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{3} -} - -// SystemGetConfig -// @Function -// @Returns: SystemConfig -type SystemGetConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *SystemGetConfig) Reset() { - *x = SystemGetConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemGetConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemGetConfig) ProtoMessage() {} - -func (x *SystemGetConfig) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemGetConfig.ProtoReflect.Descriptor instead. -func (*SystemGetConfig) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{4} -} - -// SystemUploadUsage -// @Function -// @Returns: Bool -type SystemUploadUsage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Usage []*ClientUsage `protobuf:"bytes,1,rep,name=Usage,proto3" json:"Usage,omitempty"` -} - -func (x *SystemUploadUsage) Reset() { - *x = SystemUploadUsage{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemUploadUsage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemUploadUsage) ProtoMessage() {} - -func (x *SystemUploadUsage) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemUploadUsage.ProtoReflect.Descriptor instead. -func (*SystemUploadUsage) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{5} -} - -func (x *SystemUploadUsage) GetUsage() []*ClientUsage { - if x != nil { - return x.Usage - } - return nil -} - -// SystemGetResponse -// @Function -// @Return: MessageEnvelope / MessageContainer -type SystemGetResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RequestIDs []uint64 `protobuf:"fixed64,1,rep,packed,name=RequestIDs,proto3" json:"RequestIDs,omitempty"` -} - -func (x *SystemGetResponse) Reset() { - *x = SystemGetResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemGetResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemGetResponse) ProtoMessage() {} - -func (x *SystemGetResponse) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemGetResponse.ProtoReflect.Descriptor instead. -func (*SystemGetResponse) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{6} -} - -func (x *SystemGetResponse) GetRequestIDs() []uint64 { - if x != nil { - return x.RequestIDs - } - return nil -} - -// ClientUsage -type ClientUsage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Year int32 `protobuf:"varint,1,opt,name=Year,proto3" json:"Year,omitempty"` - Month int32 `protobuf:"varint,2,opt,name=Month,proto3" json:"Month,omitempty"` - Day int32 `protobuf:"varint,3,opt,name=Day,proto3" json:"Day,omitempty"` - UserID int64 `protobuf:"varint,4,opt,name=UserID,proto3" json:"UserID,omitempty"` - ForegroundTime int64 `protobuf:"varint,5,opt,name=ForegroundTime,proto3" json:"ForegroundTime,omitempty"` // The time client is on foreground in seconds - AvgResponseTime int64 `protobuf:"varint,6,opt,name=AvgResponseTime,proto3" json:"AvgResponseTime,omitempty"` // The average response time for each api - TotalRequests int64 `protobuf:"varint,7,opt,name=TotalRequests,proto3" json:"TotalRequests,omitempty"` // Total requests sent to server - ReceivedMessages int64 `protobuf:"varint,8,opt,name=ReceivedMessages,proto3" json:"ReceivedMessages,omitempty"` - SentMessages int64 `protobuf:"varint,9,opt,name=SentMessages,proto3" json:"SentMessages,omitempty"` - ReceivedMedia int64 `protobuf:"varint,10,opt,name=ReceivedMedia,proto3" json:"ReceivedMedia,omitempty"` - SentMedia int64 `protobuf:"varint,11,opt,name=SentMedia,proto3" json:"SentMedia,omitempty"` - UploadBytes int64 `protobuf:"varint,12,opt,name=UploadBytes,proto3" json:"UploadBytes,omitempty"` - DownloadBytes int64 `protobuf:"varint,13,opt,name=DownloadBytes,proto3" json:"DownloadBytes,omitempty"` -} - -func (x *ClientUsage) Reset() { - *x = ClientUsage{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientUsage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientUsage) ProtoMessage() {} - -func (x *ClientUsage) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientUsage.ProtoReflect.Descriptor instead. -func (*ClientUsage) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{7} -} - -func (x *ClientUsage) GetYear() int32 { - if x != nil { - return x.Year - } - return 0 -} - -func (x *ClientUsage) GetMonth() int32 { - if x != nil { - return x.Month - } - return 0 -} - -func (x *ClientUsage) GetDay() int32 { - if x != nil { - return x.Day - } - return 0 -} - -func (x *ClientUsage) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *ClientUsage) GetForegroundTime() int64 { - if x != nil { - return x.ForegroundTime - } - return 0 -} - -func (x *ClientUsage) GetAvgResponseTime() int64 { - if x != nil { - return x.AvgResponseTime - } - return 0 -} - -func (x *ClientUsage) GetTotalRequests() int64 { - if x != nil { - return x.TotalRequests - } - return 0 -} - -func (x *ClientUsage) GetReceivedMessages() int64 { - if x != nil { - return x.ReceivedMessages - } - return 0 -} - -func (x *ClientUsage) GetSentMessages() int64 { - if x != nil { - return x.SentMessages - } - return 0 -} - -func (x *ClientUsage) GetReceivedMedia() int64 { - if x != nil { - return x.ReceivedMedia - } - return 0 -} - -func (x *ClientUsage) GetSentMedia() int64 { - if x != nil { - return x.SentMedia - } - return 0 -} - -func (x *ClientUsage) GetUploadBytes() int64 { - if x != nil { - return x.UploadBytes - } - return 0 -} - -func (x *ClientUsage) GetDownloadBytes() int64 { - if x != nil { - return x.DownloadBytes - } - return 0 -} - -// SystemConfig -type SystemConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - GifBot string `protobuf:"bytes,110,opt,name=GifBot,proto3" json:"GifBot,omitempty"` - WikiBot string `protobuf:"bytes,111,opt,name=WikiBot,proto3" json:"WikiBot,omitempty"` - TestMode bool `protobuf:"varint,1,opt,name=TestMode,proto3" json:"TestMode,omitempty"` - PhoneCallEnabled bool `protobuf:"varint,2,opt,name=PhoneCallEnabled,proto3" json:"PhoneCallEnabled,omitempty"` - ExpireOn int64 `protobuf:"varint,3,opt,name=ExpireOn,proto3" json:"ExpireOn,omitempty"` - GroupMaxSize int32 `protobuf:"varint,4,opt,name=GroupMaxSize,proto3" json:"GroupMaxSize,omitempty"` - ForwardedMaxCount int32 `protobuf:"varint,5,opt,name=ForwardedMaxCount,proto3" json:"ForwardedMaxCount,omitempty"` - OnlineUpdatePeriodInSec int32 `protobuf:"varint,6,opt,name=OnlineUpdatePeriodInSec,proto3" json:"OnlineUpdatePeriodInSec,omitempty"` // The client should update its online status every N milliseconds - EditTimeLimitInSec int32 `protobuf:"varint,7,opt,name=EditTimeLimitInSec,proto3" json:"EditTimeLimitInSec,omitempty"` - RevokeTimeLimitInSec int32 `protobuf:"varint,8,opt,name=RevokeTimeLimitInSec,proto3" json:"RevokeTimeLimitInSec,omitempty"` - PinnedDialogsMaxCount int32 `protobuf:"varint,9,opt,name=PinnedDialogsMaxCount,proto3" json:"PinnedDialogsMaxCount,omitempty"` - UrlPrefix int32 `protobuf:"varint,10,opt,name=UrlPrefix,proto3" json:"UrlPrefix,omitempty"` - MessageMaxLength int32 `protobuf:"varint,11,opt,name=MessageMaxLength,proto3" json:"MessageMaxLength,omitempty"` - CaptionMaxLength int32 `protobuf:"varint,12,opt,name=CaptionMaxLength,proto3" json:"CaptionMaxLength,omitempty"` - DCs []*DataCenter `protobuf:"bytes,13,rep,name=DCs,proto3" json:"DCs,omitempty"` - MaxLabels int32 `protobuf:"varint,14,opt,name=MaxLabels,proto3" json:"MaxLabels,omitempty"` - TopPeerDecayRate float32 `protobuf:"fixed32,15,opt,name=TopPeerDecayRate,proto3" json:"TopPeerDecayRate,omitempty"` - TopPeerMaxStep float32 `protobuf:"fixed32,16,opt,name=TopPeerMaxStep,proto3" json:"TopPeerMaxStep,omitempty"` - MaxActiveSessions uint32 `protobuf:"varint,17,opt,name=MaxActiveSessions,proto3" json:"MaxActiveSessions,omitempty"` - Reactions []string `protobuf:"bytes,18,rep,name=Reactions,proto3" json:"Reactions,omitempty"` - MaxUploadSize int64 `protobuf:"varint,19,opt,name=MaxUploadSize,proto3" json:"MaxUploadSize,omitempty"` - MaxUploadPartSize int64 `protobuf:"varint,20,opt,name=MaxUploadPartSize,proto3" json:"MaxUploadPartSize,omitempty"` - MaxUploadParts int64 `protobuf:"varint,21,opt,name=MaxUploadParts,proto3" json:"MaxUploadParts,omitempty"` -} - -func (x *SystemConfig) Reset() { - *x = SystemConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemConfig) ProtoMessage() {} - -func (x *SystemConfig) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemConfig.ProtoReflect.Descriptor instead. -func (*SystemConfig) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{8} -} - -func (x *SystemConfig) GetGifBot() string { - if x != nil { - return x.GifBot - } - return "" -} - -func (x *SystemConfig) GetWikiBot() string { - if x != nil { - return x.WikiBot - } - return "" -} - -func (x *SystemConfig) GetTestMode() bool { - if x != nil { - return x.TestMode - } - return false -} - -func (x *SystemConfig) GetPhoneCallEnabled() bool { - if x != nil { - return x.PhoneCallEnabled - } - return false -} - -func (x *SystemConfig) GetExpireOn() int64 { - if x != nil { - return x.ExpireOn - } - return 0 -} - -func (x *SystemConfig) GetGroupMaxSize() int32 { - if x != nil { - return x.GroupMaxSize - } - return 0 -} - -func (x *SystemConfig) GetForwardedMaxCount() int32 { - if x != nil { - return x.ForwardedMaxCount - } - return 0 -} - -func (x *SystemConfig) GetOnlineUpdatePeriodInSec() int32 { - if x != nil { - return x.OnlineUpdatePeriodInSec - } - return 0 -} - -func (x *SystemConfig) GetEditTimeLimitInSec() int32 { - if x != nil { - return x.EditTimeLimitInSec - } - return 0 -} - -func (x *SystemConfig) GetRevokeTimeLimitInSec() int32 { - if x != nil { - return x.RevokeTimeLimitInSec - } - return 0 -} - -func (x *SystemConfig) GetPinnedDialogsMaxCount() int32 { - if x != nil { - return x.PinnedDialogsMaxCount - } - return 0 -} - -func (x *SystemConfig) GetUrlPrefix() int32 { - if x != nil { - return x.UrlPrefix - } - return 0 -} - -func (x *SystemConfig) GetMessageMaxLength() int32 { - if x != nil { - return x.MessageMaxLength - } - return 0 -} - -func (x *SystemConfig) GetCaptionMaxLength() int32 { - if x != nil { - return x.CaptionMaxLength - } - return 0 -} - -func (x *SystemConfig) GetDCs() []*DataCenter { - if x != nil { - return x.DCs - } - return nil -} - -func (x *SystemConfig) GetMaxLabels() int32 { - if x != nil { - return x.MaxLabels - } - return 0 -} - -func (x *SystemConfig) GetTopPeerDecayRate() float32 { - if x != nil { - return x.TopPeerDecayRate - } - return 0 -} - -func (x *SystemConfig) GetTopPeerMaxStep() float32 { - if x != nil { - return x.TopPeerMaxStep - } - return 0 -} - -func (x *SystemConfig) GetMaxActiveSessions() uint32 { - if x != nil { - return x.MaxActiveSessions - } - return 0 -} - -func (x *SystemConfig) GetReactions() []string { - if x != nil { - return x.Reactions - } - return nil -} - -func (x *SystemConfig) GetMaxUploadSize() int64 { - if x != nil { - return x.MaxUploadSize - } - return 0 -} - -func (x *SystemConfig) GetMaxUploadPartSize() int64 { - if x != nil { - return x.MaxUploadPartSize - } - return 0 -} - -func (x *SystemConfig) GetMaxUploadParts() int64 { - if x != nil { - return x.MaxUploadParts - } - return 0 -} - -// DataCenter -type DataCenter struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - IP string `protobuf:"bytes,1,opt,name=IP,proto3" json:"IP,omitempty"` - Port int32 `protobuf:"varint,2,opt,name=Port,proto3" json:"Port,omitempty"` - Http bool `protobuf:"varint,3,opt,name=Http,proto3" json:"Http,omitempty"` - Websocket bool `protobuf:"varint,4,opt,name=Websocket,proto3" json:"Websocket,omitempty"` - Quic bool `protobuf:"varint,5,opt,name=Quic,proto3" json:"Quic,omitempty"` -} - -func (x *DataCenter) Reset() { - *x = DataCenter{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DataCenter) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DataCenter) ProtoMessage() {} - -func (x *DataCenter) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DataCenter.ProtoReflect.Descriptor instead. -func (*DataCenter) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{9} -} - -func (x *DataCenter) GetIP() string { - if x != nil { - return x.IP - } - return "" -} - -func (x *DataCenter) GetPort() int32 { - if x != nil { - return x.Port - } - return 0 -} - -func (x *DataCenter) GetHttp() bool { - if x != nil { - return x.Http - } - return false -} - -func (x *DataCenter) GetWebsocket() bool { - if x != nil { - return x.Websocket - } - return false -} - -func (x *DataCenter) GetQuic() bool { - if x != nil { - return x.Quic - } - return false -} - -// SystemSalts -type SystemSalts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Salts []int64 `protobuf:"varint,1,rep,packed,name=Salts,proto3" json:"Salts,omitempty"` - StartsFrom int64 `protobuf:"varint,2,opt,name=StartsFrom,proto3" json:"StartsFrom,omitempty"` - Duration int64 `protobuf:"varint,3,opt,name=Duration,proto3" json:"Duration,omitempty"` -} - -func (x *SystemSalts) Reset() { - *x = SystemSalts{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemSalts) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemSalts) ProtoMessage() {} - -func (x *SystemSalts) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemSalts.ProtoReflect.Descriptor instead. -func (*SystemSalts) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{10} -} - -func (x *SystemSalts) GetSalts() []int64 { - if x != nil { - return x.Salts - } - return nil -} - -func (x *SystemSalts) GetStartsFrom() int64 { - if x != nil { - return x.StartsFrom - } - return 0 -} - -func (x *SystemSalts) GetDuration() int64 { - if x != nil { - return x.Duration - } - return 0 -} - -// AppUpdate -type AppUpdate struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Available bool `protobuf:"varint,1,opt,name=Available,proto3" json:"Available,omitempty"` - Mandatory bool `protobuf:"varint,2,opt,name=Mandatory,proto3" json:"Mandatory,omitempty"` - Identifier string `protobuf:"bytes,3,opt,name=Identifier,proto3" json:"Identifier,omitempty"` - VersionName string `protobuf:"bytes,4,opt,name=VersionName,proto3" json:"VersionName,omitempty"` - DownloadUrl string `protobuf:"bytes,5,opt,name=DownloadUrl,proto3" json:"DownloadUrl,omitempty"` - Description string `protobuf:"bytes,6,opt,name=Description,proto3" json:"Description,omitempty"` - DisplayInterval int32 `protobuf:"varint,7,opt,name=DisplayInterval,proto3" json:"DisplayInterval,omitempty"` -} - -func (x *AppUpdate) Reset() { - *x = AppUpdate{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AppUpdate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AppUpdate) ProtoMessage() {} - -func (x *AppUpdate) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AppUpdate.ProtoReflect.Descriptor instead. -func (*AppUpdate) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{11} -} - -func (x *AppUpdate) GetAvailable() bool { - if x != nil { - return x.Available - } - return false -} - -func (x *AppUpdate) GetMandatory() bool { - if x != nil { - return x.Mandatory - } - return false -} - -func (x *AppUpdate) GetIdentifier() string { - if x != nil { - return x.Identifier - } - return "" -} - -func (x *AppUpdate) GetVersionName() string { - if x != nil { - return x.VersionName - } - return "" -} - -func (x *AppUpdate) GetDownloadUrl() string { - if x != nil { - return x.DownloadUrl - } - return "" -} - -func (x *AppUpdate) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *AppUpdate) GetDisplayInterval() int32 { - if x != nil { - return x.DisplayInterval - } - return 0 -} - -// SystemInfo -type SystemInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - WorkGroupName string `protobuf:"bytes,1,opt,name=WorkGroupName,proto3" json:"WorkGroupName,omitempty"` - BigPhotoUrl string `protobuf:"bytes,2,opt,name=BigPhotoUrl,proto3" json:"BigPhotoUrl,omitempty"` - SmallPhotoUrl string `protobuf:"bytes,3,opt,name=SmallPhotoUrl,proto3" json:"SmallPhotoUrl,omitempty"` - StorageUrl string `protobuf:"bytes,4,opt,name=StorageUrl,proto3" json:"StorageUrl,omitempty"` -} - -func (x *SystemInfo) Reset() { - *x = SystemInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemInfo) ProtoMessage() {} - -func (x *SystemInfo) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemInfo.ProtoReflect.Descriptor instead. -func (*SystemInfo) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{12} -} - -func (x *SystemInfo) GetWorkGroupName() string { - if x != nil { - return x.WorkGroupName - } - return "" -} - -func (x *SystemInfo) GetBigPhotoUrl() string { - if x != nil { - return x.BigPhotoUrl - } - return "" -} - -func (x *SystemInfo) GetSmallPhotoUrl() string { - if x != nil { - return x.SmallPhotoUrl - } - return "" -} - -func (x *SystemInfo) GetStorageUrl() string { - if x != nil { - return x.StorageUrl - } - return "" -} - -// SystemServerTime -type SystemServerTime struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Timestamp int64 `protobuf:"varint,1,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` // In Seconds -} - -func (x *SystemServerTime) Reset() { - *x = SystemServerTime{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemServerTime) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemServerTime) ProtoMessage() {} - -func (x *SystemServerTime) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemServerTime.ProtoReflect.Descriptor instead. -func (*SystemServerTime) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{13} -} - -func (x *SystemServerTime) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -// SystemKeys -type SystemKeys struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RSAPublicKeys []*RSAPublicKey `protobuf:"bytes,1,rep,name=RSAPublicKeys,proto3" json:"RSAPublicKeys,omitempty"` - DHGroups []*DHGroup `protobuf:"bytes,2,rep,name=DHGroups,proto3" json:"DHGroups,omitempty"` -} - -func (x *SystemKeys) Reset() { - *x = SystemKeys{} - if protoimpl.UnsafeEnabled { - mi := &file_system_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SystemKeys) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SystemKeys) ProtoMessage() {} - -func (x *SystemKeys) ProtoReflect() protoreflect.Message { - mi := &file_system_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SystemKeys.ProtoReflect.Descriptor instead. -func (*SystemKeys) Descriptor() ([]byte, []int) { - return file_system_proto_rawDescGZIP(), []int{14} -} - -func (x *SystemKeys) GetRSAPublicKeys() []*RSAPublicKey { - if x != nil { - return x.RSAPublicKeys - } - return nil -} - -func (x *SystemKeys) GetDHGroups() []*DHGroup { - if x != nil { - return x.DHGroups - } - return nil -} - -var File_system_proto protoreflect.FileDescriptor - -var file_system_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, - 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x47, - 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x15, 0x0a, 0x13, - 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, - 0x69, 0x6d, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x47, 0x65, 0x74, - 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x47, 0x65, - 0x74, 0x53, 0x61, 0x6c, 0x74, 0x73, 0x22, 0x11, 0x0a, 0x0f, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x3b, 0x0a, 0x11, 0x53, 0x79, 0x73, - 0x74, 0x65, 0x6d, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x26, - 0x0a, 0x05, 0x55, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x52, - 0x05, 0x55, 0x73, 0x61, 0x67, 0x65, 0x22, 0x33, 0x0a, 0x11, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x06, 0x52, - 0x0a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x44, 0x73, 0x22, 0xb5, 0x03, 0x0a, 0x0b, - 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x59, - 0x65, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x59, 0x65, 0x61, 0x72, 0x12, - 0x14, 0x0a, 0x05, 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x4d, 0x6f, 0x6e, 0x74, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x44, 0x61, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x44, 0x61, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, - 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, - 0x26, 0x0a, 0x0e, 0x46, 0x6f, 0x72, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x69, 0x6d, - 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x46, 0x6f, 0x72, 0x65, 0x67, 0x72, 0x6f, - 0x75, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x41, 0x76, 0x67, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0f, 0x41, 0x76, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x69, 0x6d, - 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x10, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x53, 0x65, 0x6e, 0x74, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, - 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x1c, 0x0a, - 0x09, 0x53, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x53, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x12, 0x20, 0x0a, 0x0b, 0x55, - 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0b, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x24, 0x0a, - 0x0d, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x0d, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x79, - 0x74, 0x65, 0x73, 0x22, 0x9d, 0x07, 0x0a, 0x0c, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x69, 0x66, 0x42, 0x6f, 0x74, 0x18, 0x6e, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x47, 0x69, 0x66, 0x42, 0x6f, 0x74, 0x12, 0x18, 0x0a, 0x07, - 0x57, 0x69, 0x6b, 0x69, 0x42, 0x6f, 0x74, 0x18, 0x6f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x57, - 0x69, 0x6b, 0x69, 0x42, 0x6f, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x6f, - 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x54, 0x65, 0x73, 0x74, 0x4d, 0x6f, - 0x64, 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x45, - 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x50, 0x68, - 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x1a, - 0x0a, 0x08, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x4f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x0c, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x2c, - 0x0a, 0x11, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x64, 0x4d, 0x61, 0x78, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x46, 0x6f, 0x72, 0x77, 0x61, - 0x72, 0x64, 0x65, 0x64, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x38, 0x0a, 0x17, - 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, - 0x6f, 0x64, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x17, 0x4f, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, - 0x64, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x12, 0x2e, 0x0a, 0x12, 0x45, 0x64, 0x69, 0x74, 0x54, 0x69, - 0x6d, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x12, 0x45, 0x64, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x6d, 0x69, - 0x74, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x12, 0x32, 0x0a, 0x14, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, - 0x54, 0x69, 0x6d, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x14, 0x52, 0x65, 0x76, 0x6f, 0x6b, 0x65, 0x54, 0x69, 0x6d, 0x65, - 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x49, 0x6e, 0x53, 0x65, 0x63, 0x12, 0x34, 0x0a, 0x15, 0x50, 0x69, - 0x6e, 0x6e, 0x65, 0x64, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x4d, 0x61, 0x78, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x15, 0x50, 0x69, 0x6e, 0x6e, 0x65, - 0x64, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x73, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x1c, 0x0a, 0x09, 0x55, 0x72, 0x6c, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x09, 0x55, 0x72, 0x6c, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x2a, - 0x0a, 0x10, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x4d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x2a, 0x0a, 0x10, 0x43, 0x61, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x43, 0x61, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x78, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x21, 0x0a, 0x03, 0x44, 0x43, 0x73, 0x18, 0x0d, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x43, 0x65, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x03, 0x44, 0x43, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x61, 0x78, - 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x4d, 0x61, - 0x78, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x2a, 0x0a, 0x10, 0x54, 0x6f, 0x70, 0x50, 0x65, - 0x65, 0x72, 0x44, 0x65, 0x63, 0x61, 0x79, 0x52, 0x61, 0x74, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, - 0x02, 0x52, 0x10, 0x54, 0x6f, 0x70, 0x50, 0x65, 0x65, 0x72, 0x44, 0x65, 0x63, 0x61, 0x79, 0x52, - 0x61, 0x74, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x54, 0x6f, 0x70, 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, - 0x78, 0x53, 0x74, 0x65, 0x70, 0x18, 0x10, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0e, 0x54, 0x6f, 0x70, - 0x50, 0x65, 0x65, 0x72, 0x4d, 0x61, 0x78, 0x53, 0x74, 0x65, 0x70, 0x12, 0x2c, 0x0a, 0x11, 0x4d, - 0x61, 0x78, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x11, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x11, 0x4d, 0x61, 0x78, 0x41, 0x63, 0x74, 0x69, 0x76, - 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x52, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x12, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x52, 0x65, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x4d, 0x61, 0x78, 0x55, 0x70, - 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, - 0x4d, 0x61, 0x78, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x2c, 0x0a, - 0x11, 0x4d, 0x61, 0x78, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x72, 0x74, 0x53, 0x69, - 0x7a, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x03, 0x52, 0x11, 0x4d, 0x61, 0x78, 0x55, 0x70, 0x6c, - 0x6f, 0x61, 0x64, 0x50, 0x61, 0x72, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x4d, - 0x61, 0x78, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x72, 0x74, 0x73, 0x18, 0x15, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0e, 0x4d, 0x61, 0x78, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x61, - 0x72, 0x74, 0x73, 0x22, 0x76, 0x0a, 0x0a, 0x44, 0x61, 0x74, 0x61, 0x43, 0x65, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x50, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, - 0x50, 0x12, 0x12, 0x0a, 0x04, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x04, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x74, 0x74, 0x70, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x04, 0x48, 0x74, 0x74, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x57, 0x65, 0x62, - 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x57, 0x65, - 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x51, 0x75, 0x69, 0x63, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x51, 0x75, 0x69, 0x63, 0x22, 0x5f, 0x0a, 0x0b, 0x53, - 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x61, 0x6c, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x53, 0x61, - 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x05, 0x53, 0x61, 0x6c, 0x74, 0x73, - 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x73, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x53, 0x74, 0x61, 0x72, 0x74, 0x73, 0x46, 0x72, 0x6f, 0x6d, - 0x12, 0x1a, 0x0a, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xf7, 0x01, 0x0a, - 0x09, 0x41, 0x70, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x76, - 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x41, - 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x61, 0x6e, 0x64, - 0x61, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x4d, 0x61, 0x6e, - 0x64, 0x61, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x6f, 0x77, 0x6e, - 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x44, - 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, - 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x22, 0x9a, 0x01, 0x0a, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65, - 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x24, 0x0a, 0x0d, 0x57, 0x6f, 0x72, 0x6b, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x57, 0x6f, - 0x72, 0x6b, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x42, - 0x69, 0x67, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x55, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x42, 0x69, 0x67, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x55, 0x72, 0x6c, 0x12, 0x24, 0x0a, - 0x0d, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x55, 0x72, 0x6c, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x50, 0x68, 0x6f, 0x74, 0x6f, - 0x55, 0x72, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x55, 0x72, - 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, - 0x55, 0x72, 0x6c, 0x22, 0x30, 0x0a, 0x10, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x6f, 0x0a, 0x0a, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x4b, - 0x65, 0x79, 0x73, 0x12, 0x37, 0x0a, 0x0d, 0x52, 0x53, 0x41, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x4b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x52, 0x53, 0x41, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x52, 0x0d, 0x52, - 0x53, 0x41, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x28, 0x0a, 0x08, - 0x44, 0x48, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x48, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x08, 0x44, 0x48, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_system_proto_rawDescOnce sync.Once - file_system_proto_rawDescData = file_system_proto_rawDesc -) - -func file_system_proto_rawDescGZIP() []byte { - file_system_proto_rawDescOnce.Do(func() { - file_system_proto_rawDescData = protoimpl.X.CompressGZIP(file_system_proto_rawDescData) - }) - return file_system_proto_rawDescData -} - -var file_system_proto_msgTypes = make([]protoimpl.MessageInfo, 15) -var file_system_proto_goTypes = []interface{}{ - (*SystemGetServerKeys)(nil), // 0: msg.SystemGetServerKeys - (*SystemGetServerTime)(nil), // 1: msg.SystemGetServerTime - (*SystemGetInfo)(nil), // 2: msg.SystemGetInfo - (*SystemGetSalts)(nil), // 3: msg.SystemGetSalts - (*SystemGetConfig)(nil), // 4: msg.SystemGetConfig - (*SystemUploadUsage)(nil), // 5: msg.SystemUploadUsage - (*SystemGetResponse)(nil), // 6: msg.SystemGetResponse - (*ClientUsage)(nil), // 7: msg.ClientUsage - (*SystemConfig)(nil), // 8: msg.SystemConfig - (*DataCenter)(nil), // 9: msg.DataCenter - (*SystemSalts)(nil), // 10: msg.SystemSalts - (*AppUpdate)(nil), // 11: msg.AppUpdate - (*SystemInfo)(nil), // 12: msg.SystemInfo - (*SystemServerTime)(nil), // 13: msg.SystemServerTime - (*SystemKeys)(nil), // 14: msg.SystemKeys - (*RSAPublicKey)(nil), // 15: msg.RSAPublicKey - (*DHGroup)(nil), // 16: msg.DHGroup -} -var file_system_proto_depIdxs = []int32{ - 7, // 0: msg.SystemUploadUsage.Usage:type_name -> msg.ClientUsage - 9, // 1: msg.SystemConfig.DCs:type_name -> msg.DataCenter - 15, // 2: msg.SystemKeys.RSAPublicKeys:type_name -> msg.RSAPublicKey - 16, // 3: msg.SystemKeys.DHGroups:type_name -> msg.DHGroup - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_system_proto_init() } -func file_system_proto_init() { - if File_system_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_system_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemGetServerKeys); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemGetServerTime); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemGetInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemGetSalts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemGetConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemUploadUsage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemGetResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientUsage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DataCenter); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemSalts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AppUpdate); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemServerTime); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_system_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SystemKeys); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_system_proto_rawDesc, - NumEnums: 0, - NumMessages: 15, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_system_proto_goTypes, - DependencyIndexes: file_system_proto_depIdxs, - MessageInfos: file_system_proto_msgTypes, - }.Build() - File_system_proto = out.File - file_system_proto_rawDesc = nil - file_system_proto_goTypes = nil - file_system_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/system.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/system.rony.go deleted file mode 100644 index 2268c3d6..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/system.rony.go +++ /dev/null @@ -1,1018 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: system.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_SystemGetServerKeys int64 = 2510636156 - -type poolSystemGetServerKeys struct { - pool sync.Pool -} - -func (p *poolSystemGetServerKeys) Get() *SystemGetServerKeys { - x, ok := p.pool.Get().(*SystemGetServerKeys) - if !ok { - x = &SystemGetServerKeys{} - } - - return x -} - -func (p *poolSystemGetServerKeys) Put(x *SystemGetServerKeys) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolSystemGetServerKeys = poolSystemGetServerKeys{} - -func (x *SystemGetServerKeys) DeepCopy(z *SystemGetServerKeys) { -} - -func (x *SystemGetServerKeys) Clone() *SystemGetServerKeys { - z := &SystemGetServerKeys{} - x.DeepCopy(z) - return z -} - -func (x *SystemGetServerKeys) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemGetServerKeys) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemGetServerKeys) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemGetServerKeys) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemGetServerKeys) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemGetServerKeys, x) -} - -const C_SystemGetServerTime int64 = 1321179349 - -type poolSystemGetServerTime struct { - pool sync.Pool -} - -func (p *poolSystemGetServerTime) Get() *SystemGetServerTime { - x, ok := p.pool.Get().(*SystemGetServerTime) - if !ok { - x = &SystemGetServerTime{} - } - - return x -} - -func (p *poolSystemGetServerTime) Put(x *SystemGetServerTime) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolSystemGetServerTime = poolSystemGetServerTime{} - -func (x *SystemGetServerTime) DeepCopy(z *SystemGetServerTime) { -} - -func (x *SystemGetServerTime) Clone() *SystemGetServerTime { - z := &SystemGetServerTime{} - x.DeepCopy(z) - return z -} - -func (x *SystemGetServerTime) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemGetServerTime) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemGetServerTime) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemGetServerTime) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemGetServerTime) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemGetServerTime, x) -} - -const C_SystemGetInfo int64 = 1486296237 - -type poolSystemGetInfo struct { - pool sync.Pool -} - -func (p *poolSystemGetInfo) Get() *SystemGetInfo { - x, ok := p.pool.Get().(*SystemGetInfo) - if !ok { - x = &SystemGetInfo{} - } - - return x -} - -func (p *poolSystemGetInfo) Put(x *SystemGetInfo) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolSystemGetInfo = poolSystemGetInfo{} - -func (x *SystemGetInfo) DeepCopy(z *SystemGetInfo) { -} - -func (x *SystemGetInfo) Clone() *SystemGetInfo { - z := &SystemGetInfo{} - x.DeepCopy(z) - return z -} - -func (x *SystemGetInfo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemGetInfo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemGetInfo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemGetInfo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemGetInfo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemGetInfo, x) -} - -const C_SystemGetSalts int64 = 1705203315 - -type poolSystemGetSalts struct { - pool sync.Pool -} - -func (p *poolSystemGetSalts) Get() *SystemGetSalts { - x, ok := p.pool.Get().(*SystemGetSalts) - if !ok { - x = &SystemGetSalts{} - } - - return x -} - -func (p *poolSystemGetSalts) Put(x *SystemGetSalts) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolSystemGetSalts = poolSystemGetSalts{} - -func (x *SystemGetSalts) DeepCopy(z *SystemGetSalts) { -} - -func (x *SystemGetSalts) Clone() *SystemGetSalts { - z := &SystemGetSalts{} - x.DeepCopy(z) - return z -} - -func (x *SystemGetSalts) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemGetSalts) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemGetSalts) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemGetSalts) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemGetSalts) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemGetSalts, x) -} - -const C_SystemGetConfig int64 = 1910333714 - -type poolSystemGetConfig struct { - pool sync.Pool -} - -func (p *poolSystemGetConfig) Get() *SystemGetConfig { - x, ok := p.pool.Get().(*SystemGetConfig) - if !ok { - x = &SystemGetConfig{} - } - - return x -} - -func (p *poolSystemGetConfig) Put(x *SystemGetConfig) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolSystemGetConfig = poolSystemGetConfig{} - -func (x *SystemGetConfig) DeepCopy(z *SystemGetConfig) { -} - -func (x *SystemGetConfig) Clone() *SystemGetConfig { - z := &SystemGetConfig{} - x.DeepCopy(z) - return z -} - -func (x *SystemGetConfig) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemGetConfig) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemGetConfig) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemGetConfig) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemGetConfig) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemGetConfig, x) -} - -const C_SystemUploadUsage int64 = 3056393082 - -type poolSystemUploadUsage struct { - pool sync.Pool -} - -func (p *poolSystemUploadUsage) Get() *SystemUploadUsage { - x, ok := p.pool.Get().(*SystemUploadUsage) - if !ok { - x = &SystemUploadUsage{} - } - - return x -} - -func (p *poolSystemUploadUsage) Put(x *SystemUploadUsage) { - if x == nil { - return - } - - for _, z := range x.Usage { - PoolClientUsage.Put(z) - } - x.Usage = x.Usage[:0] - - p.pool.Put(x) -} - -var PoolSystemUploadUsage = poolSystemUploadUsage{} - -func (x *SystemUploadUsage) DeepCopy(z *SystemUploadUsage) { - for idx := range x.Usage { - if x.Usage[idx] == nil { - continue - } - xx := PoolClientUsage.Get() - x.Usage[idx].DeepCopy(xx) - z.Usage = append(z.Usage, xx) - } -} - -func (x *SystemUploadUsage) Clone() *SystemUploadUsage { - z := &SystemUploadUsage{} - x.DeepCopy(z) - return z -} - -func (x *SystemUploadUsage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemUploadUsage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemUploadUsage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemUploadUsage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemUploadUsage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemUploadUsage, x) -} - -const C_SystemGetResponse int64 = 1415676946 - -type poolSystemGetResponse struct { - pool sync.Pool -} - -func (p *poolSystemGetResponse) Get() *SystemGetResponse { - x, ok := p.pool.Get().(*SystemGetResponse) - if !ok { - x = &SystemGetResponse{} - } - - return x -} - -func (p *poolSystemGetResponse) Put(x *SystemGetResponse) { - if x == nil { - return - } - - x.RequestIDs = x.RequestIDs[:0] - - p.pool.Put(x) -} - -var PoolSystemGetResponse = poolSystemGetResponse{} - -func (x *SystemGetResponse) DeepCopy(z *SystemGetResponse) { - z.RequestIDs = append(z.RequestIDs[:0], x.RequestIDs...) -} - -func (x *SystemGetResponse) Clone() *SystemGetResponse { - z := &SystemGetResponse{} - x.DeepCopy(z) - return z -} - -func (x *SystemGetResponse) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemGetResponse) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemGetResponse) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemGetResponse) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemGetResponse) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemGetResponse, x) -} - -const C_ClientUsage int64 = 453987802 - -type poolClientUsage struct { - pool sync.Pool -} - -func (p *poolClientUsage) Get() *ClientUsage { - x, ok := p.pool.Get().(*ClientUsage) - if !ok { - x = &ClientUsage{} - } - - return x -} - -func (p *poolClientUsage) Put(x *ClientUsage) { - if x == nil { - return - } - - x.Year = 0 - x.Month = 0 - x.Day = 0 - x.UserID = 0 - x.ForegroundTime = 0 - x.AvgResponseTime = 0 - x.TotalRequests = 0 - x.ReceivedMessages = 0 - x.SentMessages = 0 - x.ReceivedMedia = 0 - x.SentMedia = 0 - x.UploadBytes = 0 - x.DownloadBytes = 0 - - p.pool.Put(x) -} - -var PoolClientUsage = poolClientUsage{} - -func (x *ClientUsage) DeepCopy(z *ClientUsage) { - z.Year = x.Year - z.Month = x.Month - z.Day = x.Day - z.UserID = x.UserID - z.ForegroundTime = x.ForegroundTime - z.AvgResponseTime = x.AvgResponseTime - z.TotalRequests = x.TotalRequests - z.ReceivedMessages = x.ReceivedMessages - z.SentMessages = x.SentMessages - z.ReceivedMedia = x.ReceivedMedia - z.SentMedia = x.SentMedia - z.UploadBytes = x.UploadBytes - z.DownloadBytes = x.DownloadBytes -} - -func (x *ClientUsage) Clone() *ClientUsage { - z := &ClientUsage{} - x.DeepCopy(z) - return z -} - -func (x *ClientUsage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientUsage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientUsage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientUsage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientUsage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientUsage, x) -} - -const C_SystemConfig int64 = 367036084 - -type poolSystemConfig struct { - pool sync.Pool -} - -func (p *poolSystemConfig) Get() *SystemConfig { - x, ok := p.pool.Get().(*SystemConfig) - if !ok { - x = &SystemConfig{} - } - - return x -} - -func (p *poolSystemConfig) Put(x *SystemConfig) { - if x == nil { - return - } - - x.GifBot = "" - x.WikiBot = "" - x.TestMode = false - x.PhoneCallEnabled = false - x.ExpireOn = 0 - x.GroupMaxSize = 0 - x.ForwardedMaxCount = 0 - x.OnlineUpdatePeriodInSec = 0 - x.EditTimeLimitInSec = 0 - x.RevokeTimeLimitInSec = 0 - x.PinnedDialogsMaxCount = 0 - x.UrlPrefix = 0 - x.MessageMaxLength = 0 - x.CaptionMaxLength = 0 - for _, z := range x.DCs { - PoolDataCenter.Put(z) - } - x.DCs = x.DCs[:0] - x.MaxLabels = 0 - x.TopPeerDecayRate = 0 - x.TopPeerMaxStep = 0 - x.MaxActiveSessions = 0 - x.Reactions = x.Reactions[:0] - x.MaxUploadSize = 0 - x.MaxUploadPartSize = 0 - x.MaxUploadParts = 0 - - p.pool.Put(x) -} - -var PoolSystemConfig = poolSystemConfig{} - -func (x *SystemConfig) DeepCopy(z *SystemConfig) { - z.GifBot = x.GifBot - z.WikiBot = x.WikiBot - z.TestMode = x.TestMode - z.PhoneCallEnabled = x.PhoneCallEnabled - z.ExpireOn = x.ExpireOn - z.GroupMaxSize = x.GroupMaxSize - z.ForwardedMaxCount = x.ForwardedMaxCount - z.OnlineUpdatePeriodInSec = x.OnlineUpdatePeriodInSec - z.EditTimeLimitInSec = x.EditTimeLimitInSec - z.RevokeTimeLimitInSec = x.RevokeTimeLimitInSec - z.PinnedDialogsMaxCount = x.PinnedDialogsMaxCount - z.UrlPrefix = x.UrlPrefix - z.MessageMaxLength = x.MessageMaxLength - z.CaptionMaxLength = x.CaptionMaxLength - for idx := range x.DCs { - if x.DCs[idx] == nil { - continue - } - xx := PoolDataCenter.Get() - x.DCs[idx].DeepCopy(xx) - z.DCs = append(z.DCs, xx) - } - z.MaxLabels = x.MaxLabels - z.TopPeerDecayRate = x.TopPeerDecayRate - z.TopPeerMaxStep = x.TopPeerMaxStep - z.MaxActiveSessions = x.MaxActiveSessions - z.Reactions = append(z.Reactions[:0], x.Reactions...) - z.MaxUploadSize = x.MaxUploadSize - z.MaxUploadPartSize = x.MaxUploadPartSize - z.MaxUploadParts = x.MaxUploadParts -} - -func (x *SystemConfig) Clone() *SystemConfig { - z := &SystemConfig{} - x.DeepCopy(z) - return z -} - -func (x *SystemConfig) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemConfig) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemConfig) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemConfig) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemConfig) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemConfig, x) -} - -const C_DataCenter int64 = 3431386561 - -type poolDataCenter struct { - pool sync.Pool -} - -func (p *poolDataCenter) Get() *DataCenter { - x, ok := p.pool.Get().(*DataCenter) - if !ok { - x = &DataCenter{} - } - - return x -} - -func (p *poolDataCenter) Put(x *DataCenter) { - if x == nil { - return - } - - x.IP = "" - x.Port = 0 - x.Http = false - x.Websocket = false - x.Quic = false - - p.pool.Put(x) -} - -var PoolDataCenter = poolDataCenter{} - -func (x *DataCenter) DeepCopy(z *DataCenter) { - z.IP = x.IP - z.Port = x.Port - z.Http = x.Http - z.Websocket = x.Websocket - z.Quic = x.Quic -} - -func (x *DataCenter) Clone() *DataCenter { - z := &DataCenter{} - x.DeepCopy(z) - return z -} - -func (x *DataCenter) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *DataCenter) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *DataCenter) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *DataCenter) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *DataCenter) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_DataCenter, x) -} - -const C_SystemSalts int64 = 871116906 - -type poolSystemSalts struct { - pool sync.Pool -} - -func (p *poolSystemSalts) Get() *SystemSalts { - x, ok := p.pool.Get().(*SystemSalts) - if !ok { - x = &SystemSalts{} - } - - return x -} - -func (p *poolSystemSalts) Put(x *SystemSalts) { - if x == nil { - return - } - - x.Salts = x.Salts[:0] - x.StartsFrom = 0 - x.Duration = 0 - - p.pool.Put(x) -} - -var PoolSystemSalts = poolSystemSalts{} - -func (x *SystemSalts) DeepCopy(z *SystemSalts) { - z.Salts = append(z.Salts[:0], x.Salts...) - z.StartsFrom = x.StartsFrom - z.Duration = x.Duration -} - -func (x *SystemSalts) Clone() *SystemSalts { - z := &SystemSalts{} - x.DeepCopy(z) - return z -} - -func (x *SystemSalts) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemSalts) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemSalts) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemSalts) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemSalts) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemSalts, x) -} - -const C_AppUpdate int64 = 1100207036 - -type poolAppUpdate struct { - pool sync.Pool -} - -func (p *poolAppUpdate) Get() *AppUpdate { - x, ok := p.pool.Get().(*AppUpdate) - if !ok { - x = &AppUpdate{} - } - - return x -} - -func (p *poolAppUpdate) Put(x *AppUpdate) { - if x == nil { - return - } - - x.Available = false - x.Mandatory = false - x.Identifier = "" - x.VersionName = "" - x.DownloadUrl = "" - x.Description = "" - x.DisplayInterval = 0 - - p.pool.Put(x) -} - -var PoolAppUpdate = poolAppUpdate{} - -func (x *AppUpdate) DeepCopy(z *AppUpdate) { - z.Available = x.Available - z.Mandatory = x.Mandatory - z.Identifier = x.Identifier - z.VersionName = x.VersionName - z.DownloadUrl = x.DownloadUrl - z.Description = x.Description - z.DisplayInterval = x.DisplayInterval -} - -func (x *AppUpdate) Clone() *AppUpdate { - z := &AppUpdate{} - x.DeepCopy(z) - return z -} - -func (x *AppUpdate) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *AppUpdate) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *AppUpdate) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *AppUpdate) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *AppUpdate) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_AppUpdate, x) -} - -const C_SystemInfo int64 = 2754948760 - -type poolSystemInfo struct { - pool sync.Pool -} - -func (p *poolSystemInfo) Get() *SystemInfo { - x, ok := p.pool.Get().(*SystemInfo) - if !ok { - x = &SystemInfo{} - } - - return x -} - -func (p *poolSystemInfo) Put(x *SystemInfo) { - if x == nil { - return - } - - x.WorkGroupName = "" - x.BigPhotoUrl = "" - x.SmallPhotoUrl = "" - x.StorageUrl = "" - - p.pool.Put(x) -} - -var PoolSystemInfo = poolSystemInfo{} - -func (x *SystemInfo) DeepCopy(z *SystemInfo) { - z.WorkGroupName = x.WorkGroupName - z.BigPhotoUrl = x.BigPhotoUrl - z.SmallPhotoUrl = x.SmallPhotoUrl - z.StorageUrl = x.StorageUrl -} - -func (x *SystemInfo) Clone() *SystemInfo { - z := &SystemInfo{} - x.DeepCopy(z) - return z -} - -func (x *SystemInfo) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemInfo) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemInfo) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemInfo) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemInfo) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemInfo, x) -} - -const C_SystemServerTime int64 = 2854614486 - -type poolSystemServerTime struct { - pool sync.Pool -} - -func (p *poolSystemServerTime) Get() *SystemServerTime { - x, ok := p.pool.Get().(*SystemServerTime) - if !ok { - x = &SystemServerTime{} - } - - return x -} - -func (p *poolSystemServerTime) Put(x *SystemServerTime) { - if x == nil { - return - } - - x.Timestamp = 0 - - p.pool.Put(x) -} - -var PoolSystemServerTime = poolSystemServerTime{} - -func (x *SystemServerTime) DeepCopy(z *SystemServerTime) { - z.Timestamp = x.Timestamp -} - -func (x *SystemServerTime) Clone() *SystemServerTime { - z := &SystemServerTime{} - x.DeepCopy(z) - return z -} - -func (x *SystemServerTime) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemServerTime) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemServerTime) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemServerTime) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemServerTime) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemServerTime, x) -} - -const C_SystemKeys int64 = 3677510435 - -type poolSystemKeys struct { - pool sync.Pool -} - -func (p *poolSystemKeys) Get() *SystemKeys { - x, ok := p.pool.Get().(*SystemKeys) - if !ok { - x = &SystemKeys{} - } - - return x -} - -func (p *poolSystemKeys) Put(x *SystemKeys) { - if x == nil { - return - } - - for _, z := range x.RSAPublicKeys { - PoolRSAPublicKey.Put(z) - } - x.RSAPublicKeys = x.RSAPublicKeys[:0] - for _, z := range x.DHGroups { - PoolDHGroup.Put(z) - } - x.DHGroups = x.DHGroups[:0] - - p.pool.Put(x) -} - -var PoolSystemKeys = poolSystemKeys{} - -func (x *SystemKeys) DeepCopy(z *SystemKeys) { - for idx := range x.RSAPublicKeys { - if x.RSAPublicKeys[idx] == nil { - continue - } - xx := PoolRSAPublicKey.Get() - x.RSAPublicKeys[idx].DeepCopy(xx) - z.RSAPublicKeys = append(z.RSAPublicKeys, xx) - } - for idx := range x.DHGroups { - if x.DHGroups[idx] == nil { - continue - } - xx := PoolDHGroup.Get() - x.DHGroups[idx].DeepCopy(xx) - z.DHGroups = append(z.DHGroups, xx) - } -} - -func (x *SystemKeys) Clone() *SystemKeys { - z := &SystemKeys{} - x.DeepCopy(z) - return z -} - -func (x *SystemKeys) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *SystemKeys) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *SystemKeys) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *SystemKeys) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *SystemKeys) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_SystemKeys, x) -} - -func init() { - registry.RegisterConstructor(2510636156, "SystemGetServerKeys") - registry.RegisterConstructor(1321179349, "SystemGetServerTime") - registry.RegisterConstructor(1486296237, "SystemGetInfo") - registry.RegisterConstructor(1705203315, "SystemGetSalts") - registry.RegisterConstructor(1910333714, "SystemGetConfig") - registry.RegisterConstructor(3056393082, "SystemUploadUsage") - registry.RegisterConstructor(1415676946, "SystemGetResponse") - registry.RegisterConstructor(453987802, "ClientUsage") - registry.RegisterConstructor(367036084, "SystemConfig") - registry.RegisterConstructor(3431386561, "DataCenter") - registry.RegisterConstructor(871116906, "SystemSalts") - registry.RegisterConstructor(1100207036, "AppUpdate") - registry.RegisterConstructor(2754948760, "SystemInfo") - registry.RegisterConstructor(2854614486, "SystemServerTime") - registry.RegisterConstructor(3677510435, "SystemKeys") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/team.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/team.pb.go deleted file mode 100644 index 2ed0a8dd..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/team.pb.go +++ /dev/null @@ -1,1141 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: team.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// TeamGet -// @Function -// @Return: Team -type TeamGet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` -} - -func (x *TeamGet) Reset() { - *x = TeamGet{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamGet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamGet) ProtoMessage() {} - -func (x *TeamGet) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamGet.ProtoReflect.Descriptor instead. -func (*TeamGet) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{0} -} - -func (x *TeamGet) GetID() int64 { - if x != nil { - return x.ID - } - return 0 -} - -// TeamAddMember -// @Function -// @Return: Bool -type TeamAddMember struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - Manager bool `protobuf:"varint,3,opt,name=Manager,proto3" json:"Manager,omitempty"` -} - -func (x *TeamAddMember) Reset() { - *x = TeamAddMember{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamAddMember) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamAddMember) ProtoMessage() {} - -func (x *TeamAddMember) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamAddMember.ProtoReflect.Descriptor instead. -func (*TeamAddMember) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{1} -} - -func (x *TeamAddMember) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *TeamAddMember) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *TeamAddMember) GetManager() bool { - if x != nil { - return x.Manager - } - return false -} - -// TeamRemoveMember -// @Function -// @Return: Bool -type TeamRemoveMember struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` -} - -func (x *TeamRemoveMember) Reset() { - *x = TeamRemoveMember{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamRemoveMember) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamRemoveMember) ProtoMessage() {} - -func (x *TeamRemoveMember) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamRemoveMember.ProtoReflect.Descriptor instead. -func (*TeamRemoveMember) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{2} -} - -func (x *TeamRemoveMember) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *TeamRemoveMember) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -// TeamPromote -// @Function -// @Return: Bool -type TeamPromote struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` -} - -func (x *TeamPromote) Reset() { - *x = TeamPromote{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamPromote) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamPromote) ProtoMessage() {} - -func (x *TeamPromote) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamPromote.ProtoReflect.Descriptor instead. -func (*TeamPromote) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{3} -} - -func (x *TeamPromote) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *TeamPromote) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -// TeamDemote -// @Function -// @Return: Bool -type TeamDemote struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` -} - -func (x *TeamDemote) Reset() { - *x = TeamDemote{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamDemote) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamDemote) ProtoMessage() {} - -func (x *TeamDemote) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamDemote.ProtoReflect.Descriptor instead. -func (*TeamDemote) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{4} -} - -func (x *TeamDemote) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *TeamDemote) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -// TeamLeave -// @Function -// @Return: Bool -type TeamLeave struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,2,opt,name=TeamID,proto3" json:"TeamID,omitempty"` -} - -func (x *TeamLeave) Reset() { - *x = TeamLeave{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamLeave) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamLeave) ProtoMessage() {} - -func (x *TeamLeave) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamLeave.ProtoReflect.Descriptor instead. -func (*TeamLeave) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{5} -} - -func (x *TeamLeave) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -// TeamJoin -// @Function -// @Return: Bool -type TeamJoin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Token []byte `protobuf:"bytes,2,opt,name=Token,proto3" json:"Token,omitempty"` -} - -func (x *TeamJoin) Reset() { - *x = TeamJoin{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamJoin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamJoin) ProtoMessage() {} - -func (x *TeamJoin) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamJoin.ProtoReflect.Descriptor instead. -func (*TeamJoin) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{6} -} - -func (x *TeamJoin) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *TeamJoin) GetToken() []byte { - if x != nil { - return x.Token - } - return nil -} - -// TeamListMembers -// @Function -// @Return: TeamMembers -type TeamListMembers struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` -} - -func (x *TeamListMembers) Reset() { - *x = TeamListMembers{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamListMembers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamListMembers) ProtoMessage() {} - -func (x *TeamListMembers) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamListMembers.ProtoReflect.Descriptor instead. -func (*TeamListMembers) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{7} -} - -func (x *TeamListMembers) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -// TeamEdit -// @Function -// @Returns: Bool/Team -type TeamEdit struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` - ReturnTeam bool `protobuf:"varint,3,opt,name=ReturnTeam,proto3" json:"ReturnTeam,omitempty"` -} - -func (x *TeamEdit) Reset() { - *x = TeamEdit{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamEdit) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamEdit) ProtoMessage() {} - -func (x *TeamEdit) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamEdit.ProtoReflect.Descriptor instead. -func (*TeamEdit) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{8} -} - -func (x *TeamEdit) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *TeamEdit) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *TeamEdit) GetReturnTeam() bool { - if x != nil { - return x.ReturnTeam - } - return false -} - -// TeamUploadPhoto -// @Function -// @Returns: TeamPhoto -type TeamUploadPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - File *InputFile `protobuf:"bytes,2,opt,name=File,proto3" json:"File,omitempty"` -} - -func (x *TeamUploadPhoto) Reset() { - *x = TeamUploadPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamUploadPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamUploadPhoto) ProtoMessage() {} - -func (x *TeamUploadPhoto) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamUploadPhoto.ProtoReflect.Descriptor instead. -func (*TeamUploadPhoto) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{9} -} - -func (x *TeamUploadPhoto) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *TeamUploadPhoto) GetFile() *InputFile { - if x != nil { - return x.File - } - return nil -} - -// TeamRemovePhoto -// @Function -// @Returns: Bool -type TeamRemovePhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` -} - -func (x *TeamRemovePhoto) Reset() { - *x = TeamRemovePhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamRemovePhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamRemovePhoto) ProtoMessage() {} - -func (x *TeamRemovePhoto) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamRemovePhoto.ProtoReflect.Descriptor instead. -func (*TeamRemovePhoto) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{10} -} - -func (x *TeamRemovePhoto) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -// TeamMembers -type TeamMembers struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Members []*TeamMember `protobuf:"bytes,1,rep,name=Members,proto3" json:"Members,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` -} - -func (x *TeamMembers) Reset() { - *x = TeamMembers{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamMembers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamMembers) ProtoMessage() {} - -func (x *TeamMembers) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamMembers.ProtoReflect.Descriptor instead. -func (*TeamMembers) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{11} -} - -func (x *TeamMembers) GetMembers() []*TeamMember { - if x != nil { - return x.Members - } - return nil -} - -func (x *TeamMembers) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -// TeamMember -type TeamMember struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Admin bool `protobuf:"varint,2,opt,name=Admin,proto3" json:"Admin,omitempty"` - User *User `protobuf:"bytes,3,opt,name=User,proto3" json:"User,omitempty"` -} - -func (x *TeamMember) Reset() { - *x = TeamMember{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamMember) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamMember) ProtoMessage() {} - -func (x *TeamMember) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamMember.ProtoReflect.Descriptor instead. -func (*TeamMember) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{12} -} - -func (x *TeamMember) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *TeamMember) GetAdmin() bool { - if x != nil { - return x.Admin - } - return false -} - -func (x *TeamMember) GetUser() *User { - if x != nil { - return x.User - } - return nil -} - -// TeamsMany -type TeamsMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Teams []*Team `protobuf:"bytes,1,rep,name=Teams,proto3" json:"Teams,omitempty"` - Users []*User `protobuf:"bytes,2,rep,name=Users,proto3" json:"Users,omitempty"` - Empty bool `protobuf:"varint,3,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *TeamsMany) Reset() { - *x = TeamsMany{} - if protoimpl.UnsafeEnabled { - mi := &file_team_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TeamsMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TeamsMany) ProtoMessage() {} - -func (x *TeamsMany) ProtoReflect() protoreflect.Message { - mi := &file_team_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TeamsMany.ProtoReflect.Descriptor instead. -func (*TeamsMany) Descriptor() ([]byte, []int) { - return file_team_proto_rawDescGZIP(), []int{13} -} - -func (x *TeamsMany) GetTeams() []*Team { - if x != nil { - return x.Teams - } - return nil -} - -func (x *TeamsMany) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *TeamsMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -var File_team_proto protoreflect.FileDescriptor - -var file_team_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x74, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x73, - 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0x1d, 0x0a, 0x07, 0x54, 0x65, 0x61, 0x6d, 0x47, 0x65, 0x74, 0x12, 0x12, - 0x0a, 0x02, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x02, - 0x49, 0x44, 0x22, 0x61, 0x0a, 0x0d, 0x54, 0x65, 0x61, 0x6d, 0x41, 0x64, 0x64, 0x4d, 0x65, 0x6d, - 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, - 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x4d, - 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x4d, 0x61, - 0x6e, 0x61, 0x67, 0x65, 0x72, 0x22, 0x4a, 0x0a, 0x10, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, - 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, - 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, - 0x44, 0x22, 0x45, 0x0a, 0x0b, 0x54, 0x65, 0x61, 0x6d, 0x50, 0x72, 0x6f, 0x6d, 0x6f, 0x74, 0x65, - 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0x44, 0x0a, 0x0a, 0x54, 0x65, 0x61, 0x6d, - 0x44, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, - 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0x27, - 0x0a, 0x09, 0x54, 0x65, 0x61, 0x6d, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x1a, 0x0a, 0x06, 0x54, - 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, - 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x22, 0x3c, 0x0a, 0x08, 0x54, 0x65, 0x61, 0x6d, 0x4a, - 0x6f, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, - 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x2d, 0x0a, 0x0f, 0x54, 0x65, 0x61, 0x6d, 0x4c, 0x69, 0x73, - 0x74, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, - 0x61, 0x6d, 0x49, 0x44, 0x22, 0x5a, 0x0a, 0x08, 0x54, 0x65, 0x61, 0x6d, 0x45, 0x64, 0x69, 0x74, - 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, - 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x54, 0x65, 0x61, 0x6d, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x52, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x54, 0x65, 0x61, 0x6d, - 0x22, 0x51, 0x0a, 0x0f, 0x54, 0x65, 0x61, 0x6d, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x68, - 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, - 0x22, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x46, - 0x69, 0x6c, 0x65, 0x22, 0x2d, 0x0a, 0x0f, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, - 0x49, 0x44, 0x22, 0x59, 0x0a, 0x0b, 0x54, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, - 0x73, 0x12, 0x29, 0x0a, 0x07, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x6d, - 0x62, 0x65, 0x72, 0x52, 0x07, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x05, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x22, 0x5d, 0x0a, - 0x0a, 0x54, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x55, - 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, - 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x1d, 0x0a, - 0x04, 0x55, 0x73, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x55, 0x73, 0x65, 0x72, 0x22, 0x63, 0x0a, 0x09, - 0x54, 0x65, 0x61, 0x6d, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x1f, 0x0a, 0x05, 0x54, 0x65, 0x61, - 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, - 0x65, 0x61, 0x6d, 0x52, 0x05, 0x54, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, - 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_team_proto_rawDescOnce sync.Once - file_team_proto_rawDescData = file_team_proto_rawDesc -) - -func file_team_proto_rawDescGZIP() []byte { - file_team_proto_rawDescOnce.Do(func() { - file_team_proto_rawDescData = protoimpl.X.CompressGZIP(file_team_proto_rawDescData) - }) - return file_team_proto_rawDescData -} - -var file_team_proto_msgTypes = make([]protoimpl.MessageInfo, 14) -var file_team_proto_goTypes = []interface{}{ - (*TeamGet)(nil), // 0: msg.TeamGet - (*TeamAddMember)(nil), // 1: msg.TeamAddMember - (*TeamRemoveMember)(nil), // 2: msg.TeamRemoveMember - (*TeamPromote)(nil), // 3: msg.TeamPromote - (*TeamDemote)(nil), // 4: msg.TeamDemote - (*TeamLeave)(nil), // 5: msg.TeamLeave - (*TeamJoin)(nil), // 6: msg.TeamJoin - (*TeamListMembers)(nil), // 7: msg.TeamListMembers - (*TeamEdit)(nil), // 8: msg.TeamEdit - (*TeamUploadPhoto)(nil), // 9: msg.TeamUploadPhoto - (*TeamRemovePhoto)(nil), // 10: msg.TeamRemovePhoto - (*TeamMembers)(nil), // 11: msg.TeamMembers - (*TeamMember)(nil), // 12: msg.TeamMember - (*TeamsMany)(nil), // 13: msg.TeamsMany - (*InputFile)(nil), // 14: msg.InputFile - (*User)(nil), // 15: msg.User - (*Team)(nil), // 16: msg.Team -} -var file_team_proto_depIdxs = []int32{ - 14, // 0: msg.TeamUploadPhoto.File:type_name -> msg.InputFile - 12, // 1: msg.TeamMembers.Members:type_name -> msg.TeamMember - 15, // 2: msg.TeamMembers.Users:type_name -> msg.User - 15, // 3: msg.TeamMember.User:type_name -> msg.User - 16, // 4: msg.TeamsMany.Teams:type_name -> msg.Team - 15, // 5: msg.TeamsMany.Users:type_name -> msg.User - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_team_proto_init() } -func file_team_proto_init() { - if File_team_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_team_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamGet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamAddMember); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamRemoveMember); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamPromote); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamDemote); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamLeave); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamJoin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamListMembers); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamEdit); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamUploadPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamRemovePhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamMembers); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamMember); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_team_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TeamsMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_team_proto_rawDesc, - NumEnums: 0, - NumMessages: 14, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_team_proto_goTypes, - DependencyIndexes: file_team_proto_depIdxs, - MessageInfos: file_team_proto_msgTypes, - }.Build() - File_team_proto = out.File - file_team_proto_rawDesc = nil - file_team_proto_goTypes = nil - file_team_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/team.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/team.rony.go deleted file mode 100644 index 8b276525..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/team.rony.go +++ /dev/null @@ -1,923 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: team.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_TeamGet int64 = 1172720786 - -type poolTeamGet struct { - pool sync.Pool -} - -func (p *poolTeamGet) Get() *TeamGet { - x, ok := p.pool.Get().(*TeamGet) - if !ok { - x = &TeamGet{} - } - - return x -} - -func (p *poolTeamGet) Put(x *TeamGet) { - if x == nil { - return - } - - x.ID = 0 - - p.pool.Put(x) -} - -var PoolTeamGet = poolTeamGet{} - -func (x *TeamGet) DeepCopy(z *TeamGet) { - z.ID = x.ID -} - -func (x *TeamGet) Clone() *TeamGet { - z := &TeamGet{} - x.DeepCopy(z) - return z -} - -func (x *TeamGet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamGet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamGet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamGet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamGet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamGet, x) -} - -const C_TeamAddMember int64 = 3889056091 - -type poolTeamAddMember struct { - pool sync.Pool -} - -func (p *poolTeamAddMember) Get() *TeamAddMember { - x, ok := p.pool.Get().(*TeamAddMember) - if !ok { - x = &TeamAddMember{} - } - - return x -} - -func (p *poolTeamAddMember) Put(x *TeamAddMember) { - if x == nil { - return - } - - x.TeamID = 0 - x.UserID = 0 - x.Manager = false - - p.pool.Put(x) -} - -var PoolTeamAddMember = poolTeamAddMember{} - -func (x *TeamAddMember) DeepCopy(z *TeamAddMember) { - z.TeamID = x.TeamID - z.UserID = x.UserID - z.Manager = x.Manager -} - -func (x *TeamAddMember) Clone() *TeamAddMember { - z := &TeamAddMember{} - x.DeepCopy(z) - return z -} - -func (x *TeamAddMember) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamAddMember) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamAddMember) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamAddMember) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamAddMember) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamAddMember, x) -} - -const C_TeamRemoveMember int64 = 4200364613 - -type poolTeamRemoveMember struct { - pool sync.Pool -} - -func (p *poolTeamRemoveMember) Get() *TeamRemoveMember { - x, ok := p.pool.Get().(*TeamRemoveMember) - if !ok { - x = &TeamRemoveMember{} - } - - return x -} - -func (p *poolTeamRemoveMember) Put(x *TeamRemoveMember) { - if x == nil { - return - } - - x.TeamID = 0 - x.UserID = 0 - - p.pool.Put(x) -} - -var PoolTeamRemoveMember = poolTeamRemoveMember{} - -func (x *TeamRemoveMember) DeepCopy(z *TeamRemoveMember) { - z.TeamID = x.TeamID - z.UserID = x.UserID -} - -func (x *TeamRemoveMember) Clone() *TeamRemoveMember { - z := &TeamRemoveMember{} - x.DeepCopy(z) - return z -} - -func (x *TeamRemoveMember) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamRemoveMember) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamRemoveMember) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamRemoveMember) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamRemoveMember) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamRemoveMember, x) -} - -const C_TeamPromote int64 = 382328820 - -type poolTeamPromote struct { - pool sync.Pool -} - -func (p *poolTeamPromote) Get() *TeamPromote { - x, ok := p.pool.Get().(*TeamPromote) - if !ok { - x = &TeamPromote{} - } - - return x -} - -func (p *poolTeamPromote) Put(x *TeamPromote) { - if x == nil { - return - } - - x.TeamID = 0 - x.UserID = 0 - - p.pool.Put(x) -} - -var PoolTeamPromote = poolTeamPromote{} - -func (x *TeamPromote) DeepCopy(z *TeamPromote) { - z.TeamID = x.TeamID - z.UserID = x.UserID -} - -func (x *TeamPromote) Clone() *TeamPromote { - z := &TeamPromote{} - x.DeepCopy(z) - return z -} - -func (x *TeamPromote) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamPromote) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamPromote) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamPromote) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamPromote) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamPromote, x) -} - -const C_TeamDemote int64 = 2331393294 - -type poolTeamDemote struct { - pool sync.Pool -} - -func (p *poolTeamDemote) Get() *TeamDemote { - x, ok := p.pool.Get().(*TeamDemote) - if !ok { - x = &TeamDemote{} - } - - return x -} - -func (p *poolTeamDemote) Put(x *TeamDemote) { - if x == nil { - return - } - - x.TeamID = 0 - x.UserID = 0 - - p.pool.Put(x) -} - -var PoolTeamDemote = poolTeamDemote{} - -func (x *TeamDemote) DeepCopy(z *TeamDemote) { - z.TeamID = x.TeamID - z.UserID = x.UserID -} - -func (x *TeamDemote) Clone() *TeamDemote { - z := &TeamDemote{} - x.DeepCopy(z) - return z -} - -func (x *TeamDemote) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamDemote) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamDemote) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamDemote) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamDemote) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamDemote, x) -} - -const C_TeamLeave int64 = 1413785879 - -type poolTeamLeave struct { - pool sync.Pool -} - -func (p *poolTeamLeave) Get() *TeamLeave { - x, ok := p.pool.Get().(*TeamLeave) - if !ok { - x = &TeamLeave{} - } - - return x -} - -func (p *poolTeamLeave) Put(x *TeamLeave) { - if x == nil { - return - } - - x.TeamID = 0 - - p.pool.Put(x) -} - -var PoolTeamLeave = poolTeamLeave{} - -func (x *TeamLeave) DeepCopy(z *TeamLeave) { - z.TeamID = x.TeamID -} - -func (x *TeamLeave) Clone() *TeamLeave { - z := &TeamLeave{} - x.DeepCopy(z) - return z -} - -func (x *TeamLeave) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamLeave) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamLeave) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamLeave) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamLeave) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamLeave, x) -} - -const C_TeamJoin int64 = 1725794017 - -type poolTeamJoin struct { - pool sync.Pool -} - -func (p *poolTeamJoin) Get() *TeamJoin { - x, ok := p.pool.Get().(*TeamJoin) - if !ok { - x = &TeamJoin{} - } - - return x -} - -func (p *poolTeamJoin) Put(x *TeamJoin) { - if x == nil { - return - } - - x.TeamID = 0 - x.Token = x.Token[:0] - - p.pool.Put(x) -} - -var PoolTeamJoin = poolTeamJoin{} - -func (x *TeamJoin) DeepCopy(z *TeamJoin) { - z.TeamID = x.TeamID - z.Token = append(z.Token[:0], x.Token...) -} - -func (x *TeamJoin) Clone() *TeamJoin { - z := &TeamJoin{} - x.DeepCopy(z) - return z -} - -func (x *TeamJoin) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamJoin) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamJoin) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamJoin) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamJoin) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamJoin, x) -} - -const C_TeamListMembers int64 = 3107323194 - -type poolTeamListMembers struct { - pool sync.Pool -} - -func (p *poolTeamListMembers) Get() *TeamListMembers { - x, ok := p.pool.Get().(*TeamListMembers) - if !ok { - x = &TeamListMembers{} - } - - return x -} - -func (p *poolTeamListMembers) Put(x *TeamListMembers) { - if x == nil { - return - } - - x.TeamID = 0 - - p.pool.Put(x) -} - -var PoolTeamListMembers = poolTeamListMembers{} - -func (x *TeamListMembers) DeepCopy(z *TeamListMembers) { - z.TeamID = x.TeamID -} - -func (x *TeamListMembers) Clone() *TeamListMembers { - z := &TeamListMembers{} - x.DeepCopy(z) - return z -} - -func (x *TeamListMembers) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamListMembers) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamListMembers) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamListMembers) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamListMembers) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamListMembers, x) -} - -const C_TeamEdit int64 = 3481894956 - -type poolTeamEdit struct { - pool sync.Pool -} - -func (p *poolTeamEdit) Get() *TeamEdit { - x, ok := p.pool.Get().(*TeamEdit) - if !ok { - x = &TeamEdit{} - } - - return x -} - -func (p *poolTeamEdit) Put(x *TeamEdit) { - if x == nil { - return - } - - x.TeamID = 0 - x.Name = "" - x.ReturnTeam = false - - p.pool.Put(x) -} - -var PoolTeamEdit = poolTeamEdit{} - -func (x *TeamEdit) DeepCopy(z *TeamEdit) { - z.TeamID = x.TeamID - z.Name = x.Name - z.ReturnTeam = x.ReturnTeam -} - -func (x *TeamEdit) Clone() *TeamEdit { - z := &TeamEdit{} - x.DeepCopy(z) - return z -} - -func (x *TeamEdit) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamEdit) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamEdit) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamEdit) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamEdit) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamEdit, x) -} - -const C_TeamUploadPhoto int64 = 1595699082 - -type poolTeamUploadPhoto struct { - pool sync.Pool -} - -func (p *poolTeamUploadPhoto) Get() *TeamUploadPhoto { - x, ok := p.pool.Get().(*TeamUploadPhoto) - if !ok { - x = &TeamUploadPhoto{} - } - - x.File = PoolInputFile.Get() - - return x -} - -func (p *poolTeamUploadPhoto) Put(x *TeamUploadPhoto) { - if x == nil { - return - } - - x.TeamID = 0 - PoolInputFile.Put(x.File) - - p.pool.Put(x) -} - -var PoolTeamUploadPhoto = poolTeamUploadPhoto{} - -func (x *TeamUploadPhoto) DeepCopy(z *TeamUploadPhoto) { - z.TeamID = x.TeamID - if x.File != nil { - if z.File == nil { - z.File = PoolInputFile.Get() - } - x.File.DeepCopy(z.File) - } else { - PoolInputFile.Put(z.File) - z.File = nil - } -} - -func (x *TeamUploadPhoto) Clone() *TeamUploadPhoto { - z := &TeamUploadPhoto{} - x.DeepCopy(z) - return z -} - -func (x *TeamUploadPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamUploadPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamUploadPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamUploadPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamUploadPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamUploadPhoto, x) -} - -const C_TeamRemovePhoto int64 = 3388888323 - -type poolTeamRemovePhoto struct { - pool sync.Pool -} - -func (p *poolTeamRemovePhoto) Get() *TeamRemovePhoto { - x, ok := p.pool.Get().(*TeamRemovePhoto) - if !ok { - x = &TeamRemovePhoto{} - } - - return x -} - -func (p *poolTeamRemovePhoto) Put(x *TeamRemovePhoto) { - if x == nil { - return - } - - x.TeamID = 0 - - p.pool.Put(x) -} - -var PoolTeamRemovePhoto = poolTeamRemovePhoto{} - -func (x *TeamRemovePhoto) DeepCopy(z *TeamRemovePhoto) { - z.TeamID = x.TeamID -} - -func (x *TeamRemovePhoto) Clone() *TeamRemovePhoto { - z := &TeamRemovePhoto{} - x.DeepCopy(z) - return z -} - -func (x *TeamRemovePhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamRemovePhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamRemovePhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamRemovePhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamRemovePhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamRemovePhoto, x) -} - -const C_TeamMembers int64 = 2208941294 - -type poolTeamMembers struct { - pool sync.Pool -} - -func (p *poolTeamMembers) Get() *TeamMembers { - x, ok := p.pool.Get().(*TeamMembers) - if !ok { - x = &TeamMembers{} - } - - return x -} - -func (p *poolTeamMembers) Put(x *TeamMembers) { - if x == nil { - return - } - - for _, z := range x.Members { - PoolTeamMember.Put(z) - } - x.Members = x.Members[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - - p.pool.Put(x) -} - -var PoolTeamMembers = poolTeamMembers{} - -func (x *TeamMembers) DeepCopy(z *TeamMembers) { - for idx := range x.Members { - if x.Members[idx] == nil { - continue - } - xx := PoolTeamMember.Get() - x.Members[idx].DeepCopy(xx) - z.Members = append(z.Members, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } -} - -func (x *TeamMembers) Clone() *TeamMembers { - z := &TeamMembers{} - x.DeepCopy(z) - return z -} - -func (x *TeamMembers) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamMembers) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamMembers) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamMembers) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamMembers) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamMembers, x) -} - -const C_TeamMember int64 = 1965775170 - -type poolTeamMember struct { - pool sync.Pool -} - -func (p *poolTeamMember) Get() *TeamMember { - x, ok := p.pool.Get().(*TeamMember) - if !ok { - x = &TeamMember{} - } - - x.User = PoolUser.Get() - - return x -} - -func (p *poolTeamMember) Put(x *TeamMember) { - if x == nil { - return - } - - x.UserID = 0 - x.Admin = false - PoolUser.Put(x.User) - - p.pool.Put(x) -} - -var PoolTeamMember = poolTeamMember{} - -func (x *TeamMember) DeepCopy(z *TeamMember) { - z.UserID = x.UserID - z.Admin = x.Admin - if x.User != nil { - if z.User == nil { - z.User = PoolUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolUser.Put(z.User) - z.User = nil - } -} - -func (x *TeamMember) Clone() *TeamMember { - z := &TeamMember{} - x.DeepCopy(z) - return z -} - -func (x *TeamMember) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamMember) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamMember) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamMember) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamMember) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamMember, x) -} - -const C_TeamsMany int64 = 2225718663 - -type poolTeamsMany struct { - pool sync.Pool -} - -func (p *poolTeamsMany) Get() *TeamsMany { - x, ok := p.pool.Get().(*TeamsMany) - if !ok { - x = &TeamsMany{} - } - - return x -} - -func (p *poolTeamsMany) Put(x *TeamsMany) { - if x == nil { - return - } - - for _, z := range x.Teams { - PoolTeam.Put(z) - } - x.Teams = x.Teams[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolTeamsMany = poolTeamsMany{} - -func (x *TeamsMany) DeepCopy(z *TeamsMany) { - for idx := range x.Teams { - if x.Teams[idx] == nil { - continue - } - xx := PoolTeam.Get() - x.Teams[idx].DeepCopy(xx) - z.Teams = append(z.Teams, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - z.Empty = x.Empty -} - -func (x *TeamsMany) Clone() *TeamsMany { - z := &TeamsMany{} - x.DeepCopy(z) - return z -} - -func (x *TeamsMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *TeamsMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *TeamsMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *TeamsMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *TeamsMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_TeamsMany, x) -} - -func init() { - registry.RegisterConstructor(1172720786, "TeamGet") - registry.RegisterConstructor(3889056091, "TeamAddMember") - registry.RegisterConstructor(4200364613, "TeamRemoveMember") - registry.RegisterConstructor(382328820, "TeamPromote") - registry.RegisterConstructor(2331393294, "TeamDemote") - registry.RegisterConstructor(1413785879, "TeamLeave") - registry.RegisterConstructor(1725794017, "TeamJoin") - registry.RegisterConstructor(3107323194, "TeamListMembers") - registry.RegisterConstructor(3481894956, "TeamEdit") - registry.RegisterConstructor(1595699082, "TeamUploadPhoto") - registry.RegisterConstructor(3388888323, "TeamRemovePhoto") - registry.RegisterConstructor(2208941294, "TeamMembers") - registry.RegisterConstructor(1965775170, "TeamMember") - registry.RegisterConstructor(2225718663, "TeamsMany") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/updates.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/updates.pb.go deleted file mode 100644 index 1bb0dd73..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/updates.pb.go +++ /dev/null @@ -1,6047 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: updates.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// RedirectTarget -type RedirectTarget int32 - -const ( - RedirectTarget_RedirectTargetRpc RedirectTarget = 0 - RedirectTarget_RedirectTargetFile RedirectTarget = 1 - RedirectTarget_RedirectTargetProxy RedirectTarget = 2 - RedirectTarget_RedirectTargetReserved1 RedirectTarget = 3 - RedirectTarget_RedirectTargetReserved2 RedirectTarget = 4 - RedirectTarget_RedirectTargetReserved3 RedirectTarget = 5 - RedirectTarget_RedirectTargetReserved4 RedirectTarget = 6 -) - -// Enum value maps for RedirectTarget. -var ( - RedirectTarget_name = map[int32]string{ - 0: "RedirectTargetRpc", - 1: "RedirectTargetFile", - 2: "RedirectTargetProxy", - 3: "RedirectTargetReserved1", - 4: "RedirectTargetReserved2", - 5: "RedirectTargetReserved3", - 6: "RedirectTargetReserved4", - } - RedirectTarget_value = map[string]int32{ - "RedirectTargetRpc": 0, - "RedirectTargetFile": 1, - "RedirectTargetProxy": 2, - "RedirectTargetReserved1": 3, - "RedirectTargetReserved2": 4, - "RedirectTargetReserved3": 5, - "RedirectTargetReserved4": 6, - } -) - -func (x RedirectTarget) Enum() *RedirectTarget { - p := new(RedirectTarget) - *p = x - return p -} - -func (x RedirectTarget) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (RedirectTarget) Descriptor() protoreflect.EnumDescriptor { - return file_updates_proto_enumTypes[0].Descriptor() -} - -func (RedirectTarget) Type() protoreflect.EnumType { - return &file_updates_proto_enumTypes[0] -} - -func (x RedirectTarget) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use RedirectTarget.Descriptor instead. -func (RedirectTarget) EnumDescriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{0} -} - -// UpdateGetState -// @Function -// @Return: UpdateState -type UpdateGetState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *UpdateGetState) Reset() { - *x = UpdateGetState{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateGetState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateGetState) ProtoMessage() {} - -func (x *UpdateGetState) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateGetState.ProtoReflect.Descriptor instead. -func (*UpdateGetState) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{0} -} - -// UpdateGetDifference -// @Function -// @Return: UpdateDifference -type UpdateGetDifference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - From int64 `protobuf:"varint,1,opt,name=From,proto3" json:"From,omitempty"` - Limit int32 `protobuf:"varint,2,opt,name=Limit,proto3" json:"Limit,omitempty"` -} - -func (x *UpdateGetDifference) Reset() { - *x = UpdateGetDifference{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateGetDifference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateGetDifference) ProtoMessage() {} - -func (x *UpdateGetDifference) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateGetDifference.ProtoReflect.Descriptor instead. -func (*UpdateGetDifference) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{1} -} - -func (x *UpdateGetDifference) GetFrom() int64 { - if x != nil { - return x.From - } - return 0 -} - -func (x *UpdateGetDifference) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -// UpdateDifference -type UpdateDifference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - More bool `protobuf:"varint,1,opt,name=More,proto3" json:"More,omitempty"` - MaxUpdateID int64 `protobuf:"varint,2,opt,name=MaxUpdateID,proto3" json:"MaxUpdateID,omitempty"` - MinUpdateID int64 `protobuf:"varint,3,opt,name=MinUpdateID,proto3" json:"MinUpdateID,omitempty"` - Updates []*UpdateEnvelope `protobuf:"bytes,4,rep,name=Updates,proto3" json:"Updates,omitempty"` - Users []*User `protobuf:"bytes,5,rep,name=Users,proto3" json:"Users,omitempty"` - Groups []*Group `protobuf:"bytes,6,rep,name=Groups,proto3" json:"Groups,omitempty"` - CurrentUpdateID int64 `protobuf:"varint,7,opt,name=CurrentUpdateID,proto3" json:"CurrentUpdateID,omitempty"` -} - -func (x *UpdateDifference) Reset() { - *x = UpdateDifference{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateDifference) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateDifference) ProtoMessage() {} - -func (x *UpdateDifference) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateDifference.ProtoReflect.Descriptor instead. -func (*UpdateDifference) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{2} -} - -func (x *UpdateDifference) GetMore() bool { - if x != nil { - return x.More - } - return false -} - -func (x *UpdateDifference) GetMaxUpdateID() int64 { - if x != nil { - return x.MaxUpdateID - } - return 0 -} - -func (x *UpdateDifference) GetMinUpdateID() int64 { - if x != nil { - return x.MinUpdateID - } - return 0 -} - -func (x *UpdateDifference) GetUpdates() []*UpdateEnvelope { - if x != nil { - return x.Updates - } - return nil -} - -func (x *UpdateDifference) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *UpdateDifference) GetGroups() []*Group { - if x != nil { - return x.Groups - } - return nil -} - -func (x *UpdateDifference) GetCurrentUpdateID() int64 { - if x != nil { - return x.CurrentUpdateID - } - return 0 -} - -// UpdateTooLong -type UpdateTooLong struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *UpdateTooLong) Reset() { - *x = UpdateTooLong{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateTooLong) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateTooLong) ProtoMessage() {} - -func (x *UpdateTooLong) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateTooLong.ProtoReflect.Descriptor instead. -func (*UpdateTooLong) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{3} -} - -// UpdateState -type UpdateState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UpdateID int64 `protobuf:"varint,1,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` -} - -func (x *UpdateState) Reset() { - *x = UpdateState{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateState) ProtoMessage() {} - -func (x *UpdateState) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateState.ProtoReflect.Descriptor instead. -func (*UpdateState) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{4} -} - -func (x *UpdateState) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -// UpdateMessageID -type UpdateMessageID struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - MessageID int64 `protobuf:"varint,1,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - RandomID int64 `protobuf:"varint,2,opt,name=RandomID,proto3" json:"RandomID,omitempty"` -} - -func (x *UpdateMessageID) Reset() { - *x = UpdateMessageID{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateMessageID) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMessageID) ProtoMessage() {} - -func (x *UpdateMessageID) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMessageID.ProtoReflect.Descriptor instead. -func (*UpdateMessageID) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{5} -} - -func (x *UpdateMessageID) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateMessageID) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *UpdateMessageID) GetRandomID() int64 { - if x != nil { - return x.RandomID - } - return 0 -} - -// UpdateNewMessage -type UpdateNewMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Message *UserMessage `protobuf:"bytes,1,opt,name=Message,proto3" json:"Message,omitempty"` - Sender *User `protobuf:"bytes,2,opt,name=Sender,proto3" json:"Sender,omitempty"` - AccessHash uint64 `protobuf:"fixed64,3,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - SenderRefID int64 `protobuf:"varint,4,opt,name=SenderRefID,proto3" json:"SenderRefID,omitempty"` -} - -func (x *UpdateNewMessage) Reset() { - *x = UpdateNewMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateNewMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateNewMessage) ProtoMessage() {} - -func (x *UpdateNewMessage) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateNewMessage.ProtoReflect.Descriptor instead. -func (*UpdateNewMessage) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{6} -} - -func (x *UpdateNewMessage) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateNewMessage) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateNewMessage) GetMessage() *UserMessage { - if x != nil { - return x.Message - } - return nil -} - -func (x *UpdateNewMessage) GetSender() *User { - if x != nil { - return x.Sender - } - return nil -} - -func (x *UpdateNewMessage) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *UpdateNewMessage) GetSenderRefID() int64 { - if x != nil { - return x.SenderRefID - } - return 0 -} - -// UpdateMessageEdited -type UpdateMessageEdited struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Message *UserMessage `protobuf:"bytes,1,opt,name=Message,proto3" json:"Message,omitempty"` -} - -func (x *UpdateMessageEdited) Reset() { - *x = UpdateMessageEdited{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateMessageEdited) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMessageEdited) ProtoMessage() {} - -func (x *UpdateMessageEdited) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMessageEdited.ProtoReflect.Descriptor instead. -func (*UpdateMessageEdited) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{7} -} - -func (x *UpdateMessageEdited) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateMessageEdited) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateMessageEdited) GetMessage() *UserMessage { - if x != nil { - return x.Message - } - return nil -} - -// UpdateMessageDeleted -type UpdateMessagesDeleted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - MessageIDs []int64 `protobuf:"varint,1,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` - Peer *Peer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *UpdateMessagesDeleted) Reset() { - *x = UpdateMessagesDeleted{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateMessagesDeleted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMessagesDeleted) ProtoMessage() {} - -func (x *UpdateMessagesDeleted) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMessagesDeleted.ProtoReflect.Descriptor instead. -func (*UpdateMessagesDeleted) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{8} -} - -func (x *UpdateMessagesDeleted) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateMessagesDeleted) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateMessagesDeleted) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateMessagesDeleted) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -func (x *UpdateMessagesDeleted) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -// UpdateReadHistoryInbox -type UpdateReadHistoryInbox struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MaxID int64 `protobuf:"varint,2,opt,name=MaxID,proto3" json:"MaxID,omitempty"` -} - -func (x *UpdateReadHistoryInbox) Reset() { - *x = UpdateReadHistoryInbox{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateReadHistoryInbox) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateReadHistoryInbox) ProtoMessage() {} - -func (x *UpdateReadHistoryInbox) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateReadHistoryInbox.ProtoReflect.Descriptor instead. -func (*UpdateReadHistoryInbox) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{9} -} - -func (x *UpdateReadHistoryInbox) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateReadHistoryInbox) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateReadHistoryInbox) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateReadHistoryInbox) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdateReadHistoryInbox) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -// UpdateReadHistoryOutbox -type UpdateReadHistoryOutbox struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MaxID int64 `protobuf:"varint,2,opt,name=MaxID,proto3" json:"MaxID,omitempty"` - UserID int64 `protobuf:"varint,3,opt,name=UserID,proto3" json:"UserID,omitempty"` -} - -func (x *UpdateReadHistoryOutbox) Reset() { - *x = UpdateReadHistoryOutbox{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateReadHistoryOutbox) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateReadHistoryOutbox) ProtoMessage() {} - -func (x *UpdateReadHistoryOutbox) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateReadHistoryOutbox.ProtoReflect.Descriptor instead. -func (*UpdateReadHistoryOutbox) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{10} -} - -func (x *UpdateReadHistoryOutbox) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateReadHistoryOutbox) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateReadHistoryOutbox) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateReadHistoryOutbox) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdateReadHistoryOutbox) GetMaxID() int64 { - if x != nil { - return x.MaxID - } - return 0 -} - -func (x *UpdateReadHistoryOutbox) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -// UpdateMessagePinned -type UpdateMessagePinned struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - MsgID int64 `protobuf:"varint,3,opt,name=MsgID,proto3" json:"MsgID,omitempty"` - Version int64 `protobuf:"varint,5,opt,name=Version,proto3" json:"Version,omitempty"` -} - -func (x *UpdateMessagePinned) Reset() { - *x = UpdateMessagePinned{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateMessagePinned) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMessagePinned) ProtoMessage() {} - -func (x *UpdateMessagePinned) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMessagePinned.ProtoReflect.Descriptor instead. -func (*UpdateMessagePinned) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{11} -} - -func (x *UpdateMessagePinned) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateMessagePinned) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateMessagePinned) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateMessagePinned) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdateMessagePinned) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateMessagePinned) GetMsgID() int64 { - if x != nil { - return x.MsgID - } - return 0 -} - -func (x *UpdateMessagePinned) GetVersion() int64 { - if x != nil { - return x.Version - } - return 0 -} - -// UpdateUserTyping -type UpdateUserTyping struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Action TypingAction `protobuf:"varint,2,opt,name=Action,proto3,enum=msg.TypingAction" json:"Action,omitempty"` - PeerID int64 `protobuf:"varint,3,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,4,opt,name=PeerType,proto3" json:"PeerType,omitempty"` -} - -func (x *UpdateUserTyping) Reset() { - *x = UpdateUserTyping{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateUserTyping) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUserTyping) ProtoMessage() {} - -func (x *UpdateUserTyping) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateUserTyping.ProtoReflect.Descriptor instead. -func (*UpdateUserTyping) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{12} -} - -func (x *UpdateUserTyping) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateUserTyping) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateUserTyping) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateUserTyping) GetAction() TypingAction { - if x != nil { - return x.Action - } - return TypingAction_TypingActionTyping -} - -func (x *UpdateUserTyping) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *UpdateUserTyping) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -// UpdateUserStatus -type UpdateUserStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Status int32 `protobuf:"varint,2,opt,name=Status,proto3" json:"Status,omitempty"` -} - -func (x *UpdateUserStatus) Reset() { - *x = UpdateUserStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateUserStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUserStatus) ProtoMessage() {} - -func (x *UpdateUserStatus) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateUserStatus.ProtoReflect.Descriptor instead. -func (*UpdateUserStatus) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{13} -} - -func (x *UpdateUserStatus) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateUserStatus) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateUserStatus) GetStatus() int32 { - if x != nil { - return x.Status - } - return 0 -} - -// UpdateUsername -type UpdateUsername struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Username string `protobuf:"bytes,2,opt,name=Username,proto3" json:"Username,omitempty"` - FirstName string `protobuf:"bytes,3,opt,name=FirstName,proto3" json:"FirstName,omitempty"` - LastName string `protobuf:"bytes,4,opt,name=LastName,proto3" json:"LastName,omitempty"` - Bio string `protobuf:"bytes,5,opt,name=Bio,proto3" json:"Bio,omitempty"` - Phone string `protobuf:"bytes,6,opt,name=Phone,proto3" json:"Phone,omitempty"` -} - -func (x *UpdateUsername) Reset() { - *x = UpdateUsername{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateUsername) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUsername) ProtoMessage() {} - -func (x *UpdateUsername) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateUsername.ProtoReflect.Descriptor instead. -func (*UpdateUsername) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{14} -} - -func (x *UpdateUsername) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateUsername) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateUsername) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateUsername) GetUsername() string { - if x != nil { - return x.Username - } - return "" -} - -func (x *UpdateUsername) GetFirstName() string { - if x != nil { - return x.FirstName - } - return "" -} - -func (x *UpdateUsername) GetLastName() string { - if x != nil { - return x.LastName - } - return "" -} - -func (x *UpdateUsername) GetBio() string { - if x != nil { - return x.Bio - } - return "" -} - -func (x *UpdateUsername) GetPhone() string { - if x != nil { - return x.Phone - } - return "" -} - -// UpdateUserPhoto -type UpdateUserPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Photo *UserPhoto `protobuf:"bytes,2,opt,name=Photo,proto3" json:"Photo,omitempty"` - PhotoID int64 `protobuf:"varint,3,opt,name=PhotoID,proto3" json:"PhotoID,omitempty"` - DeletedPhotoIDs []int64 `protobuf:"varint,4,rep,packed,name=DeletedPhotoIDs,proto3" json:"DeletedPhotoIDs,omitempty"` -} - -func (x *UpdateUserPhoto) Reset() { - *x = UpdateUserPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateUserPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUserPhoto) ProtoMessage() {} - -func (x *UpdateUserPhoto) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateUserPhoto.ProtoReflect.Descriptor instead. -func (*UpdateUserPhoto) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{15} -} - -func (x *UpdateUserPhoto) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateUserPhoto) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateUserPhoto) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateUserPhoto) GetPhoto() *UserPhoto { - if x != nil { - return x.Photo - } - return nil -} - -func (x *UpdateUserPhoto) GetPhotoID() int64 { - if x != nil { - return x.PhotoID - } - return 0 -} - -func (x *UpdateUserPhoto) GetDeletedPhotoIDs() []int64 { - if x != nil { - return x.DeletedPhotoIDs - } - return nil -} - -// UpdateNotifySettings -type UpdateNotifySettings struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - NotifyPeer *Peer `protobuf:"bytes,2,opt,name=NotifyPeer,proto3" json:"NotifyPeer,omitempty"` - Settings *PeerNotifySettings `protobuf:"bytes,3,opt,name=Settings,proto3" json:"Settings,omitempty"` -} - -func (x *UpdateNotifySettings) Reset() { - *x = UpdateNotifySettings{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateNotifySettings) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateNotifySettings) ProtoMessage() {} - -func (x *UpdateNotifySettings) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateNotifySettings.ProtoReflect.Descriptor instead. -func (*UpdateNotifySettings) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{16} -} - -func (x *UpdateNotifySettings) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateNotifySettings) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateNotifySettings) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateNotifySettings) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateNotifySettings) GetNotifyPeer() *Peer { - if x != nil { - return x.NotifyPeer - } - return nil -} - -func (x *UpdateNotifySettings) GetSettings() *PeerNotifySettings { - if x != nil { - return x.Settings - } - return nil -} - -// UpdateGroupParticipantAdd -type UpdateGroupParticipantAdd struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - InviterID int64 `protobuf:"varint,3,opt,name=InviterID,proto3" json:"InviterID,omitempty"` - Date int64 `protobuf:"varint,4,opt,name=Date,proto3" json:"Date,omitempty"` -} - -func (x *UpdateGroupParticipantAdd) Reset() { - *x = UpdateGroupParticipantAdd{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateGroupParticipantAdd) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateGroupParticipantAdd) ProtoMessage() {} - -func (x *UpdateGroupParticipantAdd) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateGroupParticipantAdd.ProtoReflect.Descriptor instead. -func (*UpdateGroupParticipantAdd) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{17} -} - -func (x *UpdateGroupParticipantAdd) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateGroupParticipantAdd) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateGroupParticipantAdd) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *UpdateGroupParticipantAdd) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateGroupParticipantAdd) GetInviterID() int64 { - if x != nil { - return x.InviterID - } - return 0 -} - -func (x *UpdateGroupParticipantAdd) GetDate() int64 { - if x != nil { - return x.Date - } - return 0 -} - -// UpdateGroupParticipantDeleted -type UpdateGroupParticipantDeleted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` -} - -func (x *UpdateGroupParticipantDeleted) Reset() { - *x = UpdateGroupParticipantDeleted{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateGroupParticipantDeleted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateGroupParticipantDeleted) ProtoMessage() {} - -func (x *UpdateGroupParticipantDeleted) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateGroupParticipantDeleted.ProtoReflect.Descriptor instead. -func (*UpdateGroupParticipantDeleted) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{18} -} - -func (x *UpdateGroupParticipantDeleted) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateGroupParticipantDeleted) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateGroupParticipantDeleted) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *UpdateGroupParticipantDeleted) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -// UpdateGroupParticipantAdmin -type UpdateGroupParticipantAdmin struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - IsAdmin bool `protobuf:"varint,3,opt,name=IsAdmin,proto3" json:"IsAdmin,omitempty"` -} - -func (x *UpdateGroupParticipantAdmin) Reset() { - *x = UpdateGroupParticipantAdmin{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateGroupParticipantAdmin) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateGroupParticipantAdmin) ProtoMessage() {} - -func (x *UpdateGroupParticipantAdmin) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[19] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateGroupParticipantAdmin.ProtoReflect.Descriptor instead. -func (*UpdateGroupParticipantAdmin) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{19} -} - -func (x *UpdateGroupParticipantAdmin) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateGroupParticipantAdmin) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateGroupParticipantAdmin) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *UpdateGroupParticipantAdmin) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateGroupParticipantAdmin) GetIsAdmin() bool { - if x != nil { - return x.IsAdmin - } - return false -} - -// UpdateGroupAdmins -type UpdateGroupAdmins struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - AdminEnabled bool `protobuf:"varint,2,opt,name=AdminEnabled,proto3" json:"AdminEnabled,omitempty"` -} - -func (x *UpdateGroupAdmins) Reset() { - *x = UpdateGroupAdmins{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateGroupAdmins) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateGroupAdmins) ProtoMessage() {} - -func (x *UpdateGroupAdmins) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateGroupAdmins.ProtoReflect.Descriptor instead. -func (*UpdateGroupAdmins) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{20} -} - -func (x *UpdateGroupAdmins) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateGroupAdmins) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateGroupAdmins) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *UpdateGroupAdmins) GetAdminEnabled() bool { - if x != nil { - return x.AdminEnabled - } - return false -} - -// UpdateGroupAdminOnly -type UpdateGroupAdminOnly struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - AdminOnly bool `protobuf:"varint,2,opt,name=AdminOnly,proto3" json:"AdminOnly,omitempty"` -} - -func (x *UpdateGroupAdminOnly) Reset() { - *x = UpdateGroupAdminOnly{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateGroupAdminOnly) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateGroupAdminOnly) ProtoMessage() {} - -func (x *UpdateGroupAdminOnly) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateGroupAdminOnly.ProtoReflect.Descriptor instead. -func (*UpdateGroupAdminOnly) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{21} -} - -func (x *UpdateGroupAdminOnly) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateGroupAdminOnly) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateGroupAdminOnly) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *UpdateGroupAdminOnly) GetAdminOnly() bool { - if x != nil { - return x.AdminOnly - } - return false -} - -// UpdateGroupPhoto -type UpdateGroupPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - GroupID int64 `protobuf:"varint,1,opt,name=GroupID,proto3" json:"GroupID,omitempty"` - Photo *GroupPhoto `protobuf:"bytes,2,opt,name=Photo,proto3" json:"Photo,omitempty"` - PhotoID int64 `protobuf:"varint,3,opt,name=PhotoID,proto3" json:"PhotoID,omitempty"` -} - -func (x *UpdateGroupPhoto) Reset() { - *x = UpdateGroupPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateGroupPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateGroupPhoto) ProtoMessage() {} - -func (x *UpdateGroupPhoto) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateGroupPhoto.ProtoReflect.Descriptor instead. -func (*UpdateGroupPhoto) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{22} -} - -func (x *UpdateGroupPhoto) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateGroupPhoto) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateGroupPhoto) GetGroupID() int64 { - if x != nil { - return x.GroupID - } - return 0 -} - -func (x *UpdateGroupPhoto) GetPhoto() *GroupPhoto { - if x != nil { - return x.Photo - } - return nil -} - -func (x *UpdateGroupPhoto) GetPhotoID() int64 { - if x != nil { - return x.PhotoID - } - return 0 -} - -// UpdateReadMessagesContents -type UpdateReadMessagesContents struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - MessageIDs []int64 `protobuf:"varint,1,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` - Peer *Peer `protobuf:"bytes,2,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *UpdateReadMessagesContents) Reset() { - *x = UpdateReadMessagesContents{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateReadMessagesContents) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateReadMessagesContents) ProtoMessage() {} - -func (x *UpdateReadMessagesContents) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateReadMessagesContents.ProtoReflect.Descriptor instead. -func (*UpdateReadMessagesContents) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{23} -} - -func (x *UpdateReadMessagesContents) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateReadMessagesContents) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateReadMessagesContents) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateReadMessagesContents) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -func (x *UpdateReadMessagesContents) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -// UpdateAuthorizationReset -type UpdateAuthorizationReset struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` -} - -func (x *UpdateAuthorizationReset) Reset() { - *x = UpdateAuthorizationReset{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateAuthorizationReset) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateAuthorizationReset) ProtoMessage() {} - -func (x *UpdateAuthorizationReset) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateAuthorizationReset.ProtoReflect.Descriptor instead. -func (*UpdateAuthorizationReset) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{24} -} - -func (x *UpdateAuthorizationReset) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateAuthorizationReset) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -// UpdateDraftMessage -type UpdateDraftMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Message *DraftMessage `protobuf:"bytes,1,opt,name=Message,proto3" json:"Message,omitempty"` -} - -func (x *UpdateDraftMessage) Reset() { - *x = UpdateDraftMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateDraftMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateDraftMessage) ProtoMessage() {} - -func (x *UpdateDraftMessage) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateDraftMessage.ProtoReflect.Descriptor instead. -func (*UpdateDraftMessage) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{25} -} - -func (x *UpdateDraftMessage) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateDraftMessage) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateDraftMessage) GetMessage() *DraftMessage { - if x != nil { - return x.Message - } - return nil -} - -// UpdateDraftMessageCleared -type UpdateDraftMessageCleared struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *UpdateDraftMessageCleared) Reset() { - *x = UpdateDraftMessageCleared{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateDraftMessageCleared) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateDraftMessageCleared) ProtoMessage() {} - -func (x *UpdateDraftMessageCleared) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateDraftMessageCleared.ProtoReflect.Descriptor instead. -func (*UpdateDraftMessageCleared) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{26} -} - -func (x *UpdateDraftMessageCleared) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateDraftMessageCleared) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateDraftMessageCleared) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateDraftMessageCleared) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -// UpdateDialogPinned -type UpdateDialogPinned struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - Pinned bool `protobuf:"varint,2,opt,name=Pinned,proto3" json:"Pinned,omitempty"` -} - -func (x *UpdateDialogPinned) Reset() { - *x = UpdateDialogPinned{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[27] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateDialogPinned) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateDialogPinned) ProtoMessage() {} - -func (x *UpdateDialogPinned) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[27] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateDialogPinned.ProtoReflect.Descriptor instead. -func (*UpdateDialogPinned) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{27} -} - -func (x *UpdateDialogPinned) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateDialogPinned) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateDialogPinned) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateDialogPinned) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdateDialogPinned) GetPinned() bool { - if x != nil { - return x.Pinned - } - return false -} - -// UpdateDialogPinnedOrder -type UpdateDialogPinnedReorder struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Peer []*Peer `protobuf:"bytes,1,rep,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *UpdateDialogPinnedReorder) Reset() { - *x = UpdateDialogPinnedReorder{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateDialogPinnedReorder) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateDialogPinnedReorder) ProtoMessage() {} - -func (x *UpdateDialogPinnedReorder) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateDialogPinnedReorder.ProtoReflect.Descriptor instead. -func (*UpdateDialogPinnedReorder) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{28} -} - -func (x *UpdateDialogPinnedReorder) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateDialogPinnedReorder) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateDialogPinnedReorder) GetPeer() []*Peer { - if x != nil { - return x.Peer - } - return nil -} - -// UpdateAccountPrivacy -type UpdateAccountPrivacy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - ChatInvite []*PrivacyRule `protobuf:"bytes,1,rep,name=ChatInvite,proto3" json:"ChatInvite,omitempty"` - LastSeen []*PrivacyRule `protobuf:"bytes,2,rep,name=LastSeen,proto3" json:"LastSeen,omitempty"` - PhoneNumber []*PrivacyRule `protobuf:"bytes,3,rep,name=PhoneNumber,proto3" json:"PhoneNumber,omitempty"` - ProfilePhoto []*PrivacyRule `protobuf:"bytes,4,rep,name=ProfilePhoto,proto3" json:"ProfilePhoto,omitempty"` - ForwardedMessage []*PrivacyRule `protobuf:"bytes,5,rep,name=ForwardedMessage,proto3" json:"ForwardedMessage,omitempty"` - Call []*PrivacyRule `protobuf:"bytes,6,rep,name=Call,proto3" json:"Call,omitempty"` -} - -func (x *UpdateAccountPrivacy) Reset() { - *x = UpdateAccountPrivacy{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[29] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateAccountPrivacy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateAccountPrivacy) ProtoMessage() {} - -func (x *UpdateAccountPrivacy) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[29] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateAccountPrivacy.ProtoReflect.Descriptor instead. -func (*UpdateAccountPrivacy) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{29} -} - -func (x *UpdateAccountPrivacy) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateAccountPrivacy) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateAccountPrivacy) GetChatInvite() []*PrivacyRule { - if x != nil { - return x.ChatInvite - } - return nil -} - -func (x *UpdateAccountPrivacy) GetLastSeen() []*PrivacyRule { - if x != nil { - return x.LastSeen - } - return nil -} - -func (x *UpdateAccountPrivacy) GetPhoneNumber() []*PrivacyRule { - if x != nil { - return x.PhoneNumber - } - return nil -} - -func (x *UpdateAccountPrivacy) GetProfilePhoto() []*PrivacyRule { - if x != nil { - return x.ProfilePhoto - } - return nil -} - -func (x *UpdateAccountPrivacy) GetForwardedMessage() []*PrivacyRule { - if x != nil { - return x.ForwardedMessage - } - return nil -} - -func (x *UpdateAccountPrivacy) GetCall() []*PrivacyRule { - if x != nil { - return x.Call - } - return nil -} - -// UpdateLabelItemAdded -type UpdateLabelItemsAdded struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageIDs []int64 `protobuf:"varint,3,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` - LabelIDs []int32 `protobuf:"varint,4,rep,packed,name=LabelIDs,proto3" json:"LabelIDs,omitempty"` - Labels []*Label `protobuf:"bytes,5,rep,name=Labels,proto3" json:"Labels,omitempty"` -} - -func (x *UpdateLabelItemsAdded) Reset() { - *x = UpdateLabelItemsAdded{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[30] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateLabelItemsAdded) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateLabelItemsAdded) ProtoMessage() {} - -func (x *UpdateLabelItemsAdded) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[30] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateLabelItemsAdded.ProtoReflect.Descriptor instead. -func (*UpdateLabelItemsAdded) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{30} -} - -func (x *UpdateLabelItemsAdded) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateLabelItemsAdded) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateLabelItemsAdded) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateLabelItemsAdded) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdateLabelItemsAdded) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -func (x *UpdateLabelItemsAdded) GetLabelIDs() []int32 { - if x != nil { - return x.LabelIDs - } - return nil -} - -func (x *UpdateLabelItemsAdded) GetLabels() []*Label { - if x != nil { - return x.Labels - } - return nil -} - -// UpdateLabelItemsRemoved -type UpdateLabelItemsRemoved struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageIDs []int64 `protobuf:"varint,3,rep,packed,name=MessageIDs,proto3" json:"MessageIDs,omitempty"` - LabelIDs []int32 `protobuf:"varint,4,rep,packed,name=LabelIDs,proto3" json:"LabelIDs,omitempty"` - Labels []*Label `protobuf:"bytes,5,rep,name=Labels,proto3" json:"Labels,omitempty"` -} - -func (x *UpdateLabelItemsRemoved) Reset() { - *x = UpdateLabelItemsRemoved{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[31] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateLabelItemsRemoved) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateLabelItemsRemoved) ProtoMessage() {} - -func (x *UpdateLabelItemsRemoved) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[31] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateLabelItemsRemoved.ProtoReflect.Descriptor instead. -func (*UpdateLabelItemsRemoved) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{31} -} - -func (x *UpdateLabelItemsRemoved) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateLabelItemsRemoved) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateLabelItemsRemoved) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateLabelItemsRemoved) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdateLabelItemsRemoved) GetMessageIDs() []int64 { - if x != nil { - return x.MessageIDs - } - return nil -} - -func (x *UpdateLabelItemsRemoved) GetLabelIDs() []int32 { - if x != nil { - return x.LabelIDs - } - return nil -} - -func (x *UpdateLabelItemsRemoved) GetLabels() []*Label { - if x != nil { - return x.Labels - } - return nil -} - -// UpdateLabelSet -type UpdateLabelSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Labels []*Label `protobuf:"bytes,1,rep,name=Labels,proto3" json:"Labels,omitempty"` -} - -func (x *UpdateLabelSet) Reset() { - *x = UpdateLabelSet{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[32] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateLabelSet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateLabelSet) ProtoMessage() {} - -func (x *UpdateLabelSet) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[32] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateLabelSet.ProtoReflect.Descriptor instead. -func (*UpdateLabelSet) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{32} -} - -func (x *UpdateLabelSet) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateLabelSet) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateLabelSet) GetLabels() []*Label { - if x != nil { - return x.Labels - } - return nil -} - -// UpdateLabelDeleted -type UpdateLabelDeleted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - LabelIDs []int32 `protobuf:"varint,1,rep,packed,name=LabelIDs,proto3" json:"LabelIDs,omitempty"` -} - -func (x *UpdateLabelDeleted) Reset() { - *x = UpdateLabelDeleted{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[33] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateLabelDeleted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateLabelDeleted) ProtoMessage() {} - -func (x *UpdateLabelDeleted) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[33] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateLabelDeleted.ProtoReflect.Descriptor instead. -func (*UpdateLabelDeleted) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{33} -} - -func (x *UpdateLabelDeleted) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateLabelDeleted) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateLabelDeleted) GetLabelIDs() []int32 { - if x != nil { - return x.LabelIDs - } - return nil -} - -// UpdateUserBlocked -type UpdateUserBlocked struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - UserID int64 `protobuf:"varint,1,opt,name=UserID,proto3" json:"UserID,omitempty"` - Blocked bool `protobuf:"varint,2,opt,name=Blocked,proto3" json:"Blocked,omitempty"` -} - -func (x *UpdateUserBlocked) Reset() { - *x = UpdateUserBlocked{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[34] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateUserBlocked) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateUserBlocked) ProtoMessage() {} - -func (x *UpdateUserBlocked) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[34] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateUserBlocked.ProtoReflect.Descriptor instead. -func (*UpdateUserBlocked) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{34} -} - -func (x *UpdateUserBlocked) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateUserBlocked) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateUserBlocked) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateUserBlocked) GetBlocked() bool { - if x != nil { - return x.Blocked - } - return false -} - -// UpdateMessagePoll -type UpdateMessagePoll struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - PollID int64 `protobuf:"varint,1,opt,name=PollID,proto3" json:"PollID,omitempty"` - Poll *MediaPoll `protobuf:"bytes,2,opt,name=Poll,proto3" json:"Poll,omitempty"` - Results *PollResults `protobuf:"bytes,3,opt,name=Results,proto3" json:"Results,omitempty"` -} - -func (x *UpdateMessagePoll) Reset() { - *x = UpdateMessagePoll{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[35] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateMessagePoll) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateMessagePoll) ProtoMessage() {} - -func (x *UpdateMessagePoll) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[35] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateMessagePoll.ProtoReflect.Descriptor instead. -func (*UpdateMessagePoll) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{35} -} - -func (x *UpdateMessagePoll) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateMessagePoll) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateMessagePoll) GetPollID() int64 { - if x != nil { - return x.PollID - } - return 0 -} - -func (x *UpdateMessagePoll) GetPoll() *MediaPoll { - if x != nil { - return x.Poll - } - return nil -} - -func (x *UpdateMessagePoll) GetResults() *PollResults { - if x != nil { - return x.Results - } - return nil -} - -// UpdateBotCallbackQuery -type UpdateBotCallbackQuery struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - QueryID int64 `protobuf:"varint,1,opt,name=QueryID,proto3" json:"QueryID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - Peer *Peer `protobuf:"bytes,3,opt,name=Peer,proto3" json:"Peer,omitempty"` - MessageID int64 `protobuf:"varint,4,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Data []byte `protobuf:"bytes,5,opt,name=Data,proto3" json:"Data,omitempty"` - TeamID int64 `protobuf:"varint,6,opt,name=TeamID,proto3" json:"TeamID,omitempty"` -} - -func (x *UpdateBotCallbackQuery) Reset() { - *x = UpdateBotCallbackQuery{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[36] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateBotCallbackQuery) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateBotCallbackQuery) ProtoMessage() {} - -func (x *UpdateBotCallbackQuery) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[36] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateBotCallbackQuery.ProtoReflect.Descriptor instead. -func (*UpdateBotCallbackQuery) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{36} -} - -func (x *UpdateBotCallbackQuery) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateBotCallbackQuery) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateBotCallbackQuery) GetQueryID() int64 { - if x != nil { - return x.QueryID - } - return 0 -} - -func (x *UpdateBotCallbackQuery) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateBotCallbackQuery) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdateBotCallbackQuery) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *UpdateBotCallbackQuery) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *UpdateBotCallbackQuery) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -// UpdateBotInlineQuery -type UpdateBotInlineQuery struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - QueryID int64 `protobuf:"varint,1,opt,name=QueryID,proto3" json:"QueryID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - Peer *Peer `protobuf:"bytes,3,opt,name=Peer,proto3" json:"Peer,omitempty"` - Query string `protobuf:"bytes,4,opt,name=Query,proto3" json:"Query,omitempty"` - Offset string `protobuf:"bytes,5,opt,name=Offset,proto3" json:"Offset,omitempty"` - Geo *GeoLocation `protobuf:"bytes,6,opt,name=Geo,proto3" json:"Geo,omitempty"` - TeamID int64 `protobuf:"varint,7,opt,name=TeamID,proto3" json:"TeamID,omitempty"` -} - -func (x *UpdateBotInlineQuery) Reset() { - *x = UpdateBotInlineQuery{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[37] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateBotInlineQuery) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateBotInlineQuery) ProtoMessage() {} - -func (x *UpdateBotInlineQuery) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[37] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateBotInlineQuery.ProtoReflect.Descriptor instead. -func (*UpdateBotInlineQuery) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{37} -} - -func (x *UpdateBotInlineQuery) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateBotInlineQuery) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateBotInlineQuery) GetQueryID() int64 { - if x != nil { - return x.QueryID - } - return 0 -} - -func (x *UpdateBotInlineQuery) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateBotInlineQuery) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdateBotInlineQuery) GetQuery() string { - if x != nil { - return x.Query - } - return "" -} - -func (x *UpdateBotInlineQuery) GetOffset() string { - if x != nil { - return x.Offset - } - return "" -} - -func (x *UpdateBotInlineQuery) GetGeo() *GeoLocation { - if x != nil { - return x.Geo - } - return nil -} - -func (x *UpdateBotInlineQuery) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -// UpdateBotInlineSend -type UpdateBotInlineSend struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - Query string `protobuf:"bytes,3,opt,name=Query,proto3" json:"Query,omitempty"` - ResultID string `protobuf:"bytes,4,opt,name=ResultID,proto3" json:"ResultID,omitempty"` - Geo *GeoLocation `protobuf:"bytes,5,opt,name=Geo,proto3" json:"Geo,omitempty"` -} - -func (x *UpdateBotInlineSend) Reset() { - *x = UpdateBotInlineSend{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[38] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateBotInlineSend) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateBotInlineSend) ProtoMessage() {} - -func (x *UpdateBotInlineSend) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[38] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateBotInlineSend.ProtoReflect.Descriptor instead. -func (*UpdateBotInlineSend) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{38} -} - -func (x *UpdateBotInlineSend) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateBotInlineSend) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateBotInlineSend) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateBotInlineSend) GetQuery() string { - if x != nil { - return x.Query - } - return "" -} - -func (x *UpdateBotInlineSend) GetResultID() string { - if x != nil { - return x.ResultID - } - return "" -} - -func (x *UpdateBotInlineSend) GetGeo() *GeoLocation { - if x != nil { - return x.Geo - } - return nil -} - -// UpdateTeamCreated -type UpdateTeamCreated struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Team *Team `protobuf:"bytes,1,opt,name=Team,proto3" json:"Team,omitempty"` -} - -func (x *UpdateTeamCreated) Reset() { - *x = UpdateTeamCreated{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[39] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateTeamCreated) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateTeamCreated) ProtoMessage() {} - -func (x *UpdateTeamCreated) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[39] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateTeamCreated.ProtoReflect.Descriptor instead. -func (*UpdateTeamCreated) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{39} -} - -func (x *UpdateTeamCreated) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateTeamCreated) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateTeamCreated) GetTeam() *Team { - if x != nil { - return x.Team - } - return nil -} - -// UpdateTeamMemberAdded -type UpdateTeamMemberAdded struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - User *User `protobuf:"bytes,2,opt,name=User,proto3" json:"User,omitempty"` - Contact *ContactUser `protobuf:"bytes,3,opt,name=Contact,proto3" json:"Contact,omitempty"` - AdderID int64 `protobuf:"varint,4,opt,name=AdderID,proto3" json:"AdderID,omitempty"` - Hash uint32 `protobuf:"fixed32,5,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *UpdateTeamMemberAdded) Reset() { - *x = UpdateTeamMemberAdded{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[40] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateTeamMemberAdded) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateTeamMemberAdded) ProtoMessage() {} - -func (x *UpdateTeamMemberAdded) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[40] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateTeamMemberAdded.ProtoReflect.Descriptor instead. -func (*UpdateTeamMemberAdded) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{40} -} - -func (x *UpdateTeamMemberAdded) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateTeamMemberAdded) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateTeamMemberAdded) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateTeamMemberAdded) GetUser() *User { - if x != nil { - return x.User - } - return nil -} - -func (x *UpdateTeamMemberAdded) GetContact() *ContactUser { - if x != nil { - return x.Contact - } - return nil -} - -func (x *UpdateTeamMemberAdded) GetAdderID() int64 { - if x != nil { - return x.AdderID - } - return 0 -} - -func (x *UpdateTeamMemberAdded) GetHash() uint32 { - if x != nil { - return x.Hash - } - return 0 -} - -// UpdateTeamMemberRemoved -type UpdateTeamMemberRemoved struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - UserID int64 `protobuf:"varint,2,opt,name=UserID,proto3" json:"UserID,omitempty"` - RemoverID int64 `protobuf:"varint,3,opt,name=RemoverID,proto3" json:"RemoverID,omitempty"` - Hash uint32 `protobuf:"fixed32,4,opt,name=Hash,proto3" json:"Hash,omitempty"` -} - -func (x *UpdateTeamMemberRemoved) Reset() { - *x = UpdateTeamMemberRemoved{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[41] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateTeamMemberRemoved) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateTeamMemberRemoved) ProtoMessage() {} - -func (x *UpdateTeamMemberRemoved) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[41] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateTeamMemberRemoved.ProtoReflect.Descriptor instead. -func (*UpdateTeamMemberRemoved) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{41} -} - -func (x *UpdateTeamMemberRemoved) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateTeamMemberRemoved) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateTeamMemberRemoved) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateTeamMemberRemoved) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdateTeamMemberRemoved) GetRemoverID() int64 { - if x != nil { - return x.RemoverID - } - return 0 -} - -func (x *UpdateTeamMemberRemoved) GetHash() uint32 { - if x != nil { - return x.Hash - } - return 0 -} - -// UpdateTeamMemberStatus -type UpdateTeamMemberStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - ChangerID int64 `protobuf:"varint,3,opt,name=ChangerID,proto3" json:"ChangerID,omitempty"` - Admin bool `protobuf:"varint,4,opt,name=Admin,proto3" json:"Admin,omitempty"` -} - -func (x *UpdateTeamMemberStatus) Reset() { - *x = UpdateTeamMemberStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[42] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateTeamMemberStatus) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateTeamMemberStatus) ProtoMessage() {} - -func (x *UpdateTeamMemberStatus) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[42] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateTeamMemberStatus.ProtoReflect.Descriptor instead. -func (*UpdateTeamMemberStatus) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{42} -} - -func (x *UpdateTeamMemberStatus) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateTeamMemberStatus) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateTeamMemberStatus) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateTeamMemberStatus) GetChangerID() int64 { - if x != nil { - return x.ChangerID - } - return 0 -} - -func (x *UpdateTeamMemberStatus) GetAdmin() bool { - if x != nil { - return x.Admin - } - return false -} - -// UpdateTeamPhoto -type UpdateTeamPhoto struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Photo *TeamPhoto `protobuf:"bytes,2,opt,name=Photo,proto3" json:"Photo,omitempty"` -} - -func (x *UpdateTeamPhoto) Reset() { - *x = UpdateTeamPhoto{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[43] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateTeamPhoto) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateTeamPhoto) ProtoMessage() {} - -func (x *UpdateTeamPhoto) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[43] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateTeamPhoto.ProtoReflect.Descriptor instead. -func (*UpdateTeamPhoto) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{43} -} - -func (x *UpdateTeamPhoto) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateTeamPhoto) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateTeamPhoto) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateTeamPhoto) GetPhoto() *TeamPhoto { - if x != nil { - return x.Photo - } - return nil -} - -// UpdateTeam -type UpdateTeam struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"` -} - -func (x *UpdateTeam) Reset() { - *x = UpdateTeam{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[44] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateTeam) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateTeam) ProtoMessage() {} - -func (x *UpdateTeam) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[44] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateTeam.ProtoReflect.Descriptor instead. -func (*UpdateTeam) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{44} -} - -func (x *UpdateTeam) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateTeam) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateTeam) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateTeam) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// UpdateCommunityMessage -type UpdateCommunityMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,100,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - SenderID int64 `protobuf:"varint,1,opt,name=SenderID,proto3" json:"SenderID,omitempty"` - ReceiverID int64 `protobuf:"varint,2,opt,name=ReceiverID,proto3" json:"ReceiverID,omitempty"` - Body string `protobuf:"bytes,3,opt,name=Body,proto3" json:"Body,omitempty"` - CreatedOn int64 `protobuf:"varint,4,opt,name=CreatedOn,proto3" json:"CreatedOn,omitempty"` - GlobalMsgID uint64 `protobuf:"varint,5,opt,name=GlobalMsgID,proto3" json:"GlobalMsgID,omitempty"` - Entities []*MessageEntity `protobuf:"bytes,6,rep,name=Entities,proto3" json:"Entities,omitempty"` - SenderMsgID int64 `protobuf:"varint,7,opt,name=SenderMsgID,proto3" json:"SenderMsgID,omitempty"` -} - -func (x *UpdateCommunityMessage) Reset() { - *x = UpdateCommunityMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[45] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateCommunityMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateCommunityMessage) ProtoMessage() {} - -func (x *UpdateCommunityMessage) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[45] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateCommunityMessage.ProtoReflect.Descriptor instead. -func (*UpdateCommunityMessage) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{45} -} - -func (x *UpdateCommunityMessage) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateCommunityMessage) GetSenderID() int64 { - if x != nil { - return x.SenderID - } - return 0 -} - -func (x *UpdateCommunityMessage) GetReceiverID() int64 { - if x != nil { - return x.ReceiverID - } - return 0 -} - -func (x *UpdateCommunityMessage) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -func (x *UpdateCommunityMessage) GetCreatedOn() int64 { - if x != nil { - return x.CreatedOn - } - return 0 -} - -func (x *UpdateCommunityMessage) GetGlobalMsgID() uint64 { - if x != nil { - return x.GlobalMsgID - } - return 0 -} - -func (x *UpdateCommunityMessage) GetEntities() []*MessageEntity { - if x != nil { - return x.Entities - } - return nil -} - -func (x *UpdateCommunityMessage) GetSenderMsgID() int64 { - if x != nil { - return x.SenderMsgID - } - return 0 -} - -// UpdateCommunityReadOutbox -type UpdateCommunityReadOutbox struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,100,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - SenderID int64 `protobuf:"varint,1,opt,name=SenderID,proto3" json:"SenderID,omitempty"` - ReceiverID int64 `protobuf:"varint,2,opt,name=ReceiverID,proto3" json:"ReceiverID,omitempty"` - SenderMsgID int64 `protobuf:"varint,3,opt,name=SenderMsgID,proto3" json:"SenderMsgID,omitempty"` -} - -func (x *UpdateCommunityReadOutbox) Reset() { - *x = UpdateCommunityReadOutbox{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[46] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateCommunityReadOutbox) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateCommunityReadOutbox) ProtoMessage() {} - -func (x *UpdateCommunityReadOutbox) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[46] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateCommunityReadOutbox.ProtoReflect.Descriptor instead. -func (*UpdateCommunityReadOutbox) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{46} -} - -func (x *UpdateCommunityReadOutbox) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateCommunityReadOutbox) GetSenderID() int64 { - if x != nil { - return x.SenderID - } - return 0 -} - -func (x *UpdateCommunityReadOutbox) GetReceiverID() int64 { - if x != nil { - return x.ReceiverID - } - return 0 -} - -func (x *UpdateCommunityReadOutbox) GetSenderMsgID() int64 { - if x != nil { - return x.SenderMsgID - } - return 0 -} - -// UpdateCommunityTyping -type UpdateCommunityTyping struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TeamID int64 `protobuf:"varint,100,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - SenderID int64 `protobuf:"varint,1,opt,name=SenderID,proto3" json:"SenderID,omitempty"` - ReceiverID int64 `protobuf:"varint,2,opt,name=ReceiverID,proto3" json:"ReceiverID,omitempty"` - Action TypingAction `protobuf:"varint,3,opt,name=Action,proto3,enum=msg.TypingAction" json:"Action,omitempty"` -} - -func (x *UpdateCommunityTyping) Reset() { - *x = UpdateCommunityTyping{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[47] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateCommunityTyping) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateCommunityTyping) ProtoMessage() {} - -func (x *UpdateCommunityTyping) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[47] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateCommunityTyping.ProtoReflect.Descriptor instead. -func (*UpdateCommunityTyping) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{47} -} - -func (x *UpdateCommunityTyping) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateCommunityTyping) GetSenderID() int64 { - if x != nil { - return x.SenderID - } - return 0 -} - -func (x *UpdateCommunityTyping) GetReceiverID() int64 { - if x != nil { - return x.ReceiverID - } - return 0 -} - -func (x *UpdateCommunityTyping) GetAction() TypingAction { - if x != nil { - return x.Action - } - return TypingAction_TypingActionTyping -} - -// UpdateReaction -type UpdateReaction struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - MessageID int64 `protobuf:"varint,1,opt,name=MessageID,proto3" json:"MessageID,omitempty"` - Counter []*ReactionCounter `protobuf:"bytes,2,rep,name=Counter,proto3" json:"Counter,omitempty"` - TeamID int64 `protobuf:"varint,3,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,4,opt,name=Peer,proto3" json:"Peer,omitempty"` - Sender *User `protobuf:"bytes,5,opt,name=Sender,proto3" json:"Sender,omitempty"` - YourReactions []string `protobuf:"bytes,6,rep,name=YourReactions,proto3" json:"YourReactions,omitempty"` - Reaction string `protobuf:"bytes,7,opt,name=Reaction,proto3" json:"Reaction,omitempty"` -} - -func (x *UpdateReaction) Reset() { - *x = UpdateReaction{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[48] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateReaction) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateReaction) ProtoMessage() {} - -func (x *UpdateReaction) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[48] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateReaction.ProtoReflect.Descriptor instead. -func (*UpdateReaction) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{48} -} - -func (x *UpdateReaction) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateReaction) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateReaction) GetMessageID() int64 { - if x != nil { - return x.MessageID - } - return 0 -} - -func (x *UpdateReaction) GetCounter() []*ReactionCounter { - if x != nil { - return x.Counter - } - return nil -} - -func (x *UpdateReaction) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdateReaction) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdateReaction) GetSender() *User { - if x != nil { - return x.Sender - } - return nil -} - -func (x *UpdateReaction) GetYourReactions() []string { - if x != nil { - return x.YourReactions - } - return nil -} - -func (x *UpdateReaction) GetReaction() string { - if x != nil { - return x.Reaction - } - return "" -} - -// UpdateCalendarEventAdded -type UpdateCalendarEventAdded struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Event *CalendarEvent `protobuf:"bytes,1,opt,name=Event,proto3" json:"Event,omitempty"` -} - -func (x *UpdateCalendarEventAdded) Reset() { - *x = UpdateCalendarEventAdded{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[49] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateCalendarEventAdded) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateCalendarEventAdded) ProtoMessage() {} - -func (x *UpdateCalendarEventAdded) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[49] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateCalendarEventAdded.ProtoReflect.Descriptor instead. -func (*UpdateCalendarEventAdded) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{49} -} - -func (x *UpdateCalendarEventAdded) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateCalendarEventAdded) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateCalendarEventAdded) GetEvent() *CalendarEvent { - if x != nil { - return x.Event - } - return nil -} - -// UpdateCalendarEventRemoved -type UpdateCalendarEventRemoved struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - EventID int64 `protobuf:"varint,102,opt,name=EventID,proto3" json:"EventID,omitempty"` -} - -func (x *UpdateCalendarEventRemoved) Reset() { - *x = UpdateCalendarEventRemoved{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[50] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateCalendarEventRemoved) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateCalendarEventRemoved) ProtoMessage() {} - -func (x *UpdateCalendarEventRemoved) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[50] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateCalendarEventRemoved.ProtoReflect.Descriptor instead. -func (*UpdateCalendarEventRemoved) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{50} -} - -func (x *UpdateCalendarEventRemoved) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateCalendarEventRemoved) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateCalendarEventRemoved) GetEventID() int64 { - if x != nil { - return x.EventID - } - return 0 -} - -// UpdateCalendarEventEdited -type UpdateCalendarEventEdited struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Event *CalendarEvent `protobuf:"bytes,1,opt,name=Event,proto3" json:"Event,omitempty"` -} - -func (x *UpdateCalendarEventEdited) Reset() { - *x = UpdateCalendarEventEdited{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[51] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateCalendarEventEdited) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateCalendarEventEdited) ProtoMessage() {} - -func (x *UpdateCalendarEventEdited) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[51] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateCalendarEventEdited.ProtoReflect.Descriptor instead. -func (*UpdateCalendarEventEdited) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{51} -} - -func (x *UpdateCalendarEventEdited) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateCalendarEventEdited) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateCalendarEventEdited) GetEvent() *CalendarEvent { - if x != nil { - return x.Event - } - return nil -} - -// UpdateRedirect -type UpdateRedirect struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - Redirects []*ClientRedirect `protobuf:"bytes,1,rep,name=Redirects,proto3" json:"Redirects,omitempty"` - Empty bool `protobuf:"varint,2,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *UpdateRedirect) Reset() { - *x = UpdateRedirect{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[52] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdateRedirect) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdateRedirect) ProtoMessage() {} - -func (x *UpdateRedirect) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[52] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdateRedirect.ProtoReflect.Descriptor instead. -func (*UpdateRedirect) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{52} -} - -func (x *UpdateRedirect) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdateRedirect) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdateRedirect) GetRedirects() []*ClientRedirect { - if x != nil { - return x.Redirects - } - return nil -} - -func (x *UpdateRedirect) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -// ClientRedirect -type ClientRedirect struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - HostPort string `protobuf:"bytes,1,opt,name=HostPort,proto3" json:"HostPort,omitempty"` - Permanent bool `protobuf:"varint,2,opt,name=Permanent,proto3" json:"Permanent,omitempty"` - Target RedirectTarget `protobuf:"varint,3,opt,name=Target,proto3,enum=msg.RedirectTarget" json:"Target,omitempty"` - Alternatives []string `protobuf:"bytes,4,rep,name=Alternatives,proto3" json:"Alternatives,omitempty"` -} - -func (x *ClientRedirect) Reset() { - *x = ClientRedirect{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[53] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientRedirect) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientRedirect) ProtoMessage() {} - -func (x *ClientRedirect) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[53] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ClientRedirect.ProtoReflect.Descriptor instead. -func (*ClientRedirect) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{53} -} - -func (x *ClientRedirect) GetHostPort() string { - if x != nil { - return x.HostPort - } - return "" -} - -func (x *ClientRedirect) GetPermanent() bool { - if x != nil { - return x.Permanent - } - return false -} - -func (x *ClientRedirect) GetTarget() RedirectTarget { - if x != nil { - return x.Target - } - return RedirectTarget_RedirectTargetRpc -} - -func (x *ClientRedirect) GetAlternatives() []string { - if x != nil { - return x.Alternatives - } - return nil -} - -// UpdatePhone -type UpdatePhoneCall struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - TeamID int64 `protobuf:"varint,1,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - PeerID int64 `protobuf:"varint,2,opt,name=PeerID,proto3" json:"PeerID,omitempty"` - PeerType int32 `protobuf:"varint,3,opt,name=PeerType,proto3" json:"PeerType,omitempty"` - CallID int64 `protobuf:"varint,4,opt,name=CallID,proto3" json:"CallID,omitempty"` - UserID int64 `protobuf:"varint,5,opt,name=UserID,proto3" json:"UserID,omitempty"` - AccessHash uint64 `protobuf:"fixed64,6,opt,name=AccessHash,proto3" json:"AccessHash,omitempty"` - Action PhoneCallAction `protobuf:"varint,7,opt,name=Action,proto3,enum=msg.PhoneCallAction" json:"Action,omitempty"` - ActionData []byte `protobuf:"bytes,8,opt,name=ActionData,proto3" json:"ActionData,omitempty"` - Timestamp int64 `protobuf:"varint,9,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"` -} - -func (x *UpdatePhoneCall) Reset() { - *x = UpdatePhoneCall{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[54] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdatePhoneCall) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdatePhoneCall) ProtoMessage() {} - -func (x *UpdatePhoneCall) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[54] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdatePhoneCall.ProtoReflect.Descriptor instead. -func (*UpdatePhoneCall) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{54} -} - -func (x *UpdatePhoneCall) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdatePhoneCall) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdatePhoneCall) GetPeerID() int64 { - if x != nil { - return x.PeerID - } - return 0 -} - -func (x *UpdatePhoneCall) GetPeerType() int32 { - if x != nil { - return x.PeerType - } - return 0 -} - -func (x *UpdatePhoneCall) GetCallID() int64 { - if x != nil { - return x.CallID - } - return 0 -} - -func (x *UpdatePhoneCall) GetUserID() int64 { - if x != nil { - return x.UserID - } - return 0 -} - -func (x *UpdatePhoneCall) GetAccessHash() uint64 { - if x != nil { - return x.AccessHash - } - return 0 -} - -func (x *UpdatePhoneCall) GetAction() PhoneCallAction { - if x != nil { - return x.Action - } - return PhoneCallAction_PhoneCallEmpty -} - -func (x *UpdatePhoneCall) GetActionData() []byte { - if x != nil { - return x.ActionData - } - return nil -} - -func (x *UpdatePhoneCall) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -// UpdatePhoneCallStarted -type UpdatePhoneCallStarted struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` - CallId int64 `protobuf:"varint,2,opt,name=CallId,proto3" json:"CallId,omitempty"` -} - -func (x *UpdatePhoneCallStarted) Reset() { - *x = UpdatePhoneCallStarted{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[55] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdatePhoneCallStarted) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdatePhoneCallStarted) ProtoMessage() {} - -func (x *UpdatePhoneCallStarted) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[55] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdatePhoneCallStarted.ProtoReflect.Descriptor instead. -func (*UpdatePhoneCallStarted) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{55} -} - -func (x *UpdatePhoneCallStarted) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdatePhoneCallStarted) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdatePhoneCallStarted) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdatePhoneCallStarted) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -func (x *UpdatePhoneCallStarted) GetCallId() int64 { - if x != nil { - return x.CallId - } - return 0 -} - -// UpdatePhoneCallEnded -type UpdatePhoneCallEnded struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - UCount int32 `protobuf:"varint,100,opt,name=UCount,proto3" json:"UCount,omitempty"` - UpdateID int64 `protobuf:"varint,101,opt,name=UpdateID,proto3" json:"UpdateID,omitempty"` - TeamID int64 `protobuf:"varint,102,opt,name=TeamID,proto3" json:"TeamID,omitempty"` - Peer *Peer `protobuf:"bytes,1,opt,name=Peer,proto3" json:"Peer,omitempty"` -} - -func (x *UpdatePhoneCallEnded) Reset() { - *x = UpdatePhoneCallEnded{} - if protoimpl.UnsafeEnabled { - mi := &file_updates_proto_msgTypes[56] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UpdatePhoneCallEnded) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UpdatePhoneCallEnded) ProtoMessage() {} - -func (x *UpdatePhoneCallEnded) ProtoReflect() protoreflect.Message { - mi := &file_updates_proto_msgTypes[56] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UpdatePhoneCallEnded.ProtoReflect.Descriptor instead. -func (*UpdatePhoneCallEnded) Descriptor() ([]byte, []int) { - return file_updates_proto_rawDescGZIP(), []int{56} -} - -func (x *UpdatePhoneCallEnded) GetUCount() int32 { - if x != nil { - return x.UCount - } - return 0 -} - -func (x *UpdatePhoneCallEnded) GetUpdateID() int64 { - if x != nil { - return x.UpdateID - } - return 0 -} - -func (x *UpdatePhoneCallEnded) GetTeamID() int64 { - if x != nil { - return x.TeamID - } - return 0 -} - -func (x *UpdatePhoneCallEnded) GetPeer() *Peer { - if x != nil { - return x.Peer - } - return nil -} - -var File_updates_proto protoreflect.FileDescriptor - -var file_updates_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x03, 0x6d, 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0e, 0x63, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x10, 0x63, 0x68, 0x61, 0x74, 0x2e, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x65, - 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x3f, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x47, 0x65, 0x74, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x46, 0x72, 0x6f, - 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x88, 0x02, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x4d, 0x6f, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x4d, 0x6f, 0x72, 0x65, - 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x61, 0x78, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x4d, 0x61, 0x78, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x4d, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x4d, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x12, 0x2d, 0x0a, 0x07, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x07, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, - 0x73, 0x65, 0x72, 0x73, 0x12, 0x22, 0x0a, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x06, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x52, 0x06, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x43, 0x75, 0x72, 0x72, - 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0f, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x49, 0x44, 0x22, 0x0f, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x6f, 0x4c, - 0x6f, 0x6e, 0x67, 0x22, 0x29, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x22, 0x63, - 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, - 0x44, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, - 0x6d, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x64, 0x6f, - 0x6d, 0x49, 0x44, 0x22, 0xdb, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x65, - 0x77, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x07, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, - 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x21, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0a, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x06, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, - 0x20, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x65, 0x66, 0x49, 0x44, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x65, 0x66, 0x49, - 0x44, 0x22, 0x75, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x45, 0x64, 0x69, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x2a, 0x0a, 0x07, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, - 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, - 0x18, 0x66, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, - 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, - 0x44, 0x73, 0x12, 0x1d, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x22, 0x9d, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x64, - 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x16, 0x0a, 0x06, - 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, - 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, - 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x66, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x4d, - 0x61, 0x78, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, 0x49, - 0x44, 0x22, 0xb6, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x64, - 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x78, 0x12, 0x16, 0x0a, - 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x66, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1d, 0x0a, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, - 0x4d, 0x61, 0x78, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x61, 0x78, - 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x22, 0xd0, 0x01, 0x0a, 0x13, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x69, 0x6e, 0x6e, - 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, - 0x18, 0x66, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, - 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, - 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, - 0x05, 0x4d, 0x73, 0x67, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x4d, 0x73, - 0x67, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xc5, 0x01, - 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x54, 0x79, 0x70, 0x69, - 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, - 0x61, 0x6d, 0x49, 0x44, 0x18, 0x66, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, - 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, - 0x49, 0x44, 0x12, 0x29, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, - 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, - 0x01, 0x52, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x65, 0x65, - 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x50, 0x65, 0x65, - 0x72, 0x54, 0x79, 0x70, 0x65, 0x22, 0x5e, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, - 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x16, 0x0a, - 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xde, 0x01, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x55, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, - 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x46, 0x69, 0x72, 0x73, 0x74, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4c, 0x61, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x42, 0x69, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x42, 0x69, 0x6f, - 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0xd3, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x55, 0x73, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, - 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, - 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x24, 0x0a, 0x05, 0x50, 0x68, - 0x6f, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x55, 0x73, 0x65, 0x72, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, - 0x12, 0x1c, 0x0a, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x12, 0x2c, - 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0f, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x64, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x73, 0x22, 0xe2, 0x01, 0x0a, - 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x53, 0x65, 0x74, - 0x74, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, - 0x6d, 0x49, 0x44, 0x18, 0x66, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, - 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, - 0x44, 0x12, 0x29, 0x0a, 0x0a, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x50, 0x65, 0x65, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, - 0x52, 0x0a, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x50, 0x65, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x08, - 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x53, - 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, 0x73, 0x52, 0x08, 0x53, 0x65, 0x74, 0x74, 0x69, 0x6e, 0x67, - 0x73, 0x22, 0xbf, 0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, - 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x20, 0x0a, - 0x09, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x09, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, - 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x44, - 0x61, 0x74, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, - 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, - 0x72, 0x49, 0x44, 0x22, 0xa5, 0x01, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x41, 0x64, - 0x6d, 0x69, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, - 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, - 0x44, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x07, 0x49, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x89, 0x01, 0x0a, 0x11, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x73, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x6e, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x86, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, - 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4f, 0x6e, 0x6c, 0x79, - 0x22, 0xa9, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x47, 0x72, 0x6f, 0x75, 0x70, - 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x07, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, - 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x44, 0x12, 0x25, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x72, 0x6f, - 0x75, 0x70, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x1c, - 0x0a, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x07, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x49, 0x44, 0x22, 0xab, 0x01, 0x0a, - 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x55, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, - 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, - 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x66, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, - 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x12, 0x1d, 0x0a, 0x04, 0x50, - 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x22, 0x4e, 0x0a, 0x18, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, - 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x22, 0x75, 0x0a, 0x12, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x44, 0x72, 0x61, 0x66, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x12, 0x2b, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x44, 0x72, 0x61, 0x66, - 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x72, 0x61, 0x66, - 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x65, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x66, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, - 0x1d, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x22, 0x9b, - 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x50, - 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, - 0x6d, 0x49, 0x44, 0x18, 0x66, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, - 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x22, 0x6e, 0x0a, 0x19, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x69, 0x61, 0x6c, 0x6f, 0x67, 0x50, 0x69, 0x6e, 0x6e, - 0x65, 0x64, 0x52, 0x65, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1d, 0x0a, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x22, 0xf8, 0x02, 0x0a, - 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x72, - 0x69, 0x76, 0x61, 0x63, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x30, 0x0a, 0x0a, 0x43, 0x68, 0x61, - 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, - 0x0a, 0x43, 0x68, 0x61, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x08, 0x4c, - 0x61, 0x73, 0x74, 0x53, 0x65, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, - 0x08, 0x4c, 0x61, 0x73, 0x74, 0x53, 0x65, 0x65, 0x6e, 0x12, 0x32, 0x0a, 0x0b, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, - 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, - 0x52, 0x0b, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x34, 0x0a, - 0x0c, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x04, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, - 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0c, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x50, 0x68, - 0x6f, 0x74, 0x6f, 0x12, 0x3c, 0x0a, 0x10, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x64, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x52, - 0x10, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x12, 0x24, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x63, 0x79, 0x52, 0x75, 0x6c, - 0x65, 0x52, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x22, 0xe6, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x41, 0x64, 0x64, 0x65, - 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, - 0x66, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, - 0x44, 0x12, 0x1d, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x12, 0x1e, 0x0a, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, - 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x05, 0x52, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x12, 0x22, 0x0a, 0x06, - 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, - 0x73, 0x67, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x06, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x22, 0xe8, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, - 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, - 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, - 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x66, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, - 0x0a, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x12, 0x22, 0x0a, 0x06, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x52, 0x06, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x22, 0x68, 0x0a, 0x0e, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x53, 0x65, 0x74, 0x12, 0x16, 0x0a, - 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x12, 0x22, 0x0a, 0x06, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0a, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x06, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x73, 0x22, 0x64, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, - 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, - 0x1a, 0x0a, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x05, 0x52, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x49, 0x44, 0x73, 0x22, 0x7d, 0x0a, 0x11, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x55, 0x73, 0x65, 0x72, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, - 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, - 0x12, 0x18, 0x0a, 0x07, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x07, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x22, 0xaf, 0x01, 0x0a, 0x11, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x50, 0x6f, 0x6c, 0x6c, - 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x50, 0x6f, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x04, - 0x50, 0x6f, 0x6c, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x50, 0x6f, 0x6c, 0x6c, 0x52, 0x04, 0x50, 0x6f, 0x6c, 0x6c, - 0x12, 0x2a, 0x0a, 0x07, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x6f, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x73, 0x52, 0x07, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0xe7, 0x01, 0x0a, - 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x74, 0x43, 0x61, 0x6c, 0x6c, 0x62, 0x61, - 0x63, 0x6b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x09, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, - 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, - 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, - 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x22, 0x85, 0x02, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, - 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x51, 0x75, 0x65, 0x72, 0x79, 0x49, 0x44, 0x12, 0x16, 0x0a, - 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x55, - 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, - 0x50, 0x65, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x4f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x12, 0x22, 0x0a, 0x03, 0x47, 0x65, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x6f, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x03, 0x47, 0x65, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x22, 0xb7, - 0x01, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x42, 0x6f, 0x74, 0x49, 0x6e, 0x6c, 0x69, - 0x6e, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, - 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, - 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, - 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x03, 0x47, 0x65, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x47, 0x65, 0x6f, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x47, 0x65, 0x6f, 0x22, 0x66, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x12, 0x1d, 0x0a, 0x04, 0x54, 0x65, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x04, 0x54, 0x65, 0x61, 0x6d, - 0x22, 0xe4, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x4d, - 0x65, 0x6d, 0x62, 0x65, 0x72, 0x41, 0x64, 0x64, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, - 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, - 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x04, 0x55, 0x73, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x07, 0x43, 0x6f, 0x6e, - 0x74, 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x73, 0x67, - 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x07, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x65, 0x72, 0x49, 0x44, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x41, 0x64, 0x64, 0x65, - 0x72, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x07, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x22, 0xbb, 0x01, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, - 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, 0x12, - 0x20, 0x0a, 0x09, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x09, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x72, 0x49, - 0x44, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x07, 0x52, - 0x04, 0x48, 0x61, 0x73, 0x68, 0x22, 0xa0, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x54, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, - 0x12, 0x20, 0x0a, 0x09, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x09, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x72, - 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x05, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x87, 0x01, 0x0a, 0x0f, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x0a, 0x06, - 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, - 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, - 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x24, 0x0a, 0x05, - 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x54, 0x65, 0x61, 0x6d, 0x50, 0x68, 0x6f, 0x74, 0x6f, 0x52, 0x05, 0x50, 0x68, 0x6f, - 0x74, 0x6f, 0x22, 0x70, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x65, 0x61, 0x6d, - 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, - 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x96, 0x02, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, - 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, - 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x64, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x52, 0x65, 0x63, - 0x65, 0x69, 0x76, 0x65, 0x72, 0x49, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x4f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x47, 0x6c, 0x6f, - 0x62, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, - 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x4d, 0x73, 0x67, 0x49, 0x44, 0x12, 0x2e, 0x0a, 0x08, 0x45, - 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, - 0x6d, 0x73, 0x67, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x45, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x52, 0x08, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x49, 0x44, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, 0x49, 0x44, 0x22, 0x95, 0x01, - 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, - 0x79, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x78, 0x12, 0x1a, 0x0a, 0x06, 0x54, - 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x64, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, - 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x49, - 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, - 0x72, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x73, 0x67, - 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x4d, 0x73, 0x67, 0x49, 0x44, 0x22, 0x9a, 0x01, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x43, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x69, 0x6e, 0x67, 0x12, - 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x64, 0x20, 0x01, 0x28, 0x03, 0x42, - 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x63, 0x65, 0x69, - 0x76, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x52, 0x65, 0x63, - 0x65, 0x69, 0x76, 0x65, 0x72, 0x49, 0x44, 0x12, 0x29, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x54, 0x79, - 0x70, 0x69, 0x6e, 0x67, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x41, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x22, 0xb2, 0x02, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x44, 0x12, 0x2e, 0x0a, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x52, - 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x07, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, - 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, - 0x6d, 0x49, 0x44, 0x12, 0x1d, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, - 0x65, 0x72, 0x12, 0x21, 0x0a, 0x06, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x06, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x59, 0x6f, 0x75, 0x72, 0x52, 0x65, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x59, 0x6f, - 0x75, 0x72, 0x52, 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x52, - 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x52, - 0x65, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x78, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x43, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x64, - 0x64, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x28, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, 0x6c, - 0x65, 0x6e, 0x64, 0x61, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x22, 0x6e, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x65, 0x6e, - 0x64, 0x61, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x07, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x66, - 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x07, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x49, - 0x44, 0x22, 0x79, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6c, 0x65, 0x6e, - 0x64, 0x61, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x45, 0x64, 0x69, 0x74, 0x65, 0x64, 0x12, 0x16, - 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x49, 0x44, 0x12, 0x28, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x61, 0x6c, 0x65, 0x6e, 0x64, 0x61, 0x72, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x8d, 0x01, 0x0a, - 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x49, 0x44, 0x12, 0x31, 0x0a, 0x09, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, 0x09, 0x52, 0x65, 0x64, - 0x69, 0x72, 0x65, 0x63, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x9b, 0x01, 0x0a, - 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, - 0x1a, 0x0a, 0x08, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x08, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x50, - 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, - 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x6d, 0x73, 0x67, 0x2e, - 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x06, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x41, 0x6c, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x74, 0x69, 0x76, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x41, 0x6c, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x74, 0x69, 0x76, 0x65, 0x73, 0x22, 0xc5, 0x02, 0x0a, 0x0f, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x16, - 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, - 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x50, 0x65, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, - 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x08, 0x50, 0x65, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x06, 0x43, 0x61, - 0x6c, 0x6c, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, - 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x44, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, - 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0a, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x06, 0x42, 0x02, 0x30, 0x01, 0x52, 0x0a, 0x41, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x48, 0x61, 0x73, 0x68, 0x12, 0x2c, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x41, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x61, - 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x44, 0x61, 0x74, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x22, 0xa3, 0x01, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x68, 0x6f, - 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x55, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, - 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, 0x66, 0x20, 0x01, 0x28, - 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x12, 0x1d, 0x0a, - 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, - 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x06, - 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, - 0x52, 0x06, 0x43, 0x61, 0x6c, 0x6c, 0x49, 0x64, 0x22, 0x85, 0x01, 0x0a, 0x14, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x43, 0x61, 0x6c, 0x6c, 0x45, 0x6e, 0x64, 0x65, - 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x64, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x55, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x49, 0x44, 0x18, 0x65, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x44, 0x18, - 0x66, 0x20, 0x01, 0x28, 0x03, 0x42, 0x02, 0x30, 0x01, 0x52, 0x06, 0x54, 0x65, 0x61, 0x6d, 0x49, - 0x44, 0x12, 0x1d, 0x0a, 0x04, 0x50, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x52, 0x04, 0x50, 0x65, 0x65, 0x72, - 0x2a, 0xcc, 0x01, 0x0a, 0x0e, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x70, 0x63, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x65, - 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, - 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x10, 0x02, 0x12, 0x1b, 0x0a, 0x17, 0x52, - 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x10, 0x03, 0x12, 0x1b, 0x0a, 0x17, 0x52, 0x65, 0x64, 0x69, - 0x72, 0x65, 0x63, 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x32, 0x10, 0x04, 0x12, 0x1b, 0x0a, 0x17, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, - 0x74, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x33, - 0x10, 0x05, 0x12, 0x1b, 0x0a, 0x17, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x34, 0x10, 0x06, 0x42, - 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_updates_proto_rawDescOnce sync.Once - file_updates_proto_rawDescData = file_updates_proto_rawDesc -) - -func file_updates_proto_rawDescGZIP() []byte { - file_updates_proto_rawDescOnce.Do(func() { - file_updates_proto_rawDescData = protoimpl.X.CompressGZIP(file_updates_proto_rawDescData) - }) - return file_updates_proto_rawDescData -} - -var file_updates_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_updates_proto_msgTypes = make([]protoimpl.MessageInfo, 57) -var file_updates_proto_goTypes = []interface{}{ - (RedirectTarget)(0), // 0: msg.RedirectTarget - (*UpdateGetState)(nil), // 1: msg.UpdateGetState - (*UpdateGetDifference)(nil), // 2: msg.UpdateGetDifference - (*UpdateDifference)(nil), // 3: msg.UpdateDifference - (*UpdateTooLong)(nil), // 4: msg.UpdateTooLong - (*UpdateState)(nil), // 5: msg.UpdateState - (*UpdateMessageID)(nil), // 6: msg.UpdateMessageID - (*UpdateNewMessage)(nil), // 7: msg.UpdateNewMessage - (*UpdateMessageEdited)(nil), // 8: msg.UpdateMessageEdited - (*UpdateMessagesDeleted)(nil), // 9: msg.UpdateMessagesDeleted - (*UpdateReadHistoryInbox)(nil), // 10: msg.UpdateReadHistoryInbox - (*UpdateReadHistoryOutbox)(nil), // 11: msg.UpdateReadHistoryOutbox - (*UpdateMessagePinned)(nil), // 12: msg.UpdateMessagePinned - (*UpdateUserTyping)(nil), // 13: msg.UpdateUserTyping - (*UpdateUserStatus)(nil), // 14: msg.UpdateUserStatus - (*UpdateUsername)(nil), // 15: msg.UpdateUsername - (*UpdateUserPhoto)(nil), // 16: msg.UpdateUserPhoto - (*UpdateNotifySettings)(nil), // 17: msg.UpdateNotifySettings - (*UpdateGroupParticipantAdd)(nil), // 18: msg.UpdateGroupParticipantAdd - (*UpdateGroupParticipantDeleted)(nil), // 19: msg.UpdateGroupParticipantDeleted - (*UpdateGroupParticipantAdmin)(nil), // 20: msg.UpdateGroupParticipantAdmin - (*UpdateGroupAdmins)(nil), // 21: msg.UpdateGroupAdmins - (*UpdateGroupAdminOnly)(nil), // 22: msg.UpdateGroupAdminOnly - (*UpdateGroupPhoto)(nil), // 23: msg.UpdateGroupPhoto - (*UpdateReadMessagesContents)(nil), // 24: msg.UpdateReadMessagesContents - (*UpdateAuthorizationReset)(nil), // 25: msg.UpdateAuthorizationReset - (*UpdateDraftMessage)(nil), // 26: msg.UpdateDraftMessage - (*UpdateDraftMessageCleared)(nil), // 27: msg.UpdateDraftMessageCleared - (*UpdateDialogPinned)(nil), // 28: msg.UpdateDialogPinned - (*UpdateDialogPinnedReorder)(nil), // 29: msg.UpdateDialogPinnedReorder - (*UpdateAccountPrivacy)(nil), // 30: msg.UpdateAccountPrivacy - (*UpdateLabelItemsAdded)(nil), // 31: msg.UpdateLabelItemsAdded - (*UpdateLabelItemsRemoved)(nil), // 32: msg.UpdateLabelItemsRemoved - (*UpdateLabelSet)(nil), // 33: msg.UpdateLabelSet - (*UpdateLabelDeleted)(nil), // 34: msg.UpdateLabelDeleted - (*UpdateUserBlocked)(nil), // 35: msg.UpdateUserBlocked - (*UpdateMessagePoll)(nil), // 36: msg.UpdateMessagePoll - (*UpdateBotCallbackQuery)(nil), // 37: msg.UpdateBotCallbackQuery - (*UpdateBotInlineQuery)(nil), // 38: msg.UpdateBotInlineQuery - (*UpdateBotInlineSend)(nil), // 39: msg.UpdateBotInlineSend - (*UpdateTeamCreated)(nil), // 40: msg.UpdateTeamCreated - (*UpdateTeamMemberAdded)(nil), // 41: msg.UpdateTeamMemberAdded - (*UpdateTeamMemberRemoved)(nil), // 42: msg.UpdateTeamMemberRemoved - (*UpdateTeamMemberStatus)(nil), // 43: msg.UpdateTeamMemberStatus - (*UpdateTeamPhoto)(nil), // 44: msg.UpdateTeamPhoto - (*UpdateTeam)(nil), // 45: msg.UpdateTeam - (*UpdateCommunityMessage)(nil), // 46: msg.UpdateCommunityMessage - (*UpdateCommunityReadOutbox)(nil), // 47: msg.UpdateCommunityReadOutbox - (*UpdateCommunityTyping)(nil), // 48: msg.UpdateCommunityTyping - (*UpdateReaction)(nil), // 49: msg.UpdateReaction - (*UpdateCalendarEventAdded)(nil), // 50: msg.UpdateCalendarEventAdded - (*UpdateCalendarEventRemoved)(nil), // 51: msg.UpdateCalendarEventRemoved - (*UpdateCalendarEventEdited)(nil), // 52: msg.UpdateCalendarEventEdited - (*UpdateRedirect)(nil), // 53: msg.UpdateRedirect - (*ClientRedirect)(nil), // 54: msg.ClientRedirect - (*UpdatePhoneCall)(nil), // 55: msg.UpdatePhoneCall - (*UpdatePhoneCallStarted)(nil), // 56: msg.UpdatePhoneCallStarted - (*UpdatePhoneCallEnded)(nil), // 57: msg.UpdatePhoneCallEnded - (*UpdateEnvelope)(nil), // 58: msg.UpdateEnvelope - (*User)(nil), // 59: msg.User - (*Group)(nil), // 60: msg.Group - (*UserMessage)(nil), // 61: msg.UserMessage - (*Peer)(nil), // 62: msg.Peer - (TypingAction)(0), // 63: msg.TypingAction - (*UserPhoto)(nil), // 64: msg.UserPhoto - (*PeerNotifySettings)(nil), // 65: msg.PeerNotifySettings - (*GroupPhoto)(nil), // 66: msg.GroupPhoto - (*DraftMessage)(nil), // 67: msg.DraftMessage - (*PrivacyRule)(nil), // 68: msg.PrivacyRule - (*Label)(nil), // 69: msg.Label - (*MediaPoll)(nil), // 70: msg.MediaPoll - (*PollResults)(nil), // 71: msg.PollResults - (*GeoLocation)(nil), // 72: msg.GeoLocation - (*Team)(nil), // 73: msg.Team - (*ContactUser)(nil), // 74: msg.ContactUser - (*TeamPhoto)(nil), // 75: msg.TeamPhoto - (*MessageEntity)(nil), // 76: msg.MessageEntity - (*ReactionCounter)(nil), // 77: msg.ReactionCounter - (*CalendarEvent)(nil), // 78: msg.CalendarEvent - (PhoneCallAction)(0), // 79: msg.PhoneCallAction -} -var file_updates_proto_depIdxs = []int32{ - 58, // 0: msg.UpdateDifference.Updates:type_name -> msg.UpdateEnvelope - 59, // 1: msg.UpdateDifference.Users:type_name -> msg.User - 60, // 2: msg.UpdateDifference.Groups:type_name -> msg.Group - 61, // 3: msg.UpdateNewMessage.Message:type_name -> msg.UserMessage - 59, // 4: msg.UpdateNewMessage.Sender:type_name -> msg.User - 61, // 5: msg.UpdateMessageEdited.Message:type_name -> msg.UserMessage - 62, // 6: msg.UpdateMessagesDeleted.Peer:type_name -> msg.Peer - 62, // 7: msg.UpdateReadHistoryInbox.Peer:type_name -> msg.Peer - 62, // 8: msg.UpdateReadHistoryOutbox.Peer:type_name -> msg.Peer - 62, // 9: msg.UpdateMessagePinned.Peer:type_name -> msg.Peer - 63, // 10: msg.UpdateUserTyping.Action:type_name -> msg.TypingAction - 64, // 11: msg.UpdateUserPhoto.Photo:type_name -> msg.UserPhoto - 62, // 12: msg.UpdateNotifySettings.NotifyPeer:type_name -> msg.Peer - 65, // 13: msg.UpdateNotifySettings.Settings:type_name -> msg.PeerNotifySettings - 66, // 14: msg.UpdateGroupPhoto.Photo:type_name -> msg.GroupPhoto - 62, // 15: msg.UpdateReadMessagesContents.Peer:type_name -> msg.Peer - 67, // 16: msg.UpdateDraftMessage.Message:type_name -> msg.DraftMessage - 62, // 17: msg.UpdateDraftMessageCleared.Peer:type_name -> msg.Peer - 62, // 18: msg.UpdateDialogPinned.Peer:type_name -> msg.Peer - 62, // 19: msg.UpdateDialogPinnedReorder.Peer:type_name -> msg.Peer - 68, // 20: msg.UpdateAccountPrivacy.ChatInvite:type_name -> msg.PrivacyRule - 68, // 21: msg.UpdateAccountPrivacy.LastSeen:type_name -> msg.PrivacyRule - 68, // 22: msg.UpdateAccountPrivacy.PhoneNumber:type_name -> msg.PrivacyRule - 68, // 23: msg.UpdateAccountPrivacy.ProfilePhoto:type_name -> msg.PrivacyRule - 68, // 24: msg.UpdateAccountPrivacy.ForwardedMessage:type_name -> msg.PrivacyRule - 68, // 25: msg.UpdateAccountPrivacy.Call:type_name -> msg.PrivacyRule - 62, // 26: msg.UpdateLabelItemsAdded.Peer:type_name -> msg.Peer - 69, // 27: msg.UpdateLabelItemsAdded.Labels:type_name -> msg.Label - 62, // 28: msg.UpdateLabelItemsRemoved.Peer:type_name -> msg.Peer - 69, // 29: msg.UpdateLabelItemsRemoved.Labels:type_name -> msg.Label - 69, // 30: msg.UpdateLabelSet.Labels:type_name -> msg.Label - 70, // 31: msg.UpdateMessagePoll.Poll:type_name -> msg.MediaPoll - 71, // 32: msg.UpdateMessagePoll.Results:type_name -> msg.PollResults - 62, // 33: msg.UpdateBotCallbackQuery.Peer:type_name -> msg.Peer - 62, // 34: msg.UpdateBotInlineQuery.Peer:type_name -> msg.Peer - 72, // 35: msg.UpdateBotInlineQuery.Geo:type_name -> msg.GeoLocation - 72, // 36: msg.UpdateBotInlineSend.Geo:type_name -> msg.GeoLocation - 73, // 37: msg.UpdateTeamCreated.Team:type_name -> msg.Team - 59, // 38: msg.UpdateTeamMemberAdded.User:type_name -> msg.User - 74, // 39: msg.UpdateTeamMemberAdded.Contact:type_name -> msg.ContactUser - 75, // 40: msg.UpdateTeamPhoto.Photo:type_name -> msg.TeamPhoto - 76, // 41: msg.UpdateCommunityMessage.Entities:type_name -> msg.MessageEntity - 63, // 42: msg.UpdateCommunityTyping.Action:type_name -> msg.TypingAction - 77, // 43: msg.UpdateReaction.Counter:type_name -> msg.ReactionCounter - 62, // 44: msg.UpdateReaction.Peer:type_name -> msg.Peer - 59, // 45: msg.UpdateReaction.Sender:type_name -> msg.User - 78, // 46: msg.UpdateCalendarEventAdded.Event:type_name -> msg.CalendarEvent - 78, // 47: msg.UpdateCalendarEventEdited.Event:type_name -> msg.CalendarEvent - 54, // 48: msg.UpdateRedirect.Redirects:type_name -> msg.ClientRedirect - 0, // 49: msg.ClientRedirect.Target:type_name -> msg.RedirectTarget - 79, // 50: msg.UpdatePhoneCall.Action:type_name -> msg.PhoneCallAction - 62, // 51: msg.UpdatePhoneCallStarted.Peer:type_name -> msg.Peer - 62, // 52: msg.UpdatePhoneCallEnded.Peer:type_name -> msg.Peer - 53, // [53:53] is the sub-list for method output_type - 53, // [53:53] is the sub-list for method input_type - 53, // [53:53] is the sub-list for extension type_name - 53, // [53:53] is the sub-list for extension extendee - 0, // [0:53] is the sub-list for field type_name -} - -func init() { file_updates_proto_init() } -func file_updates_proto_init() { - if File_updates_proto != nil { - return - } - file_core_types_proto_init() - file_calendar_proto_init() - file_chat_messages_medias_proto_init() - file_chat_phone_proto_init() - if !protoimpl.UnsafeEnabled { - file_updates_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateGetState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateGetDifference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateDifference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateTooLong); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateState); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateMessageID); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateNewMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateMessageEdited); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateMessagesDeleted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReadHistoryInbox); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReadHistoryOutbox); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateMessagePinned); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateUserTyping); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateUserStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateUsername); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateUserPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateNotifySettings); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateGroupParticipantAdd); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateGroupParticipantDeleted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateGroupParticipantAdmin); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateGroupAdmins); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateGroupAdminOnly); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateGroupPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReadMessagesContents); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateAuthorizationReset); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateDraftMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateDraftMessageCleared); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateDialogPinned); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateDialogPinnedReorder); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateAccountPrivacy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateLabelItemsAdded); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateLabelItemsRemoved); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateLabelSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateLabelDeleted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateUserBlocked); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateMessagePoll); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateBotCallbackQuery); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateBotInlineQuery); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateBotInlineSend); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateTeamCreated); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateTeamMemberAdded); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateTeamMemberRemoved); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateTeamMemberStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateTeamPhoto); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateTeam); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateCommunityMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateCommunityReadOutbox); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateCommunityTyping); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateReaction); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateCalendarEventAdded); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateCalendarEventRemoved); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateCalendarEventEdited); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdateRedirect); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ClientRedirect); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdatePhoneCall); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdatePhoneCallStarted); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_updates_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UpdatePhoneCallEnded); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_updates_proto_rawDesc, - NumEnums: 1, - NumMessages: 57, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_updates_proto_goTypes, - DependencyIndexes: file_updates_proto_depIdxs, - EnumInfos: file_updates_proto_enumTypes, - MessageInfos: file_updates_proto_msgTypes, - }.Build() - File_updates_proto = out.File - file_updates_proto_rawDesc = nil - file_updates_proto_goTypes = nil - file_updates_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/updates.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/updates.rony.go deleted file mode 100644 index 2a4d1c34..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/updates.rony.go +++ /dev/null @@ -1,4251 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: updates.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_UpdateGetState int64 = 1437250230 - -type poolUpdateGetState struct { - pool sync.Pool -} - -func (p *poolUpdateGetState) Get() *UpdateGetState { - x, ok := p.pool.Get().(*UpdateGetState) - if !ok { - x = &UpdateGetState{} - } - - return x -} - -func (p *poolUpdateGetState) Put(x *UpdateGetState) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolUpdateGetState = poolUpdateGetState{} - -func (x *UpdateGetState) DeepCopy(z *UpdateGetState) { -} - -func (x *UpdateGetState) Clone() *UpdateGetState { - z := &UpdateGetState{} - x.DeepCopy(z) - return z -} - -func (x *UpdateGetState) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateGetState) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateGetState) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateGetState) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateGetState) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateGetState, x) -} - -const C_UpdateGetDifference int64 = 556775761 - -type poolUpdateGetDifference struct { - pool sync.Pool -} - -func (p *poolUpdateGetDifference) Get() *UpdateGetDifference { - x, ok := p.pool.Get().(*UpdateGetDifference) - if !ok { - x = &UpdateGetDifference{} - } - - return x -} - -func (p *poolUpdateGetDifference) Put(x *UpdateGetDifference) { - if x == nil { - return - } - - x.From = 0 - x.Limit = 0 - - p.pool.Put(x) -} - -var PoolUpdateGetDifference = poolUpdateGetDifference{} - -func (x *UpdateGetDifference) DeepCopy(z *UpdateGetDifference) { - z.From = x.From - z.Limit = x.Limit -} - -func (x *UpdateGetDifference) Clone() *UpdateGetDifference { - z := &UpdateGetDifference{} - x.DeepCopy(z) - return z -} - -func (x *UpdateGetDifference) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateGetDifference) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateGetDifference) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateGetDifference) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateGetDifference) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateGetDifference, x) -} - -const C_UpdateDifference int64 = 1742546619 - -type poolUpdateDifference struct { - pool sync.Pool -} - -func (p *poolUpdateDifference) Get() *UpdateDifference { - x, ok := p.pool.Get().(*UpdateDifference) - if !ok { - x = &UpdateDifference{} - } - - return x -} - -func (p *poolUpdateDifference) Put(x *UpdateDifference) { - if x == nil { - return - } - - x.More = false - x.MaxUpdateID = 0 - x.MinUpdateID = 0 - for _, z := range x.Updates { - PoolUpdateEnvelope.Put(z) - } - x.Updates = x.Updates[:0] - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - for _, z := range x.Groups { - PoolGroup.Put(z) - } - x.Groups = x.Groups[:0] - x.CurrentUpdateID = 0 - - p.pool.Put(x) -} - -var PoolUpdateDifference = poolUpdateDifference{} - -func (x *UpdateDifference) DeepCopy(z *UpdateDifference) { - z.More = x.More - z.MaxUpdateID = x.MaxUpdateID - z.MinUpdateID = x.MinUpdateID - for idx := range x.Updates { - if x.Updates[idx] == nil { - continue - } - xx := PoolUpdateEnvelope.Get() - x.Updates[idx].DeepCopy(xx) - z.Updates = append(z.Updates, xx) - } - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - for idx := range x.Groups { - if x.Groups[idx] == nil { - continue - } - xx := PoolGroup.Get() - x.Groups[idx].DeepCopy(xx) - z.Groups = append(z.Groups, xx) - } - z.CurrentUpdateID = x.CurrentUpdateID -} - -func (x *UpdateDifference) Clone() *UpdateDifference { - z := &UpdateDifference{} - x.DeepCopy(z) - return z -} - -func (x *UpdateDifference) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateDifference) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateDifference) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateDifference) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateDifference) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateDifference, x) -} - -const C_UpdateTooLong int64 = 1531755547 - -type poolUpdateTooLong struct { - pool sync.Pool -} - -func (p *poolUpdateTooLong) Get() *UpdateTooLong { - x, ok := p.pool.Get().(*UpdateTooLong) - if !ok { - x = &UpdateTooLong{} - } - - return x -} - -func (p *poolUpdateTooLong) Put(x *UpdateTooLong) { - if x == nil { - return - } - - p.pool.Put(x) -} - -var PoolUpdateTooLong = poolUpdateTooLong{} - -func (x *UpdateTooLong) DeepCopy(z *UpdateTooLong) { -} - -func (x *UpdateTooLong) Clone() *UpdateTooLong { - z := &UpdateTooLong{} - x.DeepCopy(z) - return z -} - -func (x *UpdateTooLong) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateTooLong) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateTooLong) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateTooLong) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateTooLong) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateTooLong, x) -} - -const C_UpdateState int64 = 1837585836 - -type poolUpdateState struct { - pool sync.Pool -} - -func (p *poolUpdateState) Get() *UpdateState { - x, ok := p.pool.Get().(*UpdateState) - if !ok { - x = &UpdateState{} - } - - return x -} - -func (p *poolUpdateState) Put(x *UpdateState) { - if x == nil { - return - } - - x.UpdateID = 0 - - p.pool.Put(x) -} - -var PoolUpdateState = poolUpdateState{} - -func (x *UpdateState) DeepCopy(z *UpdateState) { - z.UpdateID = x.UpdateID -} - -func (x *UpdateState) Clone() *UpdateState { - z := &UpdateState{} - x.DeepCopy(z) - return z -} - -func (x *UpdateState) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateState) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateState) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateState) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateState) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateState, x) -} - -const C_UpdateMessageID int64 = 2139063022 - -type poolUpdateMessageID struct { - pool sync.Pool -} - -func (p *poolUpdateMessageID) Get() *UpdateMessageID { - x, ok := p.pool.Get().(*UpdateMessageID) - if !ok { - x = &UpdateMessageID{} - } - - return x -} - -func (p *poolUpdateMessageID) Put(x *UpdateMessageID) { - if x == nil { - return - } - - x.UCount = 0 - x.MessageID = 0 - x.RandomID = 0 - - p.pool.Put(x) -} - -var PoolUpdateMessageID = poolUpdateMessageID{} - -func (x *UpdateMessageID) DeepCopy(z *UpdateMessageID) { - z.UCount = x.UCount - z.MessageID = x.MessageID - z.RandomID = x.RandomID -} - -func (x *UpdateMessageID) Clone() *UpdateMessageID { - z := &UpdateMessageID{} - x.DeepCopy(z) - return z -} - -func (x *UpdateMessageID) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateMessageID) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateMessageID) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateMessageID) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateMessageID) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateMessageID, x) -} - -const C_UpdateNewMessage int64 = 3426925183 - -type poolUpdateNewMessage struct { - pool sync.Pool -} - -func (p *poolUpdateNewMessage) Get() *UpdateNewMessage { - x, ok := p.pool.Get().(*UpdateNewMessage) - if !ok { - x = &UpdateNewMessage{} - } - - x.Message = PoolUserMessage.Get() - - x.Sender = PoolUser.Get() - - return x -} - -func (p *poolUpdateNewMessage) Put(x *UpdateNewMessage) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - PoolUserMessage.Put(x.Message) - PoolUser.Put(x.Sender) - x.AccessHash = 0 - x.SenderRefID = 0 - - p.pool.Put(x) -} - -var PoolUpdateNewMessage = poolUpdateNewMessage{} - -func (x *UpdateNewMessage) DeepCopy(z *UpdateNewMessage) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - if x.Message != nil { - if z.Message == nil { - z.Message = PoolUserMessage.Get() - } - x.Message.DeepCopy(z.Message) - } else { - PoolUserMessage.Put(z.Message) - z.Message = nil - } - if x.Sender != nil { - if z.Sender == nil { - z.Sender = PoolUser.Get() - } - x.Sender.DeepCopy(z.Sender) - } else { - PoolUser.Put(z.Sender) - z.Sender = nil - } - z.AccessHash = x.AccessHash - z.SenderRefID = x.SenderRefID -} - -func (x *UpdateNewMessage) Clone() *UpdateNewMessage { - z := &UpdateNewMessage{} - x.DeepCopy(z) - return z -} - -func (x *UpdateNewMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateNewMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateNewMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateNewMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateNewMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateNewMessage, x) -} - -const C_UpdateMessageEdited int64 = 1825079988 - -type poolUpdateMessageEdited struct { - pool sync.Pool -} - -func (p *poolUpdateMessageEdited) Get() *UpdateMessageEdited { - x, ok := p.pool.Get().(*UpdateMessageEdited) - if !ok { - x = &UpdateMessageEdited{} - } - - x.Message = PoolUserMessage.Get() - - return x -} - -func (p *poolUpdateMessageEdited) Put(x *UpdateMessageEdited) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - PoolUserMessage.Put(x.Message) - - p.pool.Put(x) -} - -var PoolUpdateMessageEdited = poolUpdateMessageEdited{} - -func (x *UpdateMessageEdited) DeepCopy(z *UpdateMessageEdited) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - if x.Message != nil { - if z.Message == nil { - z.Message = PoolUserMessage.Get() - } - x.Message.DeepCopy(z.Message) - } else { - PoolUserMessage.Put(z.Message) - z.Message = nil - } -} - -func (x *UpdateMessageEdited) Clone() *UpdateMessageEdited { - z := &UpdateMessageEdited{} - x.DeepCopy(z) - return z -} - -func (x *UpdateMessageEdited) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateMessageEdited) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateMessageEdited) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateMessageEdited) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateMessageEdited) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateMessageEdited, x) -} - -const C_UpdateMessagesDeleted int64 = 670568714 - -type poolUpdateMessagesDeleted struct { - pool sync.Pool -} - -func (p *poolUpdateMessagesDeleted) Get() *UpdateMessagesDeleted { - x, ok := p.pool.Get().(*UpdateMessagesDeleted) - if !ok { - x = &UpdateMessagesDeleted{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateMessagesDeleted) Put(x *UpdateMessagesDeleted) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - x.MessageIDs = x.MessageIDs[:0] - PoolPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolUpdateMessagesDeleted = poolUpdateMessagesDeleted{} - -func (x *UpdateMessagesDeleted) DeepCopy(z *UpdateMessagesDeleted) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *UpdateMessagesDeleted) Clone() *UpdateMessagesDeleted { - z := &UpdateMessagesDeleted{} - x.DeepCopy(z) - return z -} - -func (x *UpdateMessagesDeleted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateMessagesDeleted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateMessagesDeleted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateMessagesDeleted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateMessagesDeleted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateMessagesDeleted, x) -} - -const C_UpdateReadHistoryInbox int64 = 1529128378 - -type poolUpdateReadHistoryInbox struct { - pool sync.Pool -} - -func (p *poolUpdateReadHistoryInbox) Get() *UpdateReadHistoryInbox { - x, ok := p.pool.Get().(*UpdateReadHistoryInbox) - if !ok { - x = &UpdateReadHistoryInbox{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateReadHistoryInbox) Put(x *UpdateReadHistoryInbox) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolPeer.Put(x.Peer) - x.MaxID = 0 - - p.pool.Put(x) -} - -var PoolUpdateReadHistoryInbox = poolUpdateReadHistoryInbox{} - -func (x *UpdateReadHistoryInbox) DeepCopy(z *UpdateReadHistoryInbox) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.MaxID = x.MaxID -} - -func (x *UpdateReadHistoryInbox) Clone() *UpdateReadHistoryInbox { - z := &UpdateReadHistoryInbox{} - x.DeepCopy(z) - return z -} - -func (x *UpdateReadHistoryInbox) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateReadHistoryInbox) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateReadHistoryInbox) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateReadHistoryInbox) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateReadHistoryInbox) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateReadHistoryInbox, x) -} - -const C_UpdateReadHistoryOutbox int64 = 510866108 - -type poolUpdateReadHistoryOutbox struct { - pool sync.Pool -} - -func (p *poolUpdateReadHistoryOutbox) Get() *UpdateReadHistoryOutbox { - x, ok := p.pool.Get().(*UpdateReadHistoryOutbox) - if !ok { - x = &UpdateReadHistoryOutbox{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateReadHistoryOutbox) Put(x *UpdateReadHistoryOutbox) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolPeer.Put(x.Peer) - x.MaxID = 0 - x.UserID = 0 - - p.pool.Put(x) -} - -var PoolUpdateReadHistoryOutbox = poolUpdateReadHistoryOutbox{} - -func (x *UpdateReadHistoryOutbox) DeepCopy(z *UpdateReadHistoryOutbox) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.MaxID = x.MaxID - z.UserID = x.UserID -} - -func (x *UpdateReadHistoryOutbox) Clone() *UpdateReadHistoryOutbox { - z := &UpdateReadHistoryOutbox{} - x.DeepCopy(z) - return z -} - -func (x *UpdateReadHistoryOutbox) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateReadHistoryOutbox) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateReadHistoryOutbox) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateReadHistoryOutbox) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateReadHistoryOutbox) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateReadHistoryOutbox, x) -} - -const C_UpdateMessagePinned int64 = 1260768050 - -type poolUpdateMessagePinned struct { - pool sync.Pool -} - -func (p *poolUpdateMessagePinned) Get() *UpdateMessagePinned { - x, ok := p.pool.Get().(*UpdateMessagePinned) - if !ok { - x = &UpdateMessagePinned{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateMessagePinned) Put(x *UpdateMessagePinned) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolPeer.Put(x.Peer) - x.UserID = 0 - x.MsgID = 0 - x.Version = 0 - - p.pool.Put(x) -} - -var PoolUpdateMessagePinned = poolUpdateMessagePinned{} - -func (x *UpdateMessagePinned) DeepCopy(z *UpdateMessagePinned) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.UserID = x.UserID - z.MsgID = x.MsgID - z.Version = x.Version -} - -func (x *UpdateMessagePinned) Clone() *UpdateMessagePinned { - z := &UpdateMessagePinned{} - x.DeepCopy(z) - return z -} - -func (x *UpdateMessagePinned) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateMessagePinned) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateMessagePinned) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateMessagePinned) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateMessagePinned) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateMessagePinned, x) -} - -const C_UpdateUserTyping int64 = 178254060 - -type poolUpdateUserTyping struct { - pool sync.Pool -} - -func (p *poolUpdateUserTyping) Get() *UpdateUserTyping { - x, ok := p.pool.Get().(*UpdateUserTyping) - if !ok { - x = &UpdateUserTyping{} - } - - return x -} - -func (p *poolUpdateUserTyping) Put(x *UpdateUserTyping) { - if x == nil { - return - } - - x.UCount = 0 - x.TeamID = 0 - x.UserID = 0 - x.Action = 0 - x.PeerID = 0 - x.PeerType = 0 - - p.pool.Put(x) -} - -var PoolUpdateUserTyping = poolUpdateUserTyping{} - -func (x *UpdateUserTyping) DeepCopy(z *UpdateUserTyping) { - z.UCount = x.UCount - z.TeamID = x.TeamID - z.UserID = x.UserID - z.Action = x.Action - z.PeerID = x.PeerID - z.PeerType = x.PeerType -} - -func (x *UpdateUserTyping) Clone() *UpdateUserTyping { - z := &UpdateUserTyping{} - x.DeepCopy(z) - return z -} - -func (x *UpdateUserTyping) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateUserTyping) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateUserTyping) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateUserTyping) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateUserTyping) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateUserTyping, x) -} - -const C_UpdateUserStatus int64 = 2696747995 - -type poolUpdateUserStatus struct { - pool sync.Pool -} - -func (p *poolUpdateUserStatus) Get() *UpdateUserStatus { - x, ok := p.pool.Get().(*UpdateUserStatus) - if !ok { - x = &UpdateUserStatus{} - } - - return x -} - -func (p *poolUpdateUserStatus) Put(x *UpdateUserStatus) { - if x == nil { - return - } - - x.UCount = 0 - x.UserID = 0 - x.Status = 0 - - p.pool.Put(x) -} - -var PoolUpdateUserStatus = poolUpdateUserStatus{} - -func (x *UpdateUserStatus) DeepCopy(z *UpdateUserStatus) { - z.UCount = x.UCount - z.UserID = x.UserID - z.Status = x.Status -} - -func (x *UpdateUserStatus) Clone() *UpdateUserStatus { - z := &UpdateUserStatus{} - x.DeepCopy(z) - return z -} - -func (x *UpdateUserStatus) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateUserStatus) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateUserStatus) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateUserStatus) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateUserStatus) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateUserStatus, x) -} - -const C_UpdateUsername int64 = 4290110589 - -type poolUpdateUsername struct { - pool sync.Pool -} - -func (p *poolUpdateUsername) Get() *UpdateUsername { - x, ok := p.pool.Get().(*UpdateUsername) - if !ok { - x = &UpdateUsername{} - } - - return x -} - -func (p *poolUpdateUsername) Put(x *UpdateUsername) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.UserID = 0 - x.Username = "" - x.FirstName = "" - x.LastName = "" - x.Bio = "" - x.Phone = "" - - p.pool.Put(x) -} - -var PoolUpdateUsername = poolUpdateUsername{} - -func (x *UpdateUsername) DeepCopy(z *UpdateUsername) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.UserID = x.UserID - z.Username = x.Username - z.FirstName = x.FirstName - z.LastName = x.LastName - z.Bio = x.Bio - z.Phone = x.Phone -} - -func (x *UpdateUsername) Clone() *UpdateUsername { - z := &UpdateUsername{} - x.DeepCopy(z) - return z -} - -func (x *UpdateUsername) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateUsername) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateUsername) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateUsername) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateUsername) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateUsername, x) -} - -const C_UpdateUserPhoto int64 = 302028082 - -type poolUpdateUserPhoto struct { - pool sync.Pool -} - -func (p *poolUpdateUserPhoto) Get() *UpdateUserPhoto { - x, ok := p.pool.Get().(*UpdateUserPhoto) - if !ok { - x = &UpdateUserPhoto{} - } - - x.Photo = PoolUserPhoto.Get() - - return x -} - -func (p *poolUpdateUserPhoto) Put(x *UpdateUserPhoto) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.UserID = 0 - PoolUserPhoto.Put(x.Photo) - x.PhotoID = 0 - x.DeletedPhotoIDs = x.DeletedPhotoIDs[:0] - - p.pool.Put(x) -} - -var PoolUpdateUserPhoto = poolUpdateUserPhoto{} - -func (x *UpdateUserPhoto) DeepCopy(z *UpdateUserPhoto) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.UserID = x.UserID - if x.Photo != nil { - if z.Photo == nil { - z.Photo = PoolUserPhoto.Get() - } - x.Photo.DeepCopy(z.Photo) - } else { - PoolUserPhoto.Put(z.Photo) - z.Photo = nil - } - z.PhotoID = x.PhotoID - z.DeletedPhotoIDs = append(z.DeletedPhotoIDs[:0], x.DeletedPhotoIDs...) -} - -func (x *UpdateUserPhoto) Clone() *UpdateUserPhoto { - z := &UpdateUserPhoto{} - x.DeepCopy(z) - return z -} - -func (x *UpdateUserPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateUserPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateUserPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateUserPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateUserPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateUserPhoto, x) -} - -const C_UpdateNotifySettings int64 = 3187524885 - -type poolUpdateNotifySettings struct { - pool sync.Pool -} - -func (p *poolUpdateNotifySettings) Get() *UpdateNotifySettings { - x, ok := p.pool.Get().(*UpdateNotifySettings) - if !ok { - x = &UpdateNotifySettings{} - } - - x.NotifyPeer = PoolPeer.Get() - - x.Settings = PoolPeerNotifySettings.Get() - - return x -} - -func (p *poolUpdateNotifySettings) Put(x *UpdateNotifySettings) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - x.UserID = 0 - PoolPeer.Put(x.NotifyPeer) - PoolPeerNotifySettings.Put(x.Settings) - - p.pool.Put(x) -} - -var PoolUpdateNotifySettings = poolUpdateNotifySettings{} - -func (x *UpdateNotifySettings) DeepCopy(z *UpdateNotifySettings) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - z.UserID = x.UserID - if x.NotifyPeer != nil { - if z.NotifyPeer == nil { - z.NotifyPeer = PoolPeer.Get() - } - x.NotifyPeer.DeepCopy(z.NotifyPeer) - } else { - PoolPeer.Put(z.NotifyPeer) - z.NotifyPeer = nil - } - if x.Settings != nil { - if z.Settings == nil { - z.Settings = PoolPeerNotifySettings.Get() - } - x.Settings.DeepCopy(z.Settings) - } else { - PoolPeerNotifySettings.Put(z.Settings) - z.Settings = nil - } -} - -func (x *UpdateNotifySettings) Clone() *UpdateNotifySettings { - z := &UpdateNotifySettings{} - x.DeepCopy(z) - return z -} - -func (x *UpdateNotifySettings) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateNotifySettings) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateNotifySettings) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateNotifySettings) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateNotifySettings) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateNotifySettings, x) -} - -const C_UpdateGroupParticipantAdd int64 = 1623827837 - -type poolUpdateGroupParticipantAdd struct { - pool sync.Pool -} - -func (p *poolUpdateGroupParticipantAdd) Get() *UpdateGroupParticipantAdd { - x, ok := p.pool.Get().(*UpdateGroupParticipantAdd) - if !ok { - x = &UpdateGroupParticipantAdd{} - } - - return x -} - -func (p *poolUpdateGroupParticipantAdd) Put(x *UpdateGroupParticipantAdd) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.GroupID = 0 - x.UserID = 0 - x.InviterID = 0 - x.Date = 0 - - p.pool.Put(x) -} - -var PoolUpdateGroupParticipantAdd = poolUpdateGroupParticipantAdd{} - -func (x *UpdateGroupParticipantAdd) DeepCopy(z *UpdateGroupParticipantAdd) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.GroupID = x.GroupID - z.UserID = x.UserID - z.InviterID = x.InviterID - z.Date = x.Date -} - -func (x *UpdateGroupParticipantAdd) Clone() *UpdateGroupParticipantAdd { - z := &UpdateGroupParticipantAdd{} - x.DeepCopy(z) - return z -} - -func (x *UpdateGroupParticipantAdd) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateGroupParticipantAdd) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateGroupParticipantAdd) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateGroupParticipantAdd) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateGroupParticipantAdd) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateGroupParticipantAdd, x) -} - -const C_UpdateGroupParticipantDeleted int64 = 2489941844 - -type poolUpdateGroupParticipantDeleted struct { - pool sync.Pool -} - -func (p *poolUpdateGroupParticipantDeleted) Get() *UpdateGroupParticipantDeleted { - x, ok := p.pool.Get().(*UpdateGroupParticipantDeleted) - if !ok { - x = &UpdateGroupParticipantDeleted{} - } - - return x -} - -func (p *poolUpdateGroupParticipantDeleted) Put(x *UpdateGroupParticipantDeleted) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.GroupID = 0 - x.UserID = 0 - - p.pool.Put(x) -} - -var PoolUpdateGroupParticipantDeleted = poolUpdateGroupParticipantDeleted{} - -func (x *UpdateGroupParticipantDeleted) DeepCopy(z *UpdateGroupParticipantDeleted) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.GroupID = x.GroupID - z.UserID = x.UserID -} - -func (x *UpdateGroupParticipantDeleted) Clone() *UpdateGroupParticipantDeleted { - z := &UpdateGroupParticipantDeleted{} - x.DeepCopy(z) - return z -} - -func (x *UpdateGroupParticipantDeleted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateGroupParticipantDeleted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateGroupParticipantDeleted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateGroupParticipantDeleted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateGroupParticipantDeleted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateGroupParticipantDeleted, x) -} - -const C_UpdateGroupParticipantAdmin int64 = 1813022164 - -type poolUpdateGroupParticipantAdmin struct { - pool sync.Pool -} - -func (p *poolUpdateGroupParticipantAdmin) Get() *UpdateGroupParticipantAdmin { - x, ok := p.pool.Get().(*UpdateGroupParticipantAdmin) - if !ok { - x = &UpdateGroupParticipantAdmin{} - } - - return x -} - -func (p *poolUpdateGroupParticipantAdmin) Put(x *UpdateGroupParticipantAdmin) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.GroupID = 0 - x.UserID = 0 - x.IsAdmin = false - - p.pool.Put(x) -} - -var PoolUpdateGroupParticipantAdmin = poolUpdateGroupParticipantAdmin{} - -func (x *UpdateGroupParticipantAdmin) DeepCopy(z *UpdateGroupParticipantAdmin) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.GroupID = x.GroupID - z.UserID = x.UserID - z.IsAdmin = x.IsAdmin -} - -func (x *UpdateGroupParticipantAdmin) Clone() *UpdateGroupParticipantAdmin { - z := &UpdateGroupParticipantAdmin{} - x.DeepCopy(z) - return z -} - -func (x *UpdateGroupParticipantAdmin) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateGroupParticipantAdmin) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateGroupParticipantAdmin) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateGroupParticipantAdmin) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateGroupParticipantAdmin) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateGroupParticipantAdmin, x) -} - -const C_UpdateGroupAdmins int64 = 694155405 - -type poolUpdateGroupAdmins struct { - pool sync.Pool -} - -func (p *poolUpdateGroupAdmins) Get() *UpdateGroupAdmins { - x, ok := p.pool.Get().(*UpdateGroupAdmins) - if !ok { - x = &UpdateGroupAdmins{} - } - - return x -} - -func (p *poolUpdateGroupAdmins) Put(x *UpdateGroupAdmins) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.GroupID = 0 - x.AdminEnabled = false - - p.pool.Put(x) -} - -var PoolUpdateGroupAdmins = poolUpdateGroupAdmins{} - -func (x *UpdateGroupAdmins) DeepCopy(z *UpdateGroupAdmins) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.GroupID = x.GroupID - z.AdminEnabled = x.AdminEnabled -} - -func (x *UpdateGroupAdmins) Clone() *UpdateGroupAdmins { - z := &UpdateGroupAdmins{} - x.DeepCopy(z) - return z -} - -func (x *UpdateGroupAdmins) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateGroupAdmins) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateGroupAdmins) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateGroupAdmins) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateGroupAdmins) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateGroupAdmins, x) -} - -const C_UpdateGroupAdminOnly int64 = 691550776 - -type poolUpdateGroupAdminOnly struct { - pool sync.Pool -} - -func (p *poolUpdateGroupAdminOnly) Get() *UpdateGroupAdminOnly { - x, ok := p.pool.Get().(*UpdateGroupAdminOnly) - if !ok { - x = &UpdateGroupAdminOnly{} - } - - return x -} - -func (p *poolUpdateGroupAdminOnly) Put(x *UpdateGroupAdminOnly) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.GroupID = 0 - x.AdminOnly = false - - p.pool.Put(x) -} - -var PoolUpdateGroupAdminOnly = poolUpdateGroupAdminOnly{} - -func (x *UpdateGroupAdminOnly) DeepCopy(z *UpdateGroupAdminOnly) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.GroupID = x.GroupID - z.AdminOnly = x.AdminOnly -} - -func (x *UpdateGroupAdminOnly) Clone() *UpdateGroupAdminOnly { - z := &UpdateGroupAdminOnly{} - x.DeepCopy(z) - return z -} - -func (x *UpdateGroupAdminOnly) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateGroupAdminOnly) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateGroupAdminOnly) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateGroupAdminOnly) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateGroupAdminOnly) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateGroupAdminOnly, x) -} - -const C_UpdateGroupPhoto int64 = 367193154 - -type poolUpdateGroupPhoto struct { - pool sync.Pool -} - -func (p *poolUpdateGroupPhoto) Get() *UpdateGroupPhoto { - x, ok := p.pool.Get().(*UpdateGroupPhoto) - if !ok { - x = &UpdateGroupPhoto{} - } - - x.Photo = PoolGroupPhoto.Get() - - return x -} - -func (p *poolUpdateGroupPhoto) Put(x *UpdateGroupPhoto) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.GroupID = 0 - PoolGroupPhoto.Put(x.Photo) - x.PhotoID = 0 - - p.pool.Put(x) -} - -var PoolUpdateGroupPhoto = poolUpdateGroupPhoto{} - -func (x *UpdateGroupPhoto) DeepCopy(z *UpdateGroupPhoto) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.GroupID = x.GroupID - if x.Photo != nil { - if z.Photo == nil { - z.Photo = PoolGroupPhoto.Get() - } - x.Photo.DeepCopy(z.Photo) - } else { - PoolGroupPhoto.Put(z.Photo) - z.Photo = nil - } - z.PhotoID = x.PhotoID -} - -func (x *UpdateGroupPhoto) Clone() *UpdateGroupPhoto { - z := &UpdateGroupPhoto{} - x.DeepCopy(z) - return z -} - -func (x *UpdateGroupPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateGroupPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateGroupPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateGroupPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateGroupPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateGroupPhoto, x) -} - -const C_UpdateReadMessagesContents int64 = 2991403048 - -type poolUpdateReadMessagesContents struct { - pool sync.Pool -} - -func (p *poolUpdateReadMessagesContents) Get() *UpdateReadMessagesContents { - x, ok := p.pool.Get().(*UpdateReadMessagesContents) - if !ok { - x = &UpdateReadMessagesContents{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateReadMessagesContents) Put(x *UpdateReadMessagesContents) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - x.MessageIDs = x.MessageIDs[:0] - PoolPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolUpdateReadMessagesContents = poolUpdateReadMessagesContents{} - -func (x *UpdateReadMessagesContents) DeepCopy(z *UpdateReadMessagesContents) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *UpdateReadMessagesContents) Clone() *UpdateReadMessagesContents { - z := &UpdateReadMessagesContents{} - x.DeepCopy(z) - return z -} - -func (x *UpdateReadMessagesContents) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateReadMessagesContents) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateReadMessagesContents) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateReadMessagesContents) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateReadMessagesContents) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateReadMessagesContents, x) -} - -const C_UpdateAuthorizationReset int64 = 2359297647 - -type poolUpdateAuthorizationReset struct { - pool sync.Pool -} - -func (p *poolUpdateAuthorizationReset) Get() *UpdateAuthorizationReset { - x, ok := p.pool.Get().(*UpdateAuthorizationReset) - if !ok { - x = &UpdateAuthorizationReset{} - } - - return x -} - -func (p *poolUpdateAuthorizationReset) Put(x *UpdateAuthorizationReset) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - - p.pool.Put(x) -} - -var PoolUpdateAuthorizationReset = poolUpdateAuthorizationReset{} - -func (x *UpdateAuthorizationReset) DeepCopy(z *UpdateAuthorizationReset) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID -} - -func (x *UpdateAuthorizationReset) Clone() *UpdateAuthorizationReset { - z := &UpdateAuthorizationReset{} - x.DeepCopy(z) - return z -} - -func (x *UpdateAuthorizationReset) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateAuthorizationReset) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateAuthorizationReset) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateAuthorizationReset) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateAuthorizationReset) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateAuthorizationReset, x) -} - -const C_UpdateDraftMessage int64 = 3453026195 - -type poolUpdateDraftMessage struct { - pool sync.Pool -} - -func (p *poolUpdateDraftMessage) Get() *UpdateDraftMessage { - x, ok := p.pool.Get().(*UpdateDraftMessage) - if !ok { - x = &UpdateDraftMessage{} - } - - x.Message = PoolDraftMessage.Get() - - return x -} - -func (p *poolUpdateDraftMessage) Put(x *UpdateDraftMessage) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - PoolDraftMessage.Put(x.Message) - - p.pool.Put(x) -} - -var PoolUpdateDraftMessage = poolUpdateDraftMessage{} - -func (x *UpdateDraftMessage) DeepCopy(z *UpdateDraftMessage) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - if x.Message != nil { - if z.Message == nil { - z.Message = PoolDraftMessage.Get() - } - x.Message.DeepCopy(z.Message) - } else { - PoolDraftMessage.Put(z.Message) - z.Message = nil - } -} - -func (x *UpdateDraftMessage) Clone() *UpdateDraftMessage { - z := &UpdateDraftMessage{} - x.DeepCopy(z) - return z -} - -func (x *UpdateDraftMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateDraftMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateDraftMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateDraftMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateDraftMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateDraftMessage, x) -} - -const C_UpdateDraftMessageCleared int64 = 2011635602 - -type poolUpdateDraftMessageCleared struct { - pool sync.Pool -} - -func (p *poolUpdateDraftMessageCleared) Get() *UpdateDraftMessageCleared { - x, ok := p.pool.Get().(*UpdateDraftMessageCleared) - if !ok { - x = &UpdateDraftMessageCleared{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateDraftMessageCleared) Put(x *UpdateDraftMessageCleared) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolUpdateDraftMessageCleared = poolUpdateDraftMessageCleared{} - -func (x *UpdateDraftMessageCleared) DeepCopy(z *UpdateDraftMessageCleared) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *UpdateDraftMessageCleared) Clone() *UpdateDraftMessageCleared { - z := &UpdateDraftMessageCleared{} - x.DeepCopy(z) - return z -} - -func (x *UpdateDraftMessageCleared) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateDraftMessageCleared) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateDraftMessageCleared) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateDraftMessageCleared) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateDraftMessageCleared) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateDraftMessageCleared, x) -} - -const C_UpdateDialogPinned int64 = 231538299 - -type poolUpdateDialogPinned struct { - pool sync.Pool -} - -func (p *poolUpdateDialogPinned) Get() *UpdateDialogPinned { - x, ok := p.pool.Get().(*UpdateDialogPinned) - if !ok { - x = &UpdateDialogPinned{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateDialogPinned) Put(x *UpdateDialogPinned) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolPeer.Put(x.Peer) - x.Pinned = false - - p.pool.Put(x) -} - -var PoolUpdateDialogPinned = poolUpdateDialogPinned{} - -func (x *UpdateDialogPinned) DeepCopy(z *UpdateDialogPinned) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.Pinned = x.Pinned -} - -func (x *UpdateDialogPinned) Clone() *UpdateDialogPinned { - z := &UpdateDialogPinned{} - x.DeepCopy(z) - return z -} - -func (x *UpdateDialogPinned) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateDialogPinned) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateDialogPinned) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateDialogPinned) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateDialogPinned) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateDialogPinned, x) -} - -const C_UpdateDialogPinnedReorder int64 = 1567423539 - -type poolUpdateDialogPinnedReorder struct { - pool sync.Pool -} - -func (p *poolUpdateDialogPinnedReorder) Get() *UpdateDialogPinnedReorder { - x, ok := p.pool.Get().(*UpdateDialogPinnedReorder) - if !ok { - x = &UpdateDialogPinnedReorder{} - } - - return x -} - -func (p *poolUpdateDialogPinnedReorder) Put(x *UpdateDialogPinnedReorder) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - for _, z := range x.Peer { - PoolPeer.Put(z) - } - x.Peer = x.Peer[:0] - - p.pool.Put(x) -} - -var PoolUpdateDialogPinnedReorder = poolUpdateDialogPinnedReorder{} - -func (x *UpdateDialogPinnedReorder) DeepCopy(z *UpdateDialogPinnedReorder) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - for idx := range x.Peer { - if x.Peer[idx] == nil { - continue - } - xx := PoolPeer.Get() - x.Peer[idx].DeepCopy(xx) - z.Peer = append(z.Peer, xx) - } -} - -func (x *UpdateDialogPinnedReorder) Clone() *UpdateDialogPinnedReorder { - z := &UpdateDialogPinnedReorder{} - x.DeepCopy(z) - return z -} - -func (x *UpdateDialogPinnedReorder) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateDialogPinnedReorder) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateDialogPinnedReorder) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateDialogPinnedReorder) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateDialogPinnedReorder) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateDialogPinnedReorder, x) -} - -const C_UpdateAccountPrivacy int64 = 629173761 - -type poolUpdateAccountPrivacy struct { - pool sync.Pool -} - -func (p *poolUpdateAccountPrivacy) Get() *UpdateAccountPrivacy { - x, ok := p.pool.Get().(*UpdateAccountPrivacy) - if !ok { - x = &UpdateAccountPrivacy{} - } - - return x -} - -func (p *poolUpdateAccountPrivacy) Put(x *UpdateAccountPrivacy) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - for _, z := range x.ChatInvite { - PoolPrivacyRule.Put(z) - } - x.ChatInvite = x.ChatInvite[:0] - for _, z := range x.LastSeen { - PoolPrivacyRule.Put(z) - } - x.LastSeen = x.LastSeen[:0] - for _, z := range x.PhoneNumber { - PoolPrivacyRule.Put(z) - } - x.PhoneNumber = x.PhoneNumber[:0] - for _, z := range x.ProfilePhoto { - PoolPrivacyRule.Put(z) - } - x.ProfilePhoto = x.ProfilePhoto[:0] - for _, z := range x.ForwardedMessage { - PoolPrivacyRule.Put(z) - } - x.ForwardedMessage = x.ForwardedMessage[:0] - for _, z := range x.Call { - PoolPrivacyRule.Put(z) - } - x.Call = x.Call[:0] - - p.pool.Put(x) -} - -var PoolUpdateAccountPrivacy = poolUpdateAccountPrivacy{} - -func (x *UpdateAccountPrivacy) DeepCopy(z *UpdateAccountPrivacy) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - for idx := range x.ChatInvite { - if x.ChatInvite[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.ChatInvite[idx].DeepCopy(xx) - z.ChatInvite = append(z.ChatInvite, xx) - } - for idx := range x.LastSeen { - if x.LastSeen[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.LastSeen[idx].DeepCopy(xx) - z.LastSeen = append(z.LastSeen, xx) - } - for idx := range x.PhoneNumber { - if x.PhoneNumber[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.PhoneNumber[idx].DeepCopy(xx) - z.PhoneNumber = append(z.PhoneNumber, xx) - } - for idx := range x.ProfilePhoto { - if x.ProfilePhoto[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.ProfilePhoto[idx].DeepCopy(xx) - z.ProfilePhoto = append(z.ProfilePhoto, xx) - } - for idx := range x.ForwardedMessage { - if x.ForwardedMessage[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.ForwardedMessage[idx].DeepCopy(xx) - z.ForwardedMessage = append(z.ForwardedMessage, xx) - } - for idx := range x.Call { - if x.Call[idx] == nil { - continue - } - xx := PoolPrivacyRule.Get() - x.Call[idx].DeepCopy(xx) - z.Call = append(z.Call, xx) - } -} - -func (x *UpdateAccountPrivacy) Clone() *UpdateAccountPrivacy { - z := &UpdateAccountPrivacy{} - x.DeepCopy(z) - return z -} - -func (x *UpdateAccountPrivacy) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateAccountPrivacy) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateAccountPrivacy) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateAccountPrivacy) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateAccountPrivacy) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateAccountPrivacy, x) -} - -const C_UpdateLabelItemsAdded int64 = 2216022057 - -type poolUpdateLabelItemsAdded struct { - pool sync.Pool -} - -func (p *poolUpdateLabelItemsAdded) Get() *UpdateLabelItemsAdded { - x, ok := p.pool.Get().(*UpdateLabelItemsAdded) - if !ok { - x = &UpdateLabelItemsAdded{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateLabelItemsAdded) Put(x *UpdateLabelItemsAdded) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolPeer.Put(x.Peer) - x.MessageIDs = x.MessageIDs[:0] - x.LabelIDs = x.LabelIDs[:0] - for _, z := range x.Labels { - PoolLabel.Put(z) - } - x.Labels = x.Labels[:0] - - p.pool.Put(x) -} - -var PoolUpdateLabelItemsAdded = poolUpdateLabelItemsAdded{} - -func (x *UpdateLabelItemsAdded) DeepCopy(z *UpdateLabelItemsAdded) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) - z.LabelIDs = append(z.LabelIDs[:0], x.LabelIDs...) - for idx := range x.Labels { - if x.Labels[idx] == nil { - continue - } - xx := PoolLabel.Get() - x.Labels[idx].DeepCopy(xx) - z.Labels = append(z.Labels, xx) - } -} - -func (x *UpdateLabelItemsAdded) Clone() *UpdateLabelItemsAdded { - z := &UpdateLabelItemsAdded{} - x.DeepCopy(z) - return z -} - -func (x *UpdateLabelItemsAdded) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateLabelItemsAdded) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateLabelItemsAdded) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateLabelItemsAdded) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateLabelItemsAdded) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateLabelItemsAdded, x) -} - -const C_UpdateLabelItemsRemoved int64 = 830226827 - -type poolUpdateLabelItemsRemoved struct { - pool sync.Pool -} - -func (p *poolUpdateLabelItemsRemoved) Get() *UpdateLabelItemsRemoved { - x, ok := p.pool.Get().(*UpdateLabelItemsRemoved) - if !ok { - x = &UpdateLabelItemsRemoved{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateLabelItemsRemoved) Put(x *UpdateLabelItemsRemoved) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolPeer.Put(x.Peer) - x.MessageIDs = x.MessageIDs[:0] - x.LabelIDs = x.LabelIDs[:0] - for _, z := range x.Labels { - PoolLabel.Put(z) - } - x.Labels = x.Labels[:0] - - p.pool.Put(x) -} - -var PoolUpdateLabelItemsRemoved = poolUpdateLabelItemsRemoved{} - -func (x *UpdateLabelItemsRemoved) DeepCopy(z *UpdateLabelItemsRemoved) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageIDs = append(z.MessageIDs[:0], x.MessageIDs...) - z.LabelIDs = append(z.LabelIDs[:0], x.LabelIDs...) - for idx := range x.Labels { - if x.Labels[idx] == nil { - continue - } - xx := PoolLabel.Get() - x.Labels[idx].DeepCopy(xx) - z.Labels = append(z.Labels, xx) - } -} - -func (x *UpdateLabelItemsRemoved) Clone() *UpdateLabelItemsRemoved { - z := &UpdateLabelItemsRemoved{} - x.DeepCopy(z) - return z -} - -func (x *UpdateLabelItemsRemoved) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateLabelItemsRemoved) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateLabelItemsRemoved) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateLabelItemsRemoved) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateLabelItemsRemoved) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateLabelItemsRemoved, x) -} - -const C_UpdateLabelSet int64 = 2353687359 - -type poolUpdateLabelSet struct { - pool sync.Pool -} - -func (p *poolUpdateLabelSet) Get() *UpdateLabelSet { - x, ok := p.pool.Get().(*UpdateLabelSet) - if !ok { - x = &UpdateLabelSet{} - } - - return x -} - -func (p *poolUpdateLabelSet) Put(x *UpdateLabelSet) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - for _, z := range x.Labels { - PoolLabel.Put(z) - } - x.Labels = x.Labels[:0] - - p.pool.Put(x) -} - -var PoolUpdateLabelSet = poolUpdateLabelSet{} - -func (x *UpdateLabelSet) DeepCopy(z *UpdateLabelSet) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - for idx := range x.Labels { - if x.Labels[idx] == nil { - continue - } - xx := PoolLabel.Get() - x.Labels[idx].DeepCopy(xx) - z.Labels = append(z.Labels, xx) - } -} - -func (x *UpdateLabelSet) Clone() *UpdateLabelSet { - z := &UpdateLabelSet{} - x.DeepCopy(z) - return z -} - -func (x *UpdateLabelSet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateLabelSet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateLabelSet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateLabelSet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateLabelSet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateLabelSet, x) -} - -const C_UpdateLabelDeleted int64 = 3702192307 - -type poolUpdateLabelDeleted struct { - pool sync.Pool -} - -func (p *poolUpdateLabelDeleted) Get() *UpdateLabelDeleted { - x, ok := p.pool.Get().(*UpdateLabelDeleted) - if !ok { - x = &UpdateLabelDeleted{} - } - - return x -} - -func (p *poolUpdateLabelDeleted) Put(x *UpdateLabelDeleted) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.LabelIDs = x.LabelIDs[:0] - - p.pool.Put(x) -} - -var PoolUpdateLabelDeleted = poolUpdateLabelDeleted{} - -func (x *UpdateLabelDeleted) DeepCopy(z *UpdateLabelDeleted) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.LabelIDs = append(z.LabelIDs[:0], x.LabelIDs...) -} - -func (x *UpdateLabelDeleted) Clone() *UpdateLabelDeleted { - z := &UpdateLabelDeleted{} - x.DeepCopy(z) - return z -} - -func (x *UpdateLabelDeleted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateLabelDeleted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateLabelDeleted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateLabelDeleted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateLabelDeleted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateLabelDeleted, x) -} - -const C_UpdateUserBlocked int64 = 3750625773 - -type poolUpdateUserBlocked struct { - pool sync.Pool -} - -func (p *poolUpdateUserBlocked) Get() *UpdateUserBlocked { - x, ok := p.pool.Get().(*UpdateUserBlocked) - if !ok { - x = &UpdateUserBlocked{} - } - - return x -} - -func (p *poolUpdateUserBlocked) Put(x *UpdateUserBlocked) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.UserID = 0 - x.Blocked = false - - p.pool.Put(x) -} - -var PoolUpdateUserBlocked = poolUpdateUserBlocked{} - -func (x *UpdateUserBlocked) DeepCopy(z *UpdateUserBlocked) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.UserID = x.UserID - z.Blocked = x.Blocked -} - -func (x *UpdateUserBlocked) Clone() *UpdateUserBlocked { - z := &UpdateUserBlocked{} - x.DeepCopy(z) - return z -} - -func (x *UpdateUserBlocked) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateUserBlocked) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateUserBlocked) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateUserBlocked) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateUserBlocked) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateUserBlocked, x) -} - -const C_UpdateMessagePoll int64 = 383248674 - -type poolUpdateMessagePoll struct { - pool sync.Pool -} - -func (p *poolUpdateMessagePoll) Get() *UpdateMessagePoll { - x, ok := p.pool.Get().(*UpdateMessagePoll) - if !ok { - x = &UpdateMessagePoll{} - } - - x.Poll = PoolMediaPoll.Get() - - x.Results = PoolPollResults.Get() - - return x -} - -func (p *poolUpdateMessagePoll) Put(x *UpdateMessagePoll) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.PollID = 0 - PoolMediaPoll.Put(x.Poll) - PoolPollResults.Put(x.Results) - - p.pool.Put(x) -} - -var PoolUpdateMessagePoll = poolUpdateMessagePoll{} - -func (x *UpdateMessagePoll) DeepCopy(z *UpdateMessagePoll) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.PollID = x.PollID - if x.Poll != nil { - if z.Poll == nil { - z.Poll = PoolMediaPoll.Get() - } - x.Poll.DeepCopy(z.Poll) - } else { - PoolMediaPoll.Put(z.Poll) - z.Poll = nil - } - if x.Results != nil { - if z.Results == nil { - z.Results = PoolPollResults.Get() - } - x.Results.DeepCopy(z.Results) - } else { - PoolPollResults.Put(z.Results) - z.Results = nil - } -} - -func (x *UpdateMessagePoll) Clone() *UpdateMessagePoll { - z := &UpdateMessagePoll{} - x.DeepCopy(z) - return z -} - -func (x *UpdateMessagePoll) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateMessagePoll) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateMessagePoll) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateMessagePoll) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateMessagePoll) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateMessagePoll, x) -} - -const C_UpdateBotCallbackQuery int64 = 3408999713 - -type poolUpdateBotCallbackQuery struct { - pool sync.Pool -} - -func (p *poolUpdateBotCallbackQuery) Get() *UpdateBotCallbackQuery { - x, ok := p.pool.Get().(*UpdateBotCallbackQuery) - if !ok { - x = &UpdateBotCallbackQuery{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdateBotCallbackQuery) Put(x *UpdateBotCallbackQuery) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.QueryID = 0 - x.UserID = 0 - PoolPeer.Put(x.Peer) - x.MessageID = 0 - x.Data = x.Data[:0] - x.TeamID = 0 - - p.pool.Put(x) -} - -var PoolUpdateBotCallbackQuery = poolUpdateBotCallbackQuery{} - -func (x *UpdateBotCallbackQuery) DeepCopy(z *UpdateBotCallbackQuery) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.QueryID = x.QueryID - z.UserID = x.UserID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.MessageID = x.MessageID - z.Data = append(z.Data[:0], x.Data...) - z.TeamID = x.TeamID -} - -func (x *UpdateBotCallbackQuery) Clone() *UpdateBotCallbackQuery { - z := &UpdateBotCallbackQuery{} - x.DeepCopy(z) - return z -} - -func (x *UpdateBotCallbackQuery) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateBotCallbackQuery) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateBotCallbackQuery) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateBotCallbackQuery) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateBotCallbackQuery) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateBotCallbackQuery, x) -} - -const C_UpdateBotInlineQuery int64 = 4065328876 - -type poolUpdateBotInlineQuery struct { - pool sync.Pool -} - -func (p *poolUpdateBotInlineQuery) Get() *UpdateBotInlineQuery { - x, ok := p.pool.Get().(*UpdateBotInlineQuery) - if !ok { - x = &UpdateBotInlineQuery{} - } - - x.Peer = PoolPeer.Get() - - x.Geo = PoolGeoLocation.Get() - - return x -} - -func (p *poolUpdateBotInlineQuery) Put(x *UpdateBotInlineQuery) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.QueryID = 0 - x.UserID = 0 - PoolPeer.Put(x.Peer) - x.Query = "" - x.Offset = "" - PoolGeoLocation.Put(x.Geo) - x.TeamID = 0 - - p.pool.Put(x) -} - -var PoolUpdateBotInlineQuery = poolUpdateBotInlineQuery{} - -func (x *UpdateBotInlineQuery) DeepCopy(z *UpdateBotInlineQuery) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.QueryID = x.QueryID - z.UserID = x.UserID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.Query = x.Query - z.Offset = x.Offset - if x.Geo != nil { - if z.Geo == nil { - z.Geo = PoolGeoLocation.Get() - } - x.Geo.DeepCopy(z.Geo) - } else { - PoolGeoLocation.Put(z.Geo) - z.Geo = nil - } - z.TeamID = x.TeamID -} - -func (x *UpdateBotInlineQuery) Clone() *UpdateBotInlineQuery { - z := &UpdateBotInlineQuery{} - x.DeepCopy(z) - return z -} - -func (x *UpdateBotInlineQuery) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateBotInlineQuery) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateBotInlineQuery) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateBotInlineQuery) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateBotInlineQuery) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateBotInlineQuery, x) -} - -const C_UpdateBotInlineSend int64 = 2208028013 - -type poolUpdateBotInlineSend struct { - pool sync.Pool -} - -func (p *poolUpdateBotInlineSend) Get() *UpdateBotInlineSend { - x, ok := p.pool.Get().(*UpdateBotInlineSend) - if !ok { - x = &UpdateBotInlineSend{} - } - - x.Geo = PoolGeoLocation.Get() - - return x -} - -func (p *poolUpdateBotInlineSend) Put(x *UpdateBotInlineSend) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.UserID = 0 - x.Query = "" - x.ResultID = "" - PoolGeoLocation.Put(x.Geo) - - p.pool.Put(x) -} - -var PoolUpdateBotInlineSend = poolUpdateBotInlineSend{} - -func (x *UpdateBotInlineSend) DeepCopy(z *UpdateBotInlineSend) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.UserID = x.UserID - z.Query = x.Query - z.ResultID = x.ResultID - if x.Geo != nil { - if z.Geo == nil { - z.Geo = PoolGeoLocation.Get() - } - x.Geo.DeepCopy(z.Geo) - } else { - PoolGeoLocation.Put(z.Geo) - z.Geo = nil - } -} - -func (x *UpdateBotInlineSend) Clone() *UpdateBotInlineSend { - z := &UpdateBotInlineSend{} - x.DeepCopy(z) - return z -} - -func (x *UpdateBotInlineSend) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateBotInlineSend) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateBotInlineSend) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateBotInlineSend) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateBotInlineSend) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateBotInlineSend, x) -} - -const C_UpdateTeamCreated int64 = 2762932529 - -type poolUpdateTeamCreated struct { - pool sync.Pool -} - -func (p *poolUpdateTeamCreated) Get() *UpdateTeamCreated { - x, ok := p.pool.Get().(*UpdateTeamCreated) - if !ok { - x = &UpdateTeamCreated{} - } - - x.Team = PoolTeam.Get() - - return x -} - -func (p *poolUpdateTeamCreated) Put(x *UpdateTeamCreated) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - PoolTeam.Put(x.Team) - - p.pool.Put(x) -} - -var PoolUpdateTeamCreated = poolUpdateTeamCreated{} - -func (x *UpdateTeamCreated) DeepCopy(z *UpdateTeamCreated) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - if x.Team != nil { - if z.Team == nil { - z.Team = PoolTeam.Get() - } - x.Team.DeepCopy(z.Team) - } else { - PoolTeam.Put(z.Team) - z.Team = nil - } -} - -func (x *UpdateTeamCreated) Clone() *UpdateTeamCreated { - z := &UpdateTeamCreated{} - x.DeepCopy(z) - return z -} - -func (x *UpdateTeamCreated) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateTeamCreated) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateTeamCreated) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateTeamCreated) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateTeamCreated) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateTeamCreated, x) -} - -const C_UpdateTeamMemberAdded int64 = 1307755890 - -type poolUpdateTeamMemberAdded struct { - pool sync.Pool -} - -func (p *poolUpdateTeamMemberAdded) Get() *UpdateTeamMemberAdded { - x, ok := p.pool.Get().(*UpdateTeamMemberAdded) - if !ok { - x = &UpdateTeamMemberAdded{} - } - - x.User = PoolUser.Get() - - x.Contact = PoolContactUser.Get() - - return x -} - -func (p *poolUpdateTeamMemberAdded) Put(x *UpdateTeamMemberAdded) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolUser.Put(x.User) - PoolContactUser.Put(x.Contact) - x.AdderID = 0 - x.Hash = 0 - - p.pool.Put(x) -} - -var PoolUpdateTeamMemberAdded = poolUpdateTeamMemberAdded{} - -func (x *UpdateTeamMemberAdded) DeepCopy(z *UpdateTeamMemberAdded) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.User != nil { - if z.User == nil { - z.User = PoolUser.Get() - } - x.User.DeepCopy(z.User) - } else { - PoolUser.Put(z.User) - z.User = nil - } - if x.Contact != nil { - if z.Contact == nil { - z.Contact = PoolContactUser.Get() - } - x.Contact.DeepCopy(z.Contact) - } else { - PoolContactUser.Put(z.Contact) - z.Contact = nil - } - z.AdderID = x.AdderID - z.Hash = x.Hash -} - -func (x *UpdateTeamMemberAdded) Clone() *UpdateTeamMemberAdded { - z := &UpdateTeamMemberAdded{} - x.DeepCopy(z) - return z -} - -func (x *UpdateTeamMemberAdded) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateTeamMemberAdded) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateTeamMemberAdded) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateTeamMemberAdded) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateTeamMemberAdded) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateTeamMemberAdded, x) -} - -const C_UpdateTeamMemberRemoved int64 = 99543064 - -type poolUpdateTeamMemberRemoved struct { - pool sync.Pool -} - -func (p *poolUpdateTeamMemberRemoved) Get() *UpdateTeamMemberRemoved { - x, ok := p.pool.Get().(*UpdateTeamMemberRemoved) - if !ok { - x = &UpdateTeamMemberRemoved{} - } - - return x -} - -func (p *poolUpdateTeamMemberRemoved) Put(x *UpdateTeamMemberRemoved) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - x.UserID = 0 - x.RemoverID = 0 - x.Hash = 0 - - p.pool.Put(x) -} - -var PoolUpdateTeamMemberRemoved = poolUpdateTeamMemberRemoved{} - -func (x *UpdateTeamMemberRemoved) DeepCopy(z *UpdateTeamMemberRemoved) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - z.UserID = x.UserID - z.RemoverID = x.RemoverID - z.Hash = x.Hash -} - -func (x *UpdateTeamMemberRemoved) Clone() *UpdateTeamMemberRemoved { - z := &UpdateTeamMemberRemoved{} - x.DeepCopy(z) - return z -} - -func (x *UpdateTeamMemberRemoved) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateTeamMemberRemoved) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateTeamMemberRemoved) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateTeamMemberRemoved) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateTeamMemberRemoved) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateTeamMemberRemoved, x) -} - -const C_UpdateTeamMemberStatus int64 = 4065657769 - -type poolUpdateTeamMemberStatus struct { - pool sync.Pool -} - -func (p *poolUpdateTeamMemberStatus) Get() *UpdateTeamMemberStatus { - x, ok := p.pool.Get().(*UpdateTeamMemberStatus) - if !ok { - x = &UpdateTeamMemberStatus{} - } - - return x -} - -func (p *poolUpdateTeamMemberStatus) Put(x *UpdateTeamMemberStatus) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - x.ChangerID = 0 - x.Admin = false - - p.pool.Put(x) -} - -var PoolUpdateTeamMemberStatus = poolUpdateTeamMemberStatus{} - -func (x *UpdateTeamMemberStatus) DeepCopy(z *UpdateTeamMemberStatus) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - z.ChangerID = x.ChangerID - z.Admin = x.Admin -} - -func (x *UpdateTeamMemberStatus) Clone() *UpdateTeamMemberStatus { - z := &UpdateTeamMemberStatus{} - x.DeepCopy(z) - return z -} - -func (x *UpdateTeamMemberStatus) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateTeamMemberStatus) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateTeamMemberStatus) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateTeamMemberStatus) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateTeamMemberStatus) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateTeamMemberStatus, x) -} - -const C_UpdateTeamPhoto int64 = 3110088064 - -type poolUpdateTeamPhoto struct { - pool sync.Pool -} - -func (p *poolUpdateTeamPhoto) Get() *UpdateTeamPhoto { - x, ok := p.pool.Get().(*UpdateTeamPhoto) - if !ok { - x = &UpdateTeamPhoto{} - } - - x.Photo = PoolTeamPhoto.Get() - - return x -} - -func (p *poolUpdateTeamPhoto) Put(x *UpdateTeamPhoto) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolTeamPhoto.Put(x.Photo) - - p.pool.Put(x) -} - -var PoolUpdateTeamPhoto = poolUpdateTeamPhoto{} - -func (x *UpdateTeamPhoto) DeepCopy(z *UpdateTeamPhoto) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Photo != nil { - if z.Photo == nil { - z.Photo = PoolTeamPhoto.Get() - } - x.Photo.DeepCopy(z.Photo) - } else { - PoolTeamPhoto.Put(z.Photo) - z.Photo = nil - } -} - -func (x *UpdateTeamPhoto) Clone() *UpdateTeamPhoto { - z := &UpdateTeamPhoto{} - x.DeepCopy(z) - return z -} - -func (x *UpdateTeamPhoto) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateTeamPhoto) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateTeamPhoto) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateTeamPhoto) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateTeamPhoto) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateTeamPhoto, x) -} - -const C_UpdateTeam int64 = 2978180712 - -type poolUpdateTeam struct { - pool sync.Pool -} - -func (p *poolUpdateTeam) Get() *UpdateTeam { - x, ok := p.pool.Get().(*UpdateTeam) - if !ok { - x = &UpdateTeam{} - } - - return x -} - -func (p *poolUpdateTeam) Put(x *UpdateTeam) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - x.Name = "" - - p.pool.Put(x) -} - -var PoolUpdateTeam = poolUpdateTeam{} - -func (x *UpdateTeam) DeepCopy(z *UpdateTeam) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - z.Name = x.Name -} - -func (x *UpdateTeam) Clone() *UpdateTeam { - z := &UpdateTeam{} - x.DeepCopy(z) - return z -} - -func (x *UpdateTeam) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateTeam) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateTeam) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateTeam) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateTeam) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateTeam, x) -} - -const C_UpdateCommunityMessage int64 = 983926580 - -type poolUpdateCommunityMessage struct { - pool sync.Pool -} - -func (p *poolUpdateCommunityMessage) Get() *UpdateCommunityMessage { - x, ok := p.pool.Get().(*UpdateCommunityMessage) - if !ok { - x = &UpdateCommunityMessage{} - } - - return x -} - -func (p *poolUpdateCommunityMessage) Put(x *UpdateCommunityMessage) { - if x == nil { - return - } - - x.TeamID = 0 - x.SenderID = 0 - x.ReceiverID = 0 - x.Body = "" - x.CreatedOn = 0 - x.GlobalMsgID = 0 - for _, z := range x.Entities { - PoolMessageEntity.Put(z) - } - x.Entities = x.Entities[:0] - x.SenderMsgID = 0 - - p.pool.Put(x) -} - -var PoolUpdateCommunityMessage = poolUpdateCommunityMessage{} - -func (x *UpdateCommunityMessage) DeepCopy(z *UpdateCommunityMessage) { - z.TeamID = x.TeamID - z.SenderID = x.SenderID - z.ReceiverID = x.ReceiverID - z.Body = x.Body - z.CreatedOn = x.CreatedOn - z.GlobalMsgID = x.GlobalMsgID - for idx := range x.Entities { - if x.Entities[idx] == nil { - continue - } - xx := PoolMessageEntity.Get() - x.Entities[idx].DeepCopy(xx) - z.Entities = append(z.Entities, xx) - } - z.SenderMsgID = x.SenderMsgID -} - -func (x *UpdateCommunityMessage) Clone() *UpdateCommunityMessage { - z := &UpdateCommunityMessage{} - x.DeepCopy(z) - return z -} - -func (x *UpdateCommunityMessage) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateCommunityMessage) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateCommunityMessage) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateCommunityMessage) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateCommunityMessage) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateCommunityMessage, x) -} - -const C_UpdateCommunityReadOutbox int64 = 2094301834 - -type poolUpdateCommunityReadOutbox struct { - pool sync.Pool -} - -func (p *poolUpdateCommunityReadOutbox) Get() *UpdateCommunityReadOutbox { - x, ok := p.pool.Get().(*UpdateCommunityReadOutbox) - if !ok { - x = &UpdateCommunityReadOutbox{} - } - - return x -} - -func (p *poolUpdateCommunityReadOutbox) Put(x *UpdateCommunityReadOutbox) { - if x == nil { - return - } - - x.TeamID = 0 - x.SenderID = 0 - x.ReceiverID = 0 - x.SenderMsgID = 0 - - p.pool.Put(x) -} - -var PoolUpdateCommunityReadOutbox = poolUpdateCommunityReadOutbox{} - -func (x *UpdateCommunityReadOutbox) DeepCopy(z *UpdateCommunityReadOutbox) { - z.TeamID = x.TeamID - z.SenderID = x.SenderID - z.ReceiverID = x.ReceiverID - z.SenderMsgID = x.SenderMsgID -} - -func (x *UpdateCommunityReadOutbox) Clone() *UpdateCommunityReadOutbox { - z := &UpdateCommunityReadOutbox{} - x.DeepCopy(z) - return z -} - -func (x *UpdateCommunityReadOutbox) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateCommunityReadOutbox) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateCommunityReadOutbox) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateCommunityReadOutbox) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateCommunityReadOutbox) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateCommunityReadOutbox, x) -} - -const C_UpdateCommunityTyping int64 = 451491445 - -type poolUpdateCommunityTyping struct { - pool sync.Pool -} - -func (p *poolUpdateCommunityTyping) Get() *UpdateCommunityTyping { - x, ok := p.pool.Get().(*UpdateCommunityTyping) - if !ok { - x = &UpdateCommunityTyping{} - } - - return x -} - -func (p *poolUpdateCommunityTyping) Put(x *UpdateCommunityTyping) { - if x == nil { - return - } - - x.TeamID = 0 - x.SenderID = 0 - x.ReceiverID = 0 - x.Action = 0 - - p.pool.Put(x) -} - -var PoolUpdateCommunityTyping = poolUpdateCommunityTyping{} - -func (x *UpdateCommunityTyping) DeepCopy(z *UpdateCommunityTyping) { - z.TeamID = x.TeamID - z.SenderID = x.SenderID - z.ReceiverID = x.ReceiverID - z.Action = x.Action -} - -func (x *UpdateCommunityTyping) Clone() *UpdateCommunityTyping { - z := &UpdateCommunityTyping{} - x.DeepCopy(z) - return z -} - -func (x *UpdateCommunityTyping) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateCommunityTyping) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateCommunityTyping) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateCommunityTyping) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateCommunityTyping) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateCommunityTyping, x) -} - -const C_UpdateReaction int64 = 2738677245 - -type poolUpdateReaction struct { - pool sync.Pool -} - -func (p *poolUpdateReaction) Get() *UpdateReaction { - x, ok := p.pool.Get().(*UpdateReaction) - if !ok { - x = &UpdateReaction{} - } - - x.Peer = PoolPeer.Get() - - x.Sender = PoolUser.Get() - - return x -} - -func (p *poolUpdateReaction) Put(x *UpdateReaction) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.MessageID = 0 - for _, z := range x.Counter { - PoolReactionCounter.Put(z) - } - x.Counter = x.Counter[:0] - x.TeamID = 0 - PoolPeer.Put(x.Peer) - PoolUser.Put(x.Sender) - x.YourReactions = x.YourReactions[:0] - x.Reaction = "" - - p.pool.Put(x) -} - -var PoolUpdateReaction = poolUpdateReaction{} - -func (x *UpdateReaction) DeepCopy(z *UpdateReaction) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.MessageID = x.MessageID - for idx := range x.Counter { - if x.Counter[idx] == nil { - continue - } - xx := PoolReactionCounter.Get() - x.Counter[idx].DeepCopy(xx) - z.Counter = append(z.Counter, xx) - } - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - if x.Sender != nil { - if z.Sender == nil { - z.Sender = PoolUser.Get() - } - x.Sender.DeepCopy(z.Sender) - } else { - PoolUser.Put(z.Sender) - z.Sender = nil - } - z.YourReactions = append(z.YourReactions[:0], x.YourReactions...) - z.Reaction = x.Reaction -} - -func (x *UpdateReaction) Clone() *UpdateReaction { - z := &UpdateReaction{} - x.DeepCopy(z) - return z -} - -func (x *UpdateReaction) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateReaction) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateReaction) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateReaction) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateReaction) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateReaction, x) -} - -const C_UpdateCalendarEventAdded int64 = 297964741 - -type poolUpdateCalendarEventAdded struct { - pool sync.Pool -} - -func (p *poolUpdateCalendarEventAdded) Get() *UpdateCalendarEventAdded { - x, ok := p.pool.Get().(*UpdateCalendarEventAdded) - if !ok { - x = &UpdateCalendarEventAdded{} - } - - x.Event = PoolCalendarEvent.Get() - - return x -} - -func (p *poolUpdateCalendarEventAdded) Put(x *UpdateCalendarEventAdded) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - PoolCalendarEvent.Put(x.Event) - - p.pool.Put(x) -} - -var PoolUpdateCalendarEventAdded = poolUpdateCalendarEventAdded{} - -func (x *UpdateCalendarEventAdded) DeepCopy(z *UpdateCalendarEventAdded) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - if x.Event != nil { - if z.Event == nil { - z.Event = PoolCalendarEvent.Get() - } - x.Event.DeepCopy(z.Event) - } else { - PoolCalendarEvent.Put(z.Event) - z.Event = nil - } -} - -func (x *UpdateCalendarEventAdded) Clone() *UpdateCalendarEventAdded { - z := &UpdateCalendarEventAdded{} - x.DeepCopy(z) - return z -} - -func (x *UpdateCalendarEventAdded) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateCalendarEventAdded) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateCalendarEventAdded) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateCalendarEventAdded) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateCalendarEventAdded) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateCalendarEventAdded, x) -} - -const C_UpdateCalendarEventRemoved int64 = 2986798389 - -type poolUpdateCalendarEventRemoved struct { - pool sync.Pool -} - -func (p *poolUpdateCalendarEventRemoved) Get() *UpdateCalendarEventRemoved { - x, ok := p.pool.Get().(*UpdateCalendarEventRemoved) - if !ok { - x = &UpdateCalendarEventRemoved{} - } - - return x -} - -func (p *poolUpdateCalendarEventRemoved) Put(x *UpdateCalendarEventRemoved) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.EventID = 0 - - p.pool.Put(x) -} - -var PoolUpdateCalendarEventRemoved = poolUpdateCalendarEventRemoved{} - -func (x *UpdateCalendarEventRemoved) DeepCopy(z *UpdateCalendarEventRemoved) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.EventID = x.EventID -} - -func (x *UpdateCalendarEventRemoved) Clone() *UpdateCalendarEventRemoved { - z := &UpdateCalendarEventRemoved{} - x.DeepCopy(z) - return z -} - -func (x *UpdateCalendarEventRemoved) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateCalendarEventRemoved) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateCalendarEventRemoved) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateCalendarEventRemoved) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateCalendarEventRemoved) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateCalendarEventRemoved, x) -} - -const C_UpdateCalendarEventEdited int64 = 516349098 - -type poolUpdateCalendarEventEdited struct { - pool sync.Pool -} - -func (p *poolUpdateCalendarEventEdited) Get() *UpdateCalendarEventEdited { - x, ok := p.pool.Get().(*UpdateCalendarEventEdited) - if !ok { - x = &UpdateCalendarEventEdited{} - } - - x.Event = PoolCalendarEvent.Get() - - return x -} - -func (p *poolUpdateCalendarEventEdited) Put(x *UpdateCalendarEventEdited) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - PoolCalendarEvent.Put(x.Event) - - p.pool.Put(x) -} - -var PoolUpdateCalendarEventEdited = poolUpdateCalendarEventEdited{} - -func (x *UpdateCalendarEventEdited) DeepCopy(z *UpdateCalendarEventEdited) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - if x.Event != nil { - if z.Event == nil { - z.Event = PoolCalendarEvent.Get() - } - x.Event.DeepCopy(z.Event) - } else { - PoolCalendarEvent.Put(z.Event) - z.Event = nil - } -} - -func (x *UpdateCalendarEventEdited) Clone() *UpdateCalendarEventEdited { - z := &UpdateCalendarEventEdited{} - x.DeepCopy(z) - return z -} - -func (x *UpdateCalendarEventEdited) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateCalendarEventEdited) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateCalendarEventEdited) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateCalendarEventEdited) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateCalendarEventEdited) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateCalendarEventEdited, x) -} - -const C_UpdateRedirect int64 = 3303504929 - -type poolUpdateRedirect struct { - pool sync.Pool -} - -func (p *poolUpdateRedirect) Get() *UpdateRedirect { - x, ok := p.pool.Get().(*UpdateRedirect) - if !ok { - x = &UpdateRedirect{} - } - - return x -} - -func (p *poolUpdateRedirect) Put(x *UpdateRedirect) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - for _, z := range x.Redirects { - PoolClientRedirect.Put(z) - } - x.Redirects = x.Redirects[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolUpdateRedirect = poolUpdateRedirect{} - -func (x *UpdateRedirect) DeepCopy(z *UpdateRedirect) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - for idx := range x.Redirects { - if x.Redirects[idx] == nil { - continue - } - xx := PoolClientRedirect.Get() - x.Redirects[idx].DeepCopy(xx) - z.Redirects = append(z.Redirects, xx) - } - z.Empty = x.Empty -} - -func (x *UpdateRedirect) Clone() *UpdateRedirect { - z := &UpdateRedirect{} - x.DeepCopy(z) - return z -} - -func (x *UpdateRedirect) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdateRedirect) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdateRedirect) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdateRedirect) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdateRedirect) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdateRedirect, x) -} - -const C_ClientRedirect int64 = 3513459109 - -type poolClientRedirect struct { - pool sync.Pool -} - -func (p *poolClientRedirect) Get() *ClientRedirect { - x, ok := p.pool.Get().(*ClientRedirect) - if !ok { - x = &ClientRedirect{} - } - - return x -} - -func (p *poolClientRedirect) Put(x *ClientRedirect) { - if x == nil { - return - } - - x.HostPort = "" - x.Permanent = false - x.Target = 0 - x.Alternatives = x.Alternatives[:0] - - p.pool.Put(x) -} - -var PoolClientRedirect = poolClientRedirect{} - -func (x *ClientRedirect) DeepCopy(z *ClientRedirect) { - z.HostPort = x.HostPort - z.Permanent = x.Permanent - z.Target = x.Target - z.Alternatives = append(z.Alternatives[:0], x.Alternatives...) -} - -func (x *ClientRedirect) Clone() *ClientRedirect { - z := &ClientRedirect{} - x.DeepCopy(z) - return z -} - -func (x *ClientRedirect) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *ClientRedirect) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *ClientRedirect) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *ClientRedirect) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *ClientRedirect) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_ClientRedirect, x) -} - -const C_UpdatePhoneCall int64 = 2791086990 - -type poolUpdatePhoneCall struct { - pool sync.Pool -} - -func (p *poolUpdatePhoneCall) Get() *UpdatePhoneCall { - x, ok := p.pool.Get().(*UpdatePhoneCall) - if !ok { - x = &UpdatePhoneCall{} - } - - return x -} - -func (p *poolUpdatePhoneCall) Put(x *UpdatePhoneCall) { - if x == nil { - return - } - - x.UCount = 0 - x.TeamID = 0 - x.PeerID = 0 - x.PeerType = 0 - x.CallID = 0 - x.UserID = 0 - x.AccessHash = 0 - x.Action = 0 - x.ActionData = x.ActionData[:0] - x.Timestamp = 0 - - p.pool.Put(x) -} - -var PoolUpdatePhoneCall = poolUpdatePhoneCall{} - -func (x *UpdatePhoneCall) DeepCopy(z *UpdatePhoneCall) { - z.UCount = x.UCount - z.TeamID = x.TeamID - z.PeerID = x.PeerID - z.PeerType = x.PeerType - z.CallID = x.CallID - z.UserID = x.UserID - z.AccessHash = x.AccessHash - z.Action = x.Action - z.ActionData = append(z.ActionData[:0], x.ActionData...) - z.Timestamp = x.Timestamp -} - -func (x *UpdatePhoneCall) Clone() *UpdatePhoneCall { - z := &UpdatePhoneCall{} - x.DeepCopy(z) - return z -} - -func (x *UpdatePhoneCall) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdatePhoneCall) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdatePhoneCall) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdatePhoneCall) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdatePhoneCall) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdatePhoneCall, x) -} - -const C_UpdatePhoneCallStarted int64 = 1094761594 - -type poolUpdatePhoneCallStarted struct { - pool sync.Pool -} - -func (p *poolUpdatePhoneCallStarted) Get() *UpdatePhoneCallStarted { - x, ok := p.pool.Get().(*UpdatePhoneCallStarted) - if !ok { - x = &UpdatePhoneCallStarted{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdatePhoneCallStarted) Put(x *UpdatePhoneCallStarted) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolPeer.Put(x.Peer) - x.CallId = 0 - - p.pool.Put(x) -} - -var PoolUpdatePhoneCallStarted = poolUpdatePhoneCallStarted{} - -func (x *UpdatePhoneCallStarted) DeepCopy(z *UpdatePhoneCallStarted) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } - z.CallId = x.CallId -} - -func (x *UpdatePhoneCallStarted) Clone() *UpdatePhoneCallStarted { - z := &UpdatePhoneCallStarted{} - x.DeepCopy(z) - return z -} - -func (x *UpdatePhoneCallStarted) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdatePhoneCallStarted) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdatePhoneCallStarted) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdatePhoneCallStarted) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdatePhoneCallStarted) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdatePhoneCallStarted, x) -} - -const C_UpdatePhoneCallEnded int64 = 1764711846 - -type poolUpdatePhoneCallEnded struct { - pool sync.Pool -} - -func (p *poolUpdatePhoneCallEnded) Get() *UpdatePhoneCallEnded { - x, ok := p.pool.Get().(*UpdatePhoneCallEnded) - if !ok { - x = &UpdatePhoneCallEnded{} - } - - x.Peer = PoolPeer.Get() - - return x -} - -func (p *poolUpdatePhoneCallEnded) Put(x *UpdatePhoneCallEnded) { - if x == nil { - return - } - - x.UCount = 0 - x.UpdateID = 0 - x.TeamID = 0 - PoolPeer.Put(x.Peer) - - p.pool.Put(x) -} - -var PoolUpdatePhoneCallEnded = poolUpdatePhoneCallEnded{} - -func (x *UpdatePhoneCallEnded) DeepCopy(z *UpdatePhoneCallEnded) { - z.UCount = x.UCount - z.UpdateID = x.UpdateID - z.TeamID = x.TeamID - if x.Peer != nil { - if z.Peer == nil { - z.Peer = PoolPeer.Get() - } - x.Peer.DeepCopy(z.Peer) - } else { - PoolPeer.Put(z.Peer) - z.Peer = nil - } -} - -func (x *UpdatePhoneCallEnded) Clone() *UpdatePhoneCallEnded { - z := &UpdatePhoneCallEnded{} - x.DeepCopy(z) - return z -} - -func (x *UpdatePhoneCallEnded) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UpdatePhoneCallEnded) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UpdatePhoneCallEnded) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UpdatePhoneCallEnded) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UpdatePhoneCallEnded) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UpdatePhoneCallEnded, x) -} - -func init() { - registry.RegisterConstructor(1437250230, "UpdateGetState") - registry.RegisterConstructor(556775761, "UpdateGetDifference") - registry.RegisterConstructor(1742546619, "UpdateDifference") - registry.RegisterConstructor(1531755547, "UpdateTooLong") - registry.RegisterConstructor(1837585836, "UpdateState") - registry.RegisterConstructor(2139063022, "UpdateMessageID") - registry.RegisterConstructor(3426925183, "UpdateNewMessage") - registry.RegisterConstructor(1825079988, "UpdateMessageEdited") - registry.RegisterConstructor(670568714, "UpdateMessagesDeleted") - registry.RegisterConstructor(1529128378, "UpdateReadHistoryInbox") - registry.RegisterConstructor(510866108, "UpdateReadHistoryOutbox") - registry.RegisterConstructor(1260768050, "UpdateMessagePinned") - registry.RegisterConstructor(178254060, "UpdateUserTyping") - registry.RegisterConstructor(2696747995, "UpdateUserStatus") - registry.RegisterConstructor(4290110589, "UpdateUsername") - registry.RegisterConstructor(302028082, "UpdateUserPhoto") - registry.RegisterConstructor(3187524885, "UpdateNotifySettings") - registry.RegisterConstructor(1623827837, "UpdateGroupParticipantAdd") - registry.RegisterConstructor(2489941844, "UpdateGroupParticipantDeleted") - registry.RegisterConstructor(1813022164, "UpdateGroupParticipantAdmin") - registry.RegisterConstructor(694155405, "UpdateGroupAdmins") - registry.RegisterConstructor(691550776, "UpdateGroupAdminOnly") - registry.RegisterConstructor(367193154, "UpdateGroupPhoto") - registry.RegisterConstructor(2991403048, "UpdateReadMessagesContents") - registry.RegisterConstructor(2359297647, "UpdateAuthorizationReset") - registry.RegisterConstructor(3453026195, "UpdateDraftMessage") - registry.RegisterConstructor(2011635602, "UpdateDraftMessageCleared") - registry.RegisterConstructor(231538299, "UpdateDialogPinned") - registry.RegisterConstructor(1567423539, "UpdateDialogPinnedReorder") - registry.RegisterConstructor(629173761, "UpdateAccountPrivacy") - registry.RegisterConstructor(2216022057, "UpdateLabelItemsAdded") - registry.RegisterConstructor(830226827, "UpdateLabelItemsRemoved") - registry.RegisterConstructor(2353687359, "UpdateLabelSet") - registry.RegisterConstructor(3702192307, "UpdateLabelDeleted") - registry.RegisterConstructor(3750625773, "UpdateUserBlocked") - registry.RegisterConstructor(383248674, "UpdateMessagePoll") - registry.RegisterConstructor(3408999713, "UpdateBotCallbackQuery") - registry.RegisterConstructor(4065328876, "UpdateBotInlineQuery") - registry.RegisterConstructor(2208028013, "UpdateBotInlineSend") - registry.RegisterConstructor(2762932529, "UpdateTeamCreated") - registry.RegisterConstructor(1307755890, "UpdateTeamMemberAdded") - registry.RegisterConstructor(99543064, "UpdateTeamMemberRemoved") - registry.RegisterConstructor(4065657769, "UpdateTeamMemberStatus") - registry.RegisterConstructor(3110088064, "UpdateTeamPhoto") - registry.RegisterConstructor(2978180712, "UpdateTeam") - registry.RegisterConstructor(983926580, "UpdateCommunityMessage") - registry.RegisterConstructor(2094301834, "UpdateCommunityReadOutbox") - registry.RegisterConstructor(451491445, "UpdateCommunityTyping") - registry.RegisterConstructor(2738677245, "UpdateReaction") - registry.RegisterConstructor(297964741, "UpdateCalendarEventAdded") - registry.RegisterConstructor(2986798389, "UpdateCalendarEventRemoved") - registry.RegisterConstructor(516349098, "UpdateCalendarEventEdited") - registry.RegisterConstructor(3303504929, "UpdateRedirect") - registry.RegisterConstructor(3513459109, "ClientRedirect") - registry.RegisterConstructor(2791086990, "UpdatePhoneCall") - registry.RegisterConstructor(1094761594, "UpdatePhoneCallStarted") - registry.RegisterConstructor(1764711846, "UpdatePhoneCallEnded") -} - -var _ = bytes.MinRead diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/users.pb.go b/vendor/git.ronaksoft.com/river/msg/go/msg/users.pb.go deleted file mode 100644 index 6f557c71..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/users.pb.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.15.8 -// source: users.proto - -package msg - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// UsersGet -// @Function -// @Returns: UsersMany -type UsersGet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Users []*InputUser `protobuf:"bytes,1,rep,name=Users,proto3" json:"Users,omitempty"` -} - -func (x *UsersGet) Reset() { - *x = UsersGet{} - if protoimpl.UnsafeEnabled { - mi := &file_users_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UsersGet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UsersGet) ProtoMessage() {} - -func (x *UsersGet) ProtoReflect() protoreflect.Message { - mi := &file_users_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UsersGet.ProtoReflect.Descriptor instead. -func (*UsersGet) Descriptor() ([]byte, []int) { - return file_users_proto_rawDescGZIP(), []int{0} -} - -func (x *UsersGet) GetUsers() []*InputUser { - if x != nil { - return x.Users - } - return nil -} - -// UsersGetFull -// @Function -// @Returns: UsersFullMany -type UsersGetFull struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Users []*InputUser `protobuf:"bytes,1,rep,name=Users,proto3" json:"Users,omitempty"` -} - -func (x *UsersGetFull) Reset() { - *x = UsersGetFull{} - if protoimpl.UnsafeEnabled { - mi := &file_users_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UsersGetFull) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UsersGetFull) ProtoMessage() {} - -func (x *UsersGetFull) ProtoReflect() protoreflect.Message { - mi := &file_users_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UsersGetFull.ProtoReflect.Descriptor instead. -func (*UsersGetFull) Descriptor() ([]byte, []int) { - return file_users_proto_rawDescGZIP(), []int{1} -} - -func (x *UsersGetFull) GetUsers() []*InputUser { - if x != nil { - return x.Users - } - return nil -} - -// UsersMany -type UsersMany struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Users []*User `protobuf:"bytes,1,rep,name=Users,proto3" json:"Users,omitempty"` - Empty bool `protobuf:"varint,5,opt,name=Empty,proto3" json:"Empty,omitempty"` -} - -func (x *UsersMany) Reset() { - *x = UsersMany{} - if protoimpl.UnsafeEnabled { - mi := &file_users_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *UsersMany) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*UsersMany) ProtoMessage() {} - -func (x *UsersMany) ProtoReflect() protoreflect.Message { - mi := &file_users_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use UsersMany.ProtoReflect.Descriptor instead. -func (*UsersMany) Descriptor() ([]byte, []int) { - return file_users_proto_rawDescGZIP(), []int{2} -} - -func (x *UsersMany) GetUsers() []*User { - if x != nil { - return x.Users - } - return nil -} - -func (x *UsersMany) GetEmpty() bool { - if x != nil { - return x.Empty - } - return false -} - -var File_users_proto protoreflect.FileDescriptor - -var file_users_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, - 0x73, 0x67, 0x1a, 0x10, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x30, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x73, 0x47, 0x65, 0x74, - 0x12, 0x24, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x22, 0x34, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x73, 0x47, - 0x65, 0x74, 0x46, 0x75, 0x6c, 0x6c, 0x12, 0x24, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x22, 0x42, 0x0a, 0x09, - 0x55, 0x73, 0x65, 0x72, 0x73, 0x4d, 0x61, 0x6e, 0x79, 0x12, 0x1f, 0x0a, 0x05, 0x55, 0x73, 0x65, - 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x6d, 0x73, 0x67, 0x2e, 0x55, - 0x73, 0x65, 0x72, 0x52, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x3b, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_users_proto_rawDescOnce sync.Once - file_users_proto_rawDescData = file_users_proto_rawDesc -) - -func file_users_proto_rawDescGZIP() []byte { - file_users_proto_rawDescOnce.Do(func() { - file_users_proto_rawDescData = protoimpl.X.CompressGZIP(file_users_proto_rawDescData) - }) - return file_users_proto_rawDescData -} - -var file_users_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_users_proto_goTypes = []interface{}{ - (*UsersGet)(nil), // 0: msg.UsersGet - (*UsersGetFull)(nil), // 1: msg.UsersGetFull - (*UsersMany)(nil), // 2: msg.UsersMany - (*InputUser)(nil), // 3: msg.InputUser - (*User)(nil), // 4: msg.User -} -var file_users_proto_depIdxs = []int32{ - 3, // 0: msg.UsersGet.Users:type_name -> msg.InputUser - 3, // 1: msg.UsersGetFull.Users:type_name -> msg.InputUser - 4, // 2: msg.UsersMany.Users:type_name -> msg.User - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_users_proto_init() } -func file_users_proto_init() { - if File_users_proto != nil { - return - } - file_core_types_proto_init() - if !protoimpl.UnsafeEnabled { - file_users_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UsersGet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_users_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UsersGetFull); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_users_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*UsersMany); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_users_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_users_proto_goTypes, - DependencyIndexes: file_users_proto_depIdxs, - MessageInfos: file_users_proto_msgTypes, - }.Build() - File_users_proto = out.File - file_users_proto_rawDesc = nil - file_users_proto_goTypes = nil - file_users_proto_depIdxs = nil -} diff --git a/vendor/git.ronaksoft.com/river/msg/go/msg/users.rony.go b/vendor/git.ronaksoft.com/river/msg/go/msg/users.rony.go deleted file mode 100644 index 9f98521a..00000000 --- a/vendor/git.ronaksoft.com/river/msg/go/msg/users.rony.go +++ /dev/null @@ -1,229 +0,0 @@ -// Code generated by Rony's protoc plugin; DO NOT EDIT. -// ProtoC ver. v3.15.8 -// Rony ver. v0.12.22 -// Source: users.proto - -package msg - -import ( - bytes "bytes" - edge "github.com/ronaksoft/rony/edge" - pools "github.com/ronaksoft/rony/pools" - registry "github.com/ronaksoft/rony/registry" - protojson "google.golang.org/protobuf/encoding/protojson" - proto "google.golang.org/protobuf/proto" - sync "sync" -) - -var _ = pools.Imported - -const C_UsersGet int64 = 1039301579 - -type poolUsersGet struct { - pool sync.Pool -} - -func (p *poolUsersGet) Get() *UsersGet { - x, ok := p.pool.Get().(*UsersGet) - if !ok { - x = &UsersGet{} - } - - return x -} - -func (p *poolUsersGet) Put(x *UsersGet) { - if x == nil { - return - } - - for _, z := range x.Users { - PoolInputUser.Put(z) - } - x.Users = x.Users[:0] - - p.pool.Put(x) -} - -var PoolUsersGet = poolUsersGet{} - -func (x *UsersGet) DeepCopy(z *UsersGet) { - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolInputUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } -} - -func (x *UsersGet) Clone() *UsersGet { - z := &UsersGet{} - x.DeepCopy(z) - return z -} - -func (x *UsersGet) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UsersGet) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UsersGet) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UsersGet) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UsersGet) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UsersGet, x) -} - -const C_UsersGetFull int64 = 3343342086 - -type poolUsersGetFull struct { - pool sync.Pool -} - -func (p *poolUsersGetFull) Get() *UsersGetFull { - x, ok := p.pool.Get().(*UsersGetFull) - if !ok { - x = &UsersGetFull{} - } - - return x -} - -func (p *poolUsersGetFull) Put(x *UsersGetFull) { - if x == nil { - return - } - - for _, z := range x.Users { - PoolInputUser.Put(z) - } - x.Users = x.Users[:0] - - p.pool.Put(x) -} - -var PoolUsersGetFull = poolUsersGetFull{} - -func (x *UsersGetFull) DeepCopy(z *UsersGetFull) { - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolInputUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } -} - -func (x *UsersGetFull) Clone() *UsersGetFull { - z := &UsersGetFull{} - x.DeepCopy(z) - return z -} - -func (x *UsersGetFull) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UsersGetFull) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UsersGetFull) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UsersGetFull) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UsersGetFull) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UsersGetFull, x) -} - -const C_UsersMany int64 = 801733941 - -type poolUsersMany struct { - pool sync.Pool -} - -func (p *poolUsersMany) Get() *UsersMany { - x, ok := p.pool.Get().(*UsersMany) - if !ok { - x = &UsersMany{} - } - - return x -} - -func (p *poolUsersMany) Put(x *UsersMany) { - if x == nil { - return - } - - for _, z := range x.Users { - PoolUser.Put(z) - } - x.Users = x.Users[:0] - x.Empty = false - - p.pool.Put(x) -} - -var PoolUsersMany = poolUsersMany{} - -func (x *UsersMany) DeepCopy(z *UsersMany) { - for idx := range x.Users { - if x.Users[idx] == nil { - continue - } - xx := PoolUser.Get() - x.Users[idx].DeepCopy(xx) - z.Users = append(z.Users, xx) - } - z.Empty = x.Empty -} - -func (x *UsersMany) Clone() *UsersMany { - z := &UsersMany{} - x.DeepCopy(z) - return z -} - -func (x *UsersMany) Unmarshal(b []byte) error { - return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) -} - -func (x *UsersMany) Marshal() ([]byte, error) { - return proto.Marshal(x) -} - -func (x *UsersMany) UnmarshalJSON(b []byte) error { - return protojson.Unmarshal(b, x) -} - -func (x *UsersMany) MarshalJSON() ([]byte, error) { - return protojson.Marshal(x) -} - -func (x *UsersMany) PushToContext(ctx *edge.RequestCtx) { - ctx.PushMessage(C_UsersMany, x) -} - -func init() { - registry.RegisterConstructor(1039301579, "UsersGet") - registry.RegisterConstructor(3343342086, "UsersGetFull") - registry.RegisterConstructor(801733941, "UsersMany") -} - -var _ = bytes.MinRead diff --git a/vendor/github.com/DataDog/zstd/LICENSE b/vendor/github.com/DataDog/zstd/LICENSE deleted file mode 100644 index 345c1eb9..00000000 --- a/vendor/github.com/DataDog/zstd/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Simplified BSD License - -Copyright (c) 2016, Datadog -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/DataDog/zstd/README.md b/vendor/github.com/DataDog/zstd/README.md deleted file mode 100644 index 03f2cf66..00000000 --- a/vendor/github.com/DataDog/zstd/README.md +++ /dev/null @@ -1,124 +0,0 @@ -# Zstd Go Wrapper - -[![CircleCI](https://circleci.com/gh/DataDog/zstd/tree/1.x.svg?style=svg)](https://circleci.com/gh/DataDog/zstd/tree/1.x) -[![GoDoc](https://godoc.org/github.com/DataDog/zstd?status.svg)](https://godoc.org/github.com/DataDog/zstd) - - -[C Zstd Homepage](https://github.com/facebook/zstd) - -The current headers and C files are from *v1.4.4* (Commit -[10f0e699](https://github.com/facebook/zstd/releases/tag/v1.4.4)). - -## Usage - -There are two main APIs: - -* simple Compress/Decompress -* streaming API (io.Reader/io.Writer) - -The compress/decompress APIs mirror that of lz4, while the streaming API was -designed to be a drop-in replacement for zlib. - -### Simple `Compress/Decompress` - - -```go -// Compress compresses the byte array given in src and writes it to dst. -// If you already have a buffer allocated, you can pass it to prevent allocation -// If not, you can pass nil as dst. -// If the buffer is too small, it will be reallocated, resized, and returned bu the function -// If dst is nil, this will allocate the worst case size (CompressBound(src)) -Compress(dst, src []byte) ([]byte, error) -``` - -```go -// CompressLevel is the same as Compress but you can pass another compression level -CompressLevel(dst, src []byte, level int) ([]byte, error) -``` - -```go -// Decompress will decompress your payload into dst. -// If you already have a buffer allocated, you can pass it to prevent allocation -// If not, you can pass nil as dst (allocates a 4*src size as default). -// If the buffer is too small, it will retry 3 times by doubling the dst size -// After max retries, it will switch to the slower stream API to be sure to be able -// to decompress. Currently switches if compression ratio > 4*2**3=32. -Decompress(dst, src []byte) ([]byte, error) -``` - -### Stream API - -```go -// NewWriter creates a new object that can optionally be initialized with -// a precomputed dictionary. If dict is nil, compress without a dictionary. -// The dictionary array should not be changed during the use of this object. -// You MUST CALL Close() to write the last bytes of a zstd stream and free C objects. -NewWriter(w io.Writer) *Writer -NewWriterLevel(w io.Writer, level int) *Writer -NewWriterLevelDict(w io.Writer, level int, dict []byte) *Writer - -// Write compresses the input data and write it to the underlying writer -(w *Writer) Write(p []byte) (int, error) - -// Close flushes the buffer and frees C zstd objects -(w *Writer) Close() error -``` - -```go -// NewReader returns a new io.ReadCloser that will decompress data from the -// underlying reader. If a dictionary is provided to NewReaderDict, it must -// not be modified until Close is called. It is the caller's responsibility -// to call Close, which frees up C objects. -NewReader(r io.Reader) io.ReadCloser -NewReaderDict(r io.Reader, dict []byte) io.ReadCloser -``` - -### Benchmarks (benchmarked with v0.5.0) - -The author of Zstd also wrote lz4. Zstd is intended to occupy a speed/ratio -level similar to what zlib currently provides. In our tests, the can always -be made to be better than zlib by chosing an appropriate level while still -keeping compression and decompression time faster than zlib. - -You can run the benchmarks against your own payloads by using the Go benchmarks tool. -Just export your payload filepath as the `PAYLOAD` environment variable and run the benchmarks: - -```go -go test -bench . -``` - -Compression of a 7Mb pdf zstd (this wrapper) vs [czlib](https://github.com/DataDog/czlib): -``` -BenchmarkCompression 5 221056624 ns/op 67.34 MB/s -BenchmarkDecompression 100 18370416 ns/op 810.32 MB/s - -BenchmarkFzlibCompress 2 610156603 ns/op 24.40 MB/s -BenchmarkFzlibDecompress 20 81195246 ns/op 183.33 MB/s -``` - -Ratio is also better by a margin of ~20%. -Compression speed is always better than zlib on all the payloads we tested; -However, [czlib](https://github.com/DataDog/czlib) has optimisations that make it -faster at decompressiong small payloads: - -``` -Testing with size: 11... czlib: 8.97 MB/s, zstd: 3.26 MB/s -Testing with size: 27... czlib: 23.3 MB/s, zstd: 8.22 MB/s -Testing with size: 62... czlib: 31.6 MB/s, zstd: 19.49 MB/s -Testing with size: 141... czlib: 74.54 MB/s, zstd: 42.55 MB/s -Testing with size: 323... czlib: 155.14 MB/s, zstd: 99.39 MB/s -Testing with size: 739... czlib: 235.9 MB/s, zstd: 216.45 MB/s -Testing with size: 1689... czlib: 116.45 MB/s, zstd: 345.64 MB/s -Testing with size: 3858... czlib: 176.39 MB/s, zstd: 617.56 MB/s -Testing with size: 8811... czlib: 254.11 MB/s, zstd: 824.34 MB/s -Testing with size: 20121... czlib: 197.43 MB/s, zstd: 1339.11 MB/s -Testing with size: 45951... czlib: 201.62 MB/s, zstd: 1951.57 MB/s -``` - -zstd starts to shine with payloads > 1KB - -### Stability - Current state: STABLE - -The C library seems to be pretty stable and according to the author has been tested and fuzzed. - -For the Go wrapper, the test cover most usual cases and we have succesfully tested it on all staging and prod data. diff --git a/vendor/github.com/DataDog/zstd/ZSTD_LICENSE b/vendor/github.com/DataDog/zstd/ZSTD_LICENSE deleted file mode 100644 index a793a802..00000000 --- a/vendor/github.com/DataDog/zstd/ZSTD_LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -BSD License - -For Zstandard software - -Copyright (c) 2016-present, Facebook, Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name Facebook nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/DataDog/zstd/bitstream.h b/vendor/github.com/DataDog/zstd/bitstream.h deleted file mode 100644 index 1c294b80..00000000 --- a/vendor/github.com/DataDog/zstd/bitstream.h +++ /dev/null @@ -1,460 +0,0 @@ -/* ****************************************************************** - bitstream - Part of FSE library - Copyright (C) 2013-present, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - Source repository : https://github.com/Cyan4973/FiniteStateEntropy -****************************************************************** */ -#ifndef BITSTREAM_H_MODULE -#define BITSTREAM_H_MODULE - -#if defined (__cplusplus) -extern "C" { -#endif - -/* -* This API consists of small unitary functions, which must be inlined for best performance. -* Since link-time-optimization is not available for all compilers, -* these functions are defined into a .h to be included. -*/ - -/*-**************************************** -* Dependencies -******************************************/ -#include "mem.h" /* unaligned access routines */ -#include "debug.h" /* assert(), DEBUGLOG(), RAWLOG() */ -#include "error_private.h" /* error codes and messages */ - - -/*========================================= -* Target specific -=========================================*/ -#if defined(__BMI__) && defined(__GNUC__) -# include /* support for bextr (experimental) */ -#elif defined(__ICCARM__) -# include -#endif - -#define STREAM_ACCUMULATOR_MIN_32 25 -#define STREAM_ACCUMULATOR_MIN_64 57 -#define STREAM_ACCUMULATOR_MIN ((U32)(MEM_32bits() ? STREAM_ACCUMULATOR_MIN_32 : STREAM_ACCUMULATOR_MIN_64)) - - -/*-****************************************** -* bitStream encoding API (write forward) -********************************************/ -/* bitStream can mix input from multiple sources. - * A critical property of these streams is that they encode and decode in **reverse** direction. - * So the first bit sequence you add will be the last to be read, like a LIFO stack. - */ -typedef struct { - size_t bitContainer; - unsigned bitPos; - char* startPtr; - char* ptr; - char* endPtr; -} BIT_CStream_t; - -MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC, void* dstBuffer, size_t dstCapacity); -MEM_STATIC void BIT_addBits(BIT_CStream_t* bitC, size_t value, unsigned nbBits); -MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC); -MEM_STATIC size_t BIT_closeCStream(BIT_CStream_t* bitC); - -/* Start with initCStream, providing the size of buffer to write into. -* bitStream will never write outside of this buffer. -* `dstCapacity` must be >= sizeof(bitD->bitContainer), otherwise @return will be an error code. -* -* bits are first added to a local register. -* Local register is size_t, hence 64-bits on 64-bits systems, or 32-bits on 32-bits systems. -* Writing data into memory is an explicit operation, performed by the flushBits function. -* Hence keep track how many bits are potentially stored into local register to avoid register overflow. -* After a flushBits, a maximum of 7 bits might still be stored into local register. -* -* Avoid storing elements of more than 24 bits if you want compatibility with 32-bits bitstream readers. -* -* Last operation is to close the bitStream. -* The function returns the final size of CStream in bytes. -* If data couldn't fit into `dstBuffer`, it will return a 0 ( == not storable) -*/ - - -/*-******************************************** -* bitStream decoding API (read backward) -**********************************************/ -typedef struct { - size_t bitContainer; - unsigned bitsConsumed; - const char* ptr; - const char* start; - const char* limitPtr; -} BIT_DStream_t; - -typedef enum { BIT_DStream_unfinished = 0, - BIT_DStream_endOfBuffer = 1, - BIT_DStream_completed = 2, - BIT_DStream_overflow = 3 } BIT_DStream_status; /* result of BIT_reloadDStream() */ - /* 1,2,4,8 would be better for bitmap combinations, but slows down performance a bit ... :( */ - -MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize); -MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits); -MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD); -MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* bitD); - - -/* Start by invoking BIT_initDStream(). -* A chunk of the bitStream is then stored into a local register. -* Local register size is 64-bits on 64-bits systems, 32-bits on 32-bits systems (size_t). -* You can then retrieve bitFields stored into the local register, **in reverse order**. -* Local register is explicitly reloaded from memory by the BIT_reloadDStream() method. -* A reload guarantee a minimum of ((8*sizeof(bitD->bitContainer))-7) bits when its result is BIT_DStream_unfinished. -* Otherwise, it can be less than that, so proceed accordingly. -* Checking if DStream has reached its end can be performed with BIT_endOfDStream(). -*/ - - -/*-**************************************** -* unsafe API -******************************************/ -MEM_STATIC void BIT_addBitsFast(BIT_CStream_t* bitC, size_t value, unsigned nbBits); -/* faster, but works only if value is "clean", meaning all high bits above nbBits are 0 */ - -MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC); -/* unsafe version; does not check buffer overflow */ - -MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits); -/* faster, but works only if nbBits >= 1 */ - - - -/*-************************************************************** -* Internal functions -****************************************************************/ -MEM_STATIC unsigned BIT_highbit32 (U32 val) -{ - assert(val != 0); - { -# if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - _BitScanReverse ( &r, val ); - return (unsigned) r; -# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ - return __builtin_clz (val) ^ 31; -# elif defined(__ICCARM__) /* IAR Intrinsic */ - return 31 - __CLZ(val); -# else /* Software version */ - static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, - 11, 14, 16, 18, 22, 25, 3, 30, - 8, 12, 20, 28, 15, 17, 24, 7, - 19, 27, 23, 6, 26, 5, 4, 31 }; - U32 v = val; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - return DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27]; -# endif - } -} - -/*===== Local Constants =====*/ -static const unsigned BIT_mask[] = { - 0, 1, 3, 7, 0xF, 0x1F, - 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, - 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, 0x1FFFF, - 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF, 0x7FFFFF, - 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, 0xFFFFFFF, 0x1FFFFFFF, - 0x3FFFFFFF, 0x7FFFFFFF}; /* up to 31 bits */ -#define BIT_MASK_SIZE (sizeof(BIT_mask) / sizeof(BIT_mask[0])) - -/*-************************************************************** -* bitStream encoding -****************************************************************/ -/*! BIT_initCStream() : - * `dstCapacity` must be > sizeof(size_t) - * @return : 0 if success, - * otherwise an error code (can be tested using ERR_isError()) */ -MEM_STATIC size_t BIT_initCStream(BIT_CStream_t* bitC, - void* startPtr, size_t dstCapacity) -{ - bitC->bitContainer = 0; - bitC->bitPos = 0; - bitC->startPtr = (char*)startPtr; - bitC->ptr = bitC->startPtr; - bitC->endPtr = bitC->startPtr + dstCapacity - sizeof(bitC->bitContainer); - if (dstCapacity <= sizeof(bitC->bitContainer)) return ERROR(dstSize_tooSmall); - return 0; -} - -/*! BIT_addBits() : - * can add up to 31 bits into `bitC`. - * Note : does not check for register overflow ! */ -MEM_STATIC void BIT_addBits(BIT_CStream_t* bitC, - size_t value, unsigned nbBits) -{ - MEM_STATIC_ASSERT(BIT_MASK_SIZE == 32); - assert(nbBits < BIT_MASK_SIZE); - assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8); - bitC->bitContainer |= (value & BIT_mask[nbBits]) << bitC->bitPos; - bitC->bitPos += nbBits; -} - -/*! BIT_addBitsFast() : - * works only if `value` is _clean_, - * meaning all high bits above nbBits are 0 */ -MEM_STATIC void BIT_addBitsFast(BIT_CStream_t* bitC, - size_t value, unsigned nbBits) -{ - assert((value>>nbBits) == 0); - assert(nbBits + bitC->bitPos < sizeof(bitC->bitContainer) * 8); - bitC->bitContainer |= value << bitC->bitPos; - bitC->bitPos += nbBits; -} - -/*! BIT_flushBitsFast() : - * assumption : bitContainer has not overflowed - * unsafe version; does not check buffer overflow */ -MEM_STATIC void BIT_flushBitsFast(BIT_CStream_t* bitC) -{ - size_t const nbBytes = bitC->bitPos >> 3; - assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8); - assert(bitC->ptr <= bitC->endPtr); - MEM_writeLEST(bitC->ptr, bitC->bitContainer); - bitC->ptr += nbBytes; - bitC->bitPos &= 7; - bitC->bitContainer >>= nbBytes*8; -} - -/*! BIT_flushBits() : - * assumption : bitContainer has not overflowed - * safe version; check for buffer overflow, and prevents it. - * note : does not signal buffer overflow. - * overflow will be revealed later on using BIT_closeCStream() */ -MEM_STATIC void BIT_flushBits(BIT_CStream_t* bitC) -{ - size_t const nbBytes = bitC->bitPos >> 3; - assert(bitC->bitPos < sizeof(bitC->bitContainer) * 8); - assert(bitC->ptr <= bitC->endPtr); - MEM_writeLEST(bitC->ptr, bitC->bitContainer); - bitC->ptr += nbBytes; - if (bitC->ptr > bitC->endPtr) bitC->ptr = bitC->endPtr; - bitC->bitPos &= 7; - bitC->bitContainer >>= nbBytes*8; -} - -/*! BIT_closeCStream() : - * @return : size of CStream, in bytes, - * or 0 if it could not fit into dstBuffer */ -MEM_STATIC size_t BIT_closeCStream(BIT_CStream_t* bitC) -{ - BIT_addBitsFast(bitC, 1, 1); /* endMark */ - BIT_flushBits(bitC); - if (bitC->ptr >= bitC->endPtr) return 0; /* overflow detected */ - return (bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0); -} - - -/*-******************************************************** -* bitStream decoding -**********************************************************/ -/*! BIT_initDStream() : - * Initialize a BIT_DStream_t. - * `bitD` : a pointer to an already allocated BIT_DStream_t structure. - * `srcSize` must be the *exact* size of the bitStream, in bytes. - * @return : size of stream (== srcSize), or an errorCode if a problem is detected - */ -MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize) -{ - if (srcSize < 1) { memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); } - - bitD->start = (const char*)srcBuffer; - bitD->limitPtr = bitD->start + sizeof(bitD->bitContainer); - - if (srcSize >= sizeof(bitD->bitContainer)) { /* normal case */ - bitD->ptr = (const char*)srcBuffer + srcSize - sizeof(bitD->bitContainer); - bitD->bitContainer = MEM_readLEST(bitD->ptr); - { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1]; - bitD->bitsConsumed = lastByte ? 8 - BIT_highbit32(lastByte) : 0; /* ensures bitsConsumed is always set */ - if (lastByte == 0) return ERROR(GENERIC); /* endMark not present */ } - } else { - bitD->ptr = bitD->start; - bitD->bitContainer = *(const BYTE*)(bitD->start); - switch(srcSize) - { - case 7: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[6]) << (sizeof(bitD->bitContainer)*8 - 16); - /* fall-through */ - - case 6: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[5]) << (sizeof(bitD->bitContainer)*8 - 24); - /* fall-through */ - - case 5: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[4]) << (sizeof(bitD->bitContainer)*8 - 32); - /* fall-through */ - - case 4: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[3]) << 24; - /* fall-through */ - - case 3: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[2]) << 16; - /* fall-through */ - - case 2: bitD->bitContainer += (size_t)(((const BYTE*)(srcBuffer))[1]) << 8; - /* fall-through */ - - default: break; - } - { BYTE const lastByte = ((const BYTE*)srcBuffer)[srcSize-1]; - bitD->bitsConsumed = lastByte ? 8 - BIT_highbit32(lastByte) : 0; - if (lastByte == 0) return ERROR(corruption_detected); /* endMark not present */ - } - bitD->bitsConsumed += (U32)(sizeof(bitD->bitContainer) - srcSize)*8; - } - - return srcSize; -} - -MEM_STATIC size_t BIT_getUpperBits(size_t bitContainer, U32 const start) -{ - return bitContainer >> start; -} - -MEM_STATIC size_t BIT_getMiddleBits(size_t bitContainer, U32 const start, U32 const nbBits) -{ - U32 const regMask = sizeof(bitContainer)*8 - 1; - /* if start > regMask, bitstream is corrupted, and result is undefined */ - assert(nbBits < BIT_MASK_SIZE); - return (bitContainer >> (start & regMask)) & BIT_mask[nbBits]; -} - -MEM_STATIC size_t BIT_getLowerBits(size_t bitContainer, U32 const nbBits) -{ - assert(nbBits < BIT_MASK_SIZE); - return bitContainer & BIT_mask[nbBits]; -} - -/*! BIT_lookBits() : - * Provides next n bits from local register. - * local register is not modified. - * On 32-bits, maxNbBits==24. - * On 64-bits, maxNbBits==56. - * @return : value extracted */ -MEM_STATIC size_t BIT_lookBits(const BIT_DStream_t* bitD, U32 nbBits) -{ - /* arbitrate between double-shift and shift+mask */ -#if 1 - /* if bitD->bitsConsumed + nbBits > sizeof(bitD->bitContainer)*8, - * bitstream is likely corrupted, and result is undefined */ - return BIT_getMiddleBits(bitD->bitContainer, (sizeof(bitD->bitContainer)*8) - bitD->bitsConsumed - nbBits, nbBits); -#else - /* this code path is slower on my os-x laptop */ - U32 const regMask = sizeof(bitD->bitContainer)*8 - 1; - return ((bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> 1) >> ((regMask-nbBits) & regMask); -#endif -} - -/*! BIT_lookBitsFast() : - * unsafe version; only works if nbBits >= 1 */ -MEM_STATIC size_t BIT_lookBitsFast(const BIT_DStream_t* bitD, U32 nbBits) -{ - U32 const regMask = sizeof(bitD->bitContainer)*8 - 1; - assert(nbBits >= 1); - return (bitD->bitContainer << (bitD->bitsConsumed & regMask)) >> (((regMask+1)-nbBits) & regMask); -} - -MEM_STATIC void BIT_skipBits(BIT_DStream_t* bitD, U32 nbBits) -{ - bitD->bitsConsumed += nbBits; -} - -/*! BIT_readBits() : - * Read (consume) next n bits from local register and update. - * Pay attention to not read more than nbBits contained into local register. - * @return : extracted value. */ -MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits) -{ - size_t const value = BIT_lookBits(bitD, nbBits); - BIT_skipBits(bitD, nbBits); - return value; -} - -/*! BIT_readBitsFast() : - * unsafe version; only works only if nbBits >= 1 */ -MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits) -{ - size_t const value = BIT_lookBitsFast(bitD, nbBits); - assert(nbBits >= 1); - BIT_skipBits(bitD, nbBits); - return value; -} - -/*! BIT_reloadDStream() : - * Refill `bitD` from buffer previously set in BIT_initDStream() . - * This function is safe, it guarantees it will not read beyond src buffer. - * @return : status of `BIT_DStream_t` internal register. - * when status == BIT_DStream_unfinished, internal register is filled with at least 25 or 57 bits */ -MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD) -{ - if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8)) /* overflow detected, like end of stream */ - return BIT_DStream_overflow; - - if (bitD->ptr >= bitD->limitPtr) { - bitD->ptr -= bitD->bitsConsumed >> 3; - bitD->bitsConsumed &= 7; - bitD->bitContainer = MEM_readLEST(bitD->ptr); - return BIT_DStream_unfinished; - } - if (bitD->ptr == bitD->start) { - if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer; - return BIT_DStream_completed; - } - /* start < ptr < limitPtr */ - { U32 nbBytes = bitD->bitsConsumed >> 3; - BIT_DStream_status result = BIT_DStream_unfinished; - if (bitD->ptr - nbBytes < bitD->start) { - nbBytes = (U32)(bitD->ptr - bitD->start); /* ptr > start */ - result = BIT_DStream_endOfBuffer; - } - bitD->ptr -= nbBytes; - bitD->bitsConsumed -= nbBytes*8; - bitD->bitContainer = MEM_readLEST(bitD->ptr); /* reminder : srcSize > sizeof(bitD->bitContainer), otherwise bitD->ptr == bitD->start */ - return result; - } -} - -/*! BIT_endOfDStream() : - * @return : 1 if DStream has _exactly_ reached its end (all bits consumed). - */ -MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream) -{ - return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8)); -} - -#if defined (__cplusplus) -} -#endif - -#endif /* BITSTREAM_H_MODULE */ diff --git a/vendor/github.com/DataDog/zstd/compiler.h b/vendor/github.com/DataDog/zstd/compiler.h deleted file mode 100644 index 1877a0c1..00000000 --- a/vendor/github.com/DataDog/zstd/compiler.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_COMPILER_H -#define ZSTD_COMPILER_H - -/*-******************************************************* -* Compiler specifics -*********************************************************/ -/* force inlining */ - -#if !defined(ZSTD_NO_INLINE) -#if defined (__GNUC__) || defined(__cplusplus) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define INLINE_KEYWORD inline -#else -# define INLINE_KEYWORD -#endif - -#if defined(__GNUC__) || defined(__ICCARM__) -# define FORCE_INLINE_ATTR __attribute__((always_inline)) -#elif defined(_MSC_VER) -# define FORCE_INLINE_ATTR __forceinline -#else -# define FORCE_INLINE_ATTR -#endif - -#else - -#define INLINE_KEYWORD -#define FORCE_INLINE_ATTR - -#endif - -/** - * FORCE_INLINE_TEMPLATE is used to define C "templates", which take constant - * parameters. They must be inlined for the compiler to eliminate the constant - * branches. - */ -#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR -/** - * HINT_INLINE is used to help the compiler generate better code. It is *not* - * used for "templates", so it can be tweaked based on the compilers - * performance. - * - * gcc-4.8 and gcc-4.9 have been shown to benefit from leaving off the - * always_inline attribute. - * - * clang up to 5.0.0 (trunk) benefit tremendously from the always_inline - * attribute. - */ -#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 && __GNUC__ < 5 -# define HINT_INLINE static INLINE_KEYWORD -#else -# define HINT_INLINE static INLINE_KEYWORD FORCE_INLINE_ATTR -#endif - -/* UNUSED_ATTR tells the compiler it is okay if the function is unused. */ -#if defined(__GNUC__) -# define UNUSED_ATTR __attribute__((unused)) -#else -# define UNUSED_ATTR -#endif - -/* force no inlining */ -#ifdef _MSC_VER -# define FORCE_NOINLINE static __declspec(noinline) -#else -# if defined(__GNUC__) || defined(__ICCARM__) -# define FORCE_NOINLINE static __attribute__((__noinline__)) -# else -# define FORCE_NOINLINE static -# endif -#endif - -/* target attribute */ -#ifndef __has_attribute - #define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */ -#endif -#if defined(__GNUC__) || defined(__ICCARM__) -# define TARGET_ATTRIBUTE(target) __attribute__((__target__(target))) -#else -# define TARGET_ATTRIBUTE(target) -#endif - -/* Enable runtime BMI2 dispatch based on the CPU. - * Enabled for clang & gcc >=4.8 on x86 when BMI2 isn't enabled by default. - */ -#ifndef DYNAMIC_BMI2 - #if ((defined(__clang__) && __has_attribute(__target__)) \ - || (defined(__GNUC__) \ - && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))) \ - && (defined(__x86_64__) || defined(_M_X86)) \ - && !defined(__BMI2__) - # define DYNAMIC_BMI2 1 - #else - # define DYNAMIC_BMI2 0 - #endif -#endif - -/* prefetch - * can be disabled, by declaring NO_PREFETCH build macro */ -#if defined(NO_PREFETCH) -# define PREFETCH_L1(ptr) (void)(ptr) /* disabled */ -# define PREFETCH_L2(ptr) (void)(ptr) /* disabled */ -#else -# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) /* _mm_prefetch() is not defined outside of x86/x64 */ -# include /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ -# define PREFETCH_L1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) -# define PREFETCH_L2(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1) -# elif defined(__GNUC__) && ( (__GNUC__ >= 4) || ( (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) ) ) -# define PREFETCH_L1(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) -# define PREFETCH_L2(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */) -# else -# define PREFETCH_L1(ptr) (void)(ptr) /* disabled */ -# define PREFETCH_L2(ptr) (void)(ptr) /* disabled */ -# endif -#endif /* NO_PREFETCH */ - -#define CACHELINE_SIZE 64 - -#define PREFETCH_AREA(p, s) { \ - const char* const _ptr = (const char*)(p); \ - size_t const _size = (size_t)(s); \ - size_t _pos; \ - for (_pos=0; _pos<_size; _pos+=CACHELINE_SIZE) { \ - PREFETCH_L2(_ptr + _pos); \ - } \ -} - -/* vectorization - * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */ -#if !defined(__clang__) && defined(__GNUC__) -# if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5) -# define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize"))) -# else -# define DONT_VECTORIZE _Pragma("GCC optimize(\"no-tree-vectorize\")") -# endif -#else -# define DONT_VECTORIZE -#endif - -/* disable warnings */ -#ifdef _MSC_VER /* Visual Studio */ -# include /* For Visual 2005 */ -# pragma warning(disable : 4100) /* disable: C4100: unreferenced formal parameter */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -# pragma warning(disable : 4204) /* disable: C4204: non-constant aggregate initializer */ -# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */ -# pragma warning(disable : 4324) /* disable: C4324: padded structure */ -#endif - -#endif /* ZSTD_COMPILER_H */ diff --git a/vendor/github.com/DataDog/zstd/cover.c b/vendor/github.com/DataDog/zstd/cover.c deleted file mode 100644 index 2e129dd9..00000000 --- a/vendor/github.com/DataDog/zstd/cover.c +++ /dev/null @@ -1,1236 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/* ***************************************************************************** - * Constructs a dictionary using a heuristic based on the following paper: - * - * Liao, Petri, Moffat, Wirth - * Effective Construction of Relative Lempel-Ziv Dictionaries - * Published in WWW 2016. - * - * Adapted from code originally written by @ot (Giuseppe Ottaviano). - ******************************************************************************/ - -/*-************************************* -* Dependencies -***************************************/ -#include /* fprintf */ -#include /* malloc, free, qsort */ -#include /* memset */ -#include /* clock */ - -#include "mem.h" /* read */ -#include "pool.h" -#include "threading.h" -#include "cover.h" -#include "zstd_internal.h" /* includes zstd.h */ -#ifndef ZDICT_STATIC_LINKING_ONLY -#define ZDICT_STATIC_LINKING_ONLY -#endif -#include "zdict.h" - -/*-************************************* -* Constants -***************************************/ -#define COVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB)) -#define DEFAULT_SPLITPOINT 1.0 - -/*-************************************* -* Console display -***************************************/ -static int g_displayLevel = 2; -#define DISPLAY(...) \ - { \ - fprintf(stderr, __VA_ARGS__); \ - fflush(stderr); \ - } -#define LOCALDISPLAYLEVEL(displayLevel, l, ...) \ - if (displayLevel >= l) { \ - DISPLAY(__VA_ARGS__); \ - } /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */ -#define DISPLAYLEVEL(l, ...) LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__) - -#define LOCALDISPLAYUPDATE(displayLevel, l, ...) \ - if (displayLevel >= l) { \ - if ((clock() - g_time > refreshRate) || (displayLevel >= 4)) { \ - g_time = clock(); \ - DISPLAY(__VA_ARGS__); \ - } \ - } -#define DISPLAYUPDATE(l, ...) LOCALDISPLAYUPDATE(g_displayLevel, l, __VA_ARGS__) -static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100; -static clock_t g_time = 0; - -/*-************************************* -* Hash table -*************************************** -* A small specialized hash map for storing activeDmers. -* The map does not resize, so if it becomes full it will loop forever. -* Thus, the map must be large enough to store every value. -* The map implements linear probing and keeps its load less than 0.5. -*/ - -#define MAP_EMPTY_VALUE ((U32)-1) -typedef struct COVER_map_pair_t_s { - U32 key; - U32 value; -} COVER_map_pair_t; - -typedef struct COVER_map_s { - COVER_map_pair_t *data; - U32 sizeLog; - U32 size; - U32 sizeMask; -} COVER_map_t; - -/** - * Clear the map. - */ -static void COVER_map_clear(COVER_map_t *map) { - memset(map->data, MAP_EMPTY_VALUE, map->size * sizeof(COVER_map_pair_t)); -} - -/** - * Initializes a map of the given size. - * Returns 1 on success and 0 on failure. - * The map must be destroyed with COVER_map_destroy(). - * The map is only guaranteed to be large enough to hold size elements. - */ -static int COVER_map_init(COVER_map_t *map, U32 size) { - map->sizeLog = ZSTD_highbit32(size) + 2; - map->size = (U32)1 << map->sizeLog; - map->sizeMask = map->size - 1; - map->data = (COVER_map_pair_t *)malloc(map->size * sizeof(COVER_map_pair_t)); - if (!map->data) { - map->sizeLog = 0; - map->size = 0; - return 0; - } - COVER_map_clear(map); - return 1; -} - -/** - * Internal hash function - */ -static const U32 prime4bytes = 2654435761U; -static U32 COVER_map_hash(COVER_map_t *map, U32 key) { - return (key * prime4bytes) >> (32 - map->sizeLog); -} - -/** - * Helper function that returns the index that a key should be placed into. - */ -static U32 COVER_map_index(COVER_map_t *map, U32 key) { - const U32 hash = COVER_map_hash(map, key); - U32 i; - for (i = hash;; i = (i + 1) & map->sizeMask) { - COVER_map_pair_t *pos = &map->data[i]; - if (pos->value == MAP_EMPTY_VALUE) { - return i; - } - if (pos->key == key) { - return i; - } - } -} - -/** - * Returns the pointer to the value for key. - * If key is not in the map, it is inserted and the value is set to 0. - * The map must not be full. - */ -static U32 *COVER_map_at(COVER_map_t *map, U32 key) { - COVER_map_pair_t *pos = &map->data[COVER_map_index(map, key)]; - if (pos->value == MAP_EMPTY_VALUE) { - pos->key = key; - pos->value = 0; - } - return &pos->value; -} - -/** - * Deletes key from the map if present. - */ -static void COVER_map_remove(COVER_map_t *map, U32 key) { - U32 i = COVER_map_index(map, key); - COVER_map_pair_t *del = &map->data[i]; - U32 shift = 1; - if (del->value == MAP_EMPTY_VALUE) { - return; - } - for (i = (i + 1) & map->sizeMask;; i = (i + 1) & map->sizeMask) { - COVER_map_pair_t *const pos = &map->data[i]; - /* If the position is empty we are done */ - if (pos->value == MAP_EMPTY_VALUE) { - del->value = MAP_EMPTY_VALUE; - return; - } - /* If pos can be moved to del do so */ - if (((i - COVER_map_hash(map, pos->key)) & map->sizeMask) >= shift) { - del->key = pos->key; - del->value = pos->value; - del = pos; - shift = 1; - } else { - ++shift; - } - } -} - -/** - * Destroys a map that is inited with COVER_map_init(). - */ -static void COVER_map_destroy(COVER_map_t *map) { - if (map->data) { - free(map->data); - } - map->data = NULL; - map->size = 0; -} - -/*-************************************* -* Context -***************************************/ - -typedef struct { - const BYTE *samples; - size_t *offsets; - const size_t *samplesSizes; - size_t nbSamples; - size_t nbTrainSamples; - size_t nbTestSamples; - U32 *suffix; - size_t suffixSize; - U32 *freqs; - U32 *dmerAt; - unsigned d; -} COVER_ctx_t; - -/* We need a global context for qsort... */ -static COVER_ctx_t *g_ctx = NULL; - -/*-************************************* -* Helper functions -***************************************/ - -/** - * Returns the sum of the sample sizes. - */ -size_t COVER_sum(const size_t *samplesSizes, unsigned nbSamples) { - size_t sum = 0; - unsigned i; - for (i = 0; i < nbSamples; ++i) { - sum += samplesSizes[i]; - } - return sum; -} - -/** - * Returns -1 if the dmer at lp is less than the dmer at rp. - * Return 0 if the dmers at lp and rp are equal. - * Returns 1 if the dmer at lp is greater than the dmer at rp. - */ -static int COVER_cmp(COVER_ctx_t *ctx, const void *lp, const void *rp) { - U32 const lhs = *(U32 const *)lp; - U32 const rhs = *(U32 const *)rp; - return memcmp(ctx->samples + lhs, ctx->samples + rhs, ctx->d); -} -/** - * Faster version for d <= 8. - */ -static int COVER_cmp8(COVER_ctx_t *ctx, const void *lp, const void *rp) { - U64 const mask = (ctx->d == 8) ? (U64)-1 : (((U64)1 << (8 * ctx->d)) - 1); - U64 const lhs = MEM_readLE64(ctx->samples + *(U32 const *)lp) & mask; - U64 const rhs = MEM_readLE64(ctx->samples + *(U32 const *)rp) & mask; - if (lhs < rhs) { - return -1; - } - return (lhs > rhs); -} - -/** - * Same as COVER_cmp() except ties are broken by pointer value - * NOTE: g_ctx must be set to call this function. A global is required because - * qsort doesn't take an opaque pointer. - */ -static int COVER_strict_cmp(const void *lp, const void *rp) { - int result = COVER_cmp(g_ctx, lp, rp); - if (result == 0) { - result = lp < rp ? -1 : 1; - } - return result; -} -/** - * Faster version for d <= 8. - */ -static int COVER_strict_cmp8(const void *lp, const void *rp) { - int result = COVER_cmp8(g_ctx, lp, rp); - if (result == 0) { - result = lp < rp ? -1 : 1; - } - return result; -} - -/** - * Returns the first pointer in [first, last) whose element does not compare - * less than value. If no such element exists it returns last. - */ -static const size_t *COVER_lower_bound(const size_t *first, const size_t *last, - size_t value) { - size_t count = last - first; - while (count != 0) { - size_t step = count / 2; - const size_t *ptr = first; - ptr += step; - if (*ptr < value) { - first = ++ptr; - count -= step + 1; - } else { - count = step; - } - } - return first; -} - -/** - * Generic groupBy function. - * Groups an array sorted by cmp into groups with equivalent values. - * Calls grp for each group. - */ -static void -COVER_groupBy(const void *data, size_t count, size_t size, COVER_ctx_t *ctx, - int (*cmp)(COVER_ctx_t *, const void *, const void *), - void (*grp)(COVER_ctx_t *, const void *, const void *)) { - const BYTE *ptr = (const BYTE *)data; - size_t num = 0; - while (num < count) { - const BYTE *grpEnd = ptr + size; - ++num; - while (num < count && cmp(ctx, ptr, grpEnd) == 0) { - grpEnd += size; - ++num; - } - grp(ctx, ptr, grpEnd); - ptr = grpEnd; - } -} - -/*-************************************* -* Cover functions -***************************************/ - -/** - * Called on each group of positions with the same dmer. - * Counts the frequency of each dmer and saves it in the suffix array. - * Fills `ctx->dmerAt`. - */ -static void COVER_group(COVER_ctx_t *ctx, const void *group, - const void *groupEnd) { - /* The group consists of all the positions with the same first d bytes. */ - const U32 *grpPtr = (const U32 *)group; - const U32 *grpEnd = (const U32 *)groupEnd; - /* The dmerId is how we will reference this dmer. - * This allows us to map the whole dmer space to a much smaller space, the - * size of the suffix array. - */ - const U32 dmerId = (U32)(grpPtr - ctx->suffix); - /* Count the number of samples this dmer shows up in */ - U32 freq = 0; - /* Details */ - const size_t *curOffsetPtr = ctx->offsets; - const size_t *offsetsEnd = ctx->offsets + ctx->nbSamples; - /* Once *grpPtr >= curSampleEnd this occurrence of the dmer is in a - * different sample than the last. - */ - size_t curSampleEnd = ctx->offsets[0]; - for (; grpPtr != grpEnd; ++grpPtr) { - /* Save the dmerId for this position so we can get back to it. */ - ctx->dmerAt[*grpPtr] = dmerId; - /* Dictionaries only help for the first reference to the dmer. - * After that zstd can reference the match from the previous reference. - * So only count each dmer once for each sample it is in. - */ - if (*grpPtr < curSampleEnd) { - continue; - } - freq += 1; - /* Binary search to find the end of the sample *grpPtr is in. - * In the common case that grpPtr + 1 == grpEnd we can skip the binary - * search because the loop is over. - */ - if (grpPtr + 1 != grpEnd) { - const size_t *sampleEndPtr = - COVER_lower_bound(curOffsetPtr, offsetsEnd, *grpPtr); - curSampleEnd = *sampleEndPtr; - curOffsetPtr = sampleEndPtr + 1; - } - } - /* At this point we are never going to look at this segment of the suffix - * array again. We take advantage of this fact to save memory. - * We store the frequency of the dmer in the first position of the group, - * which is dmerId. - */ - ctx->suffix[dmerId] = freq; -} - - -/** - * Selects the best segment in an epoch. - * Segments of are scored according to the function: - * - * Let F(d) be the frequency of dmer d. - * Let S_i be the dmer at position i of segment S which has length k. - * - * Score(S) = F(S_1) + F(S_2) + ... + F(S_{k-d+1}) - * - * Once the dmer d is in the dictionary we set F(d) = 0. - */ -static COVER_segment_t COVER_selectSegment(const COVER_ctx_t *ctx, U32 *freqs, - COVER_map_t *activeDmers, U32 begin, - U32 end, - ZDICT_cover_params_t parameters) { - /* Constants */ - const U32 k = parameters.k; - const U32 d = parameters.d; - const U32 dmersInK = k - d + 1; - /* Try each segment (activeSegment) and save the best (bestSegment) */ - COVER_segment_t bestSegment = {0, 0, 0}; - COVER_segment_t activeSegment; - /* Reset the activeDmers in the segment */ - COVER_map_clear(activeDmers); - /* The activeSegment starts at the beginning of the epoch. */ - activeSegment.begin = begin; - activeSegment.end = begin; - activeSegment.score = 0; - /* Slide the activeSegment through the whole epoch. - * Save the best segment in bestSegment. - */ - while (activeSegment.end < end) { - /* The dmerId for the dmer at the next position */ - U32 newDmer = ctx->dmerAt[activeSegment.end]; - /* The entry in activeDmers for this dmerId */ - U32 *newDmerOcc = COVER_map_at(activeDmers, newDmer); - /* If the dmer isn't already present in the segment add its score. */ - if (*newDmerOcc == 0) { - /* The paper suggest using the L-0.5 norm, but experiments show that it - * doesn't help. - */ - activeSegment.score += freqs[newDmer]; - } - /* Add the dmer to the segment */ - activeSegment.end += 1; - *newDmerOcc += 1; - - /* If the window is now too large, drop the first position */ - if (activeSegment.end - activeSegment.begin == dmersInK + 1) { - U32 delDmer = ctx->dmerAt[activeSegment.begin]; - U32 *delDmerOcc = COVER_map_at(activeDmers, delDmer); - activeSegment.begin += 1; - *delDmerOcc -= 1; - /* If this is the last occurrence of the dmer, subtract its score */ - if (*delDmerOcc == 0) { - COVER_map_remove(activeDmers, delDmer); - activeSegment.score -= freqs[delDmer]; - } - } - - /* If this segment is the best so far save it */ - if (activeSegment.score > bestSegment.score) { - bestSegment = activeSegment; - } - } - { - /* Trim off the zero frequency head and tail from the segment. */ - U32 newBegin = bestSegment.end; - U32 newEnd = bestSegment.begin; - U32 pos; - for (pos = bestSegment.begin; pos != bestSegment.end; ++pos) { - U32 freq = freqs[ctx->dmerAt[pos]]; - if (freq != 0) { - newBegin = MIN(newBegin, pos); - newEnd = pos + 1; - } - } - bestSegment.begin = newBegin; - bestSegment.end = newEnd; - } - { - /* Zero out the frequency of each dmer covered by the chosen segment. */ - U32 pos; - for (pos = bestSegment.begin; pos != bestSegment.end; ++pos) { - freqs[ctx->dmerAt[pos]] = 0; - } - } - return bestSegment; -} - -/** - * Check the validity of the parameters. - * Returns non-zero if the parameters are valid and 0 otherwise. - */ -static int COVER_checkParameters(ZDICT_cover_params_t parameters, - size_t maxDictSize) { - /* k and d are required parameters */ - if (parameters.d == 0 || parameters.k == 0) { - return 0; - } - /* k <= maxDictSize */ - if (parameters.k > maxDictSize) { - return 0; - } - /* d <= k */ - if (parameters.d > parameters.k) { - return 0; - } - /* 0 < splitPoint <= 1 */ - if (parameters.splitPoint <= 0 || parameters.splitPoint > 1){ - return 0; - } - return 1; -} - -/** - * Clean up a context initialized with `COVER_ctx_init()`. - */ -static void COVER_ctx_destroy(COVER_ctx_t *ctx) { - if (!ctx) { - return; - } - if (ctx->suffix) { - free(ctx->suffix); - ctx->suffix = NULL; - } - if (ctx->freqs) { - free(ctx->freqs); - ctx->freqs = NULL; - } - if (ctx->dmerAt) { - free(ctx->dmerAt); - ctx->dmerAt = NULL; - } - if (ctx->offsets) { - free(ctx->offsets); - ctx->offsets = NULL; - } -} - -/** - * Prepare a context for dictionary building. - * The context is only dependent on the parameter `d` and can used multiple - * times. - * Returns 0 on success or error code on error. - * The context must be destroyed with `COVER_ctx_destroy()`. - */ -static size_t COVER_ctx_init(COVER_ctx_t *ctx, const void *samplesBuffer, - const size_t *samplesSizes, unsigned nbSamples, - unsigned d, double splitPoint) { - const BYTE *const samples = (const BYTE *)samplesBuffer; - const size_t totalSamplesSize = COVER_sum(samplesSizes, nbSamples); - /* Split samples into testing and training sets */ - const unsigned nbTrainSamples = splitPoint < 1.0 ? (unsigned)((double)nbSamples * splitPoint) : nbSamples; - const unsigned nbTestSamples = splitPoint < 1.0 ? nbSamples - nbTrainSamples : nbSamples; - const size_t trainingSamplesSize = splitPoint < 1.0 ? COVER_sum(samplesSizes, nbTrainSamples) : totalSamplesSize; - const size_t testSamplesSize = splitPoint < 1.0 ? COVER_sum(samplesSizes + nbTrainSamples, nbTestSamples) : totalSamplesSize; - /* Checks */ - if (totalSamplesSize < MAX(d, sizeof(U64)) || - totalSamplesSize >= (size_t)COVER_MAX_SAMPLES_SIZE) { - DISPLAYLEVEL(1, "Total samples size is too large (%u MB), maximum size is %u MB\n", - (unsigned)(totalSamplesSize>>20), (COVER_MAX_SAMPLES_SIZE >> 20)); - return ERROR(srcSize_wrong); - } - /* Check if there are at least 5 training samples */ - if (nbTrainSamples < 5) { - DISPLAYLEVEL(1, "Total number of training samples is %u and is invalid.", nbTrainSamples); - return ERROR(srcSize_wrong); - } - /* Check if there's testing sample */ - if (nbTestSamples < 1) { - DISPLAYLEVEL(1, "Total number of testing samples is %u and is invalid.", nbTestSamples); - return ERROR(srcSize_wrong); - } - /* Zero the context */ - memset(ctx, 0, sizeof(*ctx)); - DISPLAYLEVEL(2, "Training on %u samples of total size %u\n", nbTrainSamples, - (unsigned)trainingSamplesSize); - DISPLAYLEVEL(2, "Testing on %u samples of total size %u\n", nbTestSamples, - (unsigned)testSamplesSize); - ctx->samples = samples; - ctx->samplesSizes = samplesSizes; - ctx->nbSamples = nbSamples; - ctx->nbTrainSamples = nbTrainSamples; - ctx->nbTestSamples = nbTestSamples; - /* Partial suffix array */ - ctx->suffixSize = trainingSamplesSize - MAX(d, sizeof(U64)) + 1; - ctx->suffix = (U32 *)malloc(ctx->suffixSize * sizeof(U32)); - /* Maps index to the dmerID */ - ctx->dmerAt = (U32 *)malloc(ctx->suffixSize * sizeof(U32)); - /* The offsets of each file */ - ctx->offsets = (size_t *)malloc((nbSamples + 1) * sizeof(size_t)); - if (!ctx->suffix || !ctx->dmerAt || !ctx->offsets) { - DISPLAYLEVEL(1, "Failed to allocate scratch buffers\n"); - COVER_ctx_destroy(ctx); - return ERROR(memory_allocation); - } - ctx->freqs = NULL; - ctx->d = d; - - /* Fill offsets from the samplesSizes */ - { - U32 i; - ctx->offsets[0] = 0; - for (i = 1; i <= nbSamples; ++i) { - ctx->offsets[i] = ctx->offsets[i - 1] + samplesSizes[i - 1]; - } - } - DISPLAYLEVEL(2, "Constructing partial suffix array\n"); - { - /* suffix is a partial suffix array. - * It only sorts suffixes by their first parameters.d bytes. - * The sort is stable, so each dmer group is sorted by position in input. - */ - U32 i; - for (i = 0; i < ctx->suffixSize; ++i) { - ctx->suffix[i] = i; - } - /* qsort doesn't take an opaque pointer, so pass as a global. - * On OpenBSD qsort() is not guaranteed to be stable, their mergesort() is. - */ - g_ctx = ctx; -#if defined(__OpenBSD__) - mergesort(ctx->suffix, ctx->suffixSize, sizeof(U32), - (ctx->d <= 8 ? &COVER_strict_cmp8 : &COVER_strict_cmp)); -#else - qsort(ctx->suffix, ctx->suffixSize, sizeof(U32), - (ctx->d <= 8 ? &COVER_strict_cmp8 : &COVER_strict_cmp)); -#endif - } - DISPLAYLEVEL(2, "Computing frequencies\n"); - /* For each dmer group (group of positions with the same first d bytes): - * 1. For each position we set dmerAt[position] = dmerID. The dmerID is - * (groupBeginPtr - suffix). This allows us to go from position to - * dmerID so we can look up values in freq. - * 2. We calculate how many samples the dmer occurs in and save it in - * freqs[dmerId]. - */ - COVER_groupBy(ctx->suffix, ctx->suffixSize, sizeof(U32), ctx, - (ctx->d <= 8 ? &COVER_cmp8 : &COVER_cmp), &COVER_group); - ctx->freqs = ctx->suffix; - ctx->suffix = NULL; - return 0; -} - -void COVER_warnOnSmallCorpus(size_t maxDictSize, size_t nbDmers, int displayLevel) -{ - const double ratio = (double)nbDmers / maxDictSize; - if (ratio >= 10) { - return; - } - LOCALDISPLAYLEVEL(displayLevel, 1, - "WARNING: The maximum dictionary size %u is too large " - "compared to the source size %u! " - "size(source)/size(dictionary) = %f, but it should be >= " - "10! This may lead to a subpar dictionary! We recommend " - "training on sources at least 10x, and preferably 100x " - "the size of the dictionary! \n", (U32)maxDictSize, - (U32)nbDmers, ratio); -} - -COVER_epoch_info_t COVER_computeEpochs(U32 maxDictSize, - U32 nbDmers, U32 k, U32 passes) -{ - const U32 minEpochSize = k * 10; - COVER_epoch_info_t epochs; - epochs.num = MAX(1, maxDictSize / k / passes); - epochs.size = nbDmers / epochs.num; - if (epochs.size >= minEpochSize) { - assert(epochs.size * epochs.num <= nbDmers); - return epochs; - } - epochs.size = MIN(minEpochSize, nbDmers); - epochs.num = nbDmers / epochs.size; - assert(epochs.size * epochs.num <= nbDmers); - return epochs; -} - -/** - * Given the prepared context build the dictionary. - */ -static size_t COVER_buildDictionary(const COVER_ctx_t *ctx, U32 *freqs, - COVER_map_t *activeDmers, void *dictBuffer, - size_t dictBufferCapacity, - ZDICT_cover_params_t parameters) { - BYTE *const dict = (BYTE *)dictBuffer; - size_t tail = dictBufferCapacity; - /* Divide the data into epochs. We will select one segment from each epoch. */ - const COVER_epoch_info_t epochs = COVER_computeEpochs( - (U32)dictBufferCapacity, (U32)ctx->suffixSize, parameters.k, 4); - const size_t maxZeroScoreRun = MAX(10, MIN(100, epochs.num >> 3)); - size_t zeroScoreRun = 0; - size_t epoch; - DISPLAYLEVEL(2, "Breaking content into %u epochs of size %u\n", - (U32)epochs.num, (U32)epochs.size); - /* Loop through the epochs until there are no more segments or the dictionary - * is full. - */ - for (epoch = 0; tail > 0; epoch = (epoch + 1) % epochs.num) { - const U32 epochBegin = (U32)(epoch * epochs.size); - const U32 epochEnd = epochBegin + epochs.size; - size_t segmentSize; - /* Select a segment */ - COVER_segment_t segment = COVER_selectSegment( - ctx, freqs, activeDmers, epochBegin, epochEnd, parameters); - /* If the segment covers no dmers, then we are out of content. - * There may be new content in other epochs, for continue for some time. - */ - if (segment.score == 0) { - if (++zeroScoreRun >= maxZeroScoreRun) { - break; - } - continue; - } - zeroScoreRun = 0; - /* Trim the segment if necessary and if it is too small then we are done */ - segmentSize = MIN(segment.end - segment.begin + parameters.d - 1, tail); - if (segmentSize < parameters.d) { - break; - } - /* We fill the dictionary from the back to allow the best segments to be - * referenced with the smallest offsets. - */ - tail -= segmentSize; - memcpy(dict + tail, ctx->samples + segment.begin, segmentSize); - DISPLAYUPDATE( - 2, "\r%u%% ", - (unsigned)(((dictBufferCapacity - tail) * 100) / dictBufferCapacity)); - } - DISPLAYLEVEL(2, "\r%79s\r", ""); - return tail; -} - -ZDICTLIB_API size_t ZDICT_trainFromBuffer_cover( - void *dictBuffer, size_t dictBufferCapacity, - const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples, - ZDICT_cover_params_t parameters) -{ - BYTE* const dict = (BYTE*)dictBuffer; - COVER_ctx_t ctx; - COVER_map_t activeDmers; - parameters.splitPoint = 1.0; - /* Initialize global data */ - g_displayLevel = parameters.zParams.notificationLevel; - /* Checks */ - if (!COVER_checkParameters(parameters, dictBufferCapacity)) { - DISPLAYLEVEL(1, "Cover parameters incorrect\n"); - return ERROR(parameter_outOfBound); - } - if (nbSamples == 0) { - DISPLAYLEVEL(1, "Cover must have at least one input file\n"); - return ERROR(srcSize_wrong); - } - if (dictBufferCapacity < ZDICT_DICTSIZE_MIN) { - DISPLAYLEVEL(1, "dictBufferCapacity must be at least %u\n", - ZDICT_DICTSIZE_MIN); - return ERROR(dstSize_tooSmall); - } - /* Initialize context and activeDmers */ - { - size_t const initVal = COVER_ctx_init(&ctx, samplesBuffer, samplesSizes, nbSamples, - parameters.d, parameters.splitPoint); - if (ZSTD_isError(initVal)) { - return initVal; - } - } - COVER_warnOnSmallCorpus(dictBufferCapacity, ctx.suffixSize, g_displayLevel); - if (!COVER_map_init(&activeDmers, parameters.k - parameters.d + 1)) { - DISPLAYLEVEL(1, "Failed to allocate dmer map: out of memory\n"); - COVER_ctx_destroy(&ctx); - return ERROR(memory_allocation); - } - - DISPLAYLEVEL(2, "Building dictionary\n"); - { - const size_t tail = - COVER_buildDictionary(&ctx, ctx.freqs, &activeDmers, dictBuffer, - dictBufferCapacity, parameters); - const size_t dictionarySize = ZDICT_finalizeDictionary( - dict, dictBufferCapacity, dict + tail, dictBufferCapacity - tail, - samplesBuffer, samplesSizes, nbSamples, parameters.zParams); - if (!ZSTD_isError(dictionarySize)) { - DISPLAYLEVEL(2, "Constructed dictionary of size %u\n", - (unsigned)dictionarySize); - } - COVER_ctx_destroy(&ctx); - COVER_map_destroy(&activeDmers); - return dictionarySize; - } -} - - - -size_t COVER_checkTotalCompressedSize(const ZDICT_cover_params_t parameters, - const size_t *samplesSizes, const BYTE *samples, - size_t *offsets, - size_t nbTrainSamples, size_t nbSamples, - BYTE *const dict, size_t dictBufferCapacity) { - size_t totalCompressedSize = ERROR(GENERIC); - /* Pointers */ - ZSTD_CCtx *cctx; - ZSTD_CDict *cdict; - void *dst; - /* Local variables */ - size_t dstCapacity; - size_t i; - /* Allocate dst with enough space to compress the maximum sized sample */ - { - size_t maxSampleSize = 0; - i = parameters.splitPoint < 1.0 ? nbTrainSamples : 0; - for (; i < nbSamples; ++i) { - maxSampleSize = MAX(samplesSizes[i], maxSampleSize); - } - dstCapacity = ZSTD_compressBound(maxSampleSize); - dst = malloc(dstCapacity); - } - /* Create the cctx and cdict */ - cctx = ZSTD_createCCtx(); - cdict = ZSTD_createCDict(dict, dictBufferCapacity, - parameters.zParams.compressionLevel); - if (!dst || !cctx || !cdict) { - goto _compressCleanup; - } - /* Compress each sample and sum their sizes (or error) */ - totalCompressedSize = dictBufferCapacity; - i = parameters.splitPoint < 1.0 ? nbTrainSamples : 0; - for (; i < nbSamples; ++i) { - const size_t size = ZSTD_compress_usingCDict( - cctx, dst, dstCapacity, samples + offsets[i], - samplesSizes[i], cdict); - if (ZSTD_isError(size)) { - totalCompressedSize = size; - goto _compressCleanup; - } - totalCompressedSize += size; - } -_compressCleanup: - ZSTD_freeCCtx(cctx); - ZSTD_freeCDict(cdict); - if (dst) { - free(dst); - } - return totalCompressedSize; -} - - -/** - * Initialize the `COVER_best_t`. - */ -void COVER_best_init(COVER_best_t *best) { - if (best==NULL) return; /* compatible with init on NULL */ - (void)ZSTD_pthread_mutex_init(&best->mutex, NULL); - (void)ZSTD_pthread_cond_init(&best->cond, NULL); - best->liveJobs = 0; - best->dict = NULL; - best->dictSize = 0; - best->compressedSize = (size_t)-1; - memset(&best->parameters, 0, sizeof(best->parameters)); -} - -/** - * Wait until liveJobs == 0. - */ -void COVER_best_wait(COVER_best_t *best) { - if (!best) { - return; - } - ZSTD_pthread_mutex_lock(&best->mutex); - while (best->liveJobs != 0) { - ZSTD_pthread_cond_wait(&best->cond, &best->mutex); - } - ZSTD_pthread_mutex_unlock(&best->mutex); -} - -/** - * Call COVER_best_wait() and then destroy the COVER_best_t. - */ -void COVER_best_destroy(COVER_best_t *best) { - if (!best) { - return; - } - COVER_best_wait(best); - if (best->dict) { - free(best->dict); - } - ZSTD_pthread_mutex_destroy(&best->mutex); - ZSTD_pthread_cond_destroy(&best->cond); -} - -/** - * Called when a thread is about to be launched. - * Increments liveJobs. - */ -void COVER_best_start(COVER_best_t *best) { - if (!best) { - return; - } - ZSTD_pthread_mutex_lock(&best->mutex); - ++best->liveJobs; - ZSTD_pthread_mutex_unlock(&best->mutex); -} - -/** - * Called when a thread finishes executing, both on error or success. - * Decrements liveJobs and signals any waiting threads if liveJobs == 0. - * If this dictionary is the best so far save it and its parameters. - */ -void COVER_best_finish(COVER_best_t *best, ZDICT_cover_params_t parameters, - COVER_dictSelection_t selection) { - void* dict = selection.dictContent; - size_t compressedSize = selection.totalCompressedSize; - size_t dictSize = selection.dictSize; - if (!best) { - return; - } - { - size_t liveJobs; - ZSTD_pthread_mutex_lock(&best->mutex); - --best->liveJobs; - liveJobs = best->liveJobs; - /* If the new dictionary is better */ - if (compressedSize < best->compressedSize) { - /* Allocate space if necessary */ - if (!best->dict || best->dictSize < dictSize) { - if (best->dict) { - free(best->dict); - } - best->dict = malloc(dictSize); - if (!best->dict) { - best->compressedSize = ERROR(GENERIC); - best->dictSize = 0; - ZSTD_pthread_cond_signal(&best->cond); - ZSTD_pthread_mutex_unlock(&best->mutex); - return; - } - } - /* Save the dictionary, parameters, and size */ - if (dict) { - memcpy(best->dict, dict, dictSize); - best->dictSize = dictSize; - best->parameters = parameters; - best->compressedSize = compressedSize; - } - } - if (liveJobs == 0) { - ZSTD_pthread_cond_broadcast(&best->cond); - } - ZSTD_pthread_mutex_unlock(&best->mutex); - } -} - -COVER_dictSelection_t COVER_dictSelectionError(size_t error) { - COVER_dictSelection_t selection = { NULL, 0, error }; - return selection; -} - -unsigned COVER_dictSelectionIsError(COVER_dictSelection_t selection) { - return (ZSTD_isError(selection.totalCompressedSize) || !selection.dictContent); -} - -void COVER_dictSelectionFree(COVER_dictSelection_t selection){ - free(selection.dictContent); -} - -COVER_dictSelection_t COVER_selectDict(BYTE* customDictContent, - size_t dictContentSize, const BYTE* samplesBuffer, const size_t* samplesSizes, unsigned nbFinalizeSamples, - size_t nbCheckSamples, size_t nbSamples, ZDICT_cover_params_t params, size_t* offsets, size_t totalCompressedSize) { - - size_t largestDict = 0; - size_t largestCompressed = 0; - BYTE* customDictContentEnd = customDictContent + dictContentSize; - - BYTE * largestDictbuffer = (BYTE *)malloc(dictContentSize); - BYTE * candidateDictBuffer = (BYTE *)malloc(dictContentSize); - double regressionTolerance = ((double)params.shrinkDictMaxRegression / 100.0) + 1.00; - - if (!largestDictbuffer || !candidateDictBuffer) { - free(largestDictbuffer); - free(candidateDictBuffer); - return COVER_dictSelectionError(dictContentSize); - } - - /* Initial dictionary size and compressed size */ - memcpy(largestDictbuffer, customDictContent, dictContentSize); - dictContentSize = ZDICT_finalizeDictionary( - largestDictbuffer, dictContentSize, customDictContent, dictContentSize, - samplesBuffer, samplesSizes, nbFinalizeSamples, params.zParams); - - if (ZDICT_isError(dictContentSize)) { - free(largestDictbuffer); - free(candidateDictBuffer); - return COVER_dictSelectionError(dictContentSize); - } - - totalCompressedSize = COVER_checkTotalCompressedSize(params, samplesSizes, - samplesBuffer, offsets, - nbCheckSamples, nbSamples, - largestDictbuffer, dictContentSize); - - if (ZSTD_isError(totalCompressedSize)) { - free(largestDictbuffer); - free(candidateDictBuffer); - return COVER_dictSelectionError(totalCompressedSize); - } - - if (params.shrinkDict == 0) { - COVER_dictSelection_t selection = { largestDictbuffer, dictContentSize, totalCompressedSize }; - free(candidateDictBuffer); - return selection; - } - - largestDict = dictContentSize; - largestCompressed = totalCompressedSize; - dictContentSize = ZDICT_DICTSIZE_MIN; - - /* Largest dict is initially at least ZDICT_DICTSIZE_MIN */ - while (dictContentSize < largestDict) { - memcpy(candidateDictBuffer, largestDictbuffer, largestDict); - dictContentSize = ZDICT_finalizeDictionary( - candidateDictBuffer, dictContentSize, customDictContentEnd - dictContentSize, dictContentSize, - samplesBuffer, samplesSizes, nbFinalizeSamples, params.zParams); - - if (ZDICT_isError(dictContentSize)) { - free(largestDictbuffer); - free(candidateDictBuffer); - return COVER_dictSelectionError(dictContentSize); - - } - - totalCompressedSize = COVER_checkTotalCompressedSize(params, samplesSizes, - samplesBuffer, offsets, - nbCheckSamples, nbSamples, - candidateDictBuffer, dictContentSize); - - if (ZSTD_isError(totalCompressedSize)) { - free(largestDictbuffer); - free(candidateDictBuffer); - return COVER_dictSelectionError(totalCompressedSize); - } - - if (totalCompressedSize <= largestCompressed * regressionTolerance) { - COVER_dictSelection_t selection = { candidateDictBuffer, dictContentSize, totalCompressedSize }; - free(largestDictbuffer); - return selection; - } - dictContentSize *= 2; - } - dictContentSize = largestDict; - totalCompressedSize = largestCompressed; - { - COVER_dictSelection_t selection = { largestDictbuffer, dictContentSize, totalCompressedSize }; - free(candidateDictBuffer); - return selection; - } -} - -/** - * Parameters for COVER_tryParameters(). - */ -typedef struct COVER_tryParameters_data_s { - const COVER_ctx_t *ctx; - COVER_best_t *best; - size_t dictBufferCapacity; - ZDICT_cover_params_t parameters; -} COVER_tryParameters_data_t; - -/** - * Tries a set of parameters and updates the COVER_best_t with the results. - * This function is thread safe if zstd is compiled with multithreaded support. - * It takes its parameters as an *OWNING* opaque pointer to support threading. - */ -static void COVER_tryParameters(void *opaque) { - /* Save parameters as local variables */ - COVER_tryParameters_data_t *const data = (COVER_tryParameters_data_t *)opaque; - const COVER_ctx_t *const ctx = data->ctx; - const ZDICT_cover_params_t parameters = data->parameters; - size_t dictBufferCapacity = data->dictBufferCapacity; - size_t totalCompressedSize = ERROR(GENERIC); - /* Allocate space for hash table, dict, and freqs */ - COVER_map_t activeDmers; - BYTE *const dict = (BYTE * const)malloc(dictBufferCapacity); - COVER_dictSelection_t selection = COVER_dictSelectionError(ERROR(GENERIC)); - U32 *freqs = (U32 *)malloc(ctx->suffixSize * sizeof(U32)); - if (!COVER_map_init(&activeDmers, parameters.k - parameters.d + 1)) { - DISPLAYLEVEL(1, "Failed to allocate dmer map: out of memory\n"); - goto _cleanup; - } - if (!dict || !freqs) { - DISPLAYLEVEL(1, "Failed to allocate buffers: out of memory\n"); - goto _cleanup; - } - /* Copy the frequencies because we need to modify them */ - memcpy(freqs, ctx->freqs, ctx->suffixSize * sizeof(U32)); - /* Build the dictionary */ - { - const size_t tail = COVER_buildDictionary(ctx, freqs, &activeDmers, dict, - dictBufferCapacity, parameters); - selection = COVER_selectDict(dict + tail, dictBufferCapacity - tail, - ctx->samples, ctx->samplesSizes, (unsigned)ctx->nbTrainSamples, ctx->nbTrainSamples, ctx->nbSamples, parameters, ctx->offsets, - totalCompressedSize); - - if (COVER_dictSelectionIsError(selection)) { - DISPLAYLEVEL(1, "Failed to select dictionary\n"); - goto _cleanup; - } - } -_cleanup: - free(dict); - COVER_best_finish(data->best, parameters, selection); - free(data); - COVER_map_destroy(&activeDmers); - COVER_dictSelectionFree(selection); - if (freqs) { - free(freqs); - } -} - -ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_cover( - void *dictBuffer, size_t dictBufferCapacity, const void *samplesBuffer, - const size_t *samplesSizes, unsigned nbSamples, - ZDICT_cover_params_t *parameters) { - /* constants */ - const unsigned nbThreads = parameters->nbThreads; - const double splitPoint = - parameters->splitPoint <= 0.0 ? DEFAULT_SPLITPOINT : parameters->splitPoint; - const unsigned kMinD = parameters->d == 0 ? 6 : parameters->d; - const unsigned kMaxD = parameters->d == 0 ? 8 : parameters->d; - const unsigned kMinK = parameters->k == 0 ? 50 : parameters->k; - const unsigned kMaxK = parameters->k == 0 ? 2000 : parameters->k; - const unsigned kSteps = parameters->steps == 0 ? 40 : parameters->steps; - const unsigned kStepSize = MAX((kMaxK - kMinK) / kSteps, 1); - const unsigned kIterations = - (1 + (kMaxD - kMinD) / 2) * (1 + (kMaxK - kMinK) / kStepSize); - const unsigned shrinkDict = 0; - /* Local variables */ - const int displayLevel = parameters->zParams.notificationLevel; - unsigned iteration = 1; - unsigned d; - unsigned k; - COVER_best_t best; - POOL_ctx *pool = NULL; - int warned = 0; - - /* Checks */ - if (splitPoint <= 0 || splitPoint > 1) { - LOCALDISPLAYLEVEL(displayLevel, 1, "Incorrect parameters\n"); - return ERROR(parameter_outOfBound); - } - if (kMinK < kMaxD || kMaxK < kMinK) { - LOCALDISPLAYLEVEL(displayLevel, 1, "Incorrect parameters\n"); - return ERROR(parameter_outOfBound); - } - if (nbSamples == 0) { - DISPLAYLEVEL(1, "Cover must have at least one input file\n"); - return ERROR(srcSize_wrong); - } - if (dictBufferCapacity < ZDICT_DICTSIZE_MIN) { - DISPLAYLEVEL(1, "dictBufferCapacity must be at least %u\n", - ZDICT_DICTSIZE_MIN); - return ERROR(dstSize_tooSmall); - } - if (nbThreads > 1) { - pool = POOL_create(nbThreads, 1); - if (!pool) { - return ERROR(memory_allocation); - } - } - /* Initialization */ - COVER_best_init(&best); - /* Turn down global display level to clean up display at level 2 and below */ - g_displayLevel = displayLevel == 0 ? 0 : displayLevel - 1; - /* Loop through d first because each new value needs a new context */ - LOCALDISPLAYLEVEL(displayLevel, 2, "Trying %u different sets of parameters\n", - kIterations); - for (d = kMinD; d <= kMaxD; d += 2) { - /* Initialize the context for this value of d */ - COVER_ctx_t ctx; - LOCALDISPLAYLEVEL(displayLevel, 3, "d=%u\n", d); - { - const size_t initVal = COVER_ctx_init(&ctx, samplesBuffer, samplesSizes, nbSamples, d, splitPoint); - if (ZSTD_isError(initVal)) { - LOCALDISPLAYLEVEL(displayLevel, 1, "Failed to initialize context\n"); - COVER_best_destroy(&best); - POOL_free(pool); - return initVal; - } - } - if (!warned) { - COVER_warnOnSmallCorpus(dictBufferCapacity, ctx.suffixSize, displayLevel); - warned = 1; - } - /* Loop through k reusing the same context */ - for (k = kMinK; k <= kMaxK; k += kStepSize) { - /* Prepare the arguments */ - COVER_tryParameters_data_t *data = (COVER_tryParameters_data_t *)malloc( - sizeof(COVER_tryParameters_data_t)); - LOCALDISPLAYLEVEL(displayLevel, 3, "k=%u\n", k); - if (!data) { - LOCALDISPLAYLEVEL(displayLevel, 1, "Failed to allocate parameters\n"); - COVER_best_destroy(&best); - COVER_ctx_destroy(&ctx); - POOL_free(pool); - return ERROR(memory_allocation); - } - data->ctx = &ctx; - data->best = &best; - data->dictBufferCapacity = dictBufferCapacity; - data->parameters = *parameters; - data->parameters.k = k; - data->parameters.d = d; - data->parameters.splitPoint = splitPoint; - data->parameters.steps = kSteps; - data->parameters.shrinkDict = shrinkDict; - data->parameters.zParams.notificationLevel = g_displayLevel; - /* Check the parameters */ - if (!COVER_checkParameters(data->parameters, dictBufferCapacity)) { - DISPLAYLEVEL(1, "Cover parameters incorrect\n"); - free(data); - continue; - } - /* Call the function and pass ownership of data to it */ - COVER_best_start(&best); - if (pool) { - POOL_add(pool, &COVER_tryParameters, data); - } else { - COVER_tryParameters(data); - } - /* Print status */ - LOCALDISPLAYUPDATE(displayLevel, 2, "\r%u%% ", - (unsigned)((iteration * 100) / kIterations)); - ++iteration; - } - COVER_best_wait(&best); - COVER_ctx_destroy(&ctx); - } - LOCALDISPLAYLEVEL(displayLevel, 2, "\r%79s\r", ""); - /* Fill the output buffer and parameters with output of the best parameters */ - { - const size_t dictSize = best.dictSize; - if (ZSTD_isError(best.compressedSize)) { - const size_t compressedSize = best.compressedSize; - COVER_best_destroy(&best); - POOL_free(pool); - return compressedSize; - } - *parameters = best.parameters; - memcpy(dictBuffer, best.dict, dictSize); - COVER_best_destroy(&best); - POOL_free(pool); - return dictSize; - } -} diff --git a/vendor/github.com/DataDog/zstd/cover.h b/vendor/github.com/DataDog/zstd/cover.h deleted file mode 100644 index d9e0636a..00000000 --- a/vendor/github.com/DataDog/zstd/cover.h +++ /dev/null @@ -1,147 +0,0 @@ -#include /* fprintf */ -#include /* malloc, free, qsort */ -#include /* memset */ -#include /* clock */ -#include "mem.h" /* read */ -#include "pool.h" -#include "threading.h" -#include "zstd_internal.h" /* includes zstd.h */ -#ifndef ZDICT_STATIC_LINKING_ONLY -#define ZDICT_STATIC_LINKING_ONLY -#endif -#include "zdict.h" - -/** - * COVER_best_t is used for two purposes: - * 1. Synchronizing threads. - * 2. Saving the best parameters and dictionary. - * - * All of the methods except COVER_best_init() are thread safe if zstd is - * compiled with multithreaded support. - */ -typedef struct COVER_best_s { - ZSTD_pthread_mutex_t mutex; - ZSTD_pthread_cond_t cond; - size_t liveJobs; - void *dict; - size_t dictSize; - ZDICT_cover_params_t parameters; - size_t compressedSize; -} COVER_best_t; - -/** - * A segment is a range in the source as well as the score of the segment. - */ -typedef struct { - U32 begin; - U32 end; - U32 score; -} COVER_segment_t; - -/** - *Number of epochs and size of each epoch. - */ -typedef struct { - U32 num; - U32 size; -} COVER_epoch_info_t; - -/** - * Struct used for the dictionary selection function. - */ -typedef struct COVER_dictSelection { - BYTE* dictContent; - size_t dictSize; - size_t totalCompressedSize; -} COVER_dictSelection_t; - -/** - * Computes the number of epochs and the size of each epoch. - * We will make sure that each epoch gets at least 10 * k bytes. - * - * The COVER algorithms divide the data up into epochs of equal size and - * select one segment from each epoch. - * - * @param maxDictSize The maximum allowed dictionary size. - * @param nbDmers The number of dmers we are training on. - * @param k The parameter k (segment size). - * @param passes The target number of passes over the dmer corpus. - * More passes means a better dictionary. - */ -COVER_epoch_info_t COVER_computeEpochs(U32 maxDictSize, U32 nbDmers, - U32 k, U32 passes); - -/** - * Warns the user when their corpus is too small. - */ -void COVER_warnOnSmallCorpus(size_t maxDictSize, size_t nbDmers, int displayLevel); - -/** - * Checks total compressed size of a dictionary - */ -size_t COVER_checkTotalCompressedSize(const ZDICT_cover_params_t parameters, - const size_t *samplesSizes, const BYTE *samples, - size_t *offsets, - size_t nbTrainSamples, size_t nbSamples, - BYTE *const dict, size_t dictBufferCapacity); - -/** - * Returns the sum of the sample sizes. - */ -size_t COVER_sum(const size_t *samplesSizes, unsigned nbSamples) ; - -/** - * Initialize the `COVER_best_t`. - */ -void COVER_best_init(COVER_best_t *best); - -/** - * Wait until liveJobs == 0. - */ -void COVER_best_wait(COVER_best_t *best); - -/** - * Call COVER_best_wait() and then destroy the COVER_best_t. - */ -void COVER_best_destroy(COVER_best_t *best); - -/** - * Called when a thread is about to be launched. - * Increments liveJobs. - */ -void COVER_best_start(COVER_best_t *best); - -/** - * Called when a thread finishes executing, both on error or success. - * Decrements liveJobs and signals any waiting threads if liveJobs == 0. - * If this dictionary is the best so far save it and its parameters. - */ -void COVER_best_finish(COVER_best_t *best, ZDICT_cover_params_t parameters, - COVER_dictSelection_t selection); -/** - * Error function for COVER_selectDict function. Checks if the return - * value is an error. - */ -unsigned COVER_dictSelectionIsError(COVER_dictSelection_t selection); - - /** - * Error function for COVER_selectDict function. Returns a struct where - * return.totalCompressedSize is a ZSTD error. - */ -COVER_dictSelection_t COVER_dictSelectionError(size_t error); - -/** - * Always call after selectDict is called to free up used memory from - * newly created dictionary. - */ -void COVER_dictSelectionFree(COVER_dictSelection_t selection); - -/** - * Called to finalize the dictionary and select one based on whether or not - * the shrink-dict flag was enabled. If enabled the dictionary used is the - * smallest dictionary within a specified regression of the compressed size - * from the largest dictionary. - */ - COVER_dictSelection_t COVER_selectDict(BYTE* customDictContent, - size_t dictContentSize, const BYTE* samplesBuffer, const size_t* samplesSizes, unsigned nbFinalizeSamples, - size_t nbCheckSamples, size_t nbSamples, ZDICT_cover_params_t params, size_t* offsets, size_t totalCompressedSize); diff --git a/vendor/github.com/DataDog/zstd/cpu.h b/vendor/github.com/DataDog/zstd/cpu.h deleted file mode 100644 index 5f0923fc..00000000 --- a/vendor/github.com/DataDog/zstd/cpu.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2018-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_COMMON_CPU_H -#define ZSTD_COMMON_CPU_H - -/** - * Implementation taken from folly/CpuId.h - * https://github.com/facebook/folly/blob/master/folly/CpuId.h - */ - -#include - -#include "mem.h" - -#ifdef _MSC_VER -#include -#endif - -typedef struct { - U32 f1c; - U32 f1d; - U32 f7b; - U32 f7c; -} ZSTD_cpuid_t; - -MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) { - U32 f1c = 0; - U32 f1d = 0; - U32 f7b = 0; - U32 f7c = 0; -#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_IX86)) - int reg[4]; - __cpuid((int*)reg, 0); - { - int const n = reg[0]; - if (n >= 1) { - __cpuid((int*)reg, 1); - f1c = (U32)reg[2]; - f1d = (U32)reg[3]; - } - if (n >= 7) { - __cpuidex((int*)reg, 7, 0); - f7b = (U32)reg[1]; - f7c = (U32)reg[2]; - } - } -#elif defined(__i386__) && defined(__PIC__) && !defined(__clang__) && defined(__GNUC__) - /* The following block like the normal cpuid branch below, but gcc - * reserves ebx for use of its pic register so we must specially - * handle the save and restore to avoid clobbering the register - */ - U32 n; - __asm__( - "pushl %%ebx\n\t" - "cpuid\n\t" - "popl %%ebx\n\t" - : "=a"(n) - : "a"(0) - : "ecx", "edx"); - if (n >= 1) { - U32 f1a; - __asm__( - "pushl %%ebx\n\t" - "cpuid\n\t" - "popl %%ebx\n\t" - : "=a"(f1a), "=c"(f1c), "=d"(f1d) - : "a"(1)); - } - if (n >= 7) { - __asm__( - "pushl %%ebx\n\t" - "cpuid\n\t" - "movl %%ebx, %%eax\n\t" - "popl %%ebx" - : "=a"(f7b), "=c"(f7c) - : "a"(7), "c"(0) - : "edx"); - } -#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__) - U32 n; - __asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx"); - if (n >= 1) { - U32 f1a; - __asm__("cpuid" : "=a"(f1a), "=c"(f1c), "=d"(f1d) : "a"(1) : "ebx"); - } - if (n >= 7) { - U32 f7a; - __asm__("cpuid" - : "=a"(f7a), "=b"(f7b), "=c"(f7c) - : "a"(7), "c"(0) - : "edx"); - } -#endif - { - ZSTD_cpuid_t cpuid; - cpuid.f1c = f1c; - cpuid.f1d = f1d; - cpuid.f7b = f7b; - cpuid.f7c = f7c; - return cpuid; - } -} - -#define X(name, r, bit) \ - MEM_STATIC int ZSTD_cpuid_##name(ZSTD_cpuid_t const cpuid) { \ - return ((cpuid.r) & (1U << bit)) != 0; \ - } - -/* cpuid(1): Processor Info and Feature Bits. */ -#define C(name, bit) X(name, f1c, bit) - C(sse3, 0) - C(pclmuldq, 1) - C(dtes64, 2) - C(monitor, 3) - C(dscpl, 4) - C(vmx, 5) - C(smx, 6) - C(eist, 7) - C(tm2, 8) - C(ssse3, 9) - C(cnxtid, 10) - C(fma, 12) - C(cx16, 13) - C(xtpr, 14) - C(pdcm, 15) - C(pcid, 17) - C(dca, 18) - C(sse41, 19) - C(sse42, 20) - C(x2apic, 21) - C(movbe, 22) - C(popcnt, 23) - C(tscdeadline, 24) - C(aes, 25) - C(xsave, 26) - C(osxsave, 27) - C(avx, 28) - C(f16c, 29) - C(rdrand, 30) -#undef C -#define D(name, bit) X(name, f1d, bit) - D(fpu, 0) - D(vme, 1) - D(de, 2) - D(pse, 3) - D(tsc, 4) - D(msr, 5) - D(pae, 6) - D(mce, 7) - D(cx8, 8) - D(apic, 9) - D(sep, 11) - D(mtrr, 12) - D(pge, 13) - D(mca, 14) - D(cmov, 15) - D(pat, 16) - D(pse36, 17) - D(psn, 18) - D(clfsh, 19) - D(ds, 21) - D(acpi, 22) - D(mmx, 23) - D(fxsr, 24) - D(sse, 25) - D(sse2, 26) - D(ss, 27) - D(htt, 28) - D(tm, 29) - D(pbe, 31) -#undef D - -/* cpuid(7): Extended Features. */ -#define B(name, bit) X(name, f7b, bit) - B(bmi1, 3) - B(hle, 4) - B(avx2, 5) - B(smep, 7) - B(bmi2, 8) - B(erms, 9) - B(invpcid, 10) - B(rtm, 11) - B(mpx, 14) - B(avx512f, 16) - B(avx512dq, 17) - B(rdseed, 18) - B(adx, 19) - B(smap, 20) - B(avx512ifma, 21) - B(pcommit, 22) - B(clflushopt, 23) - B(clwb, 24) - B(avx512pf, 26) - B(avx512er, 27) - B(avx512cd, 28) - B(sha, 29) - B(avx512bw, 30) - B(avx512vl, 31) -#undef B -#define C(name, bit) X(name, f7c, bit) - C(prefetchwt1, 0) - C(avx512vbmi, 1) -#undef C - -#undef X - -#endif /* ZSTD_COMMON_CPU_H */ diff --git a/vendor/github.com/DataDog/zstd/debug.c b/vendor/github.com/DataDog/zstd/debug.c deleted file mode 100644 index 3ebdd1cb..00000000 --- a/vendor/github.com/DataDog/zstd/debug.c +++ /dev/null @@ -1,44 +0,0 @@ -/* ****************************************************************** - debug - Part of FSE library - Copyright (C) 2013-present, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - Source repository : https://github.com/Cyan4973/FiniteStateEntropy -****************************************************************** */ - - -/* - * This module only hosts one global variable - * which can be used to dynamically influence the verbosity of traces, - * such as DEBUGLOG and RAWLOG - */ - -#include "debug.h" - -int g_debuglevel = DEBUGLEVEL; diff --git a/vendor/github.com/DataDog/zstd/debug.h b/vendor/github.com/DataDog/zstd/debug.h deleted file mode 100644 index b4fc89d4..00000000 --- a/vendor/github.com/DataDog/zstd/debug.h +++ /dev/null @@ -1,134 +0,0 @@ -/* ****************************************************************** - debug - Part of FSE library - Copyright (C) 2013-present, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - Source repository : https://github.com/Cyan4973/FiniteStateEntropy -****************************************************************** */ - - -/* - * The purpose of this header is to enable debug functions. - * They regroup assert(), DEBUGLOG() and RAWLOG() for run-time, - * and DEBUG_STATIC_ASSERT() for compile-time. - * - * By default, DEBUGLEVEL==0, which means run-time debug is disabled. - * - * Level 1 enables assert() only. - * Starting level 2, traces can be generated and pushed to stderr. - * The higher the level, the more verbose the traces. - * - * It's possible to dynamically adjust level using variable g_debug_level, - * which is only declared if DEBUGLEVEL>=2, - * and is a global variable, not multi-thread protected (use with care) - */ - -#ifndef DEBUG_H_12987983217 -#define DEBUG_H_12987983217 - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* static assert is triggered at compile time, leaving no runtime artefact. - * static assert only works with compile-time constants. - * Also, this variant can only be used inside a function. */ -#define DEBUG_STATIC_ASSERT(c) (void)sizeof(char[(c) ? 1 : -1]) - - -/* DEBUGLEVEL is expected to be defined externally, - * typically through compiler command line. - * Value must be a number. */ -#ifndef DEBUGLEVEL -# define DEBUGLEVEL 0 -#endif - - -/* DEBUGFILE can be defined externally, - * typically through compiler command line. - * note : currently useless. - * Value must be stderr or stdout */ -#ifndef DEBUGFILE -# define DEBUGFILE stderr -#endif - - -/* recommended values for DEBUGLEVEL : - * 0 : release mode, no debug, all run-time checks disabled - * 1 : enables assert() only, no display - * 2 : reserved, for currently active debug path - * 3 : events once per object lifetime (CCtx, CDict, etc.) - * 4 : events once per frame - * 5 : events once per block - * 6 : events once per sequence (verbose) - * 7+: events at every position (*very* verbose) - * - * It's generally inconvenient to output traces > 5. - * In which case, it's possible to selectively trigger high verbosity levels - * by modifying g_debug_level. - */ - -#if (DEBUGLEVEL>=1) -# include -#else -# ifndef assert /* assert may be already defined, due to prior #include */ -# define assert(condition) ((void)0) /* disable assert (default) */ -# endif -#endif - -#if (DEBUGLEVEL>=2) -# include -extern int g_debuglevel; /* the variable is only declared, - it actually lives in debug.c, - and is shared by the whole process. - It's not thread-safe. - It's useful when enabling very verbose levels - on selective conditions (such as position in src) */ - -# define RAWLOG(l, ...) { \ - if (l<=g_debuglevel) { \ - fprintf(stderr, __VA_ARGS__); \ - } } -# define DEBUGLOG(l, ...) { \ - if (l<=g_debuglevel) { \ - fprintf(stderr, __FILE__ ": " __VA_ARGS__); \ - fprintf(stderr, " \n"); \ - } } -#else -# define RAWLOG(l, ...) {} /* disabled */ -# define DEBUGLOG(l, ...) {} /* disabled */ -#endif - - -#if defined (__cplusplus) -} -#endif - -#endif /* DEBUG_H_12987983217 */ diff --git a/vendor/github.com/DataDog/zstd/divsufsort.c b/vendor/github.com/DataDog/zstd/divsufsort.c deleted file mode 100644 index ead92204..00000000 --- a/vendor/github.com/DataDog/zstd/divsufsort.c +++ /dev/null @@ -1,1913 +0,0 @@ -/* - * divsufsort.c for libdivsufsort-lite - * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/*- Compiler specifics -*/ -#ifdef __clang__ -#pragma clang diagnostic ignored "-Wshorten-64-to-32" -#endif - -#if defined(_MSC_VER) -# pragma warning(disable : 4244) -# pragma warning(disable : 4127) /* C4127 : Condition expression is constant */ -#endif - - -/*- Dependencies -*/ -#include -#include -#include - -#include "divsufsort.h" - -/*- Constants -*/ -#if defined(INLINE) -# undef INLINE -#endif -#if !defined(INLINE) -# define INLINE __inline -#endif -#if defined(ALPHABET_SIZE) && (ALPHABET_SIZE < 1) -# undef ALPHABET_SIZE -#endif -#if !defined(ALPHABET_SIZE) -# define ALPHABET_SIZE (256) -#endif -#define BUCKET_A_SIZE (ALPHABET_SIZE) -#define BUCKET_B_SIZE (ALPHABET_SIZE * ALPHABET_SIZE) -#if defined(SS_INSERTIONSORT_THRESHOLD) -# if SS_INSERTIONSORT_THRESHOLD < 1 -# undef SS_INSERTIONSORT_THRESHOLD -# define SS_INSERTIONSORT_THRESHOLD (1) -# endif -#else -# define SS_INSERTIONSORT_THRESHOLD (8) -#endif -#if defined(SS_BLOCKSIZE) -# if SS_BLOCKSIZE < 0 -# undef SS_BLOCKSIZE -# define SS_BLOCKSIZE (0) -# elif 32768 <= SS_BLOCKSIZE -# undef SS_BLOCKSIZE -# define SS_BLOCKSIZE (32767) -# endif -#else -# define SS_BLOCKSIZE (1024) -#endif -/* minstacksize = log(SS_BLOCKSIZE) / log(3) * 2 */ -#if SS_BLOCKSIZE == 0 -# define SS_MISORT_STACKSIZE (96) -#elif SS_BLOCKSIZE <= 4096 -# define SS_MISORT_STACKSIZE (16) -#else -# define SS_MISORT_STACKSIZE (24) -#endif -#define SS_SMERGE_STACKSIZE (32) -#define TR_INSERTIONSORT_THRESHOLD (8) -#define TR_STACKSIZE (64) - - -/*- Macros -*/ -#ifndef SWAP -# define SWAP(_a, _b) do { t = (_a); (_a) = (_b); (_b) = t; } while(0) -#endif /* SWAP */ -#ifndef MIN -# define MIN(_a, _b) (((_a) < (_b)) ? (_a) : (_b)) -#endif /* MIN */ -#ifndef MAX -# define MAX(_a, _b) (((_a) > (_b)) ? (_a) : (_b)) -#endif /* MAX */ -#define STACK_PUSH(_a, _b, _c, _d)\ - do {\ - assert(ssize < STACK_SIZE);\ - stack[ssize].a = (_a), stack[ssize].b = (_b),\ - stack[ssize].c = (_c), stack[ssize++].d = (_d);\ - } while(0) -#define STACK_PUSH5(_a, _b, _c, _d, _e)\ - do {\ - assert(ssize < STACK_SIZE);\ - stack[ssize].a = (_a), stack[ssize].b = (_b),\ - stack[ssize].c = (_c), stack[ssize].d = (_d), stack[ssize++].e = (_e);\ - } while(0) -#define STACK_POP(_a, _b, _c, _d)\ - do {\ - assert(0 <= ssize);\ - if(ssize == 0) { return; }\ - (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\ - (_c) = stack[ssize].c, (_d) = stack[ssize].d;\ - } while(0) -#define STACK_POP5(_a, _b, _c, _d, _e)\ - do {\ - assert(0 <= ssize);\ - if(ssize == 0) { return; }\ - (_a) = stack[--ssize].a, (_b) = stack[ssize].b,\ - (_c) = stack[ssize].c, (_d) = stack[ssize].d, (_e) = stack[ssize].e;\ - } while(0) -#define BUCKET_A(_c0) bucket_A[(_c0)] -#if ALPHABET_SIZE == 256 -#define BUCKET_B(_c0, _c1) (bucket_B[((_c1) << 8) | (_c0)]) -#define BUCKET_BSTAR(_c0, _c1) (bucket_B[((_c0) << 8) | (_c1)]) -#else -#define BUCKET_B(_c0, _c1) (bucket_B[(_c1) * ALPHABET_SIZE + (_c0)]) -#define BUCKET_BSTAR(_c0, _c1) (bucket_B[(_c0) * ALPHABET_SIZE + (_c1)]) -#endif - - -/*- Private Functions -*/ - -static const int lg_table[256]= { - -1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; - -#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) - -static INLINE -int -ss_ilg(int n) { -#if SS_BLOCKSIZE == 0 - return (n & 0xffff0000) ? - ((n & 0xff000000) ? - 24 + lg_table[(n >> 24) & 0xff] : - 16 + lg_table[(n >> 16) & 0xff]) : - ((n & 0x0000ff00) ? - 8 + lg_table[(n >> 8) & 0xff] : - 0 + lg_table[(n >> 0) & 0xff]); -#elif SS_BLOCKSIZE < 256 - return lg_table[n]; -#else - return (n & 0xff00) ? - 8 + lg_table[(n >> 8) & 0xff] : - 0 + lg_table[(n >> 0) & 0xff]; -#endif -} - -#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */ - -#if SS_BLOCKSIZE != 0 - -static const int sqq_table[256] = { - 0, 16, 22, 27, 32, 35, 39, 42, 45, 48, 50, 53, 55, 57, 59, 61, - 64, 65, 67, 69, 71, 73, 75, 76, 78, 80, 81, 83, 84, 86, 87, 89, - 90, 91, 93, 94, 96, 97, 98, 99, 101, 102, 103, 104, 106, 107, 108, 109, -110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -128, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, -143, 144, 144, 145, 146, 147, 148, 149, 150, 150, 151, 152, 153, 154, 155, 155, -156, 157, 158, 159, 160, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, -169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, 177, 178, 178, 179, 180, -181, 181, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, -192, 192, 193, 193, 194, 195, 195, 196, 197, 197, 198, 199, 199, 200, 201, 201, -202, 203, 203, 204, 204, 205, 206, 206, 207, 208, 208, 209, 209, 210, 211, 211, -212, 212, 213, 214, 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 221, -221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, 227, 228, 229, 229, 230, -230, 231, 231, 232, 232, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, -239, 240, 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 247, -247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 253, 254, 254, 255 -}; - -static INLINE -int -ss_isqrt(int x) { - int y, e; - - if(x >= (SS_BLOCKSIZE * SS_BLOCKSIZE)) { return SS_BLOCKSIZE; } - e = (x & 0xffff0000) ? - ((x & 0xff000000) ? - 24 + lg_table[(x >> 24) & 0xff] : - 16 + lg_table[(x >> 16) & 0xff]) : - ((x & 0x0000ff00) ? - 8 + lg_table[(x >> 8) & 0xff] : - 0 + lg_table[(x >> 0) & 0xff]); - - if(e >= 16) { - y = sqq_table[x >> ((e - 6) - (e & 1))] << ((e >> 1) - 7); - if(e >= 24) { y = (y + 1 + x / y) >> 1; } - y = (y + 1 + x / y) >> 1; - } else if(e >= 8) { - y = (sqq_table[x >> ((e - 6) - (e & 1))] >> (7 - (e >> 1))) + 1; - } else { - return sqq_table[x] >> 4; - } - - return (x < (y * y)) ? y - 1 : y; -} - -#endif /* SS_BLOCKSIZE != 0 */ - - -/*---------------------------------------------------------------------------*/ - -/* Compares two suffixes. */ -static INLINE -int -ss_compare(const unsigned char *T, - const int *p1, const int *p2, - int depth) { - const unsigned char *U1, *U2, *U1n, *U2n; - - for(U1 = T + depth + *p1, - U2 = T + depth + *p2, - U1n = T + *(p1 + 1) + 2, - U2n = T + *(p2 + 1) + 2; - (U1 < U1n) && (U2 < U2n) && (*U1 == *U2); - ++U1, ++U2) { - } - - return U1 < U1n ? - (U2 < U2n ? *U1 - *U2 : 1) : - (U2 < U2n ? -1 : 0); -} - - -/*---------------------------------------------------------------------------*/ - -#if (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1) - -/* Insertionsort for small size groups */ -static -void -ss_insertionsort(const unsigned char *T, const int *PA, - int *first, int *last, int depth) { - int *i, *j; - int t; - int r; - - for(i = last - 2; first <= i; --i) { - for(t = *i, j = i + 1; 0 < (r = ss_compare(T, PA + t, PA + *j, depth));) { - do { *(j - 1) = *j; } while((++j < last) && (*j < 0)); - if(last <= j) { break; } - } - if(r == 0) { *j = ~*j; } - *(j - 1) = t; - } -} - -#endif /* (SS_BLOCKSIZE != 1) && (SS_INSERTIONSORT_THRESHOLD != 1) */ - - -/*---------------------------------------------------------------------------*/ - -#if (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) - -static INLINE -void -ss_fixdown(const unsigned char *Td, const int *PA, - int *SA, int i, int size) { - int j, k; - int v; - int c, d, e; - - for(v = SA[i], c = Td[PA[v]]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) { - d = Td[PA[SA[k = j++]]]; - if(d < (e = Td[PA[SA[j]]])) { k = j; d = e; } - if(d <= c) { break; } - } - SA[i] = v; -} - -/* Simple top-down heapsort. */ -static -void -ss_heapsort(const unsigned char *Td, const int *PA, int *SA, int size) { - int i, m; - int t; - - m = size; - if((size % 2) == 0) { - m--; - if(Td[PA[SA[m / 2]]] < Td[PA[SA[m]]]) { SWAP(SA[m], SA[m / 2]); } - } - - for(i = m / 2 - 1; 0 <= i; --i) { ss_fixdown(Td, PA, SA, i, m); } - if((size % 2) == 0) { SWAP(SA[0], SA[m]); ss_fixdown(Td, PA, SA, 0, m); } - for(i = m - 1; 0 < i; --i) { - t = SA[0], SA[0] = SA[i]; - ss_fixdown(Td, PA, SA, 0, i); - SA[i] = t; - } -} - - -/*---------------------------------------------------------------------------*/ - -/* Returns the median of three elements. */ -static INLINE -int * -ss_median3(const unsigned char *Td, const int *PA, - int *v1, int *v2, int *v3) { - int *t; - if(Td[PA[*v1]] > Td[PA[*v2]]) { SWAP(v1, v2); } - if(Td[PA[*v2]] > Td[PA[*v3]]) { - if(Td[PA[*v1]] > Td[PA[*v3]]) { return v1; } - else { return v3; } - } - return v2; -} - -/* Returns the median of five elements. */ -static INLINE -int * -ss_median5(const unsigned char *Td, const int *PA, - int *v1, int *v2, int *v3, int *v4, int *v5) { - int *t; - if(Td[PA[*v2]] > Td[PA[*v3]]) { SWAP(v2, v3); } - if(Td[PA[*v4]] > Td[PA[*v5]]) { SWAP(v4, v5); } - if(Td[PA[*v2]] > Td[PA[*v4]]) { SWAP(v2, v4); SWAP(v3, v5); } - if(Td[PA[*v1]] > Td[PA[*v3]]) { SWAP(v1, v3); } - if(Td[PA[*v1]] > Td[PA[*v4]]) { SWAP(v1, v4); SWAP(v3, v5); } - if(Td[PA[*v3]] > Td[PA[*v4]]) { return v4; } - return v3; -} - -/* Returns the pivot element. */ -static INLINE -int * -ss_pivot(const unsigned char *Td, const int *PA, int *first, int *last) { - int *middle; - int t; - - t = last - first; - middle = first + t / 2; - - if(t <= 512) { - if(t <= 32) { - return ss_median3(Td, PA, first, middle, last - 1); - } else { - t >>= 2; - return ss_median5(Td, PA, first, first + t, middle, last - 1 - t, last - 1); - } - } - t >>= 3; - first = ss_median3(Td, PA, first, first + t, first + (t << 1)); - middle = ss_median3(Td, PA, middle - t, middle, middle + t); - last = ss_median3(Td, PA, last - 1 - (t << 1), last - 1 - t, last - 1); - return ss_median3(Td, PA, first, middle, last); -} - - -/*---------------------------------------------------------------------------*/ - -/* Binary partition for substrings. */ -static INLINE -int * -ss_partition(const int *PA, - int *first, int *last, int depth) { - int *a, *b; - int t; - for(a = first - 1, b = last;;) { - for(; (++a < b) && ((PA[*a] + depth) >= (PA[*a + 1] + 1));) { *a = ~*a; } - for(; (a < --b) && ((PA[*b] + depth) < (PA[*b + 1] + 1));) { } - if(b <= a) { break; } - t = ~*b; - *b = *a; - *a = t; - } - if(first < a) { *first = ~*first; } - return a; -} - -/* Multikey introsort for medium size groups. */ -static -void -ss_mintrosort(const unsigned char *T, const int *PA, - int *first, int *last, - int depth) { -#define STACK_SIZE SS_MISORT_STACKSIZE - struct { int *a, *b, c; int d; } stack[STACK_SIZE]; - const unsigned char *Td; - int *a, *b, *c, *d, *e, *f; - int s, t; - int ssize; - int limit; - int v, x = 0; - - for(ssize = 0, limit = ss_ilg(last - first);;) { - - if((last - first) <= SS_INSERTIONSORT_THRESHOLD) { -#if 1 < SS_INSERTIONSORT_THRESHOLD - if(1 < (last - first)) { ss_insertionsort(T, PA, first, last, depth); } -#endif - STACK_POP(first, last, depth, limit); - continue; - } - - Td = T + depth; - if(limit-- == 0) { ss_heapsort(Td, PA, first, last - first); } - if(limit < 0) { - for(a = first + 1, v = Td[PA[*first]]; a < last; ++a) { - if((x = Td[PA[*a]]) != v) { - if(1 < (a - first)) { break; } - v = x; - first = a; - } - } - if(Td[PA[*first] - 1] < v) { - first = ss_partition(PA, first, a, depth); - } - if((a - first) <= (last - a)) { - if(1 < (a - first)) { - STACK_PUSH(a, last, depth, -1); - last = a, depth += 1, limit = ss_ilg(a - first); - } else { - first = a, limit = -1; - } - } else { - if(1 < (last - a)) { - STACK_PUSH(first, a, depth + 1, ss_ilg(a - first)); - first = a, limit = -1; - } else { - last = a, depth += 1, limit = ss_ilg(a - first); - } - } - continue; - } - - /* choose pivot */ - a = ss_pivot(Td, PA, first, last); - v = Td[PA[*a]]; - SWAP(*first, *a); - - /* partition */ - for(b = first; (++b < last) && ((x = Td[PA[*b]]) == v);) { } - if(((a = b) < last) && (x < v)) { - for(; (++b < last) && ((x = Td[PA[*b]]) <= v);) { - if(x == v) { SWAP(*b, *a); ++a; } - } - } - for(c = last; (b < --c) && ((x = Td[PA[*c]]) == v);) { } - if((b < (d = c)) && (x > v)) { - for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) { - if(x == v) { SWAP(*c, *d); --d; } - } - } - for(; b < c;) { - SWAP(*b, *c); - for(; (++b < c) && ((x = Td[PA[*b]]) <= v);) { - if(x == v) { SWAP(*b, *a); ++a; } - } - for(; (b < --c) && ((x = Td[PA[*c]]) >= v);) { - if(x == v) { SWAP(*c, *d); --d; } - } - } - - if(a <= d) { - c = b - 1; - - if((s = a - first) > (t = b - a)) { s = t; } - for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } - if((s = d - c) > (t = last - d - 1)) { s = t; } - for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } - - a = first + (b - a), c = last - (d - c); - b = (v <= Td[PA[*a] - 1]) ? a : ss_partition(PA, a, c, depth); - - if((a - first) <= (last - c)) { - if((last - c) <= (c - b)) { - STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); - STACK_PUSH(c, last, depth, limit); - last = a; - } else if((a - first) <= (c - b)) { - STACK_PUSH(c, last, depth, limit); - STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); - last = a; - } else { - STACK_PUSH(c, last, depth, limit); - STACK_PUSH(first, a, depth, limit); - first = b, last = c, depth += 1, limit = ss_ilg(c - b); - } - } else { - if((a - first) <= (c - b)) { - STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); - STACK_PUSH(first, a, depth, limit); - first = c; - } else if((last - c) <= (c - b)) { - STACK_PUSH(first, a, depth, limit); - STACK_PUSH(b, c, depth + 1, ss_ilg(c - b)); - first = c; - } else { - STACK_PUSH(first, a, depth, limit); - STACK_PUSH(c, last, depth, limit); - first = b, last = c, depth += 1, limit = ss_ilg(c - b); - } - } - } else { - limit += 1; - if(Td[PA[*first] - 1] < v) { - first = ss_partition(PA, first, last, depth); - limit = ss_ilg(last - first); - } - depth += 1; - } - } -#undef STACK_SIZE -} - -#endif /* (SS_BLOCKSIZE == 0) || (SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE) */ - - -/*---------------------------------------------------------------------------*/ - -#if SS_BLOCKSIZE != 0 - -static INLINE -void -ss_blockswap(int *a, int *b, int n) { - int t; - for(; 0 < n; --n, ++a, ++b) { - t = *a, *a = *b, *b = t; - } -} - -static INLINE -void -ss_rotate(int *first, int *middle, int *last) { - int *a, *b, t; - int l, r; - l = middle - first, r = last - middle; - for(; (0 < l) && (0 < r);) { - if(l == r) { ss_blockswap(first, middle, l); break; } - if(l < r) { - a = last - 1, b = middle - 1; - t = *a; - do { - *a-- = *b, *b-- = *a; - if(b < first) { - *a = t; - last = a; - if((r -= l + 1) <= l) { break; } - a -= 1, b = middle - 1; - t = *a; - } - } while(1); - } else { - a = first, b = middle; - t = *a; - do { - *a++ = *b, *b++ = *a; - if(last <= b) { - *a = t; - first = a + 1; - if((l -= r + 1) <= r) { break; } - a += 1, b = middle; - t = *a; - } - } while(1); - } - } -} - - -/*---------------------------------------------------------------------------*/ - -static -void -ss_inplacemerge(const unsigned char *T, const int *PA, - int *first, int *middle, int *last, - int depth) { - const int *p; - int *a, *b; - int len, half; - int q, r; - int x; - - for(;;) { - if(*(last - 1) < 0) { x = 1; p = PA + ~*(last - 1); } - else { x = 0; p = PA + *(last - 1); } - for(a = first, len = middle - first, half = len >> 1, r = -1; - 0 < len; - len = half, half >>= 1) { - b = a + half; - q = ss_compare(T, PA + ((0 <= *b) ? *b : ~*b), p, depth); - if(q < 0) { - a = b + 1; - half -= (len & 1) ^ 1; - } else { - r = q; - } - } - if(a < middle) { - if(r == 0) { *a = ~*a; } - ss_rotate(a, middle, last); - last -= middle - a; - middle = a; - if(first == middle) { break; } - } - --last; - if(x != 0) { while(*--last < 0) { } } - if(middle == last) { break; } - } -} - - -/*---------------------------------------------------------------------------*/ - -/* Merge-forward with internal buffer. */ -static -void -ss_mergeforward(const unsigned char *T, const int *PA, - int *first, int *middle, int *last, - int *buf, int depth) { - int *a, *b, *c, *bufend; - int t; - int r; - - bufend = buf + (middle - first) - 1; - ss_blockswap(buf, first, middle - first); - - for(t = *(a = first), b = buf, c = middle;;) { - r = ss_compare(T, PA + *b, PA + *c, depth); - if(r < 0) { - do { - *a++ = *b; - if(bufend <= b) { *bufend = t; return; } - *b++ = *a; - } while(*b < 0); - } else if(r > 0) { - do { - *a++ = *c, *c++ = *a; - if(last <= c) { - while(b < bufend) { *a++ = *b, *b++ = *a; } - *a = *b, *b = t; - return; - } - } while(*c < 0); - } else { - *c = ~*c; - do { - *a++ = *b; - if(bufend <= b) { *bufend = t; return; } - *b++ = *a; - } while(*b < 0); - - do { - *a++ = *c, *c++ = *a; - if(last <= c) { - while(b < bufend) { *a++ = *b, *b++ = *a; } - *a = *b, *b = t; - return; - } - } while(*c < 0); - } - } -} - -/* Merge-backward with internal buffer. */ -static -void -ss_mergebackward(const unsigned char *T, const int *PA, - int *first, int *middle, int *last, - int *buf, int depth) { - const int *p1, *p2; - int *a, *b, *c, *bufend; - int t; - int r; - int x; - - bufend = buf + (last - middle) - 1; - ss_blockswap(buf, middle, last - middle); - - x = 0; - if(*bufend < 0) { p1 = PA + ~*bufend; x |= 1; } - else { p1 = PA + *bufend; } - if(*(middle - 1) < 0) { p2 = PA + ~*(middle - 1); x |= 2; } - else { p2 = PA + *(middle - 1); } - for(t = *(a = last - 1), b = bufend, c = middle - 1;;) { - r = ss_compare(T, p1, p2, depth); - if(0 < r) { - if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; } - *a-- = *b; - if(b <= buf) { *buf = t; break; } - *b-- = *a; - if(*b < 0) { p1 = PA + ~*b; x |= 1; } - else { p1 = PA + *b; } - } else if(r < 0) { - if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; } - *a-- = *c, *c-- = *a; - if(c < first) { - while(buf < b) { *a-- = *b, *b-- = *a; } - *a = *b, *b = t; - break; - } - if(*c < 0) { p2 = PA + ~*c; x |= 2; } - else { p2 = PA + *c; } - } else { - if(x & 1) { do { *a-- = *b, *b-- = *a; } while(*b < 0); x ^= 1; } - *a-- = ~*b; - if(b <= buf) { *buf = t; break; } - *b-- = *a; - if(x & 2) { do { *a-- = *c, *c-- = *a; } while(*c < 0); x ^= 2; } - *a-- = *c, *c-- = *a; - if(c < first) { - while(buf < b) { *a-- = *b, *b-- = *a; } - *a = *b, *b = t; - break; - } - if(*b < 0) { p1 = PA + ~*b; x |= 1; } - else { p1 = PA + *b; } - if(*c < 0) { p2 = PA + ~*c; x |= 2; } - else { p2 = PA + *c; } - } - } -} - -/* D&C based merge. */ -static -void -ss_swapmerge(const unsigned char *T, const int *PA, - int *first, int *middle, int *last, - int *buf, int bufsize, int depth) { -#define STACK_SIZE SS_SMERGE_STACKSIZE -#define GETIDX(a) ((0 <= (a)) ? (a) : (~(a))) -#define MERGE_CHECK(a, b, c)\ - do {\ - if(((c) & 1) ||\ - (((c) & 2) && (ss_compare(T, PA + GETIDX(*((a) - 1)), PA + *(a), depth) == 0))) {\ - *(a) = ~*(a);\ - }\ - if(((c) & 4) && ((ss_compare(T, PA + GETIDX(*((b) - 1)), PA + *(b), depth) == 0))) {\ - *(b) = ~*(b);\ - }\ - } while(0) - struct { int *a, *b, *c; int d; } stack[STACK_SIZE]; - int *l, *r, *lm, *rm; - int m, len, half; - int ssize; - int check, next; - - for(check = 0, ssize = 0;;) { - if((last - middle) <= bufsize) { - if((first < middle) && (middle < last)) { - ss_mergebackward(T, PA, first, middle, last, buf, depth); - } - MERGE_CHECK(first, last, check); - STACK_POP(first, middle, last, check); - continue; - } - - if((middle - first) <= bufsize) { - if(first < middle) { - ss_mergeforward(T, PA, first, middle, last, buf, depth); - } - MERGE_CHECK(first, last, check); - STACK_POP(first, middle, last, check); - continue; - } - - for(m = 0, len = MIN(middle - first, last - middle), half = len >> 1; - 0 < len; - len = half, half >>= 1) { - if(ss_compare(T, PA + GETIDX(*(middle + m + half)), - PA + GETIDX(*(middle - m - half - 1)), depth) < 0) { - m += half + 1; - half -= (len & 1) ^ 1; - } - } - - if(0 < m) { - lm = middle - m, rm = middle + m; - ss_blockswap(lm, middle, m); - l = r = middle, next = 0; - if(rm < last) { - if(*rm < 0) { - *rm = ~*rm; - if(first < lm) { for(; *--l < 0;) { } next |= 4; } - next |= 1; - } else if(first < lm) { - for(; *r < 0; ++r) { } - next |= 2; - } - } - - if((l - first) <= (last - r)) { - STACK_PUSH(r, rm, last, (next & 3) | (check & 4)); - middle = lm, last = l, check = (check & 3) | (next & 4); - } else { - if((next & 2) && (r == middle)) { next ^= 6; } - STACK_PUSH(first, lm, l, (check & 3) | (next & 4)); - first = r, middle = rm, check = (next & 3) | (check & 4); - } - } else { - if(ss_compare(T, PA + GETIDX(*(middle - 1)), PA + *middle, depth) == 0) { - *middle = ~*middle; - } - MERGE_CHECK(first, last, check); - STACK_POP(first, middle, last, check); - } - } -#undef STACK_SIZE -} - -#endif /* SS_BLOCKSIZE != 0 */ - - -/*---------------------------------------------------------------------------*/ - -/* Substring sort */ -static -void -sssort(const unsigned char *T, const int *PA, - int *first, int *last, - int *buf, int bufsize, - int depth, int n, int lastsuffix) { - int *a; -#if SS_BLOCKSIZE != 0 - int *b, *middle, *curbuf; - int j, k, curbufsize, limit; -#endif - int i; - - if(lastsuffix != 0) { ++first; } - -#if SS_BLOCKSIZE == 0 - ss_mintrosort(T, PA, first, last, depth); -#else - if((bufsize < SS_BLOCKSIZE) && - (bufsize < (last - first)) && - (bufsize < (limit = ss_isqrt(last - first)))) { - if(SS_BLOCKSIZE < limit) { limit = SS_BLOCKSIZE; } - buf = middle = last - limit, bufsize = limit; - } else { - middle = last, limit = 0; - } - for(a = first, i = 0; SS_BLOCKSIZE < (middle - a); a += SS_BLOCKSIZE, ++i) { -#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE - ss_mintrosort(T, PA, a, a + SS_BLOCKSIZE, depth); -#elif 1 < SS_BLOCKSIZE - ss_insertionsort(T, PA, a, a + SS_BLOCKSIZE, depth); -#endif - curbufsize = last - (a + SS_BLOCKSIZE); - curbuf = a + SS_BLOCKSIZE; - if(curbufsize <= bufsize) { curbufsize = bufsize, curbuf = buf; } - for(b = a, k = SS_BLOCKSIZE, j = i; j & 1; b -= k, k <<= 1, j >>= 1) { - ss_swapmerge(T, PA, b - k, b, b + k, curbuf, curbufsize, depth); - } - } -#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE - ss_mintrosort(T, PA, a, middle, depth); -#elif 1 < SS_BLOCKSIZE - ss_insertionsort(T, PA, a, middle, depth); -#endif - for(k = SS_BLOCKSIZE; i != 0; k <<= 1, i >>= 1) { - if(i & 1) { - ss_swapmerge(T, PA, a - k, a, middle, buf, bufsize, depth); - a -= k; - } - } - if(limit != 0) { -#if SS_INSERTIONSORT_THRESHOLD < SS_BLOCKSIZE - ss_mintrosort(T, PA, middle, last, depth); -#elif 1 < SS_BLOCKSIZE - ss_insertionsort(T, PA, middle, last, depth); -#endif - ss_inplacemerge(T, PA, first, middle, last, depth); - } -#endif - - if(lastsuffix != 0) { - /* Insert last type B* suffix. */ - int PAi[2]; PAi[0] = PA[*(first - 1)], PAi[1] = n - 2; - for(a = first, i = *(first - 1); - (a < last) && ((*a < 0) || (0 < ss_compare(T, &(PAi[0]), PA + *a, depth))); - ++a) { - *(a - 1) = *a; - } - *(a - 1) = i; - } -} - - -/*---------------------------------------------------------------------------*/ - -static INLINE -int -tr_ilg(int n) { - return (n & 0xffff0000) ? - ((n & 0xff000000) ? - 24 + lg_table[(n >> 24) & 0xff] : - 16 + lg_table[(n >> 16) & 0xff]) : - ((n & 0x0000ff00) ? - 8 + lg_table[(n >> 8) & 0xff] : - 0 + lg_table[(n >> 0) & 0xff]); -} - - -/*---------------------------------------------------------------------------*/ - -/* Simple insertionsort for small size groups. */ -static -void -tr_insertionsort(const int *ISAd, int *first, int *last) { - int *a, *b; - int t, r; - - for(a = first + 1; a < last; ++a) { - for(t = *a, b = a - 1; 0 > (r = ISAd[t] - ISAd[*b]);) { - do { *(b + 1) = *b; } while((first <= --b) && (*b < 0)); - if(b < first) { break; } - } - if(r == 0) { *b = ~*b; } - *(b + 1) = t; - } -} - - -/*---------------------------------------------------------------------------*/ - -static INLINE -void -tr_fixdown(const int *ISAd, int *SA, int i, int size) { - int j, k; - int v; - int c, d, e; - - for(v = SA[i], c = ISAd[v]; (j = 2 * i + 1) < size; SA[i] = SA[k], i = k) { - d = ISAd[SA[k = j++]]; - if(d < (e = ISAd[SA[j]])) { k = j; d = e; } - if(d <= c) { break; } - } - SA[i] = v; -} - -/* Simple top-down heapsort. */ -static -void -tr_heapsort(const int *ISAd, int *SA, int size) { - int i, m; - int t; - - m = size; - if((size % 2) == 0) { - m--; - if(ISAd[SA[m / 2]] < ISAd[SA[m]]) { SWAP(SA[m], SA[m / 2]); } - } - - for(i = m / 2 - 1; 0 <= i; --i) { tr_fixdown(ISAd, SA, i, m); } - if((size % 2) == 0) { SWAP(SA[0], SA[m]); tr_fixdown(ISAd, SA, 0, m); } - for(i = m - 1; 0 < i; --i) { - t = SA[0], SA[0] = SA[i]; - tr_fixdown(ISAd, SA, 0, i); - SA[i] = t; - } -} - - -/*---------------------------------------------------------------------------*/ - -/* Returns the median of three elements. */ -static INLINE -int * -tr_median3(const int *ISAd, int *v1, int *v2, int *v3) { - int *t; - if(ISAd[*v1] > ISAd[*v2]) { SWAP(v1, v2); } - if(ISAd[*v2] > ISAd[*v3]) { - if(ISAd[*v1] > ISAd[*v3]) { return v1; } - else { return v3; } - } - return v2; -} - -/* Returns the median of five elements. */ -static INLINE -int * -tr_median5(const int *ISAd, - int *v1, int *v2, int *v3, int *v4, int *v5) { - int *t; - if(ISAd[*v2] > ISAd[*v3]) { SWAP(v2, v3); } - if(ISAd[*v4] > ISAd[*v5]) { SWAP(v4, v5); } - if(ISAd[*v2] > ISAd[*v4]) { SWAP(v2, v4); SWAP(v3, v5); } - if(ISAd[*v1] > ISAd[*v3]) { SWAP(v1, v3); } - if(ISAd[*v1] > ISAd[*v4]) { SWAP(v1, v4); SWAP(v3, v5); } - if(ISAd[*v3] > ISAd[*v4]) { return v4; } - return v3; -} - -/* Returns the pivot element. */ -static INLINE -int * -tr_pivot(const int *ISAd, int *first, int *last) { - int *middle; - int t; - - t = last - first; - middle = first + t / 2; - - if(t <= 512) { - if(t <= 32) { - return tr_median3(ISAd, first, middle, last - 1); - } else { - t >>= 2; - return tr_median5(ISAd, first, first + t, middle, last - 1 - t, last - 1); - } - } - t >>= 3; - first = tr_median3(ISAd, first, first + t, first + (t << 1)); - middle = tr_median3(ISAd, middle - t, middle, middle + t); - last = tr_median3(ISAd, last - 1 - (t << 1), last - 1 - t, last - 1); - return tr_median3(ISAd, first, middle, last); -} - - -/*---------------------------------------------------------------------------*/ - -typedef struct _trbudget_t trbudget_t; -struct _trbudget_t { - int chance; - int remain; - int incval; - int count; -}; - -static INLINE -void -trbudget_init(trbudget_t *budget, int chance, int incval) { - budget->chance = chance; - budget->remain = budget->incval = incval; -} - -static INLINE -int -trbudget_check(trbudget_t *budget, int size) { - if(size <= budget->remain) { budget->remain -= size; return 1; } - if(budget->chance == 0) { budget->count += size; return 0; } - budget->remain += budget->incval - size; - budget->chance -= 1; - return 1; -} - - -/*---------------------------------------------------------------------------*/ - -static INLINE -void -tr_partition(const int *ISAd, - int *first, int *middle, int *last, - int **pa, int **pb, int v) { - int *a, *b, *c, *d, *e, *f; - int t, s; - int x = 0; - - for(b = middle - 1; (++b < last) && ((x = ISAd[*b]) == v);) { } - if(((a = b) < last) && (x < v)) { - for(; (++b < last) && ((x = ISAd[*b]) <= v);) { - if(x == v) { SWAP(*b, *a); ++a; } - } - } - for(c = last; (b < --c) && ((x = ISAd[*c]) == v);) { } - if((b < (d = c)) && (x > v)) { - for(; (b < --c) && ((x = ISAd[*c]) >= v);) { - if(x == v) { SWAP(*c, *d); --d; } - } - } - for(; b < c;) { - SWAP(*b, *c); - for(; (++b < c) && ((x = ISAd[*b]) <= v);) { - if(x == v) { SWAP(*b, *a); ++a; } - } - for(; (b < --c) && ((x = ISAd[*c]) >= v);) { - if(x == v) { SWAP(*c, *d); --d; } - } - } - - if(a <= d) { - c = b - 1; - if((s = a - first) > (t = b - a)) { s = t; } - for(e = first, f = b - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } - if((s = d - c) > (t = last - d - 1)) { s = t; } - for(e = b, f = last - s; 0 < s; --s, ++e, ++f) { SWAP(*e, *f); } - first += (b - a), last -= (d - c); - } - *pa = first, *pb = last; -} - -static -void -tr_copy(int *ISA, const int *SA, - int *first, int *a, int *b, int *last, - int depth) { - /* sort suffixes of middle partition - by using sorted order of suffixes of left and right partition. */ - int *c, *d, *e; - int s, v; - - v = b - SA - 1; - for(c = first, d = a - 1; c <= d; ++c) { - if((0 <= (s = *c - depth)) && (ISA[s] == v)) { - *++d = s; - ISA[s] = d - SA; - } - } - for(c = last - 1, e = d + 1, d = b; e < d; --c) { - if((0 <= (s = *c - depth)) && (ISA[s] == v)) { - *--d = s; - ISA[s] = d - SA; - } - } -} - -static -void -tr_partialcopy(int *ISA, const int *SA, - int *first, int *a, int *b, int *last, - int depth) { - int *c, *d, *e; - int s, v; - int rank, lastrank, newrank = -1; - - v = b - SA - 1; - lastrank = -1; - for(c = first, d = a - 1; c <= d; ++c) { - if((0 <= (s = *c - depth)) && (ISA[s] == v)) { - *++d = s; - rank = ISA[s + depth]; - if(lastrank != rank) { lastrank = rank; newrank = d - SA; } - ISA[s] = newrank; - } - } - - lastrank = -1; - for(e = d; first <= e; --e) { - rank = ISA[*e]; - if(lastrank != rank) { lastrank = rank; newrank = e - SA; } - if(newrank != rank) { ISA[*e] = newrank; } - } - - lastrank = -1; - for(c = last - 1, e = d + 1, d = b; e < d; --c) { - if((0 <= (s = *c - depth)) && (ISA[s] == v)) { - *--d = s; - rank = ISA[s + depth]; - if(lastrank != rank) { lastrank = rank; newrank = d - SA; } - ISA[s] = newrank; - } - } -} - -static -void -tr_introsort(int *ISA, const int *ISAd, - int *SA, int *first, int *last, - trbudget_t *budget) { -#define STACK_SIZE TR_STACKSIZE - struct { const int *a; int *b, *c; int d, e; }stack[STACK_SIZE]; - int *a, *b, *c; - int t; - int v, x = 0; - int incr = ISAd - ISA; - int limit, next; - int ssize, trlink = -1; - - for(ssize = 0, limit = tr_ilg(last - first);;) { - - if(limit < 0) { - if(limit == -1) { - /* tandem repeat partition */ - tr_partition(ISAd - incr, first, first, last, &a, &b, last - SA - 1); - - /* update ranks */ - if(a < last) { - for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; } - } - if(b < last) { - for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; } - } - - /* push */ - if(1 < (b - a)) { - STACK_PUSH5(NULL, a, b, 0, 0); - STACK_PUSH5(ISAd - incr, first, last, -2, trlink); - trlink = ssize - 2; - } - if((a - first) <= (last - b)) { - if(1 < (a - first)) { - STACK_PUSH5(ISAd, b, last, tr_ilg(last - b), trlink); - last = a, limit = tr_ilg(a - first); - } else if(1 < (last - b)) { - first = b, limit = tr_ilg(last - b); - } else { - STACK_POP5(ISAd, first, last, limit, trlink); - } - } else { - if(1 < (last - b)) { - STACK_PUSH5(ISAd, first, a, tr_ilg(a - first), trlink); - first = b, limit = tr_ilg(last - b); - } else if(1 < (a - first)) { - last = a, limit = tr_ilg(a - first); - } else { - STACK_POP5(ISAd, first, last, limit, trlink); - } - } - } else if(limit == -2) { - /* tandem repeat copy */ - a = stack[--ssize].b, b = stack[ssize].c; - if(stack[ssize].d == 0) { - tr_copy(ISA, SA, first, a, b, last, ISAd - ISA); - } else { - if(0 <= trlink) { stack[trlink].d = -1; } - tr_partialcopy(ISA, SA, first, a, b, last, ISAd - ISA); - } - STACK_POP5(ISAd, first, last, limit, trlink); - } else { - /* sorted partition */ - if(0 <= *first) { - a = first; - do { ISA[*a] = a - SA; } while((++a < last) && (0 <= *a)); - first = a; - } - if(first < last) { - a = first; do { *a = ~*a; } while(*++a < 0); - next = (ISA[*a] != ISAd[*a]) ? tr_ilg(a - first + 1) : -1; - if(++a < last) { for(b = first, v = a - SA - 1; b < a; ++b) { ISA[*b] = v; } } - - /* push */ - if(trbudget_check(budget, a - first)) { - if((a - first) <= (last - a)) { - STACK_PUSH5(ISAd, a, last, -3, trlink); - ISAd += incr, last = a, limit = next; - } else { - if(1 < (last - a)) { - STACK_PUSH5(ISAd + incr, first, a, next, trlink); - first = a, limit = -3; - } else { - ISAd += incr, last = a, limit = next; - } - } - } else { - if(0 <= trlink) { stack[trlink].d = -1; } - if(1 < (last - a)) { - first = a, limit = -3; - } else { - STACK_POP5(ISAd, first, last, limit, trlink); - } - } - } else { - STACK_POP5(ISAd, first, last, limit, trlink); - } - } - continue; - } - - if((last - first) <= TR_INSERTIONSORT_THRESHOLD) { - tr_insertionsort(ISAd, first, last); - limit = -3; - continue; - } - - if(limit-- == 0) { - tr_heapsort(ISAd, first, last - first); - for(a = last - 1; first < a; a = b) { - for(x = ISAd[*a], b = a - 1; (first <= b) && (ISAd[*b] == x); --b) { *b = ~*b; } - } - limit = -3; - continue; - } - - /* choose pivot */ - a = tr_pivot(ISAd, first, last); - SWAP(*first, *a); - v = ISAd[*first]; - - /* partition */ - tr_partition(ISAd, first, first + 1, last, &a, &b, v); - if((last - first) != (b - a)) { - next = (ISA[*a] != v) ? tr_ilg(b - a) : -1; - - /* update ranks */ - for(c = first, v = a - SA - 1; c < a; ++c) { ISA[*c] = v; } - if(b < last) { for(c = a, v = b - SA - 1; c < b; ++c) { ISA[*c] = v; } } - - /* push */ - if((1 < (b - a)) && (trbudget_check(budget, b - a))) { - if((a - first) <= (last - b)) { - if((last - b) <= (b - a)) { - if(1 < (a - first)) { - STACK_PUSH5(ISAd + incr, a, b, next, trlink); - STACK_PUSH5(ISAd, b, last, limit, trlink); - last = a; - } else if(1 < (last - b)) { - STACK_PUSH5(ISAd + incr, a, b, next, trlink); - first = b; - } else { - ISAd += incr, first = a, last = b, limit = next; - } - } else if((a - first) <= (b - a)) { - if(1 < (a - first)) { - STACK_PUSH5(ISAd, b, last, limit, trlink); - STACK_PUSH5(ISAd + incr, a, b, next, trlink); - last = a; - } else { - STACK_PUSH5(ISAd, b, last, limit, trlink); - ISAd += incr, first = a, last = b, limit = next; - } - } else { - STACK_PUSH5(ISAd, b, last, limit, trlink); - STACK_PUSH5(ISAd, first, a, limit, trlink); - ISAd += incr, first = a, last = b, limit = next; - } - } else { - if((a - first) <= (b - a)) { - if(1 < (last - b)) { - STACK_PUSH5(ISAd + incr, a, b, next, trlink); - STACK_PUSH5(ISAd, first, a, limit, trlink); - first = b; - } else if(1 < (a - first)) { - STACK_PUSH5(ISAd + incr, a, b, next, trlink); - last = a; - } else { - ISAd += incr, first = a, last = b, limit = next; - } - } else if((last - b) <= (b - a)) { - if(1 < (last - b)) { - STACK_PUSH5(ISAd, first, a, limit, trlink); - STACK_PUSH5(ISAd + incr, a, b, next, trlink); - first = b; - } else { - STACK_PUSH5(ISAd, first, a, limit, trlink); - ISAd += incr, first = a, last = b, limit = next; - } - } else { - STACK_PUSH5(ISAd, first, a, limit, trlink); - STACK_PUSH5(ISAd, b, last, limit, trlink); - ISAd += incr, first = a, last = b, limit = next; - } - } - } else { - if((1 < (b - a)) && (0 <= trlink)) { stack[trlink].d = -1; } - if((a - first) <= (last - b)) { - if(1 < (a - first)) { - STACK_PUSH5(ISAd, b, last, limit, trlink); - last = a; - } else if(1 < (last - b)) { - first = b; - } else { - STACK_POP5(ISAd, first, last, limit, trlink); - } - } else { - if(1 < (last - b)) { - STACK_PUSH5(ISAd, first, a, limit, trlink); - first = b; - } else if(1 < (a - first)) { - last = a; - } else { - STACK_POP5(ISAd, first, last, limit, trlink); - } - } - } - } else { - if(trbudget_check(budget, last - first)) { - limit = tr_ilg(last - first), ISAd += incr; - } else { - if(0 <= trlink) { stack[trlink].d = -1; } - STACK_POP5(ISAd, first, last, limit, trlink); - } - } - } -#undef STACK_SIZE -} - - - -/*---------------------------------------------------------------------------*/ - -/* Tandem repeat sort */ -static -void -trsort(int *ISA, int *SA, int n, int depth) { - int *ISAd; - int *first, *last; - trbudget_t budget; - int t, skip, unsorted; - - trbudget_init(&budget, tr_ilg(n) * 2 / 3, n); -/* trbudget_init(&budget, tr_ilg(n) * 3 / 4, n); */ - for(ISAd = ISA + depth; -n < *SA; ISAd += ISAd - ISA) { - first = SA; - skip = 0; - unsorted = 0; - do { - if((t = *first) < 0) { first -= t; skip += t; } - else { - if(skip != 0) { *(first + skip) = skip; skip = 0; } - last = SA + ISA[t] + 1; - if(1 < (last - first)) { - budget.count = 0; - tr_introsort(ISA, ISAd, SA, first, last, &budget); - if(budget.count != 0) { unsorted += budget.count; } - else { skip = first - last; } - } else if((last - first) == 1) { - skip = -1; - } - first = last; - } - } while(first < (SA + n)); - if(skip != 0) { *(first + skip) = skip; } - if(unsorted == 0) { break; } - } -} - - -/*---------------------------------------------------------------------------*/ - -/* Sorts suffixes of type B*. */ -static -int -sort_typeBstar(const unsigned char *T, int *SA, - int *bucket_A, int *bucket_B, - int n, int openMP) { - int *PAb, *ISAb, *buf; -#ifdef LIBBSC_OPENMP - int *curbuf; - int l; -#endif - int i, j, k, t, m, bufsize; - int c0, c1; -#ifdef LIBBSC_OPENMP - int d0, d1; -#endif - (void)openMP; - - /* Initialize bucket arrays. */ - for(i = 0; i < BUCKET_A_SIZE; ++i) { bucket_A[i] = 0; } - for(i = 0; i < BUCKET_B_SIZE; ++i) { bucket_B[i] = 0; } - - /* Count the number of occurrences of the first one or two characters of each - type A, B and B* suffix. Moreover, store the beginning position of all - type B* suffixes into the array SA. */ - for(i = n - 1, m = n, c0 = T[n - 1]; 0 <= i;) { - /* type A suffix. */ - do { ++BUCKET_A(c1 = c0); } while((0 <= --i) && ((c0 = T[i]) >= c1)); - if(0 <= i) { - /* type B* suffix. */ - ++BUCKET_BSTAR(c0, c1); - SA[--m] = i; - /* type B suffix. */ - for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) { - ++BUCKET_B(c0, c1); - } - } - } - m = n - m; -/* -note: - A type B* suffix is lexicographically smaller than a type B suffix that - begins with the same first two characters. -*/ - - /* Calculate the index of start/end point of each bucket. */ - for(c0 = 0, i = 0, j = 0; c0 < ALPHABET_SIZE; ++c0) { - t = i + BUCKET_A(c0); - BUCKET_A(c0) = i + j; /* start point */ - i = t + BUCKET_B(c0, c0); - for(c1 = c0 + 1; c1 < ALPHABET_SIZE; ++c1) { - j += BUCKET_BSTAR(c0, c1); - BUCKET_BSTAR(c0, c1) = j; /* end point */ - i += BUCKET_B(c0, c1); - } - } - - if(0 < m) { - /* Sort the type B* suffixes by their first two characters. */ - PAb = SA + n - m; ISAb = SA + m; - for(i = m - 2; 0 <= i; --i) { - t = PAb[i], c0 = T[t], c1 = T[t + 1]; - SA[--BUCKET_BSTAR(c0, c1)] = i; - } - t = PAb[m - 1], c0 = T[t], c1 = T[t + 1]; - SA[--BUCKET_BSTAR(c0, c1)] = m - 1; - - /* Sort the type B* substrings using sssort. */ -#ifdef LIBBSC_OPENMP - if (openMP) - { - buf = SA + m; - c0 = ALPHABET_SIZE - 2, c1 = ALPHABET_SIZE - 1, j = m; -#pragma omp parallel default(shared) private(bufsize, curbuf, k, l, d0, d1) - { - bufsize = (n - (2 * m)) / omp_get_num_threads(); - curbuf = buf + omp_get_thread_num() * bufsize; - k = 0; - for(;;) { - #pragma omp critical(sssort_lock) - { - if(0 < (l = j)) { - d0 = c0, d1 = c1; - do { - k = BUCKET_BSTAR(d0, d1); - if(--d1 <= d0) { - d1 = ALPHABET_SIZE - 1; - if(--d0 < 0) { break; } - } - } while(((l - k) <= 1) && (0 < (l = k))); - c0 = d0, c1 = d1, j = k; - } - } - if(l == 0) { break; } - sssort(T, PAb, SA + k, SA + l, - curbuf, bufsize, 2, n, *(SA + k) == (m - 1)); - } - } - } - else - { - buf = SA + m, bufsize = n - (2 * m); - for(c0 = ALPHABET_SIZE - 2, j = m; 0 < j; --c0) { - for(c1 = ALPHABET_SIZE - 1; c0 < c1; j = i, --c1) { - i = BUCKET_BSTAR(c0, c1); - if(1 < (j - i)) { - sssort(T, PAb, SA + i, SA + j, - buf, bufsize, 2, n, *(SA + i) == (m - 1)); - } - } - } - } -#else - buf = SA + m, bufsize = n - (2 * m); - for(c0 = ALPHABET_SIZE - 2, j = m; 0 < j; --c0) { - for(c1 = ALPHABET_SIZE - 1; c0 < c1; j = i, --c1) { - i = BUCKET_BSTAR(c0, c1); - if(1 < (j - i)) { - sssort(T, PAb, SA + i, SA + j, - buf, bufsize, 2, n, *(SA + i) == (m - 1)); - } - } - } -#endif - - /* Compute ranks of type B* substrings. */ - for(i = m - 1; 0 <= i; --i) { - if(0 <= SA[i]) { - j = i; - do { ISAb[SA[i]] = i; } while((0 <= --i) && (0 <= SA[i])); - SA[i + 1] = i - j; - if(i <= 0) { break; } - } - j = i; - do { ISAb[SA[i] = ~SA[i]] = j; } while(SA[--i] < 0); - ISAb[SA[i]] = j; - } - - /* Construct the inverse suffix array of type B* suffixes using trsort. */ - trsort(ISAb, SA, m, 1); - - /* Set the sorted order of tyoe B* suffixes. */ - for(i = n - 1, j = m, c0 = T[n - 1]; 0 <= i;) { - for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) >= c1); --i, c1 = c0) { } - if(0 <= i) { - t = i; - for(--i, c1 = c0; (0 <= i) && ((c0 = T[i]) <= c1); --i, c1 = c0) { } - SA[ISAb[--j]] = ((t == 0) || (1 < (t - i))) ? t : ~t; - } - } - - /* Calculate the index of start/end point of each bucket. */ - BUCKET_B(ALPHABET_SIZE - 1, ALPHABET_SIZE - 1) = n; /* end point */ - for(c0 = ALPHABET_SIZE - 2, k = m - 1; 0 <= c0; --c0) { - i = BUCKET_A(c0 + 1) - 1; - for(c1 = ALPHABET_SIZE - 1; c0 < c1; --c1) { - t = i - BUCKET_B(c0, c1); - BUCKET_B(c0, c1) = i; /* end point */ - - /* Move all type B* suffixes to the correct position. */ - for(i = t, j = BUCKET_BSTAR(c0, c1); - j <= k; - --i, --k) { SA[i] = SA[k]; } - } - BUCKET_BSTAR(c0, c0 + 1) = i - BUCKET_B(c0, c0) + 1; /* start point */ - BUCKET_B(c0, c0) = i; /* end point */ - } - } - - return m; -} - -/* Constructs the suffix array by using the sorted order of type B* suffixes. */ -static -void -construct_SA(const unsigned char *T, int *SA, - int *bucket_A, int *bucket_B, - int n, int m) { - int *i, *j, *k; - int s; - int c0, c1, c2; - - if(0 < m) { - /* Construct the sorted order of type B suffixes by using - the sorted order of type B* suffixes. */ - for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) { - /* Scan the suffix array from right to left. */ - for(i = SA + BUCKET_BSTAR(c1, c1 + 1), - j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; - i <= j; - --j) { - if(0 < (s = *j)) { - assert(T[s] == c1); - assert(((s + 1) < n) && (T[s] <= T[s + 1])); - assert(T[s - 1] <= T[s]); - *j = ~s; - c0 = T[--s]; - if((0 < s) && (T[s - 1] > c0)) { s = ~s; } - if(c0 != c2) { - if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } - k = SA + BUCKET_B(c2 = c0, c1); - } - assert(k < j); assert(k != NULL); - *k-- = s; - } else { - assert(((s == 0) && (T[s] == c1)) || (s < 0)); - *j = ~s; - } - } - } - } - - /* Construct the suffix array by using - the sorted order of type B suffixes. */ - k = SA + BUCKET_A(c2 = T[n - 1]); - *k++ = (T[n - 2] < c2) ? ~(n - 1) : (n - 1); - /* Scan the suffix array from left to right. */ - for(i = SA, j = SA + n; i < j; ++i) { - if(0 < (s = *i)) { - assert(T[s - 1] >= T[s]); - c0 = T[--s]; - if((s == 0) || (T[s - 1] < c0)) { s = ~s; } - if(c0 != c2) { - BUCKET_A(c2) = k - SA; - k = SA + BUCKET_A(c2 = c0); - } - assert(i < k); - *k++ = s; - } else { - assert(s < 0); - *i = ~s; - } - } -} - -/* Constructs the burrows-wheeler transformed string directly - by using the sorted order of type B* suffixes. */ -static -int -construct_BWT(const unsigned char *T, int *SA, - int *bucket_A, int *bucket_B, - int n, int m) { - int *i, *j, *k, *orig; - int s; - int c0, c1, c2; - - if(0 < m) { - /* Construct the sorted order of type B suffixes by using - the sorted order of type B* suffixes. */ - for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) { - /* Scan the suffix array from right to left. */ - for(i = SA + BUCKET_BSTAR(c1, c1 + 1), - j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; - i <= j; - --j) { - if(0 < (s = *j)) { - assert(T[s] == c1); - assert(((s + 1) < n) && (T[s] <= T[s + 1])); - assert(T[s - 1] <= T[s]); - c0 = T[--s]; - *j = ~((int)c0); - if((0 < s) && (T[s - 1] > c0)) { s = ~s; } - if(c0 != c2) { - if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } - k = SA + BUCKET_B(c2 = c0, c1); - } - assert(k < j); assert(k != NULL); - *k-- = s; - } else if(s != 0) { - *j = ~s; -#ifndef NDEBUG - } else { - assert(T[s] == c1); -#endif - } - } - } - } - - /* Construct the BWTed string by using - the sorted order of type B suffixes. */ - k = SA + BUCKET_A(c2 = T[n - 1]); - *k++ = (T[n - 2] < c2) ? ~((int)T[n - 2]) : (n - 1); - /* Scan the suffix array from left to right. */ - for(i = SA, j = SA + n, orig = SA; i < j; ++i) { - if(0 < (s = *i)) { - assert(T[s - 1] >= T[s]); - c0 = T[--s]; - *i = c0; - if((0 < s) && (T[s - 1] < c0)) { s = ~((int)T[s - 1]); } - if(c0 != c2) { - BUCKET_A(c2) = k - SA; - k = SA + BUCKET_A(c2 = c0); - } - assert(i < k); - *k++ = s; - } else if(s != 0) { - *i = ~s; - } else { - orig = i; - } - } - - return orig - SA; -} - -/* Constructs the burrows-wheeler transformed string directly - by using the sorted order of type B* suffixes. */ -static -int -construct_BWT_indexes(const unsigned char *T, int *SA, - int *bucket_A, int *bucket_B, - int n, int m, - unsigned char * num_indexes, int * indexes) { - int *i, *j, *k, *orig; - int s; - int c0, c1, c2; - - int mod = n / 8; - { - mod |= mod >> 1; mod |= mod >> 2; - mod |= mod >> 4; mod |= mod >> 8; - mod |= mod >> 16; mod >>= 1; - - *num_indexes = (unsigned char)((n - 1) / (mod + 1)); - } - - if(0 < m) { - /* Construct the sorted order of type B suffixes by using - the sorted order of type B* suffixes. */ - for(c1 = ALPHABET_SIZE - 2; 0 <= c1; --c1) { - /* Scan the suffix array from right to left. */ - for(i = SA + BUCKET_BSTAR(c1, c1 + 1), - j = SA + BUCKET_A(c1 + 1) - 1, k = NULL, c2 = -1; - i <= j; - --j) { - if(0 < (s = *j)) { - assert(T[s] == c1); - assert(((s + 1) < n) && (T[s] <= T[s + 1])); - assert(T[s - 1] <= T[s]); - - if ((s & mod) == 0) indexes[s / (mod + 1) - 1] = j - SA; - - c0 = T[--s]; - *j = ~((int)c0); - if((0 < s) && (T[s - 1] > c0)) { s = ~s; } - if(c0 != c2) { - if(0 <= c2) { BUCKET_B(c2, c1) = k - SA; } - k = SA + BUCKET_B(c2 = c0, c1); - } - assert(k < j); assert(k != NULL); - *k-- = s; - } else if(s != 0) { - *j = ~s; -#ifndef NDEBUG - } else { - assert(T[s] == c1); -#endif - } - } - } - } - - /* Construct the BWTed string by using - the sorted order of type B suffixes. */ - k = SA + BUCKET_A(c2 = T[n - 1]); - if (T[n - 2] < c2) { - if (((n - 1) & mod) == 0) indexes[(n - 1) / (mod + 1) - 1] = k - SA; - *k++ = ~((int)T[n - 2]); - } - else { - *k++ = n - 1; - } - - /* Scan the suffix array from left to right. */ - for(i = SA, j = SA + n, orig = SA; i < j; ++i) { - if(0 < (s = *i)) { - assert(T[s - 1] >= T[s]); - - if ((s & mod) == 0) indexes[s / (mod + 1) - 1] = i - SA; - - c0 = T[--s]; - *i = c0; - if(c0 != c2) { - BUCKET_A(c2) = k - SA; - k = SA + BUCKET_A(c2 = c0); - } - assert(i < k); - if((0 < s) && (T[s - 1] < c0)) { - if ((s & mod) == 0) indexes[s / (mod + 1) - 1] = k - SA; - *k++ = ~((int)T[s - 1]); - } else - *k++ = s; - } else if(s != 0) { - *i = ~s; - } else { - orig = i; - } - } - - return orig - SA; -} - - -/*---------------------------------------------------------------------------*/ - -/*- Function -*/ - -int -divsufsort(const unsigned char *T, int *SA, int n, int openMP) { - int *bucket_A, *bucket_B; - int m; - int err = 0; - - /* Check arguments. */ - if((T == NULL) || (SA == NULL) || (n < 0)) { return -1; } - else if(n == 0) { return 0; } - else if(n == 1) { SA[0] = 0; return 0; } - else if(n == 2) { m = (T[0] < T[1]); SA[m ^ 1] = 0, SA[m] = 1; return 0; } - - bucket_A = (int *)malloc(BUCKET_A_SIZE * sizeof(int)); - bucket_B = (int *)malloc(BUCKET_B_SIZE * sizeof(int)); - - /* Suffixsort. */ - if((bucket_A != NULL) && (bucket_B != NULL)) { - m = sort_typeBstar(T, SA, bucket_A, bucket_B, n, openMP); - construct_SA(T, SA, bucket_A, bucket_B, n, m); - } else { - err = -2; - } - - free(bucket_B); - free(bucket_A); - - return err; -} - -int -divbwt(const unsigned char *T, unsigned char *U, int *A, int n, unsigned char * num_indexes, int * indexes, int openMP) { - int *B; - int *bucket_A, *bucket_B; - int m, pidx, i; - - /* Check arguments. */ - if((T == NULL) || (U == NULL) || (n < 0)) { return -1; } - else if(n <= 1) { if(n == 1) { U[0] = T[0]; } return n; } - - if((B = A) == NULL) { B = (int *)malloc((size_t)(n + 1) * sizeof(int)); } - bucket_A = (int *)malloc(BUCKET_A_SIZE * sizeof(int)); - bucket_B = (int *)malloc(BUCKET_B_SIZE * sizeof(int)); - - /* Burrows-Wheeler Transform. */ - if((B != NULL) && (bucket_A != NULL) && (bucket_B != NULL)) { - m = sort_typeBstar(T, B, bucket_A, bucket_B, n, openMP); - - if (num_indexes == NULL || indexes == NULL) { - pidx = construct_BWT(T, B, bucket_A, bucket_B, n, m); - } else { - pidx = construct_BWT_indexes(T, B, bucket_A, bucket_B, n, m, num_indexes, indexes); - } - - /* Copy to output string. */ - U[0] = T[n - 1]; - for(i = 0; i < pidx; ++i) { U[i + 1] = (unsigned char)B[i]; } - for(i += 1; i < n; ++i) { U[i] = (unsigned char)B[i]; } - pidx += 1; - } else { - pidx = -2; - } - - free(bucket_B); - free(bucket_A); - if(A == NULL) { free(B); } - - return pidx; -} diff --git a/vendor/github.com/DataDog/zstd/divsufsort.h b/vendor/github.com/DataDog/zstd/divsufsort.h deleted file mode 100644 index 5440994a..00000000 --- a/vendor/github.com/DataDog/zstd/divsufsort.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * divsufsort.h for libdivsufsort-lite - * Copyright (c) 2003-2008 Yuta Mori All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef _DIVSUFSORT_H -#define _DIVSUFSORT_H 1 - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - -/*- Prototypes -*/ - -/** - * Constructs the suffix array of a given string. - * @param T [0..n-1] The input string. - * @param SA [0..n-1] The output array of suffixes. - * @param n The length of the given string. - * @param openMP enables OpenMP optimization. - * @return 0 if no error occurred, -1 or -2 otherwise. - */ -int -divsufsort(const unsigned char *T, int *SA, int n, int openMP); - -/** - * Constructs the burrows-wheeler transformed string of a given string. - * @param T [0..n-1] The input string. - * @param U [0..n-1] The output string. (can be T) - * @param A [0..n-1] The temporary array. (can be NULL) - * @param n The length of the given string. - * @param num_indexes The length of secondary indexes array. (can be NULL) - * @param indexes The secondary indexes array. (can be NULL) - * @param openMP enables OpenMP optimization. - * @return The primary index if no error occurred, -1 or -2 otherwise. - */ -int -divbwt(const unsigned char *T, unsigned char *U, int *A, int n, unsigned char * num_indexes, int * indexes, int openMP); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif /* __cplusplus */ - -#endif /* _DIVSUFSORT_H */ diff --git a/vendor/github.com/DataDog/zstd/entropy_common.c b/vendor/github.com/DataDog/zstd/entropy_common.c deleted file mode 100644 index b12944e1..00000000 --- a/vendor/github.com/DataDog/zstd/entropy_common.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - Common functions of New Generation Entropy library - Copyright (C) 2016, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -*************************************************************************** */ - -/* ************************************* -* Dependencies -***************************************/ -#include "mem.h" -#include "error_private.h" /* ERR_*, ERROR */ -#define FSE_STATIC_LINKING_ONLY /* FSE_MIN_TABLELOG */ -#include "fse.h" -#define HUF_STATIC_LINKING_ONLY /* HUF_TABLELOG_ABSOLUTEMAX */ -#include "huf.h" - - -/*=== Version ===*/ -unsigned FSE_versionNumber(void) { return FSE_VERSION_NUMBER; } - - -/*=== Error Management ===*/ -unsigned FSE_isError(size_t code) { return ERR_isError(code); } -const char* FSE_getErrorName(size_t code) { return ERR_getErrorName(code); } - -unsigned HUF_isError(size_t code) { return ERR_isError(code); } -const char* HUF_getErrorName(size_t code) { return ERR_getErrorName(code); } - - -/*-************************************************************** -* FSE NCount encoding-decoding -****************************************************************/ -size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr, - const void* headerBuffer, size_t hbSize) -{ - const BYTE* const istart = (const BYTE*) headerBuffer; - const BYTE* const iend = istart + hbSize; - const BYTE* ip = istart; - int nbBits; - int remaining; - int threshold; - U32 bitStream; - int bitCount; - unsigned charnum = 0; - int previous0 = 0; - - if (hbSize < 4) { - /* This function only works when hbSize >= 4 */ - char buffer[4]; - memset(buffer, 0, sizeof(buffer)); - memcpy(buffer, headerBuffer, hbSize); - { size_t const countSize = FSE_readNCount(normalizedCounter, maxSVPtr, tableLogPtr, - buffer, sizeof(buffer)); - if (FSE_isError(countSize)) return countSize; - if (countSize > hbSize) return ERROR(corruption_detected); - return countSize; - } } - assert(hbSize >= 4); - - /* init */ - memset(normalizedCounter, 0, (*maxSVPtr+1) * sizeof(normalizedCounter[0])); /* all symbols not present in NCount have a frequency of 0 */ - bitStream = MEM_readLE32(ip); - nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */ - if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge); - bitStream >>= 4; - bitCount = 4; - *tableLogPtr = nbBits; - remaining = (1<1) & (charnum<=*maxSVPtr)) { - if (previous0) { - unsigned n0 = charnum; - while ((bitStream & 0xFFFF) == 0xFFFF) { - n0 += 24; - if (ip < iend-5) { - ip += 2; - bitStream = MEM_readLE32(ip) >> bitCount; - } else { - bitStream >>= 16; - bitCount += 16; - } } - while ((bitStream & 3) == 3) { - n0 += 3; - bitStream >>= 2; - bitCount += 2; - } - n0 += bitStream & 3; - bitCount += 2; - if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall); - while (charnum < n0) normalizedCounter[charnum++] = 0; - if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { - assert((bitCount >> 3) <= 3); /* For first condition to work */ - ip += bitCount>>3; - bitCount &= 7; - bitStream = MEM_readLE32(ip) >> bitCount; - } else { - bitStream >>= 2; - } } - { int const max = (2*threshold-1) - remaining; - int count; - - if ((bitStream & (threshold-1)) < (U32)max) { - count = bitStream & (threshold-1); - bitCount += nbBits-1; - } else { - count = bitStream & (2*threshold-1); - if (count >= threshold) count -= max; - bitCount += nbBits; - } - - count--; /* extra accuracy */ - remaining -= count < 0 ? -count : count; /* -1 means +1 */ - normalizedCounter[charnum++] = (short)count; - previous0 = !count; - while (remaining < threshold) { - nbBits--; - threshold >>= 1; - } - - if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { - ip += bitCount>>3; - bitCount &= 7; - } else { - bitCount -= (int)(8 * (iend - 4 - ip)); - ip = iend - 4; - } - bitStream = MEM_readLE32(ip) >> (bitCount & 31); - } } /* while ((remaining>1) & (charnum<=*maxSVPtr)) */ - if (remaining != 1) return ERROR(corruption_detected); - if (bitCount > 32) return ERROR(corruption_detected); - *maxSVPtr = charnum-1; - - ip += (bitCount+7)>>3; - return ip-istart; -} - - -/*! HUF_readStats() : - Read compact Huffman tree, saved by HUF_writeCTable(). - `huffWeight` is destination buffer. - `rankStats` is assumed to be a table of at least HUF_TABLELOG_MAX U32. - @return : size read from `src` , or an error Code . - Note : Needed by HUF_readCTable() and HUF_readDTableX?() . -*/ -size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats, - U32* nbSymbolsPtr, U32* tableLogPtr, - const void* src, size_t srcSize) -{ - U32 weightTotal; - const BYTE* ip = (const BYTE*) src; - size_t iSize; - size_t oSize; - - if (!srcSize) return ERROR(srcSize_wrong); - iSize = ip[0]; - /* memset(huffWeight, 0, hwSize); *//* is not necessary, even though some analyzer complain ... */ - - if (iSize >= 128) { /* special header */ - oSize = iSize - 127; - iSize = ((oSize+1)/2); - if (iSize+1 > srcSize) return ERROR(srcSize_wrong); - if (oSize >= hwSize) return ERROR(corruption_detected); - ip += 1; - { U32 n; - for (n=0; n> 4; - huffWeight[n+1] = ip[n/2] & 15; - } } } - else { /* header compressed with FSE (normal case) */ - FSE_DTable fseWorkspace[FSE_DTABLE_SIZE_U32(6)]; /* 6 is max possible tableLog for HUF header (maybe even 5, to be tested) */ - if (iSize+1 > srcSize) return ERROR(srcSize_wrong); - oSize = FSE_decompress_wksp(huffWeight, hwSize-1, ip+1, iSize, fseWorkspace, 6); /* max (hwSize-1) values decoded, as last one is implied */ - if (FSE_isError(oSize)) return oSize; - } - - /* collect weight stats */ - memset(rankStats, 0, (HUF_TABLELOG_MAX + 1) * sizeof(U32)); - weightTotal = 0; - { U32 n; for (n=0; n= HUF_TABLELOG_MAX) return ERROR(corruption_detected); - rankStats[huffWeight[n]]++; - weightTotal += (1 << huffWeight[n]) >> 1; - } } - if (weightTotal == 0) return ERROR(corruption_detected); - - /* get last non-null symbol weight (implied, total must be 2^n) */ - { U32 const tableLog = BIT_highbit32(weightTotal) + 1; - if (tableLog > HUF_TABLELOG_MAX) return ERROR(corruption_detected); - *tableLogPtr = tableLog; - /* determine last weight */ - { U32 const total = 1 << tableLog; - U32 const rest = total - weightTotal; - U32 const verif = 1 << BIT_highbit32(rest); - U32 const lastWeight = BIT_highbit32(rest) + 1; - if (verif != rest) return ERROR(corruption_detected); /* last value must be a clean power of 2 */ - huffWeight[oSize] = (BYTE)lastWeight; - rankStats[lastWeight]++; - } } - - /* check tree construction validity */ - if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected); /* by construction : at least 2 elts of rank 1, must be even */ - - /* results */ - *nbSymbolsPtr = (U32)(oSize+1); - return iSize+1; -} diff --git a/vendor/github.com/DataDog/zstd/error_private.c b/vendor/github.com/DataDog/zstd/error_private.c deleted file mode 100644 index 7c1bb67a..00000000 --- a/vendor/github.com/DataDog/zstd/error_private.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/* The purpose of this file is to have a single list of error strings embedded in binary */ - -#include "error_private.h" - -const char* ERR_getErrorString(ERR_enum code) -{ -#ifdef ZSTD_STRIP_ERROR_STRINGS - (void)code; - return "Error strings stripped"; -#else - static const char* const notErrorCode = "Unspecified error code"; - switch( code ) - { - case PREFIX(no_error): return "No error detected"; - case PREFIX(GENERIC): return "Error (generic)"; - case PREFIX(prefix_unknown): return "Unknown frame descriptor"; - case PREFIX(version_unsupported): return "Version not supported"; - case PREFIX(frameParameter_unsupported): return "Unsupported frame parameter"; - case PREFIX(frameParameter_windowTooLarge): return "Frame requires too much memory for decoding"; - case PREFIX(corruption_detected): return "Corrupted block detected"; - case PREFIX(checksum_wrong): return "Restored data doesn't match checksum"; - case PREFIX(parameter_unsupported): return "Unsupported parameter"; - case PREFIX(parameter_outOfBound): return "Parameter is out of bound"; - case PREFIX(init_missing): return "Context should be init first"; - case PREFIX(memory_allocation): return "Allocation error : not enough memory"; - case PREFIX(workSpace_tooSmall): return "workSpace buffer is not large enough"; - case PREFIX(stage_wrong): return "Operation not authorized at current processing stage"; - case PREFIX(tableLog_tooLarge): return "tableLog requires too much memory : unsupported"; - case PREFIX(maxSymbolValue_tooLarge): return "Unsupported max Symbol Value : too large"; - case PREFIX(maxSymbolValue_tooSmall): return "Specified maxSymbolValue is too small"; - case PREFIX(dictionary_corrupted): return "Dictionary is corrupted"; - case PREFIX(dictionary_wrong): return "Dictionary mismatch"; - case PREFIX(dictionaryCreation_failed): return "Cannot create Dictionary from provided samples"; - case PREFIX(dstSize_tooSmall): return "Destination buffer is too small"; - case PREFIX(srcSize_wrong): return "Src size is incorrect"; - case PREFIX(dstBuffer_null): return "Operation on NULL destination buffer"; - /* following error codes are not stable and may be removed or changed in a future version */ - case PREFIX(frameIndex_tooLarge): return "Frame index is too large"; - case PREFIX(seekableIO): return "An I/O error occurred when reading/seeking"; - case PREFIX(maxCode): - default: return notErrorCode; - } -#endif -} diff --git a/vendor/github.com/DataDog/zstd/error_private.h b/vendor/github.com/DataDog/zstd/error_private.h deleted file mode 100644 index 0d2fa7e3..00000000 --- a/vendor/github.com/DataDog/zstd/error_private.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/* Note : this module is expected to remain private, do not expose it */ - -#ifndef ERROR_H_MODULE -#define ERROR_H_MODULE - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* **************************************** -* Dependencies -******************************************/ -#include /* size_t */ -#include "zstd_errors.h" /* enum list */ - - -/* **************************************** -* Compiler-specific -******************************************/ -#if defined(__GNUC__) -# define ERR_STATIC static __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define ERR_STATIC static inline -#elif defined(_MSC_VER) -# define ERR_STATIC static __inline -#else -# define ERR_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif - - -/*-**************************************** -* Customization (error_public.h) -******************************************/ -typedef ZSTD_ErrorCode ERR_enum; -#define PREFIX(name) ZSTD_error_##name - - -/*-**************************************** -* Error codes handling -******************************************/ -#undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */ -#define ERROR(name) ZSTD_ERROR(name) -#define ZSTD_ERROR(name) ((size_t)-PREFIX(name)) - -ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); } - -ERR_STATIC ERR_enum ERR_getErrorCode(size_t code) { if (!ERR_isError(code)) return (ERR_enum)0; return (ERR_enum) (0-code); } - - -/*-**************************************** -* Error Strings -******************************************/ - -const char* ERR_getErrorString(ERR_enum code); /* error_private.c */ - -ERR_STATIC const char* ERR_getErrorName(size_t code) -{ - return ERR_getErrorString(ERR_getErrorCode(code)); -} - -#if defined (__cplusplus) -} -#endif - -#endif /* ERROR_H_MODULE */ diff --git a/vendor/github.com/DataDog/zstd/errors.go b/vendor/github.com/DataDog/zstd/errors.go deleted file mode 100644 index 38db0d51..00000000 --- a/vendor/github.com/DataDog/zstd/errors.go +++ /dev/null @@ -1,35 +0,0 @@ -package zstd - -/* -#define ZSTD_STATIC_LINKING_ONLY -#include "zstd.h" -*/ -import "C" - -// ErrorCode is an error returned by the zstd library. -type ErrorCode int - -// Error returns the error string given by zstd -func (e ErrorCode) Error() string { - return C.GoString(C.ZSTD_getErrorName(C.size_t(e))) -} - -func cIsError(code int) bool { - return int(C.ZSTD_isError(C.size_t(code))) != 0 -} - -// getError returns an error for the return code, or nil if it's not an error -func getError(code int) error { - if code < 0 && cIsError(code) { - return ErrorCode(code) - } - return nil -} - -// IsDstSizeTooSmallError returns whether the error correspond to zstd standard sDstSizeTooSmall error -func IsDstSizeTooSmallError(e error) bool { - if e != nil && e.Error() == "Destination buffer is too small" { - return true - } - return false -} diff --git a/vendor/github.com/DataDog/zstd/fastcover.c b/vendor/github.com/DataDog/zstd/fastcover.c deleted file mode 100644 index 941bb5a2..00000000 --- a/vendor/github.com/DataDog/zstd/fastcover.c +++ /dev/null @@ -1,747 +0,0 @@ -/*-************************************* -* Dependencies -***************************************/ -#include /* fprintf */ -#include /* malloc, free, qsort */ -#include /* memset */ -#include /* clock */ - -#include "mem.h" /* read */ -#include "pool.h" -#include "threading.h" -#include "cover.h" -#include "zstd_internal.h" /* includes zstd.h */ -#ifndef ZDICT_STATIC_LINKING_ONLY -#define ZDICT_STATIC_LINKING_ONLY -#endif -#include "zdict.h" - - -/*-************************************* -* Constants -***************************************/ -#define FASTCOVER_MAX_SAMPLES_SIZE (sizeof(size_t) == 8 ? ((unsigned)-1) : ((unsigned)1 GB)) -#define FASTCOVER_MAX_F 31 -#define FASTCOVER_MAX_ACCEL 10 -#define DEFAULT_SPLITPOINT 0.75 -#define DEFAULT_F 20 -#define DEFAULT_ACCEL 1 - - -/*-************************************* -* Console display -***************************************/ -static int g_displayLevel = 2; -#define DISPLAY(...) \ - { \ - fprintf(stderr, __VA_ARGS__); \ - fflush(stderr); \ - } -#define LOCALDISPLAYLEVEL(displayLevel, l, ...) \ - if (displayLevel >= l) { \ - DISPLAY(__VA_ARGS__); \ - } /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */ -#define DISPLAYLEVEL(l, ...) LOCALDISPLAYLEVEL(g_displayLevel, l, __VA_ARGS__) - -#define LOCALDISPLAYUPDATE(displayLevel, l, ...) \ - if (displayLevel >= l) { \ - if ((clock() - g_time > refreshRate) || (displayLevel >= 4)) { \ - g_time = clock(); \ - DISPLAY(__VA_ARGS__); \ - } \ - } -#define DISPLAYUPDATE(l, ...) LOCALDISPLAYUPDATE(g_displayLevel, l, __VA_ARGS__) -static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100; -static clock_t g_time = 0; - - -/*-************************************* -* Hash Functions -***************************************/ -static const U64 prime6bytes = 227718039650203ULL; -static size_t ZSTD_hash6(U64 u, U32 h) { return (size_t)(((u << (64-48)) * prime6bytes) >> (64-h)) ; } -static size_t ZSTD_hash6Ptr(const void* p, U32 h) { return ZSTD_hash6(MEM_readLE64(p), h); } - -static const U64 prime8bytes = 0xCF1BBCDCB7A56463ULL; -static size_t ZSTD_hash8(U64 u, U32 h) { return (size_t)(((u) * prime8bytes) >> (64-h)) ; } -static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE64(p), h); } - - -/** - * Hash the d-byte value pointed to by p and mod 2^f - */ -static size_t FASTCOVER_hashPtrToIndex(const void* p, U32 h, unsigned d) { - if (d == 6) { - return ZSTD_hash6Ptr(p, h) & ((1 << h) - 1); - } - return ZSTD_hash8Ptr(p, h) & ((1 << h) - 1); -} - - -/*-************************************* -* Acceleration -***************************************/ -typedef struct { - unsigned finalize; /* Percentage of training samples used for ZDICT_finalizeDictionary */ - unsigned skip; /* Number of dmer skipped between each dmer counted in computeFrequency */ -} FASTCOVER_accel_t; - - -static const FASTCOVER_accel_t FASTCOVER_defaultAccelParameters[FASTCOVER_MAX_ACCEL+1] = { - { 100, 0 }, /* accel = 0, should not happen because accel = 0 defaults to accel = 1 */ - { 100, 0 }, /* accel = 1 */ - { 50, 1 }, /* accel = 2 */ - { 34, 2 }, /* accel = 3 */ - { 25, 3 }, /* accel = 4 */ - { 20, 4 }, /* accel = 5 */ - { 17, 5 }, /* accel = 6 */ - { 14, 6 }, /* accel = 7 */ - { 13, 7 }, /* accel = 8 */ - { 11, 8 }, /* accel = 9 */ - { 10, 9 }, /* accel = 10 */ -}; - - -/*-************************************* -* Context -***************************************/ -typedef struct { - const BYTE *samples; - size_t *offsets; - const size_t *samplesSizes; - size_t nbSamples; - size_t nbTrainSamples; - size_t nbTestSamples; - size_t nbDmers; - U32 *freqs; - unsigned d; - unsigned f; - FASTCOVER_accel_t accelParams; -} FASTCOVER_ctx_t; - - -/*-************************************* -* Helper functions -***************************************/ -/** - * Selects the best segment in an epoch. - * Segments of are scored according to the function: - * - * Let F(d) be the frequency of all dmers with hash value d. - * Let S_i be hash value of the dmer at position i of segment S which has length k. - * - * Score(S) = F(S_1) + F(S_2) + ... + F(S_{k-d+1}) - * - * Once the dmer with hash value d is in the dictionary we set F(d) = 0. - */ -static COVER_segment_t FASTCOVER_selectSegment(const FASTCOVER_ctx_t *ctx, - U32 *freqs, U32 begin, U32 end, - ZDICT_cover_params_t parameters, - U16* segmentFreqs) { - /* Constants */ - const U32 k = parameters.k; - const U32 d = parameters.d; - const U32 f = ctx->f; - const U32 dmersInK = k - d + 1; - - /* Try each segment (activeSegment) and save the best (bestSegment) */ - COVER_segment_t bestSegment = {0, 0, 0}; - COVER_segment_t activeSegment; - - /* Reset the activeDmers in the segment */ - /* The activeSegment starts at the beginning of the epoch. */ - activeSegment.begin = begin; - activeSegment.end = begin; - activeSegment.score = 0; - - /* Slide the activeSegment through the whole epoch. - * Save the best segment in bestSegment. - */ - while (activeSegment.end < end) { - /* Get hash value of current dmer */ - const size_t idx = FASTCOVER_hashPtrToIndex(ctx->samples + activeSegment.end, f, d); - - /* Add frequency of this index to score if this is the first occurrence of index in active segment */ - if (segmentFreqs[idx] == 0) { - activeSegment.score += freqs[idx]; - } - /* Increment end of segment and segmentFreqs*/ - activeSegment.end += 1; - segmentFreqs[idx] += 1; - /* If the window is now too large, drop the first position */ - if (activeSegment.end - activeSegment.begin == dmersInK + 1) { - /* Get hash value of the dmer to be eliminated from active segment */ - const size_t delIndex = FASTCOVER_hashPtrToIndex(ctx->samples + activeSegment.begin, f, d); - segmentFreqs[delIndex] -= 1; - /* Subtract frequency of this index from score if this is the last occurrence of this index in active segment */ - if (segmentFreqs[delIndex] == 0) { - activeSegment.score -= freqs[delIndex]; - } - /* Increment start of segment */ - activeSegment.begin += 1; - } - - /* If this segment is the best so far save it */ - if (activeSegment.score > bestSegment.score) { - bestSegment = activeSegment; - } - } - - /* Zero out rest of segmentFreqs array */ - while (activeSegment.begin < end) { - const size_t delIndex = FASTCOVER_hashPtrToIndex(ctx->samples + activeSegment.begin, f, d); - segmentFreqs[delIndex] -= 1; - activeSegment.begin += 1; - } - - { - /* Zero the frequency of hash value of each dmer covered by the chosen segment. */ - U32 pos; - for (pos = bestSegment.begin; pos != bestSegment.end; ++pos) { - const size_t i = FASTCOVER_hashPtrToIndex(ctx->samples + pos, f, d); - freqs[i] = 0; - } - } - - return bestSegment; -} - - -static int FASTCOVER_checkParameters(ZDICT_cover_params_t parameters, - size_t maxDictSize, unsigned f, - unsigned accel) { - /* k, d, and f are required parameters */ - if (parameters.d == 0 || parameters.k == 0) { - return 0; - } - /* d has to be 6 or 8 */ - if (parameters.d != 6 && parameters.d != 8) { - return 0; - } - /* k <= maxDictSize */ - if (parameters.k > maxDictSize) { - return 0; - } - /* d <= k */ - if (parameters.d > parameters.k) { - return 0; - } - /* 0 < f <= FASTCOVER_MAX_F*/ - if (f > FASTCOVER_MAX_F || f == 0) { - return 0; - } - /* 0 < splitPoint <= 1 */ - if (parameters.splitPoint <= 0 || parameters.splitPoint > 1) { - return 0; - } - /* 0 < accel <= 10 */ - if (accel > 10 || accel == 0) { - return 0; - } - return 1; -} - - -/** - * Clean up a context initialized with `FASTCOVER_ctx_init()`. - */ -static void -FASTCOVER_ctx_destroy(FASTCOVER_ctx_t* ctx) -{ - if (!ctx) return; - - free(ctx->freqs); - ctx->freqs = NULL; - - free(ctx->offsets); - ctx->offsets = NULL; -} - - -/** - * Calculate for frequency of hash value of each dmer in ctx->samples - */ -static void -FASTCOVER_computeFrequency(U32* freqs, const FASTCOVER_ctx_t* ctx) -{ - const unsigned f = ctx->f; - const unsigned d = ctx->d; - const unsigned skip = ctx->accelParams.skip; - const unsigned readLength = MAX(d, 8); - size_t i; - assert(ctx->nbTrainSamples >= 5); - assert(ctx->nbTrainSamples <= ctx->nbSamples); - for (i = 0; i < ctx->nbTrainSamples; i++) { - size_t start = ctx->offsets[i]; /* start of current dmer */ - size_t const currSampleEnd = ctx->offsets[i+1]; - while (start + readLength <= currSampleEnd) { - const size_t dmerIndex = FASTCOVER_hashPtrToIndex(ctx->samples + start, f, d); - freqs[dmerIndex]++; - start = start + skip + 1; - } - } -} - - -/** - * Prepare a context for dictionary building. - * The context is only dependent on the parameter `d` and can used multiple - * times. - * Returns 0 on success or error code on error. - * The context must be destroyed with `FASTCOVER_ctx_destroy()`. - */ -static size_t -FASTCOVER_ctx_init(FASTCOVER_ctx_t* ctx, - const void* samplesBuffer, - const size_t* samplesSizes, unsigned nbSamples, - unsigned d, double splitPoint, unsigned f, - FASTCOVER_accel_t accelParams) -{ - const BYTE* const samples = (const BYTE*)samplesBuffer; - const size_t totalSamplesSize = COVER_sum(samplesSizes, nbSamples); - /* Split samples into testing and training sets */ - const unsigned nbTrainSamples = splitPoint < 1.0 ? (unsigned)((double)nbSamples * splitPoint) : nbSamples; - const unsigned nbTestSamples = splitPoint < 1.0 ? nbSamples - nbTrainSamples : nbSamples; - const size_t trainingSamplesSize = splitPoint < 1.0 ? COVER_sum(samplesSizes, nbTrainSamples) : totalSamplesSize; - const size_t testSamplesSize = splitPoint < 1.0 ? COVER_sum(samplesSizes + nbTrainSamples, nbTestSamples) : totalSamplesSize; - - /* Checks */ - if (totalSamplesSize < MAX(d, sizeof(U64)) || - totalSamplesSize >= (size_t)FASTCOVER_MAX_SAMPLES_SIZE) { - DISPLAYLEVEL(1, "Total samples size is too large (%u MB), maximum size is %u MB\n", - (unsigned)(totalSamplesSize >> 20), (FASTCOVER_MAX_SAMPLES_SIZE >> 20)); - return ERROR(srcSize_wrong); - } - - /* Check if there are at least 5 training samples */ - if (nbTrainSamples < 5) { - DISPLAYLEVEL(1, "Total number of training samples is %u and is invalid\n", nbTrainSamples); - return ERROR(srcSize_wrong); - } - - /* Check if there's testing sample */ - if (nbTestSamples < 1) { - DISPLAYLEVEL(1, "Total number of testing samples is %u and is invalid.\n", nbTestSamples); - return ERROR(srcSize_wrong); - } - - /* Zero the context */ - memset(ctx, 0, sizeof(*ctx)); - DISPLAYLEVEL(2, "Training on %u samples of total size %u\n", nbTrainSamples, - (unsigned)trainingSamplesSize); - DISPLAYLEVEL(2, "Testing on %u samples of total size %u\n", nbTestSamples, - (unsigned)testSamplesSize); - - ctx->samples = samples; - ctx->samplesSizes = samplesSizes; - ctx->nbSamples = nbSamples; - ctx->nbTrainSamples = nbTrainSamples; - ctx->nbTestSamples = nbTestSamples; - ctx->nbDmers = trainingSamplesSize - MAX(d, sizeof(U64)) + 1; - ctx->d = d; - ctx->f = f; - ctx->accelParams = accelParams; - - /* The offsets of each file */ - ctx->offsets = (size_t*)calloc((nbSamples + 1), sizeof(size_t)); - if (ctx->offsets == NULL) { - DISPLAYLEVEL(1, "Failed to allocate scratch buffers \n"); - FASTCOVER_ctx_destroy(ctx); - return ERROR(memory_allocation); - } - - /* Fill offsets from the samplesSizes */ - { U32 i; - ctx->offsets[0] = 0; - assert(nbSamples >= 5); - for (i = 1; i <= nbSamples; ++i) { - ctx->offsets[i] = ctx->offsets[i - 1] + samplesSizes[i - 1]; - } - } - - /* Initialize frequency array of size 2^f */ - ctx->freqs = (U32*)calloc(((U64)1 << f), sizeof(U32)); - if (ctx->freqs == NULL) { - DISPLAYLEVEL(1, "Failed to allocate frequency table \n"); - FASTCOVER_ctx_destroy(ctx); - return ERROR(memory_allocation); - } - - DISPLAYLEVEL(2, "Computing frequencies\n"); - FASTCOVER_computeFrequency(ctx->freqs, ctx); - - return 0; -} - - -/** - * Given the prepared context build the dictionary. - */ -static size_t -FASTCOVER_buildDictionary(const FASTCOVER_ctx_t* ctx, - U32* freqs, - void* dictBuffer, size_t dictBufferCapacity, - ZDICT_cover_params_t parameters, - U16* segmentFreqs) -{ - BYTE *const dict = (BYTE *)dictBuffer; - size_t tail = dictBufferCapacity; - /* Divide the data into epochs. We will select one segment from each epoch. */ - const COVER_epoch_info_t epochs = COVER_computeEpochs( - (U32)dictBufferCapacity, (U32)ctx->nbDmers, parameters.k, 1); - const size_t maxZeroScoreRun = 10; - size_t zeroScoreRun = 0; - size_t epoch; - DISPLAYLEVEL(2, "Breaking content into %u epochs of size %u\n", - (U32)epochs.num, (U32)epochs.size); - /* Loop through the epochs until there are no more segments or the dictionary - * is full. - */ - for (epoch = 0; tail > 0; epoch = (epoch + 1) % epochs.num) { - const U32 epochBegin = (U32)(epoch * epochs.size); - const U32 epochEnd = epochBegin + epochs.size; - size_t segmentSize; - /* Select a segment */ - COVER_segment_t segment = FASTCOVER_selectSegment( - ctx, freqs, epochBegin, epochEnd, parameters, segmentFreqs); - - /* If the segment covers no dmers, then we are out of content. - * There may be new content in other epochs, for continue for some time. - */ - if (segment.score == 0) { - if (++zeroScoreRun >= maxZeroScoreRun) { - break; - } - continue; - } - zeroScoreRun = 0; - - /* Trim the segment if necessary and if it is too small then we are done */ - segmentSize = MIN(segment.end - segment.begin + parameters.d - 1, tail); - if (segmentSize < parameters.d) { - break; - } - - /* We fill the dictionary from the back to allow the best segments to be - * referenced with the smallest offsets. - */ - tail -= segmentSize; - memcpy(dict + tail, ctx->samples + segment.begin, segmentSize); - DISPLAYUPDATE( - 2, "\r%u%% ", - (unsigned)(((dictBufferCapacity - tail) * 100) / dictBufferCapacity)); - } - DISPLAYLEVEL(2, "\r%79s\r", ""); - return tail; -} - -/** - * Parameters for FASTCOVER_tryParameters(). - */ -typedef struct FASTCOVER_tryParameters_data_s { - const FASTCOVER_ctx_t* ctx; - COVER_best_t* best; - size_t dictBufferCapacity; - ZDICT_cover_params_t parameters; -} FASTCOVER_tryParameters_data_t; - - -/** - * Tries a set of parameters and updates the COVER_best_t with the results. - * This function is thread safe if zstd is compiled with multithreaded support. - * It takes its parameters as an *OWNING* opaque pointer to support threading. - */ -static void FASTCOVER_tryParameters(void *opaque) -{ - /* Save parameters as local variables */ - FASTCOVER_tryParameters_data_t *const data = (FASTCOVER_tryParameters_data_t *)opaque; - const FASTCOVER_ctx_t *const ctx = data->ctx; - const ZDICT_cover_params_t parameters = data->parameters; - size_t dictBufferCapacity = data->dictBufferCapacity; - size_t totalCompressedSize = ERROR(GENERIC); - /* Initialize array to keep track of frequency of dmer within activeSegment */ - U16* segmentFreqs = (U16 *)calloc(((U64)1 << ctx->f), sizeof(U16)); - /* Allocate space for hash table, dict, and freqs */ - BYTE *const dict = (BYTE * const)malloc(dictBufferCapacity); - COVER_dictSelection_t selection = COVER_dictSelectionError(ERROR(GENERIC)); - U32 *freqs = (U32*) malloc(((U64)1 << ctx->f) * sizeof(U32)); - if (!segmentFreqs || !dict || !freqs) { - DISPLAYLEVEL(1, "Failed to allocate buffers: out of memory\n"); - goto _cleanup; - } - /* Copy the frequencies because we need to modify them */ - memcpy(freqs, ctx->freqs, ((U64)1 << ctx->f) * sizeof(U32)); - /* Build the dictionary */ - { const size_t tail = FASTCOVER_buildDictionary(ctx, freqs, dict, dictBufferCapacity, - parameters, segmentFreqs); - - const unsigned nbFinalizeSamples = (unsigned)(ctx->nbTrainSamples * ctx->accelParams.finalize / 100); - selection = COVER_selectDict(dict + tail, dictBufferCapacity - tail, - ctx->samples, ctx->samplesSizes, nbFinalizeSamples, ctx->nbTrainSamples, ctx->nbSamples, parameters, ctx->offsets, - totalCompressedSize); - - if (COVER_dictSelectionIsError(selection)) { - DISPLAYLEVEL(1, "Failed to select dictionary\n"); - goto _cleanup; - } - } -_cleanup: - free(dict); - COVER_best_finish(data->best, parameters, selection); - free(data); - free(segmentFreqs); - COVER_dictSelectionFree(selection); - free(freqs); -} - - -static void -FASTCOVER_convertToCoverParams(ZDICT_fastCover_params_t fastCoverParams, - ZDICT_cover_params_t* coverParams) -{ - coverParams->k = fastCoverParams.k; - coverParams->d = fastCoverParams.d; - coverParams->steps = fastCoverParams.steps; - coverParams->nbThreads = fastCoverParams.nbThreads; - coverParams->splitPoint = fastCoverParams.splitPoint; - coverParams->zParams = fastCoverParams.zParams; - coverParams->shrinkDict = fastCoverParams.shrinkDict; -} - - -static void -FASTCOVER_convertToFastCoverParams(ZDICT_cover_params_t coverParams, - ZDICT_fastCover_params_t* fastCoverParams, - unsigned f, unsigned accel) -{ - fastCoverParams->k = coverParams.k; - fastCoverParams->d = coverParams.d; - fastCoverParams->steps = coverParams.steps; - fastCoverParams->nbThreads = coverParams.nbThreads; - fastCoverParams->splitPoint = coverParams.splitPoint; - fastCoverParams->f = f; - fastCoverParams->accel = accel; - fastCoverParams->zParams = coverParams.zParams; - fastCoverParams->shrinkDict = coverParams.shrinkDict; -} - - -ZDICTLIB_API size_t -ZDICT_trainFromBuffer_fastCover(void* dictBuffer, size_t dictBufferCapacity, - const void* samplesBuffer, - const size_t* samplesSizes, unsigned nbSamples, - ZDICT_fastCover_params_t parameters) -{ - BYTE* const dict = (BYTE*)dictBuffer; - FASTCOVER_ctx_t ctx; - ZDICT_cover_params_t coverParams; - FASTCOVER_accel_t accelParams; - /* Initialize global data */ - g_displayLevel = parameters.zParams.notificationLevel; - /* Assign splitPoint and f if not provided */ - parameters.splitPoint = 1.0; - parameters.f = parameters.f == 0 ? DEFAULT_F : parameters.f; - parameters.accel = parameters.accel == 0 ? DEFAULT_ACCEL : parameters.accel; - /* Convert to cover parameter */ - memset(&coverParams, 0 , sizeof(coverParams)); - FASTCOVER_convertToCoverParams(parameters, &coverParams); - /* Checks */ - if (!FASTCOVER_checkParameters(coverParams, dictBufferCapacity, parameters.f, - parameters.accel)) { - DISPLAYLEVEL(1, "FASTCOVER parameters incorrect\n"); - return ERROR(parameter_outOfBound); - } - if (nbSamples == 0) { - DISPLAYLEVEL(1, "FASTCOVER must have at least one input file\n"); - return ERROR(srcSize_wrong); - } - if (dictBufferCapacity < ZDICT_DICTSIZE_MIN) { - DISPLAYLEVEL(1, "dictBufferCapacity must be at least %u\n", - ZDICT_DICTSIZE_MIN); - return ERROR(dstSize_tooSmall); - } - /* Assign corresponding FASTCOVER_accel_t to accelParams*/ - accelParams = FASTCOVER_defaultAccelParameters[parameters.accel]; - /* Initialize context */ - { - size_t const initVal = FASTCOVER_ctx_init(&ctx, samplesBuffer, samplesSizes, nbSamples, - coverParams.d, parameters.splitPoint, parameters.f, - accelParams); - if (ZSTD_isError(initVal)) { - DISPLAYLEVEL(1, "Failed to initialize context\n"); - return initVal; - } - } - COVER_warnOnSmallCorpus(dictBufferCapacity, ctx.nbDmers, g_displayLevel); - /* Build the dictionary */ - DISPLAYLEVEL(2, "Building dictionary\n"); - { - /* Initialize array to keep track of frequency of dmer within activeSegment */ - U16* segmentFreqs = (U16 *)calloc(((U64)1 << parameters.f), sizeof(U16)); - const size_t tail = FASTCOVER_buildDictionary(&ctx, ctx.freqs, dictBuffer, - dictBufferCapacity, coverParams, segmentFreqs); - const unsigned nbFinalizeSamples = (unsigned)(ctx.nbTrainSamples * ctx.accelParams.finalize / 100); - const size_t dictionarySize = ZDICT_finalizeDictionary( - dict, dictBufferCapacity, dict + tail, dictBufferCapacity - tail, - samplesBuffer, samplesSizes, nbFinalizeSamples, coverParams.zParams); - if (!ZSTD_isError(dictionarySize)) { - DISPLAYLEVEL(2, "Constructed dictionary of size %u\n", - (unsigned)dictionarySize); - } - FASTCOVER_ctx_destroy(&ctx); - free(segmentFreqs); - return dictionarySize; - } -} - - -ZDICTLIB_API size_t -ZDICT_optimizeTrainFromBuffer_fastCover( - void* dictBuffer, size_t dictBufferCapacity, - const void* samplesBuffer, - const size_t* samplesSizes, unsigned nbSamples, - ZDICT_fastCover_params_t* parameters) -{ - ZDICT_cover_params_t coverParams; - FASTCOVER_accel_t accelParams; - /* constants */ - const unsigned nbThreads = parameters->nbThreads; - const double splitPoint = - parameters->splitPoint <= 0.0 ? DEFAULT_SPLITPOINT : parameters->splitPoint; - const unsigned kMinD = parameters->d == 0 ? 6 : parameters->d; - const unsigned kMaxD = parameters->d == 0 ? 8 : parameters->d; - const unsigned kMinK = parameters->k == 0 ? 50 : parameters->k; - const unsigned kMaxK = parameters->k == 0 ? 2000 : parameters->k; - const unsigned kSteps = parameters->steps == 0 ? 40 : parameters->steps; - const unsigned kStepSize = MAX((kMaxK - kMinK) / kSteps, 1); - const unsigned kIterations = - (1 + (kMaxD - kMinD) / 2) * (1 + (kMaxK - kMinK) / kStepSize); - const unsigned f = parameters->f == 0 ? DEFAULT_F : parameters->f; - const unsigned accel = parameters->accel == 0 ? DEFAULT_ACCEL : parameters->accel; - const unsigned shrinkDict = 0; - /* Local variables */ - const int displayLevel = parameters->zParams.notificationLevel; - unsigned iteration = 1; - unsigned d; - unsigned k; - COVER_best_t best; - POOL_ctx *pool = NULL; - int warned = 0; - /* Checks */ - if (splitPoint <= 0 || splitPoint > 1) { - LOCALDISPLAYLEVEL(displayLevel, 1, "Incorrect splitPoint\n"); - return ERROR(parameter_outOfBound); - } - if (accel == 0 || accel > FASTCOVER_MAX_ACCEL) { - LOCALDISPLAYLEVEL(displayLevel, 1, "Incorrect accel\n"); - return ERROR(parameter_outOfBound); - } - if (kMinK < kMaxD || kMaxK < kMinK) { - LOCALDISPLAYLEVEL(displayLevel, 1, "Incorrect k\n"); - return ERROR(parameter_outOfBound); - } - if (nbSamples == 0) { - LOCALDISPLAYLEVEL(displayLevel, 1, "FASTCOVER must have at least one input file\n"); - return ERROR(srcSize_wrong); - } - if (dictBufferCapacity < ZDICT_DICTSIZE_MIN) { - LOCALDISPLAYLEVEL(displayLevel, 1, "dictBufferCapacity must be at least %u\n", - ZDICT_DICTSIZE_MIN); - return ERROR(dstSize_tooSmall); - } - if (nbThreads > 1) { - pool = POOL_create(nbThreads, 1); - if (!pool) { - return ERROR(memory_allocation); - } - } - /* Initialization */ - COVER_best_init(&best); - memset(&coverParams, 0 , sizeof(coverParams)); - FASTCOVER_convertToCoverParams(*parameters, &coverParams); - accelParams = FASTCOVER_defaultAccelParameters[accel]; - /* Turn down global display level to clean up display at level 2 and below */ - g_displayLevel = displayLevel == 0 ? 0 : displayLevel - 1; - /* Loop through d first because each new value needs a new context */ - LOCALDISPLAYLEVEL(displayLevel, 2, "Trying %u different sets of parameters\n", - kIterations); - for (d = kMinD; d <= kMaxD; d += 2) { - /* Initialize the context for this value of d */ - FASTCOVER_ctx_t ctx; - LOCALDISPLAYLEVEL(displayLevel, 3, "d=%u\n", d); - { - size_t const initVal = FASTCOVER_ctx_init(&ctx, samplesBuffer, samplesSizes, nbSamples, d, splitPoint, f, accelParams); - if (ZSTD_isError(initVal)) { - LOCALDISPLAYLEVEL(displayLevel, 1, "Failed to initialize context\n"); - COVER_best_destroy(&best); - POOL_free(pool); - return initVal; - } - } - if (!warned) { - COVER_warnOnSmallCorpus(dictBufferCapacity, ctx.nbDmers, displayLevel); - warned = 1; - } - /* Loop through k reusing the same context */ - for (k = kMinK; k <= kMaxK; k += kStepSize) { - /* Prepare the arguments */ - FASTCOVER_tryParameters_data_t *data = (FASTCOVER_tryParameters_data_t *)malloc( - sizeof(FASTCOVER_tryParameters_data_t)); - LOCALDISPLAYLEVEL(displayLevel, 3, "k=%u\n", k); - if (!data) { - LOCALDISPLAYLEVEL(displayLevel, 1, "Failed to allocate parameters\n"); - COVER_best_destroy(&best); - FASTCOVER_ctx_destroy(&ctx); - POOL_free(pool); - return ERROR(memory_allocation); - } - data->ctx = &ctx; - data->best = &best; - data->dictBufferCapacity = dictBufferCapacity; - data->parameters = coverParams; - data->parameters.k = k; - data->parameters.d = d; - data->parameters.splitPoint = splitPoint; - data->parameters.steps = kSteps; - data->parameters.shrinkDict = shrinkDict; - data->parameters.zParams.notificationLevel = g_displayLevel; - /* Check the parameters */ - if (!FASTCOVER_checkParameters(data->parameters, dictBufferCapacity, - data->ctx->f, accel)) { - DISPLAYLEVEL(1, "FASTCOVER parameters incorrect\n"); - free(data); - continue; - } - /* Call the function and pass ownership of data to it */ - COVER_best_start(&best); - if (pool) { - POOL_add(pool, &FASTCOVER_tryParameters, data); - } else { - FASTCOVER_tryParameters(data); - } - /* Print status */ - LOCALDISPLAYUPDATE(displayLevel, 2, "\r%u%% ", - (unsigned)((iteration * 100) / kIterations)); - ++iteration; - } - COVER_best_wait(&best); - FASTCOVER_ctx_destroy(&ctx); - } - LOCALDISPLAYLEVEL(displayLevel, 2, "\r%79s\r", ""); - /* Fill the output buffer and parameters with output of the best parameters */ - { - const size_t dictSize = best.dictSize; - if (ZSTD_isError(best.compressedSize)) { - const size_t compressedSize = best.compressedSize; - COVER_best_destroy(&best); - POOL_free(pool); - return compressedSize; - } - FASTCOVER_convertToFastCoverParams(best.parameters, parameters, f, accel); - memcpy(dictBuffer, best.dict, dictSize); - COVER_best_destroy(&best); - POOL_free(pool); - return dictSize; - } - -} diff --git a/vendor/github.com/DataDog/zstd/fse.h b/vendor/github.com/DataDog/zstd/fse.h deleted file mode 100644 index a7553e37..00000000 --- a/vendor/github.com/DataDog/zstd/fse.h +++ /dev/null @@ -1,708 +0,0 @@ -/* ****************************************************************** - FSE : Finite State Entropy codec - Public Prototypes declaration - Copyright (C) 2013-2016, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - Source repository : https://github.com/Cyan4973/FiniteStateEntropy -****************************************************************** */ - -#if defined (__cplusplus) -extern "C" { -#endif - -#ifndef FSE_H -#define FSE_H - - -/*-***************************************** -* Dependencies -******************************************/ -#include /* size_t, ptrdiff_t */ - - -/*-***************************************** -* FSE_PUBLIC_API : control library symbols visibility -******************************************/ -#if defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) && defined(__GNUC__) && (__GNUC__ >= 4) -# define FSE_PUBLIC_API __attribute__ ((visibility ("default"))) -#elif defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) /* Visual expected */ -# define FSE_PUBLIC_API __declspec(dllexport) -#elif defined(FSE_DLL_IMPORT) && (FSE_DLL_IMPORT==1) -# define FSE_PUBLIC_API __declspec(dllimport) /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ -#else -# define FSE_PUBLIC_API -#endif - -/*------ Version ------*/ -#define FSE_VERSION_MAJOR 0 -#define FSE_VERSION_MINOR 9 -#define FSE_VERSION_RELEASE 0 - -#define FSE_LIB_VERSION FSE_VERSION_MAJOR.FSE_VERSION_MINOR.FSE_VERSION_RELEASE -#define FSE_QUOTE(str) #str -#define FSE_EXPAND_AND_QUOTE(str) FSE_QUOTE(str) -#define FSE_VERSION_STRING FSE_EXPAND_AND_QUOTE(FSE_LIB_VERSION) - -#define FSE_VERSION_NUMBER (FSE_VERSION_MAJOR *100*100 + FSE_VERSION_MINOR *100 + FSE_VERSION_RELEASE) -FSE_PUBLIC_API unsigned FSE_versionNumber(void); /**< library version number; to be used when checking dll version */ - - -/*-**************************************** -* FSE simple functions -******************************************/ -/*! FSE_compress() : - Compress content of buffer 'src', of size 'srcSize', into destination buffer 'dst'. - 'dst' buffer must be already allocated. Compression runs faster is dstCapacity >= FSE_compressBound(srcSize). - @return : size of compressed data (<= dstCapacity). - Special values : if return == 0, srcData is not compressible => Nothing is stored within dst !!! - if return == 1, srcData is a single byte symbol * srcSize times. Use RLE compression instead. - if FSE_isError(return), compression failed (more details using FSE_getErrorName()) -*/ -FSE_PUBLIC_API size_t FSE_compress(void* dst, size_t dstCapacity, - const void* src, size_t srcSize); - -/*! FSE_decompress(): - Decompress FSE data from buffer 'cSrc', of size 'cSrcSize', - into already allocated destination buffer 'dst', of size 'dstCapacity'. - @return : size of regenerated data (<= maxDstSize), - or an error code, which can be tested using FSE_isError() . - - ** Important ** : FSE_decompress() does not decompress non-compressible nor RLE data !!! - Why ? : making this distinction requires a header. - Header management is intentionally delegated to the user layer, which can better manage special cases. -*/ -FSE_PUBLIC_API size_t FSE_decompress(void* dst, size_t dstCapacity, - const void* cSrc, size_t cSrcSize); - - -/*-***************************************** -* Tool functions -******************************************/ -FSE_PUBLIC_API size_t FSE_compressBound(size_t size); /* maximum compressed size */ - -/* Error Management */ -FSE_PUBLIC_API unsigned FSE_isError(size_t code); /* tells if a return value is an error code */ -FSE_PUBLIC_API const char* FSE_getErrorName(size_t code); /* provides error code string (useful for debugging) */ - - -/*-***************************************** -* FSE advanced functions -******************************************/ -/*! FSE_compress2() : - Same as FSE_compress(), but allows the selection of 'maxSymbolValue' and 'tableLog' - Both parameters can be defined as '0' to mean : use default value - @return : size of compressed data - Special values : if return == 0, srcData is not compressible => Nothing is stored within cSrc !!! - if return == 1, srcData is a single byte symbol * srcSize times. Use RLE compression. - if FSE_isError(return), it's an error code. -*/ -FSE_PUBLIC_API size_t FSE_compress2 (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog); - - -/*-***************************************** -* FSE detailed API -******************************************/ -/*! -FSE_compress() does the following: -1. count symbol occurrence from source[] into table count[] (see hist.h) -2. normalize counters so that sum(count[]) == Power_of_2 (2^tableLog) -3. save normalized counters to memory buffer using writeNCount() -4. build encoding table 'CTable' from normalized counters -5. encode the data stream using encoding table 'CTable' - -FSE_decompress() does the following: -1. read normalized counters with readNCount() -2. build decoding table 'DTable' from normalized counters -3. decode the data stream using decoding table 'DTable' - -The following API allows targeting specific sub-functions for advanced tasks. -For example, it's possible to compress several blocks using the same 'CTable', -or to save and provide normalized distribution using external method. -*/ - -/* *** COMPRESSION *** */ - -/*! FSE_optimalTableLog(): - dynamically downsize 'tableLog' when conditions are met. - It saves CPU time, by using smaller tables, while preserving or even improving compression ratio. - @return : recommended tableLog (necessarily <= 'maxTableLog') */ -FSE_PUBLIC_API unsigned FSE_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue); - -/*! FSE_normalizeCount(): - normalize counts so that sum(count[]) == Power_of_2 (2^tableLog) - 'normalizedCounter' is a table of short, of minimum size (maxSymbolValue+1). - @return : tableLog, - or an errorCode, which can be tested using FSE_isError() */ -FSE_PUBLIC_API size_t FSE_normalizeCount(short* normalizedCounter, unsigned tableLog, - const unsigned* count, size_t srcSize, unsigned maxSymbolValue); - -/*! FSE_NCountWriteBound(): - Provides the maximum possible size of an FSE normalized table, given 'maxSymbolValue' and 'tableLog'. - Typically useful for allocation purpose. */ -FSE_PUBLIC_API size_t FSE_NCountWriteBound(unsigned maxSymbolValue, unsigned tableLog); - -/*! FSE_writeNCount(): - Compactly save 'normalizedCounter' into 'buffer'. - @return : size of the compressed table, - or an errorCode, which can be tested using FSE_isError(). */ -FSE_PUBLIC_API size_t FSE_writeNCount (void* buffer, size_t bufferSize, - const short* normalizedCounter, - unsigned maxSymbolValue, unsigned tableLog); - -/*! Constructor and Destructor of FSE_CTable. - Note that FSE_CTable size depends on 'tableLog' and 'maxSymbolValue' */ -typedef unsigned FSE_CTable; /* don't allocate that. It's only meant to be more restrictive than void* */ -FSE_PUBLIC_API FSE_CTable* FSE_createCTable (unsigned maxSymbolValue, unsigned tableLog); -FSE_PUBLIC_API void FSE_freeCTable (FSE_CTable* ct); - -/*! FSE_buildCTable(): - Builds `ct`, which must be already allocated, using FSE_createCTable(). - @return : 0, or an errorCode, which can be tested using FSE_isError() */ -FSE_PUBLIC_API size_t FSE_buildCTable(FSE_CTable* ct, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog); - -/*! FSE_compress_usingCTable(): - Compress `src` using `ct` into `dst` which must be already allocated. - @return : size of compressed data (<= `dstCapacity`), - or 0 if compressed data could not fit into `dst`, - or an errorCode, which can be tested using FSE_isError() */ -FSE_PUBLIC_API size_t FSE_compress_usingCTable (void* dst, size_t dstCapacity, const void* src, size_t srcSize, const FSE_CTable* ct); - -/*! -Tutorial : ----------- -The first step is to count all symbols. FSE_count() does this job very fast. -Result will be saved into 'count', a table of unsigned int, which must be already allocated, and have 'maxSymbolValuePtr[0]+1' cells. -'src' is a table of bytes of size 'srcSize'. All values within 'src' MUST be <= maxSymbolValuePtr[0] -maxSymbolValuePtr[0] will be updated, with its real value (necessarily <= original value) -FSE_count() will return the number of occurrence of the most frequent symbol. -This can be used to know if there is a single symbol within 'src', and to quickly evaluate its compressibility. -If there is an error, the function will return an ErrorCode (which can be tested using FSE_isError()). - -The next step is to normalize the frequencies. -FSE_normalizeCount() will ensure that sum of frequencies is == 2 ^'tableLog'. -It also guarantees a minimum of 1 to any Symbol with frequency >= 1. -You can use 'tableLog'==0 to mean "use default tableLog value". -If you are unsure of which tableLog value to use, you can ask FSE_optimalTableLog(), -which will provide the optimal valid tableLog given sourceSize, maxSymbolValue, and a user-defined maximum (0 means "default"). - -The result of FSE_normalizeCount() will be saved into a table, -called 'normalizedCounter', which is a table of signed short. -'normalizedCounter' must be already allocated, and have at least 'maxSymbolValue+1' cells. -The return value is tableLog if everything proceeded as expected. -It is 0 if there is a single symbol within distribution. -If there is an error (ex: invalid tableLog value), the function will return an ErrorCode (which can be tested using FSE_isError()). - -'normalizedCounter' can be saved in a compact manner to a memory area using FSE_writeNCount(). -'buffer' must be already allocated. -For guaranteed success, buffer size must be at least FSE_headerBound(). -The result of the function is the number of bytes written into 'buffer'. -If there is an error, the function will return an ErrorCode (which can be tested using FSE_isError(); ex : buffer size too small). - -'normalizedCounter' can then be used to create the compression table 'CTable'. -The space required by 'CTable' must be already allocated, using FSE_createCTable(). -You can then use FSE_buildCTable() to fill 'CTable'. -If there is an error, both functions will return an ErrorCode (which can be tested using FSE_isError()). - -'CTable' can then be used to compress 'src', with FSE_compress_usingCTable(). -Similar to FSE_count(), the convention is that 'src' is assumed to be a table of char of size 'srcSize' -The function returns the size of compressed data (without header), necessarily <= `dstCapacity`. -If it returns '0', compressed data could not fit into 'dst'. -If there is an error, the function will return an ErrorCode (which can be tested using FSE_isError()). -*/ - - -/* *** DECOMPRESSION *** */ - -/*! FSE_readNCount(): - Read compactly saved 'normalizedCounter' from 'rBuffer'. - @return : size read from 'rBuffer', - or an errorCode, which can be tested using FSE_isError(). - maxSymbolValuePtr[0] and tableLogPtr[0] will also be updated with their respective values */ -FSE_PUBLIC_API size_t FSE_readNCount (short* normalizedCounter, - unsigned* maxSymbolValuePtr, unsigned* tableLogPtr, - const void* rBuffer, size_t rBuffSize); - -/*! Constructor and Destructor of FSE_DTable. - Note that its size depends on 'tableLog' */ -typedef unsigned FSE_DTable; /* don't allocate that. It's just a way to be more restrictive than void* */ -FSE_PUBLIC_API FSE_DTable* FSE_createDTable(unsigned tableLog); -FSE_PUBLIC_API void FSE_freeDTable(FSE_DTable* dt); - -/*! FSE_buildDTable(): - Builds 'dt', which must be already allocated, using FSE_createDTable(). - return : 0, or an errorCode, which can be tested using FSE_isError() */ -FSE_PUBLIC_API size_t FSE_buildDTable (FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog); - -/*! FSE_decompress_usingDTable(): - Decompress compressed source `cSrc` of size `cSrcSize` using `dt` - into `dst` which must be already allocated. - @return : size of regenerated data (necessarily <= `dstCapacity`), - or an errorCode, which can be tested using FSE_isError() */ -FSE_PUBLIC_API size_t FSE_decompress_usingDTable(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, const FSE_DTable* dt); - -/*! -Tutorial : ----------- -(Note : these functions only decompress FSE-compressed blocks. - If block is uncompressed, use memcpy() instead - If block is a single repeated byte, use memset() instead ) - -The first step is to obtain the normalized frequencies of symbols. -This can be performed by FSE_readNCount() if it was saved using FSE_writeNCount(). -'normalizedCounter' must be already allocated, and have at least 'maxSymbolValuePtr[0]+1' cells of signed short. -In practice, that means it's necessary to know 'maxSymbolValue' beforehand, -or size the table to handle worst case situations (typically 256). -FSE_readNCount() will provide 'tableLog' and 'maxSymbolValue'. -The result of FSE_readNCount() is the number of bytes read from 'rBuffer'. -Note that 'rBufferSize' must be at least 4 bytes, even if useful information is less than that. -If there is an error, the function will return an error code, which can be tested using FSE_isError(). - -The next step is to build the decompression tables 'FSE_DTable' from 'normalizedCounter'. -This is performed by the function FSE_buildDTable(). -The space required by 'FSE_DTable' must be already allocated using FSE_createDTable(). -If there is an error, the function will return an error code, which can be tested using FSE_isError(). - -`FSE_DTable` can then be used to decompress `cSrc`, with FSE_decompress_usingDTable(). -`cSrcSize` must be strictly correct, otherwise decompression will fail. -FSE_decompress_usingDTable() result will tell how many bytes were regenerated (<=`dstCapacity`). -If there is an error, the function will return an error code, which can be tested using FSE_isError(). (ex: dst buffer too small) -*/ - -#endif /* FSE_H */ - -#if defined(FSE_STATIC_LINKING_ONLY) && !defined(FSE_H_FSE_STATIC_LINKING_ONLY) -#define FSE_H_FSE_STATIC_LINKING_ONLY - -/* *** Dependency *** */ -#include "bitstream.h" - - -/* ***************************************** -* Static allocation -*******************************************/ -/* FSE buffer bounds */ -#define FSE_NCOUNTBOUND 512 -#define FSE_BLOCKBOUND(size) (size + (size>>7) + 4 /* fse states */ + sizeof(size_t) /* bitContainer */) -#define FSE_COMPRESSBOUND(size) (FSE_NCOUNTBOUND + FSE_BLOCKBOUND(size)) /* Macro version, useful for static allocation */ - -/* It is possible to statically allocate FSE CTable/DTable as a table of FSE_CTable/FSE_DTable using below macros */ -#define FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) (1 + (1<<(maxTableLog-1)) + ((maxSymbolValue+1)*2)) -#define FSE_DTABLE_SIZE_U32(maxTableLog) (1 + (1< 12) ? (1 << (maxTableLog - 2)) : 1024) ) -size_t FSE_compress_wksp (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize); - -size_t FSE_buildCTable_raw (FSE_CTable* ct, unsigned nbBits); -/**< build a fake FSE_CTable, designed for a flat distribution, where each symbol uses nbBits */ - -size_t FSE_buildCTable_rle (FSE_CTable* ct, unsigned char symbolValue); -/**< build a fake FSE_CTable, designed to compress always the same symbolValue */ - -/* FSE_buildCTable_wksp() : - * Same as FSE_buildCTable(), but using an externally allocated scratch buffer (`workSpace`). - * `wkspSize` must be >= `(1<= BIT_DStream_completed - -When it's done, verify decompression is fully completed, by checking both DStream and the relevant states. -Checking if DStream has reached its end is performed by : - BIT_endOfDStream(&DStream); -Check also the states. There might be some symbols left there, if some high probability ones (>50%) are possible. - FSE_endOfDState(&DState); -*/ - - -/* ***************************************** -* FSE unsafe API -*******************************************/ -static unsigned char FSE_decodeSymbolFast(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD); -/* faster, but works only if nbBits is always >= 1 (otherwise, result will be corrupted) */ - - -/* ***************************************** -* Implementation of inlined functions -*******************************************/ -typedef struct { - int deltaFindState; - U32 deltaNbBits; -} FSE_symbolCompressionTransform; /* total 8 bytes */ - -MEM_STATIC void FSE_initCState(FSE_CState_t* statePtr, const FSE_CTable* ct) -{ - const void* ptr = ct; - const U16* u16ptr = (const U16*) ptr; - const U32 tableLog = MEM_read16(ptr); - statePtr->value = (ptrdiff_t)1<stateTable = u16ptr+2; - statePtr->symbolTT = ct + 1 + (tableLog ? (1<<(tableLog-1)) : 1); - statePtr->stateLog = tableLog; -} - - -/*! FSE_initCState2() : -* Same as FSE_initCState(), but the first symbol to include (which will be the last to be read) -* uses the smallest state value possible, saving the cost of this symbol */ -MEM_STATIC void FSE_initCState2(FSE_CState_t* statePtr, const FSE_CTable* ct, U32 symbol) -{ - FSE_initCState(statePtr, ct); - { const FSE_symbolCompressionTransform symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol]; - const U16* stateTable = (const U16*)(statePtr->stateTable); - U32 nbBitsOut = (U32)((symbolTT.deltaNbBits + (1<<15)) >> 16); - statePtr->value = (nbBitsOut << 16) - symbolTT.deltaNbBits; - statePtr->value = stateTable[(statePtr->value >> nbBitsOut) + symbolTT.deltaFindState]; - } -} - -MEM_STATIC void FSE_encodeSymbol(BIT_CStream_t* bitC, FSE_CState_t* statePtr, unsigned symbol) -{ - FSE_symbolCompressionTransform const symbolTT = ((const FSE_symbolCompressionTransform*)(statePtr->symbolTT))[symbol]; - const U16* const stateTable = (const U16*)(statePtr->stateTable); - U32 const nbBitsOut = (U32)((statePtr->value + symbolTT.deltaNbBits) >> 16); - BIT_addBits(bitC, statePtr->value, nbBitsOut); - statePtr->value = stateTable[ (statePtr->value >> nbBitsOut) + symbolTT.deltaFindState]; -} - -MEM_STATIC void FSE_flushCState(BIT_CStream_t* bitC, const FSE_CState_t* statePtr) -{ - BIT_addBits(bitC, statePtr->value, statePtr->stateLog); - BIT_flushBits(bitC); -} - - -/* FSE_getMaxNbBits() : - * Approximate maximum cost of a symbol, in bits. - * Fractional get rounded up (i.e : a symbol with a normalized frequency of 3 gives the same result as a frequency of 2) - * note 1 : assume symbolValue is valid (<= maxSymbolValue) - * note 2 : if freq[symbolValue]==0, @return a fake cost of tableLog+1 bits */ -MEM_STATIC U32 FSE_getMaxNbBits(const void* symbolTTPtr, U32 symbolValue) -{ - const FSE_symbolCompressionTransform* symbolTT = (const FSE_symbolCompressionTransform*) symbolTTPtr; - return (symbolTT[symbolValue].deltaNbBits + ((1<<16)-1)) >> 16; -} - -/* FSE_bitCost() : - * Approximate symbol cost, as fractional value, using fixed-point format (accuracyLog fractional bits) - * note 1 : assume symbolValue is valid (<= maxSymbolValue) - * note 2 : if freq[symbolValue]==0, @return a fake cost of tableLog+1 bits */ -MEM_STATIC U32 FSE_bitCost(const void* symbolTTPtr, U32 tableLog, U32 symbolValue, U32 accuracyLog) -{ - const FSE_symbolCompressionTransform* symbolTT = (const FSE_symbolCompressionTransform*) symbolTTPtr; - U32 const minNbBits = symbolTT[symbolValue].deltaNbBits >> 16; - U32 const threshold = (minNbBits+1) << 16; - assert(tableLog < 16); - assert(accuracyLog < 31-tableLog); /* ensure enough room for renormalization double shift */ - { U32 const tableSize = 1 << tableLog; - U32 const deltaFromThreshold = threshold - (symbolTT[symbolValue].deltaNbBits + tableSize); - U32 const normalizedDeltaFromThreshold = (deltaFromThreshold << accuracyLog) >> tableLog; /* linear interpolation (very approximate) */ - U32 const bitMultiplier = 1 << accuracyLog; - assert(symbolTT[symbolValue].deltaNbBits + tableSize <= threshold); - assert(normalizedDeltaFromThreshold <= bitMultiplier); - return (minNbBits+1)*bitMultiplier - normalizedDeltaFromThreshold; - } -} - - -/* ====== Decompression ====== */ - -typedef struct { - U16 tableLog; - U16 fastMode; -} FSE_DTableHeader; /* sizeof U32 */ - -typedef struct -{ - unsigned short newState; - unsigned char symbol; - unsigned char nbBits; -} FSE_decode_t; /* size == U32 */ - -MEM_STATIC void FSE_initDState(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD, const FSE_DTable* dt) -{ - const void* ptr = dt; - const FSE_DTableHeader* const DTableH = (const FSE_DTableHeader*)ptr; - DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog); - BIT_reloadDStream(bitD); - DStatePtr->table = dt + 1; -} - -MEM_STATIC BYTE FSE_peekSymbol(const FSE_DState_t* DStatePtr) -{ - FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; - return DInfo.symbol; -} - -MEM_STATIC void FSE_updateState(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD) -{ - FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; - U32 const nbBits = DInfo.nbBits; - size_t const lowBits = BIT_readBits(bitD, nbBits); - DStatePtr->state = DInfo.newState + lowBits; -} - -MEM_STATIC BYTE FSE_decodeSymbol(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD) -{ - FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; - U32 const nbBits = DInfo.nbBits; - BYTE const symbol = DInfo.symbol; - size_t const lowBits = BIT_readBits(bitD, nbBits); - - DStatePtr->state = DInfo.newState + lowBits; - return symbol; -} - -/*! FSE_decodeSymbolFast() : - unsafe, only works if no symbol has a probability > 50% */ -MEM_STATIC BYTE FSE_decodeSymbolFast(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD) -{ - FSE_decode_t const DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; - U32 const nbBits = DInfo.nbBits; - BYTE const symbol = DInfo.symbol; - size_t const lowBits = BIT_readBitsFast(bitD, nbBits); - - DStatePtr->state = DInfo.newState + lowBits; - return symbol; -} - -MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr) -{ - return DStatePtr->state == 0; -} - - - -#ifndef FSE_COMMONDEFS_ONLY - -/* ************************************************************** -* Tuning parameters -****************************************************************/ -/*!MEMORY_USAGE : -* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) -* Increasing memory usage improves compression ratio -* Reduced memory usage can improve speed, due to cache effect -* Recommended max value is 14, for 16KB, which nicely fits into Intel x86 L1 cache */ -#ifndef FSE_MAX_MEMORY_USAGE -# define FSE_MAX_MEMORY_USAGE 14 -#endif -#ifndef FSE_DEFAULT_MEMORY_USAGE -# define FSE_DEFAULT_MEMORY_USAGE 13 -#endif - -/*!FSE_MAX_SYMBOL_VALUE : -* Maximum symbol value authorized. -* Required for proper stack allocation */ -#ifndef FSE_MAX_SYMBOL_VALUE -# define FSE_MAX_SYMBOL_VALUE 255 -#endif - -/* ************************************************************** -* template functions type & suffix -****************************************************************/ -#define FSE_FUNCTION_TYPE BYTE -#define FSE_FUNCTION_EXTENSION -#define FSE_DECODE_TYPE FSE_decode_t - - -#endif /* !FSE_COMMONDEFS_ONLY */ - - -/* *************************************************************** -* Constants -*****************************************************************/ -#define FSE_MAX_TABLELOG (FSE_MAX_MEMORY_USAGE-2) -#define FSE_MAX_TABLESIZE (1U< FSE_TABLELOG_ABSOLUTE_MAX -# error "FSE_MAX_TABLELOG > FSE_TABLELOG_ABSOLUTE_MAX is not supported" -#endif - -#define FSE_TABLESTEP(tableSize) ((tableSize>>1) + (tableSize>>3) + 3) - - -#endif /* FSE_STATIC_LINKING_ONLY */ - - -#if defined (__cplusplus) -} -#endif diff --git a/vendor/github.com/DataDog/zstd/fse_compress.c b/vendor/github.com/DataDog/zstd/fse_compress.c deleted file mode 100644 index 68b47e10..00000000 --- a/vendor/github.com/DataDog/zstd/fse_compress.c +++ /dev/null @@ -1,721 +0,0 @@ -/* ****************************************************************** - FSE : Finite State Entropy encoder - Copyright (C) 2013-present, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ - -/* ************************************************************** -* Includes -****************************************************************/ -#include /* malloc, free, qsort */ -#include /* memcpy, memset */ -#include "compiler.h" -#include "mem.h" /* U32, U16, etc. */ -#include "debug.h" /* assert, DEBUGLOG */ -#include "hist.h" /* HIST_count_wksp */ -#include "bitstream.h" -#define FSE_STATIC_LINKING_ONLY -#include "fse.h" -#include "error_private.h" - - -/* ************************************************************** -* Error Management -****************************************************************/ -#define FSE_isError ERR_isError - - -/* ************************************************************** -* Templates -****************************************************************/ -/* - designed to be included - for type-specific functions (template emulation in C) - Objective is to write these functions only once, for improved maintenance -*/ - -/* safety checks */ -#ifndef FSE_FUNCTION_EXTENSION -# error "FSE_FUNCTION_EXTENSION must be defined" -#endif -#ifndef FSE_FUNCTION_TYPE -# error "FSE_FUNCTION_TYPE must be defined" -#endif - -/* Function names */ -#define FSE_CAT(X,Y) X##Y -#define FSE_FUNCTION_NAME(X,Y) FSE_CAT(X,Y) -#define FSE_TYPE_NAME(X,Y) FSE_CAT(X,Y) - - -/* Function templates */ - -/* FSE_buildCTable_wksp() : - * Same as FSE_buildCTable(), but using an externally allocated scratch buffer (`workSpace`). - * wkspSize should be sized to handle worst case situation, which is `1<>1 : 1) ; - FSE_symbolCompressionTransform* const symbolTT = (FSE_symbolCompressionTransform*) (FSCT); - U32 const step = FSE_TABLESTEP(tableSize); - U32 cumul[FSE_MAX_SYMBOL_VALUE+2]; - - FSE_FUNCTION_TYPE* const tableSymbol = (FSE_FUNCTION_TYPE*)workSpace; - U32 highThreshold = tableSize-1; - - /* CTable header */ - if (((size_t)1 << tableLog) * sizeof(FSE_FUNCTION_TYPE) > wkspSize) return ERROR(tableLog_tooLarge); - tableU16[-2] = (U16) tableLog; - tableU16[-1] = (U16) maxSymbolValue; - assert(tableLog < 16); /* required for threshold strategy to work */ - - /* For explanations on how to distribute symbol values over the table : - * http://fastcompression.blogspot.fr/2014/02/fse-distributing-symbol-values.html */ - - #ifdef __clang_analyzer__ - memset(tableSymbol, 0, sizeof(*tableSymbol) * tableSize); /* useless initialization, just to keep scan-build happy */ - #endif - - /* symbol start positions */ - { U32 u; - cumul[0] = 0; - for (u=1; u <= maxSymbolValue+1; u++) { - if (normalizedCounter[u-1]==-1) { /* Low proba symbol */ - cumul[u] = cumul[u-1] + 1; - tableSymbol[highThreshold--] = (FSE_FUNCTION_TYPE)(u-1); - } else { - cumul[u] = cumul[u-1] + normalizedCounter[u-1]; - } } - cumul[maxSymbolValue+1] = tableSize+1; - } - - /* Spread symbols */ - { U32 position = 0; - U32 symbol; - for (symbol=0; symbol<=maxSymbolValue; symbol++) { - int nbOccurrences; - int const freq = normalizedCounter[symbol]; - for (nbOccurrences=0; nbOccurrences highThreshold) - position = (position + step) & tableMask; /* Low proba area */ - } } - - assert(position==0); /* Must have initialized all positions */ - } - - /* Build table */ - { U32 u; for (u=0; u> 3) + 3; - return maxSymbolValue ? maxHeaderSize : FSE_NCOUNTBOUND; /* maxSymbolValue==0 ? use default */ -} - -static size_t -FSE_writeNCount_generic (void* header, size_t headerBufferSize, - const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, - unsigned writeIsSafe) -{ - BYTE* const ostart = (BYTE*) header; - BYTE* out = ostart; - BYTE* const oend = ostart + headerBufferSize; - int nbBits; - const int tableSize = 1 << tableLog; - int remaining; - int threshold; - U32 bitStream = 0; - int bitCount = 0; - unsigned symbol = 0; - unsigned const alphabetSize = maxSymbolValue + 1; - int previousIs0 = 0; - - /* Table Size */ - bitStream += (tableLog-FSE_MIN_TABLELOG) << bitCount; - bitCount += 4; - - /* Init */ - remaining = tableSize+1; /* +1 for extra accuracy */ - threshold = tableSize; - nbBits = tableLog+1; - - while ((symbol < alphabetSize) && (remaining>1)) { /* stops at 1 */ - if (previousIs0) { - unsigned start = symbol; - while ((symbol < alphabetSize) && !normalizedCounter[symbol]) symbol++; - if (symbol == alphabetSize) break; /* incorrect distribution */ - while (symbol >= start+24) { - start+=24; - bitStream += 0xFFFFU << bitCount; - if ((!writeIsSafe) && (out > oend-2)) - return ERROR(dstSize_tooSmall); /* Buffer overflow */ - out[0] = (BYTE) bitStream; - out[1] = (BYTE)(bitStream>>8); - out+=2; - bitStream>>=16; - } - while (symbol >= start+3) { - start+=3; - bitStream += 3 << bitCount; - bitCount += 2; - } - bitStream += (symbol-start) << bitCount; - bitCount += 2; - if (bitCount>16) { - if ((!writeIsSafe) && (out > oend - 2)) - return ERROR(dstSize_tooSmall); /* Buffer overflow */ - out[0] = (BYTE)bitStream; - out[1] = (BYTE)(bitStream>>8); - out += 2; - bitStream >>= 16; - bitCount -= 16; - } } - { int count = normalizedCounter[symbol++]; - int const max = (2*threshold-1) - remaining; - remaining -= count < 0 ? -count : count; - count++; /* +1 for extra accuracy */ - if (count>=threshold) - count += max; /* [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ */ - bitStream += count << bitCount; - bitCount += nbBits; - bitCount -= (count>=1; } - } - if (bitCount>16) { - if ((!writeIsSafe) && (out > oend - 2)) - return ERROR(dstSize_tooSmall); /* Buffer overflow */ - out[0] = (BYTE)bitStream; - out[1] = (BYTE)(bitStream>>8); - out += 2; - bitStream >>= 16; - bitCount -= 16; - } } - - if (remaining != 1) - return ERROR(GENERIC); /* incorrect normalized distribution */ - assert(symbol <= alphabetSize); - - /* flush remaining bitStream */ - if ((!writeIsSafe) && (out > oend - 2)) - return ERROR(dstSize_tooSmall); /* Buffer overflow */ - out[0] = (BYTE)bitStream; - out[1] = (BYTE)(bitStream>>8); - out+= (bitCount+7) /8; - - return (out-ostart); -} - - -size_t FSE_writeNCount (void* buffer, size_t bufferSize, - const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog) -{ - if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge); /* Unsupported */ - if (tableLog < FSE_MIN_TABLELOG) return ERROR(GENERIC); /* Unsupported */ - - if (bufferSize < FSE_NCountWriteBound(maxSymbolValue, tableLog)) - return FSE_writeNCount_generic(buffer, bufferSize, normalizedCounter, maxSymbolValue, tableLog, 0); - - return FSE_writeNCount_generic(buffer, bufferSize, normalizedCounter, maxSymbolValue, tableLog, 1 /* write in buffer is safe */); -} - - -/*-************************************************************** -* FSE Compression Code -****************************************************************/ - -FSE_CTable* FSE_createCTable (unsigned maxSymbolValue, unsigned tableLog) -{ - size_t size; - if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX; - size = FSE_CTABLE_SIZE_U32 (tableLog, maxSymbolValue) * sizeof(U32); - return (FSE_CTable*)malloc(size); -} - -void FSE_freeCTable (FSE_CTable* ct) { free(ct); } - -/* provides the minimum logSize to safely represent a distribution */ -static unsigned FSE_minTableLog(size_t srcSize, unsigned maxSymbolValue) -{ - U32 minBitsSrc = BIT_highbit32((U32)(srcSize)) + 1; - U32 minBitsSymbols = BIT_highbit32(maxSymbolValue) + 2; - U32 minBits = minBitsSrc < minBitsSymbols ? minBitsSrc : minBitsSymbols; - assert(srcSize > 1); /* Not supported, RLE should be used instead */ - return minBits; -} - -unsigned FSE_optimalTableLog_internal(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue, unsigned minus) -{ - U32 maxBitsSrc = BIT_highbit32((U32)(srcSize - 1)) - minus; - U32 tableLog = maxTableLog; - U32 minBits = FSE_minTableLog(srcSize, maxSymbolValue); - assert(srcSize > 1); /* Not supported, RLE should be used instead */ - if (tableLog==0) tableLog = FSE_DEFAULT_TABLELOG; - if (maxBitsSrc < tableLog) tableLog = maxBitsSrc; /* Accuracy can be reduced */ - if (minBits > tableLog) tableLog = minBits; /* Need a minimum to safely represent all symbol values */ - if (tableLog < FSE_MIN_TABLELOG) tableLog = FSE_MIN_TABLELOG; - if (tableLog > FSE_MAX_TABLELOG) tableLog = FSE_MAX_TABLELOG; - return tableLog; -} - -unsigned FSE_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue) -{ - return FSE_optimalTableLog_internal(maxTableLog, srcSize, maxSymbolValue, 2); -} - - -/* Secondary normalization method. - To be used when primary method fails. */ - -static size_t FSE_normalizeM2(short* norm, U32 tableLog, const unsigned* count, size_t total, U32 maxSymbolValue) -{ - short const NOT_YET_ASSIGNED = -2; - U32 s; - U32 distributed = 0; - U32 ToDistribute; - - /* Init */ - U32 const lowThreshold = (U32)(total >> tableLog); - U32 lowOne = (U32)((total * 3) >> (tableLog + 1)); - - for (s=0; s<=maxSymbolValue; s++) { - if (count[s] == 0) { - norm[s]=0; - continue; - } - if (count[s] <= lowThreshold) { - norm[s] = -1; - distributed++; - total -= count[s]; - continue; - } - if (count[s] <= lowOne) { - norm[s] = 1; - distributed++; - total -= count[s]; - continue; - } - - norm[s]=NOT_YET_ASSIGNED; - } - ToDistribute = (1 << tableLog) - distributed; - - if (ToDistribute == 0) - return 0; - - if ((total / ToDistribute) > lowOne) { - /* risk of rounding to zero */ - lowOne = (U32)((total * 3) / (ToDistribute * 2)); - for (s=0; s<=maxSymbolValue; s++) { - if ((norm[s] == NOT_YET_ASSIGNED) && (count[s] <= lowOne)) { - norm[s] = 1; - distributed++; - total -= count[s]; - continue; - } } - ToDistribute = (1 << tableLog) - distributed; - } - - if (distributed == maxSymbolValue+1) { - /* all values are pretty poor; - probably incompressible data (should have already been detected); - find max, then give all remaining points to max */ - U32 maxV = 0, maxC = 0; - for (s=0; s<=maxSymbolValue; s++) - if (count[s] > maxC) { maxV=s; maxC=count[s]; } - norm[maxV] += (short)ToDistribute; - return 0; - } - - if (total == 0) { - /* all of the symbols were low enough for the lowOne or lowThreshold */ - for (s=0; ToDistribute > 0; s = (s+1)%(maxSymbolValue+1)) - if (norm[s] > 0) { ToDistribute--; norm[s]++; } - return 0; - } - - { U64 const vStepLog = 62 - tableLog; - U64 const mid = (1ULL << (vStepLog-1)) - 1; - U64 const rStep = ((((U64)1<> vStepLog); - U32 const sEnd = (U32)(end >> vStepLog); - U32 const weight = sEnd - sStart; - if (weight < 1) - return ERROR(GENERIC); - norm[s] = (short)weight; - tmpTotal = end; - } } } - - return 0; -} - - -size_t FSE_normalizeCount (short* normalizedCounter, unsigned tableLog, - const unsigned* count, size_t total, - unsigned maxSymbolValue) -{ - /* Sanity checks */ - if (tableLog==0) tableLog = FSE_DEFAULT_TABLELOG; - if (tableLog < FSE_MIN_TABLELOG) return ERROR(GENERIC); /* Unsupported size */ - if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge); /* Unsupported size */ - if (tableLog < FSE_minTableLog(total, maxSymbolValue)) return ERROR(GENERIC); /* Too small tableLog, compression potentially impossible */ - - { static U32 const rtbTable[] = { 0, 473195, 504333, 520860, 550000, 700000, 750000, 830000 }; - U64 const scale = 62 - tableLog; - U64 const step = ((U64)1<<62) / total; /* <== here, one division ! */ - U64 const vStep = 1ULL<<(scale-20); - int stillToDistribute = 1<> tableLog); - - for (s=0; s<=maxSymbolValue; s++) { - if (count[s] == total) return 0; /* rle special case */ - if (count[s] == 0) { normalizedCounter[s]=0; continue; } - if (count[s] <= lowThreshold) { - normalizedCounter[s] = -1; - stillToDistribute--; - } else { - short proba = (short)((count[s]*step) >> scale); - if (proba<8) { - U64 restToBeat = vStep * rtbTable[proba]; - proba += (count[s]*step) - ((U64)proba< restToBeat; - } - if (proba > largestP) { largestP=proba; largest=s; } - normalizedCounter[s] = proba; - stillToDistribute -= proba; - } } - if (-stillToDistribute >= (normalizedCounter[largest] >> 1)) { - /* corner case, need another normalization method */ - size_t const errorCode = FSE_normalizeM2(normalizedCounter, tableLog, count, total, maxSymbolValue); - if (FSE_isError(errorCode)) return errorCode; - } - else normalizedCounter[largest] += (short)stillToDistribute; - } - -#if 0 - { /* Print Table (debug) */ - U32 s; - U32 nTotal = 0; - for (s=0; s<=maxSymbolValue; s++) - RAWLOG(2, "%3i: %4i \n", s, normalizedCounter[s]); - for (s=0; s<=maxSymbolValue; s++) - nTotal += abs(normalizedCounter[s]); - if (nTotal != (1U<>1); /* assumption : tableLog >= 1 */ - FSE_symbolCompressionTransform* const symbolTT = (FSE_symbolCompressionTransform*) (FSCT); - unsigned s; - - /* Sanity checks */ - if (nbBits < 1) return ERROR(GENERIC); /* min size */ - - /* header */ - tableU16[-2] = (U16) nbBits; - tableU16[-1] = (U16) maxSymbolValue; - - /* Build table */ - for (s=0; s FSE_MAX_TABLELOG*4+7 ) && (srcSize & 2)) { /* test bit 2 */ - FSE_encodeSymbol(&bitC, &CState2, *--ip); - FSE_encodeSymbol(&bitC, &CState1, *--ip); - FSE_FLUSHBITS(&bitC); - } - - /* 2 or 4 encoding per loop */ - while ( ip>istart ) { - - FSE_encodeSymbol(&bitC, &CState2, *--ip); - - if (sizeof(bitC.bitContainer)*8 < FSE_MAX_TABLELOG*2+7 ) /* this test must be static */ - FSE_FLUSHBITS(&bitC); - - FSE_encodeSymbol(&bitC, &CState1, *--ip); - - if (sizeof(bitC.bitContainer)*8 > FSE_MAX_TABLELOG*4+7 ) { /* this test must be static */ - FSE_encodeSymbol(&bitC, &CState2, *--ip); - FSE_encodeSymbol(&bitC, &CState1, *--ip); - } - - FSE_FLUSHBITS(&bitC); - } - - FSE_flushCState(&bitC, &CState2); - FSE_flushCState(&bitC, &CState1); - return BIT_closeCStream(&bitC); -} - -size_t FSE_compress_usingCTable (void* dst, size_t dstSize, - const void* src, size_t srcSize, - const FSE_CTable* ct) -{ - unsigned const fast = (dstSize >= FSE_BLOCKBOUND(srcSize)); - - if (fast) - return FSE_compress_usingCTable_generic(dst, dstSize, src, srcSize, ct, 1); - else - return FSE_compress_usingCTable_generic(dst, dstSize, src, srcSize, ct, 0); -} - - -size_t FSE_compressBound(size_t size) { return FSE_COMPRESSBOUND(size); } - -#define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e -#define CHECK_F(f) { CHECK_V_F(_var_err__, f); } - -/* FSE_compress_wksp() : - * Same as FSE_compress2(), but using an externally allocated scratch buffer (`workSpace`). - * `wkspSize` size must be `(1< not compressible */ - if (maxCount < (srcSize >> 7)) return 0; /* Heuristic : not compressible enough */ - } - - tableLog = FSE_optimalTableLog(tableLog, srcSize, maxSymbolValue); - CHECK_F( FSE_normalizeCount(norm, tableLog, count, srcSize, maxSymbolValue) ); - - /* Write table description header */ - { CHECK_V_F(nc_err, FSE_writeNCount(op, oend-op, norm, maxSymbolValue, tableLog) ); - op += nc_err; - } - - /* Compress */ - CHECK_F( FSE_buildCTable_wksp(CTable, norm, maxSymbolValue, tableLog, scratchBuffer, scratchBufferSize) ); - { CHECK_V_F(cSize, FSE_compress_usingCTable(op, oend - op, src, srcSize, CTable) ); - if (cSize == 0) return 0; /* not enough space for compressed data */ - op += cSize; - } - - /* check compressibility */ - if ( (size_t)(op-ostart) >= srcSize-1 ) return 0; - - return op-ostart; -} - -typedef struct { - FSE_CTable CTable_max[FSE_CTABLE_SIZE_U32(FSE_MAX_TABLELOG, FSE_MAX_SYMBOL_VALUE)]; - BYTE scratchBuffer[1 << FSE_MAX_TABLELOG]; -} fseWkspMax_t; - -size_t FSE_compress2 (void* dst, size_t dstCapacity, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog) -{ - fseWkspMax_t scratchBuffer; - DEBUG_STATIC_ASSERT(sizeof(scratchBuffer) >= FSE_WKSP_SIZE_U32(FSE_MAX_TABLELOG, FSE_MAX_SYMBOL_VALUE)); /* compilation failures here means scratchBuffer is not large enough */ - if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge); - return FSE_compress_wksp(dst, dstCapacity, src, srcSize, maxSymbolValue, tableLog, &scratchBuffer, sizeof(scratchBuffer)); -} - -size_t FSE_compress (void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - return FSE_compress2(dst, dstCapacity, src, srcSize, FSE_MAX_SYMBOL_VALUE, FSE_DEFAULT_TABLELOG); -} - - -#endif /* FSE_COMMONDEFS_ONLY */ diff --git a/vendor/github.com/DataDog/zstd/fse_decompress.c b/vendor/github.com/DataDog/zstd/fse_decompress.c deleted file mode 100644 index 4f073789..00000000 --- a/vendor/github.com/DataDog/zstd/fse_decompress.c +++ /dev/null @@ -1,311 +0,0 @@ -/* ****************************************************************** - FSE : Finite State Entropy decoder - Copyright (C) 2013-2015, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ - - -/* ************************************************************** -* Includes -****************************************************************/ -#include /* malloc, free, qsort */ -#include /* memcpy, memset */ -#include "bitstream.h" -#include "compiler.h" -#define FSE_STATIC_LINKING_ONLY -#include "fse.h" -#include "error_private.h" - - -/* ************************************************************** -* Error Management -****************************************************************/ -#define FSE_isError ERR_isError -#define FSE_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c) /* use only *after* variable declarations */ - -/* check and forward error code */ -#ifndef CHECK_F -#define CHECK_F(f) { size_t const e = f; if (FSE_isError(e)) return e; } -#endif - - -/* ************************************************************** -* Templates -****************************************************************/ -/* - designed to be included - for type-specific functions (template emulation in C) - Objective is to write these functions only once, for improved maintenance -*/ - -/* safety checks */ -#ifndef FSE_FUNCTION_EXTENSION -# error "FSE_FUNCTION_EXTENSION must be defined" -#endif -#ifndef FSE_FUNCTION_TYPE -# error "FSE_FUNCTION_TYPE must be defined" -#endif - -/* Function names */ -#define FSE_CAT(X,Y) X##Y -#define FSE_FUNCTION_NAME(X,Y) FSE_CAT(X,Y) -#define FSE_TYPE_NAME(X,Y) FSE_CAT(X,Y) - - -/* Function templates */ -FSE_DTable* FSE_createDTable (unsigned tableLog) -{ - if (tableLog > FSE_TABLELOG_ABSOLUTE_MAX) tableLog = FSE_TABLELOG_ABSOLUTE_MAX; - return (FSE_DTable*)malloc( FSE_DTABLE_SIZE_U32(tableLog) * sizeof (U32) ); -} - -void FSE_freeDTable (FSE_DTable* dt) -{ - free(dt); -} - -size_t FSE_buildDTable(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog) -{ - void* const tdPtr = dt+1; /* because *dt is unsigned, 32-bits aligned on 32-bits */ - FSE_DECODE_TYPE* const tableDecode = (FSE_DECODE_TYPE*) (tdPtr); - U16 symbolNext[FSE_MAX_SYMBOL_VALUE+1]; - - U32 const maxSV1 = maxSymbolValue + 1; - U32 const tableSize = 1 << tableLog; - U32 highThreshold = tableSize-1; - - /* Sanity Checks */ - if (maxSymbolValue > FSE_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge); - if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge); - - /* Init, lay down lowprob symbols */ - { FSE_DTableHeader DTableH; - DTableH.tableLog = (U16)tableLog; - DTableH.fastMode = 1; - { S16 const largeLimit= (S16)(1 << (tableLog-1)); - U32 s; - for (s=0; s= largeLimit) DTableH.fastMode=0; - symbolNext[s] = normalizedCounter[s]; - } } } - memcpy(dt, &DTableH, sizeof(DTableH)); - } - - /* Spread symbols */ - { U32 const tableMask = tableSize-1; - U32 const step = FSE_TABLESTEP(tableSize); - U32 s, position = 0; - for (s=0; s highThreshold) position = (position + step) & tableMask; /* lowprob area */ - } } - if (position!=0) return ERROR(GENERIC); /* position must reach all cells once, otherwise normalizedCounter is incorrect */ - } - - /* Build Decoding table */ - { U32 u; - for (u=0; utableLog = 0; - DTableH->fastMode = 0; - - cell->newState = 0; - cell->symbol = symbolValue; - cell->nbBits = 0; - - return 0; -} - - -size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits) -{ - void* ptr = dt; - FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr; - void* dPtr = dt + 1; - FSE_decode_t* const dinfo = (FSE_decode_t*)dPtr; - const unsigned tableSize = 1 << nbBits; - const unsigned tableMask = tableSize - 1; - const unsigned maxSV1 = tableMask+1; - unsigned s; - - /* Sanity checks */ - if (nbBits < 1) return ERROR(GENERIC); /* min size */ - - /* Build Decoding Table */ - DTableH->tableLog = (U16)nbBits; - DTableH->fastMode = 1; - for (s=0; s sizeof(bitD.bitContainer)*8) /* This test must be static */ - BIT_reloadDStream(&bitD); - - op[1] = FSE_GETSYMBOL(&state2); - - if (FSE_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */ - { if (BIT_reloadDStream(&bitD) > BIT_DStream_unfinished) { op+=2; break; } } - - op[2] = FSE_GETSYMBOL(&state1); - - if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */ - BIT_reloadDStream(&bitD); - - op[3] = FSE_GETSYMBOL(&state2); - } - - /* tail */ - /* note : BIT_reloadDStream(&bitD) >= FSE_DStream_partiallyFilled; Ends at exactly BIT_DStream_completed */ - while (1) { - if (op>(omax-2)) return ERROR(dstSize_tooSmall); - *op++ = FSE_GETSYMBOL(&state1); - if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) { - *op++ = FSE_GETSYMBOL(&state2); - break; - } - - if (op>(omax-2)) return ERROR(dstSize_tooSmall); - *op++ = FSE_GETSYMBOL(&state2); - if (BIT_reloadDStream(&bitD)==BIT_DStream_overflow) { - *op++ = FSE_GETSYMBOL(&state1); - break; - } } - - return op-ostart; -} - - -size_t FSE_decompress_usingDTable(void* dst, size_t originalSize, - const void* cSrc, size_t cSrcSize, - const FSE_DTable* dt) -{ - const void* ptr = dt; - const FSE_DTableHeader* DTableH = (const FSE_DTableHeader*)ptr; - const U32 fastMode = DTableH->fastMode; - - /* select fast mode (static) */ - if (fastMode) return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1); - return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0); -} - - -size_t FSE_decompress_wksp(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize, FSE_DTable* workSpace, unsigned maxLog) -{ - const BYTE* const istart = (const BYTE*)cSrc; - const BYTE* ip = istart; - short counting[FSE_MAX_SYMBOL_VALUE+1]; - unsigned tableLog; - unsigned maxSymbolValue = FSE_MAX_SYMBOL_VALUE; - - /* normal FSE decoding mode */ - size_t const NCountLength = FSE_readNCount (counting, &maxSymbolValue, &tableLog, istart, cSrcSize); - if (FSE_isError(NCountLength)) return NCountLength; - //if (NCountLength >= cSrcSize) return ERROR(srcSize_wrong); /* too small input size; supposed to be already checked in NCountLength, only remaining case : NCountLength==cSrcSize */ - if (tableLog > maxLog) return ERROR(tableLog_tooLarge); - ip += NCountLength; - cSrcSize -= NCountLength; - - CHECK_F( FSE_buildDTable (workSpace, counting, maxSymbolValue, tableLog) ); - - return FSE_decompress_usingDTable (dst, dstCapacity, ip, cSrcSize, workSpace); /* always return, even if it is an error code */ -} - - -typedef FSE_DTable DTable_max_t[FSE_DTABLE_SIZE_U32(FSE_MAX_TABLELOG)]; - -size_t FSE_decompress(void* dst, size_t dstCapacity, const void* cSrc, size_t cSrcSize) -{ - DTable_max_t dt; /* Static analyzer seems unable to understand this table will be properly initialized later */ - return FSE_decompress_wksp(dst, dstCapacity, cSrc, cSrcSize, dt, FSE_MAX_TABLELOG); -} - - - -#endif /* FSE_COMMONDEFS_ONLY */ diff --git a/vendor/github.com/DataDog/zstd/hist.c b/vendor/github.com/DataDog/zstd/hist.c deleted file mode 100644 index 45b7babc..00000000 --- a/vendor/github.com/DataDog/zstd/hist.c +++ /dev/null @@ -1,203 +0,0 @@ -/* ****************************************************************** - hist : Histogram functions - part of Finite State Entropy project - Copyright (C) 2013-present, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ - -/* --- dependencies --- */ -#include "mem.h" /* U32, BYTE, etc. */ -#include "debug.h" /* assert, DEBUGLOG */ -#include "error_private.h" /* ERROR */ -#include "hist.h" - - -/* --- Error management --- */ -unsigned HIST_isError(size_t code) { return ERR_isError(code); } - -/*-************************************************************** - * Histogram functions - ****************************************************************/ -unsigned HIST_count_simple(unsigned* count, unsigned* maxSymbolValuePtr, - const void* src, size_t srcSize) -{ - const BYTE* ip = (const BYTE*)src; - const BYTE* const end = ip + srcSize; - unsigned maxSymbolValue = *maxSymbolValuePtr; - unsigned largestCount=0; - - memset(count, 0, (maxSymbolValue+1) * sizeof(*count)); - if (srcSize==0) { *maxSymbolValuePtr = 0; return 0; } - - while (ip largestCount) largestCount = count[s]; - } - - return largestCount; -} - -typedef enum { trustInput, checkMaxSymbolValue } HIST_checkInput_e; - -/* HIST_count_parallel_wksp() : - * store histogram into 4 intermediate tables, recombined at the end. - * this design makes better use of OoO cpus, - * and is noticeably faster when some values are heavily repeated. - * But it needs some additional workspace for intermediate tables. - * `workSpace` size must be a table of size >= HIST_WKSP_SIZE_U32. - * @return : largest histogram frequency, - * or an error code (notably when histogram would be larger than *maxSymbolValuePtr). */ -static size_t HIST_count_parallel_wksp( - unsigned* count, unsigned* maxSymbolValuePtr, - const void* source, size_t sourceSize, - HIST_checkInput_e check, - U32* const workSpace) -{ - const BYTE* ip = (const BYTE*)source; - const BYTE* const iend = ip+sourceSize; - unsigned maxSymbolValue = *maxSymbolValuePtr; - unsigned max=0; - U32* const Counting1 = workSpace; - U32* const Counting2 = Counting1 + 256; - U32* const Counting3 = Counting2 + 256; - U32* const Counting4 = Counting3 + 256; - - memset(workSpace, 0, 4*256*sizeof(unsigned)); - - /* safety checks */ - if (!sourceSize) { - memset(count, 0, maxSymbolValue + 1); - *maxSymbolValuePtr = 0; - return 0; - } - if (!maxSymbolValue) maxSymbolValue = 255; /* 0 == default */ - - /* by stripes of 16 bytes */ - { U32 cached = MEM_read32(ip); ip += 4; - while (ip < iend-15) { - U32 c = cached; cached = MEM_read32(ip); ip += 4; - Counting1[(BYTE) c ]++; - Counting2[(BYTE)(c>>8) ]++; - Counting3[(BYTE)(c>>16)]++; - Counting4[ c>>24 ]++; - c = cached; cached = MEM_read32(ip); ip += 4; - Counting1[(BYTE) c ]++; - Counting2[(BYTE)(c>>8) ]++; - Counting3[(BYTE)(c>>16)]++; - Counting4[ c>>24 ]++; - c = cached; cached = MEM_read32(ip); ip += 4; - Counting1[(BYTE) c ]++; - Counting2[(BYTE)(c>>8) ]++; - Counting3[(BYTE)(c>>16)]++; - Counting4[ c>>24 ]++; - c = cached; cached = MEM_read32(ip); ip += 4; - Counting1[(BYTE) c ]++; - Counting2[(BYTE)(c>>8) ]++; - Counting3[(BYTE)(c>>16)]++; - Counting4[ c>>24 ]++; - } - ip-=4; - } - - /* finish last symbols */ - while (ipmaxSymbolValue; s--) { - Counting1[s] += Counting2[s] + Counting3[s] + Counting4[s]; - if (Counting1[s]) return ERROR(maxSymbolValue_tooSmall); - } } - - { U32 s; - if (maxSymbolValue > 255) maxSymbolValue = 255; - for (s=0; s<=maxSymbolValue; s++) { - count[s] = Counting1[s] + Counting2[s] + Counting3[s] + Counting4[s]; - if (count[s] > max) max = count[s]; - } } - - while (!count[maxSymbolValue]) maxSymbolValue--; - *maxSymbolValuePtr = maxSymbolValue; - return (size_t)max; -} - -/* HIST_countFast_wksp() : - * Same as HIST_countFast(), but using an externally provided scratch buffer. - * `workSpace` is a writable buffer which must be 4-bytes aligned, - * `workSpaceSize` must be >= HIST_WKSP_SIZE - */ -size_t HIST_countFast_wksp(unsigned* count, unsigned* maxSymbolValuePtr, - const void* source, size_t sourceSize, - void* workSpace, size_t workSpaceSize) -{ - if (sourceSize < 1500) /* heuristic threshold */ - return HIST_count_simple(count, maxSymbolValuePtr, source, sourceSize); - if ((size_t)workSpace & 3) return ERROR(GENERIC); /* must be aligned on 4-bytes boundaries */ - if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall); - return HIST_count_parallel_wksp(count, maxSymbolValuePtr, source, sourceSize, trustInput, (U32*)workSpace); -} - -/* fast variant (unsafe : won't check if src contains values beyond count[] limit) */ -size_t HIST_countFast(unsigned* count, unsigned* maxSymbolValuePtr, - const void* source, size_t sourceSize) -{ - unsigned tmpCounters[HIST_WKSP_SIZE_U32]; - return HIST_countFast_wksp(count, maxSymbolValuePtr, source, sourceSize, tmpCounters, sizeof(tmpCounters)); -} - -/* HIST_count_wksp() : - * Same as HIST_count(), but using an externally provided scratch buffer. - * `workSpace` size must be table of >= HIST_WKSP_SIZE_U32 unsigned */ -size_t HIST_count_wksp(unsigned* count, unsigned* maxSymbolValuePtr, - const void* source, size_t sourceSize, - void* workSpace, size_t workSpaceSize) -{ - if ((size_t)workSpace & 3) return ERROR(GENERIC); /* must be aligned on 4-bytes boundaries */ - if (workSpaceSize < HIST_WKSP_SIZE) return ERROR(workSpace_tooSmall); - if (*maxSymbolValuePtr < 255) - return HIST_count_parallel_wksp(count, maxSymbolValuePtr, source, sourceSize, checkMaxSymbolValue, (U32*)workSpace); - *maxSymbolValuePtr = 255; - return HIST_countFast_wksp(count, maxSymbolValuePtr, source, sourceSize, workSpace, workSpaceSize); -} - -size_t HIST_count(unsigned* count, unsigned* maxSymbolValuePtr, - const void* src, size_t srcSize) -{ - unsigned tmpCounters[HIST_WKSP_SIZE_U32]; - return HIST_count_wksp(count, maxSymbolValuePtr, src, srcSize, tmpCounters, sizeof(tmpCounters)); -} diff --git a/vendor/github.com/DataDog/zstd/hist.h b/vendor/github.com/DataDog/zstd/hist.h deleted file mode 100644 index 8b389358..00000000 --- a/vendor/github.com/DataDog/zstd/hist.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ****************************************************************** - hist : Histogram functions - part of Finite State Entropy project - Copyright (C) 2013-present, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ - -/* --- dependencies --- */ -#include /* size_t */ - - -/* --- simple histogram functions --- */ - -/*! HIST_count(): - * Provides the precise count of each byte within a table 'count'. - * 'count' is a table of unsigned int, of minimum size (*maxSymbolValuePtr+1). - * Updates *maxSymbolValuePtr with actual largest symbol value detected. - * @return : count of the most frequent symbol (which isn't identified). - * or an error code, which can be tested using HIST_isError(). - * note : if return == srcSize, there is only one symbol. - */ -size_t HIST_count(unsigned* count, unsigned* maxSymbolValuePtr, - const void* src, size_t srcSize); - -unsigned HIST_isError(size_t code); /**< tells if a return value is an error code */ - - -/* --- advanced histogram functions --- */ - -#define HIST_WKSP_SIZE_U32 1024 -#define HIST_WKSP_SIZE (HIST_WKSP_SIZE_U32 * sizeof(unsigned)) -/** HIST_count_wksp() : - * Same as HIST_count(), but using an externally provided scratch buffer. - * Benefit is this function will use very little stack space. - * `workSpace` is a writable buffer which must be 4-bytes aligned, - * `workSpaceSize` must be >= HIST_WKSP_SIZE - */ -size_t HIST_count_wksp(unsigned* count, unsigned* maxSymbolValuePtr, - const void* src, size_t srcSize, - void* workSpace, size_t workSpaceSize); - -/** HIST_countFast() : - * same as HIST_count(), but blindly trusts that all byte values within src are <= *maxSymbolValuePtr. - * This function is unsafe, and will segfault if any value within `src` is `> *maxSymbolValuePtr` - */ -size_t HIST_countFast(unsigned* count, unsigned* maxSymbolValuePtr, - const void* src, size_t srcSize); - -/** HIST_countFast_wksp() : - * Same as HIST_countFast(), but using an externally provided scratch buffer. - * `workSpace` is a writable buffer which must be 4-bytes aligned, - * `workSpaceSize` must be >= HIST_WKSP_SIZE - */ -size_t HIST_countFast_wksp(unsigned* count, unsigned* maxSymbolValuePtr, - const void* src, size_t srcSize, - void* workSpace, size_t workSpaceSize); - -/*! HIST_count_simple() : - * Same as HIST_countFast(), this function is unsafe, - * and will segfault if any value within `src` is `> *maxSymbolValuePtr`. - * It is also a bit slower for large inputs. - * However, it does not need any additional memory (not even on stack). - * @return : count of the most frequent symbol. - * Note this function doesn't produce any error (i.e. it must succeed). - */ -unsigned HIST_count_simple(unsigned* count, unsigned* maxSymbolValuePtr, - const void* src, size_t srcSize); diff --git a/vendor/github.com/DataDog/zstd/huf.h b/vendor/github.com/DataDog/zstd/huf.h deleted file mode 100644 index 6b572c44..00000000 --- a/vendor/github.com/DataDog/zstd/huf.h +++ /dev/null @@ -1,358 +0,0 @@ -/* ****************************************************************** - huff0 huffman codec, - part of Finite State Entropy library - Copyright (C) 2013-present, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - Source repository : https://github.com/Cyan4973/FiniteStateEntropy -****************************************************************** */ - -#if defined (__cplusplus) -extern "C" { -#endif - -#ifndef HUF_H_298734234 -#define HUF_H_298734234 - -/* *** Dependencies *** */ -#include /* size_t */ - - -/* *** library symbols visibility *** */ -/* Note : when linking with -fvisibility=hidden on gcc, or by default on Visual, - * HUF symbols remain "private" (internal symbols for library only). - * Set macro FSE_DLL_EXPORT to 1 if you want HUF symbols visible on DLL interface */ -#if defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) && defined(__GNUC__) && (__GNUC__ >= 4) -# define HUF_PUBLIC_API __attribute__ ((visibility ("default"))) -#elif defined(FSE_DLL_EXPORT) && (FSE_DLL_EXPORT==1) /* Visual expected */ -# define HUF_PUBLIC_API __declspec(dllexport) -#elif defined(FSE_DLL_IMPORT) && (FSE_DLL_IMPORT==1) -# define HUF_PUBLIC_API __declspec(dllimport) /* not required, just to generate faster code (saves a function pointer load from IAT and an indirect jump) */ -#else -# define HUF_PUBLIC_API -#endif - - -/* ========================== */ -/* *** simple functions *** */ -/* ========================== */ - -/** HUF_compress() : - * Compress content from buffer 'src', of size 'srcSize', into buffer 'dst'. - * 'dst' buffer must be already allocated. - * Compression runs faster if `dstCapacity` >= HUF_compressBound(srcSize). - * `srcSize` must be <= `HUF_BLOCKSIZE_MAX` == 128 KB. - * @return : size of compressed data (<= `dstCapacity`). - * Special values : if return == 0, srcData is not compressible => Nothing is stored within dst !!! - * if HUF_isError(return), compression failed (more details using HUF_getErrorName()) - */ -HUF_PUBLIC_API size_t HUF_compress(void* dst, size_t dstCapacity, - const void* src, size_t srcSize); - -/** HUF_decompress() : - * Decompress HUF data from buffer 'cSrc', of size 'cSrcSize', - * into already allocated buffer 'dst', of minimum size 'dstSize'. - * `originalSize` : **must** be the ***exact*** size of original (uncompressed) data. - * Note : in contrast with FSE, HUF_decompress can regenerate - * RLE (cSrcSize==1) and uncompressed (cSrcSize==dstSize) data, - * because it knows size to regenerate (originalSize). - * @return : size of regenerated data (== originalSize), - * or an error code, which can be tested using HUF_isError() - */ -HUF_PUBLIC_API size_t HUF_decompress(void* dst, size_t originalSize, - const void* cSrc, size_t cSrcSize); - - -/* *** Tool functions *** */ -#define HUF_BLOCKSIZE_MAX (128 * 1024) /**< maximum input size for a single block compressed with HUF_compress */ -HUF_PUBLIC_API size_t HUF_compressBound(size_t size); /**< maximum compressed size (worst case) */ - -/* Error Management */ -HUF_PUBLIC_API unsigned HUF_isError(size_t code); /**< tells if a return value is an error code */ -HUF_PUBLIC_API const char* HUF_getErrorName(size_t code); /**< provides error code string (useful for debugging) */ - - -/* *** Advanced function *** */ - -/** HUF_compress2() : - * Same as HUF_compress(), but offers control over `maxSymbolValue` and `tableLog`. - * `maxSymbolValue` must be <= HUF_SYMBOLVALUE_MAX . - * `tableLog` must be `<= HUF_TABLELOG_MAX` . */ -HUF_PUBLIC_API size_t HUF_compress2 (void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned tableLog); - -/** HUF_compress4X_wksp() : - * Same as HUF_compress2(), but uses externally allocated `workSpace`. - * `workspace` must have minimum alignment of 4, and be at least as large as HUF_WORKSPACE_SIZE */ -#define HUF_WORKSPACE_SIZE (6 << 10) -#define HUF_WORKSPACE_SIZE_U32 (HUF_WORKSPACE_SIZE / sizeof(U32)) -HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned tableLog, - void* workSpace, size_t wkspSize); - -#endif /* HUF_H_298734234 */ - -/* ****************************************************************** - * WARNING !! - * The following section contains advanced and experimental definitions - * which shall never be used in the context of a dynamic library, - * because they are not guaranteed to remain stable in the future. - * Only consider them in association with static linking. - * *****************************************************************/ -#if defined(HUF_STATIC_LINKING_ONLY) && !defined(HUF_H_HUF_STATIC_LINKING_ONLY) -#define HUF_H_HUF_STATIC_LINKING_ONLY - -/* *** Dependencies *** */ -#include "mem.h" /* U32 */ - - -/* *** Constants *** */ -#define HUF_TABLELOG_MAX 12 /* max runtime value of tableLog (due to static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */ -#define HUF_TABLELOG_DEFAULT 11 /* default tableLog value when none specified */ -#define HUF_SYMBOLVALUE_MAX 255 - -#define HUF_TABLELOG_ABSOLUTEMAX 15 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */ -#if (HUF_TABLELOG_MAX > HUF_TABLELOG_ABSOLUTEMAX) -# error "HUF_TABLELOG_MAX is too large !" -#endif - - -/* **************************************** -* Static allocation -******************************************/ -/* HUF buffer bounds */ -#define HUF_CTABLEBOUND 129 -#define HUF_BLOCKBOUND(size) (size + (size>>8) + 8) /* only true when incompressible is pre-filtered with fast heuristic */ -#define HUF_COMPRESSBOUND(size) (HUF_CTABLEBOUND + HUF_BLOCKBOUND(size)) /* Macro version, useful for static allocation */ - -/* static allocation of HUF's Compression Table */ -#define HUF_CTABLE_SIZE_U32(maxSymbolValue) ((maxSymbolValue)+1) /* Use tables of U32, for proper alignment */ -#define HUF_CTABLE_SIZE(maxSymbolValue) (HUF_CTABLE_SIZE_U32(maxSymbolValue) * sizeof(U32)) -#define HUF_CREATE_STATIC_CTABLE(name, maxSymbolValue) \ - U32 name##hb[HUF_CTABLE_SIZE_U32(maxSymbolValue)]; \ - void* name##hv = &(name##hb); \ - HUF_CElt* name = (HUF_CElt*)(name##hv) /* no final ; */ - -/* static allocation of HUF's DTable */ -typedef U32 HUF_DTable; -#define HUF_DTABLE_SIZE(maxTableLog) (1 + (1<<(maxTableLog))) -#define HUF_CREATE_STATIC_DTABLEX1(DTable, maxTableLog) \ - HUF_DTable DTable[HUF_DTABLE_SIZE((maxTableLog)-1)] = { ((U32)((maxTableLog)-1) * 0x01000001) } -#define HUF_CREATE_STATIC_DTABLEX2(DTable, maxTableLog) \ - HUF_DTable DTable[HUF_DTABLE_SIZE(maxTableLog)] = { ((U32)(maxTableLog) * 0x01000001) } - - -/* **************************************** -* Advanced decompression functions -******************************************/ -size_t HUF_decompress4X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */ -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress4X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */ -#endif - -size_t HUF_decompress4X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< decodes RLE and uncompressed */ -size_t HUF_decompress4X_hufOnly(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< considers RLE and uncompressed as errors */ -size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< considers RLE and uncompressed as errors */ -size_t HUF_decompress4X1_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */ -size_t HUF_decompress4X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< single-symbol decoder */ -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress4X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */ -size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< double-symbols decoder */ -#endif - - -/* **************************************** - * HUF detailed API - * ****************************************/ - -/*! HUF_compress() does the following: - * 1. count symbol occurrence from source[] into table count[] using FSE_count() (exposed within "fse.h") - * 2. (optional) refine tableLog using HUF_optimalTableLog() - * 3. build Huffman table from count using HUF_buildCTable() - * 4. save Huffman table to memory buffer using HUF_writeCTable() - * 5. encode the data stream using HUF_compress4X_usingCTable() - * - * The following API allows targeting specific sub-functions for advanced tasks. - * For example, it's possible to compress several blocks using the same 'CTable', - * or to save and regenerate 'CTable' using external methods. - */ -unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue); -typedef struct HUF_CElt_s HUF_CElt; /* incomplete type */ -size_t HUF_buildCTable (HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue, unsigned maxNbBits); /* @return : maxNbBits; CTable and count can overlap. In which case, CTable will overwrite count content */ -size_t HUF_writeCTable (void* dst, size_t maxDstSize, const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog); -size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable); - -typedef enum { - HUF_repeat_none, /**< Cannot use the previous table */ - HUF_repeat_check, /**< Can use the previous table but it must be checked. Note : The previous table must have been constructed by HUF_compress{1, 4}X_repeat */ - HUF_repeat_valid /**< Can use the previous table and it is assumed to be valid */ - } HUF_repeat; -/** HUF_compress4X_repeat() : - * Same as HUF_compress4X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none. - * If it uses hufTable it does not modify hufTable or repeat. - * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used. - * If preferRepeat then the old table will always be used if valid. */ -size_t HUF_compress4X_repeat(void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned tableLog, - void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */ - HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2); - -/** HUF_buildCTable_wksp() : - * Same as HUF_buildCTable(), but using externally allocated scratch buffer. - * `workSpace` must be aligned on 4-bytes boundaries, and its size must be >= HUF_CTABLE_WORKSPACE_SIZE. - */ -#define HUF_CTABLE_WORKSPACE_SIZE_U32 (2*HUF_SYMBOLVALUE_MAX +1 +1) -#define HUF_CTABLE_WORKSPACE_SIZE (HUF_CTABLE_WORKSPACE_SIZE_U32 * sizeof(unsigned)) -size_t HUF_buildCTable_wksp (HUF_CElt* tree, - const unsigned* count, U32 maxSymbolValue, U32 maxNbBits, - void* workSpace, size_t wkspSize); - -/*! HUF_readStats() : - * Read compact Huffman tree, saved by HUF_writeCTable(). - * `huffWeight` is destination buffer. - * @return : size read from `src` , or an error Code . - * Note : Needed by HUF_readCTable() and HUF_readDTableXn() . */ -size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, - U32* rankStats, U32* nbSymbolsPtr, U32* tableLogPtr, - const void* src, size_t srcSize); - -/** HUF_readCTable() : - * Loading a CTable saved with HUF_writeCTable() */ -size_t HUF_readCTable (HUF_CElt* CTable, unsigned* maxSymbolValuePtr, const void* src, size_t srcSize); - -/** HUF_getNbBits() : - * Read nbBits from CTable symbolTable, for symbol `symbolValue` presumed <= HUF_SYMBOLVALUE_MAX - * Note 1 : is not inlined, as HUF_CElt definition is private - * Note 2 : const void* used, so that it can provide a statically allocated table as argument (which uses type U32) */ -U32 HUF_getNbBits(const void* symbolTable, U32 symbolValue); - -/* - * HUF_decompress() does the following: - * 1. select the decompression algorithm (X1, X2) based on pre-computed heuristics - * 2. build Huffman table from save, using HUF_readDTableX?() - * 3. decode 1 or 4 segments in parallel using HUF_decompress?X?_usingDTable() - */ - -/** HUF_selectDecoder() : - * Tells which decoder is likely to decode faster, - * based on a set of pre-computed metrics. - * @return : 0==HUF_decompress4X1, 1==HUF_decompress4X2 . - * Assumption : 0 < dstSize <= 128 KB */ -U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize); - -/** - * The minimum workspace size for the `workSpace` used in - * HUF_readDTableX1_wksp() and HUF_readDTableX2_wksp(). - * - * The space used depends on HUF_TABLELOG_MAX, ranging from ~1500 bytes when - * HUF_TABLE_LOG_MAX=12 to ~1850 bytes when HUF_TABLE_LOG_MAX=15. - * Buffer overflow errors may potentially occur if code modifications result in - * a required workspace size greater than that specified in the following - * macro. - */ -#define HUF_DECOMPRESS_WORKSPACE_SIZE (2 << 10) -#define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32)) - -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_readDTableX1 (HUF_DTable* DTable, const void* src, size_t srcSize); -size_t HUF_readDTableX1_wksp (HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize); -#endif -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_readDTableX2 (HUF_DTable* DTable, const void* src, size_t srcSize); -size_t HUF_readDTableX2_wksp (HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize); -#endif - -size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress4X1_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#endif -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress4X2_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#endif - - -/* ====================== */ -/* single stream variants */ -/* ====================== */ - -size_t HUF_compress1X (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog); -size_t HUF_compress1X_wksp (void* dst, size_t dstSize, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize); /**< `workSpace` must be a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */ -size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable); -/** HUF_compress1X_repeat() : - * Same as HUF_compress1X_wksp(), but considers using hufTable if *repeat != HUF_repeat_none. - * If it uses hufTable it does not modify hufTable or repeat. - * If it doesn't, it sets *repeat = HUF_repeat_none, and it sets hufTable to the table used. - * If preferRepeat then the old table will always be used if valid. */ -size_t HUF_compress1X_repeat(void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned tableLog, - void* workSpace, size_t wkspSize, /**< `workSpace` must be aligned on 4-bytes boundaries, `wkspSize` must be >= HUF_WORKSPACE_SIZE */ - HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2); - -size_t HUF_decompress1X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* single-symbol decoder */ -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress1X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /* double-symbol decoder */ -#endif - -size_t HUF_decompress1X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); -size_t HUF_decompress1X_DCtx_wksp (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress1X1_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< single-symbol decoder */ -size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< single-symbol decoder */ -#endif -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress1X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); /**< double-symbols decoder */ -size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize); /**< double-symbols decoder */ -#endif - -size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); /**< automatic selection of sing or double symbol decoder, based on DTable */ -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress1X1_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#endif -#ifndef HUF_FORCE_DECOMPRESS_X1 -size_t HUF_decompress1X2_usingDTable(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable); -#endif - -/* BMI2 variants. - * If the CPU has BMI2 support, pass bmi2=1, otherwise pass bmi2=0. - */ -size_t HUF_decompress1X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2); -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress1X1_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2); -#endif -size_t HUF_decompress4X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2); -size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2); - -#endif /* HUF_STATIC_LINKING_ONLY */ - -#if defined (__cplusplus) -} -#endif diff --git a/vendor/github.com/DataDog/zstd/huf_compress.c b/vendor/github.com/DataDog/zstd/huf_compress.c deleted file mode 100644 index f074f1e0..00000000 --- a/vendor/github.com/DataDog/zstd/huf_compress.c +++ /dev/null @@ -1,798 +0,0 @@ -/* ****************************************************************** - Huffman encoder, part of New Generation Entropy library - Copyright (C) 2013-2016, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ - -/* ************************************************************** -* Compiler specifics -****************************************************************/ -#ifdef _MSC_VER /* Visual Studio */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -#endif - - -/* ************************************************************** -* Includes -****************************************************************/ -#include /* memcpy, memset */ -#include /* printf (debug) */ -#include "compiler.h" -#include "bitstream.h" -#include "hist.h" -#define FSE_STATIC_LINKING_ONLY /* FSE_optimalTableLog_internal */ -#include "fse.h" /* header compression */ -#define HUF_STATIC_LINKING_ONLY -#include "huf.h" -#include "error_private.h" - - -/* ************************************************************** -* Error Management -****************************************************************/ -#define HUF_isError ERR_isError -#define HUF_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c) /* use only *after* variable declarations */ -#define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e -#define CHECK_F(f) { CHECK_V_F(_var_err__, f); } - - -/* ************************************************************** -* Utils -****************************************************************/ -unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxSymbolValue) -{ - return FSE_optimalTableLog_internal(maxTableLog, srcSize, maxSymbolValue, 1); -} - - -/* ******************************************************* -* HUF : Huffman block compression -*********************************************************/ -/* HUF_compressWeights() : - * Same as FSE_compress(), but dedicated to huff0's weights compression. - * The use case needs much less stack memory. - * Note : all elements within weightTable are supposed to be <= HUF_TABLELOG_MAX. - */ -#define MAX_FSE_TABLELOG_FOR_HUFF_HEADER 6 -static size_t HUF_compressWeights (void* dst, size_t dstSize, const void* weightTable, size_t wtSize) -{ - BYTE* const ostart = (BYTE*) dst; - BYTE* op = ostart; - BYTE* const oend = ostart + dstSize; - - unsigned maxSymbolValue = HUF_TABLELOG_MAX; - U32 tableLog = MAX_FSE_TABLELOG_FOR_HUFF_HEADER; - - FSE_CTable CTable[FSE_CTABLE_SIZE_U32(MAX_FSE_TABLELOG_FOR_HUFF_HEADER, HUF_TABLELOG_MAX)]; - BYTE scratchBuffer[1< not compressible */ - } - - tableLog = FSE_optimalTableLog(tableLog, wtSize, maxSymbolValue); - CHECK_F( FSE_normalizeCount(norm, tableLog, count, wtSize, maxSymbolValue) ); - - /* Write table description header */ - { CHECK_V_F(hSize, FSE_writeNCount(op, oend-op, norm, maxSymbolValue, tableLog) ); - op += hSize; - } - - /* Compress */ - CHECK_F( FSE_buildCTable_wksp(CTable, norm, maxSymbolValue, tableLog, scratchBuffer, sizeof(scratchBuffer)) ); - { CHECK_V_F(cSize, FSE_compress_usingCTable(op, oend - op, weightTable, wtSize, CTable) ); - if (cSize == 0) return 0; /* not enough space for compressed data */ - op += cSize; - } - - return op-ostart; -} - - -struct HUF_CElt_s { - U16 val; - BYTE nbBits; -}; /* typedef'd to HUF_CElt within "huf.h" */ - -/*! HUF_writeCTable() : - `CTable` : Huffman tree to save, using huf representation. - @return : size of saved CTable */ -size_t HUF_writeCTable (void* dst, size_t maxDstSize, - const HUF_CElt* CTable, unsigned maxSymbolValue, unsigned huffLog) -{ - BYTE bitsToWeight[HUF_TABLELOG_MAX + 1]; /* precomputed conversion table */ - BYTE huffWeight[HUF_SYMBOLVALUE_MAX]; - BYTE* op = (BYTE*)dst; - U32 n; - - /* check conditions */ - if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge); - - /* convert to weight */ - bitsToWeight[0] = 0; - for (n=1; n1) & (hSize < maxSymbolValue/2)) { /* FSE compressed */ - op[0] = (BYTE)hSize; - return hSize+1; - } } - - /* write raw values as 4-bits (max : 15) */ - if (maxSymbolValue > (256-128)) return ERROR(GENERIC); /* should not happen : likely means source cannot be compressed */ - if (((maxSymbolValue+1)/2) + 1 > maxDstSize) return ERROR(dstSize_tooSmall); /* not enough space within dst buffer */ - op[0] = (BYTE)(128 /*special case*/ + (maxSymbolValue-1)); - huffWeight[maxSymbolValue] = 0; /* to be sure it doesn't cause msan issue in final combination */ - for (n=0; n HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge); - if (nbSymbols > *maxSymbolValuePtr+1) return ERROR(maxSymbolValue_tooSmall); - - /* Prepare base value per rank */ - { U32 n, nextRankStart = 0; - for (n=1; n<=tableLog; n++) { - U32 current = nextRankStart; - nextRankStart += (rankVal[n] << (n-1)); - rankVal[n] = current; - } } - - /* fill nbBits */ - { U32 n; for (n=0; nn=tableLog+1 */ - U16 valPerRank[HUF_TABLELOG_MAX+2] = {0}; - { U32 n; for (n=0; n0; n--) { /* start at n=tablelog <-> w=1 */ - valPerRank[n] = min; /* get starting value within each rank */ - min += nbPerRank[n]; - min >>= 1; - } } - /* assign value within rank, symbol order */ - { U32 n; for (n=0; n maxNbBits */ - - /* there are several too large elements (at least >= 2) */ - { int totalCost = 0; - const U32 baseCost = 1 << (largestBits - maxNbBits); - U32 n = lastNonNull; - - while (huffNode[n].nbBits > maxNbBits) { - totalCost += baseCost - (1 << (largestBits - huffNode[n].nbBits)); - huffNode[n].nbBits = (BYTE)maxNbBits; - n --; - } /* n stops at huffNode[n].nbBits <= maxNbBits */ - while (huffNode[n].nbBits == maxNbBits) n--; /* n end at index of smallest symbol using < maxNbBits */ - - /* renorm totalCost */ - totalCost >>= (largestBits - maxNbBits); /* note : totalCost is necessarily a multiple of baseCost */ - - /* repay normalized cost */ - { U32 const noSymbol = 0xF0F0F0F0; - U32 rankLast[HUF_TABLELOG_MAX+2]; - int pos; - - /* Get pos of last (smallest) symbol per rank */ - memset(rankLast, 0xF0, sizeof(rankLast)); - { U32 currentNbBits = maxNbBits; - for (pos=n ; pos >= 0; pos--) { - if (huffNode[pos].nbBits >= currentNbBits) continue; - currentNbBits = huffNode[pos].nbBits; /* < maxNbBits */ - rankLast[maxNbBits-currentNbBits] = pos; - } } - - while (totalCost > 0) { - U32 nBitsToDecrease = BIT_highbit32(totalCost) + 1; - for ( ; nBitsToDecrease > 1; nBitsToDecrease--) { - U32 highPos = rankLast[nBitsToDecrease]; - U32 lowPos = rankLast[nBitsToDecrease-1]; - if (highPos == noSymbol) continue; - if (lowPos == noSymbol) break; - { U32 const highTotal = huffNode[highPos].count; - U32 const lowTotal = 2 * huffNode[lowPos].count; - if (highTotal <= lowTotal) break; - } } - /* only triggered when no more rank 1 symbol left => find closest one (note : there is necessarily at least one !) */ - /* HUF_MAX_TABLELOG test just to please gcc 5+; but it should not be necessary */ - while ((nBitsToDecrease<=HUF_TABLELOG_MAX) && (rankLast[nBitsToDecrease] == noSymbol)) - nBitsToDecrease ++; - totalCost -= 1 << (nBitsToDecrease-1); - if (rankLast[nBitsToDecrease-1] == noSymbol) - rankLast[nBitsToDecrease-1] = rankLast[nBitsToDecrease]; /* this rank is no longer empty */ - huffNode[rankLast[nBitsToDecrease]].nbBits ++; - if (rankLast[nBitsToDecrease] == 0) /* special case, reached largest symbol */ - rankLast[nBitsToDecrease] = noSymbol; - else { - rankLast[nBitsToDecrease]--; - if (huffNode[rankLast[nBitsToDecrease]].nbBits != maxNbBits-nBitsToDecrease) - rankLast[nBitsToDecrease] = noSymbol; /* this rank is now empty */ - } } /* while (totalCost > 0) */ - - while (totalCost < 0) { /* Sometimes, cost correction overshoot */ - if (rankLast[1] == noSymbol) { /* special case : no rank 1 symbol (using maxNbBits-1); let's create one from largest rank 0 (using maxNbBits) */ - while (huffNode[n].nbBits == maxNbBits) n--; - huffNode[n+1].nbBits--; - rankLast[1] = n+1; - totalCost++; - continue; - } - huffNode[ rankLast[1] + 1 ].nbBits--; - rankLast[1]++; - totalCost ++; - } } } /* there are several too large elements (at least >= 2) */ - - return maxNbBits; -} - - -typedef struct { - U32 base; - U32 current; -} rankPos; - -static void HUF_sort(nodeElt* huffNode, const unsigned* count, U32 maxSymbolValue) -{ - rankPos rank[32]; - U32 n; - - memset(rank, 0, sizeof(rank)); - for (n=0; n<=maxSymbolValue; n++) { - U32 r = BIT_highbit32(count[n] + 1); - rank[r].base ++; - } - for (n=30; n>0; n--) rank[n-1].base += rank[n].base; - for (n=0; n<32; n++) rank[n].current = rank[n].base; - for (n=0; n<=maxSymbolValue; n++) { - U32 const c = count[n]; - U32 const r = BIT_highbit32(c+1) + 1; - U32 pos = rank[r].current++; - while ((pos > rank[r].base) && (c > huffNode[pos-1].count)) { - huffNode[pos] = huffNode[pos-1]; - pos--; - } - huffNode[pos].count = c; - huffNode[pos].byte = (BYTE)n; - } -} - - -/** HUF_buildCTable_wksp() : - * Same as HUF_buildCTable(), but using externally allocated scratch buffer. - * `workSpace` must be aligned on 4-bytes boundaries, and be at least as large as a table of HUF_CTABLE_WORKSPACE_SIZE_U32 unsigned. - */ -#define STARTNODE (HUF_SYMBOLVALUE_MAX+1) -typedef nodeElt huffNodeTable[HUF_CTABLE_WORKSPACE_SIZE_U32]; -size_t HUF_buildCTable_wksp (HUF_CElt* tree, const unsigned* count, U32 maxSymbolValue, U32 maxNbBits, void* workSpace, size_t wkspSize) -{ - nodeElt* const huffNode0 = (nodeElt*)workSpace; - nodeElt* const huffNode = huffNode0+1; - U32 n, nonNullRank; - int lowS, lowN; - U16 nodeNb = STARTNODE; - U32 nodeRoot; - - /* safety checks */ - if (((size_t)workSpace & 3) != 0) return ERROR(GENERIC); /* must be aligned on 4-bytes boundaries */ - if (wkspSize < sizeof(huffNodeTable)) return ERROR(workSpace_tooSmall); - if (maxNbBits == 0) maxNbBits = HUF_TABLELOG_DEFAULT; - if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge); - memset(huffNode0, 0, sizeof(huffNodeTable)); - - /* sort, decreasing order */ - HUF_sort(huffNode, count, maxSymbolValue); - - /* init for parents */ - nonNullRank = maxSymbolValue; - while(huffNode[nonNullRank].count == 0) nonNullRank--; - lowS = nonNullRank; nodeRoot = nodeNb + lowS - 1; lowN = nodeNb; - huffNode[nodeNb].count = huffNode[lowS].count + huffNode[lowS-1].count; - huffNode[lowS].parent = huffNode[lowS-1].parent = nodeNb; - nodeNb++; lowS-=2; - for (n=nodeNb; n<=nodeRoot; n++) huffNode[n].count = (U32)(1U<<30); - huffNode0[0].count = (U32)(1U<<31); /* fake entry, strong barrier */ - - /* create parents */ - while (nodeNb <= nodeRoot) { - U32 n1 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++; - U32 n2 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++; - huffNode[nodeNb].count = huffNode[n1].count + huffNode[n2].count; - huffNode[n1].parent = huffNode[n2].parent = nodeNb; - nodeNb++; - } - - /* distribute weights (unlimited tree height) */ - huffNode[nodeRoot].nbBits = 0; - for (n=nodeRoot-1; n>=STARTNODE; n--) - huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1; - for (n=0; n<=nonNullRank; n++) - huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1; - - /* enforce maxTableLog */ - maxNbBits = HUF_setMaxHeight(huffNode, nonNullRank, maxNbBits); - - /* fill result into tree (val, nbBits) */ - { U16 nbPerRank[HUF_TABLELOG_MAX+1] = {0}; - U16 valPerRank[HUF_TABLELOG_MAX+1] = {0}; - if (maxNbBits > HUF_TABLELOG_MAX) return ERROR(GENERIC); /* check fit into table */ - for (n=0; n<=nonNullRank; n++) - nbPerRank[huffNode[n].nbBits]++; - /* determine stating value per rank */ - { U16 min = 0; - for (n=maxNbBits; n>0; n--) { - valPerRank[n] = min; /* get starting value within each rank */ - min += nbPerRank[n]; - min >>= 1; - } } - for (n=0; n<=maxSymbolValue; n++) - tree[huffNode[n].byte].nbBits = huffNode[n].nbBits; /* push nbBits per symbol, symbol order */ - for (n=0; n<=maxSymbolValue; n++) - tree[n].val = valPerRank[tree[n].nbBits]++; /* assign value within rank, symbol order */ - } - - return maxNbBits; -} - -/** HUF_buildCTable() : - * @return : maxNbBits - * Note : count is used before tree is written, so they can safely overlap - */ -size_t HUF_buildCTable (HUF_CElt* tree, const unsigned* count, unsigned maxSymbolValue, unsigned maxNbBits) -{ - huffNodeTable nodeTable; - return HUF_buildCTable_wksp(tree, count, maxSymbolValue, maxNbBits, nodeTable, sizeof(nodeTable)); -} - -static size_t HUF_estimateCompressedSize(HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue) -{ - size_t nbBits = 0; - int s; - for (s = 0; s <= (int)maxSymbolValue; ++s) { - nbBits += CTable[s].nbBits * count[s]; - } - return nbBits >> 3; -} - -static int HUF_validateCTable(const HUF_CElt* CTable, const unsigned* count, unsigned maxSymbolValue) { - int bad = 0; - int s; - for (s = 0; s <= (int)maxSymbolValue; ++s) { - bad |= (count[s] != 0) & (CTable[s].nbBits == 0); - } - return !bad; -} - -size_t HUF_compressBound(size_t size) { return HUF_COMPRESSBOUND(size); } - -FORCE_INLINE_TEMPLATE void -HUF_encodeSymbol(BIT_CStream_t* bitCPtr, U32 symbol, const HUF_CElt* CTable) -{ - BIT_addBitsFast(bitCPtr, CTable[symbol].val, CTable[symbol].nbBits); -} - -#define HUF_FLUSHBITS(s) BIT_flushBits(s) - -#define HUF_FLUSHBITS_1(stream) \ - if (sizeof((stream)->bitContainer)*8 < HUF_TABLELOG_MAX*2+7) HUF_FLUSHBITS(stream) - -#define HUF_FLUSHBITS_2(stream) \ - if (sizeof((stream)->bitContainer)*8 < HUF_TABLELOG_MAX*4+7) HUF_FLUSHBITS(stream) - -FORCE_INLINE_TEMPLATE size_t -HUF_compress1X_usingCTable_internal_body(void* dst, size_t dstSize, - const void* src, size_t srcSize, - const HUF_CElt* CTable) -{ - const BYTE* ip = (const BYTE*) src; - BYTE* const ostart = (BYTE*)dst; - BYTE* const oend = ostart + dstSize; - BYTE* op = ostart; - size_t n; - BIT_CStream_t bitC; - - /* init */ - if (dstSize < 8) return 0; /* not enough space to compress */ - { size_t const initErr = BIT_initCStream(&bitC, op, oend-op); - if (HUF_isError(initErr)) return 0; } - - n = srcSize & ~3; /* join to mod 4 */ - switch (srcSize & 3) - { - case 3 : HUF_encodeSymbol(&bitC, ip[n+ 2], CTable); - HUF_FLUSHBITS_2(&bitC); - /* fall-through */ - case 2 : HUF_encodeSymbol(&bitC, ip[n+ 1], CTable); - HUF_FLUSHBITS_1(&bitC); - /* fall-through */ - case 1 : HUF_encodeSymbol(&bitC, ip[n+ 0], CTable); - HUF_FLUSHBITS(&bitC); - /* fall-through */ - case 0 : /* fall-through */ - default: break; - } - - for (; n>0; n-=4) { /* note : n&3==0 at this stage */ - HUF_encodeSymbol(&bitC, ip[n- 1], CTable); - HUF_FLUSHBITS_1(&bitC); - HUF_encodeSymbol(&bitC, ip[n- 2], CTable); - HUF_FLUSHBITS_2(&bitC); - HUF_encodeSymbol(&bitC, ip[n- 3], CTable); - HUF_FLUSHBITS_1(&bitC); - HUF_encodeSymbol(&bitC, ip[n- 4], CTable); - HUF_FLUSHBITS(&bitC); - } - - return BIT_closeCStream(&bitC); -} - -#if DYNAMIC_BMI2 - -static TARGET_ATTRIBUTE("bmi2") size_t -HUF_compress1X_usingCTable_internal_bmi2(void* dst, size_t dstSize, - const void* src, size_t srcSize, - const HUF_CElt* CTable) -{ - return HUF_compress1X_usingCTable_internal_body(dst, dstSize, src, srcSize, CTable); -} - -static size_t -HUF_compress1X_usingCTable_internal_default(void* dst, size_t dstSize, - const void* src, size_t srcSize, - const HUF_CElt* CTable) -{ - return HUF_compress1X_usingCTable_internal_body(dst, dstSize, src, srcSize, CTable); -} - -static size_t -HUF_compress1X_usingCTable_internal(void* dst, size_t dstSize, - const void* src, size_t srcSize, - const HUF_CElt* CTable, const int bmi2) -{ - if (bmi2) { - return HUF_compress1X_usingCTable_internal_bmi2(dst, dstSize, src, srcSize, CTable); - } - return HUF_compress1X_usingCTable_internal_default(dst, dstSize, src, srcSize, CTable); -} - -#else - -static size_t -HUF_compress1X_usingCTable_internal(void* dst, size_t dstSize, - const void* src, size_t srcSize, - const HUF_CElt* CTable, const int bmi2) -{ - (void)bmi2; - return HUF_compress1X_usingCTable_internal_body(dst, dstSize, src, srcSize, CTable); -} - -#endif - -size_t HUF_compress1X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable) -{ - return HUF_compress1X_usingCTable_internal(dst, dstSize, src, srcSize, CTable, /* bmi2 */ 0); -} - - -static size_t -HUF_compress4X_usingCTable_internal(void* dst, size_t dstSize, - const void* src, size_t srcSize, - const HUF_CElt* CTable, int bmi2) -{ - size_t const segmentSize = (srcSize+3)/4; /* first 3 segments */ - const BYTE* ip = (const BYTE*) src; - const BYTE* const iend = ip + srcSize; - BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; - BYTE* op = ostart; - - if (dstSize < 6 + 1 + 1 + 1 + 8) return 0; /* minimum space to compress successfully */ - if (srcSize < 12) return 0; /* no saving possible : too small input */ - op += 6; /* jumpTable */ - - { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, oend-op, ip, segmentSize, CTable, bmi2) ); - if (cSize==0) return 0; - assert(cSize <= 65535); - MEM_writeLE16(ostart, (U16)cSize); - op += cSize; - } - - ip += segmentSize; - { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, oend-op, ip, segmentSize, CTable, bmi2) ); - if (cSize==0) return 0; - assert(cSize <= 65535); - MEM_writeLE16(ostart+2, (U16)cSize); - op += cSize; - } - - ip += segmentSize; - { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, oend-op, ip, segmentSize, CTable, bmi2) ); - if (cSize==0) return 0; - assert(cSize <= 65535); - MEM_writeLE16(ostart+4, (U16)cSize); - op += cSize; - } - - ip += segmentSize; - { CHECK_V_F(cSize, HUF_compress1X_usingCTable_internal(op, oend-op, ip, iend-ip, CTable, bmi2) ); - if (cSize==0) return 0; - op += cSize; - } - - return op-ostart; -} - -size_t HUF_compress4X_usingCTable(void* dst, size_t dstSize, const void* src, size_t srcSize, const HUF_CElt* CTable) -{ - return HUF_compress4X_usingCTable_internal(dst, dstSize, src, srcSize, CTable, /* bmi2 */ 0); -} - -typedef enum { HUF_singleStream, HUF_fourStreams } HUF_nbStreams_e; - -static size_t HUF_compressCTable_internal( - BYTE* const ostart, BYTE* op, BYTE* const oend, - const void* src, size_t srcSize, - HUF_nbStreams_e nbStreams, const HUF_CElt* CTable, const int bmi2) -{ - size_t const cSize = (nbStreams==HUF_singleStream) ? - HUF_compress1X_usingCTable_internal(op, oend - op, src, srcSize, CTable, bmi2) : - HUF_compress4X_usingCTable_internal(op, oend - op, src, srcSize, CTable, bmi2); - if (HUF_isError(cSize)) { return cSize; } - if (cSize==0) { return 0; } /* uncompressible */ - op += cSize; - /* check compressibility */ - if ((size_t)(op-ostart) >= srcSize-1) { return 0; } - return op-ostart; -} - -typedef struct { - unsigned count[HUF_SYMBOLVALUE_MAX + 1]; - HUF_CElt CTable[HUF_SYMBOLVALUE_MAX + 1]; - huffNodeTable nodeTable; -} HUF_compress_tables_t; - -/* HUF_compress_internal() : - * `workSpace` must a table of at least HUF_WORKSPACE_SIZE_U32 unsigned */ -static size_t -HUF_compress_internal (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog, - HUF_nbStreams_e nbStreams, - void* workSpace, size_t wkspSize, - HUF_CElt* oldHufTable, HUF_repeat* repeat, int preferRepeat, - const int bmi2) -{ - HUF_compress_tables_t* const table = (HUF_compress_tables_t*)workSpace; - BYTE* const ostart = (BYTE*)dst; - BYTE* const oend = ostart + dstSize; - BYTE* op = ostart; - - /* checks & inits */ - if (((size_t)workSpace & 3) != 0) return ERROR(GENERIC); /* must be aligned on 4-bytes boundaries */ - if (wkspSize < HUF_WORKSPACE_SIZE) return ERROR(workSpace_tooSmall); - if (!srcSize) return 0; /* Uncompressed */ - if (!dstSize) return 0; /* cannot fit anything within dst budget */ - if (srcSize > HUF_BLOCKSIZE_MAX) return ERROR(srcSize_wrong); /* current block size limit */ - if (huffLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge); - if (maxSymbolValue > HUF_SYMBOLVALUE_MAX) return ERROR(maxSymbolValue_tooLarge); - if (!maxSymbolValue) maxSymbolValue = HUF_SYMBOLVALUE_MAX; - if (!huffLog) huffLog = HUF_TABLELOG_DEFAULT; - - /* Heuristic : If old table is valid, use it for small inputs */ - if (preferRepeat && repeat && *repeat == HUF_repeat_valid) { - return HUF_compressCTable_internal(ostart, op, oend, - src, srcSize, - nbStreams, oldHufTable, bmi2); - } - - /* Scan input and build symbol stats */ - { CHECK_V_F(largest, HIST_count_wksp (table->count, &maxSymbolValue, (const BYTE*)src, srcSize, workSpace, wkspSize) ); - if (largest == srcSize) { *ostart = ((const BYTE*)src)[0]; return 1; } /* single symbol, rle */ - if (largest <= (srcSize >> 7)+4) return 0; /* heuristic : probably not compressible enough */ - } - - /* Check validity of previous table */ - if ( repeat - && *repeat == HUF_repeat_check - && !HUF_validateCTable(oldHufTable, table->count, maxSymbolValue)) { - *repeat = HUF_repeat_none; - } - /* Heuristic : use existing table for small inputs */ - if (preferRepeat && repeat && *repeat != HUF_repeat_none) { - return HUF_compressCTable_internal(ostart, op, oend, - src, srcSize, - nbStreams, oldHufTable, bmi2); - } - - /* Build Huffman Tree */ - huffLog = HUF_optimalTableLog(huffLog, srcSize, maxSymbolValue); - { size_t const maxBits = HUF_buildCTable_wksp(table->CTable, table->count, - maxSymbolValue, huffLog, - table->nodeTable, sizeof(table->nodeTable)); - CHECK_F(maxBits); - huffLog = (U32)maxBits; - /* Zero unused symbols in CTable, so we can check it for validity */ - memset(table->CTable + (maxSymbolValue + 1), 0, - sizeof(table->CTable) - ((maxSymbolValue + 1) * sizeof(HUF_CElt))); - } - - /* Write table description header */ - { CHECK_V_F(hSize, HUF_writeCTable (op, dstSize, table->CTable, maxSymbolValue, huffLog) ); - /* Check if using previous huffman table is beneficial */ - if (repeat && *repeat != HUF_repeat_none) { - size_t const oldSize = HUF_estimateCompressedSize(oldHufTable, table->count, maxSymbolValue); - size_t const newSize = HUF_estimateCompressedSize(table->CTable, table->count, maxSymbolValue); - if (oldSize <= hSize + newSize || hSize + 12 >= srcSize) { - return HUF_compressCTable_internal(ostart, op, oend, - src, srcSize, - nbStreams, oldHufTable, bmi2); - } } - - /* Use the new huffman table */ - if (hSize + 12ul >= srcSize) { return 0; } - op += hSize; - if (repeat) { *repeat = HUF_repeat_none; } - if (oldHufTable) - memcpy(oldHufTable, table->CTable, sizeof(table->CTable)); /* Save new table */ - } - return HUF_compressCTable_internal(ostart, op, oend, - src, srcSize, - nbStreams, table->CTable, bmi2); -} - - -size_t HUF_compress1X_wksp (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog, - void* workSpace, size_t wkspSize) -{ - return HUF_compress_internal(dst, dstSize, src, srcSize, - maxSymbolValue, huffLog, HUF_singleStream, - workSpace, wkspSize, - NULL, NULL, 0, 0 /*bmi2*/); -} - -size_t HUF_compress1X_repeat (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog, - void* workSpace, size_t wkspSize, - HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2) -{ - return HUF_compress_internal(dst, dstSize, src, srcSize, - maxSymbolValue, huffLog, HUF_singleStream, - workSpace, wkspSize, hufTable, - repeat, preferRepeat, bmi2); -} - -size_t HUF_compress1X (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog) -{ - unsigned workSpace[HUF_WORKSPACE_SIZE_U32]; - return HUF_compress1X_wksp(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, workSpace, sizeof(workSpace)); -} - -/* HUF_compress4X_repeat(): - * compress input using 4 streams. - * provide workspace to generate compression tables */ -size_t HUF_compress4X_wksp (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog, - void* workSpace, size_t wkspSize) -{ - return HUF_compress_internal(dst, dstSize, src, srcSize, - maxSymbolValue, huffLog, HUF_fourStreams, - workSpace, wkspSize, - NULL, NULL, 0, 0 /*bmi2*/); -} - -/* HUF_compress4X_repeat(): - * compress input using 4 streams. - * re-use an existing huffman compression table */ -size_t HUF_compress4X_repeat (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog, - void* workSpace, size_t wkspSize, - HUF_CElt* hufTable, HUF_repeat* repeat, int preferRepeat, int bmi2) -{ - return HUF_compress_internal(dst, dstSize, src, srcSize, - maxSymbolValue, huffLog, HUF_fourStreams, - workSpace, wkspSize, - hufTable, repeat, preferRepeat, bmi2); -} - -size_t HUF_compress2 (void* dst, size_t dstSize, - const void* src, size_t srcSize, - unsigned maxSymbolValue, unsigned huffLog) -{ - unsigned workSpace[HUF_WORKSPACE_SIZE_U32]; - return HUF_compress4X_wksp(dst, dstSize, src, srcSize, maxSymbolValue, huffLog, workSpace, sizeof(workSpace)); -} - -size_t HUF_compress (void* dst, size_t maxDstSize, const void* src, size_t srcSize) -{ - return HUF_compress2(dst, maxDstSize, src, srcSize, 255, HUF_TABLELOG_DEFAULT); -} diff --git a/vendor/github.com/DataDog/zstd/huf_decompress.c b/vendor/github.com/DataDog/zstd/huf_decompress.c deleted file mode 100644 index bb2d0a96..00000000 --- a/vendor/github.com/DataDog/zstd/huf_decompress.c +++ /dev/null @@ -1,1234 +0,0 @@ -/* ****************************************************************** - huff0 huffman decoder, - part of Finite State Entropy library - Copyright (C) 2013-present, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy -****************************************************************** */ - -/* ************************************************************** -* Dependencies -****************************************************************/ -#include /* memcpy, memset */ -#include "compiler.h" -#include "bitstream.h" /* BIT_* */ -#include "fse.h" /* to compress headers */ -#define HUF_STATIC_LINKING_ONLY -#include "huf.h" -#include "error_private.h" - -/* ************************************************************** -* Macros -****************************************************************/ - -/* These two optional macros force the use one way or another of the two - * Huffman decompression implementations. You can't force in both directions - * at the same time. - */ -#if defined(HUF_FORCE_DECOMPRESS_X1) && \ - defined(HUF_FORCE_DECOMPRESS_X2) -#error "Cannot force the use of the X1 and X2 decoders at the same time!" -#endif - - -/* ************************************************************** -* Error Management -****************************************************************/ -#define HUF_isError ERR_isError -#ifndef CHECK_F -#define CHECK_F(f) { size_t const err_ = (f); if (HUF_isError(err_)) return err_; } -#endif - - -/* ************************************************************** -* Byte alignment for workSpace management -****************************************************************/ -#define HUF_ALIGN(x, a) HUF_ALIGN_MASK((x), (a) - 1) -#define HUF_ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) - - -/* ************************************************************** -* BMI2 Variant Wrappers -****************************************************************/ -#if DYNAMIC_BMI2 - -#define HUF_DGEN(fn) \ - \ - static size_t fn##_default( \ - void* dst, size_t dstSize, \ - const void* cSrc, size_t cSrcSize, \ - const HUF_DTable* DTable) \ - { \ - return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \ - } \ - \ - static TARGET_ATTRIBUTE("bmi2") size_t fn##_bmi2( \ - void* dst, size_t dstSize, \ - const void* cSrc, size_t cSrcSize, \ - const HUF_DTable* DTable) \ - { \ - return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \ - } \ - \ - static size_t fn(void* dst, size_t dstSize, void const* cSrc, \ - size_t cSrcSize, HUF_DTable const* DTable, int bmi2) \ - { \ - if (bmi2) { \ - return fn##_bmi2(dst, dstSize, cSrc, cSrcSize, DTable); \ - } \ - return fn##_default(dst, dstSize, cSrc, cSrcSize, DTable); \ - } - -#else - -#define HUF_DGEN(fn) \ - static size_t fn(void* dst, size_t dstSize, void const* cSrc, \ - size_t cSrcSize, HUF_DTable const* DTable, int bmi2) \ - { \ - (void)bmi2; \ - return fn##_body(dst, dstSize, cSrc, cSrcSize, DTable); \ - } - -#endif - - -/*-***************************/ -/* generic DTableDesc */ -/*-***************************/ -typedef struct { BYTE maxTableLog; BYTE tableType; BYTE tableLog; BYTE reserved; } DTableDesc; - -static DTableDesc HUF_getDTableDesc(const HUF_DTable* table) -{ - DTableDesc dtd; - memcpy(&dtd, table, sizeof(dtd)); - return dtd; -} - - -#ifndef HUF_FORCE_DECOMPRESS_X2 - -/*-***************************/ -/* single-symbol decoding */ -/*-***************************/ -typedef struct { BYTE byte; BYTE nbBits; } HUF_DEltX1; /* single-symbol decoding */ - -size_t HUF_readDTableX1_wksp(HUF_DTable* DTable, const void* src, size_t srcSize, void* workSpace, size_t wkspSize) -{ - U32 tableLog = 0; - U32 nbSymbols = 0; - size_t iSize; - void* const dtPtr = DTable + 1; - HUF_DEltX1* const dt = (HUF_DEltX1*)dtPtr; - - U32* rankVal; - BYTE* huffWeight; - size_t spaceUsed32 = 0; - - rankVal = (U32 *)workSpace + spaceUsed32; - spaceUsed32 += HUF_TABLELOG_ABSOLUTEMAX + 1; - huffWeight = (BYTE *)((U32 *)workSpace + spaceUsed32); - spaceUsed32 += HUF_ALIGN(HUF_SYMBOLVALUE_MAX + 1, sizeof(U32)) >> 2; - - if ((spaceUsed32 << 2) > wkspSize) return ERROR(tableLog_tooLarge); - - DEBUG_STATIC_ASSERT(sizeof(DTableDesc) == sizeof(HUF_DTable)); - /* memset(huffWeight, 0, sizeof(huffWeight)); */ /* is not necessary, even though some analyzer complain ... */ - - iSize = HUF_readStats(huffWeight, HUF_SYMBOLVALUE_MAX + 1, rankVal, &nbSymbols, &tableLog, src, srcSize); - if (HUF_isError(iSize)) return iSize; - - /* Table header */ - { DTableDesc dtd = HUF_getDTableDesc(DTable); - if (tableLog > (U32)(dtd.maxTableLog+1)) return ERROR(tableLog_tooLarge); /* DTable too small, Huffman tree cannot fit in */ - dtd.tableType = 0; - dtd.tableLog = (BYTE)tableLog; - memcpy(DTable, &dtd, sizeof(dtd)); - } - - /* Calculate starting value for each rank */ - { U32 n, nextRankStart = 0; - for (n=1; n> 1; - U32 u; - HUF_DEltX1 D; - D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w); - for (u = rankVal[w]; u < rankVal[w] + length; u++) - dt[u] = D; - rankVal[w] += length; - } } - - return iSize; -} - -size_t HUF_readDTableX1(HUF_DTable* DTable, const void* src, size_t srcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_readDTableX1_wksp(DTable, src, srcSize, - workSpace, sizeof(workSpace)); -} - -FORCE_INLINE_TEMPLATE BYTE -HUF_decodeSymbolX1(BIT_DStream_t* Dstream, const HUF_DEltX1* dt, const U32 dtLog) -{ - size_t const val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */ - BYTE const c = dt[val].byte; - BIT_skipBits(Dstream, dt[val].nbBits); - return c; -} - -#define HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) \ - *ptr++ = HUF_decodeSymbolX1(DStreamPtr, dt, dtLog) - -#define HUF_DECODE_SYMBOLX1_1(ptr, DStreamPtr) \ - if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ - HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) - -#define HUF_DECODE_SYMBOLX1_2(ptr, DStreamPtr) \ - if (MEM_64bits()) \ - HUF_DECODE_SYMBOLX1_0(ptr, DStreamPtr) - -HINT_INLINE size_t -HUF_decodeStreamX1(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, const HUF_DEltX1* const dt, const U32 dtLog) -{ - BYTE* const pStart = p; - - /* up to 4 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-3)) { - HUF_DECODE_SYMBOLX1_2(p, bitDPtr); - HUF_DECODE_SYMBOLX1_1(p, bitDPtr); - HUF_DECODE_SYMBOLX1_2(p, bitDPtr); - HUF_DECODE_SYMBOLX1_0(p, bitDPtr); - } - - /* [0-3] symbols remaining */ - if (MEM_32bits()) - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd)) - HUF_DECODE_SYMBOLX1_0(p, bitDPtr); - - /* no more data to retrieve from bitstream, no need to reload */ - while (p < pEnd) - HUF_DECODE_SYMBOLX1_0(p, bitDPtr); - - return pEnd-pStart; -} - -FORCE_INLINE_TEMPLATE size_t -HUF_decompress1X1_usingDTable_internal_body( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - BYTE* op = (BYTE*)dst; - BYTE* const oend = op + dstSize; - const void* dtPtr = DTable + 1; - const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr; - BIT_DStream_t bitD; - DTableDesc const dtd = HUF_getDTableDesc(DTable); - U32 const dtLog = dtd.tableLog; - - CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) ); - - HUF_decodeStreamX1(op, &bitD, oend, dt, dtLog); - - if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected); - - return dstSize; -} - -FORCE_INLINE_TEMPLATE size_t -HUF_decompress4X1_usingDTable_internal_body( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - /* Check */ - if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ - - { const BYTE* const istart = (const BYTE*) cSrc; - BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; - const void* const dtPtr = DTable + 1; - const HUF_DEltX1* const dt = (const HUF_DEltX1*)dtPtr; - - /* Init */ - BIT_DStream_t bitD1; - BIT_DStream_t bitD2; - BIT_DStream_t bitD3; - BIT_DStream_t bitD4; - size_t const length1 = MEM_readLE16(istart); - size_t const length2 = MEM_readLE16(istart+2); - size_t const length3 = MEM_readLE16(istart+4); - size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6); - const BYTE* const istart1 = istart + 6; /* jumpTable */ - const BYTE* const istart2 = istart1 + length1; - const BYTE* const istart3 = istart2 + length2; - const BYTE* const istart4 = istart3 + length3; - const size_t segmentSize = (dstSize+3) / 4; - BYTE* const opStart2 = ostart + segmentSize; - BYTE* const opStart3 = opStart2 + segmentSize; - BYTE* const opStart4 = opStart3 + segmentSize; - BYTE* op1 = ostart; - BYTE* op2 = opStart2; - BYTE* op3 = opStart3; - BYTE* op4 = opStart4; - U32 endSignal = BIT_DStream_unfinished; - DTableDesc const dtd = HUF_getDTableDesc(DTable); - U32 const dtLog = dtd.tableLog; - - if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ - CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); - CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); - CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); - CHECK_F( BIT_initDStream(&bitD4, istart4, length4) ); - - /* up to 16 symbols per loop (4 symbols per stream) in 64-bit mode */ - endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4); - while ( (endSignal==BIT_DStream_unfinished) && (op4<(oend-3)) ) { - HUF_DECODE_SYMBOLX1_2(op1, &bitD1); - HUF_DECODE_SYMBOLX1_2(op2, &bitD2); - HUF_DECODE_SYMBOLX1_2(op3, &bitD3); - HUF_DECODE_SYMBOLX1_2(op4, &bitD4); - HUF_DECODE_SYMBOLX1_1(op1, &bitD1); - HUF_DECODE_SYMBOLX1_1(op2, &bitD2); - HUF_DECODE_SYMBOLX1_1(op3, &bitD3); - HUF_DECODE_SYMBOLX1_1(op4, &bitD4); - HUF_DECODE_SYMBOLX1_2(op1, &bitD1); - HUF_DECODE_SYMBOLX1_2(op2, &bitD2); - HUF_DECODE_SYMBOLX1_2(op3, &bitD3); - HUF_DECODE_SYMBOLX1_2(op4, &bitD4); - HUF_DECODE_SYMBOLX1_0(op1, &bitD1); - HUF_DECODE_SYMBOLX1_0(op2, &bitD2); - HUF_DECODE_SYMBOLX1_0(op3, &bitD3); - HUF_DECODE_SYMBOLX1_0(op4, &bitD4); - BIT_reloadDStream(&bitD1); - BIT_reloadDStream(&bitD2); - BIT_reloadDStream(&bitD3); - BIT_reloadDStream(&bitD4); - } - - /* check corruption */ - /* note : should not be necessary : op# advance in lock step, and we control op4. - * but curiously, binary generated by gcc 7.2 & 7.3 with -mbmi2 runs faster when >=1 test is present */ - if (op1 > opStart2) return ERROR(corruption_detected); - if (op2 > opStart3) return ERROR(corruption_detected); - if (op3 > opStart4) return ERROR(corruption_detected); - /* note : op4 supposed already verified within main loop */ - - /* finish bitStreams one by one */ - HUF_decodeStreamX1(op1, &bitD1, opStart2, dt, dtLog); - HUF_decodeStreamX1(op2, &bitD2, opStart3, dt, dtLog); - HUF_decodeStreamX1(op3, &bitD3, opStart4, dt, dtLog); - HUF_decodeStreamX1(op4, &bitD4, oend, dt, dtLog); - - /* check */ - { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4); - if (!endCheck) return ERROR(corruption_detected); } - - /* decoded size */ - return dstSize; - } -} - - -typedef size_t (*HUF_decompress_usingDTable_t)(void *dst, size_t dstSize, - const void *cSrc, - size_t cSrcSize, - const HUF_DTable *DTable); - -HUF_DGEN(HUF_decompress1X1_usingDTable_internal) -HUF_DGEN(HUF_decompress4X1_usingDTable_internal) - - - -size_t HUF_decompress1X1_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc dtd = HUF_getDTableDesc(DTable); - if (dtd.tableType != 0) return ERROR(GENERIC); - return HUF_decompress1X1_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -} - -size_t HUF_decompress1X1_DCtx_wksp(HUF_DTable* DCtx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t const hSize = HUF_readDTableX1_wksp(DCtx, cSrc, cSrcSize, workSpace, wkspSize); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx, /* bmi2 */ 0); -} - - -size_t HUF_decompress1X1_DCtx(HUF_DTable* DCtx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress1X1_DCtx_wksp(DCtx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} - -size_t HUF_decompress1X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX1(DTable, HUF_TABLELOG_MAX); - return HUF_decompress1X1_DCtx (DTable, dst, dstSize, cSrc, cSrcSize); -} - -size_t HUF_decompress4X1_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc dtd = HUF_getDTableDesc(DTable); - if (dtd.tableType != 0) return ERROR(GENERIC); - return HUF_decompress4X1_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -} - -static size_t HUF_decompress4X1_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize, int bmi2) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t const hSize = HUF_readDTableX1_wksp (dctx, cSrc, cSrcSize, - workSpace, wkspSize); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress4X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, bmi2); -} - -size_t HUF_decompress4X1_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - return HUF_decompress4X1_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, 0); -} - - -size_t HUF_decompress4X1_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} -size_t HUF_decompress4X1 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX1(DTable, HUF_TABLELOG_MAX); - return HUF_decompress4X1_DCtx(DTable, dst, dstSize, cSrc, cSrcSize); -} - -#endif /* HUF_FORCE_DECOMPRESS_X2 */ - - -#ifndef HUF_FORCE_DECOMPRESS_X1 - -/* *************************/ -/* double-symbols decoding */ -/* *************************/ - -typedef struct { U16 sequence; BYTE nbBits; BYTE length; } HUF_DEltX2; /* double-symbols decoding */ -typedef struct { BYTE symbol; BYTE weight; } sortedSymbol_t; -typedef U32 rankValCol_t[HUF_TABLELOG_MAX + 1]; -typedef rankValCol_t rankVal_t[HUF_TABLELOG_MAX]; - - -/* HUF_fillDTableX2Level2() : - * `rankValOrigin` must be a table of at least (HUF_TABLELOG_MAX + 1) U32 */ -static void HUF_fillDTableX2Level2(HUF_DEltX2* DTable, U32 sizeLog, const U32 consumed, - const U32* rankValOrigin, const int minWeight, - const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, - U32 nbBitsBaseline, U16 baseSeq) -{ - HUF_DEltX2 DElt; - U32 rankVal[HUF_TABLELOG_MAX + 1]; - - /* get pre-calculated rankVal */ - memcpy(rankVal, rankValOrigin, sizeof(rankVal)); - - /* fill skipped values */ - if (minWeight>1) { - U32 i, skipSize = rankVal[minWeight]; - MEM_writeLE16(&(DElt.sequence), baseSeq); - DElt.nbBits = (BYTE)(consumed); - DElt.length = 1; - for (i = 0; i < skipSize; i++) - DTable[i] = DElt; - } - - /* fill DTable */ - { U32 s; for (s=0; s= 1 */ - - rankVal[weight] += length; - } } -} - - -static void HUF_fillDTableX2(HUF_DEltX2* DTable, const U32 targetLog, - const sortedSymbol_t* sortedList, const U32 sortedListSize, - const U32* rankStart, rankVal_t rankValOrigin, const U32 maxWeight, - const U32 nbBitsBaseline) -{ - U32 rankVal[HUF_TABLELOG_MAX + 1]; - const int scaleLog = nbBitsBaseline - targetLog; /* note : targetLog >= srcLog, hence scaleLog <= 1 */ - const U32 minBits = nbBitsBaseline - maxWeight; - U32 s; - - memcpy(rankVal, rankValOrigin, sizeof(rankVal)); - - /* fill DTable */ - for (s=0; s= minBits) { /* enough room for a second symbol */ - U32 sortedRank; - int minWeight = nbBits + scaleLog; - if (minWeight < 1) minWeight = 1; - sortedRank = rankStart[minWeight]; - HUF_fillDTableX2Level2(DTable+start, targetLog-nbBits, nbBits, - rankValOrigin[nbBits], minWeight, - sortedList+sortedRank, sortedListSize-sortedRank, - nbBitsBaseline, symbol); - } else { - HUF_DEltX2 DElt; - MEM_writeLE16(&(DElt.sequence), symbol); - DElt.nbBits = (BYTE)(nbBits); - DElt.length = 1; - { U32 const end = start + length; - U32 u; - for (u = start; u < end; u++) DTable[u] = DElt; - } } - rankVal[weight] += length; - } -} - -size_t HUF_readDTableX2_wksp(HUF_DTable* DTable, - const void* src, size_t srcSize, - void* workSpace, size_t wkspSize) -{ - U32 tableLog, maxW, sizeOfSort, nbSymbols; - DTableDesc dtd = HUF_getDTableDesc(DTable); - U32 const maxTableLog = dtd.maxTableLog; - size_t iSize; - void* dtPtr = DTable+1; /* force compiler to avoid strict-aliasing */ - HUF_DEltX2* const dt = (HUF_DEltX2*)dtPtr; - U32 *rankStart; - - rankValCol_t* rankVal; - U32* rankStats; - U32* rankStart0; - sortedSymbol_t* sortedSymbol; - BYTE* weightList; - size_t spaceUsed32 = 0; - - rankVal = (rankValCol_t *)((U32 *)workSpace + spaceUsed32); - spaceUsed32 += (sizeof(rankValCol_t) * HUF_TABLELOG_MAX) >> 2; - rankStats = (U32 *)workSpace + spaceUsed32; - spaceUsed32 += HUF_TABLELOG_MAX + 1; - rankStart0 = (U32 *)workSpace + spaceUsed32; - spaceUsed32 += HUF_TABLELOG_MAX + 2; - sortedSymbol = (sortedSymbol_t *)workSpace + (spaceUsed32 * sizeof(U32)) / sizeof(sortedSymbol_t); - spaceUsed32 += HUF_ALIGN(sizeof(sortedSymbol_t) * (HUF_SYMBOLVALUE_MAX + 1), sizeof(U32)) >> 2; - weightList = (BYTE *)((U32 *)workSpace + spaceUsed32); - spaceUsed32 += HUF_ALIGN(HUF_SYMBOLVALUE_MAX + 1, sizeof(U32)) >> 2; - - if ((spaceUsed32 << 2) > wkspSize) return ERROR(tableLog_tooLarge); - - rankStart = rankStart0 + 1; - memset(rankStats, 0, sizeof(U32) * (2 * HUF_TABLELOG_MAX + 2 + 1)); - - DEBUG_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(HUF_DTable)); /* if compiler fails here, assertion is wrong */ - if (maxTableLog > HUF_TABLELOG_MAX) return ERROR(tableLog_tooLarge); - /* memset(weightList, 0, sizeof(weightList)); */ /* is not necessary, even though some analyzer complain ... */ - - iSize = HUF_readStats(weightList, HUF_SYMBOLVALUE_MAX + 1, rankStats, &nbSymbols, &tableLog, src, srcSize); - if (HUF_isError(iSize)) return iSize; - - /* check result */ - if (tableLog > maxTableLog) return ERROR(tableLog_tooLarge); /* DTable can't fit code depth */ - - /* find maxWeight */ - for (maxW = tableLog; rankStats[maxW]==0; maxW--) {} /* necessarily finds a solution before 0 */ - - /* Get start index of each weight */ - { U32 w, nextRankStart = 0; - for (w=1; w> consumed; - } } } } - - HUF_fillDTableX2(dt, maxTableLog, - sortedSymbol, sizeOfSort, - rankStart0, rankVal, maxW, - tableLog+1); - - dtd.tableLog = (BYTE)maxTableLog; - dtd.tableType = 1; - memcpy(DTable, &dtd, sizeof(dtd)); - return iSize; -} - -size_t HUF_readDTableX2(HUF_DTable* DTable, const void* src, size_t srcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_readDTableX2_wksp(DTable, src, srcSize, - workSpace, sizeof(workSpace)); -} - - -FORCE_INLINE_TEMPLATE U32 -HUF_decodeSymbolX2(void* op, BIT_DStream_t* DStream, const HUF_DEltX2* dt, const U32 dtLog) -{ - size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ - memcpy(op, dt+val, 2); - BIT_skipBits(DStream, dt[val].nbBits); - return dt[val].length; -} - -FORCE_INLINE_TEMPLATE U32 -HUF_decodeLastSymbolX2(void* op, BIT_DStream_t* DStream, const HUF_DEltX2* dt, const U32 dtLog) -{ - size_t const val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ - memcpy(op, dt+val, 1); - if (dt[val].length==1) BIT_skipBits(DStream, dt[val].nbBits); - else { - if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) { - BIT_skipBits(DStream, dt[val].nbBits); - if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8)) - /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */ - DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8); - } } - return 1; -} - -#define HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr) \ - ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) - -#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr) \ - if (MEM_64bits() || (HUF_TABLELOG_MAX<=12)) \ - ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) - -#define HUF_DECODE_SYMBOLX2_2(ptr, DStreamPtr) \ - if (MEM_64bits()) \ - ptr += HUF_decodeSymbolX2(ptr, DStreamPtr, dt, dtLog) - -HINT_INLINE size_t -HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, - const HUF_DEltX2* const dt, const U32 dtLog) -{ - BYTE* const pStart = p; - - /* up to 8 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p < pEnd-(sizeof(bitDPtr->bitContainer)-1))) { - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_1(p, bitDPtr); - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); - } - - /* closer to end : up to 2 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) & (p <= pEnd-2)) - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); - - while (p <= pEnd-2) - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); /* no need to reload : reached the end of DStream */ - - if (p < pEnd) - p += HUF_decodeLastSymbolX2(p, bitDPtr, dt, dtLog); - - return p-pStart; -} - -FORCE_INLINE_TEMPLATE size_t -HUF_decompress1X2_usingDTable_internal_body( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - BIT_DStream_t bitD; - - /* Init */ - CHECK_F( BIT_initDStream(&bitD, cSrc, cSrcSize) ); - - /* decode */ - { BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; - const void* const dtPtr = DTable+1; /* force compiler to not use strict-aliasing */ - const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr; - DTableDesc const dtd = HUF_getDTableDesc(DTable); - HUF_decodeStreamX2(ostart, &bitD, oend, dt, dtd.tableLog); - } - - /* check */ - if (!BIT_endOfDStream(&bitD)) return ERROR(corruption_detected); - - /* decoded size */ - return dstSize; -} - - -FORCE_INLINE_TEMPLATE size_t -HUF_decompress4X2_usingDTable_internal_body( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ - - { const BYTE* const istart = (const BYTE*) cSrc; - BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; - const void* const dtPtr = DTable+1; - const HUF_DEltX2* const dt = (const HUF_DEltX2*)dtPtr; - - /* Init */ - BIT_DStream_t bitD1; - BIT_DStream_t bitD2; - BIT_DStream_t bitD3; - BIT_DStream_t bitD4; - size_t const length1 = MEM_readLE16(istart); - size_t const length2 = MEM_readLE16(istart+2); - size_t const length3 = MEM_readLE16(istart+4); - size_t const length4 = cSrcSize - (length1 + length2 + length3 + 6); - const BYTE* const istart1 = istart + 6; /* jumpTable */ - const BYTE* const istart2 = istart1 + length1; - const BYTE* const istart3 = istart2 + length2; - const BYTE* const istart4 = istart3 + length3; - size_t const segmentSize = (dstSize+3) / 4; - BYTE* const opStart2 = ostart + segmentSize; - BYTE* const opStart3 = opStart2 + segmentSize; - BYTE* const opStart4 = opStart3 + segmentSize; - BYTE* op1 = ostart; - BYTE* op2 = opStart2; - BYTE* op3 = opStart3; - BYTE* op4 = opStart4; - U32 endSignal; - DTableDesc const dtd = HUF_getDTableDesc(DTable); - U32 const dtLog = dtd.tableLog; - - if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ - CHECK_F( BIT_initDStream(&bitD1, istart1, length1) ); - CHECK_F( BIT_initDStream(&bitD2, istart2, length2) ); - CHECK_F( BIT_initDStream(&bitD3, istart3, length3) ); - CHECK_F( BIT_initDStream(&bitD4, istart4, length4) ); - - /* 16-32 symbols per loop (4-8 symbols per stream) */ - endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4); - for ( ; (endSignal==BIT_DStream_unfinished) & (op4<(oend-(sizeof(bitD4.bitContainer)-1))) ; ) { - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_1(op1, &bitD1); - HUF_DECODE_SYMBOLX2_1(op2, &bitD2); - HUF_DECODE_SYMBOLX2_1(op3, &bitD3); - HUF_DECODE_SYMBOLX2_1(op4, &bitD4); - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_0(op1, &bitD1); - HUF_DECODE_SYMBOLX2_0(op2, &bitD2); - HUF_DECODE_SYMBOLX2_0(op3, &bitD3); - HUF_DECODE_SYMBOLX2_0(op4, &bitD4); - - endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4); - } - - /* check corruption */ - if (op1 > opStart2) return ERROR(corruption_detected); - if (op2 > opStart3) return ERROR(corruption_detected); - if (op3 > opStart4) return ERROR(corruption_detected); - /* note : op4 already verified within main loop */ - - /* finish bitStreams one by one */ - HUF_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog); - HUF_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog); - HUF_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog); - HUF_decodeStreamX2(op4, &bitD4, oend, dt, dtLog); - - /* check */ - { U32 const endCheck = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4); - if (!endCheck) return ERROR(corruption_detected); } - - /* decoded size */ - return dstSize; - } -} - -HUF_DGEN(HUF_decompress1X2_usingDTable_internal) -HUF_DGEN(HUF_decompress4X2_usingDTable_internal) - -size_t HUF_decompress1X2_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc dtd = HUF_getDTableDesc(DTable); - if (dtd.tableType != 1) return ERROR(GENERIC); - return HUF_decompress1X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -} - -size_t HUF_decompress1X2_DCtx_wksp(HUF_DTable* DCtx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t const hSize = HUF_readDTableX2_wksp(DCtx, cSrc, cSrcSize, - workSpace, wkspSize); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress1X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, DCtx, /* bmi2 */ 0); -} - - -size_t HUF_decompress1X2_DCtx(HUF_DTable* DCtx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress1X2_DCtx_wksp(DCtx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} - -size_t HUF_decompress1X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX2(DTable, HUF_TABLELOG_MAX); - return HUF_decompress1X2_DCtx(DTable, dst, dstSize, cSrc, cSrcSize); -} - -size_t HUF_decompress4X2_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc dtd = HUF_getDTableDesc(DTable); - if (dtd.tableType != 1) return ERROR(GENERIC); - return HUF_decompress4X2_usingDTable_internal(dst, dstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -} - -static size_t HUF_decompress4X2_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize, int bmi2) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t hSize = HUF_readDTableX2_wksp(dctx, cSrc, cSrcSize, - workSpace, wkspSize); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress4X2_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, bmi2); -} - -size_t HUF_decompress4X2_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - return HUF_decompress4X2_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, /* bmi2 */ 0); -} - - -size_t HUF_decompress4X2_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} - -size_t HUF_decompress4X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX2(DTable, HUF_TABLELOG_MAX); - return HUF_decompress4X2_DCtx(DTable, dst, dstSize, cSrc, cSrcSize); -} - -#endif /* HUF_FORCE_DECOMPRESS_X1 */ - - -/* ***********************************/ -/* Universal decompression selectors */ -/* ***********************************/ - -size_t HUF_decompress1X_usingDTable(void* dst, size_t maxDstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc const dtd = HUF_getDTableDesc(DTable); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dtd; - assert(dtd.tableType == 0); - return HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dtd; - assert(dtd.tableType == 1); - return HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#else - return dtd.tableType ? HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0) : - HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#endif -} - -size_t HUF_decompress4X_usingDTable(void* dst, size_t maxDstSize, - const void* cSrc, size_t cSrcSize, - const HUF_DTable* DTable) -{ - DTableDesc const dtd = HUF_getDTableDesc(DTable); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dtd; - assert(dtd.tableType == 0); - return HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dtd; - assert(dtd.tableType == 1); - return HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#else - return dtd.tableType ? HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0) : - HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, /* bmi2 */ 0); -#endif -} - - -#if !defined(HUF_FORCE_DECOMPRESS_X1) && !defined(HUF_FORCE_DECOMPRESS_X2) -typedef struct { U32 tableTime; U32 decode256Time; } algo_time_t; -static const algo_time_t algoTime[16 /* Quantization */][3 /* single, double, quad */] = -{ - /* single, double, quad */ - {{0,0}, {1,1}, {2,2}}, /* Q==0 : impossible */ - {{0,0}, {1,1}, {2,2}}, /* Q==1 : impossible */ - {{ 38,130}, {1313, 74}, {2151, 38}}, /* Q == 2 : 12-18% */ - {{ 448,128}, {1353, 74}, {2238, 41}}, /* Q == 3 : 18-25% */ - {{ 556,128}, {1353, 74}, {2238, 47}}, /* Q == 4 : 25-32% */ - {{ 714,128}, {1418, 74}, {2436, 53}}, /* Q == 5 : 32-38% */ - {{ 883,128}, {1437, 74}, {2464, 61}}, /* Q == 6 : 38-44% */ - {{ 897,128}, {1515, 75}, {2622, 68}}, /* Q == 7 : 44-50% */ - {{ 926,128}, {1613, 75}, {2730, 75}}, /* Q == 8 : 50-56% */ - {{ 947,128}, {1729, 77}, {3359, 77}}, /* Q == 9 : 56-62% */ - {{1107,128}, {2083, 81}, {4006, 84}}, /* Q ==10 : 62-69% */ - {{1177,128}, {2379, 87}, {4785, 88}}, /* Q ==11 : 69-75% */ - {{1242,128}, {2415, 93}, {5155, 84}}, /* Q ==12 : 75-81% */ - {{1349,128}, {2644,106}, {5260,106}}, /* Q ==13 : 81-87% */ - {{1455,128}, {2422,124}, {4174,124}}, /* Q ==14 : 87-93% */ - {{ 722,128}, {1891,145}, {1936,146}}, /* Q ==15 : 93-99% */ -}; -#endif - -/** HUF_selectDecoder() : - * Tells which decoder is likely to decode faster, - * based on a set of pre-computed metrics. - * @return : 0==HUF_decompress4X1, 1==HUF_decompress4X2 . - * Assumption : 0 < dstSize <= 128 KB */ -U32 HUF_selectDecoder (size_t dstSize, size_t cSrcSize) -{ - assert(dstSize > 0); - assert(dstSize <= 128*1024); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dstSize; - (void)cSrcSize; - return 0; -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dstSize; - (void)cSrcSize; - return 1; -#else - /* decoder timing evaluation */ - { U32 const Q = (cSrcSize >= dstSize) ? 15 : (U32)(cSrcSize * 16 / dstSize); /* Q < 16 */ - U32 const D256 = (U32)(dstSize >> 8); - U32 const DTime0 = algoTime[Q][0].tableTime + (algoTime[Q][0].decode256Time * D256); - U32 DTime1 = algoTime[Q][1].tableTime + (algoTime[Q][1].decode256Time * D256); - DTime1 += DTime1 >> 3; /* advantage to algorithm using less memory, to reduce cache eviction */ - return DTime1 < DTime0; - } -#endif -} - - -typedef size_t (*decompressionAlgo)(void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize); - -size_t HUF_decompress (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ -#if !defined(HUF_FORCE_DECOMPRESS_X1) && !defined(HUF_FORCE_DECOMPRESS_X2) - static const decompressionAlgo decompress[2] = { HUF_decompress4X1, HUF_decompress4X2 }; -#endif - - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize > dstSize) return ERROR(corruption_detected); /* invalid */ - if (cSrcSize == dstSize) { memcpy(dst, cSrc, dstSize); return dstSize; } /* not compressed */ - if (cSrcSize == 1) { memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; } /* RLE */ - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress4X1(dst, dstSize, cSrc, cSrcSize); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress4X2(dst, dstSize, cSrc, cSrcSize); -#else - return decompress[algoNb](dst, dstSize, cSrc, cSrcSize); -#endif - } -} - -size_t HUF_decompress4X_DCtx (HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize > dstSize) return ERROR(corruption_detected); /* invalid */ - if (cSrcSize == dstSize) { memcpy(dst, cSrc, dstSize); return dstSize; } /* not compressed */ - if (cSrcSize == 1) { memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; } /* RLE */ - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress4X1_DCtx(dctx, dst, dstSize, cSrc, cSrcSize); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress4X2_DCtx(dctx, dst, dstSize, cSrc, cSrcSize); -#else - return algoNb ? HUF_decompress4X2_DCtx(dctx, dst, dstSize, cSrc, cSrcSize) : - HUF_decompress4X1_DCtx(dctx, dst, dstSize, cSrc, cSrcSize) ; -#endif - } -} - -size_t HUF_decompress4X_hufOnly(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress4X_hufOnly_wksp(dctx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} - - -size_t HUF_decompress4X_hufOnly_wksp(HUF_DTable* dctx, void* dst, - size_t dstSize, const void* cSrc, - size_t cSrcSize, void* workSpace, - size_t wkspSize) -{ - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize == 0) return ERROR(corruption_detected); - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize); -#else - return algoNb ? HUF_decompress4X2_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize): - HUF_decompress4X1_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize); -#endif - } -} - -size_t HUF_decompress1X_DCtx_wksp(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - void* workSpace, size_t wkspSize) -{ - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize > dstSize) return ERROR(corruption_detected); /* invalid */ - if (cSrcSize == dstSize) { memcpy(dst, cSrc, dstSize); return dstSize; } /* not compressed */ - if (cSrcSize == 1) { memset(dst, *(const BYTE*)cSrc, dstSize); return dstSize; } /* RLE */ - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress1X1_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress1X2_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize); -#else - return algoNb ? HUF_decompress1X2_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize): - HUF_decompress1X1_DCtx_wksp(dctx, dst, dstSize, cSrc, - cSrcSize, workSpace, wkspSize); -#endif - } -} - -size_t HUF_decompress1X_DCtx(HUF_DTable* dctx, void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize) -{ - U32 workSpace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; - return HUF_decompress1X_DCtx_wksp(dctx, dst, dstSize, cSrc, cSrcSize, - workSpace, sizeof(workSpace)); -} - - -size_t HUF_decompress1X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2) -{ - DTableDesc const dtd = HUF_getDTableDesc(DTable); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dtd; - assert(dtd.tableType == 0); - return HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dtd; - assert(dtd.tableType == 1); - return HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#else - return dtd.tableType ? HUF_decompress1X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2) : - HUF_decompress1X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#endif -} - -#ifndef HUF_FORCE_DECOMPRESS_X2 -size_t HUF_decompress1X1_DCtx_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2) -{ - const BYTE* ip = (const BYTE*) cSrc; - - size_t const hSize = HUF_readDTableX1_wksp(dctx, cSrc, cSrcSize, workSpace, wkspSize); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; cSrcSize -= hSize; - - return HUF_decompress1X1_usingDTable_internal(dst, dstSize, ip, cSrcSize, dctx, bmi2); -} -#endif - -size_t HUF_decompress4X_usingDTable_bmi2(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize, const HUF_DTable* DTable, int bmi2) -{ - DTableDesc const dtd = HUF_getDTableDesc(DTable); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)dtd; - assert(dtd.tableType == 0); - return HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)dtd; - assert(dtd.tableType == 1); - return HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#else - return dtd.tableType ? HUF_decompress4X2_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2) : - HUF_decompress4X1_usingDTable_internal(dst, maxDstSize, cSrc, cSrcSize, DTable, bmi2); -#endif -} - -size_t HUF_decompress4X_hufOnly_wksp_bmi2(HUF_DTable* dctx, void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize, void* workSpace, size_t wkspSize, int bmi2) -{ - /* validation checks */ - if (dstSize == 0) return ERROR(dstSize_tooSmall); - if (cSrcSize == 0) return ERROR(corruption_detected); - - { U32 const algoNb = HUF_selectDecoder(dstSize, cSrcSize); -#if defined(HUF_FORCE_DECOMPRESS_X1) - (void)algoNb; - assert(algoNb == 0); - return HUF_decompress4X1_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2); -#elif defined(HUF_FORCE_DECOMPRESS_X2) - (void)algoNb; - assert(algoNb == 1); - return HUF_decompress4X2_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2); -#else - return algoNb ? HUF_decompress4X2_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2) : - HUF_decompress4X1_DCtx_wksp_bmi2(dctx, dst, dstSize, cSrc, cSrcSize, workSpace, wkspSize, bmi2); -#endif - } -} diff --git a/vendor/github.com/DataDog/zstd/mem.h b/vendor/github.com/DataDog/zstd/mem.h deleted file mode 100644 index 530d30c8..00000000 --- a/vendor/github.com/DataDog/zstd/mem.h +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef MEM_H_MODULE -#define MEM_H_MODULE - -#if defined (__cplusplus) -extern "C" { -#endif - -/*-**************************************** -* Dependencies -******************************************/ -#include /* size_t, ptrdiff_t */ -#include /* memcpy */ - - -/*-**************************************** -* Compiler specifics -******************************************/ -#if defined(_MSC_VER) /* Visual Studio */ -# include /* _byteswap_ulong */ -# include /* _byteswap_* */ -#endif -#if defined(__GNUC__) -# define MEM_STATIC static __inline __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define MEM_STATIC static inline -#elif defined(_MSC_VER) -# define MEM_STATIC static __inline -#else -# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif - -#ifndef __has_builtin -# define __has_builtin(x) 0 /* compat. with non-clang compilers */ -#endif - -/* code only tested on 32 and 64 bits systems */ -#define MEM_STATIC_ASSERT(c) { enum { MEM_static_assert = 1/(int)(!!(c)) }; } -MEM_STATIC void MEM_check(void) { MEM_STATIC_ASSERT((sizeof(size_t)==4) || (sizeof(size_t)==8)); } - -/* detects whether we are being compiled under msan */ -#if defined (__has_feature) -# if __has_feature(memory_sanitizer) -# define MEMORY_SANITIZER 1 -# endif -#endif - -#if defined (MEMORY_SANITIZER) -/* Not all platforms that support msan provide sanitizers/msan_interface.h. - * We therefore declare the functions we need ourselves, rather than trying to - * include the header file... */ - -#include /* intptr_t */ - -/* Make memory region fully initialized (without changing its contents). */ -void __msan_unpoison(const volatile void *a, size_t size); - -/* Make memory region fully uninitialized (without changing its contents). - This is a legacy interface that does not update origin information. Use - __msan_allocated_memory() instead. */ -void __msan_poison(const volatile void *a, size_t size); - -/* Returns the offset of the first (at least partially) poisoned byte in the - memory range, or -1 if the whole range is good. */ -intptr_t __msan_test_shadow(const volatile void *x, size_t size); -#endif - -/* detects whether we are being compiled under asan */ -#if defined (__has_feature) -# if __has_feature(address_sanitizer) -# define ADDRESS_SANITIZER 1 -# endif -#elif defined(__SANITIZE_ADDRESS__) -# define ADDRESS_SANITIZER 1 -#endif - -#if defined (ADDRESS_SANITIZER) -/* Not all platforms that support asan provide sanitizers/asan_interface.h. - * We therefore declare the functions we need ourselves, rather than trying to - * include the header file... */ - -/** - * Marks a memory region ([addr, addr+size)) as unaddressable. - * - * This memory must be previously allocated by your program. Instrumented - * code is forbidden from accessing addresses in this region until it is - * unpoisoned. This function is not guaranteed to poison the entire region - - * it could poison only a subregion of [addr, addr+size) due to ASan - * alignment restrictions. - * - * \note This function is not thread-safe because no two threads can poison or - * unpoison memory in the same memory region simultaneously. - * - * \param addr Start of memory region. - * \param size Size of memory region. */ -void __asan_poison_memory_region(void const volatile *addr, size_t size); - -/** - * Marks a memory region ([addr, addr+size)) as addressable. - * - * This memory must be previously allocated by your program. Accessing - * addresses in this region is allowed until this region is poisoned again. - * This function could unpoison a super-region of [addr, addr+size) due - * to ASan alignment restrictions. - * - * \note This function is not thread-safe because no two threads can - * poison or unpoison memory in the same memory region simultaneously. - * - * \param addr Start of memory region. - * \param size Size of memory region. */ -void __asan_unpoison_memory_region(void const volatile *addr, size_t size); -#endif - - -/*-************************************************************** -* Basic Types -*****************************************************************/ -#if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include - typedef uint8_t BYTE; - typedef uint16_t U16; - typedef int16_t S16; - typedef uint32_t U32; - typedef int32_t S32; - typedef uint64_t U64; - typedef int64_t S64; -#else -# include -#if CHAR_BIT != 8 -# error "this implementation requires char to be exactly 8-bit type" -#endif - typedef unsigned char BYTE; -#if USHRT_MAX != 65535 -# error "this implementation requires short to be exactly 16-bit type" -#endif - typedef unsigned short U16; - typedef signed short S16; -#if UINT_MAX != 4294967295 -# error "this implementation requires int to be exactly 32-bit type" -#endif - typedef unsigned int U32; - typedef signed int S32; -/* note : there are no limits defined for long long type in C90. - * limits exist in C99, however, in such case, is preferred */ - typedef unsigned long long U64; - typedef signed long long S64; -#endif - - -/*-************************************************************** -* Memory I/O -*****************************************************************/ -/* MEM_FORCE_MEMORY_ACCESS : - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (i.e., not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets depending on alignment. - * In some circumstances, it's the only known way to get the most performance (i.e. GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define MEM_FORCE_MEMORY_ACCESS 2 -# elif defined(__INTEL_COMPILER) || defined(__GNUC__) || defined(__ICCARM__) -# define MEM_FORCE_MEMORY_ACCESS 1 -# endif -#endif - -MEM_STATIC unsigned MEM_32bits(void) { return sizeof(size_t)==4; } -MEM_STATIC unsigned MEM_64bits(void) { return sizeof(size_t)==8; } - -MEM_STATIC unsigned MEM_isLittleEndian(void) -{ - const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */ - return one.c[0]; -} - -#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2) - -/* violates C standard, by lying on structure alignment. -Only use if no other choice to achieve best performance on target platform */ -MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; } -MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; } -MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; } -MEM_STATIC size_t MEM_readST(const void* memPtr) { return *(const size_t*) memPtr; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } -MEM_STATIC void MEM_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; } -MEM_STATIC void MEM_write64(void* memPtr, U64 value) { *(U64*)memPtr = value; } - -#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -#if defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(WIN32)) - __pragma( pack(push, 1) ) - typedef struct { U16 v; } unalign16; - typedef struct { U32 v; } unalign32; - typedef struct { U64 v; } unalign64; - typedef struct { size_t v; } unalignArch; - __pragma( pack(pop) ) -#else - typedef struct { U16 v; } __attribute__((packed)) unalign16; - typedef struct { U32 v; } __attribute__((packed)) unalign32; - typedef struct { U64 v; } __attribute__((packed)) unalign64; - typedef struct { size_t v; } __attribute__((packed)) unalignArch; -#endif - -MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign16*)ptr)->v; } -MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign32*)ptr)->v; } -MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign64*)ptr)->v; } -MEM_STATIC size_t MEM_readST(const void* ptr) { return ((const unalignArch*)ptr)->v; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign16*)memPtr)->v = value; } -MEM_STATIC void MEM_write32(void* memPtr, U32 value) { ((unalign32*)memPtr)->v = value; } -MEM_STATIC void MEM_write64(void* memPtr, U64 value) { ((unalign64*)memPtr)->v = value; } - -#else - -/* default method, safe and standard. - can sometimes prove slower */ - -MEM_STATIC U16 MEM_read16(const void* memPtr) -{ - U16 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -MEM_STATIC U32 MEM_read32(const void* memPtr) -{ - U32 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -MEM_STATIC U64 MEM_read64(const void* memPtr) -{ - U64 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -MEM_STATIC size_t MEM_readST(const void* memPtr) -{ - size_t val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) -{ - memcpy(memPtr, &value, sizeof(value)); -} - -MEM_STATIC void MEM_write32(void* memPtr, U32 value) -{ - memcpy(memPtr, &value, sizeof(value)); -} - -MEM_STATIC void MEM_write64(void* memPtr, U64 value) -{ - memcpy(memPtr, &value, sizeof(value)); -} - -#endif /* MEM_FORCE_MEMORY_ACCESS */ - -MEM_STATIC U32 MEM_swap32(U32 in) -{ -#if defined(_MSC_VER) /* Visual Studio */ - return _byteswap_ulong(in); -#elif (defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)) \ - || (defined(__clang__) && __has_builtin(__builtin_bswap32)) - return __builtin_bswap32(in); -#else - return ((in << 24) & 0xff000000 ) | - ((in << 8) & 0x00ff0000 ) | - ((in >> 8) & 0x0000ff00 ) | - ((in >> 24) & 0x000000ff ); -#endif -} - -MEM_STATIC U64 MEM_swap64(U64 in) -{ -#if defined(_MSC_VER) /* Visual Studio */ - return _byteswap_uint64(in); -#elif (defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)) \ - || (defined(__clang__) && __has_builtin(__builtin_bswap64)) - return __builtin_bswap64(in); -#else - return ((in << 56) & 0xff00000000000000ULL) | - ((in << 40) & 0x00ff000000000000ULL) | - ((in << 24) & 0x0000ff0000000000ULL) | - ((in << 8) & 0x000000ff00000000ULL) | - ((in >> 8) & 0x00000000ff000000ULL) | - ((in >> 24) & 0x0000000000ff0000ULL) | - ((in >> 40) & 0x000000000000ff00ULL) | - ((in >> 56) & 0x00000000000000ffULL); -#endif -} - -MEM_STATIC size_t MEM_swapST(size_t in) -{ - if (MEM_32bits()) - return (size_t)MEM_swap32((U32)in); - else - return (size_t)MEM_swap64((U64)in); -} - -/*=== Little endian r/w ===*/ - -MEM_STATIC U16 MEM_readLE16(const void* memPtr) -{ - if (MEM_isLittleEndian()) - return MEM_read16(memPtr); - else { - const BYTE* p = (const BYTE*)memPtr; - return (U16)(p[0] + (p[1]<<8)); - } -} - -MEM_STATIC void MEM_writeLE16(void* memPtr, U16 val) -{ - if (MEM_isLittleEndian()) { - MEM_write16(memPtr, val); - } else { - BYTE* p = (BYTE*)memPtr; - p[0] = (BYTE)val; - p[1] = (BYTE)(val>>8); - } -} - -MEM_STATIC U32 MEM_readLE24(const void* memPtr) -{ - return MEM_readLE16(memPtr) + (((const BYTE*)memPtr)[2] << 16); -} - -MEM_STATIC void MEM_writeLE24(void* memPtr, U32 val) -{ - MEM_writeLE16(memPtr, (U16)val); - ((BYTE*)memPtr)[2] = (BYTE)(val>>16); -} - -MEM_STATIC U32 MEM_readLE32(const void* memPtr) -{ - if (MEM_isLittleEndian()) - return MEM_read32(memPtr); - else - return MEM_swap32(MEM_read32(memPtr)); -} - -MEM_STATIC void MEM_writeLE32(void* memPtr, U32 val32) -{ - if (MEM_isLittleEndian()) - MEM_write32(memPtr, val32); - else - MEM_write32(memPtr, MEM_swap32(val32)); -} - -MEM_STATIC U64 MEM_readLE64(const void* memPtr) -{ - if (MEM_isLittleEndian()) - return MEM_read64(memPtr); - else - return MEM_swap64(MEM_read64(memPtr)); -} - -MEM_STATIC void MEM_writeLE64(void* memPtr, U64 val64) -{ - if (MEM_isLittleEndian()) - MEM_write64(memPtr, val64); - else - MEM_write64(memPtr, MEM_swap64(val64)); -} - -MEM_STATIC size_t MEM_readLEST(const void* memPtr) -{ - if (MEM_32bits()) - return (size_t)MEM_readLE32(memPtr); - else - return (size_t)MEM_readLE64(memPtr); -} - -MEM_STATIC void MEM_writeLEST(void* memPtr, size_t val) -{ - if (MEM_32bits()) - MEM_writeLE32(memPtr, (U32)val); - else - MEM_writeLE64(memPtr, (U64)val); -} - -/*=== Big endian r/w ===*/ - -MEM_STATIC U32 MEM_readBE32(const void* memPtr) -{ - if (MEM_isLittleEndian()) - return MEM_swap32(MEM_read32(memPtr)); - else - return MEM_read32(memPtr); -} - -MEM_STATIC void MEM_writeBE32(void* memPtr, U32 val32) -{ - if (MEM_isLittleEndian()) - MEM_write32(memPtr, MEM_swap32(val32)); - else - MEM_write32(memPtr, val32); -} - -MEM_STATIC U64 MEM_readBE64(const void* memPtr) -{ - if (MEM_isLittleEndian()) - return MEM_swap64(MEM_read64(memPtr)); - else - return MEM_read64(memPtr); -} - -MEM_STATIC void MEM_writeBE64(void* memPtr, U64 val64) -{ - if (MEM_isLittleEndian()) - MEM_write64(memPtr, MEM_swap64(val64)); - else - MEM_write64(memPtr, val64); -} - -MEM_STATIC size_t MEM_readBEST(const void* memPtr) -{ - if (MEM_32bits()) - return (size_t)MEM_readBE32(memPtr); - else - return (size_t)MEM_readBE64(memPtr); -} - -MEM_STATIC void MEM_writeBEST(void* memPtr, size_t val) -{ - if (MEM_32bits()) - MEM_writeBE32(memPtr, (U32)val); - else - MEM_writeBE64(memPtr, (U64)val); -} - - -#if defined (__cplusplus) -} -#endif - -#endif /* MEM_H_MODULE */ diff --git a/vendor/github.com/DataDog/zstd/pool.c b/vendor/github.com/DataDog/zstd/pool.c deleted file mode 100644 index f5759350..00000000 --- a/vendor/github.com/DataDog/zstd/pool.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -/* ====== Dependencies ======= */ -#include /* size_t */ -#include "debug.h" /* assert */ -#include "zstd_internal.h" /* ZSTD_malloc, ZSTD_free */ -#include "pool.h" - -/* ====== Compiler specifics ====== */ -#if defined(_MSC_VER) -# pragma warning(disable : 4204) /* disable: C4204: non-constant aggregate initializer */ -#endif - - -#ifdef ZSTD_MULTITHREAD - -#include "threading.h" /* pthread adaptation */ - -/* A job is a function and an opaque argument */ -typedef struct POOL_job_s { - POOL_function function; - void *opaque; -} POOL_job; - -struct POOL_ctx_s { - ZSTD_customMem customMem; - /* Keep track of the threads */ - ZSTD_pthread_t* threads; - size_t threadCapacity; - size_t threadLimit; - - /* The queue is a circular buffer */ - POOL_job *queue; - size_t queueHead; - size_t queueTail; - size_t queueSize; - - /* The number of threads working on jobs */ - size_t numThreadsBusy; - /* Indicates if the queue is empty */ - int queueEmpty; - - /* The mutex protects the queue */ - ZSTD_pthread_mutex_t queueMutex; - /* Condition variable for pushers to wait on when the queue is full */ - ZSTD_pthread_cond_t queuePushCond; - /* Condition variables for poppers to wait on when the queue is empty */ - ZSTD_pthread_cond_t queuePopCond; - /* Indicates if the queue is shutting down */ - int shutdown; -}; - -/* POOL_thread() : - * Work thread for the thread pool. - * Waits for jobs and executes them. - * @returns : NULL on failure else non-null. - */ -static void* POOL_thread(void* opaque) { - POOL_ctx* const ctx = (POOL_ctx*)opaque; - if (!ctx) { return NULL; } - for (;;) { - /* Lock the mutex and wait for a non-empty queue or until shutdown */ - ZSTD_pthread_mutex_lock(&ctx->queueMutex); - - while ( ctx->queueEmpty - || (ctx->numThreadsBusy >= ctx->threadLimit) ) { - if (ctx->shutdown) { - /* even if !queueEmpty, (possible if numThreadsBusy >= threadLimit), - * a few threads will be shutdown while !queueEmpty, - * but enough threads will remain active to finish the queue */ - ZSTD_pthread_mutex_unlock(&ctx->queueMutex); - return opaque; - } - ZSTD_pthread_cond_wait(&ctx->queuePopCond, &ctx->queueMutex); - } - /* Pop a job off the queue */ - { POOL_job const job = ctx->queue[ctx->queueHead]; - ctx->queueHead = (ctx->queueHead + 1) % ctx->queueSize; - ctx->numThreadsBusy++; - ctx->queueEmpty = ctx->queueHead == ctx->queueTail; - /* Unlock the mutex, signal a pusher, and run the job */ - ZSTD_pthread_cond_signal(&ctx->queuePushCond); - ZSTD_pthread_mutex_unlock(&ctx->queueMutex); - - job.function(job.opaque); - - /* If the intended queue size was 0, signal after finishing job */ - ZSTD_pthread_mutex_lock(&ctx->queueMutex); - ctx->numThreadsBusy--; - if (ctx->queueSize == 1) { - ZSTD_pthread_cond_signal(&ctx->queuePushCond); - } - ZSTD_pthread_mutex_unlock(&ctx->queueMutex); - } - } /* for (;;) */ - assert(0); /* Unreachable */ -} - -POOL_ctx* POOL_create(size_t numThreads, size_t queueSize) { - return POOL_create_advanced(numThreads, queueSize, ZSTD_defaultCMem); -} - -POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, - ZSTD_customMem customMem) { - POOL_ctx* ctx; - /* Check parameters */ - if (!numThreads) { return NULL; } - /* Allocate the context and zero initialize */ - ctx = (POOL_ctx*)ZSTD_calloc(sizeof(POOL_ctx), customMem); - if (!ctx) { return NULL; } - /* Initialize the job queue. - * It needs one extra space since one space is wasted to differentiate - * empty and full queues. - */ - ctx->queueSize = queueSize + 1; - ctx->queue = (POOL_job*)ZSTD_malloc(ctx->queueSize * sizeof(POOL_job), customMem); - ctx->queueHead = 0; - ctx->queueTail = 0; - ctx->numThreadsBusy = 0; - ctx->queueEmpty = 1; - { - int error = 0; - error |= ZSTD_pthread_mutex_init(&ctx->queueMutex, NULL); - error |= ZSTD_pthread_cond_init(&ctx->queuePushCond, NULL); - error |= ZSTD_pthread_cond_init(&ctx->queuePopCond, NULL); - if (error) { POOL_free(ctx); return NULL; } - } - ctx->shutdown = 0; - /* Allocate space for the thread handles */ - ctx->threads = (ZSTD_pthread_t*)ZSTD_malloc(numThreads * sizeof(ZSTD_pthread_t), customMem); - ctx->threadCapacity = 0; - ctx->customMem = customMem; - /* Check for errors */ - if (!ctx->threads || !ctx->queue) { POOL_free(ctx); return NULL; } - /* Initialize the threads */ - { size_t i; - for (i = 0; i < numThreads; ++i) { - if (ZSTD_pthread_create(&ctx->threads[i], NULL, &POOL_thread, ctx)) { - ctx->threadCapacity = i; - POOL_free(ctx); - return NULL; - } } - ctx->threadCapacity = numThreads; - ctx->threadLimit = numThreads; - } - return ctx; -} - -/*! POOL_join() : - Shutdown the queue, wake any sleeping threads, and join all of the threads. -*/ -static void POOL_join(POOL_ctx* ctx) { - /* Shut down the queue */ - ZSTD_pthread_mutex_lock(&ctx->queueMutex); - ctx->shutdown = 1; - ZSTD_pthread_mutex_unlock(&ctx->queueMutex); - /* Wake up sleeping threads */ - ZSTD_pthread_cond_broadcast(&ctx->queuePushCond); - ZSTD_pthread_cond_broadcast(&ctx->queuePopCond); - /* Join all of the threads */ - { size_t i; - for (i = 0; i < ctx->threadCapacity; ++i) { - ZSTD_pthread_join(ctx->threads[i], NULL); /* note : could fail */ - } } -} - -void POOL_free(POOL_ctx *ctx) { - if (!ctx) { return; } - POOL_join(ctx); - ZSTD_pthread_mutex_destroy(&ctx->queueMutex); - ZSTD_pthread_cond_destroy(&ctx->queuePushCond); - ZSTD_pthread_cond_destroy(&ctx->queuePopCond); - ZSTD_free(ctx->queue, ctx->customMem); - ZSTD_free(ctx->threads, ctx->customMem); - ZSTD_free(ctx, ctx->customMem); -} - - - -size_t POOL_sizeof(POOL_ctx *ctx) { - if (ctx==NULL) return 0; /* supports sizeof NULL */ - return sizeof(*ctx) - + ctx->queueSize * sizeof(POOL_job) - + ctx->threadCapacity * sizeof(ZSTD_pthread_t); -} - - -/* @return : 0 on success, 1 on error */ -static int POOL_resize_internal(POOL_ctx* ctx, size_t numThreads) -{ - if (numThreads <= ctx->threadCapacity) { - if (!numThreads) return 1; - ctx->threadLimit = numThreads; - return 0; - } - /* numThreads > threadCapacity */ - { ZSTD_pthread_t* const threadPool = (ZSTD_pthread_t*)ZSTD_malloc(numThreads * sizeof(ZSTD_pthread_t), ctx->customMem); - if (!threadPool) return 1; - /* replace existing thread pool */ - memcpy(threadPool, ctx->threads, ctx->threadCapacity * sizeof(*threadPool)); - ZSTD_free(ctx->threads, ctx->customMem); - ctx->threads = threadPool; - /* Initialize additional threads */ - { size_t threadId; - for (threadId = ctx->threadCapacity; threadId < numThreads; ++threadId) { - if (ZSTD_pthread_create(&threadPool[threadId], NULL, &POOL_thread, ctx)) { - ctx->threadCapacity = threadId; - return 1; - } } - } } - /* successfully expanded */ - ctx->threadCapacity = numThreads; - ctx->threadLimit = numThreads; - return 0; -} - -/* @return : 0 on success, 1 on error */ -int POOL_resize(POOL_ctx* ctx, size_t numThreads) -{ - int result; - if (ctx==NULL) return 1; - ZSTD_pthread_mutex_lock(&ctx->queueMutex); - result = POOL_resize_internal(ctx, numThreads); - ZSTD_pthread_cond_broadcast(&ctx->queuePopCond); - ZSTD_pthread_mutex_unlock(&ctx->queueMutex); - return result; -} - -/** - * Returns 1 if the queue is full and 0 otherwise. - * - * When queueSize is 1 (pool was created with an intended queueSize of 0), - * then a queue is empty if there is a thread free _and_ no job is waiting. - */ -static int isQueueFull(POOL_ctx const* ctx) { - if (ctx->queueSize > 1) { - return ctx->queueHead == ((ctx->queueTail + 1) % ctx->queueSize); - } else { - return (ctx->numThreadsBusy == ctx->threadLimit) || - !ctx->queueEmpty; - } -} - - -static void POOL_add_internal(POOL_ctx* ctx, POOL_function function, void *opaque) -{ - POOL_job const job = {function, opaque}; - assert(ctx != NULL); - if (ctx->shutdown) return; - - ctx->queueEmpty = 0; - ctx->queue[ctx->queueTail] = job; - ctx->queueTail = (ctx->queueTail + 1) % ctx->queueSize; - ZSTD_pthread_cond_signal(&ctx->queuePopCond); -} - -void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque) -{ - assert(ctx != NULL); - ZSTD_pthread_mutex_lock(&ctx->queueMutex); - /* Wait until there is space in the queue for the new job */ - while (isQueueFull(ctx) && (!ctx->shutdown)) { - ZSTD_pthread_cond_wait(&ctx->queuePushCond, &ctx->queueMutex); - } - POOL_add_internal(ctx, function, opaque); - ZSTD_pthread_mutex_unlock(&ctx->queueMutex); -} - - -int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque) -{ - assert(ctx != NULL); - ZSTD_pthread_mutex_lock(&ctx->queueMutex); - if (isQueueFull(ctx)) { - ZSTD_pthread_mutex_unlock(&ctx->queueMutex); - return 0; - } - POOL_add_internal(ctx, function, opaque); - ZSTD_pthread_mutex_unlock(&ctx->queueMutex); - return 1; -} - - -#else /* ZSTD_MULTITHREAD not defined */ - -/* ========================== */ -/* No multi-threading support */ -/* ========================== */ - - -/* We don't need any data, but if it is empty, malloc() might return NULL. */ -struct POOL_ctx_s { - int dummy; -}; -static POOL_ctx g_ctx; - -POOL_ctx* POOL_create(size_t numThreads, size_t queueSize) { - return POOL_create_advanced(numThreads, queueSize, ZSTD_defaultCMem); -} - -POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, ZSTD_customMem customMem) { - (void)numThreads; - (void)queueSize; - (void)customMem; - return &g_ctx; -} - -void POOL_free(POOL_ctx* ctx) { - assert(!ctx || ctx == &g_ctx); - (void)ctx; -} - -int POOL_resize(POOL_ctx* ctx, size_t numThreads) { - (void)ctx; (void)numThreads; - return 0; -} - -void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque) { - (void)ctx; - function(opaque); -} - -int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque) { - (void)ctx; - function(opaque); - return 1; -} - -size_t POOL_sizeof(POOL_ctx* ctx) { - if (ctx==NULL) return 0; /* supports sizeof NULL */ - assert(ctx == &g_ctx); - return sizeof(*ctx); -} - -#endif /* ZSTD_MULTITHREAD */ diff --git a/vendor/github.com/DataDog/zstd/pool.h b/vendor/github.com/DataDog/zstd/pool.h deleted file mode 100644 index 458d37f1..00000000 --- a/vendor/github.com/DataDog/zstd/pool.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef POOL_H -#define POOL_H - -#if defined (__cplusplus) -extern "C" { -#endif - - -#include /* size_t */ -#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_customMem */ -#include "zstd.h" - -typedef struct POOL_ctx_s POOL_ctx; - -/*! POOL_create() : - * Create a thread pool with at most `numThreads` threads. - * `numThreads` must be at least 1. - * The maximum number of queued jobs before blocking is `queueSize`. - * @return : POOL_ctx pointer on success, else NULL. -*/ -POOL_ctx* POOL_create(size_t numThreads, size_t queueSize); - -POOL_ctx* POOL_create_advanced(size_t numThreads, size_t queueSize, - ZSTD_customMem customMem); - -/*! POOL_free() : - * Free a thread pool returned by POOL_create(). - */ -void POOL_free(POOL_ctx* ctx); - -/*! POOL_resize() : - * Expands or shrinks pool's number of threads. - * This is more efficient than releasing + creating a new context, - * since it tries to preserve and re-use existing threads. - * `numThreads` must be at least 1. - * @return : 0 when resize was successful, - * !0 (typically 1) if there is an error. - * note : only numThreads can be resized, queueSize remains unchanged. - */ -int POOL_resize(POOL_ctx* ctx, size_t numThreads); - -/*! POOL_sizeof() : - * @return threadpool memory usage - * note : compatible with NULL (returns 0 in this case) - */ -size_t POOL_sizeof(POOL_ctx* ctx); - -/*! POOL_function : - * The function type that can be added to a thread pool. - */ -typedef void (*POOL_function)(void*); - -/*! POOL_add() : - * Add the job `function(opaque)` to the thread pool. `ctx` must be valid. - * Possibly blocks until there is room in the queue. - * Note : The function may be executed asynchronously, - * therefore, `opaque` must live until function has been completed. - */ -void POOL_add(POOL_ctx* ctx, POOL_function function, void* opaque); - - -/*! POOL_tryAdd() : - * Add the job `function(opaque)` to thread pool _if_ a worker is available. - * Returns immediately even if not (does not block). - * @return : 1 if successful, 0 if not. - */ -int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque); - - -#if defined (__cplusplus) -} -#endif - -#endif diff --git a/vendor/github.com/DataDog/zstd/threading.c b/vendor/github.com/DataDog/zstd/threading.c deleted file mode 100644 index 482664bd..00000000 --- a/vendor/github.com/DataDog/zstd/threading.c +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Copyright (c) 2016 Tino Reichardt - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * - * You can contact the author at: - * - zstdmt source repository: https://github.com/mcmilk/zstdmt - */ - -/** - * This file will hold wrapper for systems, which do not support pthreads - */ - -#include "threading.h" - -/* create fake symbol to avoid empty translation unit warning */ -int g_ZSTD_threading_useless_symbol; - -#if defined(ZSTD_MULTITHREAD) && defined(_WIN32) - -/** - * Windows minimalist Pthread Wrapper, based on : - * http://www.cse.wustl.edu/~schmidt/win32-cv-1.html - */ - - -/* === Dependencies === */ -#include -#include - - -/* === Implementation === */ - -static unsigned __stdcall worker(void *arg) -{ - ZSTD_pthread_t* const thread = (ZSTD_pthread_t*) arg; - thread->arg = thread->start_routine(thread->arg); - return 0; -} - -int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused, - void* (*start_routine) (void*), void* arg) -{ - (void)unused; - thread->arg = arg; - thread->start_routine = start_routine; - thread->handle = (HANDLE) _beginthreadex(NULL, 0, worker, thread, 0, NULL); - - if (!thread->handle) - return errno; - else - return 0; -} - -int ZSTD_pthread_join(ZSTD_pthread_t thread, void **value_ptr) -{ - DWORD result; - - if (!thread.handle) return 0; - - result = WaitForSingleObject(thread.handle, INFINITE); - switch (result) { - case WAIT_OBJECT_0: - if (value_ptr) *value_ptr = thread.arg; - return 0; - case WAIT_ABANDONED: - return EINVAL; - default: - return GetLastError(); - } -} - -#endif /* ZSTD_MULTITHREAD */ - -#if defined(ZSTD_MULTITHREAD) && DEBUGLEVEL >= 1 && !defined(_WIN32) - -#include - -int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr) -{ - *mutex = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t)); - if (!*mutex) - return 1; - return pthread_mutex_init(*mutex, attr); -} - -int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex) -{ - if (!*mutex) - return 0; - { - int const ret = pthread_mutex_destroy(*mutex); - free(*mutex); - return ret; - } -} - -int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr) -{ - *cond = (pthread_cond_t*)malloc(sizeof(pthread_cond_t)); - if (!*cond) - return 1; - return pthread_cond_init(*cond, attr); -} - -int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond) -{ - if (!*cond) - return 0; - { - int const ret = pthread_cond_destroy(*cond); - free(*cond); - return ret; - } -} - -#endif diff --git a/vendor/github.com/DataDog/zstd/threading.h b/vendor/github.com/DataDog/zstd/threading.h deleted file mode 100644 index 3193ca7d..00000000 --- a/vendor/github.com/DataDog/zstd/threading.h +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright (c) 2016 Tino Reichardt - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * - * You can contact the author at: - * - zstdmt source repository: https://github.com/mcmilk/zstdmt - */ - -#ifndef THREADING_H_938743 -#define THREADING_H_938743 - -#include "debug.h" - -#if defined (__cplusplus) -extern "C" { -#endif - -#if defined(ZSTD_MULTITHREAD) && defined(_WIN32) - -/** - * Windows minimalist Pthread Wrapper, based on : - * http://www.cse.wustl.edu/~schmidt/win32-cv-1.html - */ -#ifdef WINVER -# undef WINVER -#endif -#define WINVER 0x0600 - -#ifdef _WIN32_WINNT -# undef _WIN32_WINNT -#endif -#define _WIN32_WINNT 0x0600 - -#ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -#endif - -#undef ERROR /* reported already defined on VS 2015 (Rich Geldreich) */ -#include -#undef ERROR -#define ERROR(name) ZSTD_ERROR(name) - - -/* mutex */ -#define ZSTD_pthread_mutex_t CRITICAL_SECTION -#define ZSTD_pthread_mutex_init(a, b) ((void)(b), InitializeCriticalSection((a)), 0) -#define ZSTD_pthread_mutex_destroy(a) DeleteCriticalSection((a)) -#define ZSTD_pthread_mutex_lock(a) EnterCriticalSection((a)) -#define ZSTD_pthread_mutex_unlock(a) LeaveCriticalSection((a)) - -/* condition variable */ -#define ZSTD_pthread_cond_t CONDITION_VARIABLE -#define ZSTD_pthread_cond_init(a, b) ((void)(b), InitializeConditionVariable((a)), 0) -#define ZSTD_pthread_cond_destroy(a) ((void)(a)) -#define ZSTD_pthread_cond_wait(a, b) SleepConditionVariableCS((a), (b), INFINITE) -#define ZSTD_pthread_cond_signal(a) WakeConditionVariable((a)) -#define ZSTD_pthread_cond_broadcast(a) WakeAllConditionVariable((a)) - -/* ZSTD_pthread_create() and ZSTD_pthread_join() */ -typedef struct { - HANDLE handle; - void* (*start_routine)(void*); - void* arg; -} ZSTD_pthread_t; - -int ZSTD_pthread_create(ZSTD_pthread_t* thread, const void* unused, - void* (*start_routine) (void*), void* arg); - -int ZSTD_pthread_join(ZSTD_pthread_t thread, void** value_ptr); - -/** - * add here more wrappers as required - */ - - -#elif defined(ZSTD_MULTITHREAD) /* posix assumed ; need a better detection method */ -/* === POSIX Systems === */ -# include - -#if DEBUGLEVEL < 1 - -#define ZSTD_pthread_mutex_t pthread_mutex_t -#define ZSTD_pthread_mutex_init(a, b) pthread_mutex_init((a), (b)) -#define ZSTD_pthread_mutex_destroy(a) pthread_mutex_destroy((a)) -#define ZSTD_pthread_mutex_lock(a) pthread_mutex_lock((a)) -#define ZSTD_pthread_mutex_unlock(a) pthread_mutex_unlock((a)) - -#define ZSTD_pthread_cond_t pthread_cond_t -#define ZSTD_pthread_cond_init(a, b) pthread_cond_init((a), (b)) -#define ZSTD_pthread_cond_destroy(a) pthread_cond_destroy((a)) -#define ZSTD_pthread_cond_wait(a, b) pthread_cond_wait((a), (b)) -#define ZSTD_pthread_cond_signal(a) pthread_cond_signal((a)) -#define ZSTD_pthread_cond_broadcast(a) pthread_cond_broadcast((a)) - -#define ZSTD_pthread_t pthread_t -#define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d)) -#define ZSTD_pthread_join(a, b) pthread_join((a),(b)) - -#else /* DEBUGLEVEL >= 1 */ - -/* Debug implementation of threading. - * In this implementation we use pointers for mutexes and condition variables. - * This way, if we forget to init/destroy them the program will crash or ASAN - * will report leaks. - */ - -#define ZSTD_pthread_mutex_t pthread_mutex_t* -int ZSTD_pthread_mutex_init(ZSTD_pthread_mutex_t* mutex, pthread_mutexattr_t const* attr); -int ZSTD_pthread_mutex_destroy(ZSTD_pthread_mutex_t* mutex); -#define ZSTD_pthread_mutex_lock(a) pthread_mutex_lock(*(a)) -#define ZSTD_pthread_mutex_unlock(a) pthread_mutex_unlock(*(a)) - -#define ZSTD_pthread_cond_t pthread_cond_t* -int ZSTD_pthread_cond_init(ZSTD_pthread_cond_t* cond, pthread_condattr_t const* attr); -int ZSTD_pthread_cond_destroy(ZSTD_pthread_cond_t* cond); -#define ZSTD_pthread_cond_wait(a, b) pthread_cond_wait(*(a), *(b)) -#define ZSTD_pthread_cond_signal(a) pthread_cond_signal(*(a)) -#define ZSTD_pthread_cond_broadcast(a) pthread_cond_broadcast(*(a)) - -#define ZSTD_pthread_t pthread_t -#define ZSTD_pthread_create(a, b, c, d) pthread_create((a), (b), (c), (d)) -#define ZSTD_pthread_join(a, b) pthread_join((a),(b)) - -#endif - -#else /* ZSTD_MULTITHREAD not defined */ -/* No multithreading support */ - -typedef int ZSTD_pthread_mutex_t; -#define ZSTD_pthread_mutex_init(a, b) ((void)(a), (void)(b), 0) -#define ZSTD_pthread_mutex_destroy(a) ((void)(a)) -#define ZSTD_pthread_mutex_lock(a) ((void)(a)) -#define ZSTD_pthread_mutex_unlock(a) ((void)(a)) - -typedef int ZSTD_pthread_cond_t; -#define ZSTD_pthread_cond_init(a, b) ((void)(a), (void)(b), 0) -#define ZSTD_pthread_cond_destroy(a) ((void)(a)) -#define ZSTD_pthread_cond_wait(a, b) ((void)(a), (void)(b)) -#define ZSTD_pthread_cond_signal(a) ((void)(a)) -#define ZSTD_pthread_cond_broadcast(a) ((void)(a)) - -/* do not use ZSTD_pthread_t */ - -#endif /* ZSTD_MULTITHREAD */ - -#if defined (__cplusplus) -} -#endif - -#endif /* THREADING_H_938743 */ diff --git a/vendor/github.com/DataDog/zstd/travis_test_32.sh b/vendor/github.com/DataDog/zstd/travis_test_32.sh deleted file mode 100644 index 4a0debc8..00000000 --- a/vendor/github.com/DataDog/zstd/travis_test_32.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Get utilities -yum -y -q -e 0 install wget tar unzip gcc - -# Get Go -wget -q https://dl.google.com/go/go1.13.linux-386.tar.gz -tar -C /usr/local -xzf go1.13.linux-386.tar.gz -export PATH=$PATH:/usr/local/go/bin - -# Get payload -wget -q https://github.com/DataDog/zstd/files/2246767/mr.zip -unzip mr.zip - -# Build and run tests -go build -PAYLOAD=$(pwd)/mr go test -v -PAYLOAD=$(pwd)/mr go test -bench . diff --git a/vendor/github.com/DataDog/zstd/update.txt b/vendor/github.com/DataDog/zstd/update.txt deleted file mode 100644 index 1de939f7..00000000 --- a/vendor/github.com/DataDog/zstd/update.txt +++ /dev/null @@ -1,56 +0,0 @@ -./lib/common/bitstream.h -./lib/common/compiler.h -./lib/compress/zstd_compress_internal.h -./lib/compress/zstd_fast.h -./lib/compress/zstd_double_fast.h -./lib/compress/zstd_lazy.h -./lib/compress/zstd_ldm.h -./lib/dictBuilder/cover.c -./lib/dictBuilder/divsufsort.c -./lib/dictBuilder/divsufsort.h -./lib/common/entropy_common.c -./lib/common/error_private.c -./lib/common/error_private.h -./lib/compress/fse_compress.c -./lib/common/fse_decompress.c -./lib/common/fse.h -./lib/compress/huf_compress.c -./lib/decompress/huf_decompress.c -./lib/common/huf.h -./lib/common/mem.h -./lib/common/pool.c -./lib/common/pool.h -./lib/common/threading.c -./lib/common/threading.h -./lib/common/xxhash.c -./lib/common/xxhash.h -./lib/deprecated/zbuff_common.c -./lib/deprecated/zbuff_compress.c -./lib/deprecated/zbuff_decompress.c -./lib/deprecated/zbuff.h -./lib/dictBuilder/zdict.c -./lib/dictBuilder/zdict.h -./lib/common/zstd_common.c -./lib/compress/zstd_compress.c -./lib/decompress/zstd_decompress.c -./lib/common/zstd_errors.h -./lib/zstd.h -./lib/common/zstd_internal.h -./lib/legacy/zstd_legacy.h -./lib/compress/zstd_opt.c -./lib/compress/zstd_opt.h -./lib/legacy/zstd_v01.c -./lib/legacy/zstd_v01.h -./lib/legacy/zstd_v02.c -./lib/legacy/zstd_v02.h -./lib/legacy/zstd_v03.c -./lib/legacy/zstd_v03.h -./lib/legacy/zstd_v04.c -./lib/legacy/zstd_v04.h -./lib/legacy/zstd_v05.c -./lib/legacy/zstd_v05.h -./lib/legacy/zstd_v06.c -./lib/legacy/zstd_v06.h -./lib/legacy/zstd_v07.c -./lib/legacy/zstd_v07.h - diff --git a/vendor/github.com/DataDog/zstd/xxhash.c b/vendor/github.com/DataDog/zstd/xxhash.c deleted file mode 100644 index 99d24596..00000000 --- a/vendor/github.com/DataDog/zstd/xxhash.c +++ /dev/null @@ -1,882 +0,0 @@ -/* -* xxHash - Fast Hash algorithm -* Copyright (C) 2012-2016, Yann Collet -* -* BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are -* met: -* -* * Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* * Redistributions in binary form must reproduce the above -* copyright notice, this list of conditions and the following disclaimer -* in the documentation and/or other materials provided with the -* distribution. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* You can contact the author at : -* - xxHash homepage: http://www.xxhash.com -* - xxHash source repository : https://github.com/Cyan4973/xxHash -*/ - - -/* ************************************* -* Tuning parameters -***************************************/ -/*!XXH_FORCE_MEMORY_ACCESS : - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method doesn't depend on compiler but violate C standard. - * It can generate buggy code on targets which do not support unaligned memory accesses. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://stackoverflow.com/a/32095106/646947 for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef XXH_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define XXH_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) || \ - defined(__ICCARM__) -# define XXH_FORCE_MEMORY_ACCESS 1 -# endif -#endif - -/*!XXH_ACCEPT_NULL_INPUT_POINTER : - * If the input pointer is a null pointer, xxHash default behavior is to trigger a memory access error, since it is a bad pointer. - * When this option is enabled, xxHash output for null input pointers will be the same as a null-length input. - * By default, this option is disabled. To enable it, uncomment below define : - */ -/* #define XXH_ACCEPT_NULL_INPUT_POINTER 1 */ - -/*!XXH_FORCE_NATIVE_FORMAT : - * By default, xxHash library provides endian-independent Hash values, based on little-endian convention. - * Results are therefore identical for little-endian and big-endian CPU. - * This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format. - * Should endian-independence be of no importance for your application, you may set the #define below to 1, - * to improve speed for Big-endian CPU. - * This option has no impact on Little_Endian CPU. - */ -#ifndef XXH_FORCE_NATIVE_FORMAT /* can be defined externally */ -# define XXH_FORCE_NATIVE_FORMAT 0 -#endif - -/*!XXH_FORCE_ALIGN_CHECK : - * This is a minor performance trick, only useful with lots of very small keys. - * It means : check for aligned/unaligned input. - * The check costs one initial branch per hash; set to 0 when the input data - * is guaranteed to be aligned. - */ -#ifndef XXH_FORCE_ALIGN_CHECK /* can be defined externally */ -# if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) -# define XXH_FORCE_ALIGN_CHECK 0 -# else -# define XXH_FORCE_ALIGN_CHECK 1 -# endif -#endif - - -/* ************************************* -* Includes & Memory related functions -***************************************/ -/* Modify the local functions below should you wish to use some other memory routines */ -/* for malloc(), free() */ -#include -#include /* size_t */ -static void* XXH_malloc(size_t s) { return malloc(s); } -static void XXH_free (void* p) { free(p); } -/* for memcpy() */ -#include -static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcpy(dest,src,size); } - -#ifndef XXH_STATIC_LINKING_ONLY -# define XXH_STATIC_LINKING_ONLY -#endif -#include "xxhash.h" - - -/* ************************************* -* Compiler Specific Options -***************************************/ -#if defined (__GNUC__) || defined(__cplusplus) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# define INLINE_KEYWORD inline -#else -# define INLINE_KEYWORD -#endif - -#if defined(__GNUC__) || defined(__ICCARM__) -# define FORCE_INLINE_ATTR __attribute__((always_inline)) -#elif defined(_MSC_VER) -# define FORCE_INLINE_ATTR __forceinline -#else -# define FORCE_INLINE_ATTR -#endif - -#define FORCE_INLINE_TEMPLATE static INLINE_KEYWORD FORCE_INLINE_ATTR - - -#ifdef _MSC_VER -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -#endif - - -/* ************************************* -* Basic Types -***************************************/ -#ifndef MEM_MODULE -# define MEM_MODULE -# if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) ) -# include - typedef uint8_t BYTE; - typedef uint16_t U16; - typedef uint32_t U32; - typedef int32_t S32; - typedef uint64_t U64; -# else - typedef unsigned char BYTE; - typedef unsigned short U16; - typedef unsigned int U32; - typedef signed int S32; - typedef unsigned long long U64; /* if your compiler doesn't support unsigned long long, replace by another 64-bit type here. Note that xxhash.h will also need to be updated. */ -# endif -#endif - - -#if (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==2)) - -/* Force direct memory access. Only works on CPU which support unaligned memory access in hardware */ -static U32 XXH_read32(const void* memPtr) { return *(const U32*) memPtr; } -static U64 XXH_read64(const void* memPtr) { return *(const U64*) memPtr; } - -#elif (defined(XXH_FORCE_MEMORY_ACCESS) && (XXH_FORCE_MEMORY_ACCESS==1)) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U32 u32; U64 u64; } __attribute__((packed)) unalign; - -static U32 XXH_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -static U64 XXH_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -#else - -/* portable and safe solution. Generally efficient. - * see : http://stackoverflow.com/a/32095106/646947 - */ - -static U32 XXH_read32(const void* memPtr) -{ - U32 val; - memcpy(&val, memPtr, sizeof(val)); - return val; -} - -static U64 XXH_read64(const void* memPtr) -{ - U64 val; - memcpy(&val, memPtr, sizeof(val)); - return val; -} - -#endif /* XXH_FORCE_DIRECT_MEMORY_ACCESS */ - - -/* **************************************** -* Compiler-specific Functions and Macros -******************************************/ -#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) - -/* Note : although _rotl exists for minGW (GCC under windows), performance seems poor */ -#if defined(_MSC_VER) -# define XXH_rotl32(x,r) _rotl(x,r) -# define XXH_rotl64(x,r) _rotl64(x,r) -#else -#if defined(__ICCARM__) -# include -# define XXH_rotl32(x,r) __ROR(x,(32 - r)) -#else -# define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r))) -#endif -# define XXH_rotl64(x,r) ((x << r) | (x >> (64 - r))) -#endif - -#if defined(_MSC_VER) /* Visual Studio */ -# define XXH_swap32 _byteswap_ulong -# define XXH_swap64 _byteswap_uint64 -#elif GCC_VERSION >= 403 -# define XXH_swap32 __builtin_bswap32 -# define XXH_swap64 __builtin_bswap64 -#else -static U32 XXH_swap32 (U32 x) -{ - return ((x << 24) & 0xff000000 ) | - ((x << 8) & 0x00ff0000 ) | - ((x >> 8) & 0x0000ff00 ) | - ((x >> 24) & 0x000000ff ); -} -static U64 XXH_swap64 (U64 x) -{ - return ((x << 56) & 0xff00000000000000ULL) | - ((x << 40) & 0x00ff000000000000ULL) | - ((x << 24) & 0x0000ff0000000000ULL) | - ((x << 8) & 0x000000ff00000000ULL) | - ((x >> 8) & 0x00000000ff000000ULL) | - ((x >> 24) & 0x0000000000ff0000ULL) | - ((x >> 40) & 0x000000000000ff00ULL) | - ((x >> 56) & 0x00000000000000ffULL); -} -#endif - - -/* ************************************* -* Architecture Macros -***************************************/ -typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; - -/* XXH_CPU_LITTLE_ENDIAN can be defined externally, for example on the compiler command line */ -#ifndef XXH_CPU_LITTLE_ENDIAN - static const int g_one = 1; -# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&g_one)) -#endif - - -/* *************************** -* Memory reads -*****************************/ -typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; - -FORCE_INLINE_TEMPLATE U32 XXH_readLE32_align(const void* ptr, XXH_endianess endian, XXH_alignment align) -{ - if (align==XXH_unaligned) - return endian==XXH_littleEndian ? XXH_read32(ptr) : XXH_swap32(XXH_read32(ptr)); - else - return endian==XXH_littleEndian ? *(const U32*)ptr : XXH_swap32(*(const U32*)ptr); -} - -FORCE_INLINE_TEMPLATE U32 XXH_readLE32(const void* ptr, XXH_endianess endian) -{ - return XXH_readLE32_align(ptr, endian, XXH_unaligned); -} - -static U32 XXH_readBE32(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_swap32(XXH_read32(ptr)) : XXH_read32(ptr); -} - -FORCE_INLINE_TEMPLATE U64 XXH_readLE64_align(const void* ptr, XXH_endianess endian, XXH_alignment align) -{ - if (align==XXH_unaligned) - return endian==XXH_littleEndian ? XXH_read64(ptr) : XXH_swap64(XXH_read64(ptr)); - else - return endian==XXH_littleEndian ? *(const U64*)ptr : XXH_swap64(*(const U64*)ptr); -} - -FORCE_INLINE_TEMPLATE U64 XXH_readLE64(const void* ptr, XXH_endianess endian) -{ - return XXH_readLE64_align(ptr, endian, XXH_unaligned); -} - -static U64 XXH_readBE64(const void* ptr) -{ - return XXH_CPU_LITTLE_ENDIAN ? XXH_swap64(XXH_read64(ptr)) : XXH_read64(ptr); -} - - -/* ************************************* -* Macros -***************************************/ -#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ - - -/* ************************************* -* Constants -***************************************/ -static const U32 PRIME32_1 = 2654435761U; -static const U32 PRIME32_2 = 2246822519U; -static const U32 PRIME32_3 = 3266489917U; -static const U32 PRIME32_4 = 668265263U; -static const U32 PRIME32_5 = 374761393U; - -static const U64 PRIME64_1 = 11400714785074694791ULL; -static const U64 PRIME64_2 = 14029467366897019727ULL; -static const U64 PRIME64_3 = 1609587929392839161ULL; -static const U64 PRIME64_4 = 9650029242287828579ULL; -static const U64 PRIME64_5 = 2870177450012600261ULL; - -XXH_PUBLIC_API unsigned XXH_versionNumber (void) { return XXH_VERSION_NUMBER; } - - -/* ************************** -* Utils -****************************/ -XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* restrict dstState, const XXH32_state_t* restrict srcState) -{ - memcpy(dstState, srcState, sizeof(*dstState)); -} - -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* restrict dstState, const XXH64_state_t* restrict srcState) -{ - memcpy(dstState, srcState, sizeof(*dstState)); -} - - -/* *************************** -* Simple Hash Functions -*****************************/ - -static U32 XXH32_round(U32 seed, U32 input) -{ - seed += input * PRIME32_2; - seed = XXH_rotl32(seed, 13); - seed *= PRIME32_1; - return seed; -} - -FORCE_INLINE_TEMPLATE U32 XXH32_endian_align(const void* input, size_t len, U32 seed, XXH_endianess endian, XXH_alignment align) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* bEnd = p + len; - U32 h32; -#define XXH_get32bits(p) XXH_readLE32_align(p, endian, align) - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (p==NULL) { - len=0; - bEnd=p=(const BYTE*)(size_t)16; - } -#endif - - if (len>=16) { - const BYTE* const limit = bEnd - 16; - U32 v1 = seed + PRIME32_1 + PRIME32_2; - U32 v2 = seed + PRIME32_2; - U32 v3 = seed + 0; - U32 v4 = seed - PRIME32_1; - - do { - v1 = XXH32_round(v1, XXH_get32bits(p)); p+=4; - v2 = XXH32_round(v2, XXH_get32bits(p)); p+=4; - v3 = XXH32_round(v3, XXH_get32bits(p)); p+=4; - v4 = XXH32_round(v4, XXH_get32bits(p)); p+=4; - } while (p<=limit); - - h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); - } else { - h32 = seed + PRIME32_5; - } - - h32 += (U32) len; - - while (p+4<=bEnd) { - h32 += XXH_get32bits(p) * PRIME32_3; - h32 = XXH_rotl32(h32, 17) * PRIME32_4 ; - p+=4; - } - - while (p> 15; - h32 *= PRIME32_2; - h32 ^= h32 >> 13; - h32 *= PRIME32_3; - h32 ^= h32 >> 16; - - return h32; -} - - -XXH_PUBLIC_API unsigned int XXH32 (const void* input, size_t len, unsigned int seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH32_CREATESTATE_STATIC(state); - XXH32_reset(state, seed); - XXH32_update(state, input, len); - return XXH32_digest(state); -#else - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if (XXH_FORCE_ALIGN_CHECK) { - if ((((size_t)input) & 3) == 0) { /* Input is 4-bytes aligned, leverage the speed benefit */ - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); - else - return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); - } } - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); - else - return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); -#endif -} - - -static U64 XXH64_round(U64 acc, U64 input) -{ - acc += input * PRIME64_2; - acc = XXH_rotl64(acc, 31); - acc *= PRIME64_1; - return acc; -} - -static U64 XXH64_mergeRound(U64 acc, U64 val) -{ - val = XXH64_round(0, val); - acc ^= val; - acc = acc * PRIME64_1 + PRIME64_4; - return acc; -} - -FORCE_INLINE_TEMPLATE U64 XXH64_endian_align(const void* input, size_t len, U64 seed, XXH_endianess endian, XXH_alignment align) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - U64 h64; -#define XXH_get64bits(p) XXH_readLE64_align(p, endian, align) - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (p==NULL) { - len=0; - bEnd=p=(const BYTE*)(size_t)32; - } -#endif - - if (len>=32) { - const BYTE* const limit = bEnd - 32; - U64 v1 = seed + PRIME64_1 + PRIME64_2; - U64 v2 = seed + PRIME64_2; - U64 v3 = seed + 0; - U64 v4 = seed - PRIME64_1; - - do { - v1 = XXH64_round(v1, XXH_get64bits(p)); p+=8; - v2 = XXH64_round(v2, XXH_get64bits(p)); p+=8; - v3 = XXH64_round(v3, XXH_get64bits(p)); p+=8; - v4 = XXH64_round(v4, XXH_get64bits(p)); p+=8; - } while (p<=limit); - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - h64 = XXH64_mergeRound(h64, v1); - h64 = XXH64_mergeRound(h64, v2); - h64 = XXH64_mergeRound(h64, v3); - h64 = XXH64_mergeRound(h64, v4); - - } else { - h64 = seed + PRIME64_5; - } - - h64 += (U64) len; - - while (p+8<=bEnd) { - U64 const k1 = XXH64_round(0, XXH_get64bits(p)); - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; - p+=8; - } - - if (p+4<=bEnd) { - h64 ^= (U64)(XXH_get32bits(p)) * PRIME64_1; - h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; - p+=4; - } - - while (p> 33; - h64 *= PRIME64_2; - h64 ^= h64 >> 29; - h64 *= PRIME64_3; - h64 ^= h64 >> 32; - - return h64; -} - - -XXH_PUBLIC_API unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed) -{ -#if 0 - /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ - XXH64_CREATESTATE_STATIC(state); - XXH64_reset(state, seed); - XXH64_update(state, input, len); - return XXH64_digest(state); -#else - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if (XXH_FORCE_ALIGN_CHECK) { - if ((((size_t)input) & 7)==0) { /* Input is aligned, let's leverage the speed advantage */ - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); - else - return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); - } } - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); - else - return XXH64_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); -#endif -} - - -/* ************************************************** -* Advanced Hash Functions -****************************************************/ - -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void) -{ - return (XXH32_state_t*)XXH_malloc(sizeof(XXH32_state_t)); -} -XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void) -{ - return (XXH64_state_t*)XXH_malloc(sizeof(XXH64_state_t)); -} -XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr) -{ - XXH_free(statePtr); - return XXH_OK; -} - - -/*** Hash feed ***/ - -XXH_PUBLIC_API XXH_errorcode XXH32_reset(XXH32_state_t* statePtr, unsigned int seed) -{ - XXH32_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ - memset(&state, 0, sizeof(state)-4); /* do not write into reserved, for future removal */ - state.v1 = seed + PRIME32_1 + PRIME32_2; - state.v2 = seed + PRIME32_2; - state.v3 = seed + 0; - state.v4 = seed - PRIME32_1; - memcpy(statePtr, &state, sizeof(state)); - return XXH_OK; -} - - -XXH_PUBLIC_API XXH_errorcode XXH64_reset(XXH64_state_t* statePtr, unsigned long long seed) -{ - XXH64_state_t state; /* using a local state to memcpy() in order to avoid strict-aliasing warnings */ - memset(&state, 0, sizeof(state)-8); /* do not write into reserved, for future removal */ - state.v1 = seed + PRIME64_1 + PRIME64_2; - state.v2 = seed + PRIME64_2; - state.v3 = seed + 0; - state.v4 = seed - PRIME64_1; - memcpy(statePtr, &state, sizeof(state)); - return XXH_OK; -} - - -FORCE_INLINE_TEMPLATE XXH_errorcode XXH32_update_endian (XXH32_state_t* state, const void* input, size_t len, XXH_endianess endian) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (input==NULL) return XXH_ERROR; -#endif - - state->total_len_32 += (unsigned)len; - state->large_len |= (len>=16) | (state->total_len_32>=16); - - if (state->memsize + len < 16) { /* fill in tmp buffer */ - XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, len); - state->memsize += (unsigned)len; - return XXH_OK; - } - - if (state->memsize) { /* some data left from previous update */ - XXH_memcpy((BYTE*)(state->mem32) + state->memsize, input, 16-state->memsize); - { const U32* p32 = state->mem32; - state->v1 = XXH32_round(state->v1, XXH_readLE32(p32, endian)); p32++; - state->v2 = XXH32_round(state->v2, XXH_readLE32(p32, endian)); p32++; - state->v3 = XXH32_round(state->v3, XXH_readLE32(p32, endian)); p32++; - state->v4 = XXH32_round(state->v4, XXH_readLE32(p32, endian)); p32++; - } - p += 16-state->memsize; - state->memsize = 0; - } - - if (p <= bEnd-16) { - const BYTE* const limit = bEnd - 16; - U32 v1 = state->v1; - U32 v2 = state->v2; - U32 v3 = state->v3; - U32 v4 = state->v4; - - do { - v1 = XXH32_round(v1, XXH_readLE32(p, endian)); p+=4; - v2 = XXH32_round(v2, XXH_readLE32(p, endian)); p+=4; - v3 = XXH32_round(v3, XXH_readLE32(p, endian)); p+=4; - v4 = XXH32_round(v4, XXH_readLE32(p, endian)); p+=4; - } while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) { - XXH_memcpy(state->mem32, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); - } - - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* state_in, const void* input, size_t len) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_update_endian(state_in, input, len, XXH_littleEndian); - else - return XXH32_update_endian(state_in, input, len, XXH_bigEndian); -} - - - -FORCE_INLINE_TEMPLATE U32 XXH32_digest_endian (const XXH32_state_t* state, XXH_endianess endian) -{ - const BYTE * p = (const BYTE*)state->mem32; - const BYTE* const bEnd = (const BYTE*)(state->mem32) + state->memsize; - U32 h32; - - if (state->large_len) { - h32 = XXH_rotl32(state->v1, 1) + XXH_rotl32(state->v2, 7) + XXH_rotl32(state->v3, 12) + XXH_rotl32(state->v4, 18); - } else { - h32 = state->v3 /* == seed */ + PRIME32_5; - } - - h32 += state->total_len_32; - - while (p+4<=bEnd) { - h32 += XXH_readLE32(p, endian) * PRIME32_3; - h32 = XXH_rotl32(h32, 17) * PRIME32_4; - p+=4; - } - - while (p> 15; - h32 *= PRIME32_2; - h32 ^= h32 >> 13; - h32 *= PRIME32_3; - h32 ^= h32 >> 16; - - return h32; -} - - -XXH_PUBLIC_API unsigned int XXH32_digest (const XXH32_state_t* state_in) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH32_digest_endian(state_in, XXH_littleEndian); - else - return XXH32_digest_endian(state_in, XXH_bigEndian); -} - - - -/* **** XXH64 **** */ - -FORCE_INLINE_TEMPLATE XXH_errorcode XXH64_update_endian (XXH64_state_t* state, const void* input, size_t len, XXH_endianess endian) -{ - const BYTE* p = (const BYTE*)input; - const BYTE* const bEnd = p + len; - -#ifdef XXH_ACCEPT_NULL_INPUT_POINTER - if (input==NULL) return XXH_ERROR; -#endif - - state->total_len += len; - - if (state->memsize + len < 32) { /* fill in tmp buffer */ - XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, len); - state->memsize += (U32)len; - return XXH_OK; - } - - if (state->memsize) { /* tmp buffer is full */ - XXH_memcpy(((BYTE*)state->mem64) + state->memsize, input, 32-state->memsize); - state->v1 = XXH64_round(state->v1, XXH_readLE64(state->mem64+0, endian)); - state->v2 = XXH64_round(state->v2, XXH_readLE64(state->mem64+1, endian)); - state->v3 = XXH64_round(state->v3, XXH_readLE64(state->mem64+2, endian)); - state->v4 = XXH64_round(state->v4, XXH_readLE64(state->mem64+3, endian)); - p += 32-state->memsize; - state->memsize = 0; - } - - if (p+32 <= bEnd) { - const BYTE* const limit = bEnd - 32; - U64 v1 = state->v1; - U64 v2 = state->v2; - U64 v3 = state->v3; - U64 v4 = state->v4; - - do { - v1 = XXH64_round(v1, XXH_readLE64(p, endian)); p+=8; - v2 = XXH64_round(v2, XXH_readLE64(p, endian)); p+=8; - v3 = XXH64_round(v3, XXH_readLE64(p, endian)); p+=8; - v4 = XXH64_round(v4, XXH_readLE64(p, endian)); p+=8; - } while (p<=limit); - - state->v1 = v1; - state->v2 = v2; - state->v3 = v3; - state->v4 = v4; - } - - if (p < bEnd) { - XXH_memcpy(state->mem64, p, (size_t)(bEnd-p)); - state->memsize = (unsigned)(bEnd-p); - } - - return XXH_OK; -} - -XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* state_in, const void* input, size_t len) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_update_endian(state_in, input, len, XXH_littleEndian); - else - return XXH64_update_endian(state_in, input, len, XXH_bigEndian); -} - - - -FORCE_INLINE_TEMPLATE U64 XXH64_digest_endian (const XXH64_state_t* state, XXH_endianess endian) -{ - const BYTE * p = (const BYTE*)state->mem64; - const BYTE* const bEnd = (const BYTE*)state->mem64 + state->memsize; - U64 h64; - - if (state->total_len >= 32) { - U64 const v1 = state->v1; - U64 const v2 = state->v2; - U64 const v3 = state->v3; - U64 const v4 = state->v4; - - h64 = XXH_rotl64(v1, 1) + XXH_rotl64(v2, 7) + XXH_rotl64(v3, 12) + XXH_rotl64(v4, 18); - h64 = XXH64_mergeRound(h64, v1); - h64 = XXH64_mergeRound(h64, v2); - h64 = XXH64_mergeRound(h64, v3); - h64 = XXH64_mergeRound(h64, v4); - } else { - h64 = state->v3 + PRIME64_5; - } - - h64 += (U64) state->total_len; - - while (p+8<=bEnd) { - U64 const k1 = XXH64_round(0, XXH_readLE64(p, endian)); - h64 ^= k1; - h64 = XXH_rotl64(h64,27) * PRIME64_1 + PRIME64_4; - p+=8; - } - - if (p+4<=bEnd) { - h64 ^= (U64)(XXH_readLE32(p, endian)) * PRIME64_1; - h64 = XXH_rotl64(h64, 23) * PRIME64_2 + PRIME64_3; - p+=4; - } - - while (p> 33; - h64 *= PRIME64_2; - h64 ^= h64 >> 29; - h64 *= PRIME64_3; - h64 ^= h64 >> 32; - - return h64; -} - - -XXH_PUBLIC_API unsigned long long XXH64_digest (const XXH64_state_t* state_in) -{ - XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; - - if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) - return XXH64_digest_endian(state_in, XXH_littleEndian); - else - return XXH64_digest_endian(state_in, XXH_bigEndian); -} - - -/* ************************** -* Canonical representation -****************************/ - -/*! Default XXH result types are basic unsigned 32 and 64 bits. -* The canonical representation follows human-readable write convention, aka big-endian (large digits first). -* These functions allow transformation of hash result into and from its canonical format. -* This way, hash values can be written into a file or buffer, and remain comparable across different systems and programs. -*/ - -XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash) -{ - XXH_STATIC_ASSERT(sizeof(XXH32_canonical_t) == sizeof(XXH32_hash_t)); - if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap32(hash); - memcpy(dst, &hash, sizeof(*dst)); -} - -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash) -{ - XXH_STATIC_ASSERT(sizeof(XXH64_canonical_t) == sizeof(XXH64_hash_t)); - if (XXH_CPU_LITTLE_ENDIAN) hash = XXH_swap64(hash); - memcpy(dst, &hash, sizeof(*dst)); -} - -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src) -{ - return XXH_readBE32(src); -} - -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src) -{ - return XXH_readBE64(src); -} diff --git a/vendor/github.com/DataDog/zstd/xxhash.h b/vendor/github.com/DataDog/zstd/xxhash.h deleted file mode 100644 index 9bad1f59..00000000 --- a/vendor/github.com/DataDog/zstd/xxhash.h +++ /dev/null @@ -1,305 +0,0 @@ -/* - xxHash - Extremely Fast Hash algorithm - Header File - Copyright (C) 2012-2016, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - xxHash source repository : https://github.com/Cyan4973/xxHash -*/ - -/* Notice extracted from xxHash homepage : - -xxHash is an extremely fast Hash algorithm, running at RAM speed limits. -It also successfully passes all tests from the SMHasher suite. - -Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2 Duo @3GHz) - -Name Speed Q.Score Author -xxHash 5.4 GB/s 10 -CrapWow 3.2 GB/s 2 Andrew -MumurHash 3a 2.7 GB/s 10 Austin Appleby -SpookyHash 2.0 GB/s 10 Bob Jenkins -SBox 1.4 GB/s 9 Bret Mulvey -Lookup3 1.2 GB/s 9 Bob Jenkins -SuperFastHash 1.2 GB/s 1 Paul Hsieh -CityHash64 1.05 GB/s 10 Pike & Alakuijala -FNV 0.55 GB/s 5 Fowler, Noll, Vo -CRC32 0.43 GB/s 9 -MD5-32 0.33 GB/s 10 Ronald L. Rivest -SHA1-32 0.28 GB/s 10 - -Q.Score is a measure of quality of the hash function. -It depends on successfully passing SMHasher test set. -10 is a perfect score. - -A 64-bits version, named XXH64, is available since r35. -It offers much better speed, but for 64-bits applications only. -Name Speed on 64 bits Speed on 32 bits -XXH64 13.8 GB/s 1.9 GB/s -XXH32 6.8 GB/s 6.0 GB/s -*/ - -#if defined (__cplusplus) -extern "C" { -#endif - -#ifndef XXHASH_H_5627135585666179 -#define XXHASH_H_5627135585666179 1 - - -/* **************************** -* Definitions -******************************/ -#include /* size_t */ -typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; - - -/* **************************** -* API modifier -******************************/ -/** XXH_PRIVATE_API -* This is useful if you want to include xxhash functions in `static` mode -* in order to inline them, and remove their symbol from the public list. -* Methodology : -* #define XXH_PRIVATE_API -* #include "xxhash.h" -* `xxhash.c` is automatically included. -* It's not useful to compile and link it as a separate module anymore. -*/ -#ifdef XXH_PRIVATE_API -# ifndef XXH_STATIC_LINKING_ONLY -# define XXH_STATIC_LINKING_ONLY -# endif -# if defined(__GNUC__) -# define XXH_PUBLIC_API static __inline __attribute__((unused)) -# elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define XXH_PUBLIC_API static inline -# elif defined(_MSC_VER) -# define XXH_PUBLIC_API static __inline -# else -# define XXH_PUBLIC_API static /* this version may generate warnings for unused static functions; disable the relevant warning */ -# endif -#else -# define XXH_PUBLIC_API /* do nothing */ -#endif /* XXH_PRIVATE_API */ - -/*!XXH_NAMESPACE, aka Namespace Emulation : - -If you want to include _and expose_ xxHash functions from within your own library, -but also want to avoid symbol collisions with another library which also includes xxHash, - -you can use XXH_NAMESPACE, to automatically prefix any public symbol from xxhash library -with the value of XXH_NAMESPACE (so avoid to keep it NULL and avoid numeric values). - -Note that no change is required within the calling program as long as it includes `xxhash.h` : -regular symbol name will be automatically translated by this header. -*/ -#ifdef XXH_NAMESPACE -# define XXH_CAT(A,B) A##B -# define XXH_NAME2(A,B) XXH_CAT(A,B) -# define XXH32 XXH_NAME2(XXH_NAMESPACE, XXH32) -# define XXH64 XXH_NAME2(XXH_NAMESPACE, XXH64) -# define XXH_versionNumber XXH_NAME2(XXH_NAMESPACE, XXH_versionNumber) -# define XXH32_createState XXH_NAME2(XXH_NAMESPACE, XXH32_createState) -# define XXH64_createState XXH_NAME2(XXH_NAMESPACE, XXH64_createState) -# define XXH32_freeState XXH_NAME2(XXH_NAMESPACE, XXH32_freeState) -# define XXH64_freeState XXH_NAME2(XXH_NAMESPACE, XXH64_freeState) -# define XXH32_reset XXH_NAME2(XXH_NAMESPACE, XXH32_reset) -# define XXH64_reset XXH_NAME2(XXH_NAMESPACE, XXH64_reset) -# define XXH32_update XXH_NAME2(XXH_NAMESPACE, XXH32_update) -# define XXH64_update XXH_NAME2(XXH_NAMESPACE, XXH64_update) -# define XXH32_digest XXH_NAME2(XXH_NAMESPACE, XXH32_digest) -# define XXH64_digest XXH_NAME2(XXH_NAMESPACE, XXH64_digest) -# define XXH32_copyState XXH_NAME2(XXH_NAMESPACE, XXH32_copyState) -# define XXH64_copyState XXH_NAME2(XXH_NAMESPACE, XXH64_copyState) -# define XXH32_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH32_canonicalFromHash) -# define XXH64_canonicalFromHash XXH_NAME2(XXH_NAMESPACE, XXH64_canonicalFromHash) -# define XXH32_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH32_hashFromCanonical) -# define XXH64_hashFromCanonical XXH_NAME2(XXH_NAMESPACE, XXH64_hashFromCanonical) -#endif - - -/* ************************************* -* Version -***************************************/ -#define XXH_VERSION_MAJOR 0 -#define XXH_VERSION_MINOR 6 -#define XXH_VERSION_RELEASE 2 -#define XXH_VERSION_NUMBER (XXH_VERSION_MAJOR *100*100 + XXH_VERSION_MINOR *100 + XXH_VERSION_RELEASE) -XXH_PUBLIC_API unsigned XXH_versionNumber (void); - - -/* **************************** -* Simple Hash Functions -******************************/ -typedef unsigned int XXH32_hash_t; -typedef unsigned long long XXH64_hash_t; - -XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, unsigned int seed); -XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, unsigned long long seed); - -/*! -XXH32() : - Calculate the 32-bits hash of sequence "length" bytes stored at memory address "input". - The memory between input & input+length must be valid (allocated and read-accessible). - "seed" can be used to alter the result predictably. - Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s -XXH64() : - Calculate the 64-bits hash of sequence of length "len" stored at memory address "input". - "seed" can be used to alter the result predictably. - This function runs 2x faster on 64-bits systems, but slower on 32-bits systems (see benchmark). -*/ - - -/* **************************** -* Streaming Hash Functions -******************************/ -typedef struct XXH32_state_s XXH32_state_t; /* incomplete type */ -typedef struct XXH64_state_s XXH64_state_t; /* incomplete type */ - -/*! State allocation, compatible with dynamic libraries */ - -XXH_PUBLIC_API XXH32_state_t* XXH32_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH32_freeState(XXH32_state_t* statePtr); - -XXH_PUBLIC_API XXH64_state_t* XXH64_createState(void); -XXH_PUBLIC_API XXH_errorcode XXH64_freeState(XXH64_state_t* statePtr); - - -/* hash streaming */ - -XXH_PUBLIC_API XXH_errorcode XXH32_reset (XXH32_state_t* statePtr, unsigned int seed); -XXH_PUBLIC_API XXH_errorcode XXH32_update (XXH32_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH32_hash_t XXH32_digest (const XXH32_state_t* statePtr); - -XXH_PUBLIC_API XXH_errorcode XXH64_reset (XXH64_state_t* statePtr, unsigned long long seed); -XXH_PUBLIC_API XXH_errorcode XXH64_update (XXH64_state_t* statePtr, const void* input, size_t length); -XXH_PUBLIC_API XXH64_hash_t XXH64_digest (const XXH64_state_t* statePtr); - -/* -These functions generate the xxHash of an input provided in multiple segments. -Note that, for small input, they are slower than single-call functions, due to state management. -For small input, prefer `XXH32()` and `XXH64()` . - -XXH state must first be allocated, using XXH*_createState() . - -Start a new hash by initializing state with a seed, using XXH*_reset(). - -Then, feed the hash state by calling XXH*_update() as many times as necessary. -Obviously, input must be allocated and read accessible. -The function returns an error code, with 0 meaning OK, and any other value meaning there is an error. - -Finally, a hash value can be produced anytime, by using XXH*_digest(). -This function returns the nn-bits hash as an int or long long. - -It's still possible to continue inserting input into the hash state after a digest, -and generate some new hashes later on, by calling again XXH*_digest(). - -When done, free XXH state space if it was allocated dynamically. -*/ - - -/* ************************** -* Utils -****************************/ -#if !(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) /* ! C99 */ -# define restrict /* disable restrict */ -#endif - -XXH_PUBLIC_API void XXH32_copyState(XXH32_state_t* restrict dst_state, const XXH32_state_t* restrict src_state); -XXH_PUBLIC_API void XXH64_copyState(XXH64_state_t* restrict dst_state, const XXH64_state_t* restrict src_state); - - -/* ************************** -* Canonical representation -****************************/ -/* Default result type for XXH functions are primitive unsigned 32 and 64 bits. -* The canonical representation uses human-readable write convention, aka big-endian (large digits first). -* These functions allow transformation of hash result into and from its canonical format. -* This way, hash values can be written into a file / memory, and remain comparable on different systems and programs. -*/ -typedef struct { unsigned char digest[4]; } XXH32_canonical_t; -typedef struct { unsigned char digest[8]; } XXH64_canonical_t; - -XXH_PUBLIC_API void XXH32_canonicalFromHash(XXH32_canonical_t* dst, XXH32_hash_t hash); -XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); - -XXH_PUBLIC_API XXH32_hash_t XXH32_hashFromCanonical(const XXH32_canonical_t* src); -XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); - -#endif /* XXHASH_H_5627135585666179 */ - - - -/* ================================================================================================ - This section contains definitions which are not guaranteed to remain stable. - They may change in future versions, becoming incompatible with a different version of the library. - They shall only be used with static linking. - Never use these definitions in association with dynamic linking ! -=================================================================================================== */ -#if defined(XXH_STATIC_LINKING_ONLY) && !defined(XXH_STATIC_H_3543687687345) -#define XXH_STATIC_H_3543687687345 - -/* These definitions are only meant to allow allocation of XXH state - statically, on stack, or in a struct for example. - Do not use members directly. */ - - struct XXH32_state_s { - unsigned total_len_32; - unsigned large_len; - unsigned v1; - unsigned v2; - unsigned v3; - unsigned v4; - unsigned mem32[4]; /* buffer defined as U32 for alignment */ - unsigned memsize; - unsigned reserved; /* never read nor write, will be removed in a future version */ - }; /* typedef'd to XXH32_state_t */ - - struct XXH64_state_s { - unsigned long long total_len; - unsigned long long v1; - unsigned long long v2; - unsigned long long v3; - unsigned long long v4; - unsigned long long mem64[4]; /* buffer defined as U64 for alignment */ - unsigned memsize; - unsigned reserved[2]; /* never read nor write, will be removed in a future version */ - }; /* typedef'd to XXH64_state_t */ - - -# ifdef XXH_PRIVATE_API -# include "xxhash.c" /* include xxhash functions as `static`, for inlining */ -# endif - -#endif /* XXH_STATIC_LINKING_ONLY && XXH_STATIC_H_3543687687345 */ - - -#if defined (__cplusplus) -} -#endif diff --git a/vendor/github.com/DataDog/zstd/zbuff.h b/vendor/github.com/DataDog/zstd/zbuff.h deleted file mode 100644 index 04183eab..00000000 --- a/vendor/github.com/DataDog/zstd/zbuff.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/* *************************************************************** -* NOTES/WARNINGS -******************************************************************/ -/* The streaming API defined here is deprecated. - * Consider migrating towards ZSTD_compressStream() API in `zstd.h` - * See 'lib/README.md'. - *****************************************************************/ - - -#if defined (__cplusplus) -extern "C" { -#endif - -#ifndef ZSTD_BUFFERED_H_23987 -#define ZSTD_BUFFERED_H_23987 - -/* ************************************* -* Dependencies -***************************************/ -#include /* size_t */ -#include "zstd.h" /* ZSTD_CStream, ZSTD_DStream, ZSTDLIB_API */ - - -/* *************************************************************** -* Compiler specifics -*****************************************************************/ -/* Deprecation warnings */ -/* Should these warnings be a problem, - * it is generally possible to disable them, - * typically with -Wno-deprecated-declarations for gcc - * or _CRT_SECURE_NO_WARNINGS in Visual. - * Otherwise, it's also possible to define ZBUFF_DISABLE_DEPRECATE_WARNINGS - */ -#ifdef ZBUFF_DISABLE_DEPRECATE_WARNINGS -# define ZBUFF_DEPRECATED(message) ZSTDLIB_API /* disable deprecation warnings */ -#else -# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ -# define ZBUFF_DEPRECATED(message) [[deprecated(message)]] ZSTDLIB_API -# elif (defined(GNUC) && (GNUC > 4 || (GNUC == 4 && GNUC_MINOR >= 5))) || defined(__clang__) -# define ZBUFF_DEPRECATED(message) ZSTDLIB_API __attribute__((deprecated(message))) -# elif defined(__GNUC__) && (__GNUC__ >= 3) -# define ZBUFF_DEPRECATED(message) ZSTDLIB_API __attribute__((deprecated)) -# elif defined(_MSC_VER) -# define ZBUFF_DEPRECATED(message) ZSTDLIB_API __declspec(deprecated(message)) -# else -# pragma message("WARNING: You need to implement ZBUFF_DEPRECATED for this compiler") -# define ZBUFF_DEPRECATED(message) ZSTDLIB_API -# endif -#endif /* ZBUFF_DISABLE_DEPRECATE_WARNINGS */ - - -/* ************************************* -* Streaming functions -***************************************/ -/* This is the easier "buffered" streaming API, -* using an internal buffer to lift all restrictions on user-provided buffers -* which can be any size, any place, for both input and output. -* ZBUFF and ZSTD are 100% interoperable, -* frames created by one can be decoded by the other one */ - -typedef ZSTD_CStream ZBUFF_CCtx; -ZBUFF_DEPRECATED("use ZSTD_createCStream") ZBUFF_CCtx* ZBUFF_createCCtx(void); -ZBUFF_DEPRECATED("use ZSTD_freeCStream") size_t ZBUFF_freeCCtx(ZBUFF_CCtx* cctx); - -ZBUFF_DEPRECATED("use ZSTD_initCStream") size_t ZBUFF_compressInit(ZBUFF_CCtx* cctx, int compressionLevel); -ZBUFF_DEPRECATED("use ZSTD_initCStream_usingDict") size_t ZBUFF_compressInitDictionary(ZBUFF_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel); - -ZBUFF_DEPRECATED("use ZSTD_compressStream") size_t ZBUFF_compressContinue(ZBUFF_CCtx* cctx, void* dst, size_t* dstCapacityPtr, const void* src, size_t* srcSizePtr); -ZBUFF_DEPRECATED("use ZSTD_flushStream") size_t ZBUFF_compressFlush(ZBUFF_CCtx* cctx, void* dst, size_t* dstCapacityPtr); -ZBUFF_DEPRECATED("use ZSTD_endStream") size_t ZBUFF_compressEnd(ZBUFF_CCtx* cctx, void* dst, size_t* dstCapacityPtr); - -/*-************************************************* -* Streaming compression - howto -* -* A ZBUFF_CCtx object is required to track streaming operation. -* Use ZBUFF_createCCtx() and ZBUFF_freeCCtx() to create/release resources. -* ZBUFF_CCtx objects can be reused multiple times. -* -* Start by initializing ZBUF_CCtx. -* Use ZBUFF_compressInit() to start a new compression operation. -* Use ZBUFF_compressInitDictionary() for a compression which requires a dictionary. -* -* Use ZBUFF_compressContinue() repetitively to consume input stream. -* *srcSizePtr and *dstCapacityPtr can be any size. -* The function will report how many bytes were read or written within *srcSizePtr and *dstCapacityPtr. -* Note that it may not consume the entire input, in which case it's up to the caller to present again remaining data. -* The content of `dst` will be overwritten (up to *dstCapacityPtr) at each call, so save its content if it matters or change @dst . -* @return : a hint to preferred nb of bytes to use as input for next function call (it's just a hint, to improve latency) -* or an error code, which can be tested using ZBUFF_isError(). -* -* At any moment, it's possible to flush whatever data remains within buffer, using ZBUFF_compressFlush(). -* The nb of bytes written into `dst` will be reported into *dstCapacityPtr. -* Note that the function cannot output more than *dstCapacityPtr, -* therefore, some content might still be left into internal buffer if *dstCapacityPtr is too small. -* @return : nb of bytes still present into internal buffer (0 if it's empty) -* or an error code, which can be tested using ZBUFF_isError(). -* -* ZBUFF_compressEnd() instructs to finish a frame. -* It will perform a flush and write frame epilogue. -* The epilogue is required for decoders to consider a frame completed. -* Similar to ZBUFF_compressFlush(), it may not be able to output the entire internal buffer content if *dstCapacityPtr is too small. -* In which case, call again ZBUFF_compressFlush() to complete the flush. -* @return : nb of bytes still present into internal buffer (0 if it's empty) -* or an error code, which can be tested using ZBUFF_isError(). -* -* Hint : _recommended buffer_ sizes (not compulsory) : ZBUFF_recommendedCInSize() / ZBUFF_recommendedCOutSize() -* input : ZBUFF_recommendedCInSize==128 KB block size is the internal unit, use this value to reduce intermediate stages (better latency) -* output : ZBUFF_recommendedCOutSize==ZSTD_compressBound(128 KB) + 3 + 3 : ensures it's always possible to write/flush/end a full block. Skip some buffering. -* By using both, it ensures that input will be entirely consumed, and output will always contain the result, reducing intermediate buffering. -* **************************************************/ - - -typedef ZSTD_DStream ZBUFF_DCtx; -ZBUFF_DEPRECATED("use ZSTD_createDStream") ZBUFF_DCtx* ZBUFF_createDCtx(void); -ZBUFF_DEPRECATED("use ZSTD_freeDStream") size_t ZBUFF_freeDCtx(ZBUFF_DCtx* dctx); - -ZBUFF_DEPRECATED("use ZSTD_initDStream") size_t ZBUFF_decompressInit(ZBUFF_DCtx* dctx); -ZBUFF_DEPRECATED("use ZSTD_initDStream_usingDict") size_t ZBUFF_decompressInitDictionary(ZBUFF_DCtx* dctx, const void* dict, size_t dictSize); - -ZBUFF_DEPRECATED("use ZSTD_decompressStream") size_t ZBUFF_decompressContinue(ZBUFF_DCtx* dctx, - void* dst, size_t* dstCapacityPtr, - const void* src, size_t* srcSizePtr); - -/*-*************************************************************************** -* Streaming decompression howto -* -* A ZBUFF_DCtx object is required to track streaming operations. -* Use ZBUFF_createDCtx() and ZBUFF_freeDCtx() to create/release resources. -* Use ZBUFF_decompressInit() to start a new decompression operation, -* or ZBUFF_decompressInitDictionary() if decompression requires a dictionary. -* Note that ZBUFF_DCtx objects can be re-init multiple times. -* -* Use ZBUFF_decompressContinue() repetitively to consume your input. -* *srcSizePtr and *dstCapacityPtr can be any size. -* The function will report how many bytes were read or written by modifying *srcSizePtr and *dstCapacityPtr. -* Note that it may not consume the entire input, in which case it's up to the caller to present remaining input again. -* The content of `dst` will be overwritten (up to *dstCapacityPtr) at each function call, so save its content if it matters, or change `dst`. -* @return : 0 when a frame is completely decoded and fully flushed, -* 1 when there is still some data left within internal buffer to flush, -* >1 when more data is expected, with value being a suggested next input size (it's just a hint, which helps latency), -* or an error code, which can be tested using ZBUFF_isError(). -* -* Hint : recommended buffer sizes (not compulsory) : ZBUFF_recommendedDInSize() and ZBUFF_recommendedDOutSize() -* output : ZBUFF_recommendedDOutSize== 128 KB block size is the internal unit, it ensures it's always possible to write a full block when decoded. -* input : ZBUFF_recommendedDInSize == 128KB + 3; -* just follow indications from ZBUFF_decompressContinue() to minimize latency. It should always be <= 128 KB + 3 . -* *******************************************************************************/ - - -/* ************************************* -* Tool functions -***************************************/ -ZBUFF_DEPRECATED("use ZSTD_isError") unsigned ZBUFF_isError(size_t errorCode); -ZBUFF_DEPRECATED("use ZSTD_getErrorName") const char* ZBUFF_getErrorName(size_t errorCode); - -/** Functions below provide recommended buffer sizes for Compression or Decompression operations. -* These sizes are just hints, they tend to offer better latency */ -ZBUFF_DEPRECATED("use ZSTD_CStreamInSize") size_t ZBUFF_recommendedCInSize(void); -ZBUFF_DEPRECATED("use ZSTD_CStreamOutSize") size_t ZBUFF_recommendedCOutSize(void); -ZBUFF_DEPRECATED("use ZSTD_DStreamInSize") size_t ZBUFF_recommendedDInSize(void); -ZBUFF_DEPRECATED("use ZSTD_DStreamOutSize") size_t ZBUFF_recommendedDOutSize(void); - -#endif /* ZSTD_BUFFERED_H_23987 */ - - -#ifdef ZBUFF_STATIC_LINKING_ONLY -#ifndef ZBUFF_STATIC_H_30298098432 -#define ZBUFF_STATIC_H_30298098432 - -/* ==================================================================================== - * The definitions in this section are considered experimental. - * They should never be used in association with a dynamic library, as they may change in the future. - * They are provided for advanced usages. - * Use them only in association with static linking. - * ==================================================================================== */ - -/*--- Dependency ---*/ -#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters, ZSTD_customMem */ -#include "zstd.h" - - -/*--- Custom memory allocator ---*/ -/*! ZBUFF_createCCtx_advanced() : - * Create a ZBUFF compression context using external alloc and free functions */ -ZBUFF_DEPRECATED("use ZSTD_createCStream_advanced") ZBUFF_CCtx* ZBUFF_createCCtx_advanced(ZSTD_customMem customMem); - -/*! ZBUFF_createDCtx_advanced() : - * Create a ZBUFF decompression context using external alloc and free functions */ -ZBUFF_DEPRECATED("use ZSTD_createDStream_advanced") ZBUFF_DCtx* ZBUFF_createDCtx_advanced(ZSTD_customMem customMem); - - -/*--- Advanced Streaming Initialization ---*/ -ZBUFF_DEPRECATED("use ZSTD_initDStream_usingDict") size_t ZBUFF_compressInit_advanced(ZBUFF_CCtx* zbc, - const void* dict, size_t dictSize, - ZSTD_parameters params, unsigned long long pledgedSrcSize); - - -#endif /* ZBUFF_STATIC_H_30298098432 */ -#endif /* ZBUFF_STATIC_LINKING_ONLY */ - - -#if defined (__cplusplus) -} -#endif diff --git a/vendor/github.com/DataDog/zstd/zbuff_common.c b/vendor/github.com/DataDog/zstd/zbuff_common.c deleted file mode 100644 index 661b9b0e..00000000 --- a/vendor/github.com/DataDog/zstd/zbuff_common.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/*-************************************* -* Dependencies -***************************************/ -#include "error_private.h" -#include "zbuff.h" - -/*-**************************************** -* ZBUFF Error Management (deprecated) -******************************************/ - -/*! ZBUFF_isError() : -* tells if a return value is an error code */ -unsigned ZBUFF_isError(size_t errorCode) { return ERR_isError(errorCode); } -/*! ZBUFF_getErrorName() : -* provides error code string from function result (useful for debugging) */ -const char* ZBUFF_getErrorName(size_t errorCode) { return ERR_getErrorName(errorCode); } diff --git a/vendor/github.com/DataDog/zstd/zbuff_compress.c b/vendor/github.com/DataDog/zstd/zbuff_compress.c deleted file mode 100644 index f39c60d8..00000000 --- a/vendor/github.com/DataDog/zstd/zbuff_compress.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - - -/* ************************************* -* Dependencies -***************************************/ -#define ZBUFF_STATIC_LINKING_ONLY -#include "zbuff.h" - - -/*-*********************************************************** -* Streaming compression -* -* A ZBUFF_CCtx object is required to track streaming operation. -* Use ZBUFF_createCCtx() and ZBUFF_freeCCtx() to create/release resources. -* Use ZBUFF_compressInit() to start a new compression operation. -* ZBUFF_CCtx objects can be reused multiple times. -* -* Use ZBUFF_compressContinue() repetitively to consume your input. -* *srcSizePtr and *dstCapacityPtr can be any size. -* The function will report how many bytes were read or written by modifying *srcSizePtr and *dstCapacityPtr. -* Note that it may not consume the entire input, in which case it's up to the caller to call again the function with remaining input. -* The content of dst will be overwritten (up to *dstCapacityPtr) at each function call, so save its content if it matters or change dst . -* @return : a hint to preferred nb of bytes to use as input for next function call (it's only a hint, to improve latency) -* or an error code, which can be tested using ZBUFF_isError(). -* -* ZBUFF_compressFlush() can be used to instruct ZBUFF to compress and output whatever remains within its buffer. -* Note that it will not output more than *dstCapacityPtr. -* Therefore, some content might still be left into its internal buffer if dst buffer is too small. -* @return : nb of bytes still present into internal buffer (0 if it's empty) -* or an error code, which can be tested using ZBUFF_isError(). -* -* ZBUFF_compressEnd() instructs to finish a frame. -* It will perform a flush and write frame epilogue. -* Similar to ZBUFF_compressFlush(), it may not be able to output the entire internal buffer content if *dstCapacityPtr is too small. -* @return : nb of bytes still present into internal buffer (0 if it's empty) -* or an error code, which can be tested using ZBUFF_isError(). -* -* Hint : recommended buffer sizes (not compulsory) -* input : ZSTD_BLOCKSIZE_MAX (128 KB), internal unit size, it improves latency to use this value. -* output : ZSTD_compressBound(ZSTD_BLOCKSIZE_MAX) + ZSTD_blockHeaderSize + ZBUFF_endFrameSize : ensures it's always possible to write/flush/end a full block at best speed. -* ***********************************************************/ - -ZBUFF_CCtx* ZBUFF_createCCtx(void) -{ - return ZSTD_createCStream(); -} - -ZBUFF_CCtx* ZBUFF_createCCtx_advanced(ZSTD_customMem customMem) -{ - return ZSTD_createCStream_advanced(customMem); -} - -size_t ZBUFF_freeCCtx(ZBUFF_CCtx* zbc) -{ - return ZSTD_freeCStream(zbc); -} - - -/* ====== Initialization ====== */ - -size_t ZBUFF_compressInit_advanced(ZBUFF_CCtx* zbc, - const void* dict, size_t dictSize, - ZSTD_parameters params, unsigned long long pledgedSrcSize) -{ - if (pledgedSrcSize==0) pledgedSrcSize = ZSTD_CONTENTSIZE_UNKNOWN; /* preserve "0 == unknown" behavior */ - return ZSTD_initCStream_advanced(zbc, dict, dictSize, params, pledgedSrcSize); -} - - -size_t ZBUFF_compressInitDictionary(ZBUFF_CCtx* zbc, const void* dict, size_t dictSize, int compressionLevel) -{ - return ZSTD_initCStream_usingDict(zbc, dict, dictSize, compressionLevel); -} - -size_t ZBUFF_compressInit(ZBUFF_CCtx* zbc, int compressionLevel) -{ - return ZSTD_initCStream(zbc, compressionLevel); -} - -/* ====== Compression ====== */ - - -size_t ZBUFF_compressContinue(ZBUFF_CCtx* zbc, - void* dst, size_t* dstCapacityPtr, - const void* src, size_t* srcSizePtr) -{ - size_t result; - ZSTD_outBuffer outBuff; - ZSTD_inBuffer inBuff; - outBuff.dst = dst; - outBuff.pos = 0; - outBuff.size = *dstCapacityPtr; - inBuff.src = src; - inBuff.pos = 0; - inBuff.size = *srcSizePtr; - result = ZSTD_compressStream(zbc, &outBuff, &inBuff); - *dstCapacityPtr = outBuff.pos; - *srcSizePtr = inBuff.pos; - return result; -} - - - -/* ====== Finalize ====== */ - -size_t ZBUFF_compressFlush(ZBUFF_CCtx* zbc, void* dst, size_t* dstCapacityPtr) -{ - size_t result; - ZSTD_outBuffer outBuff; - outBuff.dst = dst; - outBuff.pos = 0; - outBuff.size = *dstCapacityPtr; - result = ZSTD_flushStream(zbc, &outBuff); - *dstCapacityPtr = outBuff.pos; - return result; -} - - -size_t ZBUFF_compressEnd(ZBUFF_CCtx* zbc, void* dst, size_t* dstCapacityPtr) -{ - size_t result; - ZSTD_outBuffer outBuff; - outBuff.dst = dst; - outBuff.pos = 0; - outBuff.size = *dstCapacityPtr; - result = ZSTD_endStream(zbc, &outBuff); - *dstCapacityPtr = outBuff.pos; - return result; -} - - - -/* ************************************* -* Tool functions -***************************************/ -size_t ZBUFF_recommendedCInSize(void) { return ZSTD_CStreamInSize(); } -size_t ZBUFF_recommendedCOutSize(void) { return ZSTD_CStreamOutSize(); } diff --git a/vendor/github.com/DataDog/zstd/zbuff_decompress.c b/vendor/github.com/DataDog/zstd/zbuff_decompress.c deleted file mode 100644 index 923c22b7..00000000 --- a/vendor/github.com/DataDog/zstd/zbuff_decompress.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - - -/* ************************************* -* Dependencies -***************************************/ -#define ZBUFF_STATIC_LINKING_ONLY -#include "zbuff.h" - - -ZBUFF_DCtx* ZBUFF_createDCtx(void) -{ - return ZSTD_createDStream(); -} - -ZBUFF_DCtx* ZBUFF_createDCtx_advanced(ZSTD_customMem customMem) -{ - return ZSTD_createDStream_advanced(customMem); -} - -size_t ZBUFF_freeDCtx(ZBUFF_DCtx* zbd) -{ - return ZSTD_freeDStream(zbd); -} - - -/* *** Initialization *** */ - -size_t ZBUFF_decompressInitDictionary(ZBUFF_DCtx* zbd, const void* dict, size_t dictSize) -{ - return ZSTD_initDStream_usingDict(zbd, dict, dictSize); -} - -size_t ZBUFF_decompressInit(ZBUFF_DCtx* zbd) -{ - return ZSTD_initDStream(zbd); -} - - -/* *** Decompression *** */ - -size_t ZBUFF_decompressContinue(ZBUFF_DCtx* zbd, - void* dst, size_t* dstCapacityPtr, - const void* src, size_t* srcSizePtr) -{ - ZSTD_outBuffer outBuff; - ZSTD_inBuffer inBuff; - size_t result; - outBuff.dst = dst; - outBuff.pos = 0; - outBuff.size = *dstCapacityPtr; - inBuff.src = src; - inBuff.pos = 0; - inBuff.size = *srcSizePtr; - result = ZSTD_decompressStream(zbd, &outBuff, &inBuff); - *dstCapacityPtr = outBuff.pos; - *srcSizePtr = inBuff.pos; - return result; -} - - -/* ************************************* -* Tool functions -***************************************/ -size_t ZBUFF_recommendedDInSize(void) { return ZSTD_DStreamInSize(); } -size_t ZBUFF_recommendedDOutSize(void) { return ZSTD_DStreamOutSize(); } diff --git a/vendor/github.com/DataDog/zstd/zdict.c b/vendor/github.com/DataDog/zstd/zdict.c deleted file mode 100644 index 4a263d82..00000000 --- a/vendor/github.com/DataDog/zstd/zdict.c +++ /dev/null @@ -1,1111 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -/*-************************************** -* Tuning parameters -****************************************/ -#define MINRATIO 4 /* minimum nb of apparition to be selected in dictionary */ -#define ZDICT_MAX_SAMPLES_SIZE (2000U << 20) -#define ZDICT_MIN_SAMPLES_SIZE (ZDICT_CONTENTSIZE_MIN * MINRATIO) - - -/*-************************************** -* Compiler Options -****************************************/ -/* Unix Large Files support (>4GB) */ -#define _FILE_OFFSET_BITS 64 -#if (defined(__sun__) && (!defined(__LP64__))) /* Sun Solaris 32-bits requires specific definitions */ -# define _LARGEFILE_SOURCE -#elif ! defined(__LP64__) /* No point defining Large file for 64 bit */ -# define _LARGEFILE64_SOURCE -#endif - - -/*-************************************* -* Dependencies -***************************************/ -#include /* malloc, free */ -#include /* memset */ -#include /* fprintf, fopen, ftello64 */ -#include /* clock */ - -#include "mem.h" /* read */ -#include "fse.h" /* FSE_normalizeCount, FSE_writeNCount */ -#define HUF_STATIC_LINKING_ONLY -#include "huf.h" /* HUF_buildCTable, HUF_writeCTable */ -#include "zstd_internal.h" /* includes zstd.h */ -#include "xxhash.h" /* XXH64 */ -#include "divsufsort.h" -#ifndef ZDICT_STATIC_LINKING_ONLY -# define ZDICT_STATIC_LINKING_ONLY -#endif -#include "zdict.h" - - -/*-************************************* -* Constants -***************************************/ -#define KB *(1 <<10) -#define MB *(1 <<20) -#define GB *(1U<<30) - -#define DICTLISTSIZE_DEFAULT 10000 - -#define NOISELENGTH 32 - -static const int g_compressionLevel_default = 3; -static const U32 g_selectivity_default = 9; - - -/*-************************************* -* Console display -***************************************/ -#define DISPLAY(...) { fprintf(stderr, __VA_ARGS__); fflush( stderr ); } -#define DISPLAYLEVEL(l, ...) if (notificationLevel>=l) { DISPLAY(__VA_ARGS__); } /* 0 : no display; 1: errors; 2: default; 3: details; 4: debug */ - -static clock_t ZDICT_clockSpan(clock_t nPrevious) { return clock() - nPrevious; } - -static void ZDICT_printHex(const void* ptr, size_t length) -{ - const BYTE* const b = (const BYTE*)ptr; - size_t u; - for (u=0; u126) c = '.'; /* non-printable char */ - DISPLAY("%c", c); - } -} - - -/*-******************************************************** -* Helper functions -**********************************************************/ -unsigned ZDICT_isError(size_t errorCode) { return ERR_isError(errorCode); } - -const char* ZDICT_getErrorName(size_t errorCode) { return ERR_getErrorName(errorCode); } - -unsigned ZDICT_getDictID(const void* dictBuffer, size_t dictSize) -{ - if (dictSize < 8) return 0; - if (MEM_readLE32(dictBuffer) != ZSTD_MAGIC_DICTIONARY) return 0; - return MEM_readLE32((const char*)dictBuffer + 4); -} - - -/*-******************************************************** -* Dictionary training functions -**********************************************************/ -static unsigned ZDICT_NbCommonBytes (size_t val) -{ - if (MEM_isLittleEndian()) { - if (MEM_64bits()) { -# if defined(_MSC_VER) && defined(_WIN64) - unsigned long r = 0; - _BitScanForward64( &r, (U64)val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_ctzll((U64)val) >> 3); -# else - static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, 0, 2, 3, 6, 1, 5, 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, 5, 3, 4, 5, 6, 7, 1, 2, 4, 6, 4, 4, 5, 7, 2, 6, 5, 7, 6, 7, 7 }; - return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58]; -# endif - } else { /* 32 bits */ -# if defined(_MSC_VER) - unsigned long r=0; - _BitScanForward( &r, (U32)val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_ctz((U32)val) >> 3); -# else - static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 }; - return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; -# endif - } - } else { /* Big Endian CPU */ - if (MEM_64bits()) { -# if defined(_MSC_VER) && defined(_WIN64) - unsigned long r = 0; - _BitScanReverse64( &r, val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_clzll(val) >> 3); -# else - unsigned r; - const unsigned n32 = sizeof(size_t)*4; /* calculate this way due to compiler complaining in 32-bits mode */ - if (!(val>>n32)) { r=4; } else { r=0; val>>=n32; } - if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } - r += (!val); - return r; -# endif - } else { /* 32 bits */ -# if defined(_MSC_VER) - unsigned long r = 0; - _BitScanReverse( &r, (unsigned long)val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_clz((U32)val) >> 3); -# else - unsigned r; - if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } - r += (!val); - return r; -# endif - } } -} - - -/*! ZDICT_count() : - Count the nb of common bytes between 2 pointers. - Note : this function presumes end of buffer followed by noisy guard band. -*/ -static size_t ZDICT_count(const void* pIn, const void* pMatch) -{ - const char* const pStart = (const char*)pIn; - for (;;) { - size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); - if (!diff) { - pIn = (const char*)pIn+sizeof(size_t); - pMatch = (const char*)pMatch+sizeof(size_t); - continue; - } - pIn = (const char*)pIn+ZDICT_NbCommonBytes(diff); - return (size_t)((const char*)pIn - pStart); - } -} - - -typedef struct { - U32 pos; - U32 length; - U32 savings; -} dictItem; - -static void ZDICT_initDictItem(dictItem* d) -{ - d->pos = 1; - d->length = 0; - d->savings = (U32)(-1); -} - - -#define LLIMIT 64 /* heuristic determined experimentally */ -#define MINMATCHLENGTH 7 /* heuristic determined experimentally */ -static dictItem ZDICT_analyzePos( - BYTE* doneMarks, - const int* suffix, U32 start, - const void* buffer, U32 minRatio, U32 notificationLevel) -{ - U32 lengthList[LLIMIT] = {0}; - U32 cumulLength[LLIMIT] = {0}; - U32 savings[LLIMIT] = {0}; - const BYTE* b = (const BYTE*)buffer; - size_t maxLength = LLIMIT; - size_t pos = suffix[start]; - U32 end = start; - dictItem solution; - - /* init */ - memset(&solution, 0, sizeof(solution)); - doneMarks[pos] = 1; - - /* trivial repetition cases */ - if ( (MEM_read16(b+pos+0) == MEM_read16(b+pos+2)) - ||(MEM_read16(b+pos+1) == MEM_read16(b+pos+3)) - ||(MEM_read16(b+pos+2) == MEM_read16(b+pos+4)) ) { - /* skip and mark segment */ - U16 const pattern16 = MEM_read16(b+pos+4); - U32 u, patternEnd = 6; - while (MEM_read16(b+pos+patternEnd) == pattern16) patternEnd+=2 ; - if (b[pos+patternEnd] == b[pos+patternEnd-1]) patternEnd++; - for (u=1; u= MINMATCHLENGTH); - } - - /* look backward */ - { size_t length; - do { - length = ZDICT_count(b + pos, b + *(suffix+start-1)); - if (length >=MINMATCHLENGTH) start--; - } while(length >= MINMATCHLENGTH); - } - - /* exit if not found a minimum nb of repetitions */ - if (end-start < minRatio) { - U32 idx; - for(idx=start; idx= %i at pos %7u ", (unsigned)(end-start), MINMATCHLENGTH, (unsigned)pos); - DISPLAYLEVEL(4, "\n"); - - for (mml = MINMATCHLENGTH ; ; mml++) { - BYTE currentChar = 0; - U32 currentCount = 0; - U32 currentID = refinedStart; - U32 id; - U32 selectedCount = 0; - U32 selectedID = currentID; - for (id =refinedStart; id < refinedEnd; id++) { - if (b[suffix[id] + mml] != currentChar) { - if (currentCount > selectedCount) { - selectedCount = currentCount; - selectedID = currentID; - } - currentID = id; - currentChar = b[ suffix[id] + mml]; - currentCount = 0; - } - currentCount ++; - } - if (currentCount > selectedCount) { /* for last */ - selectedCount = currentCount; - selectedID = currentID; - } - - if (selectedCount < minRatio) - break; - refinedStart = selectedID; - refinedEnd = refinedStart + selectedCount; - } - - /* evaluate gain based on new dict */ - start = refinedStart; - pos = suffix[refinedStart]; - end = start; - memset(lengthList, 0, sizeof(lengthList)); - - /* look forward */ - { size_t length; - do { - end++; - length = ZDICT_count(b + pos, b + suffix[end]); - if (length >= LLIMIT) length = LLIMIT-1; - lengthList[length]++; - } while (length >=MINMATCHLENGTH); - } - - /* look backward */ - { size_t length = MINMATCHLENGTH; - while ((length >= MINMATCHLENGTH) & (start > 0)) { - length = ZDICT_count(b + pos, b + suffix[start - 1]); - if (length >= LLIMIT) length = LLIMIT - 1; - lengthList[length]++; - if (length >= MINMATCHLENGTH) start--; - } - } - - /* largest useful length */ - memset(cumulLength, 0, sizeof(cumulLength)); - cumulLength[maxLength-1] = lengthList[maxLength-1]; - for (i=(int)(maxLength-2); i>=0; i--) - cumulLength[i] = cumulLength[i+1] + lengthList[i]; - - for (i=LLIMIT-1; i>=MINMATCHLENGTH; i--) if (cumulLength[i]>=minRatio) break; - maxLength = i; - - /* reduce maxLength in case of final into repetitive data */ - { U32 l = (U32)maxLength; - BYTE const c = b[pos + maxLength-1]; - while (b[pos+l-2]==c) l--; - maxLength = l; - } - if (maxLength < MINMATCHLENGTH) return solution; /* skip : no long-enough solution */ - - /* calculate savings */ - savings[5] = 0; - for (i=MINMATCHLENGTH; i<=(int)maxLength; i++) - savings[i] = savings[i-1] + (lengthList[i] * (i-3)); - - DISPLAYLEVEL(4, "Selected dict at position %u, of length %u : saves %u (ratio: %.2f) \n", - (unsigned)pos, (unsigned)maxLength, (unsigned)savings[maxLength], (double)savings[maxLength] / maxLength); - - solution.pos = (U32)pos; - solution.length = (U32)maxLength; - solution.savings = savings[maxLength]; - - /* mark positions done */ - { U32 id; - for (id=start; id solution.length) length = solution.length; - } - pEnd = (U32)(testedPos + length); - for (p=testedPos; ppos; - const U32 eltEnd = elt.pos + elt.length; - const char* const buf = (const char*) buffer; - - /* tail overlap */ - U32 u; for (u=1; u elt.pos) && (table[u].pos <= eltEnd)) { /* overlap, existing > new */ - /* append */ - U32 const addedLength = table[u].pos - elt.pos; - table[u].length += addedLength; - table[u].pos = elt.pos; - table[u].savings += elt.savings * addedLength / elt.length; /* rough approx */ - table[u].savings += elt.length / 8; /* rough approx bonus */ - elt = table[u]; - /* sort : improve rank */ - while ((u>1) && (table[u-1].savings < elt.savings)) - table[u] = table[u-1], u--; - table[u] = elt; - return u; - } } - - /* front overlap */ - for (u=1; u= elt.pos) && (table[u].pos < elt.pos)) { /* overlap, existing < new */ - /* append */ - int const addedLength = (int)eltEnd - (table[u].pos + table[u].length); - table[u].savings += elt.length / 8; /* rough approx bonus */ - if (addedLength > 0) { /* otherwise, elt fully included into existing */ - table[u].length += addedLength; - table[u].savings += elt.savings * addedLength / elt.length; /* rough approx */ - } - /* sort : improve rank */ - elt = table[u]; - while ((u>1) && (table[u-1].savings < elt.savings)) - table[u] = table[u-1], u--; - table[u] = elt; - return u; - } - - if (MEM_read64(buf + table[u].pos) == MEM_read64(buf + elt.pos + 1)) { - if (isIncluded(buf + table[u].pos, buf + elt.pos + 1, table[u].length)) { - size_t const addedLength = MAX( (int)elt.length - (int)table[u].length , 1 ); - table[u].pos = elt.pos; - table[u].savings += (U32)(elt.savings * addedLength / elt.length); - table[u].length = MIN(elt.length, table[u].length + 1); - return u; - } - } - } - - return 0; -} - - -static void ZDICT_removeDictItem(dictItem* table, U32 id) -{ - /* convention : table[0].pos stores nb of elts */ - U32 const max = table[0].pos; - U32 u; - if (!id) return; /* protection, should never happen */ - for (u=id; upos--; -} - - -static void ZDICT_insertDictItem(dictItem* table, U32 maxSize, dictItem elt, const void* buffer) -{ - /* merge if possible */ - U32 mergeId = ZDICT_tryMerge(table, elt, 0, buffer); - if (mergeId) { - U32 newMerge = 1; - while (newMerge) { - newMerge = ZDICT_tryMerge(table, table[mergeId], mergeId, buffer); - if (newMerge) ZDICT_removeDictItem(table, mergeId); - mergeId = newMerge; - } - return; - } - - /* insert */ - { U32 current; - U32 nextElt = table->pos; - if (nextElt >= maxSize) nextElt = maxSize-1; - current = nextElt-1; - while (table[current].savings < elt.savings) { - table[current+1] = table[current]; - current--; - } - table[current+1] = elt; - table->pos = nextElt+1; - } -} - - -static U32 ZDICT_dictSize(const dictItem* dictList) -{ - U32 u, dictSize = 0; - for (u=1; u=l) { \ - if (ZDICT_clockSpan(displayClock) > refreshRate) \ - { displayClock = clock(); DISPLAY(__VA_ARGS__); \ - if (notificationLevel>=4) fflush(stderr); } } - - /* init */ - DISPLAYLEVEL(2, "\r%70s\r", ""); /* clean display line */ - if (!suffix0 || !reverseSuffix || !doneMarks || !filePos) { - result = ERROR(memory_allocation); - goto _cleanup; - } - if (minRatio < MINRATIO) minRatio = MINRATIO; - memset(doneMarks, 0, bufferSize+16); - - /* limit sample set size (divsufsort limitation)*/ - if (bufferSize > ZDICT_MAX_SAMPLES_SIZE) DISPLAYLEVEL(3, "sample set too large : reduced to %u MB ...\n", (unsigned)(ZDICT_MAX_SAMPLES_SIZE>>20)); - while (bufferSize > ZDICT_MAX_SAMPLES_SIZE) bufferSize -= fileSizes[--nbFiles]; - - /* sort */ - DISPLAYLEVEL(2, "sorting %u files of total size %u MB ...\n", nbFiles, (unsigned)(bufferSize>>20)); - { int const divSuftSortResult = divsufsort((const unsigned char*)buffer, suffix, (int)bufferSize, 0); - if (divSuftSortResult != 0) { result = ERROR(GENERIC); goto _cleanup; } - } - suffix[bufferSize] = (int)bufferSize; /* leads into noise */ - suffix0[0] = (int)bufferSize; /* leads into noise */ - /* build reverse suffix sort */ - { size_t pos; - for (pos=0; pos < bufferSize; pos++) - reverseSuffix[suffix[pos]] = (U32)pos; - /* note filePos tracks borders between samples. - It's not used at this stage, but planned to become useful in a later update */ - filePos[0] = 0; - for (pos=1; pos> 21); - } -} - - -typedef struct -{ - ZSTD_CDict* dict; /* dictionary */ - ZSTD_CCtx* zc; /* working context */ - void* workPlace; /* must be ZSTD_BLOCKSIZE_MAX allocated */ -} EStats_ress_t; - -#define MAXREPOFFSET 1024 - -static void ZDICT_countEStats(EStats_ress_t esr, ZSTD_parameters params, - unsigned* countLit, unsigned* offsetcodeCount, unsigned* matchlengthCount, unsigned* litlengthCount, U32* repOffsets, - const void* src, size_t srcSize, - U32 notificationLevel) -{ - size_t const blockSizeMax = MIN (ZSTD_BLOCKSIZE_MAX, 1 << params.cParams.windowLog); - size_t cSize; - - if (srcSize > blockSizeMax) srcSize = blockSizeMax; /* protection vs large samples */ - { size_t const errorCode = ZSTD_compressBegin_usingCDict(esr.zc, esr.dict); - if (ZSTD_isError(errorCode)) { DISPLAYLEVEL(1, "warning : ZSTD_compressBegin_usingCDict failed \n"); return; } - - } - cSize = ZSTD_compressBlock(esr.zc, esr.workPlace, ZSTD_BLOCKSIZE_MAX, src, srcSize); - if (ZSTD_isError(cSize)) { DISPLAYLEVEL(3, "warning : could not compress sample size %u \n", (unsigned)srcSize); return; } - - if (cSize) { /* if == 0; block is not compressible */ - const seqStore_t* const seqStorePtr = ZSTD_getSeqStore(esr.zc); - - /* literals stats */ - { const BYTE* bytePtr; - for(bytePtr = seqStorePtr->litStart; bytePtr < seqStorePtr->lit; bytePtr++) - countLit[*bytePtr]++; - } - - /* seqStats */ - { U32 const nbSeq = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); - ZSTD_seqToCodes(seqStorePtr); - - { const BYTE* codePtr = seqStorePtr->ofCode; - U32 u; - for (u=0; umlCode; - U32 u; - for (u=0; ullCode; - U32 u; - for (u=0; u= 2) { /* rep offsets */ - const seqDef* const seq = seqStorePtr->sequencesStart; - U32 offset1 = seq[0].offset - 3; - U32 offset2 = seq[1].offset - 3; - if (offset1 >= MAXREPOFFSET) offset1 = 0; - if (offset2 >= MAXREPOFFSET) offset2 = 0; - repOffsets[offset1] += 3; - repOffsets[offset2] += 1; - } } } -} - -static size_t ZDICT_totalSampleSize(const size_t* fileSizes, unsigned nbFiles) -{ - size_t total=0; - unsigned u; - for (u=0; u0; u--) { - offsetCount_t tmp; - if (table[u-1].count >= table[u].count) break; - tmp = table[u-1]; - table[u-1] = table[u]; - table[u] = tmp; - } -} - -/* ZDICT_flatLit() : - * rewrite `countLit` to contain a mostly flat but still compressible distribution of literals. - * necessary to avoid generating a non-compressible distribution that HUF_writeCTable() cannot encode. - */ -static void ZDICT_flatLit(unsigned* countLit) -{ - int u; - for (u=1; u<256; u++) countLit[u] = 2; - countLit[0] = 4; - countLit[253] = 1; - countLit[254] = 1; -} - -#define OFFCODE_MAX 30 /* only applicable to first block */ -static size_t ZDICT_analyzeEntropy(void* dstBuffer, size_t maxDstSize, - unsigned compressionLevel, - const void* srcBuffer, const size_t* fileSizes, unsigned nbFiles, - const void* dictBuffer, size_t dictBufferSize, - unsigned notificationLevel) -{ - unsigned countLit[256]; - HUF_CREATE_STATIC_CTABLE(hufTable, 255); - unsigned offcodeCount[OFFCODE_MAX+1]; - short offcodeNCount[OFFCODE_MAX+1]; - U32 offcodeMax = ZSTD_highbit32((U32)(dictBufferSize + 128 KB)); - unsigned matchLengthCount[MaxML+1]; - short matchLengthNCount[MaxML+1]; - unsigned litLengthCount[MaxLL+1]; - short litLengthNCount[MaxLL+1]; - U32 repOffset[MAXREPOFFSET]; - offsetCount_t bestRepOffset[ZSTD_REP_NUM+1]; - EStats_ress_t esr = { NULL, NULL, NULL }; - ZSTD_parameters params; - U32 u, huffLog = 11, Offlog = OffFSELog, mlLog = MLFSELog, llLog = LLFSELog, total; - size_t pos = 0, errorCode; - size_t eSize = 0; - size_t const totalSrcSize = ZDICT_totalSampleSize(fileSizes, nbFiles); - size_t const averageSampleSize = totalSrcSize / (nbFiles + !nbFiles); - BYTE* dstPtr = (BYTE*)dstBuffer; - - /* init */ - DEBUGLOG(4, "ZDICT_analyzeEntropy"); - if (offcodeMax>OFFCODE_MAX) { eSize = ERROR(dictionaryCreation_failed); goto _cleanup; } /* too large dictionary */ - for (u=0; u<256; u++) countLit[u] = 1; /* any character must be described */ - for (u=0; u<=offcodeMax; u++) offcodeCount[u] = 1; - for (u=0; u<=MaxML; u++) matchLengthCount[u] = 1; - for (u=0; u<=MaxLL; u++) litLengthCount[u] = 1; - memset(repOffset, 0, sizeof(repOffset)); - repOffset[1] = repOffset[4] = repOffset[8] = 1; - memset(bestRepOffset, 0, sizeof(bestRepOffset)); - if (compressionLevel==0) compressionLevel = g_compressionLevel_default; - params = ZSTD_getParams(compressionLevel, averageSampleSize, dictBufferSize); - - esr.dict = ZSTD_createCDict_advanced(dictBuffer, dictBufferSize, ZSTD_dlm_byRef, ZSTD_dct_rawContent, params.cParams, ZSTD_defaultCMem); - esr.zc = ZSTD_createCCtx(); - esr.workPlace = malloc(ZSTD_BLOCKSIZE_MAX); - if (!esr.dict || !esr.zc || !esr.workPlace) { - eSize = ERROR(memory_allocation); - DISPLAYLEVEL(1, "Not enough memory \n"); - goto _cleanup; - } - - /* collect stats on all samples */ - for (u=0; u dictBufferCapacity) dictContentSize = dictBufferCapacity - hSize; - { size_t const dictSize = hSize + dictContentSize; - char* dictEnd = (char*)dictBuffer + dictSize; - memmove(dictEnd - dictContentSize, customDictContent, dictContentSize); - memcpy(dictBuffer, header, hSize); - return dictSize; - } -} - - -static size_t ZDICT_addEntropyTablesFromBuffer_advanced( - void* dictBuffer, size_t dictContentSize, size_t dictBufferCapacity, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, - ZDICT_params_t params) -{ - int const compressionLevel = (params.compressionLevel == 0) ? g_compressionLevel_default : params.compressionLevel; - U32 const notificationLevel = params.notificationLevel; - size_t hSize = 8; - - /* calculate entropy tables */ - DISPLAYLEVEL(2, "\r%70s\r", ""); /* clean display line */ - DISPLAYLEVEL(2, "statistics ... \n"); - { size_t const eSize = ZDICT_analyzeEntropy((char*)dictBuffer+hSize, dictBufferCapacity-hSize, - compressionLevel, - samplesBuffer, samplesSizes, nbSamples, - (char*)dictBuffer + dictBufferCapacity - dictContentSize, dictContentSize, - notificationLevel); - if (ZDICT_isError(eSize)) return eSize; - hSize += eSize; - } - - /* add dictionary header (after entropy tables) */ - MEM_writeLE32(dictBuffer, ZSTD_MAGIC_DICTIONARY); - { U64 const randomID = XXH64((char*)dictBuffer + dictBufferCapacity - dictContentSize, dictContentSize, 0); - U32 const compliantID = (randomID % ((1U<<31)-32768)) + 32768; - U32 const dictID = params.dictID ? params.dictID : compliantID; - MEM_writeLE32((char*)dictBuffer+4, dictID); - } - - if (hSize + dictContentSize < dictBufferCapacity) - memmove((char*)dictBuffer + hSize, (char*)dictBuffer + dictBufferCapacity - dictContentSize, dictContentSize); - return MIN(dictBufferCapacity, hSize+dictContentSize); -} - -/* Hidden declaration for dbio.c */ -size_t ZDICT_trainFromBuffer_unsafe_legacy( - void* dictBuffer, size_t maxDictSize, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, - ZDICT_legacy_params_t params); -/*! ZDICT_trainFromBuffer_unsafe_legacy() : -* Warning : `samplesBuffer` must be followed by noisy guard band. -* @return : size of dictionary, or an error code which can be tested with ZDICT_isError() -*/ -size_t ZDICT_trainFromBuffer_unsafe_legacy( - void* dictBuffer, size_t maxDictSize, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, - ZDICT_legacy_params_t params) -{ - U32 const dictListSize = MAX(MAX(DICTLISTSIZE_DEFAULT, nbSamples), (U32)(maxDictSize/16)); - dictItem* const dictList = (dictItem*)malloc(dictListSize * sizeof(*dictList)); - unsigned const selectivity = params.selectivityLevel == 0 ? g_selectivity_default : params.selectivityLevel; - unsigned const minRep = (selectivity > 30) ? MINRATIO : nbSamples >> selectivity; - size_t const targetDictSize = maxDictSize; - size_t const samplesBuffSize = ZDICT_totalSampleSize(samplesSizes, nbSamples); - size_t dictSize = 0; - U32 const notificationLevel = params.zParams.notificationLevel; - - /* checks */ - if (!dictList) return ERROR(memory_allocation); - if (maxDictSize < ZDICT_DICTSIZE_MIN) { free(dictList); return ERROR(dstSize_tooSmall); } /* requested dictionary size is too small */ - if (samplesBuffSize < ZDICT_MIN_SAMPLES_SIZE) { free(dictList); return ERROR(dictionaryCreation_failed); } /* not enough source to create dictionary */ - - /* init */ - ZDICT_initDictItem(dictList); - - /* build dictionary */ - ZDICT_trainBuffer_legacy(dictList, dictListSize, - samplesBuffer, samplesBuffSize, - samplesSizes, nbSamples, - minRep, notificationLevel); - - /* display best matches */ - if (params.zParams.notificationLevel>= 3) { - unsigned const nb = MIN(25, dictList[0].pos); - unsigned const dictContentSize = ZDICT_dictSize(dictList); - unsigned u; - DISPLAYLEVEL(3, "\n %u segments found, of total size %u \n", (unsigned)dictList[0].pos-1, dictContentSize); - DISPLAYLEVEL(3, "list %u best segments \n", nb-1); - for (u=1; u samplesBuffSize) || ((pos + length) > samplesBuffSize)) { - free(dictList); - return ERROR(GENERIC); /* should never happen */ - } - DISPLAYLEVEL(3, "%3u:%3u bytes at pos %8u, savings %7u bytes |", - u, length, pos, (unsigned)dictList[u].savings); - ZDICT_printHex((const char*)samplesBuffer+pos, printedLength); - DISPLAYLEVEL(3, "| \n"); - } } - - - /* create dictionary */ - { unsigned dictContentSize = ZDICT_dictSize(dictList); - if (dictContentSize < ZDICT_CONTENTSIZE_MIN) { free(dictList); return ERROR(dictionaryCreation_failed); } /* dictionary content too small */ - if (dictContentSize < targetDictSize/4) { - DISPLAYLEVEL(2, "! warning : selected content significantly smaller than requested (%u < %u) \n", dictContentSize, (unsigned)maxDictSize); - if (samplesBuffSize < 10 * targetDictSize) - DISPLAYLEVEL(2, "! consider increasing the number of samples (total size : %u MB)\n", (unsigned)(samplesBuffSize>>20)); - if (minRep > MINRATIO) { - DISPLAYLEVEL(2, "! consider increasing selectivity to produce larger dictionary (-s%u) \n", selectivity+1); - DISPLAYLEVEL(2, "! note : larger dictionaries are not necessarily better, test its efficiency on samples \n"); - } - } - - if ((dictContentSize > targetDictSize*3) && (nbSamples > 2*MINRATIO) && (selectivity>1)) { - unsigned proposedSelectivity = selectivity-1; - while ((nbSamples >> proposedSelectivity) <= MINRATIO) { proposedSelectivity--; } - DISPLAYLEVEL(2, "! note : calculated dictionary significantly larger than requested (%u > %u) \n", dictContentSize, (unsigned)maxDictSize); - DISPLAYLEVEL(2, "! consider increasing dictionary size, or produce denser dictionary (-s%u) \n", proposedSelectivity); - DISPLAYLEVEL(2, "! always test dictionary efficiency on real samples \n"); - } - - /* limit dictionary size */ - { U32 const max = dictList->pos; /* convention : nb of useful elts within dictList */ - U32 currentSize = 0; - U32 n; for (n=1; n targetDictSize) { currentSize -= dictList[n].length; break; } - } - dictList->pos = n; - dictContentSize = currentSize; - } - - /* build dict content */ - { U32 u; - BYTE* ptr = (BYTE*)dictBuffer + maxDictSize; - for (u=1; upos; u++) { - U32 l = dictList[u].length; - ptr -= l; - if (ptr<(BYTE*)dictBuffer) { free(dictList); return ERROR(GENERIC); } /* should not happen */ - memcpy(ptr, (const char*)samplesBuffer+dictList[u].pos, l); - } } - - dictSize = ZDICT_addEntropyTablesFromBuffer_advanced(dictBuffer, dictContentSize, maxDictSize, - samplesBuffer, samplesSizes, nbSamples, - params.zParams); - } - - /* clean up */ - free(dictList); - return dictSize; -} - - -/* ZDICT_trainFromBuffer_legacy() : - * issue : samplesBuffer need to be followed by a noisy guard band. - * work around : duplicate the buffer, and add the noise */ -size_t ZDICT_trainFromBuffer_legacy(void* dictBuffer, size_t dictBufferCapacity, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, - ZDICT_legacy_params_t params) -{ - size_t result; - void* newBuff; - size_t const sBuffSize = ZDICT_totalSampleSize(samplesSizes, nbSamples); - if (sBuffSize < ZDICT_MIN_SAMPLES_SIZE) return 0; /* not enough content => no dictionary */ - - newBuff = malloc(sBuffSize + NOISELENGTH); - if (!newBuff) return ERROR(memory_allocation); - - memcpy(newBuff, samplesBuffer, sBuffSize); - ZDICT_fillNoise((char*)newBuff + sBuffSize, NOISELENGTH); /* guard band, for end of buffer condition */ - - result = - ZDICT_trainFromBuffer_unsafe_legacy(dictBuffer, dictBufferCapacity, newBuff, - samplesSizes, nbSamples, params); - free(newBuff); - return result; -} - - -size_t ZDICT_trainFromBuffer(void* dictBuffer, size_t dictBufferCapacity, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples) -{ - ZDICT_fastCover_params_t params; - DEBUGLOG(3, "ZDICT_trainFromBuffer"); - memset(¶ms, 0, sizeof(params)); - params.d = 8; - params.steps = 4; - /* Default to level 6 since no compression level information is available */ - params.zParams.compressionLevel = 3; -#if defined(DEBUGLEVEL) && (DEBUGLEVEL>=1) - params.zParams.notificationLevel = DEBUGLEVEL; -#endif - return ZDICT_optimizeTrainFromBuffer_fastCover(dictBuffer, dictBufferCapacity, - samplesBuffer, samplesSizes, nbSamples, - ¶ms); -} - -size_t ZDICT_addEntropyTablesFromBuffer(void* dictBuffer, size_t dictContentSize, size_t dictBufferCapacity, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples) -{ - ZDICT_params_t params; - memset(¶ms, 0, sizeof(params)); - return ZDICT_addEntropyTablesFromBuffer_advanced(dictBuffer, dictContentSize, dictBufferCapacity, - samplesBuffer, samplesSizes, nbSamples, - params); -} diff --git a/vendor/github.com/DataDog/zstd/zdict.h b/vendor/github.com/DataDog/zstd/zdict.h deleted file mode 100644 index 37978ecd..00000000 --- a/vendor/github.com/DataDog/zstd/zdict.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef DICTBUILDER_H_001 -#define DICTBUILDER_H_001 - -#if defined (__cplusplus) -extern "C" { -#endif - - -/*====== Dependencies ======*/ -#include /* size_t */ - - -/* ===== ZDICTLIB_API : control library symbols visibility ===== */ -#ifndef ZDICTLIB_VISIBILITY -# if defined(__GNUC__) && (__GNUC__ >= 4) -# define ZDICTLIB_VISIBILITY __attribute__ ((visibility ("default"))) -# else -# define ZDICTLIB_VISIBILITY -# endif -#endif -#if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) -# define ZDICTLIB_API __declspec(dllexport) ZDICTLIB_VISIBILITY -#elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) -# define ZDICTLIB_API __declspec(dllimport) ZDICTLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ -#else -# define ZDICTLIB_API ZDICTLIB_VISIBILITY -#endif - - -/*! ZDICT_trainFromBuffer(): - * Train a dictionary from an array of samples. - * Redirect towards ZDICT_optimizeTrainFromBuffer_fastCover() single-threaded, with d=8, steps=4, - * f=20, and accel=1. - * Samples must be stored concatenated in a single flat buffer `samplesBuffer`, - * supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order. - * The resulting dictionary will be saved into `dictBuffer`. - * @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`) - * or an error code, which can be tested with ZDICT_isError(). - * Note: Dictionary training will fail if there are not enough samples to construct a - * dictionary, or if most of the samples are too small (< 8 bytes being the lower limit). - * If dictionary training fails, you should use zstd without a dictionary, as the dictionary - * would've been ineffective anyways. If you believe your samples would benefit from a dictionary - * please open an issue with details, and we can look into it. - * Note: ZDICT_trainFromBuffer()'s memory usage is about 6 MB. - * Tips: In general, a reasonable dictionary has a size of ~ 100 KB. - * It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`. - * In general, it's recommended to provide a few thousands samples, though this can vary a lot. - * It's recommended that total size of all samples be about ~x100 times the target size of dictionary. - */ -ZDICTLIB_API size_t ZDICT_trainFromBuffer(void* dictBuffer, size_t dictBufferCapacity, - const void* samplesBuffer, - const size_t* samplesSizes, unsigned nbSamples); - - -/*====== Helper functions ======*/ -ZDICTLIB_API unsigned ZDICT_getDictID(const void* dictBuffer, size_t dictSize); /**< extracts dictID; @return zero if error (not a valid dictionary) */ -ZDICTLIB_API unsigned ZDICT_isError(size_t errorCode); -ZDICTLIB_API const char* ZDICT_getErrorName(size_t errorCode); - - - -#ifdef ZDICT_STATIC_LINKING_ONLY - -/* ==================================================================================== - * The definitions in this section are considered experimental. - * They should never be used with a dynamic library, as they may change in the future. - * They are provided for advanced usages. - * Use them only in association with static linking. - * ==================================================================================== */ - -typedef struct { - int compressionLevel; /* optimize for a specific zstd compression level; 0 means default */ - unsigned notificationLevel; /* Write log to stderr; 0 = none (default); 1 = errors; 2 = progression; 3 = details; 4 = debug; */ - unsigned dictID; /* force dictID value; 0 means auto mode (32-bits random value) */ -} ZDICT_params_t; - -/*! ZDICT_cover_params_t: - * k and d are the only required parameters. - * For others, value 0 means default. - */ -typedef struct { - unsigned k; /* Segment size : constraint: 0 < k : Reasonable range [16, 2048+] */ - unsigned d; /* dmer size : constraint: 0 < d <= k : Reasonable range [6, 16] */ - unsigned steps; /* Number of steps : Only used for optimization : 0 means default (40) : Higher means more parameters checked */ - unsigned nbThreads; /* Number of threads : constraint: 0 < nbThreads : 1 means single-threaded : Only used for optimization : Ignored if ZSTD_MULTITHREAD is not defined */ - double splitPoint; /* Percentage of samples used for training: Only used for optimization : the first nbSamples * splitPoint samples will be used to training, the last nbSamples * (1 - splitPoint) samples will be used for testing, 0 means default (1.0), 1.0 when all samples are used for both training and testing */ - unsigned shrinkDict; /* Train dictionaries to shrink in size starting from the minimum size and selects the smallest dictionary that is shrinkDictMaxRegression% worse than the largest dictionary. 0 means no shrinking and 1 means shrinking */ - unsigned shrinkDictMaxRegression; /* Sets shrinkDictMaxRegression so that a smaller dictionary can be at worse shrinkDictMaxRegression% worse than the max dict size dictionary. */ - ZDICT_params_t zParams; -} ZDICT_cover_params_t; - -typedef struct { - unsigned k; /* Segment size : constraint: 0 < k : Reasonable range [16, 2048+] */ - unsigned d; /* dmer size : constraint: 0 < d <= k : Reasonable range [6, 16] */ - unsigned f; /* log of size of frequency array : constraint: 0 < f <= 31 : 1 means default(20)*/ - unsigned steps; /* Number of steps : Only used for optimization : 0 means default (40) : Higher means more parameters checked */ - unsigned nbThreads; /* Number of threads : constraint: 0 < nbThreads : 1 means single-threaded : Only used for optimization : Ignored if ZSTD_MULTITHREAD is not defined */ - double splitPoint; /* Percentage of samples used for training: Only used for optimization : the first nbSamples * splitPoint samples will be used to training, the last nbSamples * (1 - splitPoint) samples will be used for testing, 0 means default (0.75), 1.0 when all samples are used for both training and testing */ - unsigned accel; /* Acceleration level: constraint: 0 < accel <= 10, higher means faster and less accurate, 0 means default(1) */ - unsigned shrinkDict; /* Train dictionaries to shrink in size starting from the minimum size and selects the smallest dictionary that is shrinkDictMaxRegression% worse than the largest dictionary. 0 means no shrinking and 1 means shrinking */ - unsigned shrinkDictMaxRegression; /* Sets shrinkDictMaxRegression so that a smaller dictionary can be at worse shrinkDictMaxRegression% worse than the max dict size dictionary. */ - - ZDICT_params_t zParams; -} ZDICT_fastCover_params_t; - -/*! ZDICT_trainFromBuffer_cover(): - * Train a dictionary from an array of samples using the COVER algorithm. - * Samples must be stored concatenated in a single flat buffer `samplesBuffer`, - * supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order. - * The resulting dictionary will be saved into `dictBuffer`. - * @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`) - * or an error code, which can be tested with ZDICT_isError(). - * See ZDICT_trainFromBuffer() for details on failure modes. - * Note: ZDICT_trainFromBuffer_cover() requires about 9 bytes of memory for each input byte. - * Tips: In general, a reasonable dictionary has a size of ~ 100 KB. - * It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`. - * In general, it's recommended to provide a few thousands samples, though this can vary a lot. - * It's recommended that total size of all samples be about ~x100 times the target size of dictionary. - */ -ZDICTLIB_API size_t ZDICT_trainFromBuffer_cover( - void *dictBuffer, size_t dictBufferCapacity, - const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples, - ZDICT_cover_params_t parameters); - -/*! ZDICT_optimizeTrainFromBuffer_cover(): - * The same requirements as above hold for all the parameters except `parameters`. - * This function tries many parameter combinations and picks the best parameters. - * `*parameters` is filled with the best parameters found, - * dictionary constructed with those parameters is stored in `dictBuffer`. - * - * All of the parameters d, k, steps are optional. - * If d is non-zero then we don't check multiple values of d, otherwise we check d = {6, 8}. - * if steps is zero it defaults to its default value. - * If k is non-zero then we don't check multiple values of k, otherwise we check steps values in [50, 2000]. - * - * @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`) - * or an error code, which can be tested with ZDICT_isError(). - * On success `*parameters` contains the parameters selected. - * See ZDICT_trainFromBuffer() for details on failure modes. - * Note: ZDICT_optimizeTrainFromBuffer_cover() requires about 8 bytes of memory for each input byte and additionally another 5 bytes of memory for each byte of memory for each thread. - */ -ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_cover( - void* dictBuffer, size_t dictBufferCapacity, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, - ZDICT_cover_params_t* parameters); - -/*! ZDICT_trainFromBuffer_fastCover(): - * Train a dictionary from an array of samples using a modified version of COVER algorithm. - * Samples must be stored concatenated in a single flat buffer `samplesBuffer`, - * supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order. - * d and k are required. - * All other parameters are optional, will use default values if not provided - * The resulting dictionary will be saved into `dictBuffer`. - * @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`) - * or an error code, which can be tested with ZDICT_isError(). - * See ZDICT_trainFromBuffer() for details on failure modes. - * Note: ZDICT_trainFromBuffer_fastCover() requires 6 * 2^f bytes of memory. - * Tips: In general, a reasonable dictionary has a size of ~ 100 KB. - * It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`. - * In general, it's recommended to provide a few thousands samples, though this can vary a lot. - * It's recommended that total size of all samples be about ~x100 times the target size of dictionary. - */ -ZDICTLIB_API size_t ZDICT_trainFromBuffer_fastCover(void *dictBuffer, - size_t dictBufferCapacity, const void *samplesBuffer, - const size_t *samplesSizes, unsigned nbSamples, - ZDICT_fastCover_params_t parameters); - -/*! ZDICT_optimizeTrainFromBuffer_fastCover(): - * The same requirements as above hold for all the parameters except `parameters`. - * This function tries many parameter combinations (specifically, k and d combinations) - * and picks the best parameters. `*parameters` is filled with the best parameters found, - * dictionary constructed with those parameters is stored in `dictBuffer`. - * All of the parameters d, k, steps, f, and accel are optional. - * If d is non-zero then we don't check multiple values of d, otherwise we check d = {6, 8}. - * if steps is zero it defaults to its default value. - * If k is non-zero then we don't check multiple values of k, otherwise we check steps values in [50, 2000]. - * If f is zero, default value of 20 is used. - * If accel is zero, default value of 1 is used. - * - * @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`) - * or an error code, which can be tested with ZDICT_isError(). - * On success `*parameters` contains the parameters selected. - * See ZDICT_trainFromBuffer() for details on failure modes. - * Note: ZDICT_optimizeTrainFromBuffer_fastCover() requires about 6 * 2^f bytes of memory for each thread. - */ -ZDICTLIB_API size_t ZDICT_optimizeTrainFromBuffer_fastCover(void* dictBuffer, - size_t dictBufferCapacity, const void* samplesBuffer, - const size_t* samplesSizes, unsigned nbSamples, - ZDICT_fastCover_params_t* parameters); - -/*! ZDICT_finalizeDictionary(): - * Given a custom content as a basis for dictionary, and a set of samples, - * finalize dictionary by adding headers and statistics. - * - * Samples must be stored concatenated in a flat buffer `samplesBuffer`, - * supplied with an array of sizes `samplesSizes`, providing the size of each sample in order. - * - * dictContentSize must be >= ZDICT_CONTENTSIZE_MIN bytes. - * maxDictSize must be >= dictContentSize, and must be >= ZDICT_DICTSIZE_MIN bytes. - * - * @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`), - * or an error code, which can be tested by ZDICT_isError(). - * Note: ZDICT_finalizeDictionary() will push notifications into stderr if instructed to, using notificationLevel>0. - * Note 2: dictBuffer and dictContent can overlap - */ -#define ZDICT_CONTENTSIZE_MIN 128 -#define ZDICT_DICTSIZE_MIN 256 -ZDICTLIB_API size_t ZDICT_finalizeDictionary(void* dictBuffer, size_t dictBufferCapacity, - const void* dictContent, size_t dictContentSize, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, - ZDICT_params_t parameters); - -typedef struct { - unsigned selectivityLevel; /* 0 means default; larger => select more => larger dictionary */ - ZDICT_params_t zParams; -} ZDICT_legacy_params_t; - -/*! ZDICT_trainFromBuffer_legacy(): - * Train a dictionary from an array of samples. - * Samples must be stored concatenated in a single flat buffer `samplesBuffer`, - * supplied with an array of sizes `samplesSizes`, providing the size of each sample, in order. - * The resulting dictionary will be saved into `dictBuffer`. - * `parameters` is optional and can be provided with values set to 0 to mean "default". - * @return: size of dictionary stored into `dictBuffer` (<= `dictBufferCapacity`) - * or an error code, which can be tested with ZDICT_isError(). - * See ZDICT_trainFromBuffer() for details on failure modes. - * Tips: In general, a reasonable dictionary has a size of ~ 100 KB. - * It's possible to select smaller or larger size, just by specifying `dictBufferCapacity`. - * In general, it's recommended to provide a few thousands samples, though this can vary a lot. - * It's recommended that total size of all samples be about ~x100 times the target size of dictionary. - * Note: ZDICT_trainFromBuffer_legacy() will send notifications into stderr if instructed to, using notificationLevel>0. - */ -ZDICTLIB_API size_t ZDICT_trainFromBuffer_legacy( - void *dictBuffer, size_t dictBufferCapacity, - const void *samplesBuffer, const size_t *samplesSizes, unsigned nbSamples, - ZDICT_legacy_params_t parameters); - -/* Deprecation warnings */ -/* It is generally possible to disable deprecation warnings from compiler, - for example with -Wno-deprecated-declarations for gcc - or _CRT_SECURE_NO_WARNINGS in Visual. - Otherwise, it's also possible to manually define ZDICT_DISABLE_DEPRECATE_WARNINGS */ -#ifdef ZDICT_DISABLE_DEPRECATE_WARNINGS -# define ZDICT_DEPRECATED(message) ZDICTLIB_API /* disable deprecation warnings */ -#else -# define ZDICT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) -# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */ -# define ZDICT_DEPRECATED(message) [[deprecated(message)]] ZDICTLIB_API -# elif (ZDICT_GCC_VERSION >= 405) || defined(__clang__) -# define ZDICT_DEPRECATED(message) ZDICTLIB_API __attribute__((deprecated(message))) -# elif (ZDICT_GCC_VERSION >= 301) -# define ZDICT_DEPRECATED(message) ZDICTLIB_API __attribute__((deprecated)) -# elif defined(_MSC_VER) -# define ZDICT_DEPRECATED(message) ZDICTLIB_API __declspec(deprecated(message)) -# else -# pragma message("WARNING: You need to implement ZDICT_DEPRECATED for this compiler") -# define ZDICT_DEPRECATED(message) ZDICTLIB_API -# endif -#endif /* ZDICT_DISABLE_DEPRECATE_WARNINGS */ - -ZDICT_DEPRECATED("use ZDICT_finalizeDictionary() instead") -size_t ZDICT_addEntropyTablesFromBuffer(void* dictBuffer, size_t dictContentSize, size_t dictBufferCapacity, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples); - - -#endif /* ZDICT_STATIC_LINKING_ONLY */ - -#if defined (__cplusplus) -} -#endif - -#endif /* DICTBUILDER_H_001 */ diff --git a/vendor/github.com/DataDog/zstd/zstd.go b/vendor/github.com/DataDog/zstd/zstd.go deleted file mode 100644 index b6af4eb1..00000000 --- a/vendor/github.com/DataDog/zstd/zstd.go +++ /dev/null @@ -1,147 +0,0 @@ -package zstd - -/* -#define ZSTD_STATIC_LINKING_ONLY -#include "zstd.h" -#include "stdint.h" // for uintptr_t - -// The following *_wrapper function are used for removing superflouos -// memory allocations when calling the wrapped functions from Go code. -// See https://github.com/golang/go/issues/24450 for details. - -static size_t ZSTD_compress_wrapper(uintptr_t dst, size_t maxDstSize, const uintptr_t src, size_t srcSize, int compressionLevel) { - return ZSTD_compress((void*)dst, maxDstSize, (const void*)src, srcSize, compressionLevel); -} - -static size_t ZSTD_decompress_wrapper(uintptr_t dst, size_t maxDstSize, uintptr_t src, size_t srcSize) { - return ZSTD_decompress((void*)dst, maxDstSize, (const void *)src, srcSize); -} - -*/ -import "C" -import ( - "bytes" - "errors" - "io/ioutil" - "runtime" - "unsafe" -) - -// Defines best and standard values for zstd cli -const ( - BestSpeed = 1 - BestCompression = 20 - DefaultCompression = 5 -) - -var ( - // ErrEmptySlice is returned when there is nothing to compress - ErrEmptySlice = errors.New("Bytes slice is empty") -) - -// CompressBound returns the worst case size needed for a destination buffer, -// which can be used to preallocate a destination buffer or select a previously -// allocated buffer from a pool. -// See zstd.h to mirror implementation of ZSTD_COMPRESSBOUND -func CompressBound(srcSize int) int { - lowLimit := 128 << 10 // 128 kB - var margin int - if srcSize < lowLimit { - margin = (lowLimit - srcSize) >> 11 - } - return srcSize + (srcSize >> 8) + margin -} - -// cCompressBound is a cgo call to check the go implementation above against the c code. -func cCompressBound(srcSize int) int { - return int(C.ZSTD_compressBound(C.size_t(srcSize))) -} - -// Compress src into dst. If you have a buffer to use, you can pass it to -// prevent allocation. If it is too small, or if nil is passed, a new buffer -// will be allocated and returned. -func Compress(dst, src []byte) ([]byte, error) { - return CompressLevel(dst, src, DefaultCompression) -} - -// CompressLevel is the same as Compress but you can pass a compression level -func CompressLevel(dst, src []byte, level int) ([]byte, error) { - bound := CompressBound(len(src)) - if cap(dst) >= bound { - dst = dst[0:bound] // Reuse dst buffer - } else { - dst = make([]byte, bound) - } - - srcPtr := C.uintptr_t(uintptr(0)) // Do not point anywhere, if src is empty - if len(src) > 0 { - srcPtr = C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))) - } - - cWritten := C.ZSTD_compress_wrapper( - C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))), - C.size_t(len(dst)), - srcPtr, - C.size_t(len(src)), - C.int(level)) - - runtime.KeepAlive(src) - written := int(cWritten) - // Check if the return is an Error code - if err := getError(written); err != nil { - return nil, err - } - return dst[:written], nil -} - -// Decompress src into dst. If you have a buffer to use, you can pass it to -// prevent allocation. If it is too small, or if nil is passed, a new buffer -// will be allocated and returned. -func Decompress(dst, src []byte) ([]byte, error) { - if len(src) == 0 { - return []byte{}, ErrEmptySlice - } - decompress := func(dst, src []byte) ([]byte, error) { - - cWritten := C.ZSTD_decompress_wrapper( - C.uintptr_t(uintptr(unsafe.Pointer(&dst[0]))), - C.size_t(len(dst)), - C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))), - C.size_t(len(src))) - - runtime.KeepAlive(src) - written := int(cWritten) - // Check error - if err := getError(written); err != nil { - return nil, err - } - return dst[:written], nil - } - - if len(dst) == 0 { - // Attempt to use zStd to determine decompressed size (may result in error or 0) - size := int(C.size_t(C.ZSTD_getDecompressedSize(unsafe.Pointer(&src[0]), C.size_t(len(src))))) - - if err := getError(size); err != nil { - return nil, err - } - - if size > 0 { - dst = make([]byte, size) - } else { - dst = make([]byte, len(src)*3) // starting guess - } - } - for i := 0; i < 3; i++ { // 3 tries to allocate a bigger buffer - result, err := decompress(dst, src) - if !IsDstSizeTooSmallError(err) { - return result, err - } - dst = make([]byte, len(dst)*2) // Grow buffer by 2 - } - - // We failed getting a dst buffer of correct size, use stream API - r := NewReader(bytes.NewReader(src)) - defer r.Close() - return ioutil.ReadAll(r) -} diff --git a/vendor/github.com/DataDog/zstd/zstd.h b/vendor/github.com/DataDog/zstd/zstd.h deleted file mode 100644 index 72080ea8..00000000 --- a/vendor/github.com/DataDog/zstd/zstd.h +++ /dev/null @@ -1,2049 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ -#if defined (__cplusplus) -extern "C" { -#endif - -#ifndef ZSTD_H_235446 -#define ZSTD_H_235446 - -/* ====== Dependency ======*/ -#include /* INT_MAX */ -#include /* size_t */ - - -/* ===== ZSTDLIB_API : control library symbols visibility ===== */ -#ifndef ZSTDLIB_VISIBILITY -# if defined(__GNUC__) && (__GNUC__ >= 4) -# define ZSTDLIB_VISIBILITY __attribute__ ((visibility ("default"))) -# else -# define ZSTDLIB_VISIBILITY -# endif -#endif -#if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) -# define ZSTDLIB_API __declspec(dllexport) ZSTDLIB_VISIBILITY -#elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) -# define ZSTDLIB_API __declspec(dllimport) ZSTDLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ -#else -# define ZSTDLIB_API ZSTDLIB_VISIBILITY -#endif - - -/******************************************************************************* - Introduction - - zstd, short for Zstandard, is a fast lossless compression algorithm, targeting - real-time compression scenarios at zlib-level and better compression ratios. - The zstd compression library provides in-memory compression and decompression - functions. - - The library supports regular compression levels from 1 up to ZSTD_maxCLevel(), - which is currently 22. Levels >= 20, labeled `--ultra`, should be used with - caution, as they require more memory. The library also offers negative - compression levels, which extend the range of speed vs. ratio preferences. - The lower the level, the faster the speed (at the cost of compression). - - Compression can be done in: - - a single step (described as Simple API) - - a single step, reusing a context (described as Explicit context) - - unbounded multiple steps (described as Streaming compression) - - The compression ratio achievable on small data can be highly improved using - a dictionary. Dictionary compression can be performed in: - - a single step (described as Simple dictionary API) - - a single step, reusing a dictionary (described as Bulk-processing - dictionary API) - - Advanced experimental functions can be accessed using - `#define ZSTD_STATIC_LINKING_ONLY` before including zstd.h. - - Advanced experimental APIs should never be used with a dynamically-linked - library. They are not "stable"; their definitions or signatures may change in - the future. Only static linking is allowed. -*******************************************************************************/ - -/*------ Version ------*/ -#define ZSTD_VERSION_MAJOR 1 -#define ZSTD_VERSION_MINOR 4 -#define ZSTD_VERSION_RELEASE 4 - -#define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) -ZSTDLIB_API unsigned ZSTD_versionNumber(void); /**< to check runtime library version */ - -#define ZSTD_LIB_VERSION ZSTD_VERSION_MAJOR.ZSTD_VERSION_MINOR.ZSTD_VERSION_RELEASE -#define ZSTD_QUOTE(str) #str -#define ZSTD_EXPAND_AND_QUOTE(str) ZSTD_QUOTE(str) -#define ZSTD_VERSION_STRING ZSTD_EXPAND_AND_QUOTE(ZSTD_LIB_VERSION) -ZSTDLIB_API const char* ZSTD_versionString(void); /* requires v1.3.0+ */ - -/* ************************************* - * Default constant - ***************************************/ -#ifndef ZSTD_CLEVEL_DEFAULT -# define ZSTD_CLEVEL_DEFAULT 3 -#endif - -/* ************************************* - * Constants - ***************************************/ - -/* All magic numbers are supposed read/written to/from files/memory using little-endian convention */ -#define ZSTD_MAGICNUMBER 0xFD2FB528 /* valid since v0.8.0 */ -#define ZSTD_MAGIC_DICTIONARY 0xEC30A437 /* valid since v0.7.0 */ -#define ZSTD_MAGIC_SKIPPABLE_START 0x184D2A50 /* all 16 values, from 0x184D2A50 to 0x184D2A5F, signal the beginning of a skippable frame */ -#define ZSTD_MAGIC_SKIPPABLE_MASK 0xFFFFFFF0 - -#define ZSTD_BLOCKSIZELOG_MAX 17 -#define ZSTD_BLOCKSIZE_MAX (1<= `ZSTD_compressBound(srcSize)`. - * @return : compressed size written into `dst` (<= `dstCapacity), - * or an error code if it fails (which can be tested using ZSTD_isError()). */ -ZSTDLIB_API size_t ZSTD_compress( void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - int compressionLevel); - -/*! ZSTD_decompress() : - * `compressedSize` : must be the _exact_ size of some number of compressed and/or skippable frames. - * `dstCapacity` is an upper bound of originalSize to regenerate. - * If user cannot imply a maximum upper bound, it's better to use streaming mode to decompress data. - * @return : the number of bytes decompressed into `dst` (<= `dstCapacity`), - * or an errorCode if it fails (which can be tested using ZSTD_isError()). */ -ZSTDLIB_API size_t ZSTD_decompress( void* dst, size_t dstCapacity, - const void* src, size_t compressedSize); - -/*! ZSTD_getFrameContentSize() : requires v1.3.0+ - * `src` should point to the start of a ZSTD encoded frame. - * `srcSize` must be at least as large as the frame header. - * hint : any size >= `ZSTD_frameHeaderSize_max` is large enough. - * @return : - decompressed size of `src` frame content, if known - * - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined - * - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) - * note 1 : a 0 return value means the frame is valid but "empty". - * note 2 : decompressed size is an optional field, it may not be present, typically in streaming mode. - * When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size. - * In which case, it's necessary to use streaming mode to decompress data. - * Optionally, application can rely on some implicit limit, - * as ZSTD_decompress() only needs an upper bound of decompressed size. - * (For example, data could be necessarily cut into blocks <= 16 KB). - * note 3 : decompressed size is always present when compression is completed using single-pass functions, - * such as ZSTD_compress(), ZSTD_compressCCtx() ZSTD_compress_usingDict() or ZSTD_compress_usingCDict(). - * note 4 : decompressed size can be very large (64-bits value), - * potentially larger than what local system can handle as a single memory segment. - * In which case, it's necessary to use streaming mode to decompress data. - * note 5 : If source is untrusted, decompressed size could be wrong or intentionally modified. - * Always ensure return value fits within application's authorized limits. - * Each application can set its own limits. - * note 6 : This function replaces ZSTD_getDecompressedSize() */ -#define ZSTD_CONTENTSIZE_UNKNOWN (0ULL - 1) -#define ZSTD_CONTENTSIZE_ERROR (0ULL - 2) -ZSTDLIB_API unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize); - -/*! ZSTD_getDecompressedSize() : - * NOTE: This function is now obsolete, in favor of ZSTD_getFrameContentSize(). - * Both functions work the same way, but ZSTD_getDecompressedSize() blends - * "empty", "unknown" and "error" results to the same return value (0), - * while ZSTD_getFrameContentSize() gives them separate return values. - * @return : decompressed size of `src` frame content _if known and not empty_, 0 otherwise. */ -ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize); - -/*! ZSTD_findFrameCompressedSize() : - * `src` should point to the start of a ZSTD frame or skippable frame. - * `srcSize` must be >= first frame size - * @return : the compressed size of the first frame starting at `src`, - * suitable to pass as `srcSize` to `ZSTD_decompress` or similar, - * or an error code if input is invalid */ -ZSTDLIB_API size_t ZSTD_findFrameCompressedSize(const void* src, size_t srcSize); - - -/*====== Helper functions ======*/ -#define ZSTD_COMPRESSBOUND(srcSize) ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0)) /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */ -ZSTDLIB_API size_t ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case single-pass scenario */ -ZSTDLIB_API unsigned ZSTD_isError(size_t code); /*!< tells if a `size_t` function result is an error code */ -ZSTDLIB_API const char* ZSTD_getErrorName(size_t code); /*!< provides readable string from an error code */ -ZSTDLIB_API int ZSTD_minCLevel(void); /*!< minimum negative compression level allowed */ -ZSTDLIB_API int ZSTD_maxCLevel(void); /*!< maximum compression level available */ - - -/*************************************** -* Explicit context -***************************************/ -/*= Compression context - * When compressing many times, - * it is recommended to allocate a context just once, - * and re-use it for each successive compression operation. - * This will make workload friendlier for system's memory. - * Note : re-using context is just a speed / resource optimization. - * It doesn't change the compression ratio, which remains identical. - * Note 2 : In multi-threaded environments, - * use one different context per thread for parallel execution. - */ -typedef struct ZSTD_CCtx_s ZSTD_CCtx; -ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx(void); -ZSTDLIB_API size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx); - -/*! ZSTD_compressCCtx() : - * Same as ZSTD_compress(), using an explicit ZSTD_CCtx. - * Important : in order to behave similarly to `ZSTD_compress()`, - * this function compresses at requested compression level, - * __ignoring any other parameter__ . - * If any advanced parameter was set using the advanced API, - * they will all be reset. Only `compressionLevel` remains. - */ -ZSTDLIB_API size_t ZSTD_compressCCtx(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - int compressionLevel); - -/*= Decompression context - * When decompressing many times, - * it is recommended to allocate a context only once, - * and re-use it for each successive compression operation. - * This will make workload friendlier for system's memory. - * Use one context per thread for parallel execution. */ -typedef struct ZSTD_DCtx_s ZSTD_DCtx; -ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx(void); -ZSTDLIB_API size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx); - -/*! ZSTD_decompressDCtx() : - * Same as ZSTD_decompress(), - * requires an allocated ZSTD_DCtx. - * Compatible with sticky parameters. - */ -ZSTDLIB_API size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize); - - -/*************************************** -* Advanced compression API -***************************************/ - -/* API design : - * Parameters are pushed one by one into an existing context, - * using ZSTD_CCtx_set*() functions. - * Pushed parameters are sticky : they are valid for next compressed frame, and any subsequent frame. - * "sticky" parameters are applicable to `ZSTD_compress2()` and `ZSTD_compressStream*()` ! - * __They do not apply to "simple" one-shot variants such as ZSTD_compressCCtx()__ . - * - * It's possible to reset all parameters to "default" using ZSTD_CCtx_reset(). - * - * This API supercedes all other "advanced" API entry points in the experimental section. - * In the future, we expect to remove from experimental API entry points which are redundant with this API. - */ - - -/* Compression strategies, listed from fastest to strongest */ -typedef enum { ZSTD_fast=1, - ZSTD_dfast=2, - ZSTD_greedy=3, - ZSTD_lazy=4, - ZSTD_lazy2=5, - ZSTD_btlazy2=6, - ZSTD_btopt=7, - ZSTD_btultra=8, - ZSTD_btultra2=9 - /* note : new strategies _might_ be added in the future. - Only the order (from fast to strong) is guaranteed */ -} ZSTD_strategy; - - -typedef enum { - - /* compression parameters - * Note: When compressing with a ZSTD_CDict these parameters are superseded - * by the parameters used to construct the ZSTD_CDict. - * See ZSTD_CCtx_refCDict() for more info (superseded-by-cdict). */ - ZSTD_c_compressionLevel=100, /* Set compression parameters according to pre-defined cLevel table. - * Note that exact compression parameters are dynamically determined, - * depending on both compression level and srcSize (when known). - * Default level is ZSTD_CLEVEL_DEFAULT==3. - * Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT. - * Note 1 : it's possible to pass a negative compression level. - * Note 2 : setting a level resets all other compression parameters to default */ - /* Advanced compression parameters : - * It's possible to pin down compression parameters to some specific values. - * In which case, these values are no longer dynamically selected by the compressor */ - ZSTD_c_windowLog=101, /* Maximum allowed back-reference distance, expressed as power of 2. - * This will set a memory budget for streaming decompression, - * with larger values requiring more memory - * and typically compressing more. - * Must be clamped between ZSTD_WINDOWLOG_MIN and ZSTD_WINDOWLOG_MAX. - * Special: value 0 means "use default windowLog". - * Note: Using a windowLog greater than ZSTD_WINDOWLOG_LIMIT_DEFAULT - * requires explicitly allowing such size at streaming decompression stage. */ - ZSTD_c_hashLog=102, /* Size of the initial probe table, as a power of 2. - * Resulting memory usage is (1 << (hashLog+2)). - * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX. - * Larger tables improve compression ratio of strategies <= dFast, - * and improve speed of strategies > dFast. - * Special: value 0 means "use default hashLog". */ - ZSTD_c_chainLog=103, /* Size of the multi-probe search table, as a power of 2. - * Resulting memory usage is (1 << (chainLog+2)). - * Must be clamped between ZSTD_CHAINLOG_MIN and ZSTD_CHAINLOG_MAX. - * Larger tables result in better and slower compression. - * This parameter is useless for "fast" strategy. - * It's still useful when using "dfast" strategy, - * in which case it defines a secondary probe table. - * Special: value 0 means "use default chainLog". */ - ZSTD_c_searchLog=104, /* Number of search attempts, as a power of 2. - * More attempts result in better and slower compression. - * This parameter is useless for "fast" and "dFast" strategies. - * Special: value 0 means "use default searchLog". */ - ZSTD_c_minMatch=105, /* Minimum size of searched matches. - * Note that Zstandard can still find matches of smaller size, - * it just tweaks its search algorithm to look for this size and larger. - * Larger values increase compression and decompression speed, but decrease ratio. - * Must be clamped between ZSTD_MINMATCH_MIN and ZSTD_MINMATCH_MAX. - * Note that currently, for all strategies < btopt, effective minimum is 4. - * , for all strategies > fast, effective maximum is 6. - * Special: value 0 means "use default minMatchLength". */ - ZSTD_c_targetLength=106, /* Impact of this field depends on strategy. - * For strategies btopt, btultra & btultra2: - * Length of Match considered "good enough" to stop search. - * Larger values make compression stronger, and slower. - * For strategy fast: - * Distance between match sampling. - * Larger values make compression faster, and weaker. - * Special: value 0 means "use default targetLength". */ - ZSTD_c_strategy=107, /* See ZSTD_strategy enum definition. - * The higher the value of selected strategy, the more complex it is, - * resulting in stronger and slower compression. - * Special: value 0 means "use default strategy". */ - - /* LDM mode parameters */ - ZSTD_c_enableLongDistanceMatching=160, /* Enable long distance matching. - * This parameter is designed to improve compression ratio - * for large inputs, by finding large matches at long distance. - * It increases memory usage and window size. - * Note: enabling this parameter increases default ZSTD_c_windowLog to 128 MB - * except when expressly set to a different value. */ - ZSTD_c_ldmHashLog=161, /* Size of the table for long distance matching, as a power of 2. - * Larger values increase memory usage and compression ratio, - * but decrease compression speed. - * Must be clamped between ZSTD_HASHLOG_MIN and ZSTD_HASHLOG_MAX - * default: windowlog - 7. - * Special: value 0 means "automatically determine hashlog". */ - ZSTD_c_ldmMinMatch=162, /* Minimum match size for long distance matcher. - * Larger/too small values usually decrease compression ratio. - * Must be clamped between ZSTD_LDM_MINMATCH_MIN and ZSTD_LDM_MINMATCH_MAX. - * Special: value 0 means "use default value" (default: 64). */ - ZSTD_c_ldmBucketSizeLog=163, /* Log size of each bucket in the LDM hash table for collision resolution. - * Larger values improve collision resolution but decrease compression speed. - * The maximum value is ZSTD_LDM_BUCKETSIZELOG_MAX. - * Special: value 0 means "use default value" (default: 3). */ - ZSTD_c_ldmHashRateLog=164, /* Frequency of inserting/looking up entries into the LDM hash table. - * Must be clamped between 0 and (ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN). - * Default is MAX(0, (windowLog - ldmHashLog)), optimizing hash table usage. - * Larger values improve compression speed. - * Deviating far from default value will likely result in a compression ratio decrease. - * Special: value 0 means "automatically determine hashRateLog". */ - - /* frame parameters */ - ZSTD_c_contentSizeFlag=200, /* Content size will be written into frame header _whenever known_ (default:1) - * Content size must be known at the beginning of compression. - * This is automatically the case when using ZSTD_compress2(), - * For streaming scenarios, content size must be provided with ZSTD_CCtx_setPledgedSrcSize() */ - ZSTD_c_checksumFlag=201, /* A 32-bits checksum of content is written at end of frame (default:0) */ - ZSTD_c_dictIDFlag=202, /* When applicable, dictionary's ID is written into frame header (default:1) */ - - /* multi-threading parameters */ - /* These parameters are only useful if multi-threading is enabled (compiled with build macro ZSTD_MULTITHREAD). - * They return an error otherwise. */ - ZSTD_c_nbWorkers=400, /* Select how many threads will be spawned to compress in parallel. - * When nbWorkers >= 1, triggers asynchronous mode when used with ZSTD_compressStream*() : - * ZSTD_compressStream*() consumes input and flush output if possible, but immediately gives back control to caller, - * while compression work is performed in parallel, within worker threads. - * (note : a strong exception to this rule is when first invocation of ZSTD_compressStream2() sets ZSTD_e_end : - * in which case, ZSTD_compressStream2() delegates to ZSTD_compress2(), which is always a blocking call). - * More workers improve speed, but also increase memory usage. - * Default value is `0`, aka "single-threaded mode" : no worker is spawned, compression is performed inside Caller's thread, all invocations are blocking */ - ZSTD_c_jobSize=401, /* Size of a compression job. This value is enforced only when nbWorkers >= 1. - * Each compression job is completed in parallel, so this value can indirectly impact the nb of active threads. - * 0 means default, which is dynamically determined based on compression parameters. - * Job size must be a minimum of overlap size, or 1 MB, whichever is largest. - * The minimum size is automatically and transparently enforced. */ - ZSTD_c_overlapLog=402, /* Control the overlap size, as a fraction of window size. - * The overlap size is an amount of data reloaded from previous job at the beginning of a new job. - * It helps preserve compression ratio, while each job is compressed in parallel. - * This value is enforced only when nbWorkers >= 1. - * Larger values increase compression ratio, but decrease speed. - * Possible values range from 0 to 9 : - * - 0 means "default" : value will be determined by the library, depending on strategy - * - 1 means "no overlap" - * - 9 means "full overlap", using a full window size. - * Each intermediate rank increases/decreases load size by a factor 2 : - * 9: full window; 8: w/2; 7: w/4; 6: w/8; 5:w/16; 4: w/32; 3:w/64; 2:w/128; 1:no overlap; 0:default - * default value varies between 6 and 9, depending on strategy */ - - /* note : additional experimental parameters are also available - * within the experimental section of the API. - * At the time of this writing, they include : - * ZSTD_c_rsyncable - * ZSTD_c_format - * ZSTD_c_forceMaxWindow - * ZSTD_c_forceAttachDict - * ZSTD_c_literalCompressionMode - * ZSTD_c_targetCBlockSize - * ZSTD_c_srcSizeHint - * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them. - * note : never ever use experimentalParam? names directly; - * also, the enums values themselves are unstable and can still change. - */ - ZSTD_c_experimentalParam1=500, - ZSTD_c_experimentalParam2=10, - ZSTD_c_experimentalParam3=1000, - ZSTD_c_experimentalParam4=1001, - ZSTD_c_experimentalParam5=1002, - ZSTD_c_experimentalParam6=1003, - ZSTD_c_experimentalParam7=1004 -} ZSTD_cParameter; - -typedef struct { - size_t error; - int lowerBound; - int upperBound; -} ZSTD_bounds; - -/*! ZSTD_cParam_getBounds() : - * All parameters must belong to an interval with lower and upper bounds, - * otherwise they will either trigger an error or be automatically clamped. - * @return : a structure, ZSTD_bounds, which contains - * - an error status field, which must be tested using ZSTD_isError() - * - lower and upper bounds, both inclusive - */ -ZSTDLIB_API ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter cParam); - -/*! ZSTD_CCtx_setParameter() : - * Set one compression parameter, selected by enum ZSTD_cParameter. - * All parameters have valid bounds. Bounds can be queried using ZSTD_cParam_getBounds(). - * Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter). - * Setting a parameter is generally only possible during frame initialization (before starting compression). - * Exception : when using multi-threading mode (nbWorkers >= 1), - * the following parameters can be updated _during_ compression (within same frame): - * => compressionLevel, hashLog, chainLog, searchLog, minMatch, targetLength and strategy. - * new parameters will be active for next job only (after a flush()). - * @return : an error code (which can be tested using ZSTD_isError()). - */ -ZSTDLIB_API size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value); - -/*! ZSTD_CCtx_setPledgedSrcSize() : - * Total input data size to be compressed as a single frame. - * Value will be written in frame header, unless if explicitly forbidden using ZSTD_c_contentSizeFlag. - * This value will also be controlled at end of frame, and trigger an error if not respected. - * @result : 0, or an error code (which can be tested with ZSTD_isError()). - * Note 1 : pledgedSrcSize==0 actually means zero, aka an empty frame. - * In order to mean "unknown content size", pass constant ZSTD_CONTENTSIZE_UNKNOWN. - * ZSTD_CONTENTSIZE_UNKNOWN is default value for any new frame. - * Note 2 : pledgedSrcSize is only valid once, for the next frame. - * It's discarded at the end of the frame, and replaced by ZSTD_CONTENTSIZE_UNKNOWN. - * Note 3 : Whenever all input data is provided and consumed in a single round, - * for example with ZSTD_compress2(), - * or invoking immediately ZSTD_compressStream2(,,,ZSTD_e_end), - * this value is automatically overridden by srcSize instead. - */ -ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize); - -typedef enum { - ZSTD_reset_session_only = 1, - ZSTD_reset_parameters = 2, - ZSTD_reset_session_and_parameters = 3 -} ZSTD_ResetDirective; - -/*! ZSTD_CCtx_reset() : - * There are 2 different things that can be reset, independently or jointly : - * - The session : will stop compressing current frame, and make CCtx ready to start a new one. - * Useful after an error, or to interrupt any ongoing compression. - * Any internal data not yet flushed is cancelled. - * Compression parameters and dictionary remain unchanged. - * They will be used to compress next frame. - * Resetting session never fails. - * - The parameters : changes all parameters back to "default". - * This removes any reference to any dictionary too. - * Parameters can only be changed between 2 sessions (i.e. no compression is currently ongoing) - * otherwise the reset fails, and function returns an error value (which can be tested using ZSTD_isError()) - * - Both : similar to resetting the session, followed by resetting parameters. - */ -ZSTDLIB_API size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset); - -/*! ZSTD_compress2() : - * Behave the same as ZSTD_compressCCtx(), but compression parameters are set using the advanced API. - * ZSTD_compress2() always starts a new frame. - * Should cctx hold data from a previously unfinished frame, everything about it is forgotten. - * - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*() - * - The function is always blocking, returns when compression is completed. - * Hint : compression runs faster if `dstCapacity` >= `ZSTD_compressBound(srcSize)`. - * @return : compressed size written into `dst` (<= `dstCapacity), - * or an error code if it fails (which can be tested using ZSTD_isError()). - */ -ZSTDLIB_API size_t ZSTD_compress2( ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize); - - -/*************************************** -* Advanced decompression API -***************************************/ - -/* The advanced API pushes parameters one by one into an existing DCtx context. - * Parameters are sticky, and remain valid for all following frames - * using the same DCtx context. - * It's possible to reset parameters to default values using ZSTD_DCtx_reset(). - * Note : This API is compatible with existing ZSTD_decompressDCtx() and ZSTD_decompressStream(). - * Therefore, no new decompression function is necessary. - */ - -typedef enum { - - ZSTD_d_windowLogMax=100, /* Select a size limit (in power of 2) beyond which - * the streaming API will refuse to allocate memory buffer - * in order to protect the host from unreasonable memory requirements. - * This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode. - * By default, a decompression context accepts window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT). - * Special: value 0 means "use default maximum windowLog". */ - - /* note : additional experimental parameters are also available - * within the experimental section of the API. - * At the time of this writing, they include : - * ZSTD_c_format - * Because they are not stable, it's necessary to define ZSTD_STATIC_LINKING_ONLY to access them. - * note : never ever use experimentalParam? names directly - */ - ZSTD_d_experimentalParam1=1000 - -} ZSTD_dParameter; - -/*! ZSTD_dParam_getBounds() : - * All parameters must belong to an interval with lower and upper bounds, - * otherwise they will either trigger an error or be automatically clamped. - * @return : a structure, ZSTD_bounds, which contains - * - an error status field, which must be tested using ZSTD_isError() - * - both lower and upper bounds, inclusive - */ -ZSTDLIB_API ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam); - -/*! ZSTD_DCtx_setParameter() : - * Set one compression parameter, selected by enum ZSTD_dParameter. - * All parameters have valid bounds. Bounds can be queried using ZSTD_dParam_getBounds(). - * Providing a value beyond bound will either clamp it, or trigger an error (depending on parameter). - * Setting a parameter is only possible during frame initialization (before starting decompression). - * @return : 0, or an error code (which can be tested using ZSTD_isError()). - */ -ZSTDLIB_API size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter param, int value); - -/*! ZSTD_DCtx_reset() : - * Return a DCtx to clean state. - * Session and parameters can be reset jointly or separately. - * Parameters can only be reset when no active frame is being decompressed. - * @return : 0, or an error code, which can be tested with ZSTD_isError() - */ -ZSTDLIB_API size_t ZSTD_DCtx_reset(ZSTD_DCtx* dctx, ZSTD_ResetDirective reset); - - -/**************************** -* Streaming -****************************/ - -typedef struct ZSTD_inBuffer_s { - const void* src; /**< start of input buffer */ - size_t size; /**< size of input buffer */ - size_t pos; /**< position where reading stopped. Will be updated. Necessarily 0 <= pos <= size */ -} ZSTD_inBuffer; - -typedef struct ZSTD_outBuffer_s { - void* dst; /**< start of output buffer */ - size_t size; /**< size of output buffer */ - size_t pos; /**< position where writing stopped. Will be updated. Necessarily 0 <= pos <= size */ -} ZSTD_outBuffer; - - - -/*-*********************************************************************** -* Streaming compression - HowTo -* -* A ZSTD_CStream object is required to track streaming operation. -* Use ZSTD_createCStream() and ZSTD_freeCStream() to create/release resources. -* ZSTD_CStream objects can be reused multiple times on consecutive compression operations. -* It is recommended to re-use ZSTD_CStream since it will play nicer with system's memory, by re-using already allocated memory. -* -* For parallel execution, use one separate ZSTD_CStream per thread. -* -* note : since v1.3.0, ZSTD_CStream and ZSTD_CCtx are the same thing. -* -* Parameters are sticky : when starting a new compression on the same context, -* it will re-use the same sticky parameters as previous compression session. -* When in doubt, it's recommended to fully initialize the context before usage. -* Use ZSTD_CCtx_reset() to reset the context and ZSTD_CCtx_setParameter(), -* ZSTD_CCtx_setPledgedSrcSize(), or ZSTD_CCtx_loadDictionary() and friends to -* set more specific parameters, the pledged source size, or load a dictionary. -* -* Use ZSTD_compressStream2() with ZSTD_e_continue as many times as necessary to -* consume input stream. The function will automatically update both `pos` -* fields within `input` and `output`. -* Note that the function may not consume the entire input, for example, because -* the output buffer is already full, in which case `input.pos < input.size`. -* The caller must check if input has been entirely consumed. -* If not, the caller must make some room to receive more compressed data, -* and then present again remaining input data. -* note: ZSTD_e_continue is guaranteed to make some forward progress when called, -* but doesn't guarantee maximal forward progress. This is especially relevant -* when compressing with multiple threads. The call won't block if it can -* consume some input, but if it can't it will wait for some, but not all, -* output to be flushed. -* @return : provides a minimum amount of data remaining to be flushed from internal buffers -* or an error code, which can be tested using ZSTD_isError(). -* -* At any moment, it's possible to flush whatever data might remain stuck within internal buffer, -* using ZSTD_compressStream2() with ZSTD_e_flush. `output->pos` will be updated. -* Note that, if `output->size` is too small, a single invocation with ZSTD_e_flush might not be enough (return code > 0). -* In which case, make some room to receive more compressed data, and call again ZSTD_compressStream2() with ZSTD_e_flush. -* You must continue calling ZSTD_compressStream2() with ZSTD_e_flush until it returns 0, at which point you can change the -* operation. -* note: ZSTD_e_flush will flush as much output as possible, meaning when compressing with multiple threads, it will -* block until the flush is complete or the output buffer is full. -* @return : 0 if internal buffers are entirely flushed, -* >0 if some data still present within internal buffer (the value is minimal estimation of remaining size), -* or an error code, which can be tested using ZSTD_isError(). -* -* Calling ZSTD_compressStream2() with ZSTD_e_end instructs to finish a frame. -* It will perform a flush and write frame epilogue. -* The epilogue is required for decoders to consider a frame completed. -* flush operation is the same, and follows same rules as calling ZSTD_compressStream2() with ZSTD_e_flush. -* You must continue calling ZSTD_compressStream2() with ZSTD_e_end until it returns 0, at which point you are free to -* start a new frame. -* note: ZSTD_e_end will flush as much output as possible, meaning when compressing with multiple threads, it will -* block until the flush is complete or the output buffer is full. -* @return : 0 if frame fully completed and fully flushed, -* >0 if some data still present within internal buffer (the value is minimal estimation of remaining size), -* or an error code, which can be tested using ZSTD_isError(). -* -* *******************************************************************/ - -typedef ZSTD_CCtx ZSTD_CStream; /**< CCtx and CStream are now effectively same object (>= v1.3.0) */ - /* Continue to distinguish them for compatibility with older versions <= v1.2.0 */ -/*===== ZSTD_CStream management functions =====*/ -ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream(void); -ZSTDLIB_API size_t ZSTD_freeCStream(ZSTD_CStream* zcs); - -/*===== Streaming compression functions =====*/ -typedef enum { - ZSTD_e_continue=0, /* collect more data, encoder decides when to output compressed result, for optimal compression ratio */ - ZSTD_e_flush=1, /* flush any data provided so far, - * it creates (at least) one new block, that can be decoded immediately on reception; - * frame will continue: any future data can still reference previously compressed data, improving compression. - * note : multithreaded compression will block to flush as much output as possible. */ - ZSTD_e_end=2 /* flush any remaining data _and_ close current frame. - * note that frame is only closed after compressed data is fully flushed (return value == 0). - * After that point, any additional data starts a new frame. - * note : each frame is independent (does not reference any content from previous frame). - : note : multithreaded compression will block to flush as much output as possible. */ -} ZSTD_EndDirective; - -/*! ZSTD_compressStream2() : - * Behaves about the same as ZSTD_compressStream, with additional control on end directive. - * - Compression parameters are pushed into CCtx before starting compression, using ZSTD_CCtx_set*() - * - Compression parameters cannot be changed once compression is started (save a list of exceptions in multi-threading mode) - * - output->pos must be <= dstCapacity, input->pos must be <= srcSize - * - output->pos and input->pos will be updated. They are guaranteed to remain below their respective limit. - * - When nbWorkers==0 (default), function is blocking : it completes its job before returning to caller. - * - When nbWorkers>=1, function is non-blocking : it just acquires a copy of input, and distributes jobs to internal worker threads, flush whatever is available, - * and then immediately returns, just indicating that there is some data remaining to be flushed. - * The function nonetheless guarantees forward progress : it will return only after it reads or write at least 1+ byte. - * - Exception : if the first call requests a ZSTD_e_end directive and provides enough dstCapacity, the function delegates to ZSTD_compress2() which is always blocking. - * - @return provides a minimum amount of data remaining to be flushed from internal buffers - * or an error code, which can be tested using ZSTD_isError(). - * if @return != 0, flush is not fully completed, there is still some data left within internal buffers. - * This is useful for ZSTD_e_flush, since in this case more flushes are necessary to empty all buffers. - * For ZSTD_e_end, @return == 0 when internal buffers are fully flushed and frame is completed. - * - after a ZSTD_e_end directive, if internal buffer is not fully flushed (@return != 0), - * only ZSTD_e_end or ZSTD_e_flush operations are allowed. - * Before starting a new compression job, or changing compression parameters, - * it is required to fully flush internal buffers. - */ -ZSTDLIB_API size_t ZSTD_compressStream2( ZSTD_CCtx* cctx, - ZSTD_outBuffer* output, - ZSTD_inBuffer* input, - ZSTD_EndDirective endOp); - - -/* These buffer sizes are softly recommended. - * They are not required : ZSTD_compressStream*() happily accepts any buffer size, for both input and output. - * Respecting the recommended size just makes it a bit easier for ZSTD_compressStream*(), - * reducing the amount of memory shuffling and buffering, resulting in minor performance savings. - * - * However, note that these recommendations are from the perspective of a C caller program. - * If the streaming interface is invoked from some other language, - * especially managed ones such as Java or Go, through a foreign function interface such as jni or cgo, - * a major performance rule is to reduce crossing such interface to an absolute minimum. - * It's not rare that performance ends being spent more into the interface, rather than compression itself. - * In which cases, prefer using large buffers, as large as practical, - * for both input and output, to reduce the nb of roundtrips. - */ -ZSTDLIB_API size_t ZSTD_CStreamInSize(void); /**< recommended size for input buffer */ -ZSTDLIB_API size_t ZSTD_CStreamOutSize(void); /**< recommended size for output buffer. Guarantee to successfully flush at least one complete compressed block. */ - - -/* ***************************************************************************** - * This following is a legacy streaming API. - * It can be replaced by ZSTD_CCtx_reset() and ZSTD_compressStream2(). - * It is redundant, but remains fully supported. - * Advanced parameters and dictionary compression can only be used through the - * new API. - ******************************************************************************/ - -/*! - * Equivalent to: - * - * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - * ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any) - * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel); - */ -ZSTDLIB_API size_t ZSTD_initCStream(ZSTD_CStream* zcs, int compressionLevel); -/*! - * Alternative for ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue). - * NOTE: The return value is different. ZSTD_compressStream() returns a hint for - * the next read size (if non-zero and not an error). ZSTD_compressStream2() - * returns the minimum nb of bytes left to flush (if non-zero and not an error). - */ -ZSTDLIB_API size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input); -/*! Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_flush). */ -ZSTDLIB_API size_t ZSTD_flushStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); -/*! Equivalent to ZSTD_compressStream2(zcs, output, &emptyInput, ZSTD_e_end). */ -ZSTDLIB_API size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output); - - -/*-*************************************************************************** -* Streaming decompression - HowTo -* -* A ZSTD_DStream object is required to track streaming operations. -* Use ZSTD_createDStream() and ZSTD_freeDStream() to create/release resources. -* ZSTD_DStream objects can be re-used multiple times. -* -* Use ZSTD_initDStream() to start a new decompression operation. -* @return : recommended first input size -* Alternatively, use advanced API to set specific properties. -* -* Use ZSTD_decompressStream() repetitively to consume your input. -* The function will update both `pos` fields. -* If `input.pos < input.size`, some input has not been consumed. -* It's up to the caller to present again remaining data. -* The function tries to flush all data decoded immediately, respecting output buffer size. -* If `output.pos < output.size`, decoder has flushed everything it could. -* But if `output.pos == output.size`, there might be some data left within internal buffers., -* In which case, call ZSTD_decompressStream() again to flush whatever remains in the buffer. -* Note : with no additional input provided, amount of data flushed is necessarily <= ZSTD_BLOCKSIZE_MAX. -* @return : 0 when a frame is completely decoded and fully flushed, -* or an error code, which can be tested using ZSTD_isError(), -* or any other value > 0, which means there is still some decoding or flushing to do to complete current frame : -* the return value is a suggested next input size (just a hint for better latency) -* that will never request more than the remaining frame size. -* *******************************************************************************/ - -typedef ZSTD_DCtx ZSTD_DStream; /**< DCtx and DStream are now effectively same object (>= v1.3.0) */ - /* For compatibility with versions <= v1.2.0, prefer differentiating them. */ -/*===== ZSTD_DStream management functions =====*/ -ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream(void); -ZSTDLIB_API size_t ZSTD_freeDStream(ZSTD_DStream* zds); - -/*===== Streaming decompression functions =====*/ - -/* This function is redundant with the advanced API and equivalent to: - * - * ZSTD_DCtx_reset(zds); - * ZSTD_DCtx_refDDict(zds, NULL); - */ -ZSTDLIB_API size_t ZSTD_initDStream(ZSTD_DStream* zds); - -ZSTDLIB_API size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input); - -ZSTDLIB_API size_t ZSTD_DStreamInSize(void); /*!< recommended size for input buffer */ -ZSTDLIB_API size_t ZSTD_DStreamOutSize(void); /*!< recommended size for output buffer. Guarantee to successfully flush at least one complete block in all circumstances. */ - - -/************************** -* Simple dictionary API -***************************/ -/*! ZSTD_compress_usingDict() : - * Compression at an explicit compression level using a Dictionary. - * A dictionary can be any arbitrary data segment (also called a prefix), - * or a buffer with specified information (see dictBuilder/zdict.h). - * Note : This function loads the dictionary, resulting in significant startup delay. - * It's intended for a dictionary used only once. - * Note 2 : When `dict == NULL || dictSize < 8` no dictionary is used. */ -ZSTDLIB_API size_t ZSTD_compress_usingDict(ZSTD_CCtx* ctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict,size_t dictSize, - int compressionLevel); - -/*! ZSTD_decompress_usingDict() : - * Decompression using a known Dictionary. - * Dictionary must be identical to the one used during compression. - * Note : This function loads the dictionary, resulting in significant startup delay. - * It's intended for a dictionary used only once. - * Note : When `dict == NULL || dictSize < 8` no dictionary is used. */ -ZSTDLIB_API size_t ZSTD_decompress_usingDict(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict,size_t dictSize); - - -/*********************************** - * Bulk processing dictionary API - **********************************/ -typedef struct ZSTD_CDict_s ZSTD_CDict; - -/*! ZSTD_createCDict() : - * When compressing multiple messages or blocks using the same dictionary, - * it's recommended to digest the dictionary only once, since it's a costly operation. - * ZSTD_createCDict() will create a state from digesting a dictionary. - * The resulting state can be used for future compression operations with very limited startup cost. - * ZSTD_CDict can be created once and shared by multiple threads concurrently, since its usage is read-only. - * @dictBuffer can be released after ZSTD_CDict creation, because its content is copied within CDict. - * Note 1 : Consider experimental function `ZSTD_createCDict_byReference()` if you prefer to not duplicate @dictBuffer content. - * Note 2 : A ZSTD_CDict can be created from an empty @dictBuffer, - * in which case the only thing that it transports is the @compressionLevel. - * This can be useful in a pipeline featuring ZSTD_compress_usingCDict() exclusively, - * expecting a ZSTD_CDict parameter with any data, including those without a known dictionary. */ -ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict(const void* dictBuffer, size_t dictSize, - int compressionLevel); - -/*! ZSTD_freeCDict() : - * Function frees memory allocated by ZSTD_createCDict(). */ -ZSTDLIB_API size_t ZSTD_freeCDict(ZSTD_CDict* CDict); - -/*! ZSTD_compress_usingCDict() : - * Compression using a digested Dictionary. - * Recommended when same dictionary is used multiple times. - * Note : compression level is _decided at dictionary creation time_, - * and frame parameters are hardcoded (dictID=yes, contentSize=yes, checksum=no) */ -ZSTDLIB_API size_t ZSTD_compress_usingCDict(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const ZSTD_CDict* cdict); - - -typedef struct ZSTD_DDict_s ZSTD_DDict; - -/*! ZSTD_createDDict() : - * Create a digested dictionary, ready to start decompression operation without startup delay. - * dictBuffer can be released after DDict creation, as its content is copied inside DDict. */ -ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict(const void* dictBuffer, size_t dictSize); - -/*! ZSTD_freeDDict() : - * Function frees memory allocated with ZSTD_createDDict() */ -ZSTDLIB_API size_t ZSTD_freeDDict(ZSTD_DDict* ddict); - -/*! ZSTD_decompress_usingDDict() : - * Decompression using a digested Dictionary. - * Recommended when same dictionary is used multiple times. */ -ZSTDLIB_API size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const ZSTD_DDict* ddict); - - -/******************************** - * Dictionary helper functions - *******************************/ - -/*! ZSTD_getDictID_fromDict() : - * Provides the dictID stored within dictionary. - * if @return == 0, the dictionary is not conformant with Zstandard specification. - * It can still be loaded, but as a content-only dictionary. */ -ZSTDLIB_API unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize); - -/*! ZSTD_getDictID_fromDDict() : - * Provides the dictID of the dictionary loaded into `ddict`. - * If @return == 0, the dictionary is not conformant to Zstandard specification, or empty. - * Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */ -ZSTDLIB_API unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict); - -/*! ZSTD_getDictID_fromFrame() : - * Provides the dictID required to decompressed the frame stored within `src`. - * If @return == 0, the dictID could not be decoded. - * This could for one of the following reasons : - * - The frame does not require a dictionary to be decoded (most common case). - * - The frame was built with dictID intentionally removed. Whatever dictionary is necessary is a hidden information. - * Note : this use case also happens when using a non-conformant dictionary. - * - `srcSize` is too small, and as a result, the frame header could not be decoded (only possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`). - * - This is not a Zstandard frame. - * When identifying the exact failure cause, it's possible to use ZSTD_getFrameHeader(), which will provide a more precise error code. */ -ZSTDLIB_API unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize); - - -/******************************************************************************* - * Advanced dictionary and prefix API - * - * This API allows dictionaries to be used with ZSTD_compress2(), - * ZSTD_compressStream2(), and ZSTD_decompress(). Dictionaries are sticky, and - * only reset with the context is reset with ZSTD_reset_parameters or - * ZSTD_reset_session_and_parameters. Prefixes are single-use. - ******************************************************************************/ - - -/*! ZSTD_CCtx_loadDictionary() : - * Create an internal CDict from `dict` buffer. - * Decompression will have to use same dictionary. - * @result : 0, or an error code (which can be tested with ZSTD_isError()). - * Special: Loading a NULL (or 0-size) dictionary invalidates previous dictionary, - * meaning "return to no-dictionary mode". - * Note 1 : Dictionary is sticky, it will be used for all future compressed frames. - * To return to "no-dictionary" situation, load a NULL dictionary (or reset parameters). - * Note 2 : Loading a dictionary involves building tables. - * It's also a CPU consuming operation, with non-negligible impact on latency. - * Tables are dependent on compression parameters, and for this reason, - * compression parameters can no longer be changed after loading a dictionary. - * Note 3 :`dict` content will be copied internally. - * Use experimental ZSTD_CCtx_loadDictionary_byReference() to reference content instead. - * In such a case, dictionary buffer must outlive its users. - * Note 4 : Use ZSTD_CCtx_loadDictionary_advanced() - * to precisely select how dictionary content must be interpreted. */ -ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize); - -/*! ZSTD_CCtx_refCDict() : - * Reference a prepared dictionary, to be used for all next compressed frames. - * Note that compression parameters are enforced from within CDict, - * and supersede any compression parameter previously set within CCtx. - * The parameters ignored are labled as "superseded-by-cdict" in the ZSTD_cParameter enum docs. - * The ignored parameters will be used again if the CCtx is returned to no-dictionary mode. - * The dictionary will remain valid for future compressed frames using same CCtx. - * @result : 0, or an error code (which can be tested with ZSTD_isError()). - * Special : Referencing a NULL CDict means "return to no-dictionary mode". - * Note 1 : Currently, only one dictionary can be managed. - * Referencing a new dictionary effectively "discards" any previous one. - * Note 2 : CDict is just referenced, its lifetime must outlive its usage within CCtx. */ -ZSTDLIB_API size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); - -/*! ZSTD_CCtx_refPrefix() : - * Reference a prefix (single-usage dictionary) for next compressed frame. - * A prefix is **only used once**. Tables are discarded at end of frame (ZSTD_e_end). - * Decompression will need same prefix to properly regenerate data. - * Compressing with a prefix is similar in outcome as performing a diff and compressing it, - * but performs much faster, especially during decompression (compression speed is tunable with compression level). - * @result : 0, or an error code (which can be tested with ZSTD_isError()). - * Special: Adding any prefix (including NULL) invalidates any previous prefix or dictionary - * Note 1 : Prefix buffer is referenced. It **must** outlive compression. - * Its content must remain unmodified during compression. - * Note 2 : If the intention is to diff some large src data blob with some prior version of itself, - * ensure that the window size is large enough to contain the entire source. - * See ZSTD_c_windowLog. - * Note 3 : Referencing a prefix involves building tables, which are dependent on compression parameters. - * It's a CPU consuming operation, with non-negligible impact on latency. - * If there is a need to use the same prefix multiple times, consider loadDictionary instead. - * Note 4 : By default, the prefix is interpreted as raw content (ZSTD_dct_rawContent). - * Use experimental ZSTD_CCtx_refPrefix_advanced() to alter dictionary interpretation. */ -ZSTDLIB_API size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, - const void* prefix, size_t prefixSize); - -/*! ZSTD_DCtx_loadDictionary() : - * Create an internal DDict from dict buffer, - * to be used to decompress next frames. - * The dictionary remains valid for all future frames, until explicitly invalidated. - * @result : 0, or an error code (which can be tested with ZSTD_isError()). - * Special : Adding a NULL (or 0-size) dictionary invalidates any previous dictionary, - * meaning "return to no-dictionary mode". - * Note 1 : Loading a dictionary involves building tables, - * which has a non-negligible impact on CPU usage and latency. - * It's recommended to "load once, use many times", to amortize the cost - * Note 2 :`dict` content will be copied internally, so `dict` can be released after loading. - * Use ZSTD_DCtx_loadDictionary_byReference() to reference dictionary content instead. - * Note 3 : Use ZSTD_DCtx_loadDictionary_advanced() to take control of - * how dictionary content is loaded and interpreted. - */ -ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); - -/*! ZSTD_DCtx_refDDict() : - * Reference a prepared dictionary, to be used to decompress next frames. - * The dictionary remains active for decompression of future frames using same DCtx. - * @result : 0, or an error code (which can be tested with ZSTD_isError()). - * Note 1 : Currently, only one dictionary can be managed. - * Referencing a new dictionary effectively "discards" any previous one. - * Special: referencing a NULL DDict means "return to no-dictionary mode". - * Note 2 : DDict is just referenced, its lifetime must outlive its usage from DCtx. - */ -ZSTDLIB_API size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); - -/*! ZSTD_DCtx_refPrefix() : - * Reference a prefix (single-usage dictionary) to decompress next frame. - * This is the reverse operation of ZSTD_CCtx_refPrefix(), - * and must use the same prefix as the one used during compression. - * Prefix is **only used once**. Reference is discarded at end of frame. - * End of frame is reached when ZSTD_decompressStream() returns 0. - * @result : 0, or an error code (which can be tested with ZSTD_isError()). - * Note 1 : Adding any prefix (including NULL) invalidates any previously set prefix or dictionary - * Note 2 : Prefix buffer is referenced. It **must** outlive decompression. - * Prefix buffer must remain unmodified up to the end of frame, - * reached when ZSTD_decompressStream() returns 0. - * Note 3 : By default, the prefix is treated as raw content (ZSTD_dct_rawContent). - * Use ZSTD_CCtx_refPrefix_advanced() to alter dictMode (Experimental section) - * Note 4 : Referencing a raw content prefix has almost no cpu nor memory cost. - * A full dictionary is more costly, as it requires building tables. - */ -ZSTDLIB_API size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx, - const void* prefix, size_t prefixSize); - -/* === Memory management === */ - -/*! ZSTD_sizeof_*() : - * These functions give the _current_ memory usage of selected object. - * Note that object memory usage can evolve (increase or decrease) over time. */ -ZSTDLIB_API size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx); -ZSTDLIB_API size_t ZSTD_sizeof_DCtx(const ZSTD_DCtx* dctx); -ZSTDLIB_API size_t ZSTD_sizeof_CStream(const ZSTD_CStream* zcs); -ZSTDLIB_API size_t ZSTD_sizeof_DStream(const ZSTD_DStream* zds); -ZSTDLIB_API size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict); -ZSTDLIB_API size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict); - -#endif /* ZSTD_H_235446 */ - - -/* ************************************************************************************** - * ADVANCED AND EXPERIMENTAL FUNCTIONS - **************************************************************************************** - * The definitions in the following section are considered experimental. - * They are provided for advanced scenarios. - * They should never be used with a dynamic library, as prototypes may change in the future. - * Use them only in association with static linking. - * ***************************************************************************************/ - -#if defined(ZSTD_STATIC_LINKING_ONLY) && !defined(ZSTD_H_ZSTD_STATIC_LINKING_ONLY) -#define ZSTD_H_ZSTD_STATIC_LINKING_ONLY - -/**************************************************************************************** - * experimental API (static linking only) - **************************************************************************************** - * The following symbols and constants - * are not planned to join "stable API" status in the near future. - * They can still change in future versions. - * Some of them are planned to remain in the static_only section indefinitely. - * Some of them might be removed in the future (especially when redundant with existing stable functions) - * ***************************************************************************************/ - -#define ZSTD_FRAMEHEADERSIZE_PREFIX(format) ((format) == ZSTD_f_zstd1 ? 5 : 1) /* minimum input size required to query frame header size */ -#define ZSTD_FRAMEHEADERSIZE_MIN(format) ((format) == ZSTD_f_zstd1 ? 6 : 2) -#define ZSTD_FRAMEHEADERSIZE_MAX 18 /* can be useful for static allocation */ -#define ZSTD_SKIPPABLEHEADERSIZE 8 - -/* compression parameter bounds */ -#define ZSTD_WINDOWLOG_MAX_32 30 -#define ZSTD_WINDOWLOG_MAX_64 31 -#define ZSTD_WINDOWLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64)) -#define ZSTD_WINDOWLOG_MIN 10 -#define ZSTD_HASHLOG_MAX ((ZSTD_WINDOWLOG_MAX < 30) ? ZSTD_WINDOWLOG_MAX : 30) -#define ZSTD_HASHLOG_MIN 6 -#define ZSTD_CHAINLOG_MAX_32 29 -#define ZSTD_CHAINLOG_MAX_64 30 -#define ZSTD_CHAINLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_CHAINLOG_MAX_32 : ZSTD_CHAINLOG_MAX_64)) -#define ZSTD_CHAINLOG_MIN ZSTD_HASHLOG_MIN -#define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1) -#define ZSTD_SEARCHLOG_MIN 1 -#define ZSTD_MINMATCH_MAX 7 /* only for ZSTD_fast, other strategies are limited to 6 */ -#define ZSTD_MINMATCH_MIN 3 /* only for ZSTD_btopt+, faster strategies are limited to 4 */ -#define ZSTD_TARGETLENGTH_MAX ZSTD_BLOCKSIZE_MAX -#define ZSTD_TARGETLENGTH_MIN 0 /* note : comparing this constant to an unsigned results in a tautological test */ -#define ZSTD_STRATEGY_MIN ZSTD_fast -#define ZSTD_STRATEGY_MAX ZSTD_btultra2 - - -#define ZSTD_OVERLAPLOG_MIN 0 -#define ZSTD_OVERLAPLOG_MAX 9 - -#define ZSTD_WINDOWLOG_LIMIT_DEFAULT 27 /* by default, the streaming decoder will refuse any frame - * requiring larger than (1< 3, then this is seqDef.offset - 3 - * If seqDef.offset < 3, then this is the corresponding repeat offset - * But if seqDef.offset < 3 and litLength == 0, this is the - * repeat offset before the corresponding repeat offset - * And if seqDef.offset == 3 and litLength == 0, this is the - * most recent repeat offset - 1 - */ - unsigned int offset; - unsigned int litLength; /* Literal length */ - unsigned int matchLength; /* Match length */ - /* 0 when seq not rep and seqDef.offset otherwise - * when litLength == 0 this will be <= 4, otherwise <= 3 like normal - */ - unsigned int rep; -} ZSTD_Sequence; - -typedef struct { - unsigned windowLog; /**< largest match distance : larger == more compression, more memory needed during decompression */ - unsigned chainLog; /**< fully searched segment : larger == more compression, slower, more memory (useless for fast) */ - unsigned hashLog; /**< dispatch table : larger == faster, more memory */ - unsigned searchLog; /**< nb of searches : larger == more compression, slower */ - unsigned minMatch; /**< match length searched : larger == faster decompression, sometimes less compression */ - unsigned targetLength; /**< acceptable match size for optimal parser (only) : larger == more compression, slower */ - ZSTD_strategy strategy; /**< see ZSTD_strategy definition above */ -} ZSTD_compressionParameters; - -typedef struct { - int contentSizeFlag; /**< 1: content size will be in frame header (when known) */ - int checksumFlag; /**< 1: generate a 32-bits checksum using XXH64 algorithm at end of frame, for error detection */ - int noDictIDFlag; /**< 1: no dictID will be saved into frame header (dictID is only useful for dictionary compression) */ -} ZSTD_frameParameters; - -typedef struct { - ZSTD_compressionParameters cParams; - ZSTD_frameParameters fParams; -} ZSTD_parameters; - -typedef enum { - ZSTD_dct_auto = 0, /* dictionary is "full" when starting with ZSTD_MAGIC_DICTIONARY, otherwise it is "rawContent" */ - ZSTD_dct_rawContent = 1, /* ensures dictionary is always loaded as rawContent, even if it starts with ZSTD_MAGIC_DICTIONARY */ - ZSTD_dct_fullDict = 2 /* refuses to load a dictionary if it does not respect Zstandard's specification, starting with ZSTD_MAGIC_DICTIONARY */ -} ZSTD_dictContentType_e; - -typedef enum { - ZSTD_dlm_byCopy = 0, /**< Copy dictionary content internally */ - ZSTD_dlm_byRef = 1 /**< Reference dictionary content -- the dictionary buffer must outlive its users. */ -} ZSTD_dictLoadMethod_e; - -typedef enum { - ZSTD_f_zstd1 = 0, /* zstd frame format, specified in zstd_compression_format.md (default) */ - ZSTD_f_zstd1_magicless = 1 /* Variant of zstd frame format, without initial 4-bytes magic number. - * Useful to save 4 bytes per generated frame. - * Decoder cannot recognise automatically this format, requiring this instruction. */ -} ZSTD_format_e; - -typedef enum { - /* Note: this enum and the behavior it controls are effectively internal - * implementation details of the compressor. They are expected to continue - * to evolve and should be considered only in the context of extremely - * advanced performance tuning. - * - * Zstd currently supports the use of a CDict in three ways: - * - * - The contents of the CDict can be copied into the working context. This - * means that the compression can search both the dictionary and input - * while operating on a single set of internal tables. This makes - * the compression faster per-byte of input. However, the initial copy of - * the CDict's tables incurs a fixed cost at the beginning of the - * compression. For small compressions (< 8 KB), that copy can dominate - * the cost of the compression. - * - * - The CDict's tables can be used in-place. In this model, compression is - * slower per input byte, because the compressor has to search two sets of - * tables. However, this model incurs no start-up cost (as long as the - * working context's tables can be reused). For small inputs, this can be - * faster than copying the CDict's tables. - * - * - The CDict's tables are not used at all, and instead we use the working - * context alone to reload the dictionary and use params based on the source - * size. See ZSTD_compress_insertDictionary() and ZSTD_compress_usingDict(). - * This method is effective when the dictionary sizes are very small relative - * to the input size, and the input size is fairly large to begin with. - * - * Zstd has a simple internal heuristic that selects which strategy to use - * at the beginning of a compression. However, if experimentation shows that - * Zstd is making poor choices, it is possible to override that choice with - * this enum. - */ - ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */ - ZSTD_dictForceAttach = 1, /* Never copy the dictionary. */ - ZSTD_dictForceCopy = 2, /* Always copy the dictionary. */ - ZSTD_dictForceLoad = 3 /* Always reload the dictionary */ -} ZSTD_dictAttachPref_e; - -typedef enum { - ZSTD_lcm_auto = 0, /**< Automatically determine the compression mode based on the compression level. - * Negative compression levels will be uncompressed, and positive compression - * levels will be compressed. */ - ZSTD_lcm_huffman = 1, /**< Always attempt Huffman compression. Uncompressed literals will still be - * emitted if Huffman compression is not profitable. */ - ZSTD_lcm_uncompressed = 2 /**< Always emit uncompressed literals. */ -} ZSTD_literalCompressionMode_e; - - -/*************************************** -* Frame size functions -***************************************/ - -/*! ZSTD_findDecompressedSize() : - * `src` should point to the start of a series of ZSTD encoded and/or skippable frames - * `srcSize` must be the _exact_ size of this series - * (i.e. there should be a frame boundary at `src + srcSize`) - * @return : - decompressed size of all data in all successive frames - * - if the decompressed size cannot be determined: ZSTD_CONTENTSIZE_UNKNOWN - * - if an error occurred: ZSTD_CONTENTSIZE_ERROR - * - * note 1 : decompressed size is an optional field, that may not be present, especially in streaming mode. - * When `return==ZSTD_CONTENTSIZE_UNKNOWN`, data to decompress could be any size. - * In which case, it's necessary to use streaming mode to decompress data. - * note 2 : decompressed size is always present when compression is done with ZSTD_compress() - * note 3 : decompressed size can be very large (64-bits value), - * potentially larger than what local system can handle as a single memory segment. - * In which case, it's necessary to use streaming mode to decompress data. - * note 4 : If source is untrusted, decompressed size could be wrong or intentionally modified. - * Always ensure result fits within application's authorized limits. - * Each application can set its own limits. - * note 5 : ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to - * read each contained frame header. This is fast as most of the data is skipped, - * however it does mean that all frame data must be present and valid. */ -ZSTDLIB_API unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize); - -/*! ZSTD_decompressBound() : - * `src` should point to the start of a series of ZSTD encoded and/or skippable frames - * `srcSize` must be the _exact_ size of this series - * (i.e. there should be a frame boundary at `src + srcSize`) - * @return : - upper-bound for the decompressed size of all data in all successive frames - * - if an error occured: ZSTD_CONTENTSIZE_ERROR - * - * note 1 : an error can occur if `src` contains an invalid or incorrectly formatted frame. - * note 2 : the upper-bound is exact when the decompressed size field is available in every ZSTD encoded frame of `src`. - * in this case, `ZSTD_findDecompressedSize` and `ZSTD_decompressBound` return the same value. - * note 3 : when the decompressed size field isn't available, the upper-bound for that frame is calculated by: - * upper-bound = # blocks * min(128 KB, Window_Size) - */ -ZSTDLIB_API unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize); - -/*! ZSTD_frameHeaderSize() : - * srcSize must be >= ZSTD_FRAMEHEADERSIZE_PREFIX. - * @return : size of the Frame Header, - * or an error code (if srcSize is too small) */ -ZSTDLIB_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize); - -/*! ZSTD_getSequences() : - * Extract sequences from the sequence store - * zc can be used to insert custom compression params. - * This function invokes ZSTD_compress2 - * @return : number of sequences extracted - */ -ZSTDLIB_API size_t ZSTD_getSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs, - size_t outSeqsSize, const void* src, size_t srcSize); - - -/*************************************** -* Memory management -***************************************/ - -/*! ZSTD_estimate*() : - * These functions make it possible to estimate memory usage of a future - * {D,C}Ctx, before its creation. - * - * ZSTD_estimateCCtxSize() will provide a budget large enough for any - * compression level up to selected one. Unlike ZSTD_estimateCStreamSize*(), - * this estimate does not include space for a window buffer, so this estimate - * is guaranteed to be enough for single-shot compressions, but not streaming - * compressions. It will however assume the input may be arbitrarily large, - * which is the worst case. If srcSize is known to always be small, - * ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation. - * ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with - * ZSTD_getCParams() to create cParams from compressionLevel. - * ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with - * ZSTD_CCtxParams_setParameter(). - * - * Note: only single-threaded compression is supported. This function will - * return an error code if ZSTD_c_nbWorkers is >= 1. */ -ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel); -ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams); -ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params); -ZSTDLIB_API size_t ZSTD_estimateDCtxSize(void); - -/*! ZSTD_estimateCStreamSize() : - * ZSTD_estimateCStreamSize() will provide a budget large enough for any compression level up to selected one. - * It will also consider src size to be arbitrarily "large", which is worst case. - * If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation. - * ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel. - * ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1. - * Note : CStream size estimation is only correct for single-threaded compression. - * ZSTD_DStream memory budget depends on window Size. - * This information can be passed manually, using ZSTD_estimateDStreamSize, - * or deducted from a valid frame Header, using ZSTD_estimateDStreamSize_fromFrame(); - * Note : if streaming is init with function ZSTD_init?Stream_usingDict(), - * an internal ?Dict will be created, which additional size is not estimated here. - * In this case, get total size by adding ZSTD_estimate?DictSize */ -ZSTDLIB_API size_t ZSTD_estimateCStreamSize(int compressionLevel); -ZSTDLIB_API size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams); -ZSTDLIB_API size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params); -ZSTDLIB_API size_t ZSTD_estimateDStreamSize(size_t windowSize); -ZSTDLIB_API size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize); - -/*! ZSTD_estimate?DictSize() : - * ZSTD_estimateCDictSize() will bet that src size is relatively "small", and content is copied, like ZSTD_createCDict(). - * ZSTD_estimateCDictSize_advanced() makes it possible to control compression parameters precisely, like ZSTD_createCDict_advanced(). - * Note : dictionaries created by reference (`ZSTD_dlm_byRef`) are logically smaller. - */ -ZSTDLIB_API size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel); -ZSTDLIB_API size_t ZSTD_estimateCDictSize_advanced(size_t dictSize, ZSTD_compressionParameters cParams, ZSTD_dictLoadMethod_e dictLoadMethod); -ZSTDLIB_API size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod); - -/*! ZSTD_initStatic*() : - * Initialize an object using a pre-allocated fixed-size buffer. - * workspace: The memory area to emplace the object into. - * Provided pointer *must be 8-bytes aligned*. - * Buffer must outlive object. - * workspaceSize: Use ZSTD_estimate*Size() to determine - * how large workspace must be to support target scenario. - * @return : pointer to object (same address as workspace, just different type), - * or NULL if error (size too small, incorrect alignment, etc.) - * Note : zstd will never resize nor malloc() when using a static buffer. - * If the object requires more memory than available, - * zstd will just error out (typically ZSTD_error_memory_allocation). - * Note 2 : there is no corresponding "free" function. - * Since workspace is allocated externally, it must be freed externally too. - * Note 3 : cParams : use ZSTD_getCParams() to convert a compression level - * into its associated cParams. - * Limitation 1 : currently not compatible with internal dictionary creation, triggered by - * ZSTD_CCtx_loadDictionary(), ZSTD_initCStream_usingDict() or ZSTD_initDStream_usingDict(). - * Limitation 2 : static cctx currently not compatible with multi-threading. - * Limitation 3 : static dctx is incompatible with legacy support. - */ -ZSTDLIB_API ZSTD_CCtx* ZSTD_initStaticCCtx(void* workspace, size_t workspaceSize); -ZSTDLIB_API ZSTD_CStream* ZSTD_initStaticCStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticCCtx() */ - -ZSTDLIB_API ZSTD_DCtx* ZSTD_initStaticDCtx(void* workspace, size_t workspaceSize); -ZSTDLIB_API ZSTD_DStream* ZSTD_initStaticDStream(void* workspace, size_t workspaceSize); /**< same as ZSTD_initStaticDCtx() */ - -ZSTDLIB_API const ZSTD_CDict* ZSTD_initStaticCDict( - void* workspace, size_t workspaceSize, - const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType, - ZSTD_compressionParameters cParams); - -ZSTDLIB_API const ZSTD_DDict* ZSTD_initStaticDDict( - void* workspace, size_t workspaceSize, - const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType); - - -/*! Custom memory allocation : - * These prototypes make it possible to pass your own allocation/free functions. - * ZSTD_customMem is provided at creation time, using ZSTD_create*_advanced() variants listed below. - * All allocation/free operations will be completed using these custom variants instead of regular ones. - */ -typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size); -typedef void (*ZSTD_freeFunction) (void* opaque, void* address); -typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem; -static ZSTD_customMem const ZSTD_defaultCMem = { NULL, NULL, NULL }; /**< this constant defers to stdlib's functions */ - -ZSTDLIB_API ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem); -ZSTDLIB_API ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem); -ZSTDLIB_API ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem); -ZSTDLIB_API ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem); - -ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_advanced(const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType, - ZSTD_compressionParameters cParams, - ZSTD_customMem customMem); - -ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType, - ZSTD_customMem customMem); - - - -/*************************************** -* Advanced compression functions -***************************************/ - -/*! ZSTD_createCDict_byReference() : - * Create a digested dictionary for compression - * Dictionary content is just referenced, not duplicated. - * As a consequence, `dictBuffer` **must** outlive CDict, - * and its content must remain unmodified throughout the lifetime of CDict. - * note: equivalent to ZSTD_createCDict_advanced(), with dictLoadMethod==ZSTD_dlm_byRef */ -ZSTDLIB_API ZSTD_CDict* ZSTD_createCDict_byReference(const void* dictBuffer, size_t dictSize, int compressionLevel); - -/*! ZSTD_getCParams() : - * @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize. - * `estimatedSrcSize` value is optional, select 0 if not known */ -ZSTDLIB_API ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize); - -/*! ZSTD_getParams() : - * same as ZSTD_getCParams(), but @return a full `ZSTD_parameters` object instead of sub-component `ZSTD_compressionParameters`. - * All fields of `ZSTD_frameParameters` are set to default : contentSize=1, checksum=0, noDictID=0 */ -ZSTDLIB_API ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize); - -/*! ZSTD_checkCParams() : - * Ensure param values remain within authorized range. - * @return 0 on success, or an error code (can be checked with ZSTD_isError()) */ -ZSTDLIB_API size_t ZSTD_checkCParams(ZSTD_compressionParameters params); - -/*! ZSTD_adjustCParams() : - * optimize params for a given `srcSize` and `dictSize`. - * `srcSize` can be unknown, in which case use ZSTD_CONTENTSIZE_UNKNOWN. - * `dictSize` must be `0` when there is no dictionary. - * cPar can be invalid : all parameters will be clamped within valid range in the @return struct. - * This function never fails (wide contract) */ -ZSTDLIB_API ZSTD_compressionParameters ZSTD_adjustCParams(ZSTD_compressionParameters cPar, unsigned long long srcSize, size_t dictSize); - -/*! ZSTD_compress_advanced() : - * Note : this function is now DEPRECATED. - * It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_setParameter() and other parameter setters. - * This prototype will be marked as deprecated and generate compilation warning on reaching v1.5.x */ -ZSTDLIB_API size_t ZSTD_compress_advanced(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict,size_t dictSize, - ZSTD_parameters params); - -/*! ZSTD_compress_usingCDict_advanced() : - * Note : this function is now REDUNDANT. - * It can be replaced by ZSTD_compress2(), in combination with ZSTD_CCtx_loadDictionary() and other parameter setters. - * This prototype will be marked as deprecated and generate compilation warning in some future version */ -ZSTDLIB_API size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const ZSTD_CDict* cdict, - ZSTD_frameParameters fParams); - - -/*! ZSTD_CCtx_loadDictionary_byReference() : - * Same as ZSTD_CCtx_loadDictionary(), but dictionary content is referenced, instead of being copied into CCtx. - * It saves some memory, but also requires that `dict` outlives its usage within `cctx` */ -ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference(ZSTD_CCtx* cctx, const void* dict, size_t dictSize); - -/*! ZSTD_CCtx_loadDictionary_advanced() : - * Same as ZSTD_CCtx_loadDictionary(), but gives finer control over - * how to load the dictionary (by copy ? by reference ?) - * and how to interpret it (automatic ? force raw mode ? full mode only ?) */ -ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType); - -/*! ZSTD_CCtx_refPrefix_advanced() : - * Same as ZSTD_CCtx_refPrefix(), but gives finer control over - * how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */ -ZSTDLIB_API size_t ZSTD_CCtx_refPrefix_advanced(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType); - -/* === experimental parameters === */ -/* these parameters can be used with ZSTD_setParameter() - * they are not guaranteed to remain supported in the future */ - - /* Enables rsyncable mode, - * which makes compressed files more rsync friendly - * by adding periodic synchronization points to the compressed data. - * The target average block size is ZSTD_c_jobSize / 2. - * It's possible to modify the job size to increase or decrease - * the granularity of the synchronization point. - * Once the jobSize is smaller than the window size, - * it will result in compression ratio degradation. - * NOTE 1: rsyncable mode only works when multithreading is enabled. - * NOTE 2: rsyncable performs poorly in combination with long range mode, - * since it will decrease the effectiveness of synchronization points, - * though mileage may vary. - * NOTE 3: Rsyncable mode limits maximum compression speed to ~400 MB/s. - * If the selected compression level is already running significantly slower, - * the overall speed won't be significantly impacted. - */ - #define ZSTD_c_rsyncable ZSTD_c_experimentalParam1 - -/* Select a compression format. - * The value must be of type ZSTD_format_e. - * See ZSTD_format_e enum definition for details */ -#define ZSTD_c_format ZSTD_c_experimentalParam2 - -/* Force back-reference distances to remain < windowSize, - * even when referencing into Dictionary content (default:0) */ -#define ZSTD_c_forceMaxWindow ZSTD_c_experimentalParam3 - -/* Controls whether the contents of a CDict - * are used in place, or copied into the working context. - * Accepts values from the ZSTD_dictAttachPref_e enum. - * See the comments on that enum for an explanation of the feature. */ -#define ZSTD_c_forceAttachDict ZSTD_c_experimentalParam4 - -/* Controls how the literals are compressed (default is auto). - * The value must be of type ZSTD_literalCompressionMode_e. - * See ZSTD_literalCompressionMode_t enum definition for details. - */ -#define ZSTD_c_literalCompressionMode ZSTD_c_experimentalParam5 - -/* Tries to fit compressed block size to be around targetCBlockSize. - * No target when targetCBlockSize == 0. - * There is no guarantee on compressed block size (default:0) */ -#define ZSTD_c_targetCBlockSize ZSTD_c_experimentalParam6 - -/* User's best guess of source size. - * Hint is not valid when srcSizeHint == 0. - * There is no guarantee that hint is close to actual source size, - * but compression ratio may regress significantly if guess considerably underestimates */ -#define ZSTD_c_srcSizeHint ZSTD_c_experimentalParam7 - -/*! ZSTD_CCtx_getParameter() : - * Get the requested compression parameter value, selected by enum ZSTD_cParameter, - * and store it into int* value. - * @return : 0, or an error code (which can be tested with ZSTD_isError()). - */ -ZSTDLIB_API size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value); - - -/*! ZSTD_CCtx_params : - * Quick howto : - * - ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure - * - ZSTD_CCtxParams_setParameter() : Push parameters one by one into - * an existing ZSTD_CCtx_params structure. - * This is similar to - * ZSTD_CCtx_setParameter(). - * - ZSTD_CCtx_setParametersUsingCCtxParams() : Apply parameters to - * an existing CCtx. - * These parameters will be applied to - * all subsequent frames. - * - ZSTD_compressStream2() : Do compression using the CCtx. - * - ZSTD_freeCCtxParams() : Free the memory. - * - * This can be used with ZSTD_estimateCCtxSize_advanced_usingCCtxParams() - * for static allocation of CCtx for single-threaded compression. - */ -ZSTDLIB_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void); -ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params); - -/*! ZSTD_CCtxParams_reset() : - * Reset params to default values. - */ -ZSTDLIB_API size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params); - -/*! ZSTD_CCtxParams_init() : - * Initializes the compression parameters of cctxParams according to - * compression level. All other parameters are reset to their default values. - */ -ZSTDLIB_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel); - -/*! ZSTD_CCtxParams_init_advanced() : - * Initializes the compression and frame parameters of cctxParams according to - * params. All other parameters are reset to their default values. - */ -ZSTDLIB_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params); - -/*! ZSTD_CCtxParams_setParameter() : - * Similar to ZSTD_CCtx_setParameter. - * Set one compression parameter, selected by enum ZSTD_cParameter. - * Parameters must be applied to a ZSTD_CCtx using ZSTD_CCtx_setParametersUsingCCtxParams(). - * @result : 0, or an error code (which can be tested with ZSTD_isError()). - */ -ZSTDLIB_API size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value); - -/*! ZSTD_CCtxParams_getParameter() : - * Similar to ZSTD_CCtx_getParameter. - * Get the requested value of one compression parameter, selected by enum ZSTD_cParameter. - * @result : 0, or an error code (which can be tested with ZSTD_isError()). - */ -ZSTDLIB_API size_t ZSTD_CCtxParams_getParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value); - -/*! ZSTD_CCtx_setParametersUsingCCtxParams() : - * Apply a set of ZSTD_CCtx_params to the compression context. - * This can be done even after compression is started, - * if nbWorkers==0, this will have no impact until a new compression is started. - * if nbWorkers>=1, new parameters will be picked up at next job, - * with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated). - */ -ZSTDLIB_API size_t ZSTD_CCtx_setParametersUsingCCtxParams( - ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params); - -/*! ZSTD_compressStream2_simpleArgs() : - * Same as ZSTD_compressStream2(), - * but using only integral types as arguments. - * This variant might be helpful for binders from dynamic languages - * which have troubles handling structures containing memory pointers. - */ -ZSTDLIB_API size_t ZSTD_compressStream2_simpleArgs ( - ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, size_t* dstPos, - const void* src, size_t srcSize, size_t* srcPos, - ZSTD_EndDirective endOp); - - -/*************************************** -* Advanced decompression functions -***************************************/ - -/*! ZSTD_isFrame() : - * Tells if the content of `buffer` starts with a valid Frame Identifier. - * Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0. - * Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled. - * Note 3 : Skippable Frame Identifiers are considered valid. */ -ZSTDLIB_API unsigned ZSTD_isFrame(const void* buffer, size_t size); - -/*! ZSTD_createDDict_byReference() : - * Create a digested dictionary, ready to start decompression operation without startup delay. - * Dictionary content is referenced, and therefore stays in dictBuffer. - * It is important that dictBuffer outlives DDict, - * it must remain read accessible throughout the lifetime of DDict */ -ZSTDLIB_API ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize); - -/*! ZSTD_DCtx_loadDictionary_byReference() : - * Same as ZSTD_DCtx_loadDictionary(), - * but references `dict` content instead of copying it into `dctx`. - * This saves memory if `dict` remains around., - * However, it's imperative that `dict` remains accessible (and unmodified) while being used, so it must outlive decompression. */ -ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); - -/*! ZSTD_DCtx_loadDictionary_advanced() : - * Same as ZSTD_DCtx_loadDictionary(), - * but gives direct control over - * how to load the dictionary (by copy ? by reference ?) - * and how to interpret it (automatic ? force raw mode ? full mode only ?). */ -ZSTDLIB_API size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, const void* dict, size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType); - -/*! ZSTD_DCtx_refPrefix_advanced() : - * Same as ZSTD_DCtx_refPrefix(), but gives finer control over - * how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?) */ -ZSTDLIB_API size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType); - -/*! ZSTD_DCtx_setMaxWindowSize() : - * Refuses allocating internal buffers for frames requiring a window size larger than provided limit. - * This protects a decoder context from reserving too much memory for itself (potential attack scenario). - * This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode. - * By default, a decompression context accepts all window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) - * @return : 0, or an error code (which can be tested using ZSTD_isError()). - */ -ZSTDLIB_API size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize); - -/* ZSTD_d_format - * experimental parameter, - * allowing selection between ZSTD_format_e input compression formats - */ -#define ZSTD_d_format ZSTD_d_experimentalParam1 - -/*! ZSTD_DCtx_setFormat() : - * Instruct the decoder context about what kind of data to decode next. - * This instruction is mandatory to decode data without a fully-formed header, - * such ZSTD_f_zstd1_magicless for example. - * @return : 0, or an error code (which can be tested using ZSTD_isError()). */ -ZSTDLIB_API size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format); - -/*! ZSTD_decompressStream_simpleArgs() : - * Same as ZSTD_decompressStream(), - * but using only integral types as arguments. - * This can be helpful for binders from dynamic languages - * which have troubles handling structures containing memory pointers. - */ -ZSTDLIB_API size_t ZSTD_decompressStream_simpleArgs ( - ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, size_t* dstPos, - const void* src, size_t srcSize, size_t* srcPos); - - -/******************************************************************** -* Advanced streaming functions -* Warning : most of these functions are now redundant with the Advanced API. -* Once Advanced API reaches "stable" status, -* redundant functions will be deprecated, and then at some point removed. -********************************************************************/ - -/*===== Advanced Streaming compression functions =====*/ -/**! ZSTD_initCStream_srcSize() : - * This function is deprecated, and equivalent to: - * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - * ZSTD_CCtx_refCDict(zcs, NULL); // clear the dictionary (if any) - * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel); - * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize); - * - * pledgedSrcSize must be correct. If it is not known at init time, use - * ZSTD_CONTENTSIZE_UNKNOWN. Note that, for compatibility with older programs, - * "0" also disables frame content size field. It may be enabled in the future. - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x - */ -ZSTDLIB_API size_t -ZSTD_initCStream_srcSize(ZSTD_CStream* zcs, - int compressionLevel, - unsigned long long pledgedSrcSize); - -/**! ZSTD_initCStream_usingDict() : - * This function is deprecated, and is equivalent to: - * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - * ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel); - * ZSTD_CCtx_loadDictionary(zcs, dict, dictSize); - * - * Creates of an internal CDict (incompatible with static CCtx), except if - * dict == NULL or dictSize < 8, in which case no dict is used. - * Note: dict is loaded with ZSTD_dct_auto (treated as a full zstd dictionary if - * it begins with ZSTD_MAGIC_DICTIONARY, else as raw content) and ZSTD_dlm_byCopy. - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x - */ -ZSTDLIB_API size_t -ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, - const void* dict, size_t dictSize, - int compressionLevel); - -/**! ZSTD_initCStream_advanced() : - * This function is deprecated, and is approximately equivalent to: - * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - * // Pseudocode: Set each zstd parameter and leave the rest as-is. - * for ((param, value) : params) { - * ZSTD_CCtx_setParameter(zcs, param, value); - * } - * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize); - * ZSTD_CCtx_loadDictionary(zcs, dict, dictSize); - * - * dict is loaded with ZSTD_dct_auto and ZSTD_dlm_byCopy. - * pledgedSrcSize must be correct. - * If srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN. - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x - */ -ZSTDLIB_API size_t -ZSTD_initCStream_advanced(ZSTD_CStream* zcs, - const void* dict, size_t dictSize, - ZSTD_parameters params, - unsigned long long pledgedSrcSize); - -/**! ZSTD_initCStream_usingCDict() : - * This function is deprecated, and equivalent to: - * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - * ZSTD_CCtx_refCDict(zcs, cdict); - * - * note : cdict will just be referenced, and must outlive compression session - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x - */ -ZSTDLIB_API size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict); - -/**! ZSTD_initCStream_usingCDict_advanced() : - * This function is DEPRECATED, and is approximately equivalent to: - * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - * // Pseudocode: Set each zstd frame parameter and leave the rest as-is. - * for ((fParam, value) : fParams) { - * ZSTD_CCtx_setParameter(zcs, fParam, value); - * } - * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize); - * ZSTD_CCtx_refCDict(zcs, cdict); - * - * same as ZSTD_initCStream_usingCDict(), with control over frame parameters. - * pledgedSrcSize must be correct. If srcSize is not known at init time, use - * value ZSTD_CONTENTSIZE_UNKNOWN. - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x - */ -ZSTDLIB_API size_t -ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, - const ZSTD_CDict* cdict, - ZSTD_frameParameters fParams, - unsigned long long pledgedSrcSize); - -/*! ZSTD_resetCStream() : - * This function is deprecated, and is equivalent to: - * ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - * ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize); - * - * start a new frame, using same parameters from previous frame. - * This is typically useful to skip dictionary loading stage, since it will re-use it in-place. - * Note that zcs must be init at least once before using ZSTD_resetCStream(). - * If pledgedSrcSize is not known at reset time, use macro ZSTD_CONTENTSIZE_UNKNOWN. - * If pledgedSrcSize > 0, its value must be correct, as it will be written in header, and controlled at the end. - * For the time being, pledgedSrcSize==0 is interpreted as "srcSize unknown" for compatibility with older programs, - * but it will change to mean "empty" in future version, so use macro ZSTD_CONTENTSIZE_UNKNOWN instead. - * @return : 0, or an error code (which can be tested using ZSTD_isError()) - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x - */ -ZSTDLIB_API size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize); - - -typedef struct { - unsigned long long ingested; /* nb input bytes read and buffered */ - unsigned long long consumed; /* nb input bytes actually compressed */ - unsigned long long produced; /* nb of compressed bytes generated and buffered */ - unsigned long long flushed; /* nb of compressed bytes flushed : not provided; can be tracked from caller side */ - unsigned currentJobID; /* MT only : latest started job nb */ - unsigned nbActiveWorkers; /* MT only : nb of workers actively compressing at probe time */ -} ZSTD_frameProgression; - -/* ZSTD_getFrameProgression() : - * tells how much data has been ingested (read from input) - * consumed (input actually compressed) and produced (output) for current frame. - * Note : (ingested - consumed) is amount of input data buffered internally, not yet compressed. - * Aggregates progression inside active worker threads. - */ -ZSTDLIB_API ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx); - -/*! ZSTD_toFlushNow() : - * Tell how many bytes are ready to be flushed immediately. - * Useful for multithreading scenarios (nbWorkers >= 1). - * Probe the oldest active job, defined as oldest job not yet entirely flushed, - * and check its output buffer. - * @return : amount of data stored in oldest job and ready to be flushed immediately. - * if @return == 0, it means either : - * + there is no active job (could be checked with ZSTD_frameProgression()), or - * + oldest job is still actively compressing data, - * but everything it has produced has also been flushed so far, - * therefore flush speed is limited by production speed of oldest job - * irrespective of the speed of concurrent (and newer) jobs. - */ -ZSTDLIB_API size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx); - - -/*===== Advanced Streaming decompression functions =====*/ -/** - * This function is deprecated, and is equivalent to: - * - * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); - * ZSTD_DCtx_loadDictionary(zds, dict, dictSize); - * - * note: no dictionary will be used if dict == NULL or dictSize < 8 - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x - */ -ZSTDLIB_API size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize); - -/** - * This function is deprecated, and is equivalent to: - * - * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); - * ZSTD_DCtx_refDDict(zds, ddict); - * - * note : ddict is referenced, it must outlive decompression session - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x - */ -ZSTDLIB_API size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* zds, const ZSTD_DDict* ddict); - -/** - * This function is deprecated, and is equivalent to: - * - * ZSTD_DCtx_reset(zds, ZSTD_reset_session_only); - * - * re-use decompression parameters from previous init; saves dictionary loading - * Note : this prototype will be marked as deprecated and generate compilation warnings on reaching v1.5.x - */ -ZSTDLIB_API size_t ZSTD_resetDStream(ZSTD_DStream* zds); - - -/********************************************************************* -* Buffer-less and synchronous inner streaming functions -* -* This is an advanced API, giving full control over buffer management, for users which need direct control over memory. -* But it's also a complex one, with several restrictions, documented below. -* Prefer normal streaming API for an easier experience. -********************************************************************* */ - -/** - Buffer-less streaming compression (synchronous mode) - - A ZSTD_CCtx object is required to track streaming operations. - Use ZSTD_createCCtx() / ZSTD_freeCCtx() to manage resource. - ZSTD_CCtx object can be re-used multiple times within successive compression operations. - - Start by initializing a context. - Use ZSTD_compressBegin(), or ZSTD_compressBegin_usingDict() for dictionary compression, - or ZSTD_compressBegin_advanced(), for finer parameter control. - It's also possible to duplicate a reference context which has already been initialized, using ZSTD_copyCCtx() - - Then, consume your input using ZSTD_compressContinue(). - There are some important considerations to keep in mind when using this advanced function : - - ZSTD_compressContinue() has no internal buffer. It uses externally provided buffers only. - - Interface is synchronous : input is consumed entirely and produces 1+ compressed blocks. - - Caller must ensure there is enough space in `dst` to store compressed data under worst case scenario. - Worst case evaluation is provided by ZSTD_compressBound(). - ZSTD_compressContinue() doesn't guarantee recover after a failed compression. - - ZSTD_compressContinue() presumes prior input ***is still accessible and unmodified*** (up to maximum distance size, see WindowLog). - It remembers all previous contiguous blocks, plus one separated memory segment (which can itself consists of multiple contiguous blocks) - - ZSTD_compressContinue() detects that prior input has been overwritten when `src` buffer overlaps. - In which case, it will "discard" the relevant memory section from its history. - - Finish a frame with ZSTD_compressEnd(), which will write the last block(s) and optional checksum. - It's possible to use srcSize==0, in which case, it will write a final empty block to end the frame. - Without last block mark, frames are considered unfinished (hence corrupted) by compliant decoders. - - `ZSTD_CCtx` object can be re-used (ZSTD_compressBegin()) to compress again. -*/ - -/*===== Buffer-less streaming compression functions =====*/ -ZSTDLIB_API size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel); -ZSTDLIB_API size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel); -ZSTDLIB_API size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, ZSTD_parameters params, unsigned long long pledgedSrcSize); /**< pledgedSrcSize : If srcSize is not known at init time, use ZSTD_CONTENTSIZE_UNKNOWN */ -ZSTDLIB_API size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict); /**< note: fails if cdict==NULL */ -ZSTDLIB_API size_t ZSTD_compressBegin_usingCDict_advanced(ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, ZSTD_frameParameters const fParams, unsigned long long const pledgedSrcSize); /* compression parameters are already set within cdict. pledgedSrcSize must be correct. If srcSize is not known, use macro ZSTD_CONTENTSIZE_UNKNOWN */ -ZSTDLIB_API size_t ZSTD_copyCCtx(ZSTD_CCtx* cctx, const ZSTD_CCtx* preparedCCtx, unsigned long long pledgedSrcSize); /**< note: if pledgedSrcSize is not known, use ZSTD_CONTENTSIZE_UNKNOWN */ - -ZSTDLIB_API size_t ZSTD_compressContinue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); -ZSTDLIB_API size_t ZSTD_compressEnd(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); - - -/*- - Buffer-less streaming decompression (synchronous mode) - - A ZSTD_DCtx object is required to track streaming operations. - Use ZSTD_createDCtx() / ZSTD_freeDCtx() to manage it. - A ZSTD_DCtx object can be re-used multiple times. - - First typical operation is to retrieve frame parameters, using ZSTD_getFrameHeader(). - Frame header is extracted from the beginning of compressed frame, so providing only the frame's beginning is enough. - Data fragment must be large enough to ensure successful decoding. - `ZSTD_frameHeaderSize_max` bytes is guaranteed to always be large enough. - @result : 0 : successful decoding, the `ZSTD_frameHeader` structure is correctly filled. - >0 : `srcSize` is too small, please provide at least @result bytes on next attempt. - errorCode, which can be tested using ZSTD_isError(). - - It fills a ZSTD_frameHeader structure with important information to correctly decode the frame, - such as the dictionary ID, content size, or maximum back-reference distance (`windowSize`). - Note that these values could be wrong, either because of data corruption, or because a 3rd party deliberately spoofs false information. - As a consequence, check that values remain within valid application range. - For example, do not allocate memory blindly, check that `windowSize` is within expectation. - Each application can set its own limits, depending on local restrictions. - For extended interoperability, it is recommended to support `windowSize` of at least 8 MB. - - ZSTD_decompressContinue() needs previous data blocks during decompression, up to `windowSize` bytes. - ZSTD_decompressContinue() is very sensitive to contiguity, - if 2 blocks don't follow each other, make sure that either the compressor breaks contiguity at the same place, - or that previous contiguous segment is large enough to properly handle maximum back-reference distance. - There are multiple ways to guarantee this condition. - - The most memory efficient way is to use a round buffer of sufficient size. - Sufficient size is determined by invoking ZSTD_decodingBufferSize_min(), - which can @return an error code if required value is too large for current system (in 32-bits mode). - In a round buffer methodology, ZSTD_decompressContinue() decompresses each block next to previous one, - up to the moment there is not enough room left in the buffer to guarantee decoding another full block, - which maximum size is provided in `ZSTD_frameHeader` structure, field `blockSizeMax`. - At which point, decoding can resume from the beginning of the buffer. - Note that already decoded data stored in the buffer should be flushed before being overwritten. - - There are alternatives possible, for example using two or more buffers of size `windowSize` each, though they consume more memory. - - Finally, if you control the compression process, you can also ignore all buffer size rules, - as long as the encoder and decoder progress in "lock-step", - aka use exactly the same buffer sizes, break contiguity at the same place, etc. - - Once buffers are setup, start decompression, with ZSTD_decompressBegin(). - If decompression requires a dictionary, use ZSTD_decompressBegin_usingDict() or ZSTD_decompressBegin_usingDDict(). - - Then use ZSTD_nextSrcSizeToDecompress() and ZSTD_decompressContinue() alternatively. - ZSTD_nextSrcSizeToDecompress() tells how many bytes to provide as 'srcSize' to ZSTD_decompressContinue(). - ZSTD_decompressContinue() requires this _exact_ amount of bytes, or it will fail. - - @result of ZSTD_decompressContinue() is the number of bytes regenerated within 'dst' (necessarily <= dstCapacity). - It can be zero : it just means ZSTD_decompressContinue() has decoded some metadata item. - It can also be an error code, which can be tested with ZSTD_isError(). - - A frame is fully decoded when ZSTD_nextSrcSizeToDecompress() returns zero. - Context can then be reset to start a new decompression. - - Note : it's possible to know if next input to present is a header or a block, using ZSTD_nextInputType(). - This information is not required to properly decode a frame. - - == Special case : skippable frames == - - Skippable frames allow integration of user-defined data into a flow of concatenated frames. - Skippable frames will be ignored (skipped) by decompressor. - The format of skippable frames is as follows : - a) Skippable frame ID - 4 Bytes, Little endian format, any value from 0x184D2A50 to 0x184D2A5F - b) Frame Size - 4 Bytes, Little endian format, unsigned 32-bits - c) Frame Content - any content (User Data) of length equal to Frame Size - For skippable frames ZSTD_getFrameHeader() returns zfhPtr->frameType==ZSTD_skippableFrame. - For skippable frames ZSTD_decompressContinue() always returns 0 : it only skips the content. -*/ - -/*===== Buffer-less streaming decompression functions =====*/ -typedef enum { ZSTD_frame, ZSTD_skippableFrame } ZSTD_frameType_e; -typedef struct { - unsigned long long frameContentSize; /* if == ZSTD_CONTENTSIZE_UNKNOWN, it means this field is not available. 0 means "empty" */ - unsigned long long windowSize; /* can be very large, up to <= frameContentSize */ - unsigned blockSizeMax; - ZSTD_frameType_e frameType; /* if == ZSTD_skippableFrame, frameContentSize is the size of skippable content */ - unsigned headerSize; - unsigned dictID; - unsigned checksumFlag; -} ZSTD_frameHeader; - -/*! ZSTD_getFrameHeader() : - * decode Frame Header, or requires larger `srcSize`. - * @return : 0, `zfhPtr` is correctly filled, - * >0, `srcSize` is too small, value is wanted `srcSize` amount, - * or an error code, which can be tested using ZSTD_isError() */ -ZSTDLIB_API size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize); /**< doesn't consume input */ -/*! ZSTD_getFrameHeader_advanced() : - * same as ZSTD_getFrameHeader(), - * with added capability to select a format (like ZSTD_f_zstd1_magicless) */ -ZSTDLIB_API size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format); -ZSTDLIB_API size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize); /**< when frame content size is not known, pass in frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN */ - -ZSTDLIB_API size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx); -ZSTDLIB_API size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize); -ZSTDLIB_API size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); - -ZSTDLIB_API size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx); -ZSTDLIB_API size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); - -/* misc */ -ZSTDLIB_API void ZSTD_copyDCtx(ZSTD_DCtx* dctx, const ZSTD_DCtx* preparedDCtx); -typedef enum { ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame } ZSTD_nextInputType_e; -ZSTDLIB_API ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx); - - - - -/* ============================ */ -/** Block level API */ -/* ============================ */ - -/*! - Block functions produce and decode raw zstd blocks, without frame metadata. - Frame metadata cost is typically ~12 bytes, which can be non-negligible for very small blocks (< 100 bytes). - But users will have to take in charge needed metadata to regenerate data, such as compressed and content sizes. - - A few rules to respect : - - Compressing and decompressing require a context structure - + Use ZSTD_createCCtx() and ZSTD_createDCtx() - - It is necessary to init context before starting - + compression : any ZSTD_compressBegin*() variant, including with dictionary - + decompression : any ZSTD_decompressBegin*() variant, including with dictionary - + copyCCtx() and copyDCtx() can be used too - - Block size is limited, it must be <= ZSTD_getBlockSize() <= ZSTD_BLOCKSIZE_MAX == 128 KB - + If input is larger than a block size, it's necessary to split input data into multiple blocks - + For inputs larger than a single block, consider using regular ZSTD_compress() instead. - Frame metadata is not that costly, and quickly becomes negligible as source size grows larger than a block. - - When a block is considered not compressible enough, ZSTD_compressBlock() result will be 0 (zero) ! - ===> In which case, nothing is produced into `dst` ! - + User __must__ test for such outcome and deal directly with uncompressed data - + A block cannot be declared incompressible if ZSTD_compressBlock() return value was != 0. - Doing so would mess up with statistics history, leading to potential data corruption. - + ZSTD_decompressBlock() _doesn't accept uncompressed data as input_ !! - + In case of multiple successive blocks, should some of them be uncompressed, - decoder must be informed of their existence in order to follow proper history. - Use ZSTD_insertBlock() for such a case. -*/ - -/*===== Raw zstd block functions =====*/ -ZSTDLIB_API size_t ZSTD_getBlockSize (const ZSTD_CCtx* cctx); -ZSTDLIB_API size_t ZSTD_compressBlock (ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); -ZSTDLIB_API size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize); -ZSTDLIB_API size_t ZSTD_insertBlock (ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize); /**< insert uncompressed block into `dctx` history. Useful for multi-blocks decompression. */ - - -#endif /* ZSTD_H_ZSTD_STATIC_LINKING_ONLY */ - -#if defined (__cplusplus) -} -#endif diff --git a/vendor/github.com/DataDog/zstd/zstd_common.c b/vendor/github.com/DataDog/zstd/zstd_common.c deleted file mode 100644 index 667f4a27..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_common.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - - -/*-************************************* -* Dependencies -***************************************/ -#include /* malloc, calloc, free */ -#include /* memset */ -#include "error_private.h" -#include "zstd_internal.h" - - -/*-**************************************** -* Version -******************************************/ -unsigned ZSTD_versionNumber(void) { return ZSTD_VERSION_NUMBER; } - -const char* ZSTD_versionString(void) { return ZSTD_VERSION_STRING; } - - -/*-**************************************** -* ZSTD Error Management -******************************************/ -#undef ZSTD_isError /* defined within zstd_internal.h */ -/*! ZSTD_isError() : - * tells if a return value is an error code - * symbol is required for external callers */ -unsigned ZSTD_isError(size_t code) { return ERR_isError(code); } - -/*! ZSTD_getErrorName() : - * provides error code string from function result (useful for debugging) */ -const char* ZSTD_getErrorName(size_t code) { return ERR_getErrorName(code); } - -/*! ZSTD_getError() : - * convert a `size_t` function result into a proper ZSTD_errorCode enum */ -ZSTD_ErrorCode ZSTD_getErrorCode(size_t code) { return ERR_getErrorCode(code); } - -/*! ZSTD_getErrorString() : - * provides error code string from enum */ -const char* ZSTD_getErrorString(ZSTD_ErrorCode code) { return ERR_getErrorString(code); } - - - -/*=************************************************************** -* Custom allocator -****************************************************************/ -void* ZSTD_malloc(size_t size, ZSTD_customMem customMem) -{ - if (customMem.customAlloc) - return customMem.customAlloc(customMem.opaque, size); - return malloc(size); -} - -void* ZSTD_calloc(size_t size, ZSTD_customMem customMem) -{ - if (customMem.customAlloc) { - /* calloc implemented as malloc+memset; - * not as efficient as calloc, but next best guess for custom malloc */ - void* const ptr = customMem.customAlloc(customMem.opaque, size); - memset(ptr, 0, size); - return ptr; - } - return calloc(1, size); -} - -void ZSTD_free(void* ptr, ZSTD_customMem customMem) -{ - if (ptr!=NULL) { - if (customMem.customFree) - customMem.customFree(customMem.opaque, ptr); - else - free(ptr); - } -} diff --git a/vendor/github.com/DataDog/zstd/zstd_compress.c b/vendor/github.com/DataDog/zstd/zstd_compress.c deleted file mode 100644 index 35346b92..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_compress.c +++ /dev/null @@ -1,4103 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/*-************************************* -* Dependencies -***************************************/ -#include /* INT_MAX */ -#include /* memset */ -#include "cpu.h" -#include "mem.h" -#include "hist.h" /* HIST_countFast_wksp */ -#define FSE_STATIC_LINKING_ONLY /* FSE_encodeSymbol */ -#include "fse.h" -#define HUF_STATIC_LINKING_ONLY -#include "huf.h" -#include "zstd_compress_internal.h" -#include "zstd_compress_sequences.h" -#include "zstd_compress_literals.h" -#include "zstd_fast.h" -#include "zstd_double_fast.h" -#include "zstd_lazy.h" -#include "zstd_opt.h" -#include "zstd_ldm.h" - - -/*-************************************* -* Helper functions -***************************************/ -size_t ZSTD_compressBound(size_t srcSize) { - return ZSTD_COMPRESSBOUND(srcSize); -} - - -/*-************************************* -* Context memory management -***************************************/ -struct ZSTD_CDict_s { - const void* dictContent; - size_t dictContentSize; - U32* entropyWorkspace; /* entropy workspace of HUF_WORKSPACE_SIZE bytes */ - ZSTD_cwksp workspace; - ZSTD_matchState_t matchState; - ZSTD_compressedBlockState_t cBlockState; - ZSTD_customMem customMem; - U32 dictID; - int compressionLevel; /* 0 indicates that advanced API was used to select CDict params */ -}; /* typedef'd to ZSTD_CDict within "zstd.h" */ - -ZSTD_CCtx* ZSTD_createCCtx(void) -{ - return ZSTD_createCCtx_advanced(ZSTD_defaultCMem); -} - -static void ZSTD_initCCtx(ZSTD_CCtx* cctx, ZSTD_customMem memManager) -{ - assert(cctx != NULL); - memset(cctx, 0, sizeof(*cctx)); - cctx->customMem = memManager; - cctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()); - { size_t const err = ZSTD_CCtx_reset(cctx, ZSTD_reset_parameters); - assert(!ZSTD_isError(err)); - (void)err; - } -} - -ZSTD_CCtx* ZSTD_createCCtx_advanced(ZSTD_customMem customMem) -{ - ZSTD_STATIC_ASSERT(zcss_init==0); - ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN==(0ULL - 1)); - if (!customMem.customAlloc ^ !customMem.customFree) return NULL; - { ZSTD_CCtx* const cctx = (ZSTD_CCtx*)ZSTD_malloc(sizeof(ZSTD_CCtx), customMem); - if (!cctx) return NULL; - ZSTD_initCCtx(cctx, customMem); - return cctx; - } -} - -ZSTD_CCtx* ZSTD_initStaticCCtx(void *workspace, size_t workspaceSize) -{ - ZSTD_cwksp ws; - ZSTD_CCtx* cctx; - if (workspaceSize <= sizeof(ZSTD_CCtx)) return NULL; /* minimum size */ - if ((size_t)workspace & 7) return NULL; /* must be 8-aligned */ - ZSTD_cwksp_init(&ws, workspace, workspaceSize); - - cctx = (ZSTD_CCtx*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CCtx)); - if (cctx == NULL) { - return NULL; - } - memset(cctx, 0, sizeof(ZSTD_CCtx)); - ZSTD_cwksp_move(&cctx->workspace, &ws); - cctx->staticSize = workspaceSize; - - /* statically sized space. entropyWorkspace never moves (but prev/next block swap places) */ - if (!ZSTD_cwksp_check_available(&cctx->workspace, HUF_WORKSPACE_SIZE + 2 * sizeof(ZSTD_compressedBlockState_t))) return NULL; - cctx->blockState.prevCBlock = (ZSTD_compressedBlockState_t*)ZSTD_cwksp_reserve_object(&cctx->workspace, sizeof(ZSTD_compressedBlockState_t)); - cctx->blockState.nextCBlock = (ZSTD_compressedBlockState_t*)ZSTD_cwksp_reserve_object(&cctx->workspace, sizeof(ZSTD_compressedBlockState_t)); - cctx->entropyWorkspace = (U32*)ZSTD_cwksp_reserve_object( - &cctx->workspace, HUF_WORKSPACE_SIZE); - cctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()); - return cctx; -} - -/** - * Clears and frees all of the dictionaries in the CCtx. - */ -static void ZSTD_clearAllDicts(ZSTD_CCtx* cctx) -{ - ZSTD_free(cctx->localDict.dictBuffer, cctx->customMem); - ZSTD_freeCDict(cctx->localDict.cdict); - memset(&cctx->localDict, 0, sizeof(cctx->localDict)); - memset(&cctx->prefixDict, 0, sizeof(cctx->prefixDict)); - cctx->cdict = NULL; -} - -static size_t ZSTD_sizeof_localDict(ZSTD_localDict dict) -{ - size_t const bufferSize = dict.dictBuffer != NULL ? dict.dictSize : 0; - size_t const cdictSize = ZSTD_sizeof_CDict(dict.cdict); - return bufferSize + cdictSize; -} - -static void ZSTD_freeCCtxContent(ZSTD_CCtx* cctx) -{ - assert(cctx != NULL); - assert(cctx->staticSize == 0); - ZSTD_clearAllDicts(cctx); -#ifdef ZSTD_MULTITHREAD - ZSTDMT_freeCCtx(cctx->mtctx); cctx->mtctx = NULL; -#endif - ZSTD_cwksp_free(&cctx->workspace, cctx->customMem); -} - -size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx) -{ - if (cctx==NULL) return 0; /* support free on NULL */ - RETURN_ERROR_IF(cctx->staticSize, memory_allocation, - "not compatible with static CCtx"); - { - int cctxInWorkspace = ZSTD_cwksp_owns_buffer(&cctx->workspace, cctx); - ZSTD_freeCCtxContent(cctx); - if (!cctxInWorkspace) { - ZSTD_free(cctx, cctx->customMem); - } - } - return 0; -} - - -static size_t ZSTD_sizeof_mtctx(const ZSTD_CCtx* cctx) -{ -#ifdef ZSTD_MULTITHREAD - return ZSTDMT_sizeof_CCtx(cctx->mtctx); -#else - (void)cctx; - return 0; -#endif -} - - -size_t ZSTD_sizeof_CCtx(const ZSTD_CCtx* cctx) -{ - if (cctx==NULL) return 0; /* support sizeof on NULL */ - /* cctx may be in the workspace */ - return (cctx->workspace.workspace == cctx ? 0 : sizeof(*cctx)) - + ZSTD_cwksp_sizeof(&cctx->workspace) - + ZSTD_sizeof_localDict(cctx->localDict) - + ZSTD_sizeof_mtctx(cctx); -} - -size_t ZSTD_sizeof_CStream(const ZSTD_CStream* zcs) -{ - return ZSTD_sizeof_CCtx(zcs); /* same object */ -} - -/* private API call, for dictBuilder only */ -const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx) { return &(ctx->seqStore); } - -static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams( - ZSTD_compressionParameters cParams) -{ - ZSTD_CCtx_params cctxParams; - memset(&cctxParams, 0, sizeof(cctxParams)); - cctxParams.cParams = cParams; - cctxParams.compressionLevel = ZSTD_CLEVEL_DEFAULT; /* should not matter, as all cParams are presumed properly defined */ - assert(!ZSTD_checkCParams(cParams)); - cctxParams.fParams.contentSizeFlag = 1; - return cctxParams; -} - -static ZSTD_CCtx_params* ZSTD_createCCtxParams_advanced( - ZSTD_customMem customMem) -{ - ZSTD_CCtx_params* params; - if (!customMem.customAlloc ^ !customMem.customFree) return NULL; - params = (ZSTD_CCtx_params*)ZSTD_calloc( - sizeof(ZSTD_CCtx_params), customMem); - if (!params) { return NULL; } - params->customMem = customMem; - params->compressionLevel = ZSTD_CLEVEL_DEFAULT; - params->fParams.contentSizeFlag = 1; - return params; -} - -ZSTD_CCtx_params* ZSTD_createCCtxParams(void) -{ - return ZSTD_createCCtxParams_advanced(ZSTD_defaultCMem); -} - -size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params) -{ - if (params == NULL) { return 0; } - ZSTD_free(params, params->customMem); - return 0; -} - -size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params) -{ - return ZSTD_CCtxParams_init(params, ZSTD_CLEVEL_DEFAULT); -} - -size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel) { - RETURN_ERROR_IF(!cctxParams, GENERIC); - memset(cctxParams, 0, sizeof(*cctxParams)); - cctxParams->compressionLevel = compressionLevel; - cctxParams->fParams.contentSizeFlag = 1; - return 0; -} - -size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params) -{ - RETURN_ERROR_IF(!cctxParams, GENERIC); - FORWARD_IF_ERROR( ZSTD_checkCParams(params.cParams) ); - memset(cctxParams, 0, sizeof(*cctxParams)); - assert(!ZSTD_checkCParams(params.cParams)); - cctxParams->cParams = params.cParams; - cctxParams->fParams = params.fParams; - cctxParams->compressionLevel = ZSTD_CLEVEL_DEFAULT; /* should not matter, as all cParams are presumed properly defined */ - return 0; -} - -/* ZSTD_assignParamsToCCtxParams() : - * params is presumed valid at this stage */ -static ZSTD_CCtx_params ZSTD_assignParamsToCCtxParams( - const ZSTD_CCtx_params* cctxParams, ZSTD_parameters params) -{ - ZSTD_CCtx_params ret = *cctxParams; - assert(!ZSTD_checkCParams(params.cParams)); - ret.cParams = params.cParams; - ret.fParams = params.fParams; - ret.compressionLevel = ZSTD_CLEVEL_DEFAULT; /* should not matter, as all cParams are presumed properly defined */ - return ret; -} - -ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param) -{ - ZSTD_bounds bounds = { 0, 0, 0 }; - - switch(param) - { - case ZSTD_c_compressionLevel: - bounds.lowerBound = ZSTD_minCLevel(); - bounds.upperBound = ZSTD_maxCLevel(); - return bounds; - - case ZSTD_c_windowLog: - bounds.lowerBound = ZSTD_WINDOWLOG_MIN; - bounds.upperBound = ZSTD_WINDOWLOG_MAX; - return bounds; - - case ZSTD_c_hashLog: - bounds.lowerBound = ZSTD_HASHLOG_MIN; - bounds.upperBound = ZSTD_HASHLOG_MAX; - return bounds; - - case ZSTD_c_chainLog: - bounds.lowerBound = ZSTD_CHAINLOG_MIN; - bounds.upperBound = ZSTD_CHAINLOG_MAX; - return bounds; - - case ZSTD_c_searchLog: - bounds.lowerBound = ZSTD_SEARCHLOG_MIN; - bounds.upperBound = ZSTD_SEARCHLOG_MAX; - return bounds; - - case ZSTD_c_minMatch: - bounds.lowerBound = ZSTD_MINMATCH_MIN; - bounds.upperBound = ZSTD_MINMATCH_MAX; - return bounds; - - case ZSTD_c_targetLength: - bounds.lowerBound = ZSTD_TARGETLENGTH_MIN; - bounds.upperBound = ZSTD_TARGETLENGTH_MAX; - return bounds; - - case ZSTD_c_strategy: - bounds.lowerBound = ZSTD_STRATEGY_MIN; - bounds.upperBound = ZSTD_STRATEGY_MAX; - return bounds; - - case ZSTD_c_contentSizeFlag: - bounds.lowerBound = 0; - bounds.upperBound = 1; - return bounds; - - case ZSTD_c_checksumFlag: - bounds.lowerBound = 0; - bounds.upperBound = 1; - return bounds; - - case ZSTD_c_dictIDFlag: - bounds.lowerBound = 0; - bounds.upperBound = 1; - return bounds; - - case ZSTD_c_nbWorkers: - bounds.lowerBound = 0; -#ifdef ZSTD_MULTITHREAD - bounds.upperBound = ZSTDMT_NBWORKERS_MAX; -#else - bounds.upperBound = 0; -#endif - return bounds; - - case ZSTD_c_jobSize: - bounds.lowerBound = 0; -#ifdef ZSTD_MULTITHREAD - bounds.upperBound = ZSTDMT_JOBSIZE_MAX; -#else - bounds.upperBound = 0; -#endif - return bounds; - - case ZSTD_c_overlapLog: - bounds.lowerBound = ZSTD_OVERLAPLOG_MIN; - bounds.upperBound = ZSTD_OVERLAPLOG_MAX; - return bounds; - - case ZSTD_c_enableLongDistanceMatching: - bounds.lowerBound = 0; - bounds.upperBound = 1; - return bounds; - - case ZSTD_c_ldmHashLog: - bounds.lowerBound = ZSTD_LDM_HASHLOG_MIN; - bounds.upperBound = ZSTD_LDM_HASHLOG_MAX; - return bounds; - - case ZSTD_c_ldmMinMatch: - bounds.lowerBound = ZSTD_LDM_MINMATCH_MIN; - bounds.upperBound = ZSTD_LDM_MINMATCH_MAX; - return bounds; - - case ZSTD_c_ldmBucketSizeLog: - bounds.lowerBound = ZSTD_LDM_BUCKETSIZELOG_MIN; - bounds.upperBound = ZSTD_LDM_BUCKETSIZELOG_MAX; - return bounds; - - case ZSTD_c_ldmHashRateLog: - bounds.lowerBound = ZSTD_LDM_HASHRATELOG_MIN; - bounds.upperBound = ZSTD_LDM_HASHRATELOG_MAX; - return bounds; - - /* experimental parameters */ - case ZSTD_c_rsyncable: - bounds.lowerBound = 0; - bounds.upperBound = 1; - return bounds; - - case ZSTD_c_forceMaxWindow : - bounds.lowerBound = 0; - bounds.upperBound = 1; - return bounds; - - case ZSTD_c_format: - ZSTD_STATIC_ASSERT(ZSTD_f_zstd1 < ZSTD_f_zstd1_magicless); - bounds.lowerBound = ZSTD_f_zstd1; - bounds.upperBound = ZSTD_f_zstd1_magicless; /* note : how to ensure at compile time that this is the highest value enum ? */ - return bounds; - - case ZSTD_c_forceAttachDict: - ZSTD_STATIC_ASSERT(ZSTD_dictDefaultAttach < ZSTD_dictForceCopy); - bounds.lowerBound = ZSTD_dictDefaultAttach; - bounds.upperBound = ZSTD_dictForceLoad; /* note : how to ensure at compile time that this is the highest value enum ? */ - return bounds; - - case ZSTD_c_literalCompressionMode: - ZSTD_STATIC_ASSERT(ZSTD_lcm_auto < ZSTD_lcm_huffman && ZSTD_lcm_huffman < ZSTD_lcm_uncompressed); - bounds.lowerBound = ZSTD_lcm_auto; - bounds.upperBound = ZSTD_lcm_uncompressed; - return bounds; - - case ZSTD_c_targetCBlockSize: - bounds.lowerBound = ZSTD_TARGETCBLOCKSIZE_MIN; - bounds.upperBound = ZSTD_TARGETCBLOCKSIZE_MAX; - return bounds; - - case ZSTD_c_srcSizeHint: - bounds.lowerBound = ZSTD_SRCSIZEHINT_MIN; - bounds.upperBound = ZSTD_SRCSIZEHINT_MAX; - return bounds; - - default: - { ZSTD_bounds const boundError = { ERROR(parameter_unsupported), 0, 0 }; - return boundError; - } - } -} - -/* ZSTD_cParam_clampBounds: - * Clamps the value into the bounded range. - */ -static size_t ZSTD_cParam_clampBounds(ZSTD_cParameter cParam, int* value) -{ - ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam); - if (ZSTD_isError(bounds.error)) return bounds.error; - if (*value < bounds.lowerBound) *value = bounds.lowerBound; - if (*value > bounds.upperBound) *value = bounds.upperBound; - return 0; -} - -#define BOUNDCHECK(cParam, val) { \ - RETURN_ERROR_IF(!ZSTD_cParam_withinBounds(cParam,val), \ - parameter_outOfBound); \ -} - - -static int ZSTD_isUpdateAuthorized(ZSTD_cParameter param) -{ - switch(param) - { - case ZSTD_c_compressionLevel: - case ZSTD_c_hashLog: - case ZSTD_c_chainLog: - case ZSTD_c_searchLog: - case ZSTD_c_minMatch: - case ZSTD_c_targetLength: - case ZSTD_c_strategy: - return 1; - - case ZSTD_c_format: - case ZSTD_c_windowLog: - case ZSTD_c_contentSizeFlag: - case ZSTD_c_checksumFlag: - case ZSTD_c_dictIDFlag: - case ZSTD_c_forceMaxWindow : - case ZSTD_c_nbWorkers: - case ZSTD_c_jobSize: - case ZSTD_c_overlapLog: - case ZSTD_c_rsyncable: - case ZSTD_c_enableLongDistanceMatching: - case ZSTD_c_ldmHashLog: - case ZSTD_c_ldmMinMatch: - case ZSTD_c_ldmBucketSizeLog: - case ZSTD_c_ldmHashRateLog: - case ZSTD_c_forceAttachDict: - case ZSTD_c_literalCompressionMode: - case ZSTD_c_targetCBlockSize: - case ZSTD_c_srcSizeHint: - default: - return 0; - } -} - -size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value) -{ - DEBUGLOG(4, "ZSTD_CCtx_setParameter (%i, %i)", (int)param, value); - if (cctx->streamStage != zcss_init) { - if (ZSTD_isUpdateAuthorized(param)) { - cctx->cParamsChanged = 1; - } else { - RETURN_ERROR(stage_wrong); - } } - - switch(param) - { - case ZSTD_c_nbWorkers: - RETURN_ERROR_IF((value!=0) && cctx->staticSize, parameter_unsupported, - "MT not compatible with static alloc"); - break; - - case ZSTD_c_compressionLevel: - case ZSTD_c_windowLog: - case ZSTD_c_hashLog: - case ZSTD_c_chainLog: - case ZSTD_c_searchLog: - case ZSTD_c_minMatch: - case ZSTD_c_targetLength: - case ZSTD_c_strategy: - case ZSTD_c_ldmHashRateLog: - case ZSTD_c_format: - case ZSTD_c_contentSizeFlag: - case ZSTD_c_checksumFlag: - case ZSTD_c_dictIDFlag: - case ZSTD_c_forceMaxWindow: - case ZSTD_c_forceAttachDict: - case ZSTD_c_literalCompressionMode: - case ZSTD_c_jobSize: - case ZSTD_c_overlapLog: - case ZSTD_c_rsyncable: - case ZSTD_c_enableLongDistanceMatching: - case ZSTD_c_ldmHashLog: - case ZSTD_c_ldmMinMatch: - case ZSTD_c_ldmBucketSizeLog: - case ZSTD_c_targetCBlockSize: - case ZSTD_c_srcSizeHint: - break; - - default: RETURN_ERROR(parameter_unsupported); - } - return ZSTD_CCtxParams_setParameter(&cctx->requestedParams, param, value); -} - -size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams, - ZSTD_cParameter param, int value) -{ - DEBUGLOG(4, "ZSTD_CCtxParams_setParameter (%i, %i)", (int)param, value); - switch(param) - { - case ZSTD_c_format : - BOUNDCHECK(ZSTD_c_format, value); - CCtxParams->format = (ZSTD_format_e)value; - return (size_t)CCtxParams->format; - - case ZSTD_c_compressionLevel : { - FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(param, &value)); - if (value) { /* 0 : does not change current level */ - CCtxParams->compressionLevel = value; - } - if (CCtxParams->compressionLevel >= 0) return (size_t)CCtxParams->compressionLevel; - return 0; /* return type (size_t) cannot represent negative values */ - } - - case ZSTD_c_windowLog : - if (value!=0) /* 0 => use default */ - BOUNDCHECK(ZSTD_c_windowLog, value); - CCtxParams->cParams.windowLog = (U32)value; - return CCtxParams->cParams.windowLog; - - case ZSTD_c_hashLog : - if (value!=0) /* 0 => use default */ - BOUNDCHECK(ZSTD_c_hashLog, value); - CCtxParams->cParams.hashLog = (U32)value; - return CCtxParams->cParams.hashLog; - - case ZSTD_c_chainLog : - if (value!=0) /* 0 => use default */ - BOUNDCHECK(ZSTD_c_chainLog, value); - CCtxParams->cParams.chainLog = (U32)value; - return CCtxParams->cParams.chainLog; - - case ZSTD_c_searchLog : - if (value!=0) /* 0 => use default */ - BOUNDCHECK(ZSTD_c_searchLog, value); - CCtxParams->cParams.searchLog = (U32)value; - return (size_t)value; - - case ZSTD_c_minMatch : - if (value!=0) /* 0 => use default */ - BOUNDCHECK(ZSTD_c_minMatch, value); - CCtxParams->cParams.minMatch = value; - return CCtxParams->cParams.minMatch; - - case ZSTD_c_targetLength : - BOUNDCHECK(ZSTD_c_targetLength, value); - CCtxParams->cParams.targetLength = value; - return CCtxParams->cParams.targetLength; - - case ZSTD_c_strategy : - if (value!=0) /* 0 => use default */ - BOUNDCHECK(ZSTD_c_strategy, value); - CCtxParams->cParams.strategy = (ZSTD_strategy)value; - return (size_t)CCtxParams->cParams.strategy; - - case ZSTD_c_contentSizeFlag : - /* Content size written in frame header _when known_ (default:1) */ - DEBUGLOG(4, "set content size flag = %u", (value!=0)); - CCtxParams->fParams.contentSizeFlag = value != 0; - return CCtxParams->fParams.contentSizeFlag; - - case ZSTD_c_checksumFlag : - /* A 32-bits content checksum will be calculated and written at end of frame (default:0) */ - CCtxParams->fParams.checksumFlag = value != 0; - return CCtxParams->fParams.checksumFlag; - - case ZSTD_c_dictIDFlag : /* When applicable, dictionary's dictID is provided in frame header (default:1) */ - DEBUGLOG(4, "set dictIDFlag = %u", (value!=0)); - CCtxParams->fParams.noDictIDFlag = !value; - return !CCtxParams->fParams.noDictIDFlag; - - case ZSTD_c_forceMaxWindow : - CCtxParams->forceWindow = (value != 0); - return CCtxParams->forceWindow; - - case ZSTD_c_forceAttachDict : { - const ZSTD_dictAttachPref_e pref = (ZSTD_dictAttachPref_e)value; - BOUNDCHECK(ZSTD_c_forceAttachDict, pref); - CCtxParams->attachDictPref = pref; - return CCtxParams->attachDictPref; - } - - case ZSTD_c_literalCompressionMode : { - const ZSTD_literalCompressionMode_e lcm = (ZSTD_literalCompressionMode_e)value; - BOUNDCHECK(ZSTD_c_literalCompressionMode, lcm); - CCtxParams->literalCompressionMode = lcm; - return CCtxParams->literalCompressionMode; - } - - case ZSTD_c_nbWorkers : -#ifndef ZSTD_MULTITHREAD - RETURN_ERROR_IF(value!=0, parameter_unsupported, "not compiled with multithreading"); - return 0; -#else - FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(param, &value)); - CCtxParams->nbWorkers = value; - return CCtxParams->nbWorkers; -#endif - - case ZSTD_c_jobSize : -#ifndef ZSTD_MULTITHREAD - RETURN_ERROR_IF(value!=0, parameter_unsupported, "not compiled with multithreading"); - return 0; -#else - /* Adjust to the minimum non-default value. */ - if (value != 0 && value < ZSTDMT_JOBSIZE_MIN) - value = ZSTDMT_JOBSIZE_MIN; - FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(param, &value)); - assert(value >= 0); - CCtxParams->jobSize = value; - return CCtxParams->jobSize; -#endif - - case ZSTD_c_overlapLog : -#ifndef ZSTD_MULTITHREAD - RETURN_ERROR_IF(value!=0, parameter_unsupported, "not compiled with multithreading"); - return 0; -#else - FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(ZSTD_c_overlapLog, &value)); - CCtxParams->overlapLog = value; - return CCtxParams->overlapLog; -#endif - - case ZSTD_c_rsyncable : -#ifndef ZSTD_MULTITHREAD - RETURN_ERROR_IF(value!=0, parameter_unsupported, "not compiled with multithreading"); - return 0; -#else - FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(ZSTD_c_overlapLog, &value)); - CCtxParams->rsyncable = value; - return CCtxParams->rsyncable; -#endif - - case ZSTD_c_enableLongDistanceMatching : - CCtxParams->ldmParams.enableLdm = (value!=0); - return CCtxParams->ldmParams.enableLdm; - - case ZSTD_c_ldmHashLog : - if (value!=0) /* 0 ==> auto */ - BOUNDCHECK(ZSTD_c_ldmHashLog, value); - CCtxParams->ldmParams.hashLog = value; - return CCtxParams->ldmParams.hashLog; - - case ZSTD_c_ldmMinMatch : - if (value!=0) /* 0 ==> default */ - BOUNDCHECK(ZSTD_c_ldmMinMatch, value); - CCtxParams->ldmParams.minMatchLength = value; - return CCtxParams->ldmParams.minMatchLength; - - case ZSTD_c_ldmBucketSizeLog : - if (value!=0) /* 0 ==> default */ - BOUNDCHECK(ZSTD_c_ldmBucketSizeLog, value); - CCtxParams->ldmParams.bucketSizeLog = value; - return CCtxParams->ldmParams.bucketSizeLog; - - case ZSTD_c_ldmHashRateLog : - RETURN_ERROR_IF(value > ZSTD_WINDOWLOG_MAX - ZSTD_HASHLOG_MIN, - parameter_outOfBound); - CCtxParams->ldmParams.hashRateLog = value; - return CCtxParams->ldmParams.hashRateLog; - - case ZSTD_c_targetCBlockSize : - if (value!=0) /* 0 ==> default */ - BOUNDCHECK(ZSTD_c_targetCBlockSize, value); - CCtxParams->targetCBlockSize = value; - return CCtxParams->targetCBlockSize; - - case ZSTD_c_srcSizeHint : - if (value!=0) /* 0 ==> default */ - BOUNDCHECK(ZSTD_c_srcSizeHint, value); - CCtxParams->srcSizeHint = value; - return CCtxParams->srcSizeHint; - - default: RETURN_ERROR(parameter_unsupported, "unknown parameter"); - } -} - -size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value) -{ - return ZSTD_CCtxParams_getParameter(&cctx->requestedParams, param, value); -} - -size_t ZSTD_CCtxParams_getParameter( - ZSTD_CCtx_params* CCtxParams, ZSTD_cParameter param, int* value) -{ - switch(param) - { - case ZSTD_c_format : - *value = CCtxParams->format; - break; - case ZSTD_c_compressionLevel : - *value = CCtxParams->compressionLevel; - break; - case ZSTD_c_windowLog : - *value = (int)CCtxParams->cParams.windowLog; - break; - case ZSTD_c_hashLog : - *value = (int)CCtxParams->cParams.hashLog; - break; - case ZSTD_c_chainLog : - *value = (int)CCtxParams->cParams.chainLog; - break; - case ZSTD_c_searchLog : - *value = CCtxParams->cParams.searchLog; - break; - case ZSTD_c_minMatch : - *value = CCtxParams->cParams.minMatch; - break; - case ZSTD_c_targetLength : - *value = CCtxParams->cParams.targetLength; - break; - case ZSTD_c_strategy : - *value = (unsigned)CCtxParams->cParams.strategy; - break; - case ZSTD_c_contentSizeFlag : - *value = CCtxParams->fParams.contentSizeFlag; - break; - case ZSTD_c_checksumFlag : - *value = CCtxParams->fParams.checksumFlag; - break; - case ZSTD_c_dictIDFlag : - *value = !CCtxParams->fParams.noDictIDFlag; - break; - case ZSTD_c_forceMaxWindow : - *value = CCtxParams->forceWindow; - break; - case ZSTD_c_forceAttachDict : - *value = CCtxParams->attachDictPref; - break; - case ZSTD_c_literalCompressionMode : - *value = CCtxParams->literalCompressionMode; - break; - case ZSTD_c_nbWorkers : -#ifndef ZSTD_MULTITHREAD - assert(CCtxParams->nbWorkers == 0); -#endif - *value = CCtxParams->nbWorkers; - break; - case ZSTD_c_jobSize : -#ifndef ZSTD_MULTITHREAD - RETURN_ERROR(parameter_unsupported, "not compiled with multithreading"); -#else - assert(CCtxParams->jobSize <= INT_MAX); - *value = (int)CCtxParams->jobSize; - break; -#endif - case ZSTD_c_overlapLog : -#ifndef ZSTD_MULTITHREAD - RETURN_ERROR(parameter_unsupported, "not compiled with multithreading"); -#else - *value = CCtxParams->overlapLog; - break; -#endif - case ZSTD_c_rsyncable : -#ifndef ZSTD_MULTITHREAD - RETURN_ERROR(parameter_unsupported, "not compiled with multithreading"); -#else - *value = CCtxParams->rsyncable; - break; -#endif - case ZSTD_c_enableLongDistanceMatching : - *value = CCtxParams->ldmParams.enableLdm; - break; - case ZSTD_c_ldmHashLog : - *value = CCtxParams->ldmParams.hashLog; - break; - case ZSTD_c_ldmMinMatch : - *value = CCtxParams->ldmParams.minMatchLength; - break; - case ZSTD_c_ldmBucketSizeLog : - *value = CCtxParams->ldmParams.bucketSizeLog; - break; - case ZSTD_c_ldmHashRateLog : - *value = CCtxParams->ldmParams.hashRateLog; - break; - case ZSTD_c_targetCBlockSize : - *value = (int)CCtxParams->targetCBlockSize; - break; - case ZSTD_c_srcSizeHint : - *value = (int)CCtxParams->srcSizeHint; - break; - default: RETURN_ERROR(parameter_unsupported, "unknown parameter"); - } - return 0; -} - -/** ZSTD_CCtx_setParametersUsingCCtxParams() : - * just applies `params` into `cctx` - * no action is performed, parameters are merely stored. - * If ZSTDMT is enabled, parameters are pushed to cctx->mtctx. - * This is possible even if a compression is ongoing. - * In which case, new parameters will be applied on the fly, starting with next compression job. - */ -size_t ZSTD_CCtx_setParametersUsingCCtxParams( - ZSTD_CCtx* cctx, const ZSTD_CCtx_params* params) -{ - DEBUGLOG(4, "ZSTD_CCtx_setParametersUsingCCtxParams"); - RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong); - RETURN_ERROR_IF(cctx->cdict, stage_wrong); - - cctx->requestedParams = *params; - return 0; -} - -ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize) -{ - DEBUGLOG(4, "ZSTD_CCtx_setPledgedSrcSize to %u bytes", (U32)pledgedSrcSize); - RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong); - cctx->pledgedSrcSizePlusOne = pledgedSrcSize+1; - return 0; -} - -/** - * Initializes the local dict using the requested parameters. - * NOTE: This does not use the pledged src size, because it may be used for more - * than one compression. - */ -static size_t ZSTD_initLocalDict(ZSTD_CCtx* cctx) -{ - ZSTD_localDict* const dl = &cctx->localDict; - ZSTD_compressionParameters const cParams = ZSTD_getCParamsFromCCtxParams( - &cctx->requestedParams, 0, dl->dictSize); - if (dl->dict == NULL) { - /* No local dictionary. */ - assert(dl->dictBuffer == NULL); - assert(dl->cdict == NULL); - assert(dl->dictSize == 0); - return 0; - } - if (dl->cdict != NULL) { - assert(cctx->cdict == dl->cdict); - /* Local dictionary already initialized. */ - return 0; - } - assert(dl->dictSize > 0); - assert(cctx->cdict == NULL); - assert(cctx->prefixDict.dict == NULL); - - dl->cdict = ZSTD_createCDict_advanced( - dl->dict, - dl->dictSize, - ZSTD_dlm_byRef, - dl->dictContentType, - cParams, - cctx->customMem); - RETURN_ERROR_IF(!dl->cdict, memory_allocation); - cctx->cdict = dl->cdict; - return 0; -} - -size_t ZSTD_CCtx_loadDictionary_advanced( - ZSTD_CCtx* cctx, const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, ZSTD_dictContentType_e dictContentType) -{ - RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong); - RETURN_ERROR_IF(cctx->staticSize, memory_allocation, - "no malloc for static CCtx"); - DEBUGLOG(4, "ZSTD_CCtx_loadDictionary_advanced (size: %u)", (U32)dictSize); - ZSTD_clearAllDicts(cctx); /* in case one already exists */ - if (dict == NULL || dictSize == 0) /* no dictionary mode */ - return 0; - if (dictLoadMethod == ZSTD_dlm_byRef) { - cctx->localDict.dict = dict; - } else { - void* dictBuffer = ZSTD_malloc(dictSize, cctx->customMem); - RETURN_ERROR_IF(!dictBuffer, memory_allocation); - memcpy(dictBuffer, dict, dictSize); - cctx->localDict.dictBuffer = dictBuffer; - cctx->localDict.dict = dictBuffer; - } - cctx->localDict.dictSize = dictSize; - cctx->localDict.dictContentType = dictContentType; - return 0; -} - -ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary_byReference( - ZSTD_CCtx* cctx, const void* dict, size_t dictSize) -{ - return ZSTD_CCtx_loadDictionary_advanced( - cctx, dict, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto); -} - -ZSTDLIB_API size_t ZSTD_CCtx_loadDictionary(ZSTD_CCtx* cctx, const void* dict, size_t dictSize) -{ - return ZSTD_CCtx_loadDictionary_advanced( - cctx, dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto); -} - - -size_t ZSTD_CCtx_refCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict) -{ - RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong); - /* Free the existing local cdict (if any) to save memory. */ - ZSTD_clearAllDicts(cctx); - cctx->cdict = cdict; - return 0; -} - -size_t ZSTD_CCtx_refPrefix(ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize) -{ - return ZSTD_CCtx_refPrefix_advanced(cctx, prefix, prefixSize, ZSTD_dct_rawContent); -} - -size_t ZSTD_CCtx_refPrefix_advanced( - ZSTD_CCtx* cctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType) -{ - RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong); - ZSTD_clearAllDicts(cctx); - cctx->prefixDict.dict = prefix; - cctx->prefixDict.dictSize = prefixSize; - cctx->prefixDict.dictContentType = dictContentType; - return 0; -} - -/*! ZSTD_CCtx_reset() : - * Also dumps dictionary */ -size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset) -{ - if ( (reset == ZSTD_reset_session_only) - || (reset == ZSTD_reset_session_and_parameters) ) { - cctx->streamStage = zcss_init; - cctx->pledgedSrcSizePlusOne = 0; - } - if ( (reset == ZSTD_reset_parameters) - || (reset == ZSTD_reset_session_and_parameters) ) { - RETURN_ERROR_IF(cctx->streamStage != zcss_init, stage_wrong); - ZSTD_clearAllDicts(cctx); - return ZSTD_CCtxParams_reset(&cctx->requestedParams); - } - return 0; -} - - -/** ZSTD_checkCParams() : - control CParam values remain within authorized range. - @return : 0, or an error code if one value is beyond authorized range */ -size_t ZSTD_checkCParams(ZSTD_compressionParameters cParams) -{ - BOUNDCHECK(ZSTD_c_windowLog, (int)cParams.windowLog); - BOUNDCHECK(ZSTD_c_chainLog, (int)cParams.chainLog); - BOUNDCHECK(ZSTD_c_hashLog, (int)cParams.hashLog); - BOUNDCHECK(ZSTD_c_searchLog, (int)cParams.searchLog); - BOUNDCHECK(ZSTD_c_minMatch, (int)cParams.minMatch); - BOUNDCHECK(ZSTD_c_targetLength,(int)cParams.targetLength); - BOUNDCHECK(ZSTD_c_strategy, cParams.strategy); - return 0; -} - -/** ZSTD_clampCParams() : - * make CParam values within valid range. - * @return : valid CParams */ -static ZSTD_compressionParameters -ZSTD_clampCParams(ZSTD_compressionParameters cParams) -{ -# define CLAMP_TYPE(cParam, val, type) { \ - ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam); \ - if ((int)valbounds.upperBound) val=(type)bounds.upperBound; \ - } -# define CLAMP(cParam, val) CLAMP_TYPE(cParam, val, unsigned) - CLAMP(ZSTD_c_windowLog, cParams.windowLog); - CLAMP(ZSTD_c_chainLog, cParams.chainLog); - CLAMP(ZSTD_c_hashLog, cParams.hashLog); - CLAMP(ZSTD_c_searchLog, cParams.searchLog); - CLAMP(ZSTD_c_minMatch, cParams.minMatch); - CLAMP(ZSTD_c_targetLength,cParams.targetLength); - CLAMP_TYPE(ZSTD_c_strategy,cParams.strategy, ZSTD_strategy); - return cParams; -} - -/** ZSTD_cycleLog() : - * condition for correct operation : hashLog > 1 */ -static U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) -{ - U32 const btScale = ((U32)strat >= (U32)ZSTD_btlazy2); - return hashLog - btScale; -} - -/** ZSTD_adjustCParams_internal() : - * optimize `cPar` for a specified input (`srcSize` and `dictSize`). - * mostly downsize to reduce memory consumption and initialization latency. - * `srcSize` can be ZSTD_CONTENTSIZE_UNKNOWN when not known. - * note : for the time being, `srcSize==0` means "unknown" too, for compatibility with older convention. - * condition : cPar is presumed validated (can be checked using ZSTD_checkCParams()). */ -static ZSTD_compressionParameters -ZSTD_adjustCParams_internal(ZSTD_compressionParameters cPar, - unsigned long long srcSize, - size_t dictSize) -{ - static const U64 minSrcSize = 513; /* (1<<9) + 1 */ - static const U64 maxWindowResize = 1ULL << (ZSTD_WINDOWLOG_MAX-1); - assert(ZSTD_checkCParams(cPar)==0); - - if (dictSize && (srcSize+1<2) /* ZSTD_CONTENTSIZE_UNKNOWN and 0 mean "unknown" */ ) - srcSize = minSrcSize; /* presumed small when there is a dictionary */ - else if (srcSize == 0) - srcSize = ZSTD_CONTENTSIZE_UNKNOWN; /* 0 == unknown : presumed large */ - - /* resize windowLog if input is small enough, to use less memory */ - if ( (srcSize < maxWindowResize) - && (dictSize < maxWindowResize) ) { - U32 const tSize = (U32)(srcSize + dictSize); - static U32 const hashSizeMin = 1 << ZSTD_HASHLOG_MIN; - U32 const srcLog = (tSize < hashSizeMin) ? ZSTD_HASHLOG_MIN : - ZSTD_highbit32(tSize-1) + 1; - if (cPar.windowLog > srcLog) cPar.windowLog = srcLog; - } - if (cPar.hashLog > cPar.windowLog+1) cPar.hashLog = cPar.windowLog+1; - { U32 const cycleLog = ZSTD_cycleLog(cPar.chainLog, cPar.strategy); - if (cycleLog > cPar.windowLog) - cPar.chainLog -= (cycleLog - cPar.windowLog); - } - - if (cPar.windowLog < ZSTD_WINDOWLOG_ABSOLUTEMIN) - cPar.windowLog = ZSTD_WINDOWLOG_ABSOLUTEMIN; /* minimum wlog required for valid frame header */ - - return cPar; -} - -ZSTD_compressionParameters -ZSTD_adjustCParams(ZSTD_compressionParameters cPar, - unsigned long long srcSize, - size_t dictSize) -{ - cPar = ZSTD_clampCParams(cPar); /* resulting cPar is necessarily valid (all parameters within range) */ - return ZSTD_adjustCParams_internal(cPar, srcSize, dictSize); -} - -ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams( - const ZSTD_CCtx_params* CCtxParams, U64 srcSizeHint, size_t dictSize) -{ - ZSTD_compressionParameters cParams; - if (srcSizeHint == ZSTD_CONTENTSIZE_UNKNOWN && CCtxParams->srcSizeHint > 0) { - srcSizeHint = CCtxParams->srcSizeHint; - } - cParams = ZSTD_getCParams(CCtxParams->compressionLevel, srcSizeHint, dictSize); - if (CCtxParams->ldmParams.enableLdm) cParams.windowLog = ZSTD_LDM_DEFAULT_WINDOW_LOG; - if (CCtxParams->cParams.windowLog) cParams.windowLog = CCtxParams->cParams.windowLog; - if (CCtxParams->cParams.hashLog) cParams.hashLog = CCtxParams->cParams.hashLog; - if (CCtxParams->cParams.chainLog) cParams.chainLog = CCtxParams->cParams.chainLog; - if (CCtxParams->cParams.searchLog) cParams.searchLog = CCtxParams->cParams.searchLog; - if (CCtxParams->cParams.minMatch) cParams.minMatch = CCtxParams->cParams.minMatch; - if (CCtxParams->cParams.targetLength) cParams.targetLength = CCtxParams->cParams.targetLength; - if (CCtxParams->cParams.strategy) cParams.strategy = CCtxParams->cParams.strategy; - assert(!ZSTD_checkCParams(cParams)); - return ZSTD_adjustCParams_internal(cParams, srcSizeHint, dictSize); -} - -static size_t -ZSTD_sizeof_matchState(const ZSTD_compressionParameters* const cParams, - const U32 forCCtx) -{ - size_t const chainSize = (cParams->strategy == ZSTD_fast) ? 0 : ((size_t)1 << cParams->chainLog); - size_t const hSize = ((size_t)1) << cParams->hashLog; - U32 const hashLog3 = (forCCtx && cParams->minMatch==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0; - size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0; - /* We don't use ZSTD_cwksp_alloc_size() here because the tables aren't - * surrounded by redzones in ASAN. */ - size_t const tableSpace = chainSize * sizeof(U32) - + hSize * sizeof(U32) - + h3Size * sizeof(U32); - size_t const optPotentialSpace = - ZSTD_cwksp_alloc_size((MaxML+1) * sizeof(U32)) - + ZSTD_cwksp_alloc_size((MaxLL+1) * sizeof(U32)) - + ZSTD_cwksp_alloc_size((MaxOff+1) * sizeof(U32)) - + ZSTD_cwksp_alloc_size((1<strategy >= ZSTD_btopt)) - ? optPotentialSpace - : 0; - DEBUGLOG(4, "chainSize: %u - hSize: %u - h3Size: %u", - (U32)chainSize, (U32)hSize, (U32)h3Size); - return tableSpace + optSpace; -} - -size_t ZSTD_estimateCCtxSize_usingCCtxParams(const ZSTD_CCtx_params* params) -{ - RETURN_ERROR_IF(params->nbWorkers > 0, GENERIC, "Estimate CCtx size is supported for single-threaded compression only."); - { ZSTD_compressionParameters const cParams = - ZSTD_getCParamsFromCCtxParams(params, 0, 0); - size_t const blockSize = MIN(ZSTD_BLOCKSIZE_MAX, (size_t)1 << cParams.windowLog); - U32 const divider = (cParams.minMatch==3) ? 3 : 4; - size_t const maxNbSeq = blockSize / divider; - size_t const tokenSpace = ZSTD_cwksp_alloc_size(WILDCOPY_OVERLENGTH + blockSize) - + ZSTD_cwksp_alloc_size(maxNbSeq * sizeof(seqDef)) - + 3 * ZSTD_cwksp_alloc_size(maxNbSeq * sizeof(BYTE)); - size_t const entropySpace = ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE); - size_t const blockStateSpace = 2 * ZSTD_cwksp_alloc_size(sizeof(ZSTD_compressedBlockState_t)); - size_t const matchStateSize = ZSTD_sizeof_matchState(&cParams, /* forCCtx */ 1); - - size_t const ldmSpace = ZSTD_ldm_getTableSize(params->ldmParams); - size_t const ldmSeqSpace = ZSTD_cwksp_alloc_size(ZSTD_ldm_getMaxNbSeq(params->ldmParams, blockSize) * sizeof(rawSeq)); - - size_t const neededSpace = entropySpace + blockStateSpace + tokenSpace + - matchStateSize + ldmSpace + ldmSeqSpace; - size_t const cctxSpace = ZSTD_cwksp_alloc_size(sizeof(ZSTD_CCtx)); - - DEBUGLOG(5, "sizeof(ZSTD_CCtx) : %u", (U32)cctxSpace); - DEBUGLOG(5, "estimate workspace : %u", (U32)neededSpace); - return cctxSpace + neededSpace; - } -} - -size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams) -{ - ZSTD_CCtx_params const params = ZSTD_makeCCtxParamsFromCParams(cParams); - return ZSTD_estimateCCtxSize_usingCCtxParams(¶ms); -} - -static size_t ZSTD_estimateCCtxSize_internal(int compressionLevel) -{ - ZSTD_compressionParameters const cParams = ZSTD_getCParams(compressionLevel, 0, 0); - return ZSTD_estimateCCtxSize_usingCParams(cParams); -} - -size_t ZSTD_estimateCCtxSize(int compressionLevel) -{ - int level; - size_t memBudget = 0; - for (level=MIN(compressionLevel, 1); level<=compressionLevel; level++) { - size_t const newMB = ZSTD_estimateCCtxSize_internal(level); - if (newMB > memBudget) memBudget = newMB; - } - return memBudget; -} - -size_t ZSTD_estimateCStreamSize_usingCCtxParams(const ZSTD_CCtx_params* params) -{ - RETURN_ERROR_IF(params->nbWorkers > 0, GENERIC, "Estimate CCtx size is supported for single-threaded compression only."); - { ZSTD_compressionParameters const cParams = - ZSTD_getCParamsFromCCtxParams(params, 0, 0); - size_t const CCtxSize = ZSTD_estimateCCtxSize_usingCCtxParams(params); - size_t const blockSize = MIN(ZSTD_BLOCKSIZE_MAX, (size_t)1 << cParams.windowLog); - size_t const inBuffSize = ((size_t)1 << cParams.windowLog) + blockSize; - size_t const outBuffSize = ZSTD_compressBound(blockSize) + 1; - size_t const streamingSize = ZSTD_cwksp_alloc_size(inBuffSize) - + ZSTD_cwksp_alloc_size(outBuffSize); - - return CCtxSize + streamingSize; - } -} - -size_t ZSTD_estimateCStreamSize_usingCParams(ZSTD_compressionParameters cParams) -{ - ZSTD_CCtx_params const params = ZSTD_makeCCtxParamsFromCParams(cParams); - return ZSTD_estimateCStreamSize_usingCCtxParams(¶ms); -} - -static size_t ZSTD_estimateCStreamSize_internal(int compressionLevel) -{ - ZSTD_compressionParameters const cParams = ZSTD_getCParams(compressionLevel, 0, 0); - return ZSTD_estimateCStreamSize_usingCParams(cParams); -} - -size_t ZSTD_estimateCStreamSize(int compressionLevel) -{ - int level; - size_t memBudget = 0; - for (level=MIN(compressionLevel, 1); level<=compressionLevel; level++) { - size_t const newMB = ZSTD_estimateCStreamSize_internal(level); - if (newMB > memBudget) memBudget = newMB; - } - return memBudget; -} - -/* ZSTD_getFrameProgression(): - * tells how much data has been consumed (input) and produced (output) for current frame. - * able to count progression inside worker threads (non-blocking mode). - */ -ZSTD_frameProgression ZSTD_getFrameProgression(const ZSTD_CCtx* cctx) -{ -#ifdef ZSTD_MULTITHREAD - if (cctx->appliedParams.nbWorkers > 0) { - return ZSTDMT_getFrameProgression(cctx->mtctx); - } -#endif - { ZSTD_frameProgression fp; - size_t const buffered = (cctx->inBuff == NULL) ? 0 : - cctx->inBuffPos - cctx->inToCompress; - if (buffered) assert(cctx->inBuffPos >= cctx->inToCompress); - assert(buffered <= ZSTD_BLOCKSIZE_MAX); - fp.ingested = cctx->consumedSrcSize + buffered; - fp.consumed = cctx->consumedSrcSize; - fp.produced = cctx->producedCSize; - fp.flushed = cctx->producedCSize; /* simplified; some data might still be left within streaming output buffer */ - fp.currentJobID = 0; - fp.nbActiveWorkers = 0; - return fp; -} } - -/*! ZSTD_toFlushNow() - * Only useful for multithreading scenarios currently (nbWorkers >= 1). - */ -size_t ZSTD_toFlushNow(ZSTD_CCtx* cctx) -{ -#ifdef ZSTD_MULTITHREAD - if (cctx->appliedParams.nbWorkers > 0) { - return ZSTDMT_toFlushNow(cctx->mtctx); - } -#endif - (void)cctx; - return 0; /* over-simplification; could also check if context is currently running in streaming mode, and in which case, report how many bytes are left to be flushed within output buffer */ -} - -static void ZSTD_assertEqualCParams(ZSTD_compressionParameters cParams1, - ZSTD_compressionParameters cParams2) -{ - (void)cParams1; - (void)cParams2; - assert(cParams1.windowLog == cParams2.windowLog); - assert(cParams1.chainLog == cParams2.chainLog); - assert(cParams1.hashLog == cParams2.hashLog); - assert(cParams1.searchLog == cParams2.searchLog); - assert(cParams1.minMatch == cParams2.minMatch); - assert(cParams1.targetLength == cParams2.targetLength); - assert(cParams1.strategy == cParams2.strategy); -} - -static void ZSTD_reset_compressedBlockState(ZSTD_compressedBlockState_t* bs) -{ - int i; - for (i = 0; i < ZSTD_REP_NUM; ++i) - bs->rep[i] = repStartValue[i]; - bs->entropy.huf.repeatMode = HUF_repeat_none; - bs->entropy.fse.offcode_repeatMode = FSE_repeat_none; - bs->entropy.fse.matchlength_repeatMode = FSE_repeat_none; - bs->entropy.fse.litlength_repeatMode = FSE_repeat_none; -} - -/*! ZSTD_invalidateMatchState() - * Invalidate all the matches in the match finder tables. - * Requires nextSrc and base to be set (can be NULL). - */ -static void ZSTD_invalidateMatchState(ZSTD_matchState_t* ms) -{ - ZSTD_window_clear(&ms->window); - - ms->nextToUpdate = ms->window.dictLimit; - ms->loadedDictEnd = 0; - ms->opt.litLengthSum = 0; /* force reset of btopt stats */ - ms->dictMatchState = NULL; -} - -/** - * Indicates whether this compression proceeds directly from user-provided - * source buffer to user-provided destination buffer (ZSTDb_not_buffered), or - * whether the context needs to buffer the input/output (ZSTDb_buffered). - */ -typedef enum { - ZSTDb_not_buffered, - ZSTDb_buffered -} ZSTD_buffered_policy_e; - -/** - * Controls, for this matchState reset, whether the tables need to be cleared / - * prepared for the coming compression (ZSTDcrp_makeClean), or whether the - * tables can be left unclean (ZSTDcrp_leaveDirty), because we know that a - * subsequent operation will overwrite the table space anyways (e.g., copying - * the matchState contents in from a CDict). - */ -typedef enum { - ZSTDcrp_makeClean, - ZSTDcrp_leaveDirty -} ZSTD_compResetPolicy_e; - -/** - * Controls, for this matchState reset, whether indexing can continue where it - * left off (ZSTDirp_continue), or whether it needs to be restarted from zero - * (ZSTDirp_reset). - */ -typedef enum { - ZSTDirp_continue, - ZSTDirp_reset -} ZSTD_indexResetPolicy_e; - -typedef enum { - ZSTD_resetTarget_CDict, - ZSTD_resetTarget_CCtx -} ZSTD_resetTarget_e; - -static size_t -ZSTD_reset_matchState(ZSTD_matchState_t* ms, - ZSTD_cwksp* ws, - const ZSTD_compressionParameters* cParams, - const ZSTD_compResetPolicy_e crp, - const ZSTD_indexResetPolicy_e forceResetIndex, - const ZSTD_resetTarget_e forWho) -{ - size_t const chainSize = (cParams->strategy == ZSTD_fast) ? 0 : ((size_t)1 << cParams->chainLog); - size_t const hSize = ((size_t)1) << cParams->hashLog; - U32 const hashLog3 = ((forWho == ZSTD_resetTarget_CCtx) && cParams->minMatch==3) ? MIN(ZSTD_HASHLOG3_MAX, cParams->windowLog) : 0; - size_t const h3Size = hashLog3 ? ((size_t)1) << hashLog3 : 0; - - DEBUGLOG(4, "reset indices : %u", forceResetIndex == ZSTDirp_reset); - if (forceResetIndex == ZSTDirp_reset) { - memset(&ms->window, 0, sizeof(ms->window)); - ms->window.dictLimit = 1; /* start from 1, so that 1st position is valid */ - ms->window.lowLimit = 1; /* it ensures first and later CCtx usages compress the same */ - ms->window.nextSrc = ms->window.base + 1; /* see issue #1241 */ - ZSTD_cwksp_mark_tables_dirty(ws); - } - - ms->hashLog3 = hashLog3; - - ZSTD_invalidateMatchState(ms); - - assert(!ZSTD_cwksp_reserve_failed(ws)); /* check that allocation hasn't already failed */ - - ZSTD_cwksp_clear_tables(ws); - - DEBUGLOG(5, "reserving table space"); - /* table Space */ - ms->hashTable = (U32*)ZSTD_cwksp_reserve_table(ws, hSize * sizeof(U32)); - ms->chainTable = (U32*)ZSTD_cwksp_reserve_table(ws, chainSize * sizeof(U32)); - ms->hashTable3 = (U32*)ZSTD_cwksp_reserve_table(ws, h3Size * sizeof(U32)); - RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation, - "failed a workspace allocation in ZSTD_reset_matchState"); - - DEBUGLOG(4, "reset table : %u", crp!=ZSTDcrp_leaveDirty); - if (crp!=ZSTDcrp_leaveDirty) { - /* reset tables only */ - ZSTD_cwksp_clean_tables(ws); - } - - /* opt parser space */ - if ((forWho == ZSTD_resetTarget_CCtx) && (cParams->strategy >= ZSTD_btopt)) { - DEBUGLOG(4, "reserving optimal parser space"); - ms->opt.litFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (1<opt.litLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxLL+1) * sizeof(unsigned)); - ms->opt.matchLengthFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxML+1) * sizeof(unsigned)); - ms->opt.offCodeFreq = (unsigned*)ZSTD_cwksp_reserve_aligned(ws, (MaxOff+1) * sizeof(unsigned)); - ms->opt.matchTable = (ZSTD_match_t*)ZSTD_cwksp_reserve_aligned(ws, (ZSTD_OPT_NUM+1) * sizeof(ZSTD_match_t)); - ms->opt.priceTable = (ZSTD_optimal_t*)ZSTD_cwksp_reserve_aligned(ws, (ZSTD_OPT_NUM+1) * sizeof(ZSTD_optimal_t)); - } - - ms->cParams = *cParams; - - RETURN_ERROR_IF(ZSTD_cwksp_reserve_failed(ws), memory_allocation, - "failed a workspace allocation in ZSTD_reset_matchState"); - - return 0; -} - -/* ZSTD_indexTooCloseToMax() : - * minor optimization : prefer memset() rather than reduceIndex() - * which is measurably slow in some circumstances (reported for Visual Studio). - * Works when re-using a context for a lot of smallish inputs : - * if all inputs are smaller than ZSTD_INDEXOVERFLOW_MARGIN, - * memset() will be triggered before reduceIndex(). - */ -#define ZSTD_INDEXOVERFLOW_MARGIN (16 MB) -static int ZSTD_indexTooCloseToMax(ZSTD_window_t w) -{ - return (size_t)(w.nextSrc - w.base) > (ZSTD_CURRENT_MAX - ZSTD_INDEXOVERFLOW_MARGIN); -} - -/*! ZSTD_resetCCtx_internal() : - note : `params` are assumed fully validated at this stage */ -static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc, - ZSTD_CCtx_params params, - U64 const pledgedSrcSize, - ZSTD_compResetPolicy_e const crp, - ZSTD_buffered_policy_e const zbuff) -{ - ZSTD_cwksp* const ws = &zc->workspace; - DEBUGLOG(4, "ZSTD_resetCCtx_internal: pledgedSrcSize=%u, wlog=%u", - (U32)pledgedSrcSize, params.cParams.windowLog); - assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams))); - - zc->isFirstBlock = 1; - - if (params.ldmParams.enableLdm) { - /* Adjust long distance matching parameters */ - ZSTD_ldm_adjustParameters(¶ms.ldmParams, ¶ms.cParams); - assert(params.ldmParams.hashLog >= params.ldmParams.bucketSizeLog); - assert(params.ldmParams.hashRateLog < 32); - zc->ldmState.hashPower = ZSTD_rollingHash_primePower(params.ldmParams.minMatchLength); - } - - { size_t const windowSize = MAX(1, (size_t)MIN(((U64)1 << params.cParams.windowLog), pledgedSrcSize)); - size_t const blockSize = MIN(ZSTD_BLOCKSIZE_MAX, windowSize); - U32 const divider = (params.cParams.minMatch==3) ? 3 : 4; - size_t const maxNbSeq = blockSize / divider; - size_t const tokenSpace = ZSTD_cwksp_alloc_size(WILDCOPY_OVERLENGTH + blockSize) - + ZSTD_cwksp_alloc_size(maxNbSeq * sizeof(seqDef)) - + 3 * ZSTD_cwksp_alloc_size(maxNbSeq * sizeof(BYTE)); - size_t const buffOutSize = (zbuff==ZSTDb_buffered) ? ZSTD_compressBound(blockSize)+1 : 0; - size_t const buffInSize = (zbuff==ZSTDb_buffered) ? windowSize + blockSize : 0; - size_t const matchStateSize = ZSTD_sizeof_matchState(¶ms.cParams, /* forCCtx */ 1); - size_t const maxNbLdmSeq = ZSTD_ldm_getMaxNbSeq(params.ldmParams, blockSize); - - ZSTD_indexResetPolicy_e needsIndexReset = ZSTDirp_continue; - - if (ZSTD_indexTooCloseToMax(zc->blockState.matchState.window)) { - needsIndexReset = ZSTDirp_reset; - } - - ZSTD_cwksp_bump_oversized_duration(ws, 0); - - /* Check if workspace is large enough, alloc a new one if needed */ - { size_t const cctxSpace = zc->staticSize ? ZSTD_cwksp_alloc_size(sizeof(ZSTD_CCtx)) : 0; - size_t const entropySpace = ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE); - size_t const blockStateSpace = 2 * ZSTD_cwksp_alloc_size(sizeof(ZSTD_compressedBlockState_t)); - size_t const bufferSpace = ZSTD_cwksp_alloc_size(buffInSize) + ZSTD_cwksp_alloc_size(buffOutSize); - size_t const ldmSpace = ZSTD_ldm_getTableSize(params.ldmParams); - size_t const ldmSeqSpace = ZSTD_cwksp_alloc_size(maxNbLdmSeq * sizeof(rawSeq)); - - size_t const neededSpace = - cctxSpace + - entropySpace + - blockStateSpace + - ldmSpace + - ldmSeqSpace + - matchStateSize + - tokenSpace + - bufferSpace; - - int const workspaceTooSmall = ZSTD_cwksp_sizeof(ws) < neededSpace; - int const workspaceWasteful = ZSTD_cwksp_check_wasteful(ws, neededSpace); - - DEBUGLOG(4, "Need %zuKB workspace, including %zuKB for match state, and %zuKB for buffers", - neededSpace>>10, matchStateSize>>10, bufferSpace>>10); - DEBUGLOG(4, "windowSize: %zu - blockSize: %zu", windowSize, blockSize); - - if (workspaceTooSmall || workspaceWasteful) { - DEBUGLOG(4, "Resize workspaceSize from %zuKB to %zuKB", - ZSTD_cwksp_sizeof(ws) >> 10, - neededSpace >> 10); - - RETURN_ERROR_IF(zc->staticSize, memory_allocation, "static cctx : no resize"); - - needsIndexReset = ZSTDirp_reset; - - ZSTD_cwksp_free(ws, zc->customMem); - FORWARD_IF_ERROR(ZSTD_cwksp_create(ws, neededSpace, zc->customMem)); - - DEBUGLOG(5, "reserving object space"); - /* Statically sized space. - * entropyWorkspace never moves, - * though prev/next block swap places */ - assert(ZSTD_cwksp_check_available(ws, 2 * sizeof(ZSTD_compressedBlockState_t))); - zc->blockState.prevCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t)); - RETURN_ERROR_IF(zc->blockState.prevCBlock == NULL, memory_allocation, "couldn't allocate prevCBlock"); - zc->blockState.nextCBlock = (ZSTD_compressedBlockState_t*) ZSTD_cwksp_reserve_object(ws, sizeof(ZSTD_compressedBlockState_t)); - RETURN_ERROR_IF(zc->blockState.nextCBlock == NULL, memory_allocation, "couldn't allocate nextCBlock"); - zc->entropyWorkspace = (U32*) ZSTD_cwksp_reserve_object(ws, HUF_WORKSPACE_SIZE); - RETURN_ERROR_IF(zc->blockState.nextCBlock == NULL, memory_allocation, "couldn't allocate entropyWorkspace"); - } } - - ZSTD_cwksp_clear(ws); - - /* init params */ - zc->appliedParams = params; - zc->blockState.matchState.cParams = params.cParams; - zc->pledgedSrcSizePlusOne = pledgedSrcSize+1; - zc->consumedSrcSize = 0; - zc->producedCSize = 0; - if (pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN) - zc->appliedParams.fParams.contentSizeFlag = 0; - DEBUGLOG(4, "pledged content size : %u ; flag : %u", - (unsigned)pledgedSrcSize, zc->appliedParams.fParams.contentSizeFlag); - zc->blockSize = blockSize; - - XXH64_reset(&zc->xxhState, 0); - zc->stage = ZSTDcs_init; - zc->dictID = 0; - - ZSTD_reset_compressedBlockState(zc->blockState.prevCBlock); - - /* ZSTD_wildcopy() is used to copy into the literals buffer, - * so we have to oversize the buffer by WILDCOPY_OVERLENGTH bytes. - */ - zc->seqStore.litStart = ZSTD_cwksp_reserve_buffer(ws, blockSize + WILDCOPY_OVERLENGTH); - zc->seqStore.maxNbLit = blockSize; - - /* buffers */ - zc->inBuffSize = buffInSize; - zc->inBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffInSize); - zc->outBuffSize = buffOutSize; - zc->outBuff = (char*)ZSTD_cwksp_reserve_buffer(ws, buffOutSize); - - /* ldm bucketOffsets table */ - if (params.ldmParams.enableLdm) { - /* TODO: avoid memset? */ - size_t const ldmBucketSize = - ((size_t)1) << (params.ldmParams.hashLog - - params.ldmParams.bucketSizeLog); - zc->ldmState.bucketOffsets = ZSTD_cwksp_reserve_buffer(ws, ldmBucketSize); - memset(zc->ldmState.bucketOffsets, 0, ldmBucketSize); - } - - /* sequences storage */ - ZSTD_referenceExternalSequences(zc, NULL, 0); - zc->seqStore.maxNbSeq = maxNbSeq; - zc->seqStore.llCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE)); - zc->seqStore.mlCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE)); - zc->seqStore.ofCode = ZSTD_cwksp_reserve_buffer(ws, maxNbSeq * sizeof(BYTE)); - zc->seqStore.sequencesStart = (seqDef*)ZSTD_cwksp_reserve_aligned(ws, maxNbSeq * sizeof(seqDef)); - - FORWARD_IF_ERROR(ZSTD_reset_matchState( - &zc->blockState.matchState, - ws, - ¶ms.cParams, - crp, - needsIndexReset, - ZSTD_resetTarget_CCtx)); - - /* ldm hash table */ - if (params.ldmParams.enableLdm) { - /* TODO: avoid memset? */ - size_t const ldmHSize = ((size_t)1) << params.ldmParams.hashLog; - zc->ldmState.hashTable = (ldmEntry_t*)ZSTD_cwksp_reserve_aligned(ws, ldmHSize * sizeof(ldmEntry_t)); - memset(zc->ldmState.hashTable, 0, ldmHSize * sizeof(ldmEntry_t)); - zc->ldmSequences = (rawSeq*)ZSTD_cwksp_reserve_aligned(ws, maxNbLdmSeq * sizeof(rawSeq)); - zc->maxNbLdmSequences = maxNbLdmSeq; - - memset(&zc->ldmState.window, 0, sizeof(zc->ldmState.window)); - ZSTD_window_clear(&zc->ldmState.window); - } - - DEBUGLOG(3, "wksp: finished allocating, %zd bytes remain available", ZSTD_cwksp_available_space(ws)); - - return 0; - } -} - -/* ZSTD_invalidateRepCodes() : - * ensures next compression will not use repcodes from previous block. - * Note : only works with regular variant; - * do not use with extDict variant ! */ -void ZSTD_invalidateRepCodes(ZSTD_CCtx* cctx) { - int i; - for (i=0; iblockState.prevCBlock->rep[i] = 0; - assert(!ZSTD_window_hasExtDict(cctx->blockState.matchState.window)); -} - -/* These are the approximate sizes for each strategy past which copying the - * dictionary tables into the working context is faster than using them - * in-place. - */ -static const size_t attachDictSizeCutoffs[ZSTD_STRATEGY_MAX+1] = { - 8 KB, /* unused */ - 8 KB, /* ZSTD_fast */ - 16 KB, /* ZSTD_dfast */ - 32 KB, /* ZSTD_greedy */ - 32 KB, /* ZSTD_lazy */ - 32 KB, /* ZSTD_lazy2 */ - 32 KB, /* ZSTD_btlazy2 */ - 32 KB, /* ZSTD_btopt */ - 8 KB, /* ZSTD_btultra */ - 8 KB /* ZSTD_btultra2 */ -}; - -static int ZSTD_shouldAttachDict(const ZSTD_CDict* cdict, - const ZSTD_CCtx_params* params, - U64 pledgedSrcSize) -{ - size_t cutoff = attachDictSizeCutoffs[cdict->matchState.cParams.strategy]; - return ( pledgedSrcSize <= cutoff - || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN - || params->attachDictPref == ZSTD_dictForceAttach ) - && params->attachDictPref != ZSTD_dictForceCopy - && !params->forceWindow; /* dictMatchState isn't correctly - * handled in _enforceMaxDist */ -} - -static size_t -ZSTD_resetCCtx_byAttachingCDict(ZSTD_CCtx* cctx, - const ZSTD_CDict* cdict, - ZSTD_CCtx_params params, - U64 pledgedSrcSize, - ZSTD_buffered_policy_e zbuff) -{ - { const ZSTD_compressionParameters* const cdict_cParams = &cdict->matchState.cParams; - unsigned const windowLog = params.cParams.windowLog; - assert(windowLog != 0); - /* Resize working context table params for input only, since the dict - * has its own tables. */ - params.cParams = ZSTD_adjustCParams_internal(*cdict_cParams, pledgedSrcSize, 0); - params.cParams.windowLog = windowLog; - FORWARD_IF_ERROR(ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize, - ZSTDcrp_makeClean, zbuff)); - assert(cctx->appliedParams.cParams.strategy == cdict_cParams->strategy); - } - - { const U32 cdictEnd = (U32)( cdict->matchState.window.nextSrc - - cdict->matchState.window.base); - const U32 cdictLen = cdictEnd - cdict->matchState.window.dictLimit; - if (cdictLen == 0) { - /* don't even attach dictionaries with no contents */ - DEBUGLOG(4, "skipping attaching empty dictionary"); - } else { - DEBUGLOG(4, "attaching dictionary into context"); - cctx->blockState.matchState.dictMatchState = &cdict->matchState; - - /* prep working match state so dict matches never have negative indices - * when they are translated to the working context's index space. */ - if (cctx->blockState.matchState.window.dictLimit < cdictEnd) { - cctx->blockState.matchState.window.nextSrc = - cctx->blockState.matchState.window.base + cdictEnd; - ZSTD_window_clear(&cctx->blockState.matchState.window); - } - /* loadedDictEnd is expressed within the referential of the active context */ - cctx->blockState.matchState.loadedDictEnd = cctx->blockState.matchState.window.dictLimit; - } } - - cctx->dictID = cdict->dictID; - - /* copy block state */ - memcpy(cctx->blockState.prevCBlock, &cdict->cBlockState, sizeof(cdict->cBlockState)); - - return 0; -} - -static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx, - const ZSTD_CDict* cdict, - ZSTD_CCtx_params params, - U64 pledgedSrcSize, - ZSTD_buffered_policy_e zbuff) -{ - const ZSTD_compressionParameters *cdict_cParams = &cdict->matchState.cParams; - - DEBUGLOG(4, "copying dictionary into context"); - - { unsigned const windowLog = params.cParams.windowLog; - assert(windowLog != 0); - /* Copy only compression parameters related to tables. */ - params.cParams = *cdict_cParams; - params.cParams.windowLog = windowLog; - FORWARD_IF_ERROR(ZSTD_resetCCtx_internal(cctx, params, pledgedSrcSize, - ZSTDcrp_leaveDirty, zbuff)); - assert(cctx->appliedParams.cParams.strategy == cdict_cParams->strategy); - assert(cctx->appliedParams.cParams.hashLog == cdict_cParams->hashLog); - assert(cctx->appliedParams.cParams.chainLog == cdict_cParams->chainLog); - } - - ZSTD_cwksp_mark_tables_dirty(&cctx->workspace); - - /* copy tables */ - { size_t const chainSize = (cdict_cParams->strategy == ZSTD_fast) ? 0 : ((size_t)1 << cdict_cParams->chainLog); - size_t const hSize = (size_t)1 << cdict_cParams->hashLog; - - memcpy(cctx->blockState.matchState.hashTable, - cdict->matchState.hashTable, - hSize * sizeof(U32)); - memcpy(cctx->blockState.matchState.chainTable, - cdict->matchState.chainTable, - chainSize * sizeof(U32)); - } - - /* Zero the hashTable3, since the cdict never fills it */ - { int const h3log = cctx->blockState.matchState.hashLog3; - size_t const h3Size = h3log ? ((size_t)1 << h3log) : 0; - assert(cdict->matchState.hashLog3 == 0); - memset(cctx->blockState.matchState.hashTable3, 0, h3Size * sizeof(U32)); - } - - ZSTD_cwksp_mark_tables_clean(&cctx->workspace); - - /* copy dictionary offsets */ - { ZSTD_matchState_t const* srcMatchState = &cdict->matchState; - ZSTD_matchState_t* dstMatchState = &cctx->blockState.matchState; - dstMatchState->window = srcMatchState->window; - dstMatchState->nextToUpdate = srcMatchState->nextToUpdate; - dstMatchState->loadedDictEnd= srcMatchState->loadedDictEnd; - } - - cctx->dictID = cdict->dictID; - - /* copy block state */ - memcpy(cctx->blockState.prevCBlock, &cdict->cBlockState, sizeof(cdict->cBlockState)); - - return 0; -} - -/* We have a choice between copying the dictionary context into the working - * context, or referencing the dictionary context from the working context - * in-place. We decide here which strategy to use. */ -static size_t ZSTD_resetCCtx_usingCDict(ZSTD_CCtx* cctx, - const ZSTD_CDict* cdict, - const ZSTD_CCtx_params* params, - U64 pledgedSrcSize, - ZSTD_buffered_policy_e zbuff) -{ - - DEBUGLOG(4, "ZSTD_resetCCtx_usingCDict (pledgedSrcSize=%u)", - (unsigned)pledgedSrcSize); - - if (ZSTD_shouldAttachDict(cdict, params, pledgedSrcSize)) { - return ZSTD_resetCCtx_byAttachingCDict( - cctx, cdict, *params, pledgedSrcSize, zbuff); - } else { - return ZSTD_resetCCtx_byCopyingCDict( - cctx, cdict, *params, pledgedSrcSize, zbuff); - } -} - -/*! ZSTD_copyCCtx_internal() : - * Duplicate an existing context `srcCCtx` into another one `dstCCtx`. - * Only works during stage ZSTDcs_init (i.e. after creation, but before first call to ZSTD_compressContinue()). - * The "context", in this case, refers to the hash and chain tables, - * entropy tables, and dictionary references. - * `windowLog` value is enforced if != 0, otherwise value is copied from srcCCtx. - * @return : 0, or an error code */ -static size_t ZSTD_copyCCtx_internal(ZSTD_CCtx* dstCCtx, - const ZSTD_CCtx* srcCCtx, - ZSTD_frameParameters fParams, - U64 pledgedSrcSize, - ZSTD_buffered_policy_e zbuff) -{ - DEBUGLOG(5, "ZSTD_copyCCtx_internal"); - RETURN_ERROR_IF(srcCCtx->stage!=ZSTDcs_init, stage_wrong); - - memcpy(&dstCCtx->customMem, &srcCCtx->customMem, sizeof(ZSTD_customMem)); - { ZSTD_CCtx_params params = dstCCtx->requestedParams; - /* Copy only compression parameters related to tables. */ - params.cParams = srcCCtx->appliedParams.cParams; - params.fParams = fParams; - ZSTD_resetCCtx_internal(dstCCtx, params, pledgedSrcSize, - ZSTDcrp_leaveDirty, zbuff); - assert(dstCCtx->appliedParams.cParams.windowLog == srcCCtx->appliedParams.cParams.windowLog); - assert(dstCCtx->appliedParams.cParams.strategy == srcCCtx->appliedParams.cParams.strategy); - assert(dstCCtx->appliedParams.cParams.hashLog == srcCCtx->appliedParams.cParams.hashLog); - assert(dstCCtx->appliedParams.cParams.chainLog == srcCCtx->appliedParams.cParams.chainLog); - assert(dstCCtx->blockState.matchState.hashLog3 == srcCCtx->blockState.matchState.hashLog3); - } - - ZSTD_cwksp_mark_tables_dirty(&dstCCtx->workspace); - - /* copy tables */ - { size_t const chainSize = (srcCCtx->appliedParams.cParams.strategy == ZSTD_fast) ? 0 : ((size_t)1 << srcCCtx->appliedParams.cParams.chainLog); - size_t const hSize = (size_t)1 << srcCCtx->appliedParams.cParams.hashLog; - int const h3log = srcCCtx->blockState.matchState.hashLog3; - size_t const h3Size = h3log ? ((size_t)1 << h3log) : 0; - - memcpy(dstCCtx->blockState.matchState.hashTable, - srcCCtx->blockState.matchState.hashTable, - hSize * sizeof(U32)); - memcpy(dstCCtx->blockState.matchState.chainTable, - srcCCtx->blockState.matchState.chainTable, - chainSize * sizeof(U32)); - memcpy(dstCCtx->blockState.matchState.hashTable3, - srcCCtx->blockState.matchState.hashTable3, - h3Size * sizeof(U32)); - } - - ZSTD_cwksp_mark_tables_clean(&dstCCtx->workspace); - - /* copy dictionary offsets */ - { - const ZSTD_matchState_t* srcMatchState = &srcCCtx->blockState.matchState; - ZSTD_matchState_t* dstMatchState = &dstCCtx->blockState.matchState; - dstMatchState->window = srcMatchState->window; - dstMatchState->nextToUpdate = srcMatchState->nextToUpdate; - dstMatchState->loadedDictEnd= srcMatchState->loadedDictEnd; - } - dstCCtx->dictID = srcCCtx->dictID; - - /* copy block state */ - memcpy(dstCCtx->blockState.prevCBlock, srcCCtx->blockState.prevCBlock, sizeof(*srcCCtx->blockState.prevCBlock)); - - return 0; -} - -/*! ZSTD_copyCCtx() : - * Duplicate an existing context `srcCCtx` into another one `dstCCtx`. - * Only works during stage ZSTDcs_init (i.e. after creation, but before first call to ZSTD_compressContinue()). - * pledgedSrcSize==0 means "unknown". -* @return : 0, or an error code */ -size_t ZSTD_copyCCtx(ZSTD_CCtx* dstCCtx, const ZSTD_CCtx* srcCCtx, unsigned long long pledgedSrcSize) -{ - ZSTD_frameParameters fParams = { 1 /*content*/, 0 /*checksum*/, 0 /*noDictID*/ }; - ZSTD_buffered_policy_e const zbuff = (ZSTD_buffered_policy_e)(srcCCtx->inBuffSize>0); - ZSTD_STATIC_ASSERT((U32)ZSTDb_buffered==1); - if (pledgedSrcSize==0) pledgedSrcSize = ZSTD_CONTENTSIZE_UNKNOWN; - fParams.contentSizeFlag = (pledgedSrcSize != ZSTD_CONTENTSIZE_UNKNOWN); - - return ZSTD_copyCCtx_internal(dstCCtx, srcCCtx, - fParams, pledgedSrcSize, - zbuff); -} - - -#define ZSTD_ROWSIZE 16 -/*! ZSTD_reduceTable() : - * reduce table indexes by `reducerValue`, or squash to zero. - * PreserveMark preserves "unsorted mark" for btlazy2 strategy. - * It must be set to a clear 0/1 value, to remove branch during inlining. - * Presume table size is a multiple of ZSTD_ROWSIZE - * to help auto-vectorization */ -FORCE_INLINE_TEMPLATE void -ZSTD_reduceTable_internal (U32* const table, U32 const size, U32 const reducerValue, int const preserveMark) -{ - int const nbRows = (int)size / ZSTD_ROWSIZE; - int cellNb = 0; - int rowNb; - assert((size & (ZSTD_ROWSIZE-1)) == 0); /* multiple of ZSTD_ROWSIZE */ - assert(size < (1U<<31)); /* can be casted to int */ - -#if defined (MEMORY_SANITIZER) && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) - /* To validate that the table re-use logic is sound, and that we don't - * access table space that we haven't cleaned, we re-"poison" the table - * space every time we mark it dirty. - * - * This function however is intended to operate on those dirty tables and - * re-clean them. So when this function is used correctly, we can unpoison - * the memory it operated on. This introduces a blind spot though, since - * if we now try to operate on __actually__ poisoned memory, we will not - * detect that. */ - __msan_unpoison(table, size * sizeof(U32)); -#endif - - for (rowNb=0 ; rowNb < nbRows ; rowNb++) { - int column; - for (column=0; columncParams.hashLog; - ZSTD_reduceTable(ms->hashTable, hSize, reducerValue); - } - - if (params->cParams.strategy != ZSTD_fast) { - U32 const chainSize = (U32)1 << params->cParams.chainLog; - if (params->cParams.strategy == ZSTD_btlazy2) - ZSTD_reduceTable_btlazy2(ms->chainTable, chainSize, reducerValue); - else - ZSTD_reduceTable(ms->chainTable, chainSize, reducerValue); - } - - if (ms->hashLog3) { - U32 const h3Size = (U32)1 << ms->hashLog3; - ZSTD_reduceTable(ms->hashTable3, h3Size, reducerValue); - } -} - - -/*-******************************************************* -* Block entropic compression -*********************************************************/ - -/* See doc/zstd_compression_format.md for detailed format description */ - -static size_t ZSTD_noCompressBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize, U32 lastBlock) -{ - U32 const cBlockHeader24 = lastBlock + (((U32)bt_raw)<<1) + (U32)(srcSize << 3); - RETURN_ERROR_IF(srcSize + ZSTD_blockHeaderSize > dstCapacity, - dstSize_tooSmall); - MEM_writeLE24(dst, cBlockHeader24); - memcpy((BYTE*)dst + ZSTD_blockHeaderSize, src, srcSize); - return ZSTD_blockHeaderSize + srcSize; -} - -void ZSTD_seqToCodes(const seqStore_t* seqStorePtr) -{ - const seqDef* const sequences = seqStorePtr->sequencesStart; - BYTE* const llCodeTable = seqStorePtr->llCode; - BYTE* const ofCodeTable = seqStorePtr->ofCode; - BYTE* const mlCodeTable = seqStorePtr->mlCode; - U32 const nbSeq = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); - U32 u; - assert(nbSeq <= seqStorePtr->maxNbSeq); - for (u=0; ulongLengthID==1) - llCodeTable[seqStorePtr->longLengthPos] = MaxLL; - if (seqStorePtr->longLengthID==2) - mlCodeTable[seqStorePtr->longLengthPos] = MaxML; -} - -static int ZSTD_disableLiteralsCompression(const ZSTD_CCtx_params* cctxParams) -{ - switch (cctxParams->literalCompressionMode) { - case ZSTD_lcm_huffman: - return 0; - case ZSTD_lcm_uncompressed: - return 1; - default: - assert(0 /* impossible: pre-validated */); - /* fall-through */ - case ZSTD_lcm_auto: - return (cctxParams->cParams.strategy == ZSTD_fast) && (cctxParams->cParams.targetLength > 0); - } -} - -/* ZSTD_compressSequences_internal(): - * actually compresses both literals and sequences */ -MEM_STATIC size_t -ZSTD_compressSequences_internal(seqStore_t* seqStorePtr, - const ZSTD_entropyCTables_t* prevEntropy, - ZSTD_entropyCTables_t* nextEntropy, - const ZSTD_CCtx_params* cctxParams, - void* dst, size_t dstCapacity, - void* entropyWorkspace, size_t entropyWkspSize, - const int bmi2) -{ - const int longOffsets = cctxParams->cParams.windowLog > STREAM_ACCUMULATOR_MIN; - ZSTD_strategy const strategy = cctxParams->cParams.strategy; - unsigned count[MaxSeq+1]; - FSE_CTable* CTable_LitLength = nextEntropy->fse.litlengthCTable; - FSE_CTable* CTable_OffsetBits = nextEntropy->fse.offcodeCTable; - FSE_CTable* CTable_MatchLength = nextEntropy->fse.matchlengthCTable; - U32 LLtype, Offtype, MLtype; /* compressed, raw or rle */ - const seqDef* const sequences = seqStorePtr->sequencesStart; - const BYTE* const ofCodeTable = seqStorePtr->ofCode; - const BYTE* const llCodeTable = seqStorePtr->llCode; - const BYTE* const mlCodeTable = seqStorePtr->mlCode; - BYTE* const ostart = (BYTE*)dst; - BYTE* const oend = ostart + dstCapacity; - BYTE* op = ostart; - size_t const nbSeq = (size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart); - BYTE* seqHead; - BYTE* lastNCount = NULL; - - DEBUGLOG(5, "ZSTD_compressSequences_internal (nbSeq=%zu)", nbSeq); - ZSTD_STATIC_ASSERT(HUF_WORKSPACE_SIZE >= (1<litStart; - size_t const litSize = (size_t)(seqStorePtr->lit - literals); - size_t const cSize = ZSTD_compressLiterals( - &prevEntropy->huf, &nextEntropy->huf, - cctxParams->cParams.strategy, - ZSTD_disableLiteralsCompression(cctxParams), - op, dstCapacity, - literals, litSize, - entropyWorkspace, entropyWkspSize, - bmi2); - FORWARD_IF_ERROR(cSize); - assert(cSize <= dstCapacity); - op += cSize; - } - - /* Sequences Header */ - RETURN_ERROR_IF((oend-op) < 3 /*max nbSeq Size*/ + 1 /*seqHead*/, - dstSize_tooSmall); - if (nbSeq < 128) { - *op++ = (BYTE)nbSeq; - } else if (nbSeq < LONGNBSEQ) { - op[0] = (BYTE)((nbSeq>>8) + 0x80); - op[1] = (BYTE)nbSeq; - op+=2; - } else { - op[0]=0xFF; - MEM_writeLE16(op+1, (U16)(nbSeq - LONGNBSEQ)); - op+=3; - } - assert(op <= oend); - if (nbSeq==0) { - /* Copy the old tables over as if we repeated them */ - memcpy(&nextEntropy->fse, &prevEntropy->fse, sizeof(prevEntropy->fse)); - return (size_t)(op - ostart); - } - - /* seqHead : flags for FSE encoding type */ - seqHead = op++; - assert(op <= oend); - - /* convert length/distances into codes */ - ZSTD_seqToCodes(seqStorePtr); - /* build CTable for Literal Lengths */ - { unsigned max = MaxLL; - size_t const mostFrequent = HIST_countFast_wksp(count, &max, llCodeTable, nbSeq, entropyWorkspace, entropyWkspSize); /* can't fail */ - DEBUGLOG(5, "Building LL table"); - nextEntropy->fse.litlength_repeatMode = prevEntropy->fse.litlength_repeatMode; - LLtype = ZSTD_selectEncodingType(&nextEntropy->fse.litlength_repeatMode, - count, max, mostFrequent, nbSeq, - LLFSELog, prevEntropy->fse.litlengthCTable, - LL_defaultNorm, LL_defaultNormLog, - ZSTD_defaultAllowed, strategy); - assert(set_basic < set_compressed && set_rle < set_compressed); - assert(!(LLtype < set_compressed && nextEntropy->fse.litlength_repeatMode != FSE_repeat_none)); /* We don't copy tables */ - { size_t const countSize = ZSTD_buildCTable( - op, (size_t)(oend - op), - CTable_LitLength, LLFSELog, (symbolEncodingType_e)LLtype, - count, max, llCodeTable, nbSeq, - LL_defaultNorm, LL_defaultNormLog, MaxLL, - prevEntropy->fse.litlengthCTable, - sizeof(prevEntropy->fse.litlengthCTable), - entropyWorkspace, entropyWkspSize); - FORWARD_IF_ERROR(countSize); - if (LLtype == set_compressed) - lastNCount = op; - op += countSize; - assert(op <= oend); - } } - /* build CTable for Offsets */ - { unsigned max = MaxOff; - size_t const mostFrequent = HIST_countFast_wksp( - count, &max, ofCodeTable, nbSeq, entropyWorkspace, entropyWkspSize); /* can't fail */ - /* We can only use the basic table if max <= DefaultMaxOff, otherwise the offsets are too large */ - ZSTD_defaultPolicy_e const defaultPolicy = (max <= DefaultMaxOff) ? ZSTD_defaultAllowed : ZSTD_defaultDisallowed; - DEBUGLOG(5, "Building OF table"); - nextEntropy->fse.offcode_repeatMode = prevEntropy->fse.offcode_repeatMode; - Offtype = ZSTD_selectEncodingType(&nextEntropy->fse.offcode_repeatMode, - count, max, mostFrequent, nbSeq, - OffFSELog, prevEntropy->fse.offcodeCTable, - OF_defaultNorm, OF_defaultNormLog, - defaultPolicy, strategy); - assert(!(Offtype < set_compressed && nextEntropy->fse.offcode_repeatMode != FSE_repeat_none)); /* We don't copy tables */ - { size_t const countSize = ZSTD_buildCTable( - op, (size_t)(oend - op), - CTable_OffsetBits, OffFSELog, (symbolEncodingType_e)Offtype, - count, max, ofCodeTable, nbSeq, - OF_defaultNorm, OF_defaultNormLog, DefaultMaxOff, - prevEntropy->fse.offcodeCTable, - sizeof(prevEntropy->fse.offcodeCTable), - entropyWorkspace, entropyWkspSize); - FORWARD_IF_ERROR(countSize); - if (Offtype == set_compressed) - lastNCount = op; - op += countSize; - assert(op <= oend); - } } - /* build CTable for MatchLengths */ - { unsigned max = MaxML; - size_t const mostFrequent = HIST_countFast_wksp( - count, &max, mlCodeTable, nbSeq, entropyWorkspace, entropyWkspSize); /* can't fail */ - DEBUGLOG(5, "Building ML table (remaining space : %i)", (int)(oend-op)); - nextEntropy->fse.matchlength_repeatMode = prevEntropy->fse.matchlength_repeatMode; - MLtype = ZSTD_selectEncodingType(&nextEntropy->fse.matchlength_repeatMode, - count, max, mostFrequent, nbSeq, - MLFSELog, prevEntropy->fse.matchlengthCTable, - ML_defaultNorm, ML_defaultNormLog, - ZSTD_defaultAllowed, strategy); - assert(!(MLtype < set_compressed && nextEntropy->fse.matchlength_repeatMode != FSE_repeat_none)); /* We don't copy tables */ - { size_t const countSize = ZSTD_buildCTable( - op, (size_t)(oend - op), - CTable_MatchLength, MLFSELog, (symbolEncodingType_e)MLtype, - count, max, mlCodeTable, nbSeq, - ML_defaultNorm, ML_defaultNormLog, MaxML, - prevEntropy->fse.matchlengthCTable, - sizeof(prevEntropy->fse.matchlengthCTable), - entropyWorkspace, entropyWkspSize); - FORWARD_IF_ERROR(countSize); - if (MLtype == set_compressed) - lastNCount = op; - op += countSize; - assert(op <= oend); - } } - - *seqHead = (BYTE)((LLtype<<6) + (Offtype<<4) + (MLtype<<2)); - - { size_t const bitstreamSize = ZSTD_encodeSequences( - op, (size_t)(oend - op), - CTable_MatchLength, mlCodeTable, - CTable_OffsetBits, ofCodeTable, - CTable_LitLength, llCodeTable, - sequences, nbSeq, - longOffsets, bmi2); - FORWARD_IF_ERROR(bitstreamSize); - op += bitstreamSize; - assert(op <= oend); - /* zstd versions <= 1.3.4 mistakenly report corruption when - * FSE_readNCount() receives a buffer < 4 bytes. - * Fixed by https://github.com/facebook/zstd/pull/1146. - * This can happen when the last set_compressed table present is 2 - * bytes and the bitstream is only one byte. - * In this exceedingly rare case, we will simply emit an uncompressed - * block, since it isn't worth optimizing. - */ - if (lastNCount && (op - lastNCount) < 4) { - /* NCountSize >= 2 && bitstreamSize > 0 ==> lastCountSize == 3 */ - assert(op - lastNCount == 3); - DEBUGLOG(5, "Avoiding bug in zstd decoder in versions <= 1.3.4 by " - "emitting an uncompressed block."); - return 0; - } - } - - DEBUGLOG(5, "compressed block size : %u", (unsigned)(op - ostart)); - return (size_t)(op - ostart); -} - -MEM_STATIC size_t -ZSTD_compressSequences(seqStore_t* seqStorePtr, - const ZSTD_entropyCTables_t* prevEntropy, - ZSTD_entropyCTables_t* nextEntropy, - const ZSTD_CCtx_params* cctxParams, - void* dst, size_t dstCapacity, - size_t srcSize, - void* entropyWorkspace, size_t entropyWkspSize, - int bmi2) -{ - size_t const cSize = ZSTD_compressSequences_internal( - seqStorePtr, prevEntropy, nextEntropy, cctxParams, - dst, dstCapacity, - entropyWorkspace, entropyWkspSize, bmi2); - if (cSize == 0) return 0; - /* When srcSize <= dstCapacity, there is enough space to write a raw uncompressed block. - * Since we ran out of space, block must be not compressible, so fall back to raw uncompressed block. - */ - if ((cSize == ERROR(dstSize_tooSmall)) & (srcSize <= dstCapacity)) - return 0; /* block not compressed */ - FORWARD_IF_ERROR(cSize); - - /* Check compressibility */ - { size_t const maxCSize = srcSize - ZSTD_minGain(srcSize, cctxParams->cParams.strategy); - if (cSize >= maxCSize) return 0; /* block not compressed */ - } - - return cSize; -} - -/* ZSTD_selectBlockCompressor() : - * Not static, but internal use only (used by long distance matcher) - * assumption : strat is a valid strategy */ -ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, ZSTD_dictMode_e dictMode) -{ - static const ZSTD_blockCompressor blockCompressor[3][ZSTD_STRATEGY_MAX+1] = { - { ZSTD_compressBlock_fast /* default for 0 */, - ZSTD_compressBlock_fast, - ZSTD_compressBlock_doubleFast, - ZSTD_compressBlock_greedy, - ZSTD_compressBlock_lazy, - ZSTD_compressBlock_lazy2, - ZSTD_compressBlock_btlazy2, - ZSTD_compressBlock_btopt, - ZSTD_compressBlock_btultra, - ZSTD_compressBlock_btultra2 }, - { ZSTD_compressBlock_fast_extDict /* default for 0 */, - ZSTD_compressBlock_fast_extDict, - ZSTD_compressBlock_doubleFast_extDict, - ZSTD_compressBlock_greedy_extDict, - ZSTD_compressBlock_lazy_extDict, - ZSTD_compressBlock_lazy2_extDict, - ZSTD_compressBlock_btlazy2_extDict, - ZSTD_compressBlock_btopt_extDict, - ZSTD_compressBlock_btultra_extDict, - ZSTD_compressBlock_btultra_extDict }, - { ZSTD_compressBlock_fast_dictMatchState /* default for 0 */, - ZSTD_compressBlock_fast_dictMatchState, - ZSTD_compressBlock_doubleFast_dictMatchState, - ZSTD_compressBlock_greedy_dictMatchState, - ZSTD_compressBlock_lazy_dictMatchState, - ZSTD_compressBlock_lazy2_dictMatchState, - ZSTD_compressBlock_btlazy2_dictMatchState, - ZSTD_compressBlock_btopt_dictMatchState, - ZSTD_compressBlock_btultra_dictMatchState, - ZSTD_compressBlock_btultra_dictMatchState } - }; - ZSTD_blockCompressor selectedCompressor; - ZSTD_STATIC_ASSERT((unsigned)ZSTD_fast == 1); - - assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, strat)); - selectedCompressor = blockCompressor[(int)dictMode][(int)strat]; - assert(selectedCompressor != NULL); - return selectedCompressor; -} - -static void ZSTD_storeLastLiterals(seqStore_t* seqStorePtr, - const BYTE* anchor, size_t lastLLSize) -{ - memcpy(seqStorePtr->lit, anchor, lastLLSize); - seqStorePtr->lit += lastLLSize; -} - -void ZSTD_resetSeqStore(seqStore_t* ssPtr) -{ - ssPtr->lit = ssPtr->litStart; - ssPtr->sequences = ssPtr->sequencesStart; - ssPtr->longLengthID = 0; -} - -typedef enum { ZSTDbss_compress, ZSTDbss_noCompress } ZSTD_buildSeqStore_e; - -static size_t ZSTD_buildSeqStore(ZSTD_CCtx* zc, const void* src, size_t srcSize) -{ - ZSTD_matchState_t* const ms = &zc->blockState.matchState; - DEBUGLOG(5, "ZSTD_buildSeqStore (srcSize=%zu)", srcSize); - assert(srcSize <= ZSTD_BLOCKSIZE_MAX); - /* Assert that we have correctly flushed the ctx params into the ms's copy */ - ZSTD_assertEqualCParams(zc->appliedParams.cParams, ms->cParams); - if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1) { - ZSTD_ldm_skipSequences(&zc->externSeqStore, srcSize, zc->appliedParams.cParams.minMatch); - return ZSTDbss_noCompress; /* don't even attempt compression below a certain srcSize */ - } - ZSTD_resetSeqStore(&(zc->seqStore)); - /* required for optimal parser to read stats from dictionary */ - ms->opt.symbolCosts = &zc->blockState.prevCBlock->entropy; - /* tell the optimal parser how we expect to compress literals */ - ms->opt.literalCompressionMode = zc->appliedParams.literalCompressionMode; - /* a gap between an attached dict and the current window is not safe, - * they must remain adjacent, - * and when that stops being the case, the dict must be unset */ - assert(ms->dictMatchState == NULL || ms->loadedDictEnd == ms->window.dictLimit); - - /* limited update after a very long match */ - { const BYTE* const base = ms->window.base; - const BYTE* const istart = (const BYTE*)src; - const U32 current = (U32)(istart-base); - if (sizeof(ptrdiff_t)==8) assert(istart - base < (ptrdiff_t)(U32)(-1)); /* ensure no overflow */ - if (current > ms->nextToUpdate + 384) - ms->nextToUpdate = current - MIN(192, (U32)(current - ms->nextToUpdate - 384)); - } - - /* select and store sequences */ - { ZSTD_dictMode_e const dictMode = ZSTD_matchState_dictMode(ms); - size_t lastLLSize; - { int i; - for (i = 0; i < ZSTD_REP_NUM; ++i) - zc->blockState.nextCBlock->rep[i] = zc->blockState.prevCBlock->rep[i]; - } - if (zc->externSeqStore.pos < zc->externSeqStore.size) { - assert(!zc->appliedParams.ldmParams.enableLdm); - /* Updates ldmSeqStore.pos */ - lastLLSize = - ZSTD_ldm_blockCompress(&zc->externSeqStore, - ms, &zc->seqStore, - zc->blockState.nextCBlock->rep, - src, srcSize); - assert(zc->externSeqStore.pos <= zc->externSeqStore.size); - } else if (zc->appliedParams.ldmParams.enableLdm) { - rawSeqStore_t ldmSeqStore = {NULL, 0, 0, 0}; - - ldmSeqStore.seq = zc->ldmSequences; - ldmSeqStore.capacity = zc->maxNbLdmSequences; - /* Updates ldmSeqStore.size */ - FORWARD_IF_ERROR(ZSTD_ldm_generateSequences(&zc->ldmState, &ldmSeqStore, - &zc->appliedParams.ldmParams, - src, srcSize)); - /* Updates ldmSeqStore.pos */ - lastLLSize = - ZSTD_ldm_blockCompress(&ldmSeqStore, - ms, &zc->seqStore, - zc->blockState.nextCBlock->rep, - src, srcSize); - assert(ldmSeqStore.pos == ldmSeqStore.size); - } else { /* not long range mode */ - ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->appliedParams.cParams.strategy, dictMode); - lastLLSize = blockCompressor(ms, &zc->seqStore, zc->blockState.nextCBlock->rep, src, srcSize); - } - { const BYTE* const lastLiterals = (const BYTE*)src + srcSize - lastLLSize; - ZSTD_storeLastLiterals(&zc->seqStore, lastLiterals, lastLLSize); - } } - return ZSTDbss_compress; -} - -static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc) -{ - const seqStore_t* seqStore = ZSTD_getSeqStore(zc); - const seqDef* seqs = seqStore->sequencesStart; - size_t seqsSize = seqStore->sequences - seqs; - - ZSTD_Sequence* outSeqs = &zc->seqCollector.seqStart[zc->seqCollector.seqIndex]; - size_t i; size_t position; int repIdx; - - assert(zc->seqCollector.seqIndex + 1 < zc->seqCollector.maxSequences); - for (i = 0, position = 0; i < seqsSize; ++i) { - outSeqs[i].offset = seqs[i].offset; - outSeqs[i].litLength = seqs[i].litLength; - outSeqs[i].matchLength = seqs[i].matchLength + MINMATCH; - - if (i == seqStore->longLengthPos) { - if (seqStore->longLengthID == 1) { - outSeqs[i].litLength += 0x10000; - } else if (seqStore->longLengthID == 2) { - outSeqs[i].matchLength += 0x10000; - } - } - - if (outSeqs[i].offset <= ZSTD_REP_NUM) { - outSeqs[i].rep = outSeqs[i].offset; - repIdx = (unsigned int)i - outSeqs[i].offset; - - if (outSeqs[i].litLength == 0) { - if (outSeqs[i].offset < 3) { - --repIdx; - } else { - repIdx = (unsigned int)i - 1; - } - ++outSeqs[i].rep; - } - assert(repIdx >= -3); - outSeqs[i].offset = repIdx >= 0 ? outSeqs[repIdx].offset : repStartValue[-repIdx - 1]; - if (outSeqs[i].rep == 4) { - --outSeqs[i].offset; - } - } else { - outSeqs[i].offset -= ZSTD_REP_NUM; - } - - position += outSeqs[i].litLength; - outSeqs[i].matchPos = (unsigned int)position; - position += outSeqs[i].matchLength; - } - zc->seqCollector.seqIndex += seqsSize; -} - -size_t ZSTD_getSequences(ZSTD_CCtx* zc, ZSTD_Sequence* outSeqs, - size_t outSeqsSize, const void* src, size_t srcSize) -{ - const size_t dstCapacity = ZSTD_compressBound(srcSize); - void* dst = ZSTD_malloc(dstCapacity, ZSTD_defaultCMem); - SeqCollector seqCollector; - - RETURN_ERROR_IF(dst == NULL, memory_allocation); - - seqCollector.collectSequences = 1; - seqCollector.seqStart = outSeqs; - seqCollector.seqIndex = 0; - seqCollector.maxSequences = outSeqsSize; - zc->seqCollector = seqCollector; - - ZSTD_compress2(zc, dst, dstCapacity, src, srcSize); - ZSTD_free(dst, ZSTD_defaultCMem); - return zc->seqCollector.seqIndex; -} - -/* Returns true if the given block is a RLE block */ -static int ZSTD_isRLE(const BYTE *ip, size_t length) { - size_t i; - if (length < 2) return 1; - for (i = 1; i < length; ++i) { - if (ip[0] != ip[i]) return 0; - } - return 1; -} - -static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, U32 frame) -{ - /* This the upper bound for the length of an rle block. - * This isn't the actual upper bound. Finding the real threshold - * needs further investigation. - */ - const U32 rleMaxLength = 25; - size_t cSize; - const BYTE* ip = (const BYTE*)src; - BYTE* op = (BYTE*)dst; - DEBUGLOG(5, "ZSTD_compressBlock_internal (dstCapacity=%u, dictLimit=%u, nextToUpdate=%u)", - (unsigned)dstCapacity, (unsigned)zc->blockState.matchState.window.dictLimit, - (unsigned)zc->blockState.matchState.nextToUpdate); - - { const size_t bss = ZSTD_buildSeqStore(zc, src, srcSize); - FORWARD_IF_ERROR(bss); - if (bss == ZSTDbss_noCompress) { cSize = 0; goto out; } - } - - if (zc->seqCollector.collectSequences) { - ZSTD_copyBlockSequences(zc); - return 0; - } - - /* encode sequences and literals */ - cSize = ZSTD_compressSequences(&zc->seqStore, - &zc->blockState.prevCBlock->entropy, &zc->blockState.nextCBlock->entropy, - &zc->appliedParams, - dst, dstCapacity, - srcSize, - zc->entropyWorkspace, HUF_WORKSPACE_SIZE /* statically allocated in resetCCtx */, - zc->bmi2); - - if (frame && - /* We don't want to emit our first block as a RLE even if it qualifies because - * doing so will cause the decoder (cli only) to throw a "should consume all input error." - * This is only an issue for zstd <= v1.4.3 - */ - !zc->isFirstBlock && - cSize < rleMaxLength && - ZSTD_isRLE(ip, srcSize)) - { - cSize = 1; - op[0] = ip[0]; - } - -out: - if (!ZSTD_isError(cSize) && cSize > 1) { - /* confirm repcodes and entropy tables when emitting a compressed block */ - ZSTD_compressedBlockState_t* const tmp = zc->blockState.prevCBlock; - zc->blockState.prevCBlock = zc->blockState.nextCBlock; - zc->blockState.nextCBlock = tmp; - } - /* We check that dictionaries have offset codes available for the first - * block. After the first block, the offcode table might not have large - * enough codes to represent the offsets in the data. - */ - if (zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode == FSE_repeat_valid) - zc->blockState.prevCBlock->entropy.fse.offcode_repeatMode = FSE_repeat_check; - - return cSize; -} - - -static void ZSTD_overflowCorrectIfNeeded(ZSTD_matchState_t* ms, - ZSTD_cwksp* ws, - ZSTD_CCtx_params const* params, - void const* ip, - void const* iend) -{ - if (ZSTD_window_needOverflowCorrection(ms->window, iend)) { - U32 const maxDist = (U32)1 << params->cParams.windowLog; - U32 const cycleLog = ZSTD_cycleLog(params->cParams.chainLog, params->cParams.strategy); - U32 const correction = ZSTD_window_correctOverflow(&ms->window, cycleLog, maxDist, ip); - ZSTD_STATIC_ASSERT(ZSTD_CHAINLOG_MAX <= 30); - ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX_32 <= 30); - ZSTD_STATIC_ASSERT(ZSTD_WINDOWLOG_MAX <= 31); - ZSTD_cwksp_mark_tables_dirty(ws); - ZSTD_reduceIndex(ms, params, correction); - ZSTD_cwksp_mark_tables_clean(ws); - if (ms->nextToUpdate < correction) ms->nextToUpdate = 0; - else ms->nextToUpdate -= correction; - /* invalidate dictionaries on overflow correction */ - ms->loadedDictEnd = 0; - ms->dictMatchState = NULL; - } -} - -/*! ZSTD_compress_frameChunk() : -* Compress a chunk of data into one or multiple blocks. -* All blocks will be terminated, all input will be consumed. -* Function will issue an error if there is not enough `dstCapacity` to hold the compressed content. -* Frame is supposed already started (header already produced) -* @return : compressed size, or an error code -*/ -static size_t ZSTD_compress_frameChunk (ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - U32 lastFrameChunk) -{ - size_t blockSize = cctx->blockSize; - size_t remaining = srcSize; - const BYTE* ip = (const BYTE*)src; - BYTE* const ostart = (BYTE*)dst; - BYTE* op = ostart; - U32 const maxDist = (U32)1 << cctx->appliedParams.cParams.windowLog; - assert(cctx->appliedParams.cParams.windowLog <= ZSTD_WINDOWLOG_MAX); - - DEBUGLOG(5, "ZSTD_compress_frameChunk (blockSize=%u)", (unsigned)blockSize); - if (cctx->appliedParams.fParams.checksumFlag && srcSize) - XXH64_update(&cctx->xxhState, src, srcSize); - - while (remaining) { - ZSTD_matchState_t* const ms = &cctx->blockState.matchState; - U32 const lastBlock = lastFrameChunk & (blockSize >= remaining); - - RETURN_ERROR_IF(dstCapacity < ZSTD_blockHeaderSize + MIN_CBLOCK_SIZE, - dstSize_tooSmall, - "not enough space to store compressed block"); - if (remaining < blockSize) blockSize = remaining; - - ZSTD_overflowCorrectIfNeeded( - ms, &cctx->workspace, &cctx->appliedParams, ip, ip + blockSize); - ZSTD_checkDictValidity(&ms->window, ip + blockSize, maxDist, &ms->loadedDictEnd, &ms->dictMatchState); - - /* Ensure hash/chain table insertion resumes no sooner than lowlimit */ - if (ms->nextToUpdate < ms->window.lowLimit) ms->nextToUpdate = ms->window.lowLimit; - - { size_t cSize = ZSTD_compressBlock_internal(cctx, - op+ZSTD_blockHeaderSize, dstCapacity-ZSTD_blockHeaderSize, - ip, blockSize, 1 /* frame */); - FORWARD_IF_ERROR(cSize); - if (cSize == 0) { /* block is not compressible */ - cSize = ZSTD_noCompressBlock(op, dstCapacity, ip, blockSize, lastBlock); - FORWARD_IF_ERROR(cSize); - } else { - const U32 cBlockHeader = cSize == 1 ? - lastBlock + (((U32)bt_rle)<<1) + (U32)(blockSize << 3) : - lastBlock + (((U32)bt_compressed)<<1) + (U32)(cSize << 3); - MEM_writeLE24(op, cBlockHeader); - cSize += ZSTD_blockHeaderSize; - } - - ip += blockSize; - assert(remaining >= blockSize); - remaining -= blockSize; - op += cSize; - assert(dstCapacity >= cSize); - dstCapacity -= cSize; - cctx->isFirstBlock = 0; - DEBUGLOG(5, "ZSTD_compress_frameChunk: adding a block of size %u", - (unsigned)cSize); - } } - - if (lastFrameChunk && (op>ostart)) cctx->stage = ZSTDcs_ending; - return (size_t)(op-ostart); -} - - -static size_t ZSTD_writeFrameHeader(void* dst, size_t dstCapacity, - const ZSTD_CCtx_params* params, U64 pledgedSrcSize, U32 dictID) -{ BYTE* const op = (BYTE*)dst; - U32 const dictIDSizeCodeLength = (dictID>0) + (dictID>=256) + (dictID>=65536); /* 0-3 */ - U32 const dictIDSizeCode = params->fParams.noDictIDFlag ? 0 : dictIDSizeCodeLength; /* 0-3 */ - U32 const checksumFlag = params->fParams.checksumFlag>0; - U32 const windowSize = (U32)1 << params->cParams.windowLog; - U32 const singleSegment = params->fParams.contentSizeFlag && (windowSize >= pledgedSrcSize); - BYTE const windowLogByte = (BYTE)((params->cParams.windowLog - ZSTD_WINDOWLOG_ABSOLUTEMIN) << 3); - U32 const fcsCode = params->fParams.contentSizeFlag ? - (pledgedSrcSize>=256) + (pledgedSrcSize>=65536+256) + (pledgedSrcSize>=0xFFFFFFFFU) : 0; /* 0-3 */ - BYTE const frameHeaderDescriptionByte = (BYTE)(dictIDSizeCode + (checksumFlag<<2) + (singleSegment<<5) + (fcsCode<<6) ); - size_t pos=0; - - assert(!(params->fParams.contentSizeFlag && pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN)); - RETURN_ERROR_IF(dstCapacity < ZSTD_FRAMEHEADERSIZE_MAX, dstSize_tooSmall); - DEBUGLOG(4, "ZSTD_writeFrameHeader : dictIDFlag : %u ; dictID : %u ; dictIDSizeCode : %u", - !params->fParams.noDictIDFlag, (unsigned)dictID, (unsigned)dictIDSizeCode); - - if (params->format == ZSTD_f_zstd1) { - MEM_writeLE32(dst, ZSTD_MAGICNUMBER); - pos = 4; - } - op[pos++] = frameHeaderDescriptionByte; - if (!singleSegment) op[pos++] = windowLogByte; - switch(dictIDSizeCode) - { - default: assert(0); /* impossible */ - case 0 : break; - case 1 : op[pos] = (BYTE)(dictID); pos++; break; - case 2 : MEM_writeLE16(op+pos, (U16)dictID); pos+=2; break; - case 3 : MEM_writeLE32(op+pos, dictID); pos+=4; break; - } - switch(fcsCode) - { - default: assert(0); /* impossible */ - case 0 : if (singleSegment) op[pos++] = (BYTE)(pledgedSrcSize); break; - case 1 : MEM_writeLE16(op+pos, (U16)(pledgedSrcSize-256)); pos+=2; break; - case 2 : MEM_writeLE32(op+pos, (U32)(pledgedSrcSize)); pos+=4; break; - case 3 : MEM_writeLE64(op+pos, (U64)(pledgedSrcSize)); pos+=8; break; - } - return pos; -} - -/* ZSTD_writeLastEmptyBlock() : - * output an empty Block with end-of-frame mark to complete a frame - * @return : size of data written into `dst` (== ZSTD_blockHeaderSize (defined in zstd_internal.h)) - * or an error code if `dstCapacity` is too small (stage != ZSTDcs_init, stage_wrong); - RETURN_ERROR_IF(cctx->appliedParams.ldmParams.enableLdm, - parameter_unsupported); - cctx->externSeqStore.seq = seq; - cctx->externSeqStore.size = nbSeq; - cctx->externSeqStore.capacity = nbSeq; - cctx->externSeqStore.pos = 0; - return 0; -} - - -static size_t ZSTD_compressContinue_internal (ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - U32 frame, U32 lastFrameChunk) -{ - ZSTD_matchState_t* const ms = &cctx->blockState.matchState; - size_t fhSize = 0; - - DEBUGLOG(5, "ZSTD_compressContinue_internal, stage: %u, srcSize: %u", - cctx->stage, (unsigned)srcSize); - RETURN_ERROR_IF(cctx->stage==ZSTDcs_created, stage_wrong, - "missing init (ZSTD_compressBegin)"); - - if (frame && (cctx->stage==ZSTDcs_init)) { - fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams, - cctx->pledgedSrcSizePlusOne-1, cctx->dictID); - FORWARD_IF_ERROR(fhSize); - assert(fhSize <= dstCapacity); - dstCapacity -= fhSize; - dst = (char*)dst + fhSize; - cctx->stage = ZSTDcs_ongoing; - } - - if (!srcSize) return fhSize; /* do not generate an empty block if no input */ - - if (!ZSTD_window_update(&ms->window, src, srcSize)) { - ms->nextToUpdate = ms->window.dictLimit; - } - if (cctx->appliedParams.ldmParams.enableLdm) { - ZSTD_window_update(&cctx->ldmState.window, src, srcSize); - } - - if (!frame) { - /* overflow check and correction for block mode */ - ZSTD_overflowCorrectIfNeeded( - ms, &cctx->workspace, &cctx->appliedParams, - src, (BYTE const*)src + srcSize); - } - - DEBUGLOG(5, "ZSTD_compressContinue_internal (blockSize=%u)", (unsigned)cctx->blockSize); - { size_t const cSize = frame ? - ZSTD_compress_frameChunk (cctx, dst, dstCapacity, src, srcSize, lastFrameChunk) : - ZSTD_compressBlock_internal (cctx, dst, dstCapacity, src, srcSize, 0 /* frame */); - FORWARD_IF_ERROR(cSize); - cctx->consumedSrcSize += srcSize; - cctx->producedCSize += (cSize + fhSize); - assert(!(cctx->appliedParams.fParams.contentSizeFlag && cctx->pledgedSrcSizePlusOne == 0)); - if (cctx->pledgedSrcSizePlusOne != 0) { /* control src size */ - ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN == (unsigned long long)-1); - RETURN_ERROR_IF( - cctx->consumedSrcSize+1 > cctx->pledgedSrcSizePlusOne, - srcSize_wrong, - "error : pledgedSrcSize = %u, while realSrcSize >= %u", - (unsigned)cctx->pledgedSrcSizePlusOne-1, - (unsigned)cctx->consumedSrcSize); - } - return cSize + fhSize; - } -} - -size_t ZSTD_compressContinue (ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize) -{ - DEBUGLOG(5, "ZSTD_compressContinue (srcSize=%u)", (unsigned)srcSize); - return ZSTD_compressContinue_internal(cctx, dst, dstCapacity, src, srcSize, 1 /* frame mode */, 0 /* last chunk */); -} - - -size_t ZSTD_getBlockSize(const ZSTD_CCtx* cctx) -{ - ZSTD_compressionParameters const cParams = cctx->appliedParams.cParams; - assert(!ZSTD_checkCParams(cParams)); - return MIN (ZSTD_BLOCKSIZE_MAX, (U32)1 << cParams.windowLog); -} - -size_t ZSTD_compressBlock(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - DEBUGLOG(5, "ZSTD_compressBlock: srcSize = %u", (unsigned)srcSize); - { size_t const blockSizeMax = ZSTD_getBlockSize(cctx); - RETURN_ERROR_IF(srcSize > blockSizeMax, srcSize_wrong); } - - return ZSTD_compressContinue_internal(cctx, dst, dstCapacity, src, srcSize, 0 /* frame mode */, 0 /* last chunk */); -} - -/*! ZSTD_loadDictionaryContent() : - * @return : 0, or an error code - */ -static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms, - ZSTD_cwksp* ws, - ZSTD_CCtx_params const* params, - const void* src, size_t srcSize, - ZSTD_dictTableLoadMethod_e dtlm) -{ - const BYTE* ip = (const BYTE*) src; - const BYTE* const iend = ip + srcSize; - - ZSTD_window_update(&ms->window, src, srcSize); - ms->loadedDictEnd = params->forceWindow ? 0 : (U32)(iend - ms->window.base); - - /* Assert that we the ms params match the params we're being given */ - ZSTD_assertEqualCParams(params->cParams, ms->cParams); - - if (srcSize <= HASH_READ_SIZE) return 0; - - while (iend - ip > HASH_READ_SIZE) { - size_t const remaining = (size_t)(iend - ip); - size_t const chunk = MIN(remaining, ZSTD_CHUNKSIZE_MAX); - const BYTE* const ichunk = ip + chunk; - - ZSTD_overflowCorrectIfNeeded(ms, ws, params, ip, ichunk); - - switch(params->cParams.strategy) - { - case ZSTD_fast: - ZSTD_fillHashTable(ms, ichunk, dtlm); - break; - case ZSTD_dfast: - ZSTD_fillDoubleHashTable(ms, ichunk, dtlm); - break; - - case ZSTD_greedy: - case ZSTD_lazy: - case ZSTD_lazy2: - if (chunk >= HASH_READ_SIZE) - ZSTD_insertAndFindFirstIndex(ms, ichunk-HASH_READ_SIZE); - break; - - case ZSTD_btlazy2: /* we want the dictionary table fully sorted */ - case ZSTD_btopt: - case ZSTD_btultra: - case ZSTD_btultra2: - if (chunk >= HASH_READ_SIZE) - ZSTD_updateTree(ms, ichunk-HASH_READ_SIZE, ichunk); - break; - - default: - assert(0); /* not possible : not a valid strategy id */ - } - - ip = ichunk; - } - - ms->nextToUpdate = (U32)(iend - ms->window.base); - return 0; -} - - -/* Dictionaries that assign zero probability to symbols that show up causes problems - when FSE encoding. Refuse dictionaries that assign zero probability to symbols - that we may encounter during compression. - NOTE: This behavior is not standard and could be improved in the future. */ -static size_t ZSTD_checkDictNCount(short* normalizedCounter, unsigned dictMaxSymbolValue, unsigned maxSymbolValue) { - U32 s; - RETURN_ERROR_IF(dictMaxSymbolValue < maxSymbolValue, dictionary_corrupted); - for (s = 0; s <= maxSymbolValue; ++s) { - RETURN_ERROR_IF(normalizedCounter[s] == 0, dictionary_corrupted); - } - return 0; -} - - -/* Dictionary format : - * See : - * https://github.com/facebook/zstd/blob/master/doc/zstd_compression_format.md#dictionary-format - */ -/*! ZSTD_loadZstdDictionary() : - * @return : dictID, or an error code - * assumptions : magic number supposed already checked - * dictSize supposed >= 8 - */ -static size_t ZSTD_loadZstdDictionary(ZSTD_compressedBlockState_t* bs, - ZSTD_matchState_t* ms, - ZSTD_cwksp* ws, - ZSTD_CCtx_params const* params, - const void* dict, size_t dictSize, - ZSTD_dictTableLoadMethod_e dtlm, - void* workspace) -{ - const BYTE* dictPtr = (const BYTE*)dict; - const BYTE* const dictEnd = dictPtr + dictSize; - short offcodeNCount[MaxOff+1]; - unsigned offcodeMaxValue = MaxOff; - size_t dictID; - - ZSTD_STATIC_ASSERT(HUF_WORKSPACE_SIZE >= (1<= 8); - assert(MEM_readLE32(dictPtr) == ZSTD_MAGIC_DICTIONARY); - - dictPtr += 4; /* skip magic number */ - dictID = params->fParams.noDictIDFlag ? 0 : MEM_readLE32(dictPtr); - dictPtr += 4; - - { unsigned maxSymbolValue = 255; - size_t const hufHeaderSize = HUF_readCTable((HUF_CElt*)bs->entropy.huf.CTable, &maxSymbolValue, dictPtr, dictEnd-dictPtr); - RETURN_ERROR_IF(HUF_isError(hufHeaderSize), dictionary_corrupted); - RETURN_ERROR_IF(maxSymbolValue < 255, dictionary_corrupted); - dictPtr += hufHeaderSize; - } - - { unsigned offcodeLog; - size_t const offcodeHeaderSize = FSE_readNCount(offcodeNCount, &offcodeMaxValue, &offcodeLog, dictPtr, dictEnd-dictPtr); - RETURN_ERROR_IF(FSE_isError(offcodeHeaderSize), dictionary_corrupted); - RETURN_ERROR_IF(offcodeLog > OffFSELog, dictionary_corrupted); - /* Defer checking offcodeMaxValue because we need to know the size of the dictionary content */ - /* fill all offset symbols to avoid garbage at end of table */ - RETURN_ERROR_IF(FSE_isError(FSE_buildCTable_wksp( - bs->entropy.fse.offcodeCTable, - offcodeNCount, MaxOff, offcodeLog, - workspace, HUF_WORKSPACE_SIZE)), - dictionary_corrupted); - dictPtr += offcodeHeaderSize; - } - - { short matchlengthNCount[MaxML+1]; - unsigned matchlengthMaxValue = MaxML, matchlengthLog; - size_t const matchlengthHeaderSize = FSE_readNCount(matchlengthNCount, &matchlengthMaxValue, &matchlengthLog, dictPtr, dictEnd-dictPtr); - RETURN_ERROR_IF(FSE_isError(matchlengthHeaderSize), dictionary_corrupted); - RETURN_ERROR_IF(matchlengthLog > MLFSELog, dictionary_corrupted); - /* Every match length code must have non-zero probability */ - FORWARD_IF_ERROR( ZSTD_checkDictNCount(matchlengthNCount, matchlengthMaxValue, MaxML)); - RETURN_ERROR_IF(FSE_isError(FSE_buildCTable_wksp( - bs->entropy.fse.matchlengthCTable, - matchlengthNCount, matchlengthMaxValue, matchlengthLog, - workspace, HUF_WORKSPACE_SIZE)), - dictionary_corrupted); - dictPtr += matchlengthHeaderSize; - } - - { short litlengthNCount[MaxLL+1]; - unsigned litlengthMaxValue = MaxLL, litlengthLog; - size_t const litlengthHeaderSize = FSE_readNCount(litlengthNCount, &litlengthMaxValue, &litlengthLog, dictPtr, dictEnd-dictPtr); - RETURN_ERROR_IF(FSE_isError(litlengthHeaderSize), dictionary_corrupted); - RETURN_ERROR_IF(litlengthLog > LLFSELog, dictionary_corrupted); - /* Every literal length code must have non-zero probability */ - FORWARD_IF_ERROR( ZSTD_checkDictNCount(litlengthNCount, litlengthMaxValue, MaxLL)); - RETURN_ERROR_IF(FSE_isError(FSE_buildCTable_wksp( - bs->entropy.fse.litlengthCTable, - litlengthNCount, litlengthMaxValue, litlengthLog, - workspace, HUF_WORKSPACE_SIZE)), - dictionary_corrupted); - dictPtr += litlengthHeaderSize; - } - - RETURN_ERROR_IF(dictPtr+12 > dictEnd, dictionary_corrupted); - bs->rep[0] = MEM_readLE32(dictPtr+0); - bs->rep[1] = MEM_readLE32(dictPtr+4); - bs->rep[2] = MEM_readLE32(dictPtr+8); - dictPtr += 12; - - { size_t const dictContentSize = (size_t)(dictEnd - dictPtr); - U32 offcodeMax = MaxOff; - if (dictContentSize <= ((U32)-1) - 128 KB) { - U32 const maxOffset = (U32)dictContentSize + 128 KB; /* The maximum offset that must be supported */ - offcodeMax = ZSTD_highbit32(maxOffset); /* Calculate minimum offset code required to represent maxOffset */ - } - /* All offset values <= dictContentSize + 128 KB must be representable */ - FORWARD_IF_ERROR(ZSTD_checkDictNCount(offcodeNCount, offcodeMaxValue, MIN(offcodeMax, MaxOff))); - /* All repCodes must be <= dictContentSize and != 0*/ - { U32 u; - for (u=0; u<3; u++) { - RETURN_ERROR_IF(bs->rep[u] == 0, dictionary_corrupted); - RETURN_ERROR_IF(bs->rep[u] > dictContentSize, dictionary_corrupted); - } } - - bs->entropy.huf.repeatMode = HUF_repeat_valid; - bs->entropy.fse.offcode_repeatMode = FSE_repeat_valid; - bs->entropy.fse.matchlength_repeatMode = FSE_repeat_valid; - bs->entropy.fse.litlength_repeatMode = FSE_repeat_valid; - FORWARD_IF_ERROR(ZSTD_loadDictionaryContent( - ms, ws, params, dictPtr, dictContentSize, dtlm)); - return dictID; - } -} - -/** ZSTD_compress_insertDictionary() : -* @return : dictID, or an error code */ -static size_t -ZSTD_compress_insertDictionary(ZSTD_compressedBlockState_t* bs, - ZSTD_matchState_t* ms, - ZSTD_cwksp* ws, - const ZSTD_CCtx_params* params, - const void* dict, size_t dictSize, - ZSTD_dictContentType_e dictContentType, - ZSTD_dictTableLoadMethod_e dtlm, - void* workspace) -{ - DEBUGLOG(4, "ZSTD_compress_insertDictionary (dictSize=%u)", (U32)dictSize); - if ((dict==NULL) || (dictSize<8)) { - RETURN_ERROR_IF(dictContentType == ZSTD_dct_fullDict, dictionary_wrong); - return 0; - } - - ZSTD_reset_compressedBlockState(bs); - - /* dict restricted modes */ - if (dictContentType == ZSTD_dct_rawContent) - return ZSTD_loadDictionaryContent(ms, ws, params, dict, dictSize, dtlm); - - if (MEM_readLE32(dict) != ZSTD_MAGIC_DICTIONARY) { - if (dictContentType == ZSTD_dct_auto) { - DEBUGLOG(4, "raw content dictionary detected"); - return ZSTD_loadDictionaryContent( - ms, ws, params, dict, dictSize, dtlm); - } - RETURN_ERROR_IF(dictContentType == ZSTD_dct_fullDict, dictionary_wrong); - assert(0); /* impossible */ - } - - /* dict as full zstd dictionary */ - return ZSTD_loadZstdDictionary( - bs, ms, ws, params, dict, dictSize, dtlm, workspace); -} - -#define ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF (128 KB) -#define ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER (6) - -/*! ZSTD_compressBegin_internal() : - * @return : 0, or an error code */ -static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx, - const void* dict, size_t dictSize, - ZSTD_dictContentType_e dictContentType, - ZSTD_dictTableLoadMethod_e dtlm, - const ZSTD_CDict* cdict, - const ZSTD_CCtx_params* params, U64 pledgedSrcSize, - ZSTD_buffered_policy_e zbuff) -{ - DEBUGLOG(4, "ZSTD_compressBegin_internal: wlog=%u", params->cParams.windowLog); - /* params are supposed to be fully validated at this point */ - assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams))); - assert(!((dict) && (cdict))); /* either dict or cdict, not both */ - if ( (cdict) - && (cdict->dictContentSize > 0) - && ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF - || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER - || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN - || cdict->compressionLevel == 0) - && (params->attachDictPref != ZSTD_dictForceLoad) ) { - return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff); - } - - FORWARD_IF_ERROR( ZSTD_resetCCtx_internal(cctx, *params, pledgedSrcSize, - ZSTDcrp_makeClean, zbuff) ); - { size_t const dictID = cdict ? - ZSTD_compress_insertDictionary( - cctx->blockState.prevCBlock, &cctx->blockState.matchState, - &cctx->workspace, params, cdict->dictContent, cdict->dictContentSize, - dictContentType, dtlm, cctx->entropyWorkspace) - : ZSTD_compress_insertDictionary( - cctx->blockState.prevCBlock, &cctx->blockState.matchState, - &cctx->workspace, params, dict, dictSize, - dictContentType, dtlm, cctx->entropyWorkspace); - FORWARD_IF_ERROR(dictID); - assert(dictID <= UINT_MAX); - cctx->dictID = (U32)dictID; - } - return 0; -} - -size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx, - const void* dict, size_t dictSize, - ZSTD_dictContentType_e dictContentType, - ZSTD_dictTableLoadMethod_e dtlm, - const ZSTD_CDict* cdict, - const ZSTD_CCtx_params* params, - unsigned long long pledgedSrcSize) -{ - DEBUGLOG(4, "ZSTD_compressBegin_advanced_internal: wlog=%u", params->cParams.windowLog); - /* compression parameters verification and optimization */ - FORWARD_IF_ERROR( ZSTD_checkCParams(params->cParams) ); - return ZSTD_compressBegin_internal(cctx, - dict, dictSize, dictContentType, dtlm, - cdict, - params, pledgedSrcSize, - ZSTDb_not_buffered); -} - -/*! ZSTD_compressBegin_advanced() : -* @return : 0, or an error code */ -size_t ZSTD_compressBegin_advanced(ZSTD_CCtx* cctx, - const void* dict, size_t dictSize, - ZSTD_parameters params, unsigned long long pledgedSrcSize) -{ - ZSTD_CCtx_params const cctxParams = - ZSTD_assignParamsToCCtxParams(&cctx->requestedParams, params); - return ZSTD_compressBegin_advanced_internal(cctx, - dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast, - NULL /*cdict*/, - &cctxParams, pledgedSrcSize); -} - -size_t ZSTD_compressBegin_usingDict(ZSTD_CCtx* cctx, const void* dict, size_t dictSize, int compressionLevel) -{ - ZSTD_parameters const params = ZSTD_getParams(compressionLevel, ZSTD_CONTENTSIZE_UNKNOWN, dictSize); - ZSTD_CCtx_params const cctxParams = - ZSTD_assignParamsToCCtxParams(&cctx->requestedParams, params); - DEBUGLOG(4, "ZSTD_compressBegin_usingDict (dictSize=%u)", (unsigned)dictSize); - return ZSTD_compressBegin_internal(cctx, dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast, NULL, - &cctxParams, ZSTD_CONTENTSIZE_UNKNOWN, ZSTDb_not_buffered); -} - -size_t ZSTD_compressBegin(ZSTD_CCtx* cctx, int compressionLevel) -{ - return ZSTD_compressBegin_usingDict(cctx, NULL, 0, compressionLevel); -} - - -/*! ZSTD_writeEpilogue() : -* Ends a frame. -* @return : nb of bytes written into dst (or an error code) */ -static size_t ZSTD_writeEpilogue(ZSTD_CCtx* cctx, void* dst, size_t dstCapacity) -{ - BYTE* const ostart = (BYTE*)dst; - BYTE* op = ostart; - size_t fhSize = 0; - - DEBUGLOG(4, "ZSTD_writeEpilogue"); - RETURN_ERROR_IF(cctx->stage == ZSTDcs_created, stage_wrong, "init missing"); - - /* special case : empty frame */ - if (cctx->stage == ZSTDcs_init) { - fhSize = ZSTD_writeFrameHeader(dst, dstCapacity, &cctx->appliedParams, 0, 0); - FORWARD_IF_ERROR(fhSize); - dstCapacity -= fhSize; - op += fhSize; - cctx->stage = ZSTDcs_ongoing; - } - - if (cctx->stage != ZSTDcs_ending) { - /* write one last empty block, make it the "last" block */ - U32 const cBlockHeader24 = 1 /* last block */ + (((U32)bt_raw)<<1) + 0; - RETURN_ERROR_IF(dstCapacity<4, dstSize_tooSmall); - MEM_writeLE32(op, cBlockHeader24); - op += ZSTD_blockHeaderSize; - dstCapacity -= ZSTD_blockHeaderSize; - } - - if (cctx->appliedParams.fParams.checksumFlag) { - U32 const checksum = (U32) XXH64_digest(&cctx->xxhState); - RETURN_ERROR_IF(dstCapacity<4, dstSize_tooSmall); - DEBUGLOG(4, "ZSTD_writeEpilogue: write checksum : %08X", (unsigned)checksum); - MEM_writeLE32(op, checksum); - op += 4; - } - - cctx->stage = ZSTDcs_created; /* return to "created but no init" status */ - return op-ostart; -} - -size_t ZSTD_compressEnd (ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize) -{ - size_t endResult; - size_t const cSize = ZSTD_compressContinue_internal(cctx, - dst, dstCapacity, src, srcSize, - 1 /* frame mode */, 1 /* last chunk */); - FORWARD_IF_ERROR(cSize); - endResult = ZSTD_writeEpilogue(cctx, (char*)dst + cSize, dstCapacity-cSize); - FORWARD_IF_ERROR(endResult); - assert(!(cctx->appliedParams.fParams.contentSizeFlag && cctx->pledgedSrcSizePlusOne == 0)); - if (cctx->pledgedSrcSizePlusOne != 0) { /* control src size */ - ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN == (unsigned long long)-1); - DEBUGLOG(4, "end of frame : controlling src size"); - RETURN_ERROR_IF( - cctx->pledgedSrcSizePlusOne != cctx->consumedSrcSize+1, - srcSize_wrong, - "error : pledgedSrcSize = %u, while realSrcSize = %u", - (unsigned)cctx->pledgedSrcSizePlusOne-1, - (unsigned)cctx->consumedSrcSize); - } - return cSize + endResult; -} - - -static size_t ZSTD_compress_internal (ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict,size_t dictSize, - ZSTD_parameters params) -{ - ZSTD_CCtx_params const cctxParams = - ZSTD_assignParamsToCCtxParams(&cctx->requestedParams, params); - DEBUGLOG(4, "ZSTD_compress_internal"); - return ZSTD_compress_advanced_internal(cctx, - dst, dstCapacity, - src, srcSize, - dict, dictSize, - &cctxParams); -} - -size_t ZSTD_compress_advanced (ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict,size_t dictSize, - ZSTD_parameters params) -{ - DEBUGLOG(4, "ZSTD_compress_advanced"); - FORWARD_IF_ERROR(ZSTD_checkCParams(params.cParams)); - return ZSTD_compress_internal(cctx, - dst, dstCapacity, - src, srcSize, - dict, dictSize, - params); -} - -/* Internal */ -size_t ZSTD_compress_advanced_internal( - ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict,size_t dictSize, - const ZSTD_CCtx_params* params) -{ - DEBUGLOG(4, "ZSTD_compress_advanced_internal (srcSize:%u)", (unsigned)srcSize); - FORWARD_IF_ERROR( ZSTD_compressBegin_internal(cctx, - dict, dictSize, ZSTD_dct_auto, ZSTD_dtlm_fast, NULL, - params, srcSize, ZSTDb_not_buffered) ); - return ZSTD_compressEnd(cctx, dst, dstCapacity, src, srcSize); -} - -size_t ZSTD_compress_usingDict(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict, size_t dictSize, - int compressionLevel) -{ - ZSTD_parameters const params = ZSTD_getParams(compressionLevel, srcSize + (!srcSize), dict ? dictSize : 0); - ZSTD_CCtx_params cctxParams = ZSTD_assignParamsToCCtxParams(&cctx->requestedParams, params); - assert(params.fParams.contentSizeFlag == 1); - return ZSTD_compress_advanced_internal(cctx, dst, dstCapacity, src, srcSize, dict, dictSize, &cctxParams); -} - -size_t ZSTD_compressCCtx(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - int compressionLevel) -{ - DEBUGLOG(4, "ZSTD_compressCCtx (srcSize=%u)", (unsigned)srcSize); - assert(cctx != NULL); - return ZSTD_compress_usingDict(cctx, dst, dstCapacity, src, srcSize, NULL, 0, compressionLevel); -} - -size_t ZSTD_compress(void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - int compressionLevel) -{ - size_t result; - ZSTD_CCtx ctxBody; - ZSTD_initCCtx(&ctxBody, ZSTD_defaultCMem); - result = ZSTD_compressCCtx(&ctxBody, dst, dstCapacity, src, srcSize, compressionLevel); - ZSTD_freeCCtxContent(&ctxBody); /* can't free ctxBody itself, as it's on stack; free only heap content */ - return result; -} - - -/* ===== Dictionary API ===== */ - -/*! ZSTD_estimateCDictSize_advanced() : - * Estimate amount of memory that will be needed to create a dictionary with following arguments */ -size_t ZSTD_estimateCDictSize_advanced( - size_t dictSize, ZSTD_compressionParameters cParams, - ZSTD_dictLoadMethod_e dictLoadMethod) -{ - DEBUGLOG(5, "sizeof(ZSTD_CDict) : %u", (unsigned)sizeof(ZSTD_CDict)); - return ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict)) - + ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE) - + ZSTD_sizeof_matchState(&cParams, /* forCCtx */ 0) - + (dictLoadMethod == ZSTD_dlm_byRef ? 0 - : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void *)))); -} - -size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel) -{ - ZSTD_compressionParameters const cParams = ZSTD_getCParams(compressionLevel, 0, dictSize); - return ZSTD_estimateCDictSize_advanced(dictSize, cParams, ZSTD_dlm_byCopy); -} - -size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict) -{ - if (cdict==NULL) return 0; /* support sizeof on NULL */ - DEBUGLOG(5, "sizeof(*cdict) : %u", (unsigned)sizeof(*cdict)); - /* cdict may be in the workspace */ - return (cdict->workspace.workspace == cdict ? 0 : sizeof(*cdict)) - + ZSTD_cwksp_sizeof(&cdict->workspace); -} - -static size_t ZSTD_initCDict_internal( - ZSTD_CDict* cdict, - const void* dictBuffer, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType, - ZSTD_compressionParameters cParams) -{ - DEBUGLOG(3, "ZSTD_initCDict_internal (dictContentType:%u)", (unsigned)dictContentType); - assert(!ZSTD_checkCParams(cParams)); - cdict->matchState.cParams = cParams; - if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dictBuffer) || (!dictSize)) { - cdict->dictContent = dictBuffer; - } else { - void *internalBuffer = ZSTD_cwksp_reserve_object(&cdict->workspace, ZSTD_cwksp_align(dictSize, sizeof(void*))); - RETURN_ERROR_IF(!internalBuffer, memory_allocation); - cdict->dictContent = internalBuffer; - memcpy(internalBuffer, dictBuffer, dictSize); - } - cdict->dictContentSize = dictSize; - - cdict->entropyWorkspace = (U32*)ZSTD_cwksp_reserve_object(&cdict->workspace, HUF_WORKSPACE_SIZE); - - - /* Reset the state to no dictionary */ - ZSTD_reset_compressedBlockState(&cdict->cBlockState); - FORWARD_IF_ERROR(ZSTD_reset_matchState( - &cdict->matchState, - &cdict->workspace, - &cParams, - ZSTDcrp_makeClean, - ZSTDirp_reset, - ZSTD_resetTarget_CDict)); - /* (Maybe) load the dictionary - * Skips loading the dictionary if it is < 8 bytes. - */ - { ZSTD_CCtx_params params; - memset(¶ms, 0, sizeof(params)); - params.compressionLevel = ZSTD_CLEVEL_DEFAULT; - params.fParams.contentSizeFlag = 1; - params.cParams = cParams; - { size_t const dictID = ZSTD_compress_insertDictionary( - &cdict->cBlockState, &cdict->matchState, &cdict->workspace, - ¶ms, cdict->dictContent, cdict->dictContentSize, - dictContentType, ZSTD_dtlm_full, cdict->entropyWorkspace); - FORWARD_IF_ERROR(dictID); - assert(dictID <= (size_t)(U32)-1); - cdict->dictID = (U32)dictID; - } - } - - return 0; -} - -ZSTD_CDict* ZSTD_createCDict_advanced(const void* dictBuffer, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType, - ZSTD_compressionParameters cParams, ZSTD_customMem customMem) -{ - DEBUGLOG(3, "ZSTD_createCDict_advanced, mode %u", (unsigned)dictContentType); - if (!customMem.customAlloc ^ !customMem.customFree) return NULL; - - { size_t const workspaceSize = - ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict)) + - ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE) + - ZSTD_sizeof_matchState(&cParams, /* forCCtx */ 0) + - (dictLoadMethod == ZSTD_dlm_byRef ? 0 - : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void*)))); - void* const workspace = ZSTD_malloc(workspaceSize, customMem); - ZSTD_cwksp ws; - ZSTD_CDict* cdict; - - if (!workspace) { - ZSTD_free(workspace, customMem); - return NULL; - } - - ZSTD_cwksp_init(&ws, workspace, workspaceSize); - - cdict = (ZSTD_CDict*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CDict)); - assert(cdict != NULL); - ZSTD_cwksp_move(&cdict->workspace, &ws); - cdict->customMem = customMem; - cdict->compressionLevel = 0; /* signals advanced API usage */ - - if (ZSTD_isError( ZSTD_initCDict_internal(cdict, - dictBuffer, dictSize, - dictLoadMethod, dictContentType, - cParams) )) { - ZSTD_freeCDict(cdict); - return NULL; - } - - return cdict; - } -} - -ZSTD_CDict* ZSTD_createCDict(const void* dict, size_t dictSize, int compressionLevel) -{ - ZSTD_compressionParameters cParams = ZSTD_getCParams(compressionLevel, 0, dictSize); - ZSTD_CDict* cdict = ZSTD_createCDict_advanced(dict, dictSize, - ZSTD_dlm_byCopy, ZSTD_dct_auto, - cParams, ZSTD_defaultCMem); - if (cdict) - cdict->compressionLevel = compressionLevel == 0 ? ZSTD_CLEVEL_DEFAULT : compressionLevel; - return cdict; -} - -ZSTD_CDict* ZSTD_createCDict_byReference(const void* dict, size_t dictSize, int compressionLevel) -{ - ZSTD_compressionParameters cParams = ZSTD_getCParams(compressionLevel, 0, dictSize); - return ZSTD_createCDict_advanced(dict, dictSize, - ZSTD_dlm_byRef, ZSTD_dct_auto, - cParams, ZSTD_defaultCMem); -} - -size_t ZSTD_freeCDict(ZSTD_CDict* cdict) -{ - if (cdict==NULL) return 0; /* support free on NULL */ - { ZSTD_customMem const cMem = cdict->customMem; - int cdictInWorkspace = ZSTD_cwksp_owns_buffer(&cdict->workspace, cdict); - ZSTD_cwksp_free(&cdict->workspace, cMem); - if (!cdictInWorkspace) { - ZSTD_free(cdict, cMem); - } - return 0; - } -} - -/*! ZSTD_initStaticCDict_advanced() : - * Generate a digested dictionary in provided memory area. - * workspace: The memory area to emplace the dictionary into. - * Provided pointer must 8-bytes aligned. - * It must outlive dictionary usage. - * workspaceSize: Use ZSTD_estimateCDictSize() - * to determine how large workspace must be. - * cParams : use ZSTD_getCParams() to transform a compression level - * into its relevants cParams. - * @return : pointer to ZSTD_CDict*, or NULL if error (size too small) - * Note : there is no corresponding "free" function. - * Since workspace was allocated externally, it must be freed externally. - */ -const ZSTD_CDict* ZSTD_initStaticCDict( - void* workspace, size_t workspaceSize, - const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType, - ZSTD_compressionParameters cParams) -{ - size_t const matchStateSize = ZSTD_sizeof_matchState(&cParams, /* forCCtx */ 0); - size_t const neededSize = ZSTD_cwksp_alloc_size(sizeof(ZSTD_CDict)) - + (dictLoadMethod == ZSTD_dlm_byRef ? 0 - : ZSTD_cwksp_alloc_size(ZSTD_cwksp_align(dictSize, sizeof(void*)))) - + ZSTD_cwksp_alloc_size(HUF_WORKSPACE_SIZE) - + matchStateSize; - ZSTD_CDict* cdict; - - if ((size_t)workspace & 7) return NULL; /* 8-aligned */ - - { - ZSTD_cwksp ws; - ZSTD_cwksp_init(&ws, workspace, workspaceSize); - cdict = (ZSTD_CDict*)ZSTD_cwksp_reserve_object(&ws, sizeof(ZSTD_CDict)); - if (cdict == NULL) return NULL; - ZSTD_cwksp_move(&cdict->workspace, &ws); - } - - DEBUGLOG(4, "(workspaceSize < neededSize) : (%u < %u) => %u", - (unsigned)workspaceSize, (unsigned)neededSize, (unsigned)(workspaceSize < neededSize)); - if (workspaceSize < neededSize) return NULL; - - if (ZSTD_isError( ZSTD_initCDict_internal(cdict, - dict, dictSize, - dictLoadMethod, dictContentType, - cParams) )) - return NULL; - - return cdict; -} - -ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict) -{ - assert(cdict != NULL); - return cdict->matchState.cParams; -} - -/* ZSTD_compressBegin_usingCDict_advanced() : - * cdict must be != NULL */ -size_t ZSTD_compressBegin_usingCDict_advanced( - ZSTD_CCtx* const cctx, const ZSTD_CDict* const cdict, - ZSTD_frameParameters const fParams, unsigned long long const pledgedSrcSize) -{ - DEBUGLOG(4, "ZSTD_compressBegin_usingCDict_advanced"); - RETURN_ERROR_IF(cdict==NULL, dictionary_wrong); - { ZSTD_CCtx_params params = cctx->requestedParams; - params.cParams = ( pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_SRCSIZE_CUTOFF - || pledgedSrcSize < cdict->dictContentSize * ZSTD_USE_CDICT_PARAMS_DICTSIZE_MULTIPLIER - || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN - || cdict->compressionLevel == 0 ) - && (params.attachDictPref != ZSTD_dictForceLoad) ? - ZSTD_getCParamsFromCDict(cdict) - : ZSTD_getCParams(cdict->compressionLevel, - pledgedSrcSize, - cdict->dictContentSize); - /* Increase window log to fit the entire dictionary and source if the - * source size is known. Limit the increase to 19, which is the - * window log for compression level 1 with the largest source size. - */ - if (pledgedSrcSize != ZSTD_CONTENTSIZE_UNKNOWN) { - U32 const limitedSrcSize = (U32)MIN(pledgedSrcSize, 1U << 19); - U32 const limitedSrcLog = limitedSrcSize > 1 ? ZSTD_highbit32(limitedSrcSize - 1) + 1 : 1; - params.cParams.windowLog = MAX(params.cParams.windowLog, limitedSrcLog); - } - params.fParams = fParams; - return ZSTD_compressBegin_internal(cctx, - NULL, 0, ZSTD_dct_auto, ZSTD_dtlm_fast, - cdict, - ¶ms, pledgedSrcSize, - ZSTDb_not_buffered); - } -} - -/* ZSTD_compressBegin_usingCDict() : - * pledgedSrcSize=0 means "unknown" - * if pledgedSrcSize>0, it will enable contentSizeFlag */ -size_t ZSTD_compressBegin_usingCDict(ZSTD_CCtx* cctx, const ZSTD_CDict* cdict) -{ - ZSTD_frameParameters const fParams = { 0 /*content*/, 0 /*checksum*/, 0 /*noDictID*/ }; - DEBUGLOG(4, "ZSTD_compressBegin_usingCDict : dictIDFlag == %u", !fParams.noDictIDFlag); - return ZSTD_compressBegin_usingCDict_advanced(cctx, cdict, fParams, ZSTD_CONTENTSIZE_UNKNOWN); -} - -size_t ZSTD_compress_usingCDict_advanced(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const ZSTD_CDict* cdict, ZSTD_frameParameters fParams) -{ - FORWARD_IF_ERROR(ZSTD_compressBegin_usingCDict_advanced(cctx, cdict, fParams, srcSize)); /* will check if cdict != NULL */ - return ZSTD_compressEnd(cctx, dst, dstCapacity, src, srcSize); -} - -/*! ZSTD_compress_usingCDict() : - * Compression using a digested Dictionary. - * Faster startup than ZSTD_compress_usingDict(), recommended when same dictionary is used multiple times. - * Note that compression parameters are decided at CDict creation time - * while frame parameters are hardcoded */ -size_t ZSTD_compress_usingCDict(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const ZSTD_CDict* cdict) -{ - ZSTD_frameParameters const fParams = { 1 /*content*/, 0 /*checksum*/, 0 /*noDictID*/ }; - return ZSTD_compress_usingCDict_advanced(cctx, dst, dstCapacity, src, srcSize, cdict, fParams); -} - - - -/* ****************************************************************** -* Streaming -********************************************************************/ - -ZSTD_CStream* ZSTD_createCStream(void) -{ - DEBUGLOG(3, "ZSTD_createCStream"); - return ZSTD_createCStream_advanced(ZSTD_defaultCMem); -} - -ZSTD_CStream* ZSTD_initStaticCStream(void *workspace, size_t workspaceSize) -{ - return ZSTD_initStaticCCtx(workspace, workspaceSize); -} - -ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem) -{ /* CStream and CCtx are now same object */ - return ZSTD_createCCtx_advanced(customMem); -} - -size_t ZSTD_freeCStream(ZSTD_CStream* zcs) -{ - return ZSTD_freeCCtx(zcs); /* same object */ -} - - - -/*====== Initialization ======*/ - -size_t ZSTD_CStreamInSize(void) { return ZSTD_BLOCKSIZE_MAX; } - -size_t ZSTD_CStreamOutSize(void) -{ - return ZSTD_compressBound(ZSTD_BLOCKSIZE_MAX) + ZSTD_blockHeaderSize + 4 /* 32-bits hash */ ; -} - -static size_t ZSTD_resetCStream_internal(ZSTD_CStream* cctx, - const void* const dict, size_t const dictSize, ZSTD_dictContentType_e const dictContentType, - const ZSTD_CDict* const cdict, - ZSTD_CCtx_params params, unsigned long long const pledgedSrcSize) -{ - DEBUGLOG(4, "ZSTD_resetCStream_internal"); - /* Finalize the compression parameters */ - params.cParams = ZSTD_getCParamsFromCCtxParams(¶ms, pledgedSrcSize, dictSize); - /* params are supposed to be fully validated at this point */ - assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams))); - assert(!((dict) && (cdict))); /* either dict or cdict, not both */ - - FORWARD_IF_ERROR( ZSTD_compressBegin_internal(cctx, - dict, dictSize, dictContentType, ZSTD_dtlm_fast, - cdict, - ¶ms, pledgedSrcSize, - ZSTDb_buffered) ); - - cctx->inToCompress = 0; - cctx->inBuffPos = 0; - cctx->inBuffTarget = cctx->blockSize - + (cctx->blockSize == pledgedSrcSize); /* for small input: avoid automatic flush on reaching end of block, since it would require to add a 3-bytes null block to end frame */ - cctx->outBuffContentSize = cctx->outBuffFlushedSize = 0; - cctx->streamStage = zcss_load; - cctx->frameEnded = 0; - return 0; /* ready to go */ -} - -/* ZSTD_resetCStream(): - * pledgedSrcSize == 0 means "unknown" */ -size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pss) -{ - /* temporary : 0 interpreted as "unknown" during transition period. - * Users willing to specify "unknown" **must** use ZSTD_CONTENTSIZE_UNKNOWN. - * 0 will be interpreted as "empty" in the future. - */ - U64 const pledgedSrcSize = (pss==0) ? ZSTD_CONTENTSIZE_UNKNOWN : pss; - DEBUGLOG(4, "ZSTD_resetCStream: pledgedSrcSize = %u", (unsigned)pledgedSrcSize); - FORWARD_IF_ERROR( ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize) ); - return 0; -} - -/*! ZSTD_initCStream_internal() : - * Note : for lib/compress only. Used by zstdmt_compress.c. - * Assumption 1 : params are valid - * Assumption 2 : either dict, or cdict, is defined, not both */ -size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs, - const void* dict, size_t dictSize, const ZSTD_CDict* cdict, - const ZSTD_CCtx_params* params, - unsigned long long pledgedSrcSize) -{ - DEBUGLOG(4, "ZSTD_initCStream_internal"); - FORWARD_IF_ERROR( ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize) ); - assert(!ZSTD_isError(ZSTD_checkCParams(params->cParams))); - zcs->requestedParams = *params; - assert(!((dict) && (cdict))); /* either dict or cdict, not both */ - if (dict) { - FORWARD_IF_ERROR( ZSTD_CCtx_loadDictionary(zcs, dict, dictSize) ); - } else { - /* Dictionary is cleared if !cdict */ - FORWARD_IF_ERROR( ZSTD_CCtx_refCDict(zcs, cdict) ); - } - return 0; -} - -/* ZSTD_initCStream_usingCDict_advanced() : - * same as ZSTD_initCStream_usingCDict(), with control over frame parameters */ -size_t ZSTD_initCStream_usingCDict_advanced(ZSTD_CStream* zcs, - const ZSTD_CDict* cdict, - ZSTD_frameParameters fParams, - unsigned long long pledgedSrcSize) -{ - DEBUGLOG(4, "ZSTD_initCStream_usingCDict_advanced"); - FORWARD_IF_ERROR( ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize) ); - zcs->requestedParams.fParams = fParams; - FORWARD_IF_ERROR( ZSTD_CCtx_refCDict(zcs, cdict) ); - return 0; -} - -/* note : cdict must outlive compression session */ -size_t ZSTD_initCStream_usingCDict(ZSTD_CStream* zcs, const ZSTD_CDict* cdict) -{ - DEBUGLOG(4, "ZSTD_initCStream_usingCDict"); - FORWARD_IF_ERROR( ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_CCtx_refCDict(zcs, cdict) ); - return 0; -} - - -/* ZSTD_initCStream_advanced() : - * pledgedSrcSize must be exact. - * if srcSize is not known at init time, use value ZSTD_CONTENTSIZE_UNKNOWN. - * dict is loaded with default parameters ZSTD_dct_auto and ZSTD_dlm_byCopy. */ -size_t ZSTD_initCStream_advanced(ZSTD_CStream* zcs, - const void* dict, size_t dictSize, - ZSTD_parameters params, unsigned long long pss) -{ - /* for compatibility with older programs relying on this behavior. - * Users should now specify ZSTD_CONTENTSIZE_UNKNOWN. - * This line will be removed in the future. - */ - U64 const pledgedSrcSize = (pss==0 && params.fParams.contentSizeFlag==0) ? ZSTD_CONTENTSIZE_UNKNOWN : pss; - DEBUGLOG(4, "ZSTD_initCStream_advanced"); - FORWARD_IF_ERROR( ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize) ); - FORWARD_IF_ERROR( ZSTD_checkCParams(params.cParams) ); - zcs->requestedParams = ZSTD_assignParamsToCCtxParams(&zcs->requestedParams, params); - FORWARD_IF_ERROR( ZSTD_CCtx_loadDictionary(zcs, dict, dictSize) ); - return 0; -} - -size_t ZSTD_initCStream_usingDict(ZSTD_CStream* zcs, const void* dict, size_t dictSize, int compressionLevel) -{ - DEBUGLOG(4, "ZSTD_initCStream_usingDict"); - FORWARD_IF_ERROR( ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel) ); - FORWARD_IF_ERROR( ZSTD_CCtx_loadDictionary(zcs, dict, dictSize) ); - return 0; -} - -size_t ZSTD_initCStream_srcSize(ZSTD_CStream* zcs, int compressionLevel, unsigned long long pss) -{ - /* temporary : 0 interpreted as "unknown" during transition period. - * Users willing to specify "unknown" **must** use ZSTD_CONTENTSIZE_UNKNOWN. - * 0 will be interpreted as "empty" in the future. - */ - U64 const pledgedSrcSize = (pss==0) ? ZSTD_CONTENTSIZE_UNKNOWN : pss; - DEBUGLOG(4, "ZSTD_initCStream_srcSize"); - FORWARD_IF_ERROR( ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_CCtx_refCDict(zcs, NULL) ); - FORWARD_IF_ERROR( ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel) ); - FORWARD_IF_ERROR( ZSTD_CCtx_setPledgedSrcSize(zcs, pledgedSrcSize) ); - return 0; -} - -size_t ZSTD_initCStream(ZSTD_CStream* zcs, int compressionLevel) -{ - DEBUGLOG(4, "ZSTD_initCStream"); - FORWARD_IF_ERROR( ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_CCtx_refCDict(zcs, NULL) ); - FORWARD_IF_ERROR( ZSTD_CCtx_setParameter(zcs, ZSTD_c_compressionLevel, compressionLevel) ); - return 0; -} - -/*====== Compression ======*/ - -static size_t ZSTD_nextInputSizeHint(const ZSTD_CCtx* cctx) -{ - size_t hintInSize = cctx->inBuffTarget - cctx->inBuffPos; - if (hintInSize==0) hintInSize = cctx->blockSize; - return hintInSize; -} - -static size_t ZSTD_limitCopy(void* dst, size_t dstCapacity, - const void* src, size_t srcSize) -{ - size_t const length = MIN(dstCapacity, srcSize); - if (length) memcpy(dst, src, length); - return length; -} - -/** ZSTD_compressStream_generic(): - * internal function for all *compressStream*() variants - * non-static, because can be called from zstdmt_compress.c - * @return : hint size for next input */ -static size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs, - ZSTD_outBuffer* output, - ZSTD_inBuffer* input, - ZSTD_EndDirective const flushMode) -{ - const char* const istart = (const char*)input->src; - const char* const iend = istart + input->size; - const char* ip = istart + input->pos; - char* const ostart = (char*)output->dst; - char* const oend = ostart + output->size; - char* op = ostart + output->pos; - U32 someMoreWork = 1; - - /* check expectations */ - DEBUGLOG(5, "ZSTD_compressStream_generic, flush=%u", (unsigned)flushMode); - assert(zcs->inBuff != NULL); - assert(zcs->inBuffSize > 0); - assert(zcs->outBuff != NULL); - assert(zcs->outBuffSize > 0); - assert(output->pos <= output->size); - assert(input->pos <= input->size); - - while (someMoreWork) { - switch(zcs->streamStage) - { - case zcss_init: - RETURN_ERROR(init_missing, "call ZSTD_initCStream() first!"); - - case zcss_load: - if ( (flushMode == ZSTD_e_end) - && ((size_t)(oend-op) >= ZSTD_compressBound(iend-ip)) /* enough dstCapacity */ - && (zcs->inBuffPos == 0) ) { - /* shortcut to compression pass directly into output buffer */ - size_t const cSize = ZSTD_compressEnd(zcs, - op, oend-op, ip, iend-ip); - DEBUGLOG(4, "ZSTD_compressEnd : cSize=%u", (unsigned)cSize); - FORWARD_IF_ERROR(cSize); - ip = iend; - op += cSize; - zcs->frameEnded = 1; - ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - someMoreWork = 0; break; - } - /* complete loading into inBuffer */ - { size_t const toLoad = zcs->inBuffTarget - zcs->inBuffPos; - size_t const loaded = ZSTD_limitCopy( - zcs->inBuff + zcs->inBuffPos, toLoad, - ip, iend-ip); - zcs->inBuffPos += loaded; - ip += loaded; - if ( (flushMode == ZSTD_e_continue) - && (zcs->inBuffPos < zcs->inBuffTarget) ) { - /* not enough input to fill full block : stop here */ - someMoreWork = 0; break; - } - if ( (flushMode == ZSTD_e_flush) - && (zcs->inBuffPos == zcs->inToCompress) ) { - /* empty */ - someMoreWork = 0; break; - } - } - /* compress current block (note : this stage cannot be stopped in the middle) */ - DEBUGLOG(5, "stream compression stage (flushMode==%u)", flushMode); - { void* cDst; - size_t cSize; - size_t const iSize = zcs->inBuffPos - zcs->inToCompress; - size_t oSize = oend-op; - unsigned const lastBlock = (flushMode == ZSTD_e_end) && (ip==iend); - if (oSize >= ZSTD_compressBound(iSize)) - cDst = op; /* compress into output buffer, to skip flush stage */ - else - cDst = zcs->outBuff, oSize = zcs->outBuffSize; - cSize = lastBlock ? - ZSTD_compressEnd(zcs, cDst, oSize, - zcs->inBuff + zcs->inToCompress, iSize) : - ZSTD_compressContinue(zcs, cDst, oSize, - zcs->inBuff + zcs->inToCompress, iSize); - FORWARD_IF_ERROR(cSize); - zcs->frameEnded = lastBlock; - /* prepare next block */ - zcs->inBuffTarget = zcs->inBuffPos + zcs->blockSize; - if (zcs->inBuffTarget > zcs->inBuffSize) - zcs->inBuffPos = 0, zcs->inBuffTarget = zcs->blockSize; - DEBUGLOG(5, "inBuffTarget:%u / inBuffSize:%u", - (unsigned)zcs->inBuffTarget, (unsigned)zcs->inBuffSize); - if (!lastBlock) - assert(zcs->inBuffTarget <= zcs->inBuffSize); - zcs->inToCompress = zcs->inBuffPos; - if (cDst == op) { /* no need to flush */ - op += cSize; - if (zcs->frameEnded) { - DEBUGLOG(5, "Frame completed directly in outBuffer"); - someMoreWork = 0; - ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - } - break; - } - zcs->outBuffContentSize = cSize; - zcs->outBuffFlushedSize = 0; - zcs->streamStage = zcss_flush; /* pass-through to flush stage */ - } - /* fall-through */ - case zcss_flush: - DEBUGLOG(5, "flush stage"); - { size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize; - size_t const flushed = ZSTD_limitCopy(op, (size_t)(oend-op), - zcs->outBuff + zcs->outBuffFlushedSize, toFlush); - DEBUGLOG(5, "toFlush: %u into %u ==> flushed: %u", - (unsigned)toFlush, (unsigned)(oend-op), (unsigned)flushed); - op += flushed; - zcs->outBuffFlushedSize += flushed; - if (toFlush!=flushed) { - /* flush not fully completed, presumably because dst is too small */ - assert(op==oend); - someMoreWork = 0; - break; - } - zcs->outBuffContentSize = zcs->outBuffFlushedSize = 0; - if (zcs->frameEnded) { - DEBUGLOG(5, "Frame completed on flush"); - someMoreWork = 0; - ZSTD_CCtx_reset(zcs, ZSTD_reset_session_only); - break; - } - zcs->streamStage = zcss_load; - break; - } - - default: /* impossible */ - assert(0); - } - } - - input->pos = ip - istart; - output->pos = op - ostart; - if (zcs->frameEnded) return 0; - return ZSTD_nextInputSizeHint(zcs); -} - -static size_t ZSTD_nextInputSizeHint_MTorST(const ZSTD_CCtx* cctx) -{ -#ifdef ZSTD_MULTITHREAD - if (cctx->appliedParams.nbWorkers >= 1) { - assert(cctx->mtctx != NULL); - return ZSTDMT_nextInputSizeHint(cctx->mtctx); - } -#endif - return ZSTD_nextInputSizeHint(cctx); - -} - -size_t ZSTD_compressStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output, ZSTD_inBuffer* input) -{ - FORWARD_IF_ERROR( ZSTD_compressStream2(zcs, output, input, ZSTD_e_continue) ); - return ZSTD_nextInputSizeHint_MTorST(zcs); -} - - -size_t ZSTD_compressStream2( ZSTD_CCtx* cctx, - ZSTD_outBuffer* output, - ZSTD_inBuffer* input, - ZSTD_EndDirective endOp) -{ - DEBUGLOG(5, "ZSTD_compressStream2, endOp=%u ", (unsigned)endOp); - /* check conditions */ - RETURN_ERROR_IF(output->pos > output->size, GENERIC); - RETURN_ERROR_IF(input->pos > input->size, GENERIC); - assert(cctx!=NULL); - - /* transparent initialization stage */ - if (cctx->streamStage == zcss_init) { - ZSTD_CCtx_params params = cctx->requestedParams; - ZSTD_prefixDict const prefixDict = cctx->prefixDict; - FORWARD_IF_ERROR( ZSTD_initLocalDict(cctx) ); /* Init the local dict if present. */ - memset(&cctx->prefixDict, 0, sizeof(cctx->prefixDict)); /* single usage */ - assert(prefixDict.dict==NULL || cctx->cdict==NULL); /* only one can be set */ - DEBUGLOG(4, "ZSTD_compressStream2 : transparent init stage"); - if (endOp == ZSTD_e_end) cctx->pledgedSrcSizePlusOne = input->size + 1; /* auto-fix pledgedSrcSize */ - params.cParams = ZSTD_getCParamsFromCCtxParams( - &cctx->requestedParams, cctx->pledgedSrcSizePlusOne-1, 0 /*dictSize*/); - - -#ifdef ZSTD_MULTITHREAD - if ((cctx->pledgedSrcSizePlusOne-1) <= ZSTDMT_JOBSIZE_MIN) { - params.nbWorkers = 0; /* do not invoke multi-threading when src size is too small */ - } - if (params.nbWorkers > 0) { - /* mt context creation */ - if (cctx->mtctx == NULL) { - DEBUGLOG(4, "ZSTD_compressStream2: creating new mtctx for nbWorkers=%u", - params.nbWorkers); - cctx->mtctx = ZSTDMT_createCCtx_advanced((U32)params.nbWorkers, cctx->customMem); - RETURN_ERROR_IF(cctx->mtctx == NULL, memory_allocation); - } - /* mt compression */ - DEBUGLOG(4, "call ZSTDMT_initCStream_internal as nbWorkers=%u", params.nbWorkers); - FORWARD_IF_ERROR( ZSTDMT_initCStream_internal( - cctx->mtctx, - prefixDict.dict, prefixDict.dictSize, ZSTD_dct_rawContent, - cctx->cdict, params, cctx->pledgedSrcSizePlusOne-1) ); - cctx->streamStage = zcss_load; - cctx->appliedParams.nbWorkers = params.nbWorkers; - } else -#endif - { FORWARD_IF_ERROR( ZSTD_resetCStream_internal(cctx, - prefixDict.dict, prefixDict.dictSize, prefixDict.dictContentType, - cctx->cdict, - params, cctx->pledgedSrcSizePlusOne-1) ); - assert(cctx->streamStage == zcss_load); - assert(cctx->appliedParams.nbWorkers == 0); - } } - /* end of transparent initialization stage */ - - /* compression stage */ -#ifdef ZSTD_MULTITHREAD - if (cctx->appliedParams.nbWorkers > 0) { - int const forceMaxProgress = (endOp == ZSTD_e_flush || endOp == ZSTD_e_end); - size_t flushMin; - assert(forceMaxProgress || endOp == ZSTD_e_continue /* Protection for a new flush type */); - if (cctx->cParamsChanged) { - ZSTDMT_updateCParams_whileCompressing(cctx->mtctx, &cctx->requestedParams); - cctx->cParamsChanged = 0; - } - do { - flushMin = ZSTDMT_compressStream_generic(cctx->mtctx, output, input, endOp); - if ( ZSTD_isError(flushMin) - || (endOp == ZSTD_e_end && flushMin == 0) ) { /* compression completed */ - ZSTD_CCtx_reset(cctx, ZSTD_reset_session_only); - } - FORWARD_IF_ERROR(flushMin); - } while (forceMaxProgress && flushMin != 0 && output->pos < output->size); - DEBUGLOG(5, "completed ZSTD_compressStream2 delegating to ZSTDMT_compressStream_generic"); - /* Either we don't require maximum forward progress, we've finished the - * flush, or we are out of output space. - */ - assert(!forceMaxProgress || flushMin == 0 || output->pos == output->size); - return flushMin; - } -#endif - FORWARD_IF_ERROR( ZSTD_compressStream_generic(cctx, output, input, endOp) ); - DEBUGLOG(5, "completed ZSTD_compressStream2"); - return cctx->outBuffContentSize - cctx->outBuffFlushedSize; /* remaining to flush */ -} - -size_t ZSTD_compressStream2_simpleArgs ( - ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, size_t* dstPos, - const void* src, size_t srcSize, size_t* srcPos, - ZSTD_EndDirective endOp) -{ - ZSTD_outBuffer output = { dst, dstCapacity, *dstPos }; - ZSTD_inBuffer input = { src, srcSize, *srcPos }; - /* ZSTD_compressStream2() will check validity of dstPos and srcPos */ - size_t const cErr = ZSTD_compressStream2(cctx, &output, &input, endOp); - *dstPos = output.pos; - *srcPos = input.pos; - return cErr; -} - -size_t ZSTD_compress2(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize) -{ - ZSTD_CCtx_reset(cctx, ZSTD_reset_session_only); - { size_t oPos = 0; - size_t iPos = 0; - size_t const result = ZSTD_compressStream2_simpleArgs(cctx, - dst, dstCapacity, &oPos, - src, srcSize, &iPos, - ZSTD_e_end); - FORWARD_IF_ERROR(result); - if (result != 0) { /* compression not completed, due to lack of output space */ - assert(oPos == dstCapacity); - RETURN_ERROR(dstSize_tooSmall); - } - assert(iPos == srcSize); /* all input is expected consumed */ - return oPos; - } -} - -/*====== Finalize ======*/ - -/*! ZSTD_flushStream() : - * @return : amount of data remaining to flush */ -size_t ZSTD_flushStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output) -{ - ZSTD_inBuffer input = { NULL, 0, 0 }; - return ZSTD_compressStream2(zcs, output, &input, ZSTD_e_flush); -} - - -size_t ZSTD_endStream(ZSTD_CStream* zcs, ZSTD_outBuffer* output) -{ - ZSTD_inBuffer input = { NULL, 0, 0 }; - size_t const remainingToFlush = ZSTD_compressStream2(zcs, output, &input, ZSTD_e_end); - FORWARD_IF_ERROR( remainingToFlush ); - if (zcs->appliedParams.nbWorkers > 0) return remainingToFlush; /* minimal estimation */ - /* single thread mode : attempt to calculate remaining to flush more precisely */ - { size_t const lastBlockSize = zcs->frameEnded ? 0 : ZSTD_BLOCKHEADERSIZE; - size_t const checksumSize = (size_t)(zcs->frameEnded ? 0 : zcs->appliedParams.fParams.checksumFlag * 4); - size_t const toFlush = remainingToFlush + lastBlockSize + checksumSize; - DEBUGLOG(4, "ZSTD_endStream : remaining to flush : %u", (unsigned)toFlush); - return toFlush; - } -} - - -/*-===== Pre-defined compression levels =====-*/ - -#define ZSTD_MAX_CLEVEL 22 -int ZSTD_maxCLevel(void) { return ZSTD_MAX_CLEVEL; } -int ZSTD_minCLevel(void) { return (int)-ZSTD_TARGETLENGTH_MAX; } - -static const ZSTD_compressionParameters ZSTD_defaultCParameters[4][ZSTD_MAX_CLEVEL+1] = { -{ /* "default" - for any srcSize > 256 KB */ - /* W, C, H, S, L, TL, strat */ - { 19, 12, 13, 1, 6, 1, ZSTD_fast }, /* base for negative levels */ - { 19, 13, 14, 1, 7, 0, ZSTD_fast }, /* level 1 */ - { 20, 15, 16, 1, 6, 0, ZSTD_fast }, /* level 2 */ - { 21, 16, 17, 1, 5, 0, ZSTD_dfast }, /* level 3 */ - { 21, 18, 18, 1, 5, 0, ZSTD_dfast }, /* level 4 */ - { 21, 18, 19, 2, 5, 2, ZSTD_greedy }, /* level 5 */ - { 21, 19, 19, 3, 5, 4, ZSTD_greedy }, /* level 6 */ - { 21, 19, 19, 3, 5, 8, ZSTD_lazy }, /* level 7 */ - { 21, 19, 19, 3, 5, 16, ZSTD_lazy2 }, /* level 8 */ - { 21, 19, 20, 4, 5, 16, ZSTD_lazy2 }, /* level 9 */ - { 22, 20, 21, 4, 5, 16, ZSTD_lazy2 }, /* level 10 */ - { 22, 21, 22, 4, 5, 16, ZSTD_lazy2 }, /* level 11 */ - { 22, 21, 22, 5, 5, 16, ZSTD_lazy2 }, /* level 12 */ - { 22, 21, 22, 5, 5, 32, ZSTD_btlazy2 }, /* level 13 */ - { 22, 22, 23, 5, 5, 32, ZSTD_btlazy2 }, /* level 14 */ - { 22, 23, 23, 6, 5, 32, ZSTD_btlazy2 }, /* level 15 */ - { 22, 22, 22, 5, 5, 48, ZSTD_btopt }, /* level 16 */ - { 23, 23, 22, 5, 4, 64, ZSTD_btopt }, /* level 17 */ - { 23, 23, 22, 6, 3, 64, ZSTD_btultra }, /* level 18 */ - { 23, 24, 22, 7, 3,256, ZSTD_btultra2}, /* level 19 */ - { 25, 25, 23, 7, 3,256, ZSTD_btultra2}, /* level 20 */ - { 26, 26, 24, 7, 3,512, ZSTD_btultra2}, /* level 21 */ - { 27, 27, 25, 9, 3,999, ZSTD_btultra2}, /* level 22 */ -}, -{ /* for srcSize <= 256 KB */ - /* W, C, H, S, L, T, strat */ - { 18, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */ - { 18, 13, 14, 1, 6, 0, ZSTD_fast }, /* level 1 */ - { 18, 14, 14, 1, 5, 0, ZSTD_dfast }, /* level 2 */ - { 18, 16, 16, 1, 4, 0, ZSTD_dfast }, /* level 3 */ - { 18, 16, 17, 2, 5, 2, ZSTD_greedy }, /* level 4.*/ - { 18, 18, 18, 3, 5, 2, ZSTD_greedy }, /* level 5.*/ - { 18, 18, 19, 3, 5, 4, ZSTD_lazy }, /* level 6.*/ - { 18, 18, 19, 4, 4, 4, ZSTD_lazy }, /* level 7 */ - { 18, 18, 19, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */ - { 18, 18, 19, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */ - { 18, 18, 19, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */ - { 18, 18, 19, 5, 4, 12, ZSTD_btlazy2 }, /* level 11.*/ - { 18, 19, 19, 7, 4, 12, ZSTD_btlazy2 }, /* level 12.*/ - { 18, 18, 19, 4, 4, 16, ZSTD_btopt }, /* level 13 */ - { 18, 18, 19, 4, 3, 32, ZSTD_btopt }, /* level 14.*/ - { 18, 18, 19, 6, 3,128, ZSTD_btopt }, /* level 15.*/ - { 18, 19, 19, 6, 3,128, ZSTD_btultra }, /* level 16.*/ - { 18, 19, 19, 8, 3,256, ZSTD_btultra }, /* level 17.*/ - { 18, 19, 19, 6, 3,128, ZSTD_btultra2}, /* level 18.*/ - { 18, 19, 19, 8, 3,256, ZSTD_btultra2}, /* level 19.*/ - { 18, 19, 19, 10, 3,512, ZSTD_btultra2}, /* level 20.*/ - { 18, 19, 19, 12, 3,512, ZSTD_btultra2}, /* level 21.*/ - { 18, 19, 19, 13, 3,999, ZSTD_btultra2}, /* level 22.*/ -}, -{ /* for srcSize <= 128 KB */ - /* W, C, H, S, L, T, strat */ - { 17, 12, 12, 1, 5, 1, ZSTD_fast }, /* base for negative levels */ - { 17, 12, 13, 1, 6, 0, ZSTD_fast }, /* level 1 */ - { 17, 13, 15, 1, 5, 0, ZSTD_fast }, /* level 2 */ - { 17, 15, 16, 2, 5, 0, ZSTD_dfast }, /* level 3 */ - { 17, 17, 17, 2, 4, 0, ZSTD_dfast }, /* level 4 */ - { 17, 16, 17, 3, 4, 2, ZSTD_greedy }, /* level 5 */ - { 17, 17, 17, 3, 4, 4, ZSTD_lazy }, /* level 6 */ - { 17, 17, 17, 3, 4, 8, ZSTD_lazy2 }, /* level 7 */ - { 17, 17, 17, 4, 4, 8, ZSTD_lazy2 }, /* level 8 */ - { 17, 17, 17, 5, 4, 8, ZSTD_lazy2 }, /* level 9 */ - { 17, 17, 17, 6, 4, 8, ZSTD_lazy2 }, /* level 10 */ - { 17, 17, 17, 5, 4, 8, ZSTD_btlazy2 }, /* level 11 */ - { 17, 18, 17, 7, 4, 12, ZSTD_btlazy2 }, /* level 12 */ - { 17, 18, 17, 3, 4, 12, ZSTD_btopt }, /* level 13.*/ - { 17, 18, 17, 4, 3, 32, ZSTD_btopt }, /* level 14.*/ - { 17, 18, 17, 6, 3,256, ZSTD_btopt }, /* level 15.*/ - { 17, 18, 17, 6, 3,128, ZSTD_btultra }, /* level 16.*/ - { 17, 18, 17, 8, 3,256, ZSTD_btultra }, /* level 17.*/ - { 17, 18, 17, 10, 3,512, ZSTD_btultra }, /* level 18.*/ - { 17, 18, 17, 5, 3,256, ZSTD_btultra2}, /* level 19.*/ - { 17, 18, 17, 7, 3,512, ZSTD_btultra2}, /* level 20.*/ - { 17, 18, 17, 9, 3,512, ZSTD_btultra2}, /* level 21.*/ - { 17, 18, 17, 11, 3,999, ZSTD_btultra2}, /* level 22.*/ -}, -{ /* for srcSize <= 16 KB */ - /* W, C, H, S, L, T, strat */ - { 14, 12, 13, 1, 5, 1, ZSTD_fast }, /* base for negative levels */ - { 14, 14, 15, 1, 5, 0, ZSTD_fast }, /* level 1 */ - { 14, 14, 15, 1, 4, 0, ZSTD_fast }, /* level 2 */ - { 14, 14, 15, 2, 4, 0, ZSTD_dfast }, /* level 3 */ - { 14, 14, 14, 4, 4, 2, ZSTD_greedy }, /* level 4 */ - { 14, 14, 14, 3, 4, 4, ZSTD_lazy }, /* level 5.*/ - { 14, 14, 14, 4, 4, 8, ZSTD_lazy2 }, /* level 6 */ - { 14, 14, 14, 6, 4, 8, ZSTD_lazy2 }, /* level 7 */ - { 14, 14, 14, 8, 4, 8, ZSTD_lazy2 }, /* level 8.*/ - { 14, 15, 14, 5, 4, 8, ZSTD_btlazy2 }, /* level 9.*/ - { 14, 15, 14, 9, 4, 8, ZSTD_btlazy2 }, /* level 10.*/ - { 14, 15, 14, 3, 4, 12, ZSTD_btopt }, /* level 11.*/ - { 14, 15, 14, 4, 3, 24, ZSTD_btopt }, /* level 12.*/ - { 14, 15, 14, 5, 3, 32, ZSTD_btultra }, /* level 13.*/ - { 14, 15, 15, 6, 3, 64, ZSTD_btultra }, /* level 14.*/ - { 14, 15, 15, 7, 3,256, ZSTD_btultra }, /* level 15.*/ - { 14, 15, 15, 5, 3, 48, ZSTD_btultra2}, /* level 16.*/ - { 14, 15, 15, 6, 3,128, ZSTD_btultra2}, /* level 17.*/ - { 14, 15, 15, 7, 3,256, ZSTD_btultra2}, /* level 18.*/ - { 14, 15, 15, 8, 3,256, ZSTD_btultra2}, /* level 19.*/ - { 14, 15, 15, 8, 3,512, ZSTD_btultra2}, /* level 20.*/ - { 14, 15, 15, 9, 3,512, ZSTD_btultra2}, /* level 21.*/ - { 14, 15, 15, 10, 3,999, ZSTD_btultra2}, /* level 22.*/ -}, -}; - -/*! ZSTD_getCParams() : - * @return ZSTD_compressionParameters structure for a selected compression level, srcSize and dictSize. - * Size values are optional, provide 0 if not known or unused */ -ZSTD_compressionParameters ZSTD_getCParams(int compressionLevel, unsigned long long srcSizeHint, size_t dictSize) -{ - size_t const addedSize = srcSizeHint ? 0 : 500; - U64 const rSize = srcSizeHint+dictSize ? srcSizeHint+dictSize+addedSize : ZSTD_CONTENTSIZE_UNKNOWN; /* intentional overflow for srcSizeHint == ZSTD_CONTENTSIZE_UNKNOWN */ - U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB); - int row = compressionLevel; - DEBUGLOG(5, "ZSTD_getCParams (cLevel=%i)", compressionLevel); - if (compressionLevel == 0) row = ZSTD_CLEVEL_DEFAULT; /* 0 == default */ - if (compressionLevel < 0) row = 0; /* entry 0 is baseline for fast mode */ - if (compressionLevel > ZSTD_MAX_CLEVEL) row = ZSTD_MAX_CLEVEL; - { ZSTD_compressionParameters cp = ZSTD_defaultCParameters[tableID][row]; - if (compressionLevel < 0) cp.targetLength = (unsigned)(-compressionLevel); /* acceleration factor */ - return ZSTD_adjustCParams_internal(cp, srcSizeHint, dictSize); /* refine parameters based on srcSize & dictSize */ - } -} - -/*! ZSTD_getParams() : - * same idea as ZSTD_getCParams() - * @return a `ZSTD_parameters` structure (instead of `ZSTD_compressionParameters`). - * Fields of `ZSTD_frameParameters` are set to default values */ -ZSTD_parameters ZSTD_getParams(int compressionLevel, unsigned long long srcSizeHint, size_t dictSize) { - ZSTD_parameters params; - ZSTD_compressionParameters const cParams = ZSTD_getCParams(compressionLevel, srcSizeHint, dictSize); - DEBUGLOG(5, "ZSTD_getParams (cLevel=%i)", compressionLevel); - memset(¶ms, 0, sizeof(params)); - params.cParams = cParams; - params.fParams.contentSizeFlag = 1; - return params; -} diff --git a/vendor/github.com/DataDog/zstd/zstd_compress_internal.h b/vendor/github.com/DataDog/zstd/zstd_compress_internal.h deleted file mode 100644 index 14036f87..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_compress_internal.h +++ /dev/null @@ -1,1003 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/* This header contains definitions - * that shall **only** be used by modules within lib/compress. - */ - -#ifndef ZSTD_COMPRESS_H -#define ZSTD_COMPRESS_H - -/*-************************************* -* Dependencies -***************************************/ -#include "zstd_internal.h" -#include "zstd_cwksp.h" -#ifdef ZSTD_MULTITHREAD -# include "zstdmt_compress.h" -#endif - -#if defined (__cplusplus) -extern "C" { -#endif - - -/*-************************************* -* Constants -***************************************/ -#define kSearchStrength 8 -#define HASH_READ_SIZE 8 -#define ZSTD_DUBT_UNSORTED_MARK 1 /* For btlazy2 strategy, index ZSTD_DUBT_UNSORTED_MARK==1 means "unsorted". - It could be confused for a real successor at index "1", if sorted as larger than its predecessor. - It's not a big deal though : candidate will just be sorted again. - Additionally, candidate position 1 will be lost. - But candidate 1 cannot hide a large tree of candidates, so it's a minimal loss. - The benefit is that ZSTD_DUBT_UNSORTED_MARK cannot be mishandled after table re-use with a different strategy. - This constant is required by ZSTD_compressBlock_btlazy2() and ZSTD_reduceTable_internal() */ - - -/*-************************************* -* Context memory management -***************************************/ -typedef enum { ZSTDcs_created=0, ZSTDcs_init, ZSTDcs_ongoing, ZSTDcs_ending } ZSTD_compressionStage_e; -typedef enum { zcss_init=0, zcss_load, zcss_flush } ZSTD_cStreamStage; - -typedef struct ZSTD_prefixDict_s { - const void* dict; - size_t dictSize; - ZSTD_dictContentType_e dictContentType; -} ZSTD_prefixDict; - -typedef struct { - void* dictBuffer; - void const* dict; - size_t dictSize; - ZSTD_dictContentType_e dictContentType; - ZSTD_CDict* cdict; -} ZSTD_localDict; - -typedef struct { - U32 CTable[HUF_CTABLE_SIZE_U32(255)]; - HUF_repeat repeatMode; -} ZSTD_hufCTables_t; - -typedef struct { - FSE_CTable offcodeCTable[FSE_CTABLE_SIZE_U32(OffFSELog, MaxOff)]; - FSE_CTable matchlengthCTable[FSE_CTABLE_SIZE_U32(MLFSELog, MaxML)]; - FSE_CTable litlengthCTable[FSE_CTABLE_SIZE_U32(LLFSELog, MaxLL)]; - FSE_repeat offcode_repeatMode; - FSE_repeat matchlength_repeatMode; - FSE_repeat litlength_repeatMode; -} ZSTD_fseCTables_t; - -typedef struct { - ZSTD_hufCTables_t huf; - ZSTD_fseCTables_t fse; -} ZSTD_entropyCTables_t; - -typedef struct { - U32 off; - U32 len; -} ZSTD_match_t; - -typedef struct { - int price; - U32 off; - U32 mlen; - U32 litlen; - U32 rep[ZSTD_REP_NUM]; -} ZSTD_optimal_t; - -typedef enum { zop_dynamic=0, zop_predef } ZSTD_OptPrice_e; - -typedef struct { - /* All tables are allocated inside cctx->workspace by ZSTD_resetCCtx_internal() */ - unsigned* litFreq; /* table of literals statistics, of size 256 */ - unsigned* litLengthFreq; /* table of litLength statistics, of size (MaxLL+1) */ - unsigned* matchLengthFreq; /* table of matchLength statistics, of size (MaxML+1) */ - unsigned* offCodeFreq; /* table of offCode statistics, of size (MaxOff+1) */ - ZSTD_match_t* matchTable; /* list of found matches, of size ZSTD_OPT_NUM+1 */ - ZSTD_optimal_t* priceTable; /* All positions tracked by optimal parser, of size ZSTD_OPT_NUM+1 */ - - U32 litSum; /* nb of literals */ - U32 litLengthSum; /* nb of litLength codes */ - U32 matchLengthSum; /* nb of matchLength codes */ - U32 offCodeSum; /* nb of offset codes */ - U32 litSumBasePrice; /* to compare to log2(litfreq) */ - U32 litLengthSumBasePrice; /* to compare to log2(llfreq) */ - U32 matchLengthSumBasePrice;/* to compare to log2(mlfreq) */ - U32 offCodeSumBasePrice; /* to compare to log2(offreq) */ - ZSTD_OptPrice_e priceType; /* prices can be determined dynamically, or follow a pre-defined cost structure */ - const ZSTD_entropyCTables_t* symbolCosts; /* pre-calculated dictionary statistics */ - ZSTD_literalCompressionMode_e literalCompressionMode; -} optState_t; - -typedef struct { - ZSTD_entropyCTables_t entropy; - U32 rep[ZSTD_REP_NUM]; -} ZSTD_compressedBlockState_t; - -typedef struct { - BYTE const* nextSrc; /* next block here to continue on current prefix */ - BYTE const* base; /* All regular indexes relative to this position */ - BYTE const* dictBase; /* extDict indexes relative to this position */ - U32 dictLimit; /* below that point, need extDict */ - U32 lowLimit; /* below that point, no more valid data */ -} ZSTD_window_t; - -typedef struct ZSTD_matchState_t ZSTD_matchState_t; -struct ZSTD_matchState_t { - ZSTD_window_t window; /* State for window round buffer management */ - U32 loadedDictEnd; /* index of end of dictionary, within context's referential. - * When loadedDictEnd != 0, a dictionary is in use, and still valid. - * This relies on a mechanism to set loadedDictEnd=0 when dictionary is no longer within distance. - * Such mechanism is provided within ZSTD_window_enforceMaxDist() and ZSTD_checkDictValidity(). - * When dict referential is copied into active context (i.e. not attached), - * loadedDictEnd == dictSize, since referential starts from zero. - */ - U32 nextToUpdate; /* index from which to continue table update */ - U32 hashLog3; /* dispatch table for matches of len==3 : larger == faster, more memory */ - U32* hashTable; - U32* hashTable3; - U32* chainTable; - optState_t opt; /* optimal parser state */ - const ZSTD_matchState_t* dictMatchState; - ZSTD_compressionParameters cParams; -}; - -typedef struct { - ZSTD_compressedBlockState_t* prevCBlock; - ZSTD_compressedBlockState_t* nextCBlock; - ZSTD_matchState_t matchState; -} ZSTD_blockState_t; - -typedef struct { - U32 offset; - U32 checksum; -} ldmEntry_t; - -typedef struct { - ZSTD_window_t window; /* State for the window round buffer management */ - ldmEntry_t* hashTable; - BYTE* bucketOffsets; /* Next position in bucket to insert entry */ - U64 hashPower; /* Used to compute the rolling hash. - * Depends on ldmParams.minMatchLength */ -} ldmState_t; - -typedef struct { - U32 enableLdm; /* 1 if enable long distance matching */ - U32 hashLog; /* Log size of hashTable */ - U32 bucketSizeLog; /* Log bucket size for collision resolution, at most 8 */ - U32 minMatchLength; /* Minimum match length */ - U32 hashRateLog; /* Log number of entries to skip */ - U32 windowLog; /* Window log for the LDM */ -} ldmParams_t; - -typedef struct { - U32 offset; - U32 litLength; - U32 matchLength; -} rawSeq; - -typedef struct { - rawSeq* seq; /* The start of the sequences */ - size_t pos; /* The position where reading stopped. <= size. */ - size_t size; /* The number of sequences. <= capacity. */ - size_t capacity; /* The capacity starting from `seq` pointer */ -} rawSeqStore_t; - -typedef struct { - int collectSequences; - ZSTD_Sequence* seqStart; - size_t seqIndex; - size_t maxSequences; -} SeqCollector; - -struct ZSTD_CCtx_params_s { - ZSTD_format_e format; - ZSTD_compressionParameters cParams; - ZSTD_frameParameters fParams; - - int compressionLevel; - int forceWindow; /* force back-references to respect limit of - * 1< 63) ? ZSTD_highbit32(litLength) + LL_deltaCode : LL_Code[litLength]; -} - -/* ZSTD_MLcode() : - * note : mlBase = matchLength - MINMATCH; - * because it's the format it's stored in seqStore->sequences */ -MEM_STATIC U32 ZSTD_MLcode(U32 mlBase) -{ - static const BYTE ML_Code[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, - 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, - 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, - 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42 }; - static const U32 ML_deltaCode = 36; - return (mlBase > 127) ? ZSTD_highbit32(mlBase) + ML_deltaCode : ML_Code[mlBase]; -} - -/* ZSTD_cParam_withinBounds: - * @return 1 if value is within cParam bounds, - * 0 otherwise */ -MEM_STATIC int ZSTD_cParam_withinBounds(ZSTD_cParameter cParam, int value) -{ - ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam); - if (ZSTD_isError(bounds.error)) return 0; - if (value < bounds.lowerBound) return 0; - if (value > bounds.upperBound) return 0; - return 1; -} - -/* ZSTD_minGain() : - * minimum compression required - * to generate a compress block or a compressed literals section. - * note : use same formula for both situations */ -MEM_STATIC size_t ZSTD_minGain(size_t srcSize, ZSTD_strategy strat) -{ - U32 const minlog = (strat>=ZSTD_btultra) ? (U32)(strat) - 1 : 6; - ZSTD_STATIC_ASSERT(ZSTD_btultra == 8); - assert(ZSTD_cParam_withinBounds(ZSTD_c_strategy, strat)); - return (srcSize >> minlog) + 2; -} - -/*! ZSTD_safecopyLiterals() : - * memcpy() function that won't read beyond more than WILDCOPY_OVERLENGTH bytes past ilimit_w. - * Only called when the sequence ends past ilimit_w, so it only needs to be optimized for single - * large copies. - */ -static void ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE const* ilimit_w) { - assert(iend > ilimit_w); - if (ip <= ilimit_w) { - ZSTD_wildcopy(op, ip, ilimit_w - ip, ZSTD_no_overlap); - op += ilimit_w - ip; - ip = ilimit_w; - } - while (ip < iend) *op++ = *ip++; -} - -/*! ZSTD_storeSeq() : - * Store a sequence (litlen, litPtr, offCode and mlBase) into seqStore_t. - * `offCode` : distance to match + ZSTD_REP_MOVE (values <= ZSTD_REP_MOVE are repCodes). - * `mlBase` : matchLength - MINMATCH - * Allowed to overread literals up to litLimit. -*/ -HINT_INLINE UNUSED_ATTR -void ZSTD_storeSeq(seqStore_t* seqStorePtr, size_t litLength, const BYTE* literals, const BYTE* litLimit, U32 offCode, size_t mlBase) -{ - BYTE const* const litLimit_w = litLimit - WILDCOPY_OVERLENGTH; - BYTE const* const litEnd = literals + litLength; -#if defined(DEBUGLEVEL) && (DEBUGLEVEL >= 6) - static const BYTE* g_start = NULL; - if (g_start==NULL) g_start = (const BYTE*)literals; /* note : index only works for compression within a single segment */ - { U32 const pos = (U32)((const BYTE*)literals - g_start); - DEBUGLOG(6, "Cpos%7u :%3u literals, match%4u bytes at offCode%7u", - pos, (U32)litLength, (U32)mlBase+MINMATCH, (U32)offCode); - } -#endif - assert((size_t)(seqStorePtr->sequences - seqStorePtr->sequencesStart) < seqStorePtr->maxNbSeq); - /* copy Literals */ - assert(seqStorePtr->maxNbLit <= 128 KB); - assert(seqStorePtr->lit + litLength <= seqStorePtr->litStart + seqStorePtr->maxNbLit); - assert(literals + litLength <= litLimit); - if (litEnd <= litLimit_w) { - /* Common case we can use wildcopy. - * First copy 16 bytes, because literals are likely short. - */ - assert(WILDCOPY_OVERLENGTH >= 16); - ZSTD_copy16(seqStorePtr->lit, literals); - if (litLength > 16) { - ZSTD_wildcopy(seqStorePtr->lit+16, literals+16, (ptrdiff_t)litLength-16, ZSTD_no_overlap); - } - } else { - ZSTD_safecopyLiterals(seqStorePtr->lit, literals, litEnd, litLimit_w); - } - seqStorePtr->lit += litLength; - - /* literal Length */ - if (litLength>0xFFFF) { - assert(seqStorePtr->longLengthID == 0); /* there can only be a single long length */ - seqStorePtr->longLengthID = 1; - seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); - } - seqStorePtr->sequences[0].litLength = (U16)litLength; - - /* match offset */ - seqStorePtr->sequences[0].offset = offCode + 1; - - /* match Length */ - if (mlBase>0xFFFF) { - assert(seqStorePtr->longLengthID == 0); /* there can only be a single long length */ - seqStorePtr->longLengthID = 2; - seqStorePtr->longLengthPos = (U32)(seqStorePtr->sequences - seqStorePtr->sequencesStart); - } - seqStorePtr->sequences[0].matchLength = (U16)mlBase; - - seqStorePtr->sequences++; -} - - -/*-************************************* -* Match length counter -***************************************/ -static unsigned ZSTD_NbCommonBytes (size_t val) -{ - if (MEM_isLittleEndian()) { - if (MEM_64bits()) { -# if defined(_MSC_VER) && defined(_WIN64) - unsigned long r = 0; - _BitScanForward64( &r, (U64)val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 4) - return (__builtin_ctzll((U64)val) >> 3); -# else - static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, - 0, 3, 1, 3, 1, 4, 2, 7, - 0, 2, 3, 6, 1, 5, 3, 5, - 1, 3, 4, 4, 2, 5, 6, 7, - 7, 0, 1, 2, 3, 3, 4, 6, - 2, 6, 5, 5, 3, 4, 5, 6, - 7, 1, 2, 4, 6, 4, 4, 5, - 7, 2, 6, 5, 7, 6, 7, 7 }; - return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58]; -# endif - } else { /* 32 bits */ -# if defined(_MSC_VER) - unsigned long r=0; - _BitScanForward( &r, (U32)val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_ctz((U32)val) >> 3); -# else - static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, - 3, 2, 2, 1, 3, 2, 0, 1, - 3, 3, 1, 2, 2, 2, 2, 0, - 3, 1, 2, 0, 1, 0, 1, 1 }; - return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27]; -# endif - } - } else { /* Big Endian CPU */ - if (MEM_64bits()) { -# if defined(_MSC_VER) && defined(_WIN64) - unsigned long r = 0; - _BitScanReverse64( &r, val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 4) - return (__builtin_clzll(val) >> 3); -# else - unsigned r; - const unsigned n32 = sizeof(size_t)*4; /* calculate this way due to compiler complaining in 32-bits mode */ - if (!(val>>n32)) { r=4; } else { r=0; val>>=n32; } - if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } - r += (!val); - return r; -# endif - } else { /* 32 bits */ -# if defined(_MSC_VER) - unsigned long r = 0; - _BitScanReverse( &r, (unsigned long)val ); - return (unsigned)(r>>3); -# elif defined(__GNUC__) && (__GNUC__ >= 3) - return (__builtin_clz((U32)val) >> 3); -# else - unsigned r; - if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; } - r += (!val); - return r; -# endif - } } -} - - -MEM_STATIC size_t ZSTD_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* const pInLimit) -{ - const BYTE* const pStart = pIn; - const BYTE* const pInLoopLimit = pInLimit - (sizeof(size_t)-1); - - if (pIn < pInLoopLimit) { - { size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); - if (diff) return ZSTD_NbCommonBytes(diff); } - pIn+=sizeof(size_t); pMatch+=sizeof(size_t); - while (pIn < pInLoopLimit) { - size_t const diff = MEM_readST(pMatch) ^ MEM_readST(pIn); - if (!diff) { pIn+=sizeof(size_t); pMatch+=sizeof(size_t); continue; } - pIn += ZSTD_NbCommonBytes(diff); - return (size_t)(pIn - pStart); - } } - if (MEM_64bits() && (pIn<(pInLimit-3)) && (MEM_read32(pMatch) == MEM_read32(pIn))) { pIn+=4; pMatch+=4; } - if ((pIn<(pInLimit-1)) && (MEM_read16(pMatch) == MEM_read16(pIn))) { pIn+=2; pMatch+=2; } - if ((pIn> (32-h) ; } -MEM_STATIC size_t ZSTD_hash3Ptr(const void* ptr, U32 h) { return ZSTD_hash3(MEM_readLE32(ptr), h); } /* only in zstd_opt.h */ - -static const U32 prime4bytes = 2654435761U; -static U32 ZSTD_hash4(U32 u, U32 h) { return (u * prime4bytes) >> (32-h) ; } -static size_t ZSTD_hash4Ptr(const void* ptr, U32 h) { return ZSTD_hash4(MEM_read32(ptr), h); } - -static const U64 prime5bytes = 889523592379ULL; -static size_t ZSTD_hash5(U64 u, U32 h) { return (size_t)(((u << (64-40)) * prime5bytes) >> (64-h)) ; } -static size_t ZSTD_hash5Ptr(const void* p, U32 h) { return ZSTD_hash5(MEM_readLE64(p), h); } - -static const U64 prime6bytes = 227718039650203ULL; -static size_t ZSTD_hash6(U64 u, U32 h) { return (size_t)(((u << (64-48)) * prime6bytes) >> (64-h)) ; } -static size_t ZSTD_hash6Ptr(const void* p, U32 h) { return ZSTD_hash6(MEM_readLE64(p), h); } - -static const U64 prime7bytes = 58295818150454627ULL; -static size_t ZSTD_hash7(U64 u, U32 h) { return (size_t)(((u << (64-56)) * prime7bytes) >> (64-h)) ; } -static size_t ZSTD_hash7Ptr(const void* p, U32 h) { return ZSTD_hash7(MEM_readLE64(p), h); } - -static const U64 prime8bytes = 0xCF1BBCDCB7A56463ULL; -static size_t ZSTD_hash8(U64 u, U32 h) { return (size_t)(((u) * prime8bytes) >> (64-h)) ; } -static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE64(p), h); } - -MEM_STATIC size_t ZSTD_hashPtr(const void* p, U32 hBits, U32 mls) -{ - switch(mls) - { - default: - case 4: return ZSTD_hash4Ptr(p, hBits); - case 5: return ZSTD_hash5Ptr(p, hBits); - case 6: return ZSTD_hash6Ptr(p, hBits); - case 7: return ZSTD_hash7Ptr(p, hBits); - case 8: return ZSTD_hash8Ptr(p, hBits); - } -} - -/** ZSTD_ipow() : - * Return base^exponent. - */ -static U64 ZSTD_ipow(U64 base, U64 exponent) -{ - U64 power = 1; - while (exponent) { - if (exponent & 1) power *= base; - exponent >>= 1; - base *= base; - } - return power; -} - -#define ZSTD_ROLL_HASH_CHAR_OFFSET 10 - -/** ZSTD_rollingHash_append() : - * Add the buffer to the hash value. - */ -static U64 ZSTD_rollingHash_append(U64 hash, void const* buf, size_t size) -{ - BYTE const* istart = (BYTE const*)buf; - size_t pos; - for (pos = 0; pos < size; ++pos) { - hash *= prime8bytes; - hash += istart[pos] + ZSTD_ROLL_HASH_CHAR_OFFSET; - } - return hash; -} - -/** ZSTD_rollingHash_compute() : - * Compute the rolling hash value of the buffer. - */ -MEM_STATIC U64 ZSTD_rollingHash_compute(void const* buf, size_t size) -{ - return ZSTD_rollingHash_append(0, buf, size); -} - -/** ZSTD_rollingHash_primePower() : - * Compute the primePower to be passed to ZSTD_rollingHash_rotate() for a hash - * over a window of length bytes. - */ -MEM_STATIC U64 ZSTD_rollingHash_primePower(U32 length) -{ - return ZSTD_ipow(prime8bytes, length - 1); -} - -/** ZSTD_rollingHash_rotate() : - * Rotate the rolling hash by one byte. - */ -MEM_STATIC U64 ZSTD_rollingHash_rotate(U64 hash, BYTE toRemove, BYTE toAdd, U64 primePower) -{ - hash -= (toRemove + ZSTD_ROLL_HASH_CHAR_OFFSET) * primePower; - hash *= prime8bytes; - hash += toAdd + ZSTD_ROLL_HASH_CHAR_OFFSET; - return hash; -} - -/*-************************************* -* Round buffer management -***************************************/ -#if (ZSTD_WINDOWLOG_MAX_64 > 31) -# error "ZSTD_WINDOWLOG_MAX is too large : would overflow ZSTD_CURRENT_MAX" -#endif -/* Max current allowed */ -#define ZSTD_CURRENT_MAX ((3U << 29) + (1U << ZSTD_WINDOWLOG_MAX)) -/* Maximum chunk size before overflow correction needs to be called again */ -#define ZSTD_CHUNKSIZE_MAX \ - ( ((U32)-1) /* Maximum ending current index */ \ - - ZSTD_CURRENT_MAX) /* Maximum beginning lowLimit */ - -/** - * ZSTD_window_clear(): - * Clears the window containing the history by simply setting it to empty. - */ -MEM_STATIC void ZSTD_window_clear(ZSTD_window_t* window) -{ - size_t const endT = (size_t)(window->nextSrc - window->base); - U32 const end = (U32)endT; - - window->lowLimit = end; - window->dictLimit = end; -} - -/** - * ZSTD_window_hasExtDict(): - * Returns non-zero if the window has a non-empty extDict. - */ -MEM_STATIC U32 ZSTD_window_hasExtDict(ZSTD_window_t const window) -{ - return window.lowLimit < window.dictLimit; -} - -/** - * ZSTD_matchState_dictMode(): - * Inspects the provided matchState and figures out what dictMode should be - * passed to the compressor. - */ -MEM_STATIC ZSTD_dictMode_e ZSTD_matchState_dictMode(const ZSTD_matchState_t *ms) -{ - return ZSTD_window_hasExtDict(ms->window) ? - ZSTD_extDict : - ms->dictMatchState != NULL ? - ZSTD_dictMatchState : - ZSTD_noDict; -} - -/** - * ZSTD_window_needOverflowCorrection(): - * Returns non-zero if the indices are getting too large and need overflow - * protection. - */ -MEM_STATIC U32 ZSTD_window_needOverflowCorrection(ZSTD_window_t const window, - void const* srcEnd) -{ - U32 const current = (U32)((BYTE const*)srcEnd - window.base); - return current > ZSTD_CURRENT_MAX; -} - -/** - * ZSTD_window_correctOverflow(): - * Reduces the indices to protect from index overflow. - * Returns the correction made to the indices, which must be applied to every - * stored index. - * - * The least significant cycleLog bits of the indices must remain the same, - * which may be 0. Every index up to maxDist in the past must be valid. - * NOTE: (maxDist & cycleMask) must be zero. - */ -MEM_STATIC U32 ZSTD_window_correctOverflow(ZSTD_window_t* window, U32 cycleLog, - U32 maxDist, void const* src) -{ - /* preemptive overflow correction: - * 1. correction is large enough: - * lowLimit > (3<<29) ==> current > 3<<29 + 1< (3<<29 + 1< (3<<29) - (1< (3<<29) - (1<<30) (NOTE: chainLog <= 30) - * > 1<<29 - * - * 2. (ip+ZSTD_CHUNKSIZE_MAX - cctx->base) doesn't overflow: - * After correction, current is less than (1<base < 1<<32. - * 3. (cctx->lowLimit + 1< 3<<29 + 1<base); - U32 const newCurrent = (current & cycleMask) + maxDist; - U32 const correction = current - newCurrent; - assert((maxDist & cycleMask) == 0); - assert(current > newCurrent); - /* Loose bound, should be around 1<<29 (see above) */ - assert(correction > 1<<28); - - window->base += correction; - window->dictBase += correction; - window->lowLimit -= correction; - window->dictLimit -= correction; - - DEBUGLOG(4, "Correction of 0x%x bytes to lowLimit=0x%x", correction, - window->lowLimit); - return correction; -} - -/** - * ZSTD_window_enforceMaxDist(): - * Updates lowLimit so that: - * (srcEnd - base) - lowLimit == maxDist + loadedDictEnd - * - * It ensures index is valid as long as index >= lowLimit. - * This must be called before a block compression call. - * - * loadedDictEnd is only defined if a dictionary is in use for current compression. - * As the name implies, loadedDictEnd represents the index at end of dictionary. - * The value lies within context's referential, it can be directly compared to blockEndIdx. - * - * If loadedDictEndPtr is NULL, no dictionary is in use, and we use loadedDictEnd == 0. - * If loadedDictEndPtr is not NULL, we set it to zero after updating lowLimit. - * This is because dictionaries are allowed to be referenced fully - * as long as the last byte of the dictionary is in the window. - * Once input has progressed beyond window size, dictionary cannot be referenced anymore. - * - * In normal dict mode, the dictionary lies between lowLimit and dictLimit. - * In dictMatchState mode, lowLimit and dictLimit are the same, - * and the dictionary is below them. - * forceWindow and dictMatchState are therefore incompatible. - */ -MEM_STATIC void -ZSTD_window_enforceMaxDist(ZSTD_window_t* window, - const void* blockEnd, - U32 maxDist, - U32* loadedDictEndPtr, - const ZSTD_matchState_t** dictMatchStatePtr) -{ - U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); - U32 const loadedDictEnd = (loadedDictEndPtr != NULL) ? *loadedDictEndPtr : 0; - DEBUGLOG(5, "ZSTD_window_enforceMaxDist: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u", - (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd); - - /* - When there is no dictionary : loadedDictEnd == 0. - In which case, the test (blockEndIdx > maxDist) is merely to avoid - overflowing next operation `newLowLimit = blockEndIdx - maxDist`. - - When there is a standard dictionary : - Index referential is copied from the dictionary, - which means it starts from 0. - In which case, loadedDictEnd == dictSize, - and it makes sense to compare `blockEndIdx > maxDist + dictSize` - since `blockEndIdx` also starts from zero. - - When there is an attached dictionary : - loadedDictEnd is expressed within the referential of the context, - so it can be directly compared against blockEndIdx. - */ - if (blockEndIdx > maxDist + loadedDictEnd) { - U32 const newLowLimit = blockEndIdx - maxDist; - if (window->lowLimit < newLowLimit) window->lowLimit = newLowLimit; - if (window->dictLimit < window->lowLimit) { - DEBUGLOG(5, "Update dictLimit to match lowLimit, from %u to %u", - (unsigned)window->dictLimit, (unsigned)window->lowLimit); - window->dictLimit = window->lowLimit; - } - /* On reaching window size, dictionaries are invalidated */ - if (loadedDictEndPtr) *loadedDictEndPtr = 0; - if (dictMatchStatePtr) *dictMatchStatePtr = NULL; - } -} - -/* Similar to ZSTD_window_enforceMaxDist(), - * but only invalidates dictionary - * when input progresses beyond window size. - * assumption : loadedDictEndPtr and dictMatchStatePtr are valid (non NULL) - * loadedDictEnd uses same referential as window->base - * maxDist is the window size */ -MEM_STATIC void -ZSTD_checkDictValidity(const ZSTD_window_t* window, - const void* blockEnd, - U32 maxDist, - U32* loadedDictEndPtr, - const ZSTD_matchState_t** dictMatchStatePtr) -{ - assert(loadedDictEndPtr != NULL); - assert(dictMatchStatePtr != NULL); - { U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); - U32 const loadedDictEnd = *loadedDictEndPtr; - DEBUGLOG(5, "ZSTD_checkDictValidity: blockEndIdx=%u, maxDist=%u, loadedDictEnd=%u", - (unsigned)blockEndIdx, (unsigned)maxDist, (unsigned)loadedDictEnd); - assert(blockEndIdx >= loadedDictEnd); - - if (blockEndIdx > loadedDictEnd + maxDist) { - /* On reaching window size, dictionaries are invalidated. - * For simplification, if window size is reached anywhere within next block, - * the dictionary is invalidated for the full block. - */ - DEBUGLOG(6, "invalidating dictionary for current block (distance > windowSize)"); - *loadedDictEndPtr = 0; - *dictMatchStatePtr = NULL; - } else { - if (*loadedDictEndPtr != 0) { - DEBUGLOG(6, "dictionary considered valid for current block"); - } } } -} - -/** - * ZSTD_window_update(): - * Updates the window by appending [src, src + srcSize) to the window. - * If it is not contiguous, the current prefix becomes the extDict, and we - * forget about the extDict. Handles overlap of the prefix and extDict. - * Returns non-zero if the segment is contiguous. - */ -MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window, - void const* src, size_t srcSize) -{ - BYTE const* const ip = (BYTE const*)src; - U32 contiguous = 1; - DEBUGLOG(5, "ZSTD_window_update"); - /* Check if blocks follow each other */ - if (src != window->nextSrc) { - /* not contiguous */ - size_t const distanceFromBase = (size_t)(window->nextSrc - window->base); - DEBUGLOG(5, "Non contiguous blocks, new segment starts at %u", window->dictLimit); - window->lowLimit = window->dictLimit; - assert(distanceFromBase == (size_t)(U32)distanceFromBase); /* should never overflow */ - window->dictLimit = (U32)distanceFromBase; - window->dictBase = window->base; - window->base = ip - distanceFromBase; - // ms->nextToUpdate = window->dictLimit; - if (window->dictLimit - window->lowLimit < HASH_READ_SIZE) window->lowLimit = window->dictLimit; /* too small extDict */ - contiguous = 0; - } - window->nextSrc = ip + srcSize; - /* if input and dictionary overlap : reduce dictionary (area presumed modified by input) */ - if ( (ip+srcSize > window->dictBase + window->lowLimit) - & (ip < window->dictBase + window->dictLimit)) { - ptrdiff_t const highInputIdx = (ip + srcSize) - window->dictBase; - U32 const lowLimitMax = (highInputIdx > (ptrdiff_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx; - window->lowLimit = lowLimitMax; - DEBUGLOG(5, "Overlapping extDict and input : new lowLimit = %u", window->lowLimit); - } - return contiguous; -} - -MEM_STATIC U32 ZSTD_getLowestMatchIndex(const ZSTD_matchState_t* ms, U32 current, unsigned windowLog) -{ - U32 const maxDistance = 1U << windowLog; - U32 const lowestValid = ms->window.lowLimit; - U32 const withinWindow = (current - lowestValid > maxDistance) ? current - maxDistance : lowestValid; - U32 const isDictionary = (ms->loadedDictEnd != 0); - U32 const matchLowest = isDictionary ? lowestValid : withinWindow; - return matchLowest; -} - - - -/* debug functions */ -#if (DEBUGLEVEL>=2) - -MEM_STATIC double ZSTD_fWeight(U32 rawStat) -{ - U32 const fp_accuracy = 8; - U32 const fp_multiplier = (1 << fp_accuracy); - U32 const newStat = rawStat + 1; - U32 const hb = ZSTD_highbit32(newStat); - U32 const BWeight = hb * fp_multiplier; - U32 const FWeight = (newStat << fp_accuracy) >> hb; - U32 const weight = BWeight + FWeight; - assert(hb + fp_accuracy < 31); - return (double)weight / fp_multiplier; -} - -/* display a table content, - * listing each element, its frequency, and its predicted bit cost */ -MEM_STATIC void ZSTD_debugTable(const U32* table, U32 max) -{ - unsigned u, sum; - for (u=0, sum=0; u<=max; u++) sum += table[u]; - DEBUGLOG(2, "total nb elts: %u", sum); - for (u=0; u<=max; u++) { - DEBUGLOG(2, "%2u: %5u (%.2f)", - u, table[u], ZSTD_fWeight(sum) - ZSTD_fWeight(table[u]) ); - } -} - -#endif - - -#if defined (__cplusplus) -} -#endif - - -/* ============================================================== - * Private declarations - * These prototypes shall only be called from within lib/compress - * ============================================================== */ - -/* ZSTD_getCParamsFromCCtxParams() : - * cParams are built depending on compressionLevel, src size hints, - * LDM and manually set compression parameters. - */ -ZSTD_compressionParameters ZSTD_getCParamsFromCCtxParams( - const ZSTD_CCtx_params* CCtxParams, U64 srcSizeHint, size_t dictSize); - -/*! ZSTD_initCStream_internal() : - * Private use only. Init streaming operation. - * expects params to be valid. - * must receive dict, or cdict, or none, but not both. - * @return : 0, or an error code */ -size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs, - const void* dict, size_t dictSize, - const ZSTD_CDict* cdict, - const ZSTD_CCtx_params* params, unsigned long long pledgedSrcSize); - -void ZSTD_resetSeqStore(seqStore_t* ssPtr); - -/*! ZSTD_getCParamsFromCDict() : - * as the name implies */ -ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict); - -/* ZSTD_compressBegin_advanced_internal() : - * Private use only. To be called from zstdmt_compress.c. */ -size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx, - const void* dict, size_t dictSize, - ZSTD_dictContentType_e dictContentType, - ZSTD_dictTableLoadMethod_e dtlm, - const ZSTD_CDict* cdict, - const ZSTD_CCtx_params* params, - unsigned long long pledgedSrcSize); - -/* ZSTD_compress_advanced_internal() : - * Private use only. To be called from zstdmt_compress.c. */ -size_t ZSTD_compress_advanced_internal(ZSTD_CCtx* cctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict,size_t dictSize, - const ZSTD_CCtx_params* params); - - -/* ZSTD_writeLastEmptyBlock() : - * output an empty Block with end-of-frame mark to complete a frame - * @return : size of data written into `dst` (== ZSTD_blockHeaderSize (defined in zstd_internal.h)) - * or an error code if `dstCapacity` is too small (31) + (srcSize>4095); - - RETURN_ERROR_IF(srcSize + flSize > dstCapacity, dstSize_tooSmall); - - switch(flSize) - { - case 1: /* 2 - 1 - 5 */ - ostart[0] = (BYTE)((U32)set_basic + (srcSize<<3)); - break; - case 2: /* 2 - 2 - 12 */ - MEM_writeLE16(ostart, (U16)((U32)set_basic + (1<<2) + (srcSize<<4))); - break; - case 3: /* 2 - 2 - 20 */ - MEM_writeLE32(ostart, (U32)((U32)set_basic + (3<<2) + (srcSize<<4))); - break; - default: /* not necessary : flSize is {1,2,3} */ - assert(0); - } - - memcpy(ostart + flSize, src, srcSize); - return srcSize + flSize; -} - -size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - BYTE* const ostart = (BYTE* const)dst; - U32 const flSize = 1 + (srcSize>31) + (srcSize>4095); - - (void)dstCapacity; /* dstCapacity already guaranteed to be >=4, hence large enough */ - - switch(flSize) - { - case 1: /* 2 - 1 - 5 */ - ostart[0] = (BYTE)((U32)set_rle + (srcSize<<3)); - break; - case 2: /* 2 - 2 - 12 */ - MEM_writeLE16(ostart, (U16)((U32)set_rle + (1<<2) + (srcSize<<4))); - break; - case 3: /* 2 - 2 - 20 */ - MEM_writeLE32(ostart, (U32)((U32)set_rle + (3<<2) + (srcSize<<4))); - break; - default: /* not necessary : flSize is {1,2,3} */ - assert(0); - } - - ostart[flSize] = *(const BYTE*)src; - return flSize+1; -} - -size_t ZSTD_compressLiterals (ZSTD_hufCTables_t const* prevHuf, - ZSTD_hufCTables_t* nextHuf, - ZSTD_strategy strategy, int disableLiteralCompression, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - void* entropyWorkspace, size_t entropyWorkspaceSize, - const int bmi2) -{ - size_t const minGain = ZSTD_minGain(srcSize, strategy); - size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB); - BYTE* const ostart = (BYTE*)dst; - U32 singleStream = srcSize < 256; - symbolEncodingType_e hType = set_compressed; - size_t cLitSize; - - DEBUGLOG(5,"ZSTD_compressLiterals (disableLiteralCompression=%i)", - disableLiteralCompression); - - /* Prepare nextEntropy assuming reusing the existing table */ - memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - - if (disableLiteralCompression) - return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); - - /* small ? don't even attempt compression (speed opt) */ -# define COMPRESS_LITERALS_SIZE_MIN 63 - { size_t const minLitSize = (prevHuf->repeatMode == HUF_repeat_valid) ? 6 : COMPRESS_LITERALS_SIZE_MIN; - if (srcSize <= minLitSize) return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); - } - - RETURN_ERROR_IF(dstCapacity < lhSize+1, dstSize_tooSmall, "not enough space for compression"); - { HUF_repeat repeat = prevHuf->repeatMode; - int const preferRepeat = strategy < ZSTD_lazy ? srcSize <= 1024 : 0; - if (repeat == HUF_repeat_valid && lhSize == 3) singleStream = 1; - cLitSize = singleStream ? - HUF_compress1X_repeat( - ostart+lhSize, dstCapacity-lhSize, src, srcSize, - 255, 11, entropyWorkspace, entropyWorkspaceSize, - (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2) : - HUF_compress4X_repeat( - ostart+lhSize, dstCapacity-lhSize, src, srcSize, - 255, 11, entropyWorkspace, entropyWorkspaceSize, - (HUF_CElt*)nextHuf->CTable, &repeat, preferRepeat, bmi2); - if (repeat != HUF_repeat_none) { - /* reused the existing table */ - hType = set_repeat; - } - } - - if ((cLitSize==0) | (cLitSize >= srcSize - minGain) | ERR_isError(cLitSize)) { - memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize); - } - if (cLitSize==1) { - memcpy(nextHuf, prevHuf, sizeof(*prevHuf)); - return ZSTD_compressRleLiteralsBlock(dst, dstCapacity, src, srcSize); - } - - if (hType == set_compressed) { - /* using a newly constructed table */ - nextHuf->repeatMode = HUF_repeat_check; - } - - /* Build header */ - switch(lhSize) - { - case 3: /* 2 - 2 - 10 - 10 */ - { U32 const lhc = hType + ((!singleStream) << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<14); - MEM_writeLE24(ostart, lhc); - break; - } - case 4: /* 2 - 2 - 14 - 14 */ - { U32 const lhc = hType + (2 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<18); - MEM_writeLE32(ostart, lhc); - break; - } - case 5: /* 2 - 2 - 18 - 18 */ - { U32 const lhc = hType + (3 << 2) + ((U32)srcSize<<4) + ((U32)cLitSize<<22); - MEM_writeLE32(ostart, lhc); - ostart[4] = (BYTE)(cLitSize >> 10); - break; - } - default: /* not possible : lhSize is {3,4,5} */ - assert(0); - } - return lhSize+cLitSize; -} diff --git a/vendor/github.com/DataDog/zstd/zstd_compress_literals.h b/vendor/github.com/DataDog/zstd/zstd_compress_literals.h deleted file mode 100644 index 97273d7c..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_compress_literals.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_COMPRESS_LITERALS_H -#define ZSTD_COMPRESS_LITERALS_H - -#include "zstd_compress_internal.h" /* ZSTD_hufCTables_t, ZSTD_minGain() */ - - -size_t ZSTD_noCompressLiterals (void* dst, size_t dstCapacity, const void* src, size_t srcSize); - -size_t ZSTD_compressRleLiteralsBlock (void* dst, size_t dstCapacity, const void* src, size_t srcSize); - -size_t ZSTD_compressLiterals (ZSTD_hufCTables_t const* prevHuf, - ZSTD_hufCTables_t* nextHuf, - ZSTD_strategy strategy, int disableLiteralCompression, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - void* entropyWorkspace, size_t entropyWorkspaceSize, - const int bmi2); - -#endif /* ZSTD_COMPRESS_LITERALS_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_compress_sequences.c b/vendor/github.com/DataDog/zstd/zstd_compress_sequences.c deleted file mode 100644 index 0ff7a268..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_compress_sequences.c +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - /*-************************************* - * Dependencies - ***************************************/ -#include "zstd_compress_sequences.h" - -/** - * -log2(x / 256) lookup table for x in [0, 256). - * If x == 0: Return 0 - * Else: Return floor(-log2(x / 256) * 256) - */ -static unsigned const kInverseProbabilityLog256[256] = { - 0, 2048, 1792, 1642, 1536, 1453, 1386, 1329, 1280, 1236, 1197, 1162, - 1130, 1100, 1073, 1047, 1024, 1001, 980, 960, 941, 923, 906, 889, - 874, 859, 844, 830, 817, 804, 791, 779, 768, 756, 745, 734, - 724, 714, 704, 694, 685, 676, 667, 658, 650, 642, 633, 626, - 618, 610, 603, 595, 588, 581, 574, 567, 561, 554, 548, 542, - 535, 529, 523, 517, 512, 506, 500, 495, 489, 484, 478, 473, - 468, 463, 458, 453, 448, 443, 438, 434, 429, 424, 420, 415, - 411, 407, 402, 398, 394, 390, 386, 382, 377, 373, 370, 366, - 362, 358, 354, 350, 347, 343, 339, 336, 332, 329, 325, 322, - 318, 315, 311, 308, 305, 302, 298, 295, 292, 289, 286, 282, - 279, 276, 273, 270, 267, 264, 261, 258, 256, 253, 250, 247, - 244, 241, 239, 236, 233, 230, 228, 225, 222, 220, 217, 215, - 212, 209, 207, 204, 202, 199, 197, 194, 192, 190, 187, 185, - 182, 180, 178, 175, 173, 171, 168, 166, 164, 162, 159, 157, - 155, 153, 151, 149, 146, 144, 142, 140, 138, 136, 134, 132, - 130, 128, 126, 123, 121, 119, 117, 115, 114, 112, 110, 108, - 106, 104, 102, 100, 98, 96, 94, 93, 91, 89, 87, 85, - 83, 82, 80, 78, 76, 74, 73, 71, 69, 67, 66, 64, - 62, 61, 59, 57, 55, 54, 52, 50, 49, 47, 46, 44, - 42, 41, 39, 37, 36, 34, 33, 31, 30, 28, 26, 25, - 23, 22, 20, 19, 17, 16, 14, 13, 11, 10, 8, 7, - 5, 4, 2, 1, -}; - -static unsigned ZSTD_getFSEMaxSymbolValue(FSE_CTable const* ctable) { - void const* ptr = ctable; - U16 const* u16ptr = (U16 const*)ptr; - U32 const maxSymbolValue = MEM_read16(u16ptr + 1); - return maxSymbolValue; -} - -/** - * Returns the cost in bytes of encoding the normalized count header. - * Returns an error if any of the helper functions return an error. - */ -static size_t ZSTD_NCountCost(unsigned const* count, unsigned const max, - size_t const nbSeq, unsigned const FSELog) -{ - BYTE wksp[FSE_NCOUNTBOUND]; - S16 norm[MaxSeq + 1]; - const U32 tableLog = FSE_optimalTableLog(FSELog, nbSeq, max); - FORWARD_IF_ERROR(FSE_normalizeCount(norm, tableLog, count, nbSeq, max)); - return FSE_writeNCount(wksp, sizeof(wksp), norm, max, tableLog); -} - -/** - * Returns the cost in bits of encoding the distribution described by count - * using the entropy bound. - */ -static size_t ZSTD_entropyCost(unsigned const* count, unsigned const max, size_t const total) -{ - unsigned cost = 0; - unsigned s; - for (s = 0; s <= max; ++s) { - unsigned norm = (unsigned)((256 * count[s]) / total); - if (count[s] != 0 && norm == 0) - norm = 1; - assert(count[s] < total); - cost += count[s] * kInverseProbabilityLog256[norm]; - } - return cost >> 8; -} - -/** - * Returns the cost in bits of encoding the distribution in count using ctable. - * Returns an error if ctable cannot represent all the symbols in count. - */ -static size_t ZSTD_fseBitCost( - FSE_CTable const* ctable, - unsigned const* count, - unsigned const max) -{ - unsigned const kAccuracyLog = 8; - size_t cost = 0; - unsigned s; - FSE_CState_t cstate; - FSE_initCState(&cstate, ctable); - RETURN_ERROR_IF(ZSTD_getFSEMaxSymbolValue(ctable) < max, GENERIC, - "Repeat FSE_CTable has maxSymbolValue %u < %u", - ZSTD_getFSEMaxSymbolValue(ctable), max); - for (s = 0; s <= max; ++s) { - unsigned const tableLog = cstate.stateLog; - unsigned const badCost = (tableLog + 1) << kAccuracyLog; - unsigned const bitCost = FSE_bitCost(cstate.symbolTT, tableLog, s, kAccuracyLog); - if (count[s] == 0) - continue; - RETURN_ERROR_IF(bitCost >= badCost, GENERIC, - "Repeat FSE_CTable has Prob[%u] == 0", s); - cost += count[s] * bitCost; - } - return cost >> kAccuracyLog; -} - -/** - * Returns the cost in bits of encoding the distribution in count using the - * table described by norm. The max symbol support by norm is assumed >= max. - * norm must be valid for every symbol with non-zero probability in count. - */ -static size_t ZSTD_crossEntropyCost(short const* norm, unsigned accuracyLog, - unsigned const* count, unsigned const max) -{ - unsigned const shift = 8 - accuracyLog; - size_t cost = 0; - unsigned s; - assert(accuracyLog <= 8); - for (s = 0; s <= max; ++s) { - unsigned const normAcc = norm[s] != -1 ? norm[s] : 1; - unsigned const norm256 = normAcc << shift; - assert(norm256 > 0); - assert(norm256 < 256); - cost += count[s] * kInverseProbabilityLog256[norm256]; - } - return cost >> 8; -} - -symbolEncodingType_e -ZSTD_selectEncodingType( - FSE_repeat* repeatMode, unsigned const* count, unsigned const max, - size_t const mostFrequent, size_t nbSeq, unsigned const FSELog, - FSE_CTable const* prevCTable, - short const* defaultNorm, U32 defaultNormLog, - ZSTD_defaultPolicy_e const isDefaultAllowed, - ZSTD_strategy const strategy) -{ - ZSTD_STATIC_ASSERT(ZSTD_defaultDisallowed == 0 && ZSTD_defaultAllowed != 0); - if (mostFrequent == nbSeq) { - *repeatMode = FSE_repeat_none; - if (isDefaultAllowed && nbSeq <= 2) { - /* Prefer set_basic over set_rle when there are 2 or less symbols, - * since RLE uses 1 byte, but set_basic uses 5-6 bits per symbol. - * If basic encoding isn't possible, always choose RLE. - */ - DEBUGLOG(5, "Selected set_basic"); - return set_basic; - } - DEBUGLOG(5, "Selected set_rle"); - return set_rle; - } - if (strategy < ZSTD_lazy) { - if (isDefaultAllowed) { - size_t const staticFse_nbSeq_max = 1000; - size_t const mult = 10 - strategy; - size_t const baseLog = 3; - size_t const dynamicFse_nbSeq_min = (((size_t)1 << defaultNormLog) * mult) >> baseLog; /* 28-36 for offset, 56-72 for lengths */ - assert(defaultNormLog >= 5 && defaultNormLog <= 6); /* xx_DEFAULTNORMLOG */ - assert(mult <= 9 && mult >= 7); - if ( (*repeatMode == FSE_repeat_valid) - && (nbSeq < staticFse_nbSeq_max) ) { - DEBUGLOG(5, "Selected set_repeat"); - return set_repeat; - } - if ( (nbSeq < dynamicFse_nbSeq_min) - || (mostFrequent < (nbSeq >> (defaultNormLog-1))) ) { - DEBUGLOG(5, "Selected set_basic"); - /* The format allows default tables to be repeated, but it isn't useful. - * When using simple heuristics to select encoding type, we don't want - * to confuse these tables with dictionaries. When running more careful - * analysis, we don't need to waste time checking both repeating tables - * and default tables. - */ - *repeatMode = FSE_repeat_none; - return set_basic; - } - } - } else { - size_t const basicCost = isDefaultAllowed ? ZSTD_crossEntropyCost(defaultNorm, defaultNormLog, count, max) : ERROR(GENERIC); - size_t const repeatCost = *repeatMode != FSE_repeat_none ? ZSTD_fseBitCost(prevCTable, count, max) : ERROR(GENERIC); - size_t const NCountCost = ZSTD_NCountCost(count, max, nbSeq, FSELog); - size_t const compressedCost = (NCountCost << 3) + ZSTD_entropyCost(count, max, nbSeq); - - if (isDefaultAllowed) { - assert(!ZSTD_isError(basicCost)); - assert(!(*repeatMode == FSE_repeat_valid && ZSTD_isError(repeatCost))); - } - assert(!ZSTD_isError(NCountCost)); - assert(compressedCost < ERROR(maxCode)); - DEBUGLOG(5, "Estimated bit costs: basic=%u\trepeat=%u\tcompressed=%u", - (unsigned)basicCost, (unsigned)repeatCost, (unsigned)compressedCost); - if (basicCost <= repeatCost && basicCost <= compressedCost) { - DEBUGLOG(5, "Selected set_basic"); - assert(isDefaultAllowed); - *repeatMode = FSE_repeat_none; - return set_basic; - } - if (repeatCost <= compressedCost) { - DEBUGLOG(5, "Selected set_repeat"); - assert(!ZSTD_isError(repeatCost)); - return set_repeat; - } - assert(compressedCost < basicCost && compressedCost < repeatCost); - } - DEBUGLOG(5, "Selected set_compressed"); - *repeatMode = FSE_repeat_check; - return set_compressed; -} - -size_t -ZSTD_buildCTable(void* dst, size_t dstCapacity, - FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type, - unsigned* count, U32 max, - const BYTE* codeTable, size_t nbSeq, - const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax, - const FSE_CTable* prevCTable, size_t prevCTableSize, - void* entropyWorkspace, size_t entropyWorkspaceSize) -{ - BYTE* op = (BYTE*)dst; - const BYTE* const oend = op + dstCapacity; - DEBUGLOG(6, "ZSTD_buildCTable (dstCapacity=%u)", (unsigned)dstCapacity); - - switch (type) { - case set_rle: - FORWARD_IF_ERROR(FSE_buildCTable_rle(nextCTable, (BYTE)max)); - RETURN_ERROR_IF(dstCapacity==0, dstSize_tooSmall); - *op = codeTable[0]; - return 1; - case set_repeat: - memcpy(nextCTable, prevCTable, prevCTableSize); - return 0; - case set_basic: - FORWARD_IF_ERROR(FSE_buildCTable_wksp(nextCTable, defaultNorm, defaultMax, defaultNormLog, entropyWorkspace, entropyWorkspaceSize)); /* note : could be pre-calculated */ - return 0; - case set_compressed: { - S16 norm[MaxSeq + 1]; - size_t nbSeq_1 = nbSeq; - const U32 tableLog = FSE_optimalTableLog(FSELog, nbSeq, max); - if (count[codeTable[nbSeq-1]] > 1) { - count[codeTable[nbSeq-1]]--; - nbSeq_1--; - } - assert(nbSeq_1 > 1); - FORWARD_IF_ERROR(FSE_normalizeCount(norm, tableLog, count, nbSeq_1, max)); - { size_t const NCountSize = FSE_writeNCount(op, oend - op, norm, max, tableLog); /* overflow protected */ - FORWARD_IF_ERROR(NCountSize); - FORWARD_IF_ERROR(FSE_buildCTable_wksp(nextCTable, norm, max, tableLog, entropyWorkspace, entropyWorkspaceSize)); - return NCountSize; - } - } - default: assert(0); RETURN_ERROR(GENERIC); - } -} - -FORCE_INLINE_TEMPLATE size_t -ZSTD_encodeSequences_body( - void* dst, size_t dstCapacity, - FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, - FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, - FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, - seqDef const* sequences, size_t nbSeq, int longOffsets) -{ - BIT_CStream_t blockStream; - FSE_CState_t stateMatchLength; - FSE_CState_t stateOffsetBits; - FSE_CState_t stateLitLength; - - RETURN_ERROR_IF( - ERR_isError(BIT_initCStream(&blockStream, dst, dstCapacity)), - dstSize_tooSmall, "not enough space remaining"); - DEBUGLOG(6, "available space for bitstream : %i (dstCapacity=%u)", - (int)(blockStream.endPtr - blockStream.startPtr), - (unsigned)dstCapacity); - - /* first symbols */ - FSE_initCState2(&stateMatchLength, CTable_MatchLength, mlCodeTable[nbSeq-1]); - FSE_initCState2(&stateOffsetBits, CTable_OffsetBits, ofCodeTable[nbSeq-1]); - FSE_initCState2(&stateLitLength, CTable_LitLength, llCodeTable[nbSeq-1]); - BIT_addBits(&blockStream, sequences[nbSeq-1].litLength, LL_bits[llCodeTable[nbSeq-1]]); - if (MEM_32bits()) BIT_flushBits(&blockStream); - BIT_addBits(&blockStream, sequences[nbSeq-1].matchLength, ML_bits[mlCodeTable[nbSeq-1]]); - if (MEM_32bits()) BIT_flushBits(&blockStream); - if (longOffsets) { - U32 const ofBits = ofCodeTable[nbSeq-1]; - int const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1); - if (extraBits) { - BIT_addBits(&blockStream, sequences[nbSeq-1].offset, extraBits); - BIT_flushBits(&blockStream); - } - BIT_addBits(&blockStream, sequences[nbSeq-1].offset >> extraBits, - ofBits - extraBits); - } else { - BIT_addBits(&blockStream, sequences[nbSeq-1].offset, ofCodeTable[nbSeq-1]); - } - BIT_flushBits(&blockStream); - - { size_t n; - for (n=nbSeq-2 ; n= 64-7-(LLFSELog+MLFSELog+OffFSELog))) - BIT_flushBits(&blockStream); /* (7)*/ - BIT_addBits(&blockStream, sequences[n].litLength, llBits); - if (MEM_32bits() && ((llBits+mlBits)>24)) BIT_flushBits(&blockStream); - BIT_addBits(&blockStream, sequences[n].matchLength, mlBits); - if (MEM_32bits() || (ofBits+mlBits+llBits > 56)) BIT_flushBits(&blockStream); - if (longOffsets) { - int const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN-1); - if (extraBits) { - BIT_addBits(&blockStream, sequences[n].offset, extraBits); - BIT_flushBits(&blockStream); /* (7)*/ - } - BIT_addBits(&blockStream, sequences[n].offset >> extraBits, - ofBits - extraBits); /* 31 */ - } else { - BIT_addBits(&blockStream, sequences[n].offset, ofBits); /* 31 */ - } - BIT_flushBits(&blockStream); /* (7)*/ - DEBUGLOG(7, "remaining space : %i", (int)(blockStream.endPtr - blockStream.ptr)); - } } - - DEBUGLOG(6, "ZSTD_encodeSequences: flushing ML state with %u bits", stateMatchLength.stateLog); - FSE_flushCState(&blockStream, &stateMatchLength); - DEBUGLOG(6, "ZSTD_encodeSequences: flushing Off state with %u bits", stateOffsetBits.stateLog); - FSE_flushCState(&blockStream, &stateOffsetBits); - DEBUGLOG(6, "ZSTD_encodeSequences: flushing LL state with %u bits", stateLitLength.stateLog); - FSE_flushCState(&blockStream, &stateLitLength); - - { size_t const streamSize = BIT_closeCStream(&blockStream); - RETURN_ERROR_IF(streamSize==0, dstSize_tooSmall, "not enough space"); - return streamSize; - } -} - -static size_t -ZSTD_encodeSequences_default( - void* dst, size_t dstCapacity, - FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, - FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, - FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, - seqDef const* sequences, size_t nbSeq, int longOffsets) -{ - return ZSTD_encodeSequences_body(dst, dstCapacity, - CTable_MatchLength, mlCodeTable, - CTable_OffsetBits, ofCodeTable, - CTable_LitLength, llCodeTable, - sequences, nbSeq, longOffsets); -} - - -#if DYNAMIC_BMI2 - -static TARGET_ATTRIBUTE("bmi2") size_t -ZSTD_encodeSequences_bmi2( - void* dst, size_t dstCapacity, - FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, - FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, - FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, - seqDef const* sequences, size_t nbSeq, int longOffsets) -{ - return ZSTD_encodeSequences_body(dst, dstCapacity, - CTable_MatchLength, mlCodeTable, - CTable_OffsetBits, ofCodeTable, - CTable_LitLength, llCodeTable, - sequences, nbSeq, longOffsets); -} - -#endif - -size_t ZSTD_encodeSequences( - void* dst, size_t dstCapacity, - FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, - FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, - FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, - seqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2) -{ - DEBUGLOG(5, "ZSTD_encodeSequences: dstCapacity = %u", (unsigned)dstCapacity); -#if DYNAMIC_BMI2 - if (bmi2) { - return ZSTD_encodeSequences_bmi2(dst, dstCapacity, - CTable_MatchLength, mlCodeTable, - CTable_OffsetBits, ofCodeTable, - CTable_LitLength, llCodeTable, - sequences, nbSeq, longOffsets); - } -#endif - (void)bmi2; - return ZSTD_encodeSequences_default(dst, dstCapacity, - CTable_MatchLength, mlCodeTable, - CTable_OffsetBits, ofCodeTable, - CTable_LitLength, llCodeTable, - sequences, nbSeq, longOffsets); -} diff --git a/vendor/github.com/DataDog/zstd/zstd_compress_sequences.h b/vendor/github.com/DataDog/zstd/zstd_compress_sequences.h deleted file mode 100644 index 57e8e367..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_compress_sequences.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_COMPRESS_SEQUENCES_H -#define ZSTD_COMPRESS_SEQUENCES_H - -#include "fse.h" /* FSE_repeat, FSE_CTable */ -#include "zstd_internal.h" /* symbolEncodingType_e, ZSTD_strategy */ - -typedef enum { - ZSTD_defaultDisallowed = 0, - ZSTD_defaultAllowed = 1 -} ZSTD_defaultPolicy_e; - -symbolEncodingType_e -ZSTD_selectEncodingType( - FSE_repeat* repeatMode, unsigned const* count, unsigned const max, - size_t const mostFrequent, size_t nbSeq, unsigned const FSELog, - FSE_CTable const* prevCTable, - short const* defaultNorm, U32 defaultNormLog, - ZSTD_defaultPolicy_e const isDefaultAllowed, - ZSTD_strategy const strategy); - -size_t -ZSTD_buildCTable(void* dst, size_t dstCapacity, - FSE_CTable* nextCTable, U32 FSELog, symbolEncodingType_e type, - unsigned* count, U32 max, - const BYTE* codeTable, size_t nbSeq, - const S16* defaultNorm, U32 defaultNormLog, U32 defaultMax, - const FSE_CTable* prevCTable, size_t prevCTableSize, - void* entropyWorkspace, size_t entropyWorkspaceSize); - -size_t ZSTD_encodeSequences( - void* dst, size_t dstCapacity, - FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, - FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, - FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, - seqDef const* sequences, size_t nbSeq, int longOffsets, int bmi2); - -#endif /* ZSTD_COMPRESS_SEQUENCES_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_cwksp.h b/vendor/github.com/DataDog/zstd/zstd_cwksp.h deleted file mode 100644 index fc9765bd..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_cwksp.h +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_CWKSP_H -#define ZSTD_CWKSP_H - -/*-************************************* -* Dependencies -***************************************/ -#include "zstd_internal.h" - -#if defined (__cplusplus) -extern "C" { -#endif - -/*-************************************* -* Constants -***************************************/ - -/* define "workspace is too large" as this number of times larger than needed */ -#define ZSTD_WORKSPACETOOLARGE_FACTOR 3 - -/* when workspace is continuously too large - * during at least this number of times, - * context's memory usage is considered wasteful, - * because it's sized to handle a worst case scenario which rarely happens. - * In which case, resize it down to free some memory */ -#define ZSTD_WORKSPACETOOLARGE_MAXDURATION 128 - -/* Since the workspace is effectively its own little malloc implementation / - * arena, when we run under ASAN, we should similarly insert redzones between - * each internal element of the workspace, so ASAN will catch overruns that - * reach outside an object but that stay inside the workspace. - * - * This defines the size of that redzone. - */ -#ifndef ZSTD_CWKSP_ASAN_REDZONE_SIZE -#define ZSTD_CWKSP_ASAN_REDZONE_SIZE 128 -#endif - -/*-************************************* -* Structures -***************************************/ -typedef enum { - ZSTD_cwksp_alloc_objects, - ZSTD_cwksp_alloc_buffers, - ZSTD_cwksp_alloc_aligned -} ZSTD_cwksp_alloc_phase_e; - -/** - * Zstd fits all its internal datastructures into a single continuous buffer, - * so that it only needs to perform a single OS allocation (or so that a buffer - * can be provided to it and it can perform no allocations at all). This buffer - * is called the workspace. - * - * Several optimizations complicate that process of allocating memory ranges - * from this workspace for each internal datastructure: - * - * - These different internal datastructures have different setup requirements: - * - * - The static objects need to be cleared once and can then be trivially - * reused for each compression. - * - * - Various buffers don't need to be initialized at all--they are always - * written into before they're read. - * - * - The matchstate tables have a unique requirement that they don't need - * their memory to be totally cleared, but they do need the memory to have - * some bound, i.e., a guarantee that all values in the memory they've been - * allocated is less than some maximum value (which is the starting value - * for the indices that they will then use for compression). When this - * guarantee is provided to them, they can use the memory without any setup - * work. When it can't, they have to clear the area. - * - * - These buffers also have different alignment requirements. - * - * - We would like to reuse the objects in the workspace for multiple - * compressions without having to perform any expensive reallocation or - * reinitialization work. - * - * - We would like to be able to efficiently reuse the workspace across - * multiple compressions **even when the compression parameters change** and - * we need to resize some of the objects (where possible). - * - * To attempt to manage this buffer, given these constraints, the ZSTD_cwksp - * abstraction was created. It works as follows: - * - * Workspace Layout: - * - * [ ... workspace ... ] - * [objects][tables ... ->] free space [<- ... aligned][<- ... buffers] - * - * The various objects that live in the workspace are divided into the - * following categories, and are allocated separately: - * - * - Static objects: this is optionally the enclosing ZSTD_CCtx or ZSTD_CDict, - * so that literally everything fits in a single buffer. Note: if present, - * this must be the first object in the workspace, since ZSTD_free{CCtx, - * CDict}() rely on a pointer comparison to see whether one or two frees are - * required. - * - * - Fixed size objects: these are fixed-size, fixed-count objects that are - * nonetheless "dynamically" allocated in the workspace so that we can - * control how they're initialized separately from the broader ZSTD_CCtx. - * Examples: - * - Entropy Workspace - * - 2 x ZSTD_compressedBlockState_t - * - CDict dictionary contents - * - * - Tables: these are any of several different datastructures (hash tables, - * chain tables, binary trees) that all respect a common format: they are - * uint32_t arrays, all of whose values are between 0 and (nextSrc - base). - * Their sizes depend on the cparams. - * - * - Aligned: these buffers are used for various purposes that require 4 byte - * alignment, but don't require any initialization before they're used. - * - * - Buffers: these buffers are used for various purposes that don't require - * any alignment or initialization before they're used. This means they can - * be moved around at no cost for a new compression. - * - * Allocating Memory: - * - * The various types of objects must be allocated in order, so they can be - * correctly packed into the workspace buffer. That order is: - * - * 1. Objects - * 2. Buffers - * 3. Aligned - * 4. Tables - * - * Attempts to reserve objects of different types out of order will fail. - */ -typedef struct { - void* workspace; - void* workspaceEnd; - - void* objectEnd; - void* tableEnd; - void* tableValidEnd; - void* allocStart; - - int allocFailed; - int workspaceOversizedDuration; - ZSTD_cwksp_alloc_phase_e phase; -} ZSTD_cwksp; - -/*-************************************* -* Functions -***************************************/ - -MEM_STATIC size_t ZSTD_cwksp_available_space(ZSTD_cwksp* ws); - -MEM_STATIC void ZSTD_cwksp_assert_internal_consistency(ZSTD_cwksp* ws) { - (void)ws; - assert(ws->workspace <= ws->objectEnd); - assert(ws->objectEnd <= ws->tableEnd); - assert(ws->objectEnd <= ws->tableValidEnd); - assert(ws->tableEnd <= ws->allocStart); - assert(ws->tableValidEnd <= ws->allocStart); - assert(ws->allocStart <= ws->workspaceEnd); -} - -/** - * Align must be a power of 2. - */ -MEM_STATIC size_t ZSTD_cwksp_align(size_t size, size_t const align) { - size_t const mask = align - 1; - assert((align & mask) == 0); - return (size + mask) & ~mask; -} - -/** - * Use this to determine how much space in the workspace we will consume to - * allocate this object. (Normally it should be exactly the size of the object, - * but under special conditions, like ASAN, where we pad each object, it might - * be larger.) - * - * Since tables aren't currently redzoned, you don't need to call through this - * to figure out how much space you need for the matchState tables. Everything - * else is though. - */ -MEM_STATIC size_t ZSTD_cwksp_alloc_size(size_t size) { -#if defined (ADDRESS_SANITIZER) && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) - return size + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE; -#else - return size; -#endif -} - -MEM_STATIC void ZSTD_cwksp_internal_advance_phase( - ZSTD_cwksp* ws, ZSTD_cwksp_alloc_phase_e phase) { - assert(phase >= ws->phase); - if (phase > ws->phase) { - if (ws->phase < ZSTD_cwksp_alloc_buffers && - phase >= ZSTD_cwksp_alloc_buffers) { - ws->tableValidEnd = ws->objectEnd; - } - if (ws->phase < ZSTD_cwksp_alloc_aligned && - phase >= ZSTD_cwksp_alloc_aligned) { - /* If unaligned allocations down from a too-large top have left us - * unaligned, we need to realign our alloc ptr. Technically, this - * can consume space that is unaccounted for in the neededSpace - * calculation. However, I believe this can only happen when the - * workspace is too large, and specifically when it is too large - * by a larger margin than the space that will be consumed. */ - /* TODO: cleaner, compiler warning friendly way to do this??? */ - ws->allocStart = (BYTE*)ws->allocStart - ((size_t)ws->allocStart & (sizeof(U32)-1)); - if (ws->allocStart < ws->tableValidEnd) { - ws->tableValidEnd = ws->allocStart; - } - } - ws->phase = phase; - } -} - -/** - * Returns whether this object/buffer/etc was allocated in this workspace. - */ -MEM_STATIC int ZSTD_cwksp_owns_buffer(const ZSTD_cwksp* ws, const void* ptr) { - return (ptr != NULL) && (ws->workspace <= ptr) && (ptr <= ws->workspaceEnd); -} - -/** - * Internal function. Do not use directly. - */ -MEM_STATIC void* ZSTD_cwksp_reserve_internal( - ZSTD_cwksp* ws, size_t bytes, ZSTD_cwksp_alloc_phase_e phase) { - void* alloc; - void* bottom = ws->tableEnd; - ZSTD_cwksp_internal_advance_phase(ws, phase); - alloc = (BYTE *)ws->allocStart - bytes; - -#if defined (ADDRESS_SANITIZER) && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) - /* over-reserve space */ - alloc = (BYTE *)alloc - 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE; -#endif - - DEBUGLOG(5, "cwksp: reserving %p %zd bytes, %zd bytes remaining", - alloc, bytes, ZSTD_cwksp_available_space(ws) - bytes); - ZSTD_cwksp_assert_internal_consistency(ws); - assert(alloc >= bottom); - if (alloc < bottom) { - DEBUGLOG(4, "cwksp: alloc failed!"); - ws->allocFailed = 1; - return NULL; - } - if (alloc < ws->tableValidEnd) { - ws->tableValidEnd = alloc; - } - ws->allocStart = alloc; - -#if defined (ADDRESS_SANITIZER) && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) - /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on - * either size. */ - alloc = (BYTE *)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE; - __asan_unpoison_memory_region(alloc, bytes); -#endif - - return alloc; -} - -/** - * Reserves and returns unaligned memory. - */ -MEM_STATIC BYTE* ZSTD_cwksp_reserve_buffer(ZSTD_cwksp* ws, size_t bytes) { - return (BYTE*)ZSTD_cwksp_reserve_internal(ws, bytes, ZSTD_cwksp_alloc_buffers); -} - -/** - * Reserves and returns memory sized on and aligned on sizeof(unsigned). - */ -MEM_STATIC void* ZSTD_cwksp_reserve_aligned(ZSTD_cwksp* ws, size_t bytes) { - assert((bytes & (sizeof(U32)-1)) == 0); - return ZSTD_cwksp_reserve_internal(ws, ZSTD_cwksp_align(bytes, sizeof(U32)), ZSTD_cwksp_alloc_aligned); -} - -/** - * Aligned on sizeof(unsigned). These buffers have the special property that - * their values remain constrained, allowing us to re-use them without - * memset()-ing them. - */ -MEM_STATIC void* ZSTD_cwksp_reserve_table(ZSTD_cwksp* ws, size_t bytes) { - const ZSTD_cwksp_alloc_phase_e phase = ZSTD_cwksp_alloc_aligned; - void* alloc = ws->tableEnd; - void* end = (BYTE *)alloc + bytes; - void* top = ws->allocStart; - - DEBUGLOG(5, "cwksp: reserving %p table %zd bytes, %zd bytes remaining", - alloc, bytes, ZSTD_cwksp_available_space(ws) - bytes); - assert((bytes & (sizeof(U32)-1)) == 0); - ZSTD_cwksp_internal_advance_phase(ws, phase); - ZSTD_cwksp_assert_internal_consistency(ws); - assert(end <= top); - if (end > top) { - DEBUGLOG(4, "cwksp: table alloc failed!"); - ws->allocFailed = 1; - return NULL; - } - ws->tableEnd = end; - -#if defined (ADDRESS_SANITIZER) && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) - __asan_unpoison_memory_region(alloc, bytes); -#endif - - return alloc; -} - -/** - * Aligned on sizeof(void*). - */ -MEM_STATIC void* ZSTD_cwksp_reserve_object(ZSTD_cwksp* ws, size_t bytes) { - size_t roundedBytes = ZSTD_cwksp_align(bytes, sizeof(void*)); - void* alloc = ws->objectEnd; - void* end = (BYTE*)alloc + roundedBytes; - -#if defined (ADDRESS_SANITIZER) && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) - /* over-reserve space */ - end = (BYTE *)end + 2 * ZSTD_CWKSP_ASAN_REDZONE_SIZE; -#endif - - DEBUGLOG(5, - "cwksp: reserving %p object %zd bytes (rounded to %zd), %zd bytes remaining", - alloc, bytes, roundedBytes, ZSTD_cwksp_available_space(ws) - roundedBytes); - assert(((size_t)alloc & (sizeof(void*)-1)) == 0); - assert((bytes & (sizeof(void*)-1)) == 0); - ZSTD_cwksp_assert_internal_consistency(ws); - /* we must be in the first phase, no advance is possible */ - if (ws->phase != ZSTD_cwksp_alloc_objects || end > ws->workspaceEnd) { - DEBUGLOG(4, "cwksp: object alloc failed!"); - ws->allocFailed = 1; - return NULL; - } - ws->objectEnd = end; - ws->tableEnd = end; - ws->tableValidEnd = end; - -#if defined (ADDRESS_SANITIZER) && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) - /* Move alloc so there's ZSTD_CWKSP_ASAN_REDZONE_SIZE unused space on - * either size. */ - alloc = (BYTE *)alloc + ZSTD_CWKSP_ASAN_REDZONE_SIZE; - __asan_unpoison_memory_region(alloc, bytes); -#endif - - return alloc; -} - -MEM_STATIC void ZSTD_cwksp_mark_tables_dirty(ZSTD_cwksp* ws) { - DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_dirty"); - -#if defined (MEMORY_SANITIZER) && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) - /* To validate that the table re-use logic is sound, and that we don't - * access table space that we haven't cleaned, we re-"poison" the table - * space every time we mark it dirty. */ - { - size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd; - assert(__msan_test_shadow(ws->objectEnd, size) == -1); - __msan_poison(ws->objectEnd, size); - } -#endif - - assert(ws->tableValidEnd >= ws->objectEnd); - assert(ws->tableValidEnd <= ws->allocStart); - ws->tableValidEnd = ws->objectEnd; - ZSTD_cwksp_assert_internal_consistency(ws); -} - -MEM_STATIC void ZSTD_cwksp_mark_tables_clean(ZSTD_cwksp* ws) { - DEBUGLOG(4, "cwksp: ZSTD_cwksp_mark_tables_clean"); - assert(ws->tableValidEnd >= ws->objectEnd); - assert(ws->tableValidEnd <= ws->allocStart); - if (ws->tableValidEnd < ws->tableEnd) { - ws->tableValidEnd = ws->tableEnd; - } - ZSTD_cwksp_assert_internal_consistency(ws); -} - -/** - * Zero the part of the allocated tables not already marked clean. - */ -MEM_STATIC void ZSTD_cwksp_clean_tables(ZSTD_cwksp* ws) { - DEBUGLOG(4, "cwksp: ZSTD_cwksp_clean_tables"); - assert(ws->tableValidEnd >= ws->objectEnd); - assert(ws->tableValidEnd <= ws->allocStart); - if (ws->tableValidEnd < ws->tableEnd) { - memset(ws->tableValidEnd, 0, (BYTE*)ws->tableEnd - (BYTE*)ws->tableValidEnd); - } - ZSTD_cwksp_mark_tables_clean(ws); -} - -/** - * Invalidates table allocations. - * All other allocations remain valid. - */ -MEM_STATIC void ZSTD_cwksp_clear_tables(ZSTD_cwksp* ws) { - DEBUGLOG(4, "cwksp: clearing tables!"); - -#if defined (ADDRESS_SANITIZER) && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) - { - size_t size = (BYTE*)ws->tableValidEnd - (BYTE*)ws->objectEnd; - __asan_poison_memory_region(ws->objectEnd, size); - } -#endif - - ws->tableEnd = ws->objectEnd; - ZSTD_cwksp_assert_internal_consistency(ws); -} - -/** - * Invalidates all buffer, aligned, and table allocations. - * Object allocations remain valid. - */ -MEM_STATIC void ZSTD_cwksp_clear(ZSTD_cwksp* ws) { - DEBUGLOG(4, "cwksp: clearing!"); - -#if defined (MEMORY_SANITIZER) && !defined (ZSTD_MSAN_DONT_POISON_WORKSPACE) - /* To validate that the context re-use logic is sound, and that we don't - * access stuff that this compression hasn't initialized, we re-"poison" - * the workspace (or at least the non-static, non-table parts of it) - * every time we start a new compression. */ - { - size_t size = (BYTE*)ws->workspaceEnd - (BYTE*)ws->tableValidEnd; - __msan_poison(ws->tableValidEnd, size); - } -#endif - -#if defined (ADDRESS_SANITIZER) && !defined (ZSTD_ASAN_DONT_POISON_WORKSPACE) - { - size_t size = (BYTE*)ws->workspaceEnd - (BYTE*)ws->objectEnd; - __asan_poison_memory_region(ws->objectEnd, size); - } -#endif - - ws->tableEnd = ws->objectEnd; - ws->allocStart = ws->workspaceEnd; - ws->allocFailed = 0; - if (ws->phase > ZSTD_cwksp_alloc_buffers) { - ws->phase = ZSTD_cwksp_alloc_buffers; - } - ZSTD_cwksp_assert_internal_consistency(ws); -} - -/** - * The provided workspace takes ownership of the buffer [start, start+size). - * Any existing values in the workspace are ignored (the previously managed - * buffer, if present, must be separately freed). - */ -MEM_STATIC void ZSTD_cwksp_init(ZSTD_cwksp* ws, void* start, size_t size) { - DEBUGLOG(4, "cwksp: init'ing workspace with %zd bytes", size); - assert(((size_t)start & (sizeof(void*)-1)) == 0); /* ensure correct alignment */ - ws->workspace = start; - ws->workspaceEnd = (BYTE*)start + size; - ws->objectEnd = ws->workspace; - ws->tableValidEnd = ws->objectEnd; - ws->phase = ZSTD_cwksp_alloc_objects; - ZSTD_cwksp_clear(ws); - ws->workspaceOversizedDuration = 0; - ZSTD_cwksp_assert_internal_consistency(ws); -} - -MEM_STATIC size_t ZSTD_cwksp_create(ZSTD_cwksp* ws, size_t size, ZSTD_customMem customMem) { - void* workspace = ZSTD_malloc(size, customMem); - DEBUGLOG(4, "cwksp: creating new workspace with %zd bytes", size); - RETURN_ERROR_IF(workspace == NULL, memory_allocation); - ZSTD_cwksp_init(ws, workspace, size); - return 0; -} - -MEM_STATIC void ZSTD_cwksp_free(ZSTD_cwksp* ws, ZSTD_customMem customMem) { - void *ptr = ws->workspace; - DEBUGLOG(4, "cwksp: freeing workspace"); - memset(ws, 0, sizeof(ZSTD_cwksp)); - ZSTD_free(ptr, customMem); -} - -/** - * Moves the management of a workspace from one cwksp to another. The src cwksp - * is left in an invalid state (src must be re-init()'ed before its used again). - */ -MEM_STATIC void ZSTD_cwksp_move(ZSTD_cwksp* dst, ZSTD_cwksp* src) { - *dst = *src; - memset(src, 0, sizeof(ZSTD_cwksp)); -} - -MEM_STATIC size_t ZSTD_cwksp_sizeof(const ZSTD_cwksp* ws) { - return (size_t)((BYTE*)ws->workspaceEnd - (BYTE*)ws->workspace); -} - -MEM_STATIC int ZSTD_cwksp_reserve_failed(const ZSTD_cwksp* ws) { - return ws->allocFailed; -} - -/*-************************************* -* Functions Checking Free Space -***************************************/ - -MEM_STATIC size_t ZSTD_cwksp_available_space(ZSTD_cwksp* ws) { - return (size_t)((BYTE*)ws->allocStart - (BYTE*)ws->tableEnd); -} - -MEM_STATIC int ZSTD_cwksp_check_available(ZSTD_cwksp* ws, size_t additionalNeededSpace) { - return ZSTD_cwksp_available_space(ws) >= additionalNeededSpace; -} - -MEM_STATIC int ZSTD_cwksp_check_too_large(ZSTD_cwksp* ws, size_t additionalNeededSpace) { - return ZSTD_cwksp_check_available( - ws, additionalNeededSpace * ZSTD_WORKSPACETOOLARGE_FACTOR); -} - -MEM_STATIC int ZSTD_cwksp_check_wasteful(ZSTD_cwksp* ws, size_t additionalNeededSpace) { - return ZSTD_cwksp_check_too_large(ws, additionalNeededSpace) - && ws->workspaceOversizedDuration > ZSTD_WORKSPACETOOLARGE_MAXDURATION; -} - -MEM_STATIC void ZSTD_cwksp_bump_oversized_duration( - ZSTD_cwksp* ws, size_t additionalNeededSpace) { - if (ZSTD_cwksp_check_too_large(ws, additionalNeededSpace)) { - ws->workspaceOversizedDuration++; - } else { - ws->workspaceOversizedDuration = 0; - } -} - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_CWKSP_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_ddict.c b/vendor/github.com/DataDog/zstd/zstd_ddict.c deleted file mode 100644 index 0af3d23b..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_ddict.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/* zstd_ddict.c : - * concentrates all logic that needs to know the internals of ZSTD_DDict object */ - -/*-******************************************************* -* Dependencies -*********************************************************/ -#include /* memcpy, memmove, memset */ -#include "cpu.h" /* bmi2 */ -#include "mem.h" /* low level memory routines */ -#define FSE_STATIC_LINKING_ONLY -#include "fse.h" -#define HUF_STATIC_LINKING_ONLY -#include "huf.h" -#include "zstd_decompress_internal.h" -#include "zstd_ddict.h" - -#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) -# include "zstd_legacy.h" -#endif - - - -/*-******************************************************* -* Types -*********************************************************/ -struct ZSTD_DDict_s { - void* dictBuffer; - const void* dictContent; - size_t dictSize; - ZSTD_entropyDTables_t entropy; - U32 dictID; - U32 entropyPresent; - ZSTD_customMem cMem; -}; /* typedef'd to ZSTD_DDict within "zstd.h" */ - -const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict) -{ - assert(ddict != NULL); - return ddict->dictContent; -} - -size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict) -{ - assert(ddict != NULL); - return ddict->dictSize; -} - -void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict) -{ - DEBUGLOG(4, "ZSTD_copyDDictParameters"); - assert(dctx != NULL); - assert(ddict != NULL); - dctx->dictID = ddict->dictID; - dctx->prefixStart = ddict->dictContent; - dctx->virtualStart = ddict->dictContent; - dctx->dictEnd = (const BYTE*)ddict->dictContent + ddict->dictSize; - dctx->previousDstEnd = dctx->dictEnd; - if (ddict->entropyPresent) { - dctx->litEntropy = 1; - dctx->fseEntropy = 1; - dctx->LLTptr = ddict->entropy.LLTable; - dctx->MLTptr = ddict->entropy.MLTable; - dctx->OFTptr = ddict->entropy.OFTable; - dctx->HUFptr = ddict->entropy.hufTable; - dctx->entropy.rep[0] = ddict->entropy.rep[0]; - dctx->entropy.rep[1] = ddict->entropy.rep[1]; - dctx->entropy.rep[2] = ddict->entropy.rep[2]; - } else { - dctx->litEntropy = 0; - dctx->fseEntropy = 0; - } -} - - -static size_t -ZSTD_loadEntropy_intoDDict(ZSTD_DDict* ddict, - ZSTD_dictContentType_e dictContentType) -{ - ddict->dictID = 0; - ddict->entropyPresent = 0; - if (dictContentType == ZSTD_dct_rawContent) return 0; - - if (ddict->dictSize < 8) { - if (dictContentType == ZSTD_dct_fullDict) - return ERROR(dictionary_corrupted); /* only accept specified dictionaries */ - return 0; /* pure content mode */ - } - { U32 const magic = MEM_readLE32(ddict->dictContent); - if (magic != ZSTD_MAGIC_DICTIONARY) { - if (dictContentType == ZSTD_dct_fullDict) - return ERROR(dictionary_corrupted); /* only accept specified dictionaries */ - return 0; /* pure content mode */ - } - } - ddict->dictID = MEM_readLE32((const char*)ddict->dictContent + ZSTD_FRAMEIDSIZE); - - /* load entropy tables */ - RETURN_ERROR_IF(ZSTD_isError(ZSTD_loadDEntropy( - &ddict->entropy, ddict->dictContent, ddict->dictSize)), - dictionary_corrupted); - ddict->entropyPresent = 1; - return 0; -} - - -static size_t ZSTD_initDDict_internal(ZSTD_DDict* ddict, - const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType) -{ - if ((dictLoadMethod == ZSTD_dlm_byRef) || (!dict) || (!dictSize)) { - ddict->dictBuffer = NULL; - ddict->dictContent = dict; - if (!dict) dictSize = 0; - } else { - void* const internalBuffer = ZSTD_malloc(dictSize, ddict->cMem); - ddict->dictBuffer = internalBuffer; - ddict->dictContent = internalBuffer; - if (!internalBuffer) return ERROR(memory_allocation); - memcpy(internalBuffer, dict, dictSize); - } - ddict->dictSize = dictSize; - ddict->entropy.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001); /* cover both little and big endian */ - - /* parse dictionary content */ - FORWARD_IF_ERROR( ZSTD_loadEntropy_intoDDict(ddict, dictContentType) ); - - return 0; -} - -ZSTD_DDict* ZSTD_createDDict_advanced(const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType, - ZSTD_customMem customMem) -{ - if (!customMem.customAlloc ^ !customMem.customFree) return NULL; - - { ZSTD_DDict* const ddict = (ZSTD_DDict*) ZSTD_malloc(sizeof(ZSTD_DDict), customMem); - if (ddict == NULL) return NULL; - ddict->cMem = customMem; - { size_t const initResult = ZSTD_initDDict_internal(ddict, - dict, dictSize, - dictLoadMethod, dictContentType); - if (ZSTD_isError(initResult)) { - ZSTD_freeDDict(ddict); - return NULL; - } } - return ddict; - } -} - -/*! ZSTD_createDDict() : -* Create a digested dictionary, to start decompression without startup delay. -* `dict` content is copied inside DDict. -* Consequently, `dict` can be released after `ZSTD_DDict` creation */ -ZSTD_DDict* ZSTD_createDDict(const void* dict, size_t dictSize) -{ - ZSTD_customMem const allocator = { NULL, NULL, NULL }; - return ZSTD_createDDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, allocator); -} - -/*! ZSTD_createDDict_byReference() : - * Create a digested dictionary, to start decompression without startup delay. - * Dictionary content is simply referenced, it will be accessed during decompression. - * Warning : dictBuffer must outlive DDict (DDict must be freed before dictBuffer) */ -ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize) -{ - ZSTD_customMem const allocator = { NULL, NULL, NULL }; - return ZSTD_createDDict_advanced(dictBuffer, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto, allocator); -} - - -const ZSTD_DDict* ZSTD_initStaticDDict( - void* sBuffer, size_t sBufferSize, - const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType) -{ - size_t const neededSpace = sizeof(ZSTD_DDict) - + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize); - ZSTD_DDict* const ddict = (ZSTD_DDict*)sBuffer; - assert(sBuffer != NULL); - assert(dict != NULL); - if ((size_t)sBuffer & 7) return NULL; /* 8-aligned */ - if (sBufferSize < neededSpace) return NULL; - if (dictLoadMethod == ZSTD_dlm_byCopy) { - memcpy(ddict+1, dict, dictSize); /* local copy */ - dict = ddict+1; - } - if (ZSTD_isError( ZSTD_initDDict_internal(ddict, - dict, dictSize, - ZSTD_dlm_byRef, dictContentType) )) - return NULL; - return ddict; -} - - -size_t ZSTD_freeDDict(ZSTD_DDict* ddict) -{ - if (ddict==NULL) return 0; /* support free on NULL */ - { ZSTD_customMem const cMem = ddict->cMem; - ZSTD_free(ddict->dictBuffer, cMem); - ZSTD_free(ddict, cMem); - return 0; - } -} - -/*! ZSTD_estimateDDictSize() : - * Estimate amount of memory that will be needed to create a dictionary for decompression. - * Note : dictionary created by reference using ZSTD_dlm_byRef are smaller */ -size_t ZSTD_estimateDDictSize(size_t dictSize, ZSTD_dictLoadMethod_e dictLoadMethod) -{ - return sizeof(ZSTD_DDict) + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize); -} - -size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict) -{ - if (ddict==NULL) return 0; /* support sizeof on NULL */ - return sizeof(*ddict) + (ddict->dictBuffer ? ddict->dictSize : 0) ; -} - -/*! ZSTD_getDictID_fromDDict() : - * Provides the dictID of the dictionary loaded into `ddict`. - * If @return == 0, the dictionary is not conformant to Zstandard specification, or empty. - * Non-conformant dictionaries can still be loaded, but as content-only dictionaries. */ -unsigned ZSTD_getDictID_fromDDict(const ZSTD_DDict* ddict) -{ - if (ddict==NULL) return 0; - return ZSTD_getDictID_fromDict(ddict->dictContent, ddict->dictSize); -} diff --git a/vendor/github.com/DataDog/zstd/zstd_ddict.h b/vendor/github.com/DataDog/zstd/zstd_ddict.h deleted file mode 100644 index 0479d11b..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_ddict.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -#ifndef ZSTD_DDICT_H -#define ZSTD_DDICT_H - -/*-******************************************************* - * Dependencies - *********************************************************/ -#include /* size_t */ -#include "zstd.h" /* ZSTD_DDict, and several public functions */ - - -/*-******************************************************* - * Interface - *********************************************************/ - -/* note: several prototypes are already published in `zstd.h` : - * ZSTD_createDDict() - * ZSTD_createDDict_byReference() - * ZSTD_createDDict_advanced() - * ZSTD_freeDDict() - * ZSTD_initStaticDDict() - * ZSTD_sizeof_DDict() - * ZSTD_estimateDDictSize() - * ZSTD_getDictID_fromDict() - */ - -const void* ZSTD_DDict_dictContent(const ZSTD_DDict* ddict); -size_t ZSTD_DDict_dictSize(const ZSTD_DDict* ddict); - -void ZSTD_copyDDictParameters(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict); - - - -#endif /* ZSTD_DDICT_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_decompress.c b/vendor/github.com/DataDog/zstd/zstd_decompress.c deleted file mode 100644 index dd4591b7..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_decompress.c +++ /dev/null @@ -1,1769 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -/* *************************************************************** -* Tuning parameters -*****************************************************************/ -/*! - * HEAPMODE : - * Select how default decompression function ZSTD_decompress() allocates its context, - * on stack (0), or into heap (1, default; requires malloc()). - * Note that functions with explicit context such as ZSTD_decompressDCtx() are unaffected. - */ -#ifndef ZSTD_HEAPMODE -# define ZSTD_HEAPMODE 1 -#endif - -/*! -* LEGACY_SUPPORT : -* if set to 1+, ZSTD_decompress() can decode older formats (v0.1+) -*/ -#ifndef ZSTD_LEGACY_SUPPORT -# define ZSTD_LEGACY_SUPPORT 0 -#endif - -/*! - * MAXWINDOWSIZE_DEFAULT : - * maximum window size accepted by DStream __by default__. - * Frames requiring more memory will be rejected. - * It's possible to set a different limit using ZSTD_DCtx_setMaxWindowSize(). - */ -#ifndef ZSTD_MAXWINDOWSIZE_DEFAULT -# define ZSTD_MAXWINDOWSIZE_DEFAULT (((U32)1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) + 1) -#endif - -/*! - * NO_FORWARD_PROGRESS_MAX : - * maximum allowed nb of calls to ZSTD_decompressStream() - * without any forward progress - * (defined as: no byte read from input, and no byte flushed to output) - * before triggering an error. - */ -#ifndef ZSTD_NO_FORWARD_PROGRESS_MAX -# define ZSTD_NO_FORWARD_PROGRESS_MAX 16 -#endif - - -/*-******************************************************* -* Dependencies -*********************************************************/ -#include /* memcpy, memmove, memset */ -#include "cpu.h" /* bmi2 */ -#include "mem.h" /* low level memory routines */ -#define FSE_STATIC_LINKING_ONLY -#include "fse.h" -#define HUF_STATIC_LINKING_ONLY -#include "huf.h" -#include "zstd_internal.h" /* blockProperties_t */ -#include "zstd_decompress_internal.h" /* ZSTD_DCtx */ -#include "zstd_ddict.h" /* ZSTD_DDictDictContent */ -#include "zstd_decompress_block.h" /* ZSTD_decompressBlock_internal */ - -#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) -# include "zstd_legacy.h" -#endif - - -/*-************************************************************* -* Context management -***************************************************************/ -size_t ZSTD_sizeof_DCtx (const ZSTD_DCtx* dctx) -{ - if (dctx==NULL) return 0; /* support sizeof NULL */ - return sizeof(*dctx) - + ZSTD_sizeof_DDict(dctx->ddictLocal) - + dctx->inBuffSize + dctx->outBuffSize; -} - -size_t ZSTD_estimateDCtxSize(void) { return sizeof(ZSTD_DCtx); } - - -static size_t ZSTD_startingInputLength(ZSTD_format_e format) -{ - size_t const startingInputLength = ZSTD_FRAMEHEADERSIZE_PREFIX(format); - /* only supports formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless */ - assert( (format == ZSTD_f_zstd1) || (format == ZSTD_f_zstd1_magicless) ); - return startingInputLength; -} - -static void ZSTD_initDCtx_internal(ZSTD_DCtx* dctx) -{ - dctx->format = ZSTD_f_zstd1; /* ZSTD_decompressBegin() invokes ZSTD_startingInputLength() with argument dctx->format */ - dctx->staticSize = 0; - dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT; - dctx->ddict = NULL; - dctx->ddictLocal = NULL; - dctx->dictEnd = NULL; - dctx->ddictIsCold = 0; - dctx->dictUses = ZSTD_dont_use; - dctx->inBuff = NULL; - dctx->inBuffSize = 0; - dctx->outBuffSize = 0; - dctx->streamStage = zdss_init; - dctx->legacyContext = NULL; - dctx->previousLegacyVersion = 0; - dctx->noForwardProgress = 0; - dctx->bmi2 = ZSTD_cpuid_bmi2(ZSTD_cpuid()); -} - -ZSTD_DCtx* ZSTD_initStaticDCtx(void *workspace, size_t workspaceSize) -{ - ZSTD_DCtx* const dctx = (ZSTD_DCtx*) workspace; - - if ((size_t)workspace & 7) return NULL; /* 8-aligned */ - if (workspaceSize < sizeof(ZSTD_DCtx)) return NULL; /* minimum size */ - - ZSTD_initDCtx_internal(dctx); - dctx->staticSize = workspaceSize; - dctx->inBuff = (char*)(dctx+1); - return dctx; -} - -ZSTD_DCtx* ZSTD_createDCtx_advanced(ZSTD_customMem customMem) -{ - if (!customMem.customAlloc ^ !customMem.customFree) return NULL; - - { ZSTD_DCtx* const dctx = (ZSTD_DCtx*)ZSTD_malloc(sizeof(*dctx), customMem); - if (!dctx) return NULL; - dctx->customMem = customMem; - ZSTD_initDCtx_internal(dctx); - return dctx; - } -} - -ZSTD_DCtx* ZSTD_createDCtx(void) -{ - DEBUGLOG(3, "ZSTD_createDCtx"); - return ZSTD_createDCtx_advanced(ZSTD_defaultCMem); -} - -static void ZSTD_clearDict(ZSTD_DCtx* dctx) -{ - ZSTD_freeDDict(dctx->ddictLocal); - dctx->ddictLocal = NULL; - dctx->ddict = NULL; - dctx->dictUses = ZSTD_dont_use; -} - -size_t ZSTD_freeDCtx(ZSTD_DCtx* dctx) -{ - if (dctx==NULL) return 0; /* support free on NULL */ - RETURN_ERROR_IF(dctx->staticSize, memory_allocation, "not compatible with static DCtx"); - { ZSTD_customMem const cMem = dctx->customMem; - ZSTD_clearDict(dctx); - ZSTD_free(dctx->inBuff, cMem); - dctx->inBuff = NULL; -#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1) - if (dctx->legacyContext) - ZSTD_freeLegacyStreamContext(dctx->legacyContext, dctx->previousLegacyVersion); -#endif - ZSTD_free(dctx, cMem); - return 0; - } -} - -/* no longer useful */ -void ZSTD_copyDCtx(ZSTD_DCtx* dstDCtx, const ZSTD_DCtx* srcDCtx) -{ - size_t const toCopy = (size_t)((char*)(&dstDCtx->inBuff) - (char*)dstDCtx); - memcpy(dstDCtx, srcDCtx, toCopy); /* no need to copy workspace */ -} - - -/*-************************************************************* - * Frame header decoding - ***************************************************************/ - -/*! ZSTD_isFrame() : - * Tells if the content of `buffer` starts with a valid Frame Identifier. - * Note : Frame Identifier is 4 bytes. If `size < 4`, @return will always be 0. - * Note 2 : Legacy Frame Identifiers are considered valid only if Legacy Support is enabled. - * Note 3 : Skippable Frame Identifiers are considered valid. */ -unsigned ZSTD_isFrame(const void* buffer, size_t size) -{ - if (size < ZSTD_FRAMEIDSIZE) return 0; - { U32 const magic = MEM_readLE32(buffer); - if (magic == ZSTD_MAGICNUMBER) return 1; - if ((magic & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) return 1; - } -#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1) - if (ZSTD_isLegacy(buffer, size)) return 1; -#endif - return 0; -} - -/** ZSTD_frameHeaderSize_internal() : - * srcSize must be large enough to reach header size fields. - * note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless. - * @return : size of the Frame Header - * or an error code, which can be tested with ZSTD_isError() */ -static size_t ZSTD_frameHeaderSize_internal(const void* src, size_t srcSize, ZSTD_format_e format) -{ - size_t const minInputSize = ZSTD_startingInputLength(format); - RETURN_ERROR_IF(srcSize < minInputSize, srcSize_wrong); - - { BYTE const fhd = ((const BYTE*)src)[minInputSize-1]; - U32 const dictID= fhd & 3; - U32 const singleSegment = (fhd >> 5) & 1; - U32 const fcsId = fhd >> 6; - return minInputSize + !singleSegment - + ZSTD_did_fieldSize[dictID] + ZSTD_fcs_fieldSize[fcsId] - + (singleSegment && !fcsId); - } -} - -/** ZSTD_frameHeaderSize() : - * srcSize must be >= ZSTD_frameHeaderSize_prefix. - * @return : size of the Frame Header, - * or an error code (if srcSize is too small) */ -size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize) -{ - return ZSTD_frameHeaderSize_internal(src, srcSize, ZSTD_f_zstd1); -} - - -/** ZSTD_getFrameHeader_advanced() : - * decode Frame Header, or require larger `srcSize`. - * note : only works for formats ZSTD_f_zstd1 and ZSTD_f_zstd1_magicless - * @return : 0, `zfhPtr` is correctly filled, - * >0, `srcSize` is too small, value is wanted `srcSize` amount, - * or an error code, which can be tested using ZSTD_isError() */ -size_t ZSTD_getFrameHeader_advanced(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize, ZSTD_format_e format) -{ - const BYTE* ip = (const BYTE*)src; - size_t const minInputSize = ZSTD_startingInputLength(format); - - memset(zfhPtr, 0, sizeof(*zfhPtr)); /* not strictly necessary, but static analyzer do not understand that zfhPtr is only going to be read only if return value is zero, since they are 2 different signals */ - if (srcSize < minInputSize) return minInputSize; - RETURN_ERROR_IF(src==NULL, GENERIC, "invalid parameter"); - - if ( (format != ZSTD_f_zstd1_magicless) - && (MEM_readLE32(src) != ZSTD_MAGICNUMBER) ) { - if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { - /* skippable frame */ - if (srcSize < ZSTD_SKIPPABLEHEADERSIZE) - return ZSTD_SKIPPABLEHEADERSIZE; /* magic number + frame length */ - memset(zfhPtr, 0, sizeof(*zfhPtr)); - zfhPtr->frameContentSize = MEM_readLE32((const char *)src + ZSTD_FRAMEIDSIZE); - zfhPtr->frameType = ZSTD_skippableFrame; - return 0; - } - RETURN_ERROR(prefix_unknown); - } - - /* ensure there is enough `srcSize` to fully read/decode frame header */ - { size_t const fhsize = ZSTD_frameHeaderSize_internal(src, srcSize, format); - if (srcSize < fhsize) return fhsize; - zfhPtr->headerSize = (U32)fhsize; - } - - { BYTE const fhdByte = ip[minInputSize-1]; - size_t pos = minInputSize; - U32 const dictIDSizeCode = fhdByte&3; - U32 const checksumFlag = (fhdByte>>2)&1; - U32 const singleSegment = (fhdByte>>5)&1; - U32 const fcsID = fhdByte>>6; - U64 windowSize = 0; - U32 dictID = 0; - U64 frameContentSize = ZSTD_CONTENTSIZE_UNKNOWN; - RETURN_ERROR_IF((fhdByte & 0x08) != 0, frameParameter_unsupported, - "reserved bits, must be zero"); - - if (!singleSegment) { - BYTE const wlByte = ip[pos++]; - U32 const windowLog = (wlByte >> 3) + ZSTD_WINDOWLOG_ABSOLUTEMIN; - RETURN_ERROR_IF(windowLog > ZSTD_WINDOWLOG_MAX, frameParameter_windowTooLarge); - windowSize = (1ULL << windowLog); - windowSize += (windowSize >> 3) * (wlByte&7); - } - switch(dictIDSizeCode) - { - default: assert(0); /* impossible */ - case 0 : break; - case 1 : dictID = ip[pos]; pos++; break; - case 2 : dictID = MEM_readLE16(ip+pos); pos+=2; break; - case 3 : dictID = MEM_readLE32(ip+pos); pos+=4; break; - } - switch(fcsID) - { - default: assert(0); /* impossible */ - case 0 : if (singleSegment) frameContentSize = ip[pos]; break; - case 1 : frameContentSize = MEM_readLE16(ip+pos)+256; break; - case 2 : frameContentSize = MEM_readLE32(ip+pos); break; - case 3 : frameContentSize = MEM_readLE64(ip+pos); break; - } - if (singleSegment) windowSize = frameContentSize; - - zfhPtr->frameType = ZSTD_frame; - zfhPtr->frameContentSize = frameContentSize; - zfhPtr->windowSize = windowSize; - zfhPtr->blockSizeMax = (unsigned) MIN(windowSize, ZSTD_BLOCKSIZE_MAX); - zfhPtr->dictID = dictID; - zfhPtr->checksumFlag = checksumFlag; - } - return 0; -} - -/** ZSTD_getFrameHeader() : - * decode Frame Header, or require larger `srcSize`. - * note : this function does not consume input, it only reads it. - * @return : 0, `zfhPtr` is correctly filled, - * >0, `srcSize` is too small, value is wanted `srcSize` amount, - * or an error code, which can be tested using ZSTD_isError() */ -size_t ZSTD_getFrameHeader(ZSTD_frameHeader* zfhPtr, const void* src, size_t srcSize) -{ - return ZSTD_getFrameHeader_advanced(zfhPtr, src, srcSize, ZSTD_f_zstd1); -} - - -/** ZSTD_getFrameContentSize() : - * compatible with legacy mode - * @return : decompressed size of the single frame pointed to be `src` if known, otherwise - * - ZSTD_CONTENTSIZE_UNKNOWN if the size cannot be determined - * - ZSTD_CONTENTSIZE_ERROR if an error occurred (e.g. invalid magic number, srcSize too small) */ -unsigned long long ZSTD_getFrameContentSize(const void *src, size_t srcSize) -{ -#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1) - if (ZSTD_isLegacy(src, srcSize)) { - unsigned long long const ret = ZSTD_getDecompressedSize_legacy(src, srcSize); - return ret == 0 ? ZSTD_CONTENTSIZE_UNKNOWN : ret; - } -#endif - { ZSTD_frameHeader zfh; - if (ZSTD_getFrameHeader(&zfh, src, srcSize) != 0) - return ZSTD_CONTENTSIZE_ERROR; - if (zfh.frameType == ZSTD_skippableFrame) { - return 0; - } else { - return zfh.frameContentSize; - } } -} - -static size_t readSkippableFrameSize(void const* src, size_t srcSize) -{ - size_t const skippableHeaderSize = ZSTD_SKIPPABLEHEADERSIZE; - U32 sizeU32; - - RETURN_ERROR_IF(srcSize < ZSTD_SKIPPABLEHEADERSIZE, srcSize_wrong); - - sizeU32 = MEM_readLE32((BYTE const*)src + ZSTD_FRAMEIDSIZE); - RETURN_ERROR_IF((U32)(sizeU32 + ZSTD_SKIPPABLEHEADERSIZE) < sizeU32, - frameParameter_unsupported); - { - size_t const skippableSize = skippableHeaderSize + sizeU32; - RETURN_ERROR_IF(skippableSize > srcSize, srcSize_wrong); - return skippableSize; - } -} - -/** ZSTD_findDecompressedSize() : - * compatible with legacy mode - * `srcSize` must be the exact length of some number of ZSTD compressed and/or - * skippable frames - * @return : decompressed size of the frames contained */ -unsigned long long ZSTD_findDecompressedSize(const void* src, size_t srcSize) -{ - unsigned long long totalDstSize = 0; - - while (srcSize >= ZSTD_startingInputLength(ZSTD_f_zstd1)) { - U32 const magicNumber = MEM_readLE32(src); - - if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { - size_t const skippableSize = readSkippableFrameSize(src, srcSize); - if (ZSTD_isError(skippableSize)) { - return ZSTD_CONTENTSIZE_ERROR; - } - assert(skippableSize <= srcSize); - - src = (const BYTE *)src + skippableSize; - srcSize -= skippableSize; - continue; - } - - { unsigned long long const ret = ZSTD_getFrameContentSize(src, srcSize); - if (ret >= ZSTD_CONTENTSIZE_ERROR) return ret; - - /* check for overflow */ - if (totalDstSize + ret < totalDstSize) return ZSTD_CONTENTSIZE_ERROR; - totalDstSize += ret; - } - { size_t const frameSrcSize = ZSTD_findFrameCompressedSize(src, srcSize); - if (ZSTD_isError(frameSrcSize)) { - return ZSTD_CONTENTSIZE_ERROR; - } - - src = (const BYTE *)src + frameSrcSize; - srcSize -= frameSrcSize; - } - } /* while (srcSize >= ZSTD_frameHeaderSize_prefix) */ - - if (srcSize) return ZSTD_CONTENTSIZE_ERROR; - - return totalDstSize; -} - -/** ZSTD_getDecompressedSize() : - * compatible with legacy mode - * @return : decompressed size if known, 0 otherwise - note : 0 can mean any of the following : - - frame content is empty - - decompressed size field is not present in frame header - - frame header unknown / not supported - - frame header not complete (`srcSize` too small) */ -unsigned long long ZSTD_getDecompressedSize(const void* src, size_t srcSize) -{ - unsigned long long const ret = ZSTD_getFrameContentSize(src, srcSize); - ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_ERROR < ZSTD_CONTENTSIZE_UNKNOWN); - return (ret >= ZSTD_CONTENTSIZE_ERROR) ? 0 : ret; -} - - -/** ZSTD_decodeFrameHeader() : - * `headerSize` must be the size provided by ZSTD_frameHeaderSize(). - * @return : 0 if success, or an error code, which can be tested using ZSTD_isError() */ -static size_t ZSTD_decodeFrameHeader(ZSTD_DCtx* dctx, const void* src, size_t headerSize) -{ - size_t const result = ZSTD_getFrameHeader_advanced(&(dctx->fParams), src, headerSize, dctx->format); - if (ZSTD_isError(result)) return result; /* invalid header */ - RETURN_ERROR_IF(result>0, srcSize_wrong, "headerSize too small"); -#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION - /* Skip the dictID check in fuzzing mode, because it makes the search - * harder. - */ - RETURN_ERROR_IF(dctx->fParams.dictID && (dctx->dictID != dctx->fParams.dictID), - dictionary_wrong); -#endif - if (dctx->fParams.checksumFlag) XXH64_reset(&dctx->xxhState, 0); - return 0; -} - -static ZSTD_frameSizeInfo ZSTD_errorFrameSizeInfo(size_t ret) -{ - ZSTD_frameSizeInfo frameSizeInfo; - frameSizeInfo.compressedSize = ret; - frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR; - return frameSizeInfo; -} - -static ZSTD_frameSizeInfo ZSTD_findFrameSizeInfo(const void* src, size_t srcSize) -{ - ZSTD_frameSizeInfo frameSizeInfo; - memset(&frameSizeInfo, 0, sizeof(ZSTD_frameSizeInfo)); - -#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1) - if (ZSTD_isLegacy(src, srcSize)) - return ZSTD_findFrameSizeInfoLegacy(src, srcSize); -#endif - - if ((srcSize >= ZSTD_SKIPPABLEHEADERSIZE) - && (MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { - frameSizeInfo.compressedSize = readSkippableFrameSize(src, srcSize); - assert(ZSTD_isError(frameSizeInfo.compressedSize) || - frameSizeInfo.compressedSize <= srcSize); - return frameSizeInfo; - } else { - const BYTE* ip = (const BYTE*)src; - const BYTE* const ipstart = ip; - size_t remainingSize = srcSize; - size_t nbBlocks = 0; - ZSTD_frameHeader zfh; - - /* Extract Frame Header */ - { size_t const ret = ZSTD_getFrameHeader(&zfh, src, srcSize); - if (ZSTD_isError(ret)) - return ZSTD_errorFrameSizeInfo(ret); - if (ret > 0) - return ZSTD_errorFrameSizeInfo(ERROR(srcSize_wrong)); - } - - ip += zfh.headerSize; - remainingSize -= zfh.headerSize; - - /* Iterate over each block */ - while (1) { - blockProperties_t blockProperties; - size_t const cBlockSize = ZSTD_getcBlockSize(ip, remainingSize, &blockProperties); - if (ZSTD_isError(cBlockSize)) - return ZSTD_errorFrameSizeInfo(cBlockSize); - - if (ZSTD_blockHeaderSize + cBlockSize > remainingSize) - return ZSTD_errorFrameSizeInfo(ERROR(srcSize_wrong)); - - ip += ZSTD_blockHeaderSize + cBlockSize; - remainingSize -= ZSTD_blockHeaderSize + cBlockSize; - nbBlocks++; - - if (blockProperties.lastBlock) break; - } - - /* Final frame content checksum */ - if (zfh.checksumFlag) { - if (remainingSize < 4) - return ZSTD_errorFrameSizeInfo(ERROR(srcSize_wrong)); - ip += 4; - } - - frameSizeInfo.compressedSize = ip - ipstart; - frameSizeInfo.decompressedBound = (zfh.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN) - ? zfh.frameContentSize - : nbBlocks * zfh.blockSizeMax; - return frameSizeInfo; - } -} - -/** ZSTD_findFrameCompressedSize() : - * compatible with legacy mode - * `src` must point to the start of a ZSTD frame, ZSTD legacy frame, or skippable frame - * `srcSize` must be at least as large as the frame contained - * @return : the compressed size of the frame starting at `src` */ -size_t ZSTD_findFrameCompressedSize(const void *src, size_t srcSize) -{ - ZSTD_frameSizeInfo const frameSizeInfo = ZSTD_findFrameSizeInfo(src, srcSize); - return frameSizeInfo.compressedSize; -} - -/** ZSTD_decompressBound() : - * compatible with legacy mode - * `src` must point to the start of a ZSTD frame or a skippeable frame - * `srcSize` must be at least as large as the frame contained - * @return : the maximum decompressed size of the compressed source - */ -unsigned long long ZSTD_decompressBound(const void* src, size_t srcSize) -{ - unsigned long long bound = 0; - /* Iterate over each frame */ - while (srcSize > 0) { - ZSTD_frameSizeInfo const frameSizeInfo = ZSTD_findFrameSizeInfo(src, srcSize); - size_t const compressedSize = frameSizeInfo.compressedSize; - unsigned long long const decompressedBound = frameSizeInfo.decompressedBound; - if (ZSTD_isError(compressedSize) || decompressedBound == ZSTD_CONTENTSIZE_ERROR) - return ZSTD_CONTENTSIZE_ERROR; - assert(srcSize >= compressedSize); - src = (const BYTE*)src + compressedSize; - srcSize -= compressedSize; - bound += decompressedBound; - } - return bound; -} - - -/*-************************************************************* - * Frame decoding - ***************************************************************/ - - -void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst) -{ - if (dst != dctx->previousDstEnd) { /* not contiguous */ - dctx->dictEnd = dctx->previousDstEnd; - dctx->virtualStart = (const char*)dst - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->prefixStart)); - dctx->prefixStart = dst; - dctx->previousDstEnd = dst; - } -} - -/** ZSTD_insertBlock() : - * insert `src` block into `dctx` history. Useful to track uncompressed blocks. */ -size_t ZSTD_insertBlock(ZSTD_DCtx* dctx, const void* blockStart, size_t blockSize) -{ - DEBUGLOG(5, "ZSTD_insertBlock: %u bytes", (unsigned)blockSize); - ZSTD_checkContinuity(dctx, blockStart); - dctx->previousDstEnd = (const char*)blockStart + blockSize; - return blockSize; -} - - -static size_t ZSTD_copyRawBlock(void* dst, size_t dstCapacity, - const void* src, size_t srcSize) -{ - DEBUGLOG(5, "ZSTD_copyRawBlock"); - if (dst == NULL) { - if (srcSize == 0) return 0; - RETURN_ERROR(dstBuffer_null); - } - RETURN_ERROR_IF(srcSize > dstCapacity, dstSize_tooSmall); - memcpy(dst, src, srcSize); - return srcSize; -} - -static size_t ZSTD_setRleBlock(void* dst, size_t dstCapacity, - BYTE b, - size_t regenSize) -{ - if (dst == NULL) { - if (regenSize == 0) return 0; - RETURN_ERROR(dstBuffer_null); - } - RETURN_ERROR_IF(regenSize > dstCapacity, dstSize_tooSmall); - memset(dst, b, regenSize); - return regenSize; -} - - -/*! ZSTD_decompressFrame() : - * @dctx must be properly initialized - * will update *srcPtr and *srcSizePtr, - * to make *srcPtr progress by one frame. */ -static size_t ZSTD_decompressFrame(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void** srcPtr, size_t *srcSizePtr) -{ - const BYTE* ip = (const BYTE*)(*srcPtr); - BYTE* const ostart = (BYTE* const)dst; - BYTE* const oend = ostart + dstCapacity; - BYTE* op = ostart; - size_t remainingSrcSize = *srcSizePtr; - - DEBUGLOG(4, "ZSTD_decompressFrame (srcSize:%i)", (int)*srcSizePtr); - - /* check */ - RETURN_ERROR_IF( - remainingSrcSize < ZSTD_FRAMEHEADERSIZE_MIN(dctx->format)+ZSTD_blockHeaderSize, - srcSize_wrong); - - /* Frame Header */ - { size_t const frameHeaderSize = ZSTD_frameHeaderSize_internal( - ip, ZSTD_FRAMEHEADERSIZE_PREFIX(dctx->format), dctx->format); - if (ZSTD_isError(frameHeaderSize)) return frameHeaderSize; - RETURN_ERROR_IF(remainingSrcSize < frameHeaderSize+ZSTD_blockHeaderSize, - srcSize_wrong); - FORWARD_IF_ERROR( ZSTD_decodeFrameHeader(dctx, ip, frameHeaderSize) ); - ip += frameHeaderSize; remainingSrcSize -= frameHeaderSize; - } - - /* Loop on each block */ - while (1) { - size_t decodedSize; - blockProperties_t blockProperties; - size_t const cBlockSize = ZSTD_getcBlockSize(ip, remainingSrcSize, &blockProperties); - if (ZSTD_isError(cBlockSize)) return cBlockSize; - - ip += ZSTD_blockHeaderSize; - remainingSrcSize -= ZSTD_blockHeaderSize; - RETURN_ERROR_IF(cBlockSize > remainingSrcSize, srcSize_wrong); - - switch(blockProperties.blockType) - { - case bt_compressed: - decodedSize = ZSTD_decompressBlock_internal(dctx, op, oend-op, ip, cBlockSize, /* frame */ 1); - break; - case bt_raw : - decodedSize = ZSTD_copyRawBlock(op, oend-op, ip, cBlockSize); - break; - case bt_rle : - decodedSize = ZSTD_setRleBlock(op, oend-op, *ip, blockProperties.origSize); - break; - case bt_reserved : - default: - RETURN_ERROR(corruption_detected); - } - - if (ZSTD_isError(decodedSize)) return decodedSize; - if (dctx->fParams.checksumFlag) - XXH64_update(&dctx->xxhState, op, decodedSize); - op += decodedSize; - ip += cBlockSize; - remainingSrcSize -= cBlockSize; - if (blockProperties.lastBlock) break; - } - - if (dctx->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN) { - RETURN_ERROR_IF((U64)(op-ostart) != dctx->fParams.frameContentSize, - corruption_detected); - } - if (dctx->fParams.checksumFlag) { /* Frame content checksum verification */ - U32 const checkCalc = (U32)XXH64_digest(&dctx->xxhState); - U32 checkRead; - RETURN_ERROR_IF(remainingSrcSize<4, checksum_wrong); - checkRead = MEM_readLE32(ip); - RETURN_ERROR_IF(checkRead != checkCalc, checksum_wrong); - ip += 4; - remainingSrcSize -= 4; - } - - /* Allow caller to get size read */ - *srcPtr = ip; - *srcSizePtr = remainingSrcSize; - return op-ostart; -} - -static size_t ZSTD_decompressMultiFrame(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict, size_t dictSize, - const ZSTD_DDict* ddict) -{ - void* const dststart = dst; - int moreThan1Frame = 0; - - DEBUGLOG(5, "ZSTD_decompressMultiFrame"); - assert(dict==NULL || ddict==NULL); /* either dict or ddict set, not both */ - - if (ddict) { - dict = ZSTD_DDict_dictContent(ddict); - dictSize = ZSTD_DDict_dictSize(ddict); - } - - while (srcSize >= ZSTD_startingInputLength(dctx->format)) { - -#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT >= 1) - if (ZSTD_isLegacy(src, srcSize)) { - size_t decodedSize; - size_t const frameSize = ZSTD_findFrameCompressedSizeLegacy(src, srcSize); - if (ZSTD_isError(frameSize)) return frameSize; - RETURN_ERROR_IF(dctx->staticSize, memory_allocation, - "legacy support is not compatible with static dctx"); - - decodedSize = ZSTD_decompressLegacy(dst, dstCapacity, src, frameSize, dict, dictSize); - if (ZSTD_isError(decodedSize)) return decodedSize; - - assert(decodedSize <=- dstCapacity); - dst = (BYTE*)dst + decodedSize; - dstCapacity -= decodedSize; - - src = (const BYTE*)src + frameSize; - srcSize -= frameSize; - - continue; - } -#endif - - { U32 const magicNumber = MEM_readLE32(src); - DEBUGLOG(4, "reading magic number %08X (expecting %08X)", - (unsigned)magicNumber, ZSTD_MAGICNUMBER); - if ((magicNumber & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { - size_t const skippableSize = readSkippableFrameSize(src, srcSize); - FORWARD_IF_ERROR(skippableSize); - assert(skippableSize <= srcSize); - - src = (const BYTE *)src + skippableSize; - srcSize -= skippableSize; - continue; - } } - - if (ddict) { - /* we were called from ZSTD_decompress_usingDDict */ - FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDDict(dctx, ddict)); - } else { - /* this will initialize correctly with no dict if dict == NULL, so - * use this in all cases but ddict */ - FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDict(dctx, dict, dictSize)); - } - ZSTD_checkContinuity(dctx, dst); - - { const size_t res = ZSTD_decompressFrame(dctx, dst, dstCapacity, - &src, &srcSize); - RETURN_ERROR_IF( - (ZSTD_getErrorCode(res) == ZSTD_error_prefix_unknown) - && (moreThan1Frame==1), - srcSize_wrong, - "at least one frame successfully completed, but following " - "bytes are garbage: it's more likely to be a srcSize error, " - "specifying more bytes than compressed size of frame(s). This " - "error message replaces ERROR(prefix_unknown), which would be " - "confusing, as the first header is actually correct. Note that " - "one could be unlucky, it might be a corruption error instead, " - "happening right at the place where we expect zstd magic " - "bytes. But this is _much_ less likely than a srcSize field " - "error."); - if (ZSTD_isError(res)) return res; - assert(res <= dstCapacity); - dst = (BYTE*)dst + res; - dstCapacity -= res; - } - moreThan1Frame = 1; - } /* while (srcSize >= ZSTD_frameHeaderSize_prefix) */ - - RETURN_ERROR_IF(srcSize, srcSize_wrong, "input not entirely consumed"); - - return (BYTE*)dst - (BYTE*)dststart; -} - -size_t ZSTD_decompress_usingDict(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const void* dict, size_t dictSize) -{ - return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize, dict, dictSize, NULL); -} - - -static ZSTD_DDict const* ZSTD_getDDict(ZSTD_DCtx* dctx) -{ - switch (dctx->dictUses) { - default: - assert(0 /* Impossible */); - /* fall-through */ - case ZSTD_dont_use: - ZSTD_clearDict(dctx); - return NULL; - case ZSTD_use_indefinitely: - return dctx->ddict; - case ZSTD_use_once: - dctx->dictUses = ZSTD_dont_use; - return dctx->ddict; - } -} - -size_t ZSTD_decompressDCtx(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - return ZSTD_decompress_usingDDict(dctx, dst, dstCapacity, src, srcSize, ZSTD_getDDict(dctx)); -} - - -size_t ZSTD_decompress(void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ -#if defined(ZSTD_HEAPMODE) && (ZSTD_HEAPMODE>=1) - size_t regenSize; - ZSTD_DCtx* const dctx = ZSTD_createDCtx(); - RETURN_ERROR_IF(dctx==NULL, memory_allocation); - regenSize = ZSTD_decompressDCtx(dctx, dst, dstCapacity, src, srcSize); - ZSTD_freeDCtx(dctx); - return regenSize; -#else /* stack mode */ - ZSTD_DCtx dctx; - ZSTD_initDCtx_internal(&dctx); - return ZSTD_decompressDCtx(&dctx, dst, dstCapacity, src, srcSize); -#endif -} - - -/*-************************************** -* Advanced Streaming Decompression API -* Bufferless and synchronous -****************************************/ -size_t ZSTD_nextSrcSizeToDecompress(ZSTD_DCtx* dctx) { return dctx->expected; } - -ZSTD_nextInputType_e ZSTD_nextInputType(ZSTD_DCtx* dctx) { - switch(dctx->stage) - { - default: /* should not happen */ - assert(0); - case ZSTDds_getFrameHeaderSize: - case ZSTDds_decodeFrameHeader: - return ZSTDnit_frameHeader; - case ZSTDds_decodeBlockHeader: - return ZSTDnit_blockHeader; - case ZSTDds_decompressBlock: - return ZSTDnit_block; - case ZSTDds_decompressLastBlock: - return ZSTDnit_lastBlock; - case ZSTDds_checkChecksum: - return ZSTDnit_checksum; - case ZSTDds_decodeSkippableHeader: - case ZSTDds_skipFrame: - return ZSTDnit_skippableFrame; - } -} - -static int ZSTD_isSkipFrame(ZSTD_DCtx* dctx) { return dctx->stage == ZSTDds_skipFrame; } - -/** ZSTD_decompressContinue() : - * srcSize : must be the exact nb of bytes expected (see ZSTD_nextSrcSizeToDecompress()) - * @return : nb of bytes generated into `dst` (necessarily <= `dstCapacity) - * or an error code, which can be tested using ZSTD_isError() */ -size_t ZSTD_decompressContinue(ZSTD_DCtx* dctx, void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - DEBUGLOG(5, "ZSTD_decompressContinue (srcSize:%u)", (unsigned)srcSize); - /* Sanity check */ - RETURN_ERROR_IF(srcSize != dctx->expected, srcSize_wrong, "not allowed"); - if (dstCapacity) ZSTD_checkContinuity(dctx, dst); - - switch (dctx->stage) - { - case ZSTDds_getFrameHeaderSize : - assert(src != NULL); - if (dctx->format == ZSTD_f_zstd1) { /* allows header */ - assert(srcSize >= ZSTD_FRAMEIDSIZE); /* to read skippable magic number */ - if ((MEM_readLE32(src) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { /* skippable frame */ - memcpy(dctx->headerBuffer, src, srcSize); - dctx->expected = ZSTD_SKIPPABLEHEADERSIZE - srcSize; /* remaining to load to get full skippable frame header */ - dctx->stage = ZSTDds_decodeSkippableHeader; - return 0; - } } - dctx->headerSize = ZSTD_frameHeaderSize_internal(src, srcSize, dctx->format); - if (ZSTD_isError(dctx->headerSize)) return dctx->headerSize; - memcpy(dctx->headerBuffer, src, srcSize); - dctx->expected = dctx->headerSize - srcSize; - dctx->stage = ZSTDds_decodeFrameHeader; - return 0; - - case ZSTDds_decodeFrameHeader: - assert(src != NULL); - memcpy(dctx->headerBuffer + (dctx->headerSize - srcSize), src, srcSize); - FORWARD_IF_ERROR(ZSTD_decodeFrameHeader(dctx, dctx->headerBuffer, dctx->headerSize)); - dctx->expected = ZSTD_blockHeaderSize; - dctx->stage = ZSTDds_decodeBlockHeader; - return 0; - - case ZSTDds_decodeBlockHeader: - { blockProperties_t bp; - size_t const cBlockSize = ZSTD_getcBlockSize(src, ZSTD_blockHeaderSize, &bp); - if (ZSTD_isError(cBlockSize)) return cBlockSize; - RETURN_ERROR_IF(cBlockSize > dctx->fParams.blockSizeMax, corruption_detected, "Block Size Exceeds Maximum"); - dctx->expected = cBlockSize; - dctx->bType = bp.blockType; - dctx->rleSize = bp.origSize; - if (cBlockSize) { - dctx->stage = bp.lastBlock ? ZSTDds_decompressLastBlock : ZSTDds_decompressBlock; - return 0; - } - /* empty block */ - if (bp.lastBlock) { - if (dctx->fParams.checksumFlag) { - dctx->expected = 4; - dctx->stage = ZSTDds_checkChecksum; - } else { - dctx->expected = 0; /* end of frame */ - dctx->stage = ZSTDds_getFrameHeaderSize; - } - } else { - dctx->expected = ZSTD_blockHeaderSize; /* jump to next header */ - dctx->stage = ZSTDds_decodeBlockHeader; - } - return 0; - } - - case ZSTDds_decompressLastBlock: - case ZSTDds_decompressBlock: - DEBUGLOG(5, "ZSTD_decompressContinue: case ZSTDds_decompressBlock"); - { size_t rSize; - switch(dctx->bType) - { - case bt_compressed: - DEBUGLOG(5, "ZSTD_decompressContinue: case bt_compressed"); - rSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 1); - break; - case bt_raw : - rSize = ZSTD_copyRawBlock(dst, dstCapacity, src, srcSize); - break; - case bt_rle : - rSize = ZSTD_setRleBlock(dst, dstCapacity, *(const BYTE*)src, dctx->rleSize); - break; - case bt_reserved : /* should never happen */ - default: - RETURN_ERROR(corruption_detected); - } - if (ZSTD_isError(rSize)) return rSize; - RETURN_ERROR_IF(rSize > dctx->fParams.blockSizeMax, corruption_detected, "Decompressed Block Size Exceeds Maximum"); - DEBUGLOG(5, "ZSTD_decompressContinue: decoded size from block : %u", (unsigned)rSize); - dctx->decodedSize += rSize; - if (dctx->fParams.checksumFlag) XXH64_update(&dctx->xxhState, dst, rSize); - - if (dctx->stage == ZSTDds_decompressLastBlock) { /* end of frame */ - DEBUGLOG(4, "ZSTD_decompressContinue: decoded size from frame : %u", (unsigned)dctx->decodedSize); - RETURN_ERROR_IF( - dctx->fParams.frameContentSize != ZSTD_CONTENTSIZE_UNKNOWN - && dctx->decodedSize != dctx->fParams.frameContentSize, - corruption_detected); - if (dctx->fParams.checksumFlag) { /* another round for frame checksum */ - dctx->expected = 4; - dctx->stage = ZSTDds_checkChecksum; - } else { - dctx->expected = 0; /* ends here */ - dctx->stage = ZSTDds_getFrameHeaderSize; - } - } else { - dctx->stage = ZSTDds_decodeBlockHeader; - dctx->expected = ZSTD_blockHeaderSize; - dctx->previousDstEnd = (char*)dst + rSize; - } - return rSize; - } - - case ZSTDds_checkChecksum: - assert(srcSize == 4); /* guaranteed by dctx->expected */ - { U32 const h32 = (U32)XXH64_digest(&dctx->xxhState); - U32 const check32 = MEM_readLE32(src); - DEBUGLOG(4, "ZSTD_decompressContinue: checksum : calculated %08X :: %08X read", (unsigned)h32, (unsigned)check32); - RETURN_ERROR_IF(check32 != h32, checksum_wrong); - dctx->expected = 0; - dctx->stage = ZSTDds_getFrameHeaderSize; - return 0; - } - - case ZSTDds_decodeSkippableHeader: - assert(src != NULL); - assert(srcSize <= ZSTD_SKIPPABLEHEADERSIZE); - memcpy(dctx->headerBuffer + (ZSTD_SKIPPABLEHEADERSIZE - srcSize), src, srcSize); /* complete skippable header */ - dctx->expected = MEM_readLE32(dctx->headerBuffer + ZSTD_FRAMEIDSIZE); /* note : dctx->expected can grow seriously large, beyond local buffer size */ - dctx->stage = ZSTDds_skipFrame; - return 0; - - case ZSTDds_skipFrame: - dctx->expected = 0; - dctx->stage = ZSTDds_getFrameHeaderSize; - return 0; - - default: - assert(0); /* impossible */ - RETURN_ERROR(GENERIC); /* some compiler require default to do something */ - } -} - - -static size_t ZSTD_refDictContent(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) -{ - dctx->dictEnd = dctx->previousDstEnd; - dctx->virtualStart = (const char*)dict - ((const char*)(dctx->previousDstEnd) - (const char*)(dctx->prefixStart)); - dctx->prefixStart = dict; - dctx->previousDstEnd = (const char*)dict + dictSize; - return 0; -} - -/*! ZSTD_loadDEntropy() : - * dict : must point at beginning of a valid zstd dictionary. - * @return : size of entropy tables read */ -size_t -ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy, - const void* const dict, size_t const dictSize) -{ - const BYTE* dictPtr = (const BYTE*)dict; - const BYTE* const dictEnd = dictPtr + dictSize; - - RETURN_ERROR_IF(dictSize <= 8, dictionary_corrupted); - assert(MEM_readLE32(dict) == ZSTD_MAGIC_DICTIONARY); /* dict must be valid */ - dictPtr += 8; /* skip header = magic + dictID */ - - ZSTD_STATIC_ASSERT(offsetof(ZSTD_entropyDTables_t, OFTable) == offsetof(ZSTD_entropyDTables_t, LLTable) + sizeof(entropy->LLTable)); - ZSTD_STATIC_ASSERT(offsetof(ZSTD_entropyDTables_t, MLTable) == offsetof(ZSTD_entropyDTables_t, OFTable) + sizeof(entropy->OFTable)); - ZSTD_STATIC_ASSERT(sizeof(entropy->LLTable) + sizeof(entropy->OFTable) + sizeof(entropy->MLTable) >= HUF_DECOMPRESS_WORKSPACE_SIZE); - { void* const workspace = &entropy->LLTable; /* use fse tables as temporary workspace; implies fse tables are grouped together */ - size_t const workspaceSize = sizeof(entropy->LLTable) + sizeof(entropy->OFTable) + sizeof(entropy->MLTable); -#ifdef HUF_FORCE_DECOMPRESS_X1 - /* in minimal huffman, we always use X1 variants */ - size_t const hSize = HUF_readDTableX1_wksp(entropy->hufTable, - dictPtr, dictEnd - dictPtr, - workspace, workspaceSize); -#else - size_t const hSize = HUF_readDTableX2_wksp(entropy->hufTable, - dictPtr, dictEnd - dictPtr, - workspace, workspaceSize); -#endif - RETURN_ERROR_IF(HUF_isError(hSize), dictionary_corrupted); - dictPtr += hSize; - } - - { short offcodeNCount[MaxOff+1]; - unsigned offcodeMaxValue = MaxOff, offcodeLog; - size_t const offcodeHeaderSize = FSE_readNCount(offcodeNCount, &offcodeMaxValue, &offcodeLog, dictPtr, dictEnd-dictPtr); - RETURN_ERROR_IF(FSE_isError(offcodeHeaderSize), dictionary_corrupted); - RETURN_ERROR_IF(offcodeMaxValue > MaxOff, dictionary_corrupted); - RETURN_ERROR_IF(offcodeLog > OffFSELog, dictionary_corrupted); - ZSTD_buildFSETable( entropy->OFTable, - offcodeNCount, offcodeMaxValue, - OF_base, OF_bits, - offcodeLog); - dictPtr += offcodeHeaderSize; - } - - { short matchlengthNCount[MaxML+1]; - unsigned matchlengthMaxValue = MaxML, matchlengthLog; - size_t const matchlengthHeaderSize = FSE_readNCount(matchlengthNCount, &matchlengthMaxValue, &matchlengthLog, dictPtr, dictEnd-dictPtr); - RETURN_ERROR_IF(FSE_isError(matchlengthHeaderSize), dictionary_corrupted); - RETURN_ERROR_IF(matchlengthMaxValue > MaxML, dictionary_corrupted); - RETURN_ERROR_IF(matchlengthLog > MLFSELog, dictionary_corrupted); - ZSTD_buildFSETable( entropy->MLTable, - matchlengthNCount, matchlengthMaxValue, - ML_base, ML_bits, - matchlengthLog); - dictPtr += matchlengthHeaderSize; - } - - { short litlengthNCount[MaxLL+1]; - unsigned litlengthMaxValue = MaxLL, litlengthLog; - size_t const litlengthHeaderSize = FSE_readNCount(litlengthNCount, &litlengthMaxValue, &litlengthLog, dictPtr, dictEnd-dictPtr); - RETURN_ERROR_IF(FSE_isError(litlengthHeaderSize), dictionary_corrupted); - RETURN_ERROR_IF(litlengthMaxValue > MaxLL, dictionary_corrupted); - RETURN_ERROR_IF(litlengthLog > LLFSELog, dictionary_corrupted); - ZSTD_buildFSETable( entropy->LLTable, - litlengthNCount, litlengthMaxValue, - LL_base, LL_bits, - litlengthLog); - dictPtr += litlengthHeaderSize; - } - - RETURN_ERROR_IF(dictPtr+12 > dictEnd, dictionary_corrupted); - { int i; - size_t const dictContentSize = (size_t)(dictEnd - (dictPtr+12)); - for (i=0; i<3; i++) { - U32 const rep = MEM_readLE32(dictPtr); dictPtr += 4; - RETURN_ERROR_IF(rep==0 || rep > dictContentSize, - dictionary_corrupted); - entropy->rep[i] = rep; - } } - - return dictPtr - (const BYTE*)dict; -} - -static size_t ZSTD_decompress_insertDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) -{ - if (dictSize < 8) return ZSTD_refDictContent(dctx, dict, dictSize); - { U32 const magic = MEM_readLE32(dict); - if (magic != ZSTD_MAGIC_DICTIONARY) { - return ZSTD_refDictContent(dctx, dict, dictSize); /* pure content mode */ - } } - dctx->dictID = MEM_readLE32((const char*)dict + ZSTD_FRAMEIDSIZE); - - /* load entropy tables */ - { size_t const eSize = ZSTD_loadDEntropy(&dctx->entropy, dict, dictSize); - RETURN_ERROR_IF(ZSTD_isError(eSize), dictionary_corrupted); - dict = (const char*)dict + eSize; - dictSize -= eSize; - } - dctx->litEntropy = dctx->fseEntropy = 1; - - /* reference dictionary content */ - return ZSTD_refDictContent(dctx, dict, dictSize); -} - -size_t ZSTD_decompressBegin(ZSTD_DCtx* dctx) -{ - assert(dctx != NULL); - dctx->expected = ZSTD_startingInputLength(dctx->format); /* dctx->format must be properly set */ - dctx->stage = ZSTDds_getFrameHeaderSize; - dctx->decodedSize = 0; - dctx->previousDstEnd = NULL; - dctx->prefixStart = NULL; - dctx->virtualStart = NULL; - dctx->dictEnd = NULL; - dctx->entropy.hufTable[0] = (HUF_DTable)((HufLog)*0x1000001); /* cover both little and big endian */ - dctx->litEntropy = dctx->fseEntropy = 0; - dctx->dictID = 0; - ZSTD_STATIC_ASSERT(sizeof(dctx->entropy.rep) == sizeof(repStartValue)); - memcpy(dctx->entropy.rep, repStartValue, sizeof(repStartValue)); /* initial repcodes */ - dctx->LLTptr = dctx->entropy.LLTable; - dctx->MLTptr = dctx->entropy.MLTable; - dctx->OFTptr = dctx->entropy.OFTable; - dctx->HUFptr = dctx->entropy.hufTable; - return 0; -} - -size_t ZSTD_decompressBegin_usingDict(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) -{ - FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) ); - if (dict && dictSize) - RETURN_ERROR_IF( - ZSTD_isError(ZSTD_decompress_insertDictionary(dctx, dict, dictSize)), - dictionary_corrupted); - return 0; -} - - -/* ====== ZSTD_DDict ====== */ - -size_t ZSTD_decompressBegin_usingDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict) -{ - DEBUGLOG(4, "ZSTD_decompressBegin_usingDDict"); - assert(dctx != NULL); - if (ddict) { - const char* const dictStart = (const char*)ZSTD_DDict_dictContent(ddict); - size_t const dictSize = ZSTD_DDict_dictSize(ddict); - const void* const dictEnd = dictStart + dictSize; - dctx->ddictIsCold = (dctx->dictEnd != dictEnd); - DEBUGLOG(4, "DDict is %s", - dctx->ddictIsCold ? "~cold~" : "hot!"); - } - FORWARD_IF_ERROR( ZSTD_decompressBegin(dctx) ); - if (ddict) { /* NULL ddict is equivalent to no dictionary */ - ZSTD_copyDDictParameters(dctx, ddict); - } - return 0; -} - -/*! ZSTD_getDictID_fromDict() : - * Provides the dictID stored within dictionary. - * if @return == 0, the dictionary is not conformant with Zstandard specification. - * It can still be loaded, but as a content-only dictionary. */ -unsigned ZSTD_getDictID_fromDict(const void* dict, size_t dictSize) -{ - if (dictSize < 8) return 0; - if (MEM_readLE32(dict) != ZSTD_MAGIC_DICTIONARY) return 0; - return MEM_readLE32((const char*)dict + ZSTD_FRAMEIDSIZE); -} - -/*! ZSTD_getDictID_fromFrame() : - * Provides the dictID required to decompress frame stored within `src`. - * If @return == 0, the dictID could not be decoded. - * This could for one of the following reasons : - * - The frame does not require a dictionary (most common case). - * - The frame was built with dictID intentionally removed. - * Needed dictionary is a hidden information. - * Note : this use case also happens when using a non-conformant dictionary. - * - `srcSize` is too small, and as a result, frame header could not be decoded. - * Note : possible if `srcSize < ZSTD_FRAMEHEADERSIZE_MAX`. - * - This is not a Zstandard frame. - * When identifying the exact failure cause, it's possible to use - * ZSTD_getFrameHeader(), which will provide a more precise error code. */ -unsigned ZSTD_getDictID_fromFrame(const void* src, size_t srcSize) -{ - ZSTD_frameHeader zfp = { 0, 0, 0, ZSTD_frame, 0, 0, 0 }; - size_t const hError = ZSTD_getFrameHeader(&zfp, src, srcSize); - if (ZSTD_isError(hError)) return 0; - return zfp.dictID; -} - - -/*! ZSTD_decompress_usingDDict() : -* Decompression using a pre-digested Dictionary -* Use dictionary without significant overhead. */ -size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, - const ZSTD_DDict* ddict) -{ - /* pass content and size in case legacy frames are encountered */ - return ZSTD_decompressMultiFrame(dctx, dst, dstCapacity, src, srcSize, - NULL, 0, - ddict); -} - - -/*===================================== -* Streaming decompression -*====================================*/ - -ZSTD_DStream* ZSTD_createDStream(void) -{ - DEBUGLOG(3, "ZSTD_createDStream"); - return ZSTD_createDStream_advanced(ZSTD_defaultCMem); -} - -ZSTD_DStream* ZSTD_initStaticDStream(void *workspace, size_t workspaceSize) -{ - return ZSTD_initStaticDCtx(workspace, workspaceSize); -} - -ZSTD_DStream* ZSTD_createDStream_advanced(ZSTD_customMem customMem) -{ - return ZSTD_createDCtx_advanced(customMem); -} - -size_t ZSTD_freeDStream(ZSTD_DStream* zds) -{ - return ZSTD_freeDCtx(zds); -} - - -/* *** Initialization *** */ - -size_t ZSTD_DStreamInSize(void) { return ZSTD_BLOCKSIZE_MAX + ZSTD_blockHeaderSize; } -size_t ZSTD_DStreamOutSize(void) { return ZSTD_BLOCKSIZE_MAX; } - -size_t ZSTD_DCtx_loadDictionary_advanced(ZSTD_DCtx* dctx, - const void* dict, size_t dictSize, - ZSTD_dictLoadMethod_e dictLoadMethod, - ZSTD_dictContentType_e dictContentType) -{ - RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong); - ZSTD_clearDict(dctx); - if (dict && dictSize != 0) { - dctx->ddictLocal = ZSTD_createDDict_advanced(dict, dictSize, dictLoadMethod, dictContentType, dctx->customMem); - RETURN_ERROR_IF(dctx->ddictLocal == NULL, memory_allocation); - dctx->ddict = dctx->ddictLocal; - dctx->dictUses = ZSTD_use_indefinitely; - } - return 0; -} - -size_t ZSTD_DCtx_loadDictionary_byReference(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) -{ - return ZSTD_DCtx_loadDictionary_advanced(dctx, dict, dictSize, ZSTD_dlm_byRef, ZSTD_dct_auto); -} - -size_t ZSTD_DCtx_loadDictionary(ZSTD_DCtx* dctx, const void* dict, size_t dictSize) -{ - return ZSTD_DCtx_loadDictionary_advanced(dctx, dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto); -} - -size_t ZSTD_DCtx_refPrefix_advanced(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize, ZSTD_dictContentType_e dictContentType) -{ - FORWARD_IF_ERROR(ZSTD_DCtx_loadDictionary_advanced(dctx, prefix, prefixSize, ZSTD_dlm_byRef, dictContentType)); - dctx->dictUses = ZSTD_use_once; - return 0; -} - -size_t ZSTD_DCtx_refPrefix(ZSTD_DCtx* dctx, const void* prefix, size_t prefixSize) -{ - return ZSTD_DCtx_refPrefix_advanced(dctx, prefix, prefixSize, ZSTD_dct_rawContent); -} - - -/* ZSTD_initDStream_usingDict() : - * return : expected size, aka ZSTD_startingInputLength(). - * this function cannot fail */ -size_t ZSTD_initDStream_usingDict(ZSTD_DStream* zds, const void* dict, size_t dictSize) -{ - DEBUGLOG(4, "ZSTD_initDStream_usingDict"); - FORWARD_IF_ERROR( ZSTD_DCtx_reset(zds, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_DCtx_loadDictionary(zds, dict, dictSize) ); - return ZSTD_startingInputLength(zds->format); -} - -/* note : this variant can't fail */ -size_t ZSTD_initDStream(ZSTD_DStream* zds) -{ - DEBUGLOG(4, "ZSTD_initDStream"); - return ZSTD_initDStream_usingDDict(zds, NULL); -} - -/* ZSTD_initDStream_usingDDict() : - * ddict will just be referenced, and must outlive decompression session - * this function cannot fail */ -size_t ZSTD_initDStream_usingDDict(ZSTD_DStream* dctx, const ZSTD_DDict* ddict) -{ - FORWARD_IF_ERROR( ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only) ); - FORWARD_IF_ERROR( ZSTD_DCtx_refDDict(dctx, ddict) ); - return ZSTD_startingInputLength(dctx->format); -} - -/* ZSTD_resetDStream() : - * return : expected size, aka ZSTD_startingInputLength(). - * this function cannot fail */ -size_t ZSTD_resetDStream(ZSTD_DStream* dctx) -{ - FORWARD_IF_ERROR(ZSTD_DCtx_reset(dctx, ZSTD_reset_session_only)); - return ZSTD_startingInputLength(dctx->format); -} - - -size_t ZSTD_DCtx_refDDict(ZSTD_DCtx* dctx, const ZSTD_DDict* ddict) -{ - RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong); - ZSTD_clearDict(dctx); - if (ddict) { - dctx->ddict = ddict; - dctx->dictUses = ZSTD_use_indefinitely; - } - return 0; -} - -/* ZSTD_DCtx_setMaxWindowSize() : - * note : no direct equivalence in ZSTD_DCtx_setParameter, - * since this version sets windowSize, and the other sets windowLog */ -size_t ZSTD_DCtx_setMaxWindowSize(ZSTD_DCtx* dctx, size_t maxWindowSize) -{ - ZSTD_bounds const bounds = ZSTD_dParam_getBounds(ZSTD_d_windowLogMax); - size_t const min = (size_t)1 << bounds.lowerBound; - size_t const max = (size_t)1 << bounds.upperBound; - RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong); - RETURN_ERROR_IF(maxWindowSize < min, parameter_outOfBound); - RETURN_ERROR_IF(maxWindowSize > max, parameter_outOfBound); - dctx->maxWindowSize = maxWindowSize; - return 0; -} - -size_t ZSTD_DCtx_setFormat(ZSTD_DCtx* dctx, ZSTD_format_e format) -{ - return ZSTD_DCtx_setParameter(dctx, ZSTD_d_format, format); -} - -ZSTD_bounds ZSTD_dParam_getBounds(ZSTD_dParameter dParam) -{ - ZSTD_bounds bounds = { 0, 0, 0 }; - switch(dParam) { - case ZSTD_d_windowLogMax: - bounds.lowerBound = ZSTD_WINDOWLOG_ABSOLUTEMIN; - bounds.upperBound = ZSTD_WINDOWLOG_MAX; - return bounds; - case ZSTD_d_format: - bounds.lowerBound = (int)ZSTD_f_zstd1; - bounds.upperBound = (int)ZSTD_f_zstd1_magicless; - ZSTD_STATIC_ASSERT(ZSTD_f_zstd1 < ZSTD_f_zstd1_magicless); - return bounds; - default:; - } - bounds.error = ERROR(parameter_unsupported); - return bounds; -} - -/* ZSTD_dParam_withinBounds: - * @return 1 if value is within dParam bounds, - * 0 otherwise */ -static int ZSTD_dParam_withinBounds(ZSTD_dParameter dParam, int value) -{ - ZSTD_bounds const bounds = ZSTD_dParam_getBounds(dParam); - if (ZSTD_isError(bounds.error)) return 0; - if (value < bounds.lowerBound) return 0; - if (value > bounds.upperBound) return 0; - return 1; -} - -#define CHECK_DBOUNDS(p,v) { \ - RETURN_ERROR_IF(!ZSTD_dParam_withinBounds(p, v), parameter_outOfBound); \ -} - -size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, int value) -{ - RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong); - switch(dParam) { - case ZSTD_d_windowLogMax: - if (value == 0) value = ZSTD_WINDOWLOG_LIMIT_DEFAULT; - CHECK_DBOUNDS(ZSTD_d_windowLogMax, value); - dctx->maxWindowSize = ((size_t)1) << value; - return 0; - case ZSTD_d_format: - CHECK_DBOUNDS(ZSTD_d_format, value); - dctx->format = (ZSTD_format_e)value; - return 0; - default:; - } - RETURN_ERROR(parameter_unsupported); -} - -size_t ZSTD_DCtx_reset(ZSTD_DCtx* dctx, ZSTD_ResetDirective reset) -{ - if ( (reset == ZSTD_reset_session_only) - || (reset == ZSTD_reset_session_and_parameters) ) { - dctx->streamStage = zdss_init; - dctx->noForwardProgress = 0; - } - if ( (reset == ZSTD_reset_parameters) - || (reset == ZSTD_reset_session_and_parameters) ) { - RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong); - ZSTD_clearDict(dctx); - dctx->format = ZSTD_f_zstd1; - dctx->maxWindowSize = ZSTD_MAXWINDOWSIZE_DEFAULT; - } - return 0; -} - - -size_t ZSTD_sizeof_DStream(const ZSTD_DStream* dctx) -{ - return ZSTD_sizeof_DCtx(dctx); -} - -size_t ZSTD_decodingBufferSize_min(unsigned long long windowSize, unsigned long long frameContentSize) -{ - size_t const blockSize = (size_t) MIN(windowSize, ZSTD_BLOCKSIZE_MAX); - unsigned long long const neededRBSize = windowSize + blockSize + (WILDCOPY_OVERLENGTH * 2); - unsigned long long const neededSize = MIN(frameContentSize, neededRBSize); - size_t const minRBSize = (size_t) neededSize; - RETURN_ERROR_IF((unsigned long long)minRBSize != neededSize, - frameParameter_windowTooLarge); - return minRBSize; -} - -size_t ZSTD_estimateDStreamSize(size_t windowSize) -{ - size_t const blockSize = MIN(windowSize, ZSTD_BLOCKSIZE_MAX); - size_t const inBuffSize = blockSize; /* no block can be larger */ - size_t const outBuffSize = ZSTD_decodingBufferSize_min(windowSize, ZSTD_CONTENTSIZE_UNKNOWN); - return ZSTD_estimateDCtxSize() + inBuffSize + outBuffSize; -} - -size_t ZSTD_estimateDStreamSize_fromFrame(const void* src, size_t srcSize) -{ - U32 const windowSizeMax = 1U << ZSTD_WINDOWLOG_MAX; /* note : should be user-selectable, but requires an additional parameter (or a dctx) */ - ZSTD_frameHeader zfh; - size_t const err = ZSTD_getFrameHeader(&zfh, src, srcSize); - if (ZSTD_isError(err)) return err; - RETURN_ERROR_IF(err>0, srcSize_wrong); - RETURN_ERROR_IF(zfh.windowSize > windowSizeMax, - frameParameter_windowTooLarge); - return ZSTD_estimateDStreamSize((size_t)zfh.windowSize); -} - - -/* ***** Decompression ***** */ - -MEM_STATIC size_t ZSTD_limitCopy(void* dst, size_t dstCapacity, const void* src, size_t srcSize) -{ - size_t const length = MIN(dstCapacity, srcSize); - memcpy(dst, src, length); - return length; -} - - -size_t ZSTD_decompressStream(ZSTD_DStream* zds, ZSTD_outBuffer* output, ZSTD_inBuffer* input) -{ - const char* const istart = (const char*)(input->src) + input->pos; - const char* const iend = (const char*)(input->src) + input->size; - const char* ip = istart; - char* const ostart = (char*)(output->dst) + output->pos; - char* const oend = (char*)(output->dst) + output->size; - char* op = ostart; - U32 someMoreWork = 1; - - DEBUGLOG(5, "ZSTD_decompressStream"); - RETURN_ERROR_IF( - input->pos > input->size, - srcSize_wrong, - "forbidden. in: pos: %u vs size: %u", - (U32)input->pos, (U32)input->size); - RETURN_ERROR_IF( - output->pos > output->size, - dstSize_tooSmall, - "forbidden. out: pos: %u vs size: %u", - (U32)output->pos, (U32)output->size); - DEBUGLOG(5, "input size : %u", (U32)(input->size - input->pos)); - - while (someMoreWork) { - switch(zds->streamStage) - { - case zdss_init : - DEBUGLOG(5, "stage zdss_init => transparent reset "); - zds->streamStage = zdss_loadHeader; - zds->lhSize = zds->inPos = zds->outStart = zds->outEnd = 0; - zds->legacyVersion = 0; - zds->hostageByte = 0; - /* fall-through */ - - case zdss_loadHeader : - DEBUGLOG(5, "stage zdss_loadHeader (srcSize : %u)", (U32)(iend - ip)); -#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) - if (zds->legacyVersion) { - RETURN_ERROR_IF(zds->staticSize, memory_allocation, - "legacy support is incompatible with static dctx"); - { size_t const hint = ZSTD_decompressLegacyStream(zds->legacyContext, zds->legacyVersion, output, input); - if (hint==0) zds->streamStage = zdss_init; - return hint; - } } -#endif - { size_t const hSize = ZSTD_getFrameHeader_advanced(&zds->fParams, zds->headerBuffer, zds->lhSize, zds->format); - DEBUGLOG(5, "header size : %u", (U32)hSize); - if (ZSTD_isError(hSize)) { -#if defined(ZSTD_LEGACY_SUPPORT) && (ZSTD_LEGACY_SUPPORT>=1) - U32 const legacyVersion = ZSTD_isLegacy(istart, iend-istart); - if (legacyVersion) { - ZSTD_DDict const* const ddict = ZSTD_getDDict(zds); - const void* const dict = ddict ? ZSTD_DDict_dictContent(ddict) : NULL; - size_t const dictSize = ddict ? ZSTD_DDict_dictSize(ddict) : 0; - DEBUGLOG(5, "ZSTD_decompressStream: detected legacy version v0.%u", legacyVersion); - RETURN_ERROR_IF(zds->staticSize, memory_allocation, - "legacy support is incompatible with static dctx"); - FORWARD_IF_ERROR(ZSTD_initLegacyStream(&zds->legacyContext, - zds->previousLegacyVersion, legacyVersion, - dict, dictSize)); - zds->legacyVersion = zds->previousLegacyVersion = legacyVersion; - { size_t const hint = ZSTD_decompressLegacyStream(zds->legacyContext, legacyVersion, output, input); - if (hint==0) zds->streamStage = zdss_init; /* or stay in stage zdss_loadHeader */ - return hint; - } } -#endif - return hSize; /* error */ - } - if (hSize != 0) { /* need more input */ - size_t const toLoad = hSize - zds->lhSize; /* if hSize!=0, hSize > zds->lhSize */ - size_t const remainingInput = (size_t)(iend-ip); - assert(iend >= ip); - if (toLoad > remainingInput) { /* not enough input to load full header */ - if (remainingInput > 0) { - memcpy(zds->headerBuffer + zds->lhSize, ip, remainingInput); - zds->lhSize += remainingInput; - } - input->pos = input->size; - return (MAX((size_t)ZSTD_FRAMEHEADERSIZE_MIN(zds->format), hSize) - zds->lhSize) + ZSTD_blockHeaderSize; /* remaining header bytes + next block header */ - } - assert(ip != NULL); - memcpy(zds->headerBuffer + zds->lhSize, ip, toLoad); zds->lhSize = hSize; ip += toLoad; - break; - } } - - /* check for single-pass mode opportunity */ - if (zds->fParams.frameContentSize && zds->fParams.windowSize /* skippable frame if == 0 */ - && (U64)(size_t)(oend-op) >= zds->fParams.frameContentSize) { - size_t const cSize = ZSTD_findFrameCompressedSize(istart, iend-istart); - if (cSize <= (size_t)(iend-istart)) { - /* shortcut : using single-pass mode */ - size_t const decompressedSize = ZSTD_decompress_usingDDict(zds, op, oend-op, istart, cSize, ZSTD_getDDict(zds)); - if (ZSTD_isError(decompressedSize)) return decompressedSize; - DEBUGLOG(4, "shortcut to single-pass ZSTD_decompress_usingDDict()") - ip = istart + cSize; - op += decompressedSize; - zds->expected = 0; - zds->streamStage = zdss_init; - someMoreWork = 0; - break; - } } - - /* Consume header (see ZSTDds_decodeFrameHeader) */ - DEBUGLOG(4, "Consume header"); - FORWARD_IF_ERROR(ZSTD_decompressBegin_usingDDict(zds, ZSTD_getDDict(zds))); - - if ((MEM_readLE32(zds->headerBuffer) & ZSTD_MAGIC_SKIPPABLE_MASK) == ZSTD_MAGIC_SKIPPABLE_START) { /* skippable frame */ - zds->expected = MEM_readLE32(zds->headerBuffer + ZSTD_FRAMEIDSIZE); - zds->stage = ZSTDds_skipFrame; - } else { - FORWARD_IF_ERROR(ZSTD_decodeFrameHeader(zds, zds->headerBuffer, zds->lhSize)); - zds->expected = ZSTD_blockHeaderSize; - zds->stage = ZSTDds_decodeBlockHeader; - } - - /* control buffer memory usage */ - DEBUGLOG(4, "Control max memory usage (%u KB <= max %u KB)", - (U32)(zds->fParams.windowSize >>10), - (U32)(zds->maxWindowSize >> 10) ); - zds->fParams.windowSize = MAX(zds->fParams.windowSize, 1U << ZSTD_WINDOWLOG_ABSOLUTEMIN); - RETURN_ERROR_IF(zds->fParams.windowSize > zds->maxWindowSize, - frameParameter_windowTooLarge); - - /* Adapt buffer sizes to frame header instructions */ - { size_t const neededInBuffSize = MAX(zds->fParams.blockSizeMax, 4 /* frame checksum */); - size_t const neededOutBuffSize = ZSTD_decodingBufferSize_min(zds->fParams.windowSize, zds->fParams.frameContentSize); - if ((zds->inBuffSize < neededInBuffSize) || (zds->outBuffSize < neededOutBuffSize)) { - size_t const bufferSize = neededInBuffSize + neededOutBuffSize; - DEBUGLOG(4, "inBuff : from %u to %u", - (U32)zds->inBuffSize, (U32)neededInBuffSize); - DEBUGLOG(4, "outBuff : from %u to %u", - (U32)zds->outBuffSize, (U32)neededOutBuffSize); - if (zds->staticSize) { /* static DCtx */ - DEBUGLOG(4, "staticSize : %u", (U32)zds->staticSize); - assert(zds->staticSize >= sizeof(ZSTD_DCtx)); /* controlled at init */ - RETURN_ERROR_IF( - bufferSize > zds->staticSize - sizeof(ZSTD_DCtx), - memory_allocation); - } else { - ZSTD_free(zds->inBuff, zds->customMem); - zds->inBuffSize = 0; - zds->outBuffSize = 0; - zds->inBuff = (char*)ZSTD_malloc(bufferSize, zds->customMem); - RETURN_ERROR_IF(zds->inBuff == NULL, memory_allocation); - } - zds->inBuffSize = neededInBuffSize; - zds->outBuff = zds->inBuff + zds->inBuffSize; - zds->outBuffSize = neededOutBuffSize; - } } - zds->streamStage = zdss_read; - /* fall-through */ - - case zdss_read: - DEBUGLOG(5, "stage zdss_read"); - { size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds); - DEBUGLOG(5, "neededInSize = %u", (U32)neededInSize); - if (neededInSize==0) { /* end of frame */ - zds->streamStage = zdss_init; - someMoreWork = 0; - break; - } - if ((size_t)(iend-ip) >= neededInSize) { /* decode directly from src */ - int const isSkipFrame = ZSTD_isSkipFrame(zds); - size_t const decodedSize = ZSTD_decompressContinue(zds, - zds->outBuff + zds->outStart, (isSkipFrame ? 0 : zds->outBuffSize - zds->outStart), - ip, neededInSize); - if (ZSTD_isError(decodedSize)) return decodedSize; - ip += neededInSize; - if (!decodedSize && !isSkipFrame) break; /* this was just a header */ - zds->outEnd = zds->outStart + decodedSize; - zds->streamStage = zdss_flush; - break; - } } - if (ip==iend) { someMoreWork = 0; break; } /* no more input */ - zds->streamStage = zdss_load; - /* fall-through */ - - case zdss_load: - { size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds); - size_t const toLoad = neededInSize - zds->inPos; - int const isSkipFrame = ZSTD_isSkipFrame(zds); - size_t loadedSize; - if (isSkipFrame) { - loadedSize = MIN(toLoad, (size_t)(iend-ip)); - } else { - RETURN_ERROR_IF(toLoad > zds->inBuffSize - zds->inPos, - corruption_detected, - "should never happen"); - loadedSize = ZSTD_limitCopy(zds->inBuff + zds->inPos, toLoad, ip, iend-ip); - } - ip += loadedSize; - zds->inPos += loadedSize; - if (loadedSize < toLoad) { someMoreWork = 0; break; } /* not enough input, wait for more */ - - /* decode loaded input */ - { size_t const decodedSize = ZSTD_decompressContinue(zds, - zds->outBuff + zds->outStart, zds->outBuffSize - zds->outStart, - zds->inBuff, neededInSize); - if (ZSTD_isError(decodedSize)) return decodedSize; - zds->inPos = 0; /* input is consumed */ - if (!decodedSize && !isSkipFrame) { zds->streamStage = zdss_read; break; } /* this was just a header */ - zds->outEnd = zds->outStart + decodedSize; - } } - zds->streamStage = zdss_flush; - /* fall-through */ - - case zdss_flush: - { size_t const toFlushSize = zds->outEnd - zds->outStart; - size_t const flushedSize = ZSTD_limitCopy(op, oend-op, zds->outBuff + zds->outStart, toFlushSize); - op += flushedSize; - zds->outStart += flushedSize; - if (flushedSize == toFlushSize) { /* flush completed */ - zds->streamStage = zdss_read; - if ( (zds->outBuffSize < zds->fParams.frameContentSize) - && (zds->outStart + zds->fParams.blockSizeMax > zds->outBuffSize) ) { - DEBUGLOG(5, "restart filling outBuff from beginning (left:%i, needed:%u)", - (int)(zds->outBuffSize - zds->outStart), - (U32)zds->fParams.blockSizeMax); - zds->outStart = zds->outEnd = 0; - } - break; - } } - /* cannot complete flush */ - someMoreWork = 0; - break; - - default: - assert(0); /* impossible */ - RETURN_ERROR(GENERIC); /* some compiler require default to do something */ - } } - - /* result */ - input->pos = (size_t)(ip - (const char*)(input->src)); - output->pos = (size_t)(op - (char*)(output->dst)); - if ((ip==istart) && (op==ostart)) { /* no forward progress */ - zds->noForwardProgress ++; - if (zds->noForwardProgress >= ZSTD_NO_FORWARD_PROGRESS_MAX) { - RETURN_ERROR_IF(op==oend, dstSize_tooSmall); - RETURN_ERROR_IF(ip==iend, srcSize_wrong); - assert(0); - } - } else { - zds->noForwardProgress = 0; - } - { size_t nextSrcSizeHint = ZSTD_nextSrcSizeToDecompress(zds); - if (!nextSrcSizeHint) { /* frame fully decoded */ - if (zds->outEnd == zds->outStart) { /* output fully flushed */ - if (zds->hostageByte) { - if (input->pos >= input->size) { - /* can't release hostage (not present) */ - zds->streamStage = zdss_read; - return 1; - } - input->pos++; /* release hostage */ - } /* zds->hostageByte */ - return 0; - } /* zds->outEnd == zds->outStart */ - if (!zds->hostageByte) { /* output not fully flushed; keep last byte as hostage; will be released when all output is flushed */ - input->pos--; /* note : pos > 0, otherwise, impossible to finish reading last block */ - zds->hostageByte=1; - } - return 1; - } /* nextSrcSizeHint==0 */ - nextSrcSizeHint += ZSTD_blockHeaderSize * (ZSTD_nextInputType(zds) == ZSTDnit_block); /* preload header of next block */ - assert(zds->inPos <= nextSrcSizeHint); - nextSrcSizeHint -= zds->inPos; /* part already loaded*/ - return nextSrcSizeHint; - } -} - -size_t ZSTD_decompressStream_simpleArgs ( - ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, size_t* dstPos, - const void* src, size_t srcSize, size_t* srcPos) -{ - ZSTD_outBuffer output = { dst, dstCapacity, *dstPos }; - ZSTD_inBuffer input = { src, srcSize, *srcPos }; - /* ZSTD_compress_generic() will check validity of dstPos and srcPos */ - size_t const cErr = ZSTD_decompressStream(dctx, &output, &input); - *dstPos = output.pos; - *srcPos = input.pos; - return cErr; -} diff --git a/vendor/github.com/DataDog/zstd/zstd_decompress_block.c b/vendor/github.com/DataDog/zstd/zstd_decompress_block.c deleted file mode 100644 index 767e5f9a..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_decompress_block.c +++ /dev/null @@ -1,1323 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -/* zstd_decompress_block : - * this module takes care of decompressing _compressed_ block */ - -/*-******************************************************* -* Dependencies -*********************************************************/ -#include /* memcpy, memmove, memset */ -#include "compiler.h" /* prefetch */ -#include "cpu.h" /* bmi2 */ -#include "mem.h" /* low level memory routines */ -#define FSE_STATIC_LINKING_ONLY -#include "fse.h" -#define HUF_STATIC_LINKING_ONLY -#include "huf.h" -#include "zstd_internal.h" -#include "zstd_decompress_internal.h" /* ZSTD_DCtx */ -#include "zstd_ddict.h" /* ZSTD_DDictDictContent */ -#include "zstd_decompress_block.h" - -/*_******************************************************* -* Macros -**********************************************************/ - -/* These two optional macros force the use one way or another of the two - * ZSTD_decompressSequences implementations. You can't force in both directions - * at the same time. - */ -#if defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \ - defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG) -#error "Cannot force the use of the short and the long ZSTD_decompressSequences variants!" -#endif - - -/*_******************************************************* -* Memory operations -**********************************************************/ -static void ZSTD_copy4(void* dst, const void* src) { memcpy(dst, src, 4); } - - -/*-************************************************************* - * Block decoding - ***************************************************************/ - -/*! ZSTD_getcBlockSize() : - * Provides the size of compressed block from block header `src` */ -size_t ZSTD_getcBlockSize(const void* src, size_t srcSize, - blockProperties_t* bpPtr) -{ - RETURN_ERROR_IF(srcSize < ZSTD_blockHeaderSize, srcSize_wrong); - - { U32 const cBlockHeader = MEM_readLE24(src); - U32 const cSize = cBlockHeader >> 3; - bpPtr->lastBlock = cBlockHeader & 1; - bpPtr->blockType = (blockType_e)((cBlockHeader >> 1) & 3); - bpPtr->origSize = cSize; /* only useful for RLE */ - if (bpPtr->blockType == bt_rle) return 1; - RETURN_ERROR_IF(bpPtr->blockType == bt_reserved, corruption_detected); - return cSize; - } -} - - -/* Hidden declaration for fullbench */ -size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, - const void* src, size_t srcSize); -/*! ZSTD_decodeLiteralsBlock() : - * @return : nb of bytes read from src (< srcSize ) - * note : symbol not declared but exposed for fullbench */ -size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx* dctx, - const void* src, size_t srcSize) /* note : srcSize < BLOCKSIZE */ -{ - DEBUGLOG(5, "ZSTD_decodeLiteralsBlock"); - RETURN_ERROR_IF(srcSize < MIN_CBLOCK_SIZE, corruption_detected); - - { const BYTE* const istart = (const BYTE*) src; - symbolEncodingType_e const litEncType = (symbolEncodingType_e)(istart[0] & 3); - - switch(litEncType) - { - case set_repeat: - DEBUGLOG(5, "set_repeat flag : re-using stats from previous compressed literals block"); - RETURN_ERROR_IF(dctx->litEntropy==0, dictionary_corrupted); - /* fall-through */ - - case set_compressed: - RETURN_ERROR_IF(srcSize < 5, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3"); - { size_t lhSize, litSize, litCSize; - U32 singleStream=0; - U32 const lhlCode = (istart[0] >> 2) & 3; - U32 const lhc = MEM_readLE32(istart); - size_t hufSuccess; - switch(lhlCode) - { - case 0: case 1: default: /* note : default is impossible, since lhlCode into [0..3] */ - /* 2 - 2 - 10 - 10 */ - singleStream = !lhlCode; - lhSize = 3; - litSize = (lhc >> 4) & 0x3FF; - litCSize = (lhc >> 14) & 0x3FF; - break; - case 2: - /* 2 - 2 - 14 - 14 */ - lhSize = 4; - litSize = (lhc >> 4) & 0x3FFF; - litCSize = lhc >> 18; - break; - case 3: - /* 2 - 2 - 18 - 18 */ - lhSize = 5; - litSize = (lhc >> 4) & 0x3FFFF; - litCSize = (lhc >> 22) + ((size_t)istart[4] << 10); - break; - } - RETURN_ERROR_IF(litSize > ZSTD_BLOCKSIZE_MAX, corruption_detected); - RETURN_ERROR_IF(litCSize + lhSize > srcSize, corruption_detected); - - /* prefetch huffman table if cold */ - if (dctx->ddictIsCold && (litSize > 768 /* heuristic */)) { - PREFETCH_AREA(dctx->HUFptr, sizeof(dctx->entropy.hufTable)); - } - - if (litEncType==set_repeat) { - if (singleStream) { - hufSuccess = HUF_decompress1X_usingDTable_bmi2( - dctx->litBuffer, litSize, istart+lhSize, litCSize, - dctx->HUFptr, dctx->bmi2); - } else { - hufSuccess = HUF_decompress4X_usingDTable_bmi2( - dctx->litBuffer, litSize, istart+lhSize, litCSize, - dctx->HUFptr, dctx->bmi2); - } - } else { - if (singleStream) { -#if defined(HUF_FORCE_DECOMPRESS_X2) - hufSuccess = HUF_decompress1X_DCtx_wksp( - dctx->entropy.hufTable, dctx->litBuffer, litSize, - istart+lhSize, litCSize, dctx->workspace, - sizeof(dctx->workspace)); -#else - hufSuccess = HUF_decompress1X1_DCtx_wksp_bmi2( - dctx->entropy.hufTable, dctx->litBuffer, litSize, - istart+lhSize, litCSize, dctx->workspace, - sizeof(dctx->workspace), dctx->bmi2); -#endif - } else { - hufSuccess = HUF_decompress4X_hufOnly_wksp_bmi2( - dctx->entropy.hufTable, dctx->litBuffer, litSize, - istart+lhSize, litCSize, dctx->workspace, - sizeof(dctx->workspace), dctx->bmi2); - } - } - - RETURN_ERROR_IF(HUF_isError(hufSuccess), corruption_detected); - - dctx->litPtr = dctx->litBuffer; - dctx->litSize = litSize; - dctx->litEntropy = 1; - if (litEncType==set_compressed) dctx->HUFptr = dctx->entropy.hufTable; - memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH); - return litCSize + lhSize; - } - - case set_basic: - { size_t litSize, lhSize; - U32 const lhlCode = ((istart[0]) >> 2) & 3; - switch(lhlCode) - { - case 0: case 2: default: /* note : default is impossible, since lhlCode into [0..3] */ - lhSize = 1; - litSize = istart[0] >> 3; - break; - case 1: - lhSize = 2; - litSize = MEM_readLE16(istart) >> 4; - break; - case 3: - lhSize = 3; - litSize = MEM_readLE24(istart) >> 4; - break; - } - - if (lhSize+litSize+WILDCOPY_OVERLENGTH > srcSize) { /* risk reading beyond src buffer with wildcopy */ - RETURN_ERROR_IF(litSize+lhSize > srcSize, corruption_detected); - memcpy(dctx->litBuffer, istart+lhSize, litSize); - dctx->litPtr = dctx->litBuffer; - dctx->litSize = litSize; - memset(dctx->litBuffer + dctx->litSize, 0, WILDCOPY_OVERLENGTH); - return lhSize+litSize; - } - /* direct reference into compressed stream */ - dctx->litPtr = istart+lhSize; - dctx->litSize = litSize; - return lhSize+litSize; - } - - case set_rle: - { U32 const lhlCode = ((istart[0]) >> 2) & 3; - size_t litSize, lhSize; - switch(lhlCode) - { - case 0: case 2: default: /* note : default is impossible, since lhlCode into [0..3] */ - lhSize = 1; - litSize = istart[0] >> 3; - break; - case 1: - lhSize = 2; - litSize = MEM_readLE16(istart) >> 4; - break; - case 3: - lhSize = 3; - litSize = MEM_readLE24(istart) >> 4; - RETURN_ERROR_IF(srcSize<4, corruption_detected, "srcSize >= MIN_CBLOCK_SIZE == 3; here we need lhSize+1 = 4"); - break; - } - RETURN_ERROR_IF(litSize > ZSTD_BLOCKSIZE_MAX, corruption_detected); - memset(dctx->litBuffer, istart[lhSize], litSize + WILDCOPY_OVERLENGTH); - dctx->litPtr = dctx->litBuffer; - dctx->litSize = litSize; - return lhSize+1; - } - default: - RETURN_ERROR(corruption_detected, "impossible"); - } - } -} - -/* Default FSE distribution tables. - * These are pre-calculated FSE decoding tables using default distributions as defined in specification : - * https://github.com/facebook/zstd/blob/master/doc/zstd_compression_format.md#default-distributions - * They were generated programmatically with following method : - * - start from default distributions, present in /lib/common/zstd_internal.h - * - generate tables normally, using ZSTD_buildFSETable() - * - printout the content of tables - * - pretify output, report below, test with fuzzer to ensure it's correct */ - -/* Default FSE distribution table for Literal Lengths */ -static const ZSTD_seqSymbol LL_defaultDTable[(1<tableLog = 0; - DTableH->fastMode = 0; - - cell->nbBits = 0; - cell->nextState = 0; - assert(nbAddBits < 255); - cell->nbAdditionalBits = (BYTE)nbAddBits; - cell->baseValue = baseValue; -} - - -/* ZSTD_buildFSETable() : - * generate FSE decoding table for one symbol (ll, ml or off) - * cannot fail if input is valid => - * all inputs are presumed validated at this stage */ -void -ZSTD_buildFSETable(ZSTD_seqSymbol* dt, - const short* normalizedCounter, unsigned maxSymbolValue, - const U32* baseValue, const U32* nbAdditionalBits, - unsigned tableLog) -{ - ZSTD_seqSymbol* const tableDecode = dt+1; - U16 symbolNext[MaxSeq+1]; - - U32 const maxSV1 = maxSymbolValue + 1; - U32 const tableSize = 1 << tableLog; - U32 highThreshold = tableSize-1; - - /* Sanity Checks */ - assert(maxSymbolValue <= MaxSeq); - assert(tableLog <= MaxFSELog); - - /* Init, lay down lowprob symbols */ - { ZSTD_seqSymbol_header DTableH; - DTableH.tableLog = tableLog; - DTableH.fastMode = 1; - { S16 const largeLimit= (S16)(1 << (tableLog-1)); - U32 s; - for (s=0; s= largeLimit) DTableH.fastMode=0; - assert(normalizedCounter[s]>=0); - symbolNext[s] = (U16)normalizedCounter[s]; - } } } - memcpy(dt, &DTableH, sizeof(DTableH)); - } - - /* Spread symbols */ - { U32 const tableMask = tableSize-1; - U32 const step = FSE_TABLESTEP(tableSize); - U32 s, position = 0; - for (s=0; s highThreshold) position = (position + step) & tableMask; /* lowprob area */ - } } - assert(position == 0); /* position must reach all cells once, otherwise normalizedCounter is incorrect */ - } - - /* Build Decoding table */ - { U32 u; - for (u=0; u max, corruption_detected); - { U32 const symbol = *(const BYTE*)src; - U32 const baseline = baseValue[symbol]; - U32 const nbBits = nbAdditionalBits[symbol]; - ZSTD_buildSeqTable_rle(DTableSpace, baseline, nbBits); - } - *DTablePtr = DTableSpace; - return 1; - case set_basic : - *DTablePtr = defaultTable; - return 0; - case set_repeat: - RETURN_ERROR_IF(!flagRepeatTable, corruption_detected); - /* prefetch FSE table if used */ - if (ddictIsCold && (nbSeq > 24 /* heuristic */)) { - const void* const pStart = *DTablePtr; - size_t const pSize = sizeof(ZSTD_seqSymbol) * (SEQSYMBOL_TABLE_SIZE(maxLog)); - PREFETCH_AREA(pStart, pSize); - } - return 0; - case set_compressed : - { unsigned tableLog; - S16 norm[MaxSeq+1]; - size_t const headerSize = FSE_readNCount(norm, &max, &tableLog, src, srcSize); - RETURN_ERROR_IF(FSE_isError(headerSize), corruption_detected); - RETURN_ERROR_IF(tableLog > maxLog, corruption_detected); - ZSTD_buildFSETable(DTableSpace, norm, max, baseValue, nbAdditionalBits, tableLog); - *DTablePtr = DTableSpace; - return headerSize; - } - default : - assert(0); - RETURN_ERROR(GENERIC, "impossible"); - } -} - -size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, - const void* src, size_t srcSize) -{ - const BYTE* const istart = (const BYTE* const)src; - const BYTE* const iend = istart + srcSize; - const BYTE* ip = istart; - int nbSeq; - DEBUGLOG(5, "ZSTD_decodeSeqHeaders"); - - /* check */ - RETURN_ERROR_IF(srcSize < MIN_SEQUENCES_SIZE, srcSize_wrong); - - /* SeqHead */ - nbSeq = *ip++; - if (!nbSeq) { - *nbSeqPtr=0; - RETURN_ERROR_IF(srcSize != 1, srcSize_wrong); - return 1; - } - if (nbSeq > 0x7F) { - if (nbSeq == 0xFF) { - RETURN_ERROR_IF(ip+2 > iend, srcSize_wrong); - nbSeq = MEM_readLE16(ip) + LONGNBSEQ, ip+=2; - } else { - RETURN_ERROR_IF(ip >= iend, srcSize_wrong); - nbSeq = ((nbSeq-0x80)<<8) + *ip++; - } - } - *nbSeqPtr = nbSeq; - - /* FSE table descriptors */ - RETURN_ERROR_IF(ip+1 > iend, srcSize_wrong); /* minimum possible size: 1 byte for symbol encoding types */ - { symbolEncodingType_e const LLtype = (symbolEncodingType_e)(*ip >> 6); - symbolEncodingType_e const OFtype = (symbolEncodingType_e)((*ip >> 4) & 3); - symbolEncodingType_e const MLtype = (symbolEncodingType_e)((*ip >> 2) & 3); - ip++; - - /* Build DTables */ - { size_t const llhSize = ZSTD_buildSeqTable(dctx->entropy.LLTable, &dctx->LLTptr, - LLtype, MaxLL, LLFSELog, - ip, iend-ip, - LL_base, LL_bits, - LL_defaultDTable, dctx->fseEntropy, - dctx->ddictIsCold, nbSeq); - RETURN_ERROR_IF(ZSTD_isError(llhSize), corruption_detected); - ip += llhSize; - } - - { size_t const ofhSize = ZSTD_buildSeqTable(dctx->entropy.OFTable, &dctx->OFTptr, - OFtype, MaxOff, OffFSELog, - ip, iend-ip, - OF_base, OF_bits, - OF_defaultDTable, dctx->fseEntropy, - dctx->ddictIsCold, nbSeq); - RETURN_ERROR_IF(ZSTD_isError(ofhSize), corruption_detected); - ip += ofhSize; - } - - { size_t const mlhSize = ZSTD_buildSeqTable(dctx->entropy.MLTable, &dctx->MLTptr, - MLtype, MaxML, MLFSELog, - ip, iend-ip, - ML_base, ML_bits, - ML_defaultDTable, dctx->fseEntropy, - dctx->ddictIsCold, nbSeq); - RETURN_ERROR_IF(ZSTD_isError(mlhSize), corruption_detected); - ip += mlhSize; - } - } - - return ip-istart; -} - - -typedef struct { - size_t litLength; - size_t matchLength; - size_t offset; - const BYTE* match; -} seq_t; - -typedef struct { - size_t state; - const ZSTD_seqSymbol* table; -} ZSTD_fseState; - -typedef struct { - BIT_DStream_t DStream; - ZSTD_fseState stateLL; - ZSTD_fseState stateOffb; - ZSTD_fseState stateML; - size_t prevOffset[ZSTD_REP_NUM]; - const BYTE* prefixStart; - const BYTE* dictEnd; - size_t pos; -} seqState_t; - -/*! ZSTD_overlapCopy8() : - * Copies 8 bytes from ip to op and updates op and ip where ip <= op. - * If the offset is < 8 then the offset is spread to at least 8 bytes. - * - * Precondition: *ip <= *op - * Postcondition: *op - *op >= 8 - */ -static void ZSTD_overlapCopy8(BYTE** op, BYTE const** ip, size_t offset) { - assert(*ip <= *op); - if (offset < 8) { - /* close range match, overlap */ - static const U32 dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 }; /* added */ - static const int dec64table[] = { 8, 8, 8, 7, 8, 9,10,11 }; /* subtracted */ - int const sub2 = dec64table[offset]; - (*op)[0] = (*ip)[0]; - (*op)[1] = (*ip)[1]; - (*op)[2] = (*ip)[2]; - (*op)[3] = (*ip)[3]; - *ip += dec32table[offset]; - ZSTD_copy4(*op+4, *ip); - *ip -= sub2; - } else { - ZSTD_copy8(*op, *ip); - } - *ip += 8; - *op += 8; - assert(*op - *ip >= 8); -} - -/*! ZSTD_safecopy() : - * Specialized version of memcpy() that is allowed to READ up to WILDCOPY_OVERLENGTH past the input buffer - * and write up to 16 bytes past oend_w (op >= oend_w is allowed). - * This function is only called in the uncommon case where the sequence is near the end of the block. It - * should be fast for a single long sequence, but can be slow for several short sequences. - * - * @param ovtype controls the overlap detection - * - ZSTD_no_overlap: The source and destination are guaranteed to be at least WILDCOPY_VECLEN bytes apart. - * - ZSTD_overlap_src_before_dst: The src and dst may overlap and may be any distance apart. - * The src buffer must be before the dst buffer. - */ -static void ZSTD_safecopy(BYTE* op, BYTE* const oend_w, BYTE const* ip, ptrdiff_t length, ZSTD_overlap_e ovtype) { - ptrdiff_t const diff = op - ip; - BYTE* const oend = op + length; - - assert((ovtype == ZSTD_no_overlap && (diff <= -8 || diff >= 8 || op >= oend_w)) || - (ovtype == ZSTD_overlap_src_before_dst && diff >= 0)); - - if (length < 8) { - /* Handle short lengths. */ - while (op < oend) *op++ = *ip++; - return; - } - if (ovtype == ZSTD_overlap_src_before_dst) { - /* Copy 8 bytes and ensure the offset >= 8 when there can be overlap. */ - assert(length >= 8); - ZSTD_overlapCopy8(&op, &ip, diff); - assert(op - ip >= 8); - assert(op <= oend); - } - - if (oend <= oend_w) { - /* No risk of overwrite. */ - ZSTD_wildcopy(op, ip, length, ovtype); - return; - } - if (op <= oend_w) { - /* Wildcopy until we get close to the end. */ - assert(oend > oend_w); - ZSTD_wildcopy(op, ip, oend_w - op, ovtype); - ip += oend_w - op; - op = oend_w; - } - /* Handle the leftovers. */ - while (op < oend) *op++ = *ip++; -} - -/* ZSTD_execSequenceEnd(): - * This version handles cases that are near the end of the output buffer. It requires - * more careful checks to make sure there is no overflow. By separating out these hard - * and unlikely cases, we can speed up the common cases. - * - * NOTE: This function needs to be fast for a single long sequence, but doesn't need - * to be optimized for many small sequences, since those fall into ZSTD_execSequence(). - */ -FORCE_NOINLINE -size_t ZSTD_execSequenceEnd(BYTE* op, - BYTE* const oend, seq_t sequence, - const BYTE** litPtr, const BYTE* const litLimit, - const BYTE* const prefixStart, const BYTE* const virtualStart, const BYTE* const dictEnd) -{ - BYTE* const oLitEnd = op + sequence.litLength; - size_t const sequenceLength = sequence.litLength + sequence.matchLength; - BYTE* const oMatchEnd = op + sequenceLength; /* risk : address space overflow (32-bits) */ - const BYTE* const iLitEnd = *litPtr + sequence.litLength; - const BYTE* match = oLitEnd - sequence.offset; - BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH; - - /* bounds checks */ - assert(oLitEnd < oMatchEnd); - RETURN_ERROR_IF(oMatchEnd > oend, dstSize_tooSmall, "last match must fit within dstBuffer"); - RETURN_ERROR_IF(iLitEnd > litLimit, corruption_detected, "try to read beyond literal buffer"); - - /* copy literals */ - ZSTD_safecopy(op, oend_w, *litPtr, sequence.litLength, ZSTD_no_overlap); - op = oLitEnd; - *litPtr = iLitEnd; - - /* copy Match */ - if (sequence.offset > (size_t)(oLitEnd - prefixStart)) { - /* offset beyond prefix */ - RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected); - match = dictEnd - (prefixStart-match); - if (match + sequence.matchLength <= dictEnd) { - memmove(oLitEnd, match, sequence.matchLength); - return sequenceLength; - } - /* span extDict & currentPrefixSegment */ - { size_t const length1 = dictEnd - match; - memmove(oLitEnd, match, length1); - op = oLitEnd + length1; - sequence.matchLength -= length1; - match = prefixStart; - } } - ZSTD_safecopy(op, oend_w, match, sequence.matchLength, ZSTD_overlap_src_before_dst); - return sequenceLength; -} - -HINT_INLINE -size_t ZSTD_execSequence(BYTE* op, - BYTE* const oend, seq_t sequence, - const BYTE** litPtr, const BYTE* const litLimit, - const BYTE* const prefixStart, const BYTE* const virtualStart, const BYTE* const dictEnd) -{ - BYTE* const oLitEnd = op + sequence.litLength; - size_t const sequenceLength = sequence.litLength + sequence.matchLength; - BYTE* const oMatchEnd = op + sequenceLength; /* risk : address space overflow (32-bits) */ - BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH; - const BYTE* const iLitEnd = *litPtr + sequence.litLength; - const BYTE* match = oLitEnd - sequence.offset; - - /* Errors and uncommon cases handled here. */ - assert(oLitEnd < oMatchEnd); - if (iLitEnd > litLimit || oMatchEnd > oend_w) - return ZSTD_execSequenceEnd(op, oend, sequence, litPtr, litLimit, prefixStart, virtualStart, dictEnd); - - /* Assumptions (everything else goes into ZSTD_execSequenceEnd()) */ - assert(iLitEnd <= litLimit /* Literal length is in bounds */); - assert(oLitEnd <= oend_w /* Can wildcopy literals */); - assert(oMatchEnd <= oend_w /* Can wildcopy matches */); - - /* Copy Literals: - * Split out litLength <= 16 since it is nearly always true. +1.6% on gcc-9. - * We likely don't need the full 32-byte wildcopy. - */ - assert(WILDCOPY_OVERLENGTH >= 16); - ZSTD_copy16(op, (*litPtr)); - if (sequence.litLength > 16) { - ZSTD_wildcopy(op+16, (*litPtr)+16, sequence.litLength-16, ZSTD_no_overlap); - } - op = oLitEnd; - *litPtr = iLitEnd; /* update for next sequence */ - - /* Copy Match */ - if (sequence.offset > (size_t)(oLitEnd - prefixStart)) { - /* offset beyond prefix -> go into extDict */ - RETURN_ERROR_IF(sequence.offset > (size_t)(oLitEnd - virtualStart), corruption_detected); - match = dictEnd + (match - prefixStart); - if (match + sequence.matchLength <= dictEnd) { - memmove(oLitEnd, match, sequence.matchLength); - return sequenceLength; - } - /* span extDict & currentPrefixSegment */ - { size_t const length1 = dictEnd - match; - memmove(oLitEnd, match, length1); - op = oLitEnd + length1; - sequence.matchLength -= length1; - match = prefixStart; - } } - /* Match within prefix of 1 or more bytes */ - assert(op <= oMatchEnd); - assert(oMatchEnd <= oend_w); - assert(match >= prefixStart); - assert(sequence.matchLength >= 1); - - /* Nearly all offsets are >= WILDCOPY_VECLEN bytes, which means we can use wildcopy - * without overlap checking. - */ - if (sequence.offset >= WILDCOPY_VECLEN) { - /* We bet on a full wildcopy for matches, since we expect matches to be - * longer than literals (in general). In silesia, ~10% of matches are longer - * than 16 bytes. - */ - ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength, ZSTD_no_overlap); - return sequenceLength; - } - assert(sequence.offset < WILDCOPY_VECLEN); - - /* Copy 8 bytes and spread the offset to be >= 8. */ - ZSTD_overlapCopy8(&op, &match, sequence.offset); - - /* If the match length is > 8 bytes, then continue with the wildcopy. */ - if (sequence.matchLength > 8) { - assert(op < oMatchEnd); - ZSTD_wildcopy(op, match, (ptrdiff_t)sequence.matchLength-8, ZSTD_overlap_src_before_dst); - } - return sequenceLength; -} - -static void -ZSTD_initFseState(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD, const ZSTD_seqSymbol* dt) -{ - const void* ptr = dt; - const ZSTD_seqSymbol_header* const DTableH = (const ZSTD_seqSymbol_header*)ptr; - DStatePtr->state = BIT_readBits(bitD, DTableH->tableLog); - DEBUGLOG(6, "ZSTD_initFseState : val=%u using %u bits", - (U32)DStatePtr->state, DTableH->tableLog); - BIT_reloadDStream(bitD); - DStatePtr->table = dt + 1; -} - -FORCE_INLINE_TEMPLATE void -ZSTD_updateFseState(ZSTD_fseState* DStatePtr, BIT_DStream_t* bitD) -{ - ZSTD_seqSymbol const DInfo = DStatePtr->table[DStatePtr->state]; - U32 const nbBits = DInfo.nbBits; - size_t const lowBits = BIT_readBits(bitD, nbBits); - DStatePtr->state = DInfo.nextState + lowBits; -} - -/* We need to add at most (ZSTD_WINDOWLOG_MAX_32 - 1) bits to read the maximum - * offset bits. But we can only read at most (STREAM_ACCUMULATOR_MIN_32 - 1) - * bits before reloading. This value is the maximum number of bytes we read - * after reloading when we are decoding long offsets. - */ -#define LONG_OFFSETS_MAX_EXTRA_BITS_32 \ - (ZSTD_WINDOWLOG_MAX_32 > STREAM_ACCUMULATOR_MIN_32 \ - ? ZSTD_WINDOWLOG_MAX_32 - STREAM_ACCUMULATOR_MIN_32 \ - : 0) - -typedef enum { ZSTD_lo_isRegularOffset, ZSTD_lo_isLongOffset=1 } ZSTD_longOffset_e; - -#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG -FORCE_INLINE_TEMPLATE seq_t -ZSTD_decodeSequence(seqState_t* seqState, const ZSTD_longOffset_e longOffsets) -{ - seq_t seq; - U32 const llBits = seqState->stateLL.table[seqState->stateLL.state].nbAdditionalBits; - U32 const mlBits = seqState->stateML.table[seqState->stateML.state].nbAdditionalBits; - U32 const ofBits = seqState->stateOffb.table[seqState->stateOffb.state].nbAdditionalBits; - U32 const totalBits = llBits+mlBits+ofBits; - U32 const llBase = seqState->stateLL.table[seqState->stateLL.state].baseValue; - U32 const mlBase = seqState->stateML.table[seqState->stateML.state].baseValue; - U32 const ofBase = seqState->stateOffb.table[seqState->stateOffb.state].baseValue; - - /* sequence */ - { size_t offset; - if (!ofBits) - offset = 0; - else { - ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1); - ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5); - assert(ofBits <= MaxOff); - if (MEM_32bits() && longOffsets && (ofBits >= STREAM_ACCUMULATOR_MIN_32)) { - U32 const extraBits = ofBits - MIN(ofBits, 32 - seqState->DStream.bitsConsumed); - offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits); - BIT_reloadDStream(&seqState->DStream); - if (extraBits) offset += BIT_readBitsFast(&seqState->DStream, extraBits); - assert(extraBits <= LONG_OFFSETS_MAX_EXTRA_BITS_32); /* to avoid another reload */ - } else { - offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits/*>0*/); /* <= (ZSTD_WINDOWLOG_MAX-1) bits */ - if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); - } - } - - if (ofBits <= 1) { - offset += (llBase==0); - if (offset) { - size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset]; - temp += !temp; /* 0 is not valid; input is corrupted; force offset to 1 */ - if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1]; - seqState->prevOffset[1] = seqState->prevOffset[0]; - seqState->prevOffset[0] = offset = temp; - } else { /* offset == 0 */ - offset = seqState->prevOffset[0]; - } - } else { - seqState->prevOffset[2] = seqState->prevOffset[1]; - seqState->prevOffset[1] = seqState->prevOffset[0]; - seqState->prevOffset[0] = offset; - } - seq.offset = offset; - } - - seq.matchLength = mlBase - + ((mlBits>0) ? BIT_readBitsFast(&seqState->DStream, mlBits/*>0*/) : 0); /* <= 16 bits */ - if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32)) - BIT_reloadDStream(&seqState->DStream); - if (MEM_64bits() && (totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog))) - BIT_reloadDStream(&seqState->DStream); - /* Ensure there are enough bits to read the rest of data in 64-bit mode. */ - ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64); - - seq.litLength = llBase - + ((llBits>0) ? BIT_readBitsFast(&seqState->DStream, llBits/*>0*/) : 0); /* <= 16 bits */ - if (MEM_32bits()) - BIT_reloadDStream(&seqState->DStream); - - DEBUGLOG(6, "seq: litL=%u, matchL=%u, offset=%u", - (U32)seq.litLength, (U32)seq.matchLength, (U32)seq.offset); - - /* ANS state update */ - ZSTD_updateFseState(&seqState->stateLL, &seqState->DStream); /* <= 9 bits */ - ZSTD_updateFseState(&seqState->stateML, &seqState->DStream); /* <= 9 bits */ - if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */ - ZSTD_updateFseState(&seqState->stateOffb, &seqState->DStream); /* <= 8 bits */ - - return seq; -} - -FORCE_INLINE_TEMPLATE size_t -DONT_VECTORIZE -ZSTD_decompressSequences_body( ZSTD_DCtx* dctx, - void* dst, size_t maxDstSize, - const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset) -{ - const BYTE* ip = (const BYTE*)seqStart; - const BYTE* const iend = ip + seqSize; - BYTE* const ostart = (BYTE* const)dst; - BYTE* const oend = ostart + maxDstSize; - BYTE* op = ostart; - const BYTE* litPtr = dctx->litPtr; - const BYTE* const litEnd = litPtr + dctx->litSize; - const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart); - const BYTE* const vBase = (const BYTE*) (dctx->virtualStart); - const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd); - DEBUGLOG(5, "ZSTD_decompressSequences_body"); - - /* Regen sequences */ - if (nbSeq) { - seqState_t seqState; - dctx->fseEntropy = 1; - { U32 i; for (i=0; ientropy.rep[i]; } - RETURN_ERROR_IF( - ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend-ip)), - corruption_detected); - ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr); - ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr); - ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr); - - ZSTD_STATIC_ASSERT( - BIT_DStream_unfinished < BIT_DStream_completed && - BIT_DStream_endOfBuffer < BIT_DStream_completed && - BIT_DStream_completed < BIT_DStream_overflow); - - for ( ; (BIT_reloadDStream(&(seqState.DStream)) <= BIT_DStream_completed) && nbSeq ; ) { - nbSeq--; - { seq_t const sequence = ZSTD_decodeSequence(&seqState, isLongOffset); - size_t const oneSeqSize = ZSTD_execSequence(op, oend, sequence, &litPtr, litEnd, prefixStart, vBase, dictEnd); - DEBUGLOG(6, "regenerated sequence size : %u", (U32)oneSeqSize); - if (ZSTD_isError(oneSeqSize)) return oneSeqSize; - op += oneSeqSize; - } } - - /* check if reached exact end */ - DEBUGLOG(5, "ZSTD_decompressSequences_body: after decode loop, remaining nbSeq : %i", nbSeq); - RETURN_ERROR_IF(nbSeq, corruption_detected); - RETURN_ERROR_IF(BIT_reloadDStream(&seqState.DStream) < BIT_DStream_completed, corruption_detected); - /* save reps for next block */ - { U32 i; for (i=0; ientropy.rep[i] = (U32)(seqState.prevOffset[i]); } - } - - /* last literal segment */ - { size_t const lastLLSize = litEnd - litPtr; - RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall); - memcpy(op, litPtr, lastLLSize); - op += lastLLSize; - } - - return op-ostart; -} - -static size_t -ZSTD_decompressSequences_default(ZSTD_DCtx* dctx, - void* dst, size_t maxDstSize, - const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset) -{ - return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); -} -#endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */ - - - -#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT -FORCE_INLINE_TEMPLATE seq_t -ZSTD_decodeSequenceLong(seqState_t* seqState, ZSTD_longOffset_e const longOffsets) -{ - seq_t seq; - U32 const llBits = seqState->stateLL.table[seqState->stateLL.state].nbAdditionalBits; - U32 const mlBits = seqState->stateML.table[seqState->stateML.state].nbAdditionalBits; - U32 const ofBits = seqState->stateOffb.table[seqState->stateOffb.state].nbAdditionalBits; - U32 const totalBits = llBits+mlBits+ofBits; - U32 const llBase = seqState->stateLL.table[seqState->stateLL.state].baseValue; - U32 const mlBase = seqState->stateML.table[seqState->stateML.state].baseValue; - U32 const ofBase = seqState->stateOffb.table[seqState->stateOffb.state].baseValue; - - /* sequence */ - { size_t offset; - if (!ofBits) - offset = 0; - else { - ZSTD_STATIC_ASSERT(ZSTD_lo_isLongOffset == 1); - ZSTD_STATIC_ASSERT(LONG_OFFSETS_MAX_EXTRA_BITS_32 == 5); - assert(ofBits <= MaxOff); - if (MEM_32bits() && longOffsets) { - U32 const extraBits = ofBits - MIN(ofBits, STREAM_ACCUMULATOR_MIN_32-1); - offset = ofBase + (BIT_readBitsFast(&seqState->DStream, ofBits - extraBits) << extraBits); - if (MEM_32bits() || extraBits) BIT_reloadDStream(&seqState->DStream); - if (extraBits) offset += BIT_readBitsFast(&seqState->DStream, extraBits); - } else { - offset = ofBase + BIT_readBitsFast(&seqState->DStream, ofBits); /* <= (ZSTD_WINDOWLOG_MAX-1) bits */ - if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); - } - } - - if (ofBits <= 1) { - offset += (llBase==0); - if (offset) { - size_t temp = (offset==3) ? seqState->prevOffset[0] - 1 : seqState->prevOffset[offset]; - temp += !temp; /* 0 is not valid; input is corrupted; force offset to 1 */ - if (offset != 1) seqState->prevOffset[2] = seqState->prevOffset[1]; - seqState->prevOffset[1] = seqState->prevOffset[0]; - seqState->prevOffset[0] = offset = temp; - } else { - offset = seqState->prevOffset[0]; - } - } else { - seqState->prevOffset[2] = seqState->prevOffset[1]; - seqState->prevOffset[1] = seqState->prevOffset[0]; - seqState->prevOffset[0] = offset; - } - seq.offset = offset; - } - - seq.matchLength = mlBase + ((mlBits>0) ? BIT_readBitsFast(&seqState->DStream, mlBits) : 0); /* <= 16 bits */ - if (MEM_32bits() && (mlBits+llBits >= STREAM_ACCUMULATOR_MIN_32-LONG_OFFSETS_MAX_EXTRA_BITS_32)) - BIT_reloadDStream(&seqState->DStream); - if (MEM_64bits() && (totalBits >= STREAM_ACCUMULATOR_MIN_64-(LLFSELog+MLFSELog+OffFSELog))) - BIT_reloadDStream(&seqState->DStream); - /* Verify that there is enough bits to read the rest of the data in 64-bit mode. */ - ZSTD_STATIC_ASSERT(16+LLFSELog+MLFSELog+OffFSELog < STREAM_ACCUMULATOR_MIN_64); - - seq.litLength = llBase + ((llBits>0) ? BIT_readBitsFast(&seqState->DStream, llBits) : 0); /* <= 16 bits */ - if (MEM_32bits()) - BIT_reloadDStream(&seqState->DStream); - - { size_t const pos = seqState->pos + seq.litLength; - const BYTE* const matchBase = (seq.offset > pos) ? seqState->dictEnd : seqState->prefixStart; - seq.match = matchBase + pos - seq.offset; /* note : this operation can overflow when seq.offset is really too large, which can only happen when input is corrupted. - * No consequence though : no memory access will occur, overly large offset will be detected in ZSTD_execSequenceLong() */ - seqState->pos = pos + seq.matchLength; - } - - /* ANS state update */ - ZSTD_updateFseState(&seqState->stateLL, &seqState->DStream); /* <= 9 bits */ - ZSTD_updateFseState(&seqState->stateML, &seqState->DStream); /* <= 9 bits */ - if (MEM_32bits()) BIT_reloadDStream(&seqState->DStream); /* <= 18 bits */ - ZSTD_updateFseState(&seqState->stateOffb, &seqState->DStream); /* <= 8 bits */ - - return seq; -} - -FORCE_INLINE_TEMPLATE size_t -ZSTD_decompressSequencesLong_body( - ZSTD_DCtx* dctx, - void* dst, size_t maxDstSize, - const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset) -{ - const BYTE* ip = (const BYTE*)seqStart; - const BYTE* const iend = ip + seqSize; - BYTE* const ostart = (BYTE* const)dst; - BYTE* const oend = ostart + maxDstSize; - BYTE* op = ostart; - const BYTE* litPtr = dctx->litPtr; - const BYTE* const litEnd = litPtr + dctx->litSize; - const BYTE* const prefixStart = (const BYTE*) (dctx->prefixStart); - const BYTE* const dictStart = (const BYTE*) (dctx->virtualStart); - const BYTE* const dictEnd = (const BYTE*) (dctx->dictEnd); - - /* Regen sequences */ - if (nbSeq) { -#define STORED_SEQS 4 -#define STORED_SEQS_MASK (STORED_SEQS-1) -#define ADVANCED_SEQS 4 - seq_t sequences[STORED_SEQS]; - int const seqAdvance = MIN(nbSeq, ADVANCED_SEQS); - seqState_t seqState; - int seqNb; - dctx->fseEntropy = 1; - { int i; for (i=0; ientropy.rep[i]; } - seqState.prefixStart = prefixStart; - seqState.pos = (size_t)(op-prefixStart); - seqState.dictEnd = dictEnd; - assert(iend >= ip); - RETURN_ERROR_IF( - ERR_isError(BIT_initDStream(&seqState.DStream, ip, iend-ip)), - corruption_detected); - ZSTD_initFseState(&seqState.stateLL, &seqState.DStream, dctx->LLTptr); - ZSTD_initFseState(&seqState.stateOffb, &seqState.DStream, dctx->OFTptr); - ZSTD_initFseState(&seqState.stateML, &seqState.DStream, dctx->MLTptr); - - /* prepare in advance */ - for (seqNb=0; (BIT_reloadDStream(&seqState.DStream) <= BIT_DStream_completed) && (seqNbentropy.rep[i] = (U32)(seqState.prevOffset[i]); } - } - - /* last literal segment */ - { size_t const lastLLSize = litEnd - litPtr; - RETURN_ERROR_IF(lastLLSize > (size_t)(oend-op), dstSize_tooSmall); - memcpy(op, litPtr, lastLLSize); - op += lastLLSize; - } - - return op-ostart; -} - -static size_t -ZSTD_decompressSequencesLong_default(ZSTD_DCtx* dctx, - void* dst, size_t maxDstSize, - const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset) -{ - return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); -} -#endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT */ - - - -#if DYNAMIC_BMI2 - -#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG -static TARGET_ATTRIBUTE("bmi2") size_t -DONT_VECTORIZE -ZSTD_decompressSequences_bmi2(ZSTD_DCtx* dctx, - void* dst, size_t maxDstSize, - const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset) -{ - return ZSTD_decompressSequences_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); -} -#endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */ - -#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT -static TARGET_ATTRIBUTE("bmi2") size_t -ZSTD_decompressSequencesLong_bmi2(ZSTD_DCtx* dctx, - void* dst, size_t maxDstSize, - const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset) -{ - return ZSTD_decompressSequencesLong_body(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); -} -#endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT */ - -#endif /* DYNAMIC_BMI2 */ - -typedef size_t (*ZSTD_decompressSequences_t)( - ZSTD_DCtx* dctx, - void* dst, size_t maxDstSize, - const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset); - -#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG -static size_t -ZSTD_decompressSequences(ZSTD_DCtx* dctx, void* dst, size_t maxDstSize, - const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset) -{ - DEBUGLOG(5, "ZSTD_decompressSequences"); -#if DYNAMIC_BMI2 - if (dctx->bmi2) { - return ZSTD_decompressSequences_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); - } -#endif - return ZSTD_decompressSequences_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); -} -#endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG */ - - -#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT -/* ZSTD_decompressSequencesLong() : - * decompression function triggered when a minimum share of offsets is considered "long", - * aka out of cache. - * note : "long" definition seems overloaded here, sometimes meaning "wider than bitstream register", and sometimes meaning "farther than memory cache distance". - * This function will try to mitigate main memory latency through the use of prefetching */ -static size_t -ZSTD_decompressSequencesLong(ZSTD_DCtx* dctx, - void* dst, size_t maxDstSize, - const void* seqStart, size_t seqSize, int nbSeq, - const ZSTD_longOffset_e isLongOffset) -{ - DEBUGLOG(5, "ZSTD_decompressSequencesLong"); -#if DYNAMIC_BMI2 - if (dctx->bmi2) { - return ZSTD_decompressSequencesLong_bmi2(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); - } -#endif - return ZSTD_decompressSequencesLong_default(dctx, dst, maxDstSize, seqStart, seqSize, nbSeq, isLongOffset); -} -#endif /* ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT */ - - - -#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \ - !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG) -/* ZSTD_getLongOffsetsShare() : - * condition : offTable must be valid - * @return : "share" of long offsets (arbitrarily defined as > (1<<23)) - * compared to maximum possible of (1< 22) total += 1; - } - - assert(tableLog <= OffFSELog); - total <<= (OffFSELog - tableLog); /* scale to OffFSELog */ - - return total; -} -#endif - - -size_t -ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, const int frame) -{ /* blockType == blockCompressed */ - const BYTE* ip = (const BYTE*)src; - /* isLongOffset must be true if there are long offsets. - * Offsets are long if they are larger than 2^STREAM_ACCUMULATOR_MIN. - * We don't expect that to be the case in 64-bit mode. - * In block mode, window size is not known, so we have to be conservative. - * (note: but it could be evaluated from current-lowLimit) - */ - ZSTD_longOffset_e const isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (!frame || (dctx->fParams.windowSize > (1ULL << STREAM_ACCUMULATOR_MIN)))); - DEBUGLOG(5, "ZSTD_decompressBlock_internal (size : %u)", (U32)srcSize); - - RETURN_ERROR_IF(srcSize >= ZSTD_BLOCKSIZE_MAX, srcSize_wrong); - - /* Decode literals section */ - { size_t const litCSize = ZSTD_decodeLiteralsBlock(dctx, src, srcSize); - DEBUGLOG(5, "ZSTD_decodeLiteralsBlock : %u", (U32)litCSize); - if (ZSTD_isError(litCSize)) return litCSize; - ip += litCSize; - srcSize -= litCSize; - } - - /* Build Decoding Tables */ - { - /* These macros control at build-time which decompressor implementation - * we use. If neither is defined, we do some inspection and dispatch at - * runtime. - */ -#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \ - !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG) - int usePrefetchDecoder = dctx->ddictIsCold; -#endif - int nbSeq; - size_t const seqHSize = ZSTD_decodeSeqHeaders(dctx, &nbSeq, ip, srcSize); - if (ZSTD_isError(seqHSize)) return seqHSize; - ip += seqHSize; - srcSize -= seqHSize; - -#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \ - !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG) - if ( !usePrefetchDecoder - && (!frame || (dctx->fParams.windowSize > (1<<24))) - && (nbSeq>ADVANCED_SEQS) ) { /* could probably use a larger nbSeq limit */ - U32 const shareLongOffsets = ZSTD_getLongOffsetsShare(dctx->OFTptr); - U32 const minShare = MEM_64bits() ? 7 : 20; /* heuristic values, correspond to 2.73% and 7.81% */ - usePrefetchDecoder = (shareLongOffsets >= minShare); - } -#endif - - dctx->ddictIsCold = 0; - -#if !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT) && \ - !defined(ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG) - if (usePrefetchDecoder) -#endif -#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT - return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset); -#endif - -#ifndef ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG - /* else */ - return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize, nbSeq, isLongOffset); -#endif - } -} - - -size_t ZSTD_decompressBlock(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize) -{ - size_t dSize; - ZSTD_checkContinuity(dctx, dst); - dSize = ZSTD_decompressBlock_internal(dctx, dst, dstCapacity, src, srcSize, /* frame */ 0); - dctx->previousDstEnd = (char*)dst + dSize; - return dSize; -} diff --git a/vendor/github.com/DataDog/zstd/zstd_decompress_block.h b/vendor/github.com/DataDog/zstd/zstd_decompress_block.h deleted file mode 100644 index 7e929604..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_decompress_block.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -#ifndef ZSTD_DEC_BLOCK_H -#define ZSTD_DEC_BLOCK_H - -/*-******************************************************* - * Dependencies - *********************************************************/ -#include /* size_t */ -#include "zstd.h" /* DCtx, and some public functions */ -#include "zstd_internal.h" /* blockProperties_t, and some public functions */ -#include "zstd_decompress_internal.h" /* ZSTD_seqSymbol */ - - -/* === Prototypes === */ - -/* note: prototypes already published within `zstd.h` : - * ZSTD_decompressBlock() - */ - -/* note: prototypes already published within `zstd_internal.h` : - * ZSTD_getcBlockSize() - * ZSTD_decodeSeqHeaders() - */ - - -/* ZSTD_decompressBlock_internal() : - * decompress block, starting at `src`, - * into destination buffer `dst`. - * @return : decompressed block size, - * or an error code (which can be tested using ZSTD_isError()) - */ -size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx, - void* dst, size_t dstCapacity, - const void* src, size_t srcSize, const int frame); - -/* ZSTD_buildFSETable() : - * generate FSE decoding table for one symbol (ll, ml or off) - * this function must be called with valid parameters only - * (dt is large enough, normalizedCounter distribution total is a power of 2, max is within range, etc.) - * in which case it cannot fail. - * Internal use only. - */ -void ZSTD_buildFSETable(ZSTD_seqSymbol* dt, - const short* normalizedCounter, unsigned maxSymbolValue, - const U32* baseValue, const U32* nbAdditionalBits, - unsigned tableLog); - - -#endif /* ZSTD_DEC_BLOCK_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_decompress_internal.h b/vendor/github.com/DataDog/zstd/zstd_decompress_internal.h deleted file mode 100644 index ccbdfa09..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_decompress_internal.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -/* zstd_decompress_internal: - * objects and definitions shared within lib/decompress modules */ - - #ifndef ZSTD_DECOMPRESS_INTERNAL_H - #define ZSTD_DECOMPRESS_INTERNAL_H - - -/*-******************************************************* - * Dependencies - *********************************************************/ -#include "mem.h" /* BYTE, U16, U32 */ -#include "zstd_internal.h" /* ZSTD_seqSymbol */ - - - -/*-******************************************************* - * Constants - *********************************************************/ -static const U32 LL_base[MaxLL+1] = { - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, - 16, 18, 20, 22, 24, 28, 32, 40, - 48, 64, 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, - 0x2000, 0x4000, 0x8000, 0x10000 }; - -static const U32 OF_base[MaxOff+1] = { - 0, 1, 1, 5, 0xD, 0x1D, 0x3D, 0x7D, - 0xFD, 0x1FD, 0x3FD, 0x7FD, 0xFFD, 0x1FFD, 0x3FFD, 0x7FFD, - 0xFFFD, 0x1FFFD, 0x3FFFD, 0x7FFFD, 0xFFFFD, 0x1FFFFD, 0x3FFFFD, 0x7FFFFD, - 0xFFFFFD, 0x1FFFFFD, 0x3FFFFFD, 0x7FFFFFD, 0xFFFFFFD, 0x1FFFFFFD, 0x3FFFFFFD, 0x7FFFFFFD }; - -static const U32 OF_bits[MaxOff+1] = { - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31 }; - -static const U32 ML_base[MaxML+1] = { - 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, - 35, 37, 39, 41, 43, 47, 51, 59, - 67, 83, 99, 0x83, 0x103, 0x203, 0x403, 0x803, - 0x1003, 0x2003, 0x4003, 0x8003, 0x10003 }; - - -/*-******************************************************* - * Decompression types - *********************************************************/ - typedef struct { - U32 fastMode; - U32 tableLog; - } ZSTD_seqSymbol_header; - - typedef struct { - U16 nextState; - BYTE nbAdditionalBits; - BYTE nbBits; - U32 baseValue; - } ZSTD_seqSymbol; - - #define SEQSYMBOL_TABLE_SIZE(log) (1 + (1 << (log))) - -typedef struct { - ZSTD_seqSymbol LLTable[SEQSYMBOL_TABLE_SIZE(LLFSELog)]; /* Note : Space reserved for FSE Tables */ - ZSTD_seqSymbol OFTable[SEQSYMBOL_TABLE_SIZE(OffFSELog)]; /* is also used as temporary workspace while building hufTable during DDict creation */ - ZSTD_seqSymbol MLTable[SEQSYMBOL_TABLE_SIZE(MLFSELog)]; /* and therefore must be at least HUF_DECOMPRESS_WORKSPACE_SIZE large */ - HUF_DTable hufTable[HUF_DTABLE_SIZE(HufLog)]; /* can accommodate HUF_decompress4X */ - U32 rep[ZSTD_REP_NUM]; -} ZSTD_entropyDTables_t; - -typedef enum { ZSTDds_getFrameHeaderSize, ZSTDds_decodeFrameHeader, - ZSTDds_decodeBlockHeader, ZSTDds_decompressBlock, - ZSTDds_decompressLastBlock, ZSTDds_checkChecksum, - ZSTDds_decodeSkippableHeader, ZSTDds_skipFrame } ZSTD_dStage; - -typedef enum { zdss_init=0, zdss_loadHeader, - zdss_read, zdss_load, zdss_flush } ZSTD_dStreamStage; - -typedef enum { - ZSTD_use_indefinitely = -1, /* Use the dictionary indefinitely */ - ZSTD_dont_use = 0, /* Do not use the dictionary (if one exists free it) */ - ZSTD_use_once = 1 /* Use the dictionary once and set to ZSTD_dont_use */ -} ZSTD_dictUses_e; - -struct ZSTD_DCtx_s -{ - const ZSTD_seqSymbol* LLTptr; - const ZSTD_seqSymbol* MLTptr; - const ZSTD_seqSymbol* OFTptr; - const HUF_DTable* HUFptr; - ZSTD_entropyDTables_t entropy; - U32 workspace[HUF_DECOMPRESS_WORKSPACE_SIZE_U32]; /* space needed when building huffman tables */ - const void* previousDstEnd; /* detect continuity */ - const void* prefixStart; /* start of current segment */ - const void* virtualStart; /* virtual start of previous segment if it was just before current one */ - const void* dictEnd; /* end of previous segment */ - size_t expected; - ZSTD_frameHeader fParams; - U64 decodedSize; - blockType_e bType; /* used in ZSTD_decompressContinue(), store blockType between block header decoding and block decompression stages */ - ZSTD_dStage stage; - U32 litEntropy; - U32 fseEntropy; - XXH64_state_t xxhState; - size_t headerSize; - ZSTD_format_e format; - const BYTE* litPtr; - ZSTD_customMem customMem; - size_t litSize; - size_t rleSize; - size_t staticSize; - int bmi2; /* == 1 if the CPU supports BMI2 and 0 otherwise. CPU support is determined dynamically once per context lifetime. */ - - /* dictionary */ - ZSTD_DDict* ddictLocal; - const ZSTD_DDict* ddict; /* set by ZSTD_initDStream_usingDDict(), or ZSTD_DCtx_refDDict() */ - U32 dictID; - int ddictIsCold; /* if == 1 : dictionary is "new" for working context, and presumed "cold" (not in cpu cache) */ - ZSTD_dictUses_e dictUses; - - /* streaming */ - ZSTD_dStreamStage streamStage; - char* inBuff; - size_t inBuffSize; - size_t inPos; - size_t maxWindowSize; - char* outBuff; - size_t outBuffSize; - size_t outStart; - size_t outEnd; - size_t lhSize; - void* legacyContext; - U32 previousLegacyVersion; - U32 legacyVersion; - U32 hostageByte; - int noForwardProgress; - - /* workspace */ - BYTE litBuffer[ZSTD_BLOCKSIZE_MAX + WILDCOPY_OVERLENGTH]; - BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX]; -}; /* typedef'd to ZSTD_DCtx within "zstd.h" */ - - -/*-******************************************************* - * Shared internal functions - *********************************************************/ - -/*! ZSTD_loadDEntropy() : - * dict : must point at beginning of a valid zstd dictionary. - * @return : size of entropy tables read */ -size_t ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy, - const void* const dict, size_t const dictSize); - -/*! ZSTD_checkContinuity() : - * check if next `dst` follows previous position, where decompression ended. - * If yes, do nothing (continue on current segment). - * If not, classify previous segment as "external dictionary", and start a new segment. - * This function cannot fail. */ -void ZSTD_checkContinuity(ZSTD_DCtx* dctx, const void* dst); - - -#endif /* ZSTD_DECOMPRESS_INTERNAL_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_double_fast.c b/vendor/github.com/DataDog/zstd/zstd_double_fast.c deleted file mode 100644 index a661a485..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_double_fast.c +++ /dev/null @@ -1,518 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#include "zstd_compress_internal.h" -#include "zstd_double_fast.h" - - -void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, - void const* end, ZSTD_dictTableLoadMethod_e dtlm) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashLarge = ms->hashTable; - U32 const hBitsL = cParams->hashLog; - U32 const mls = cParams->minMatch; - U32* const hashSmall = ms->chainTable; - U32 const hBitsS = cParams->chainLog; - const BYTE* const base = ms->window.base; - const BYTE* ip = base + ms->nextToUpdate; - const BYTE* const iend = ((const BYTE*)end) - HASH_READ_SIZE; - const U32 fastHashFillStep = 3; - - /* Always insert every fastHashFillStep position into the hash tables. - * Insert the other positions into the large hash table if their entry - * is empty. - */ - for (; ip + fastHashFillStep - 1 <= iend; ip += fastHashFillStep) { - U32 const current = (U32)(ip - base); - U32 i; - for (i = 0; i < fastHashFillStep; ++i) { - size_t const smHash = ZSTD_hashPtr(ip + i, hBitsS, mls); - size_t const lgHash = ZSTD_hashPtr(ip + i, hBitsL, 8); - if (i == 0) - hashSmall[smHash] = current + i; - if (i == 0 || hashLarge[lgHash] == 0) - hashLarge[lgHash] = current + i; - /* Only load extra positions for ZSTD_dtlm_full */ - if (dtlm == ZSTD_dtlm_fast) - break; - } } -} - - -FORCE_INLINE_TEMPLATE -size_t ZSTD_compressBlock_doubleFast_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize, - U32 const mls /* template */, ZSTD_dictMode_e const dictMode) -{ - ZSTD_compressionParameters const* cParams = &ms->cParams; - U32* const hashLong = ms->hashTable; - const U32 hBitsL = cParams->hashLog; - U32* const hashSmall = ms->chainTable; - const U32 hBitsS = cParams->chainLog; - const BYTE* const base = ms->window.base; - const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; - const BYTE* anchor = istart; - const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); - const U32 lowestValid = ms->window.dictLimit; - const U32 maxDistance = 1U << cParams->windowLog; - /* presumes that, if there is a dictionary, it must be using Attach mode */ - const U32 prefixLowestIndex = (endIndex - lowestValid > maxDistance) ? endIndex - maxDistance : lowestValid; - const BYTE* const prefixLowest = base + prefixLowestIndex; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - HASH_READ_SIZE; - U32 offset_1=rep[0], offset_2=rep[1]; - U32 offsetSaved = 0; - - const ZSTD_matchState_t* const dms = ms->dictMatchState; - const ZSTD_compressionParameters* const dictCParams = - dictMode == ZSTD_dictMatchState ? - &dms->cParams : NULL; - const U32* const dictHashLong = dictMode == ZSTD_dictMatchState ? - dms->hashTable : NULL; - const U32* const dictHashSmall = dictMode == ZSTD_dictMatchState ? - dms->chainTable : NULL; - const U32 dictStartIndex = dictMode == ZSTD_dictMatchState ? - dms->window.dictLimit : 0; - const BYTE* const dictBase = dictMode == ZSTD_dictMatchState ? - dms->window.base : NULL; - const BYTE* const dictStart = dictMode == ZSTD_dictMatchState ? - dictBase + dictStartIndex : NULL; - const BYTE* const dictEnd = dictMode == ZSTD_dictMatchState ? - dms->window.nextSrc : NULL; - const U32 dictIndexDelta = dictMode == ZSTD_dictMatchState ? - prefixLowestIndex - (U32)(dictEnd - dictBase) : - 0; - const U32 dictHBitsL = dictMode == ZSTD_dictMatchState ? - dictCParams->hashLog : hBitsL; - const U32 dictHBitsS = dictMode == ZSTD_dictMatchState ? - dictCParams->chainLog : hBitsS; - const U32 dictAndPrefixLength = (U32)(ip - prefixLowest + dictEnd - dictStart); - - DEBUGLOG(5, "ZSTD_compressBlock_doubleFast_generic"); - - assert(dictMode == ZSTD_noDict || dictMode == ZSTD_dictMatchState); - - /* if a dictionary is attached, it must be within window range */ - if (dictMode == ZSTD_dictMatchState) { - assert(lowestValid + maxDistance >= endIndex); - } - - /* init */ - ip += (dictAndPrefixLength == 0); - if (dictMode == ZSTD_noDict) { - U32 const maxRep = (U32)(ip - prefixLowest); - if (offset_2 > maxRep) offsetSaved = offset_2, offset_2 = 0; - if (offset_1 > maxRep) offsetSaved = offset_1, offset_1 = 0; - } - if (dictMode == ZSTD_dictMatchState) { - /* dictMatchState repCode checks don't currently handle repCode == 0 - * disabling. */ - assert(offset_1 <= dictAndPrefixLength); - assert(offset_2 <= dictAndPrefixLength); - } - - /* Main Search Loop */ - while (ip < ilimit) { /* < instead of <=, because repcode check at (ip+1) */ - size_t mLength; - U32 offset; - size_t const h2 = ZSTD_hashPtr(ip, hBitsL, 8); - size_t const h = ZSTD_hashPtr(ip, hBitsS, mls); - size_t const dictHL = ZSTD_hashPtr(ip, dictHBitsL, 8); - size_t const dictHS = ZSTD_hashPtr(ip, dictHBitsS, mls); - U32 const current = (U32)(ip-base); - U32 const matchIndexL = hashLong[h2]; - U32 matchIndexS = hashSmall[h]; - const BYTE* matchLong = base + matchIndexL; - const BYTE* match = base + matchIndexS; - const U32 repIndex = current + 1 - offset_1; - const BYTE* repMatch = (dictMode == ZSTD_dictMatchState - && repIndex < prefixLowestIndex) ? - dictBase + (repIndex - dictIndexDelta) : - base + repIndex; - hashLong[h2] = hashSmall[h] = current; /* update hash tables */ - - /* check dictMatchState repcode */ - if (dictMode == ZSTD_dictMatchState - && ((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */) - && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { - const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend; - mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4; - ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH); - goto _match_stored; - } - - /* check noDict repcode */ - if ( dictMode == ZSTD_noDict - && ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)))) { - mLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4; - ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH); - goto _match_stored; - } - - if (matchIndexL > prefixLowestIndex) { - /* check prefix long match */ - if (MEM_read64(matchLong) == MEM_read64(ip)) { - mLength = ZSTD_count(ip+8, matchLong+8, iend) + 8; - offset = (U32)(ip-matchLong); - while (((ip>anchor) & (matchLong>prefixLowest)) && (ip[-1] == matchLong[-1])) { ip--; matchLong--; mLength++; } /* catch up */ - goto _match_found; - } - } else if (dictMode == ZSTD_dictMatchState) { - /* check dictMatchState long match */ - U32 const dictMatchIndexL = dictHashLong[dictHL]; - const BYTE* dictMatchL = dictBase + dictMatchIndexL; - assert(dictMatchL < dictEnd); - - if (dictMatchL > dictStart && MEM_read64(dictMatchL) == MEM_read64(ip)) { - mLength = ZSTD_count_2segments(ip+8, dictMatchL+8, iend, dictEnd, prefixLowest) + 8; - offset = (U32)(current - dictMatchIndexL - dictIndexDelta); - while (((ip>anchor) & (dictMatchL>dictStart)) && (ip[-1] == dictMatchL[-1])) { ip--; dictMatchL--; mLength++; } /* catch up */ - goto _match_found; - } } - - if (matchIndexS > prefixLowestIndex) { - /* check prefix short match */ - if (MEM_read32(match) == MEM_read32(ip)) { - goto _search_next_long; - } - } else if (dictMode == ZSTD_dictMatchState) { - /* check dictMatchState short match */ - U32 const dictMatchIndexS = dictHashSmall[dictHS]; - match = dictBase + dictMatchIndexS; - matchIndexS = dictMatchIndexS + dictIndexDelta; - - if (match > dictStart && MEM_read32(match) == MEM_read32(ip)) { - goto _search_next_long; - } } - - ip += ((ip-anchor) >> kSearchStrength) + 1; - continue; - -_search_next_long: - - { size_t const hl3 = ZSTD_hashPtr(ip+1, hBitsL, 8); - size_t const dictHLNext = ZSTD_hashPtr(ip+1, dictHBitsL, 8); - U32 const matchIndexL3 = hashLong[hl3]; - const BYTE* matchL3 = base + matchIndexL3; - hashLong[hl3] = current + 1; - - /* check prefix long +1 match */ - if (matchIndexL3 > prefixLowestIndex) { - if (MEM_read64(matchL3) == MEM_read64(ip+1)) { - mLength = ZSTD_count(ip+9, matchL3+8, iend) + 8; - ip++; - offset = (U32)(ip-matchL3); - while (((ip>anchor) & (matchL3>prefixLowest)) && (ip[-1] == matchL3[-1])) { ip--; matchL3--; mLength++; } /* catch up */ - goto _match_found; - } - } else if (dictMode == ZSTD_dictMatchState) { - /* check dict long +1 match */ - U32 const dictMatchIndexL3 = dictHashLong[dictHLNext]; - const BYTE* dictMatchL3 = dictBase + dictMatchIndexL3; - assert(dictMatchL3 < dictEnd); - if (dictMatchL3 > dictStart && MEM_read64(dictMatchL3) == MEM_read64(ip+1)) { - mLength = ZSTD_count_2segments(ip+1+8, dictMatchL3+8, iend, dictEnd, prefixLowest) + 8; - ip++; - offset = (U32)(current + 1 - dictMatchIndexL3 - dictIndexDelta); - while (((ip>anchor) & (dictMatchL3>dictStart)) && (ip[-1] == dictMatchL3[-1])) { ip--; dictMatchL3--; mLength++; } /* catch up */ - goto _match_found; - } } } - - /* if no long +1 match, explore the short match we found */ - if (dictMode == ZSTD_dictMatchState && matchIndexS < prefixLowestIndex) { - mLength = ZSTD_count_2segments(ip+4, match+4, iend, dictEnd, prefixLowest) + 4; - offset = (U32)(current - matchIndexS); - while (((ip>anchor) & (match>dictStart)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ - } else { - mLength = ZSTD_count(ip+4, match+4, iend) + 4; - offset = (U32)(ip - match); - while (((ip>anchor) & (match>prefixLowest)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ - } - - /* fall-through */ - -_match_found: - offset_2 = offset_1; - offset_1 = offset; - - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); - -_match_stored: - /* match found */ - ip += mLength; - anchor = ip; - - if (ip <= ilimit) { - /* Complementary insertion */ - /* done after iLimit test, as candidates could be > iend-8 */ - { U32 const indexToInsert = current+2; - hashLong[ZSTD_hashPtr(base+indexToInsert, hBitsL, 8)] = indexToInsert; - hashLong[ZSTD_hashPtr(ip-2, hBitsL, 8)] = (U32)(ip-2-base); - hashSmall[ZSTD_hashPtr(base+indexToInsert, hBitsS, mls)] = indexToInsert; - hashSmall[ZSTD_hashPtr(ip-1, hBitsS, mls)] = (U32)(ip-1-base); - } - - /* check immediate repcode */ - if (dictMode == ZSTD_dictMatchState) { - while (ip <= ilimit) { - U32 const current2 = (U32)(ip-base); - U32 const repIndex2 = current2 - offset_2; - const BYTE* repMatch2 = dictMode == ZSTD_dictMatchState - && repIndex2 < prefixLowestIndex ? - dictBase - dictIndexDelta + repIndex2 : - base + repIndex2; - if ( ((U32)((prefixLowestIndex-1) - (U32)repIndex2) >= 3 /* intentional overflow */) - && (MEM_read32(repMatch2) == MEM_read32(ip)) ) { - const BYTE* const repEnd2 = repIndex2 < prefixLowestIndex ? dictEnd : iend; - size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixLowest) + 4; - U32 tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, repLength2-MINMATCH); - hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = current2; - hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = current2; - ip += repLength2; - anchor = ip; - continue; - } - break; - } } - - if (dictMode == ZSTD_noDict) { - while ( (ip <= ilimit) - && ( (offset_2>0) - & (MEM_read32(ip) == MEM_read32(ip - offset_2)) )) { - /* store sequence */ - size_t const rLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4; - U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff; /* swap offset_2 <=> offset_1 */ - hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = (U32)(ip-base); - hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = (U32)(ip-base); - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, rLength-MINMATCH); - ip += rLength; - anchor = ip; - continue; /* faster when present ... (?) */ - } } } - } /* while (ip < ilimit) */ - - /* save reps for next block */ - rep[0] = offset_1 ? offset_1 : offsetSaved; - rep[1] = offset_2 ? offset_2 : offsetSaved; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - - -size_t ZSTD_compressBlock_doubleFast( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - const U32 mls = ms->cParams.minMatch; - switch(mls) - { - default: /* includes case 3 */ - case 4 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 4, ZSTD_noDict); - case 5 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 5, ZSTD_noDict); - case 6 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 6, ZSTD_noDict); - case 7 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 7, ZSTD_noDict); - } -} - - -size_t ZSTD_compressBlock_doubleFast_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - const U32 mls = ms->cParams.minMatch; - switch(mls) - { - default: /* includes case 3 */ - case 4 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 4, ZSTD_dictMatchState); - case 5 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 5, ZSTD_dictMatchState); - case 6 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 6, ZSTD_dictMatchState); - case 7 : - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, 7, ZSTD_dictMatchState); - } -} - - -static size_t ZSTD_compressBlock_doubleFast_extDict_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize, - U32 const mls /* template */) -{ - ZSTD_compressionParameters const* cParams = &ms->cParams; - U32* const hashLong = ms->hashTable; - U32 const hBitsL = cParams->hashLog; - U32* const hashSmall = ms->chainTable; - U32 const hBitsS = cParams->chainLog; - const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; - const BYTE* anchor = istart; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - 8; - const BYTE* const base = ms->window.base; - const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); - const U32 lowLimit = ZSTD_getLowestMatchIndex(ms, endIndex, cParams->windowLog); - const U32 dictStartIndex = lowLimit; - const U32 dictLimit = ms->window.dictLimit; - const U32 prefixStartIndex = (dictLimit > lowLimit) ? dictLimit : lowLimit; - const BYTE* const prefixStart = base + prefixStartIndex; - const BYTE* const dictBase = ms->window.dictBase; - const BYTE* const dictStart = dictBase + dictStartIndex; - const BYTE* const dictEnd = dictBase + prefixStartIndex; - U32 offset_1=rep[0], offset_2=rep[1]; - - DEBUGLOG(5, "ZSTD_compressBlock_doubleFast_extDict_generic (srcSize=%zu)", srcSize); - - /* if extDict is invalidated due to maxDistance, switch to "regular" variant */ - if (prefixStartIndex == dictStartIndex) - return ZSTD_compressBlock_doubleFast_generic(ms, seqStore, rep, src, srcSize, mls, ZSTD_noDict); - - /* Search Loop */ - while (ip < ilimit) { /* < instead of <=, because (ip+1) */ - const size_t hSmall = ZSTD_hashPtr(ip, hBitsS, mls); - const U32 matchIndex = hashSmall[hSmall]; - const BYTE* const matchBase = matchIndex < prefixStartIndex ? dictBase : base; - const BYTE* match = matchBase + matchIndex; - - const size_t hLong = ZSTD_hashPtr(ip, hBitsL, 8); - const U32 matchLongIndex = hashLong[hLong]; - const BYTE* const matchLongBase = matchLongIndex < prefixStartIndex ? dictBase : base; - const BYTE* matchLong = matchLongBase + matchLongIndex; - - const U32 current = (U32)(ip-base); - const U32 repIndex = current + 1 - offset_1; /* offset_1 expected <= current +1 */ - const BYTE* const repBase = repIndex < prefixStartIndex ? dictBase : base; - const BYTE* const repMatch = repBase + repIndex; - size_t mLength; - hashSmall[hSmall] = hashLong[hLong] = current; /* update hash table */ - - if ((((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow : ensure repIndex doesn't overlap dict + prefix */ - & (repIndex > dictStartIndex)) - && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { - const BYTE* repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; - mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixStart) + 4; - ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH); - } else { - if ((matchLongIndex > dictStartIndex) && (MEM_read64(matchLong) == MEM_read64(ip))) { - const BYTE* const matchEnd = matchLongIndex < prefixStartIndex ? dictEnd : iend; - const BYTE* const lowMatchPtr = matchLongIndex < prefixStartIndex ? dictStart : prefixStart; - U32 offset; - mLength = ZSTD_count_2segments(ip+8, matchLong+8, iend, matchEnd, prefixStart) + 8; - offset = current - matchLongIndex; - while (((ip>anchor) & (matchLong>lowMatchPtr)) && (ip[-1] == matchLong[-1])) { ip--; matchLong--; mLength++; } /* catch up */ - offset_2 = offset_1; - offset_1 = offset; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); - - } else if ((matchIndex > dictStartIndex) && (MEM_read32(match) == MEM_read32(ip))) { - size_t const h3 = ZSTD_hashPtr(ip+1, hBitsL, 8); - U32 const matchIndex3 = hashLong[h3]; - const BYTE* const match3Base = matchIndex3 < prefixStartIndex ? dictBase : base; - const BYTE* match3 = match3Base + matchIndex3; - U32 offset; - hashLong[h3] = current + 1; - if ( (matchIndex3 > dictStartIndex) && (MEM_read64(match3) == MEM_read64(ip+1)) ) { - const BYTE* const matchEnd = matchIndex3 < prefixStartIndex ? dictEnd : iend; - const BYTE* const lowMatchPtr = matchIndex3 < prefixStartIndex ? dictStart : prefixStart; - mLength = ZSTD_count_2segments(ip+9, match3+8, iend, matchEnd, prefixStart) + 8; - ip++; - offset = current+1 - matchIndex3; - while (((ip>anchor) & (match3>lowMatchPtr)) && (ip[-1] == match3[-1])) { ip--; match3--; mLength++; } /* catch up */ - } else { - const BYTE* const matchEnd = matchIndex < prefixStartIndex ? dictEnd : iend; - const BYTE* const lowMatchPtr = matchIndex < prefixStartIndex ? dictStart : prefixStart; - mLength = ZSTD_count_2segments(ip+4, match+4, iend, matchEnd, prefixStart) + 4; - offset = current - matchIndex; - while (((ip>anchor) & (match>lowMatchPtr)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ - } - offset_2 = offset_1; - offset_1 = offset; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); - - } else { - ip += ((ip-anchor) >> kSearchStrength) + 1; - continue; - } } - - /* move to next sequence start */ - ip += mLength; - anchor = ip; - - if (ip <= ilimit) { - /* Complementary insertion */ - /* done after iLimit test, as candidates could be > iend-8 */ - { U32 const indexToInsert = current+2; - hashLong[ZSTD_hashPtr(base+indexToInsert, hBitsL, 8)] = indexToInsert; - hashLong[ZSTD_hashPtr(ip-2, hBitsL, 8)] = (U32)(ip-2-base); - hashSmall[ZSTD_hashPtr(base+indexToInsert, hBitsS, mls)] = indexToInsert; - hashSmall[ZSTD_hashPtr(ip-1, hBitsS, mls)] = (U32)(ip-1-base); - } - - /* check immediate repcode */ - while (ip <= ilimit) { - U32 const current2 = (U32)(ip-base); - U32 const repIndex2 = current2 - offset_2; - const BYTE* repMatch2 = repIndex2 < prefixStartIndex ? dictBase + repIndex2 : base + repIndex2; - if ( (((U32)((prefixStartIndex-1) - repIndex2) >= 3) /* intentional overflow : ensure repIndex2 doesn't overlap dict + prefix */ - & (repIndex2 > dictStartIndex)) - && (MEM_read32(repMatch2) == MEM_read32(ip)) ) { - const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; - size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; - U32 const tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, repLength2-MINMATCH); - hashSmall[ZSTD_hashPtr(ip, hBitsS, mls)] = current2; - hashLong[ZSTD_hashPtr(ip, hBitsL, 8)] = current2; - ip += repLength2; - anchor = ip; - continue; - } - break; - } } } - - /* save reps for next block */ - rep[0] = offset_1; - rep[1] = offset_2; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - - -size_t ZSTD_compressBlock_doubleFast_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - U32 const mls = ms->cParams.minMatch; - switch(mls) - { - default: /* includes case 3 */ - case 4 : - return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, src, srcSize, 4); - case 5 : - return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, src, srcSize, 5); - case 6 : - return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, src, srcSize, 6); - case 7 : - return ZSTD_compressBlock_doubleFast_extDict_generic(ms, seqStore, rep, src, srcSize, 7); - } -} diff --git a/vendor/github.com/DataDog/zstd/zstd_double_fast.h b/vendor/github.com/DataDog/zstd/zstd_double_fast.h deleted file mode 100644 index 4fa31acf..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_double_fast.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_DOUBLE_FAST_H -#define ZSTD_DOUBLE_FAST_H - -#if defined (__cplusplus) -extern "C" { -#endif - -#include "mem.h" /* U32 */ -#include "zstd_compress_internal.h" /* ZSTD_CCtx, size_t */ - -void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms, - void const* end, ZSTD_dictTableLoadMethod_e dtlm); -size_t ZSTD_compressBlock_doubleFast( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_doubleFast_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_doubleFast_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_DOUBLE_FAST_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_errors.h b/vendor/github.com/DataDog/zstd/zstd_errors.h deleted file mode 100644 index 92a34338..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_errors.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_ERRORS_H_398273423 -#define ZSTD_ERRORS_H_398273423 - -#if defined (__cplusplus) -extern "C" { -#endif - -/*===== dependency =====*/ -#include /* size_t */ - - -/* ===== ZSTDERRORLIB_API : control library symbols visibility ===== */ -#ifndef ZSTDERRORLIB_VISIBILITY -# if defined(__GNUC__) && (__GNUC__ >= 4) -# define ZSTDERRORLIB_VISIBILITY __attribute__ ((visibility ("default"))) -# else -# define ZSTDERRORLIB_VISIBILITY -# endif -#endif -#if defined(ZSTD_DLL_EXPORT) && (ZSTD_DLL_EXPORT==1) -# define ZSTDERRORLIB_API __declspec(dllexport) ZSTDERRORLIB_VISIBILITY -#elif defined(ZSTD_DLL_IMPORT) && (ZSTD_DLL_IMPORT==1) -# define ZSTDERRORLIB_API __declspec(dllimport) ZSTDERRORLIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/ -#else -# define ZSTDERRORLIB_API ZSTDERRORLIB_VISIBILITY -#endif - -/*-********************************************* - * Error codes list - *-********************************************* - * Error codes _values_ are pinned down since v1.3.1 only. - * Therefore, don't rely on values if you may link to any version < v1.3.1. - * - * Only values < 100 are considered stable. - * - * note 1 : this API shall be used with static linking only. - * dynamic linking is not yet officially supported. - * note 2 : Prefer relying on the enum than on its value whenever possible - * This is the only supported way to use the error list < v1.3.1 - * note 3 : ZSTD_isError() is always correct, whatever the library version. - **********************************************/ -typedef enum { - ZSTD_error_no_error = 0, - ZSTD_error_GENERIC = 1, - ZSTD_error_prefix_unknown = 10, - ZSTD_error_version_unsupported = 12, - ZSTD_error_frameParameter_unsupported = 14, - ZSTD_error_frameParameter_windowTooLarge = 16, - ZSTD_error_corruption_detected = 20, - ZSTD_error_checksum_wrong = 22, - ZSTD_error_dictionary_corrupted = 30, - ZSTD_error_dictionary_wrong = 32, - ZSTD_error_dictionaryCreation_failed = 34, - ZSTD_error_parameter_unsupported = 40, - ZSTD_error_parameter_outOfBound = 42, - ZSTD_error_tableLog_tooLarge = 44, - ZSTD_error_maxSymbolValue_tooLarge = 46, - ZSTD_error_maxSymbolValue_tooSmall = 48, - ZSTD_error_stage_wrong = 60, - ZSTD_error_init_missing = 62, - ZSTD_error_memory_allocation = 64, - ZSTD_error_workSpace_tooSmall= 66, - ZSTD_error_dstSize_tooSmall = 70, - ZSTD_error_srcSize_wrong = 72, - ZSTD_error_dstBuffer_null = 74, - /* following error codes are __NOT STABLE__, they can be removed or changed in future versions */ - ZSTD_error_frameIndex_tooLarge = 100, - ZSTD_error_seekableIO = 102, - ZSTD_error_maxCode = 120 /* never EVER use this value directly, it can change in future versions! Use ZSTD_isError() instead */ -} ZSTD_ErrorCode; - -/*! ZSTD_getErrorCode() : - convert a `size_t` function result into a `ZSTD_ErrorCode` enum type, - which can be used to compare with enum list published above */ -ZSTDERRORLIB_API ZSTD_ErrorCode ZSTD_getErrorCode(size_t functionResult); -ZSTDERRORLIB_API const char* ZSTD_getErrorString(ZSTD_ErrorCode code); /**< Same as ZSTD_getErrorName, but using a `ZSTD_ErrorCode` enum argument */ - - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_ERRORS_H_398273423 */ diff --git a/vendor/github.com/DataDog/zstd/zstd_fast.c b/vendor/github.com/DataDog/zstd/zstd_fast.c deleted file mode 100644 index 6dbefee6..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_fast.c +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#include "zstd_compress_internal.h" /* ZSTD_hashPtr, ZSTD_count, ZSTD_storeSeq */ -#include "zstd_fast.h" - - -void ZSTD_fillHashTable(ZSTD_matchState_t* ms, - const void* const end, - ZSTD_dictTableLoadMethod_e dtlm) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hBits = cParams->hashLog; - U32 const mls = cParams->minMatch; - const BYTE* const base = ms->window.base; - const BYTE* ip = base + ms->nextToUpdate; - const BYTE* const iend = ((const BYTE*)end) - HASH_READ_SIZE; - const U32 fastHashFillStep = 3; - - /* Always insert every fastHashFillStep position into the hash table. - * Insert the other positions if their hash entry is empty. - */ - for ( ; ip + fastHashFillStep < iend + 2; ip += fastHashFillStep) { - U32 const current = (U32)(ip - base); - size_t const hash0 = ZSTD_hashPtr(ip, hBits, mls); - hashTable[hash0] = current; - if (dtlm == ZSTD_dtlm_fast) continue; - /* Only load extra positions for ZSTD_dtlm_full */ - { U32 p; - for (p = 1; p < fastHashFillStep; ++p) { - size_t const hash = ZSTD_hashPtr(ip + p, hBits, mls); - if (hashTable[hash] == 0) { /* not yet filled */ - hashTable[hash] = current + p; - } } } } -} - - -FORCE_INLINE_TEMPLATE size_t -ZSTD_compressBlock_fast_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize, - U32 const mls) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hlog = cParams->hashLog; - /* support stepSize of 0 */ - size_t const stepSize = cParams->targetLength + !(cParams->targetLength) + 1; - const BYTE* const base = ms->window.base; - const BYTE* const istart = (const BYTE*)src; - /* We check ip0 (ip + 0) and ip1 (ip + 1) each loop */ - const BYTE* ip0 = istart; - const BYTE* ip1; - const BYTE* anchor = istart; - const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); - const U32 maxDistance = 1U << cParams->windowLog; - const U32 validStartIndex = ms->window.dictLimit; - const U32 prefixStartIndex = (endIndex - validStartIndex > maxDistance) ? endIndex - maxDistance : validStartIndex; - const BYTE* const prefixStart = base + prefixStartIndex; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - HASH_READ_SIZE; - U32 offset_1=rep[0], offset_2=rep[1]; - U32 offsetSaved = 0; - - /* init */ - DEBUGLOG(5, "ZSTD_compressBlock_fast_generic"); - ip0 += (ip0 == prefixStart); - ip1 = ip0 + 1; - { U32 const maxRep = (U32)(ip0 - prefixStart); - if (offset_2 > maxRep) offsetSaved = offset_2, offset_2 = 0; - if (offset_1 > maxRep) offsetSaved = offset_1, offset_1 = 0; - } - - /* Main Search Loop */ - while (ip1 < ilimit) { /* < instead of <=, because check at ip0+2 */ - size_t mLength; - BYTE const* ip2 = ip0 + 2; - size_t const h0 = ZSTD_hashPtr(ip0, hlog, mls); - U32 const val0 = MEM_read32(ip0); - size_t const h1 = ZSTD_hashPtr(ip1, hlog, mls); - U32 const val1 = MEM_read32(ip1); - U32 const current0 = (U32)(ip0-base); - U32 const current1 = (U32)(ip1-base); - U32 const matchIndex0 = hashTable[h0]; - U32 const matchIndex1 = hashTable[h1]; - BYTE const* repMatch = ip2-offset_1; - const BYTE* match0 = base + matchIndex0; - const BYTE* match1 = base + matchIndex1; - U32 offcode; - hashTable[h0] = current0; /* update hash table */ - hashTable[h1] = current1; /* update hash table */ - - assert(ip0 + 1 == ip1); - - if ((offset_1 > 0) & (MEM_read32(repMatch) == MEM_read32(ip2))) { - mLength = ip2[-1] == repMatch[-1] ? 1 : 0; - ip0 = ip2 - mLength; - match0 = repMatch - mLength; - offcode = 0; - goto _match; - } - if ((matchIndex0 > prefixStartIndex) && MEM_read32(match0) == val0) { - /* found a regular match */ - goto _offset; - } - if ((matchIndex1 > prefixStartIndex) && MEM_read32(match1) == val1) { - /* found a regular match after one literal */ - ip0 = ip1; - match0 = match1; - goto _offset; - } - { size_t const step = ((size_t)(ip0-anchor) >> (kSearchStrength - 1)) + stepSize; - assert(step >= 2); - ip0 += step; - ip1 += step; - continue; - } -_offset: /* Requires: ip0, match0 */ - /* Compute the offset code */ - offset_2 = offset_1; - offset_1 = (U32)(ip0-match0); - offcode = offset_1 + ZSTD_REP_MOVE; - mLength = 0; - /* Count the backwards match length */ - while (((ip0>anchor) & (match0>prefixStart)) - && (ip0[-1] == match0[-1])) { ip0--; match0--; mLength++; } /* catch up */ - -_match: /* Requires: ip0, match0, offcode */ - /* Count the forward length */ - mLength += ZSTD_count(ip0+mLength+4, match0+mLength+4, iend) + 4; - ZSTD_storeSeq(seqStore, (size_t)(ip0-anchor), anchor, iend, offcode, mLength-MINMATCH); - /* match found */ - ip0 += mLength; - anchor = ip0; - ip1 = ip0 + 1; - - if (ip0 <= ilimit) { - /* Fill Table */ - assert(base+current0+2 > istart); /* check base overflow */ - hashTable[ZSTD_hashPtr(base+current0+2, hlog, mls)] = current0+2; /* here because current+2 could be > iend-8 */ - hashTable[ZSTD_hashPtr(ip0-2, hlog, mls)] = (U32)(ip0-2-base); - - while ( ((ip0 <= ilimit) & (offset_2>0)) /* offset_2==0 means offset_2 is invalidated */ - && (MEM_read32(ip0) == MEM_read32(ip0 - offset_2)) ) { - /* store sequence */ - size_t const rLength = ZSTD_count(ip0+4, ip0+4-offset_2, iend) + 4; - { U32 const tmpOff = offset_2; offset_2 = offset_1; offset_1 = tmpOff; } /* swap offset_2 <=> offset_1 */ - hashTable[ZSTD_hashPtr(ip0, hlog, mls)] = (U32)(ip0-base); - ip0 += rLength; - ip1 = ip0 + 1; - ZSTD_storeSeq(seqStore, 0 /*litLen*/, anchor, iend, 0 /*offCode*/, rLength-MINMATCH); - anchor = ip0; - continue; /* faster when present (confirmed on gcc-8) ... (?) */ - } - } - } - - /* save reps for next block */ - rep[0] = offset_1 ? offset_1 : offsetSaved; - rep[1] = offset_2 ? offset_2 : offsetSaved; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - - -size_t ZSTD_compressBlock_fast( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - U32 const mls = ms->cParams.minMatch; - assert(ms->dictMatchState == NULL); - switch(mls) - { - default: /* includes case 3 */ - case 4 : - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, 4); - case 5 : - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, 5); - case 6 : - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, 6); - case 7 : - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, 7); - } -} - -FORCE_INLINE_TEMPLATE -size_t ZSTD_compressBlock_fast_dictMatchState_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize, U32 const mls) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hlog = cParams->hashLog; - /* support stepSize of 0 */ - U32 const stepSize = cParams->targetLength + !(cParams->targetLength); - const BYTE* const base = ms->window.base; - const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; - const BYTE* anchor = istart; - const U32 prefixStartIndex = ms->window.dictLimit; - const BYTE* const prefixStart = base + prefixStartIndex; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - HASH_READ_SIZE; - U32 offset_1=rep[0], offset_2=rep[1]; - U32 offsetSaved = 0; - - const ZSTD_matchState_t* const dms = ms->dictMatchState; - const ZSTD_compressionParameters* const dictCParams = &dms->cParams ; - const U32* const dictHashTable = dms->hashTable; - const U32 dictStartIndex = dms->window.dictLimit; - const BYTE* const dictBase = dms->window.base; - const BYTE* const dictStart = dictBase + dictStartIndex; - const BYTE* const dictEnd = dms->window.nextSrc; - const U32 dictIndexDelta = prefixStartIndex - (U32)(dictEnd - dictBase); - const U32 dictAndPrefixLength = (U32)(ip - prefixStart + dictEnd - dictStart); - const U32 dictHLog = dictCParams->hashLog; - - /* if a dictionary is still attached, it necessarily means that - * it is within window size. So we just check it. */ - const U32 maxDistance = 1U << cParams->windowLog; - const U32 endIndex = (U32)((size_t)(ip - base) + srcSize); - assert(endIndex - prefixStartIndex <= maxDistance); - (void)maxDistance; (void)endIndex; /* these variables are not used when assert() is disabled */ - - /* ensure there will be no no underflow - * when translating a dict index into a local index */ - assert(prefixStartIndex >= (U32)(dictEnd - dictBase)); - - /* init */ - DEBUGLOG(5, "ZSTD_compressBlock_fast_dictMatchState_generic"); - ip += (dictAndPrefixLength == 0); - /* dictMatchState repCode checks don't currently handle repCode == 0 - * disabling. */ - assert(offset_1 <= dictAndPrefixLength); - assert(offset_2 <= dictAndPrefixLength); - - /* Main Search Loop */ - while (ip < ilimit) { /* < instead of <=, because repcode check at (ip+1) */ - size_t mLength; - size_t const h = ZSTD_hashPtr(ip, hlog, mls); - U32 const current = (U32)(ip-base); - U32 const matchIndex = hashTable[h]; - const BYTE* match = base + matchIndex; - const U32 repIndex = current + 1 - offset_1; - const BYTE* repMatch = (repIndex < prefixStartIndex) ? - dictBase + (repIndex - dictIndexDelta) : - base + repIndex; - hashTable[h] = current; /* update hash table */ - - if ( ((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow : ensure repIndex isn't overlapping dict + prefix */ - && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { - const BYTE* const repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; - mLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixStart) + 4; - ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, mLength-MINMATCH); - } else if ( (matchIndex <= prefixStartIndex) ) { - size_t const dictHash = ZSTD_hashPtr(ip, dictHLog, mls); - U32 const dictMatchIndex = dictHashTable[dictHash]; - const BYTE* dictMatch = dictBase + dictMatchIndex; - if (dictMatchIndex <= dictStartIndex || - MEM_read32(dictMatch) != MEM_read32(ip)) { - assert(stepSize >= 1); - ip += ((ip-anchor) >> kSearchStrength) + stepSize; - continue; - } else { - /* found a dict match */ - U32 const offset = (U32)(current-dictMatchIndex-dictIndexDelta); - mLength = ZSTD_count_2segments(ip+4, dictMatch+4, iend, dictEnd, prefixStart) + 4; - while (((ip>anchor) & (dictMatch>dictStart)) - && (ip[-1] == dictMatch[-1])) { - ip--; dictMatch--; mLength++; - } /* catch up */ - offset_2 = offset_1; - offset_1 = offset; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); - } - } else if (MEM_read32(match) != MEM_read32(ip)) { - /* it's not a match, and we're not going to check the dictionary */ - assert(stepSize >= 1); - ip += ((ip-anchor) >> kSearchStrength) + stepSize; - continue; - } else { - /* found a regular match */ - U32 const offset = (U32)(ip-match); - mLength = ZSTD_count(ip+4, match+4, iend) + 4; - while (((ip>anchor) & (match>prefixStart)) - && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ - offset_2 = offset_1; - offset_1 = offset; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); - } - - /* match found */ - ip += mLength; - anchor = ip; - - if (ip <= ilimit) { - /* Fill Table */ - assert(base+current+2 > istart); /* check base overflow */ - hashTable[ZSTD_hashPtr(base+current+2, hlog, mls)] = current+2; /* here because current+2 could be > iend-8 */ - hashTable[ZSTD_hashPtr(ip-2, hlog, mls)] = (U32)(ip-2-base); - - /* check immediate repcode */ - while (ip <= ilimit) { - U32 const current2 = (U32)(ip-base); - U32 const repIndex2 = current2 - offset_2; - const BYTE* repMatch2 = repIndex2 < prefixStartIndex ? - dictBase - dictIndexDelta + repIndex2 : - base + repIndex2; - if ( ((U32)((prefixStartIndex-1) - (U32)repIndex2) >= 3 /* intentional overflow */) - && (MEM_read32(repMatch2) == MEM_read32(ip)) ) { - const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; - size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; - U32 tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, repLength2-MINMATCH); - hashTable[ZSTD_hashPtr(ip, hlog, mls)] = current2; - ip += repLength2; - anchor = ip; - continue; - } - break; - } - } - } - - /* save reps for next block */ - rep[0] = offset_1 ? offset_1 : offsetSaved; - rep[1] = offset_2 ? offset_2 : offsetSaved; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - -size_t ZSTD_compressBlock_fast_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - U32 const mls = ms->cParams.minMatch; - assert(ms->dictMatchState != NULL); - switch(mls) - { - default: /* includes case 3 */ - case 4 : - return ZSTD_compressBlock_fast_dictMatchState_generic(ms, seqStore, rep, src, srcSize, 4); - case 5 : - return ZSTD_compressBlock_fast_dictMatchState_generic(ms, seqStore, rep, src, srcSize, 5); - case 6 : - return ZSTD_compressBlock_fast_dictMatchState_generic(ms, seqStore, rep, src, srcSize, 6); - case 7 : - return ZSTD_compressBlock_fast_dictMatchState_generic(ms, seqStore, rep, src, srcSize, 7); - } -} - - -static size_t ZSTD_compressBlock_fast_extDict_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize, U32 const mls) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hlog = cParams->hashLog; - /* support stepSize of 0 */ - U32 const stepSize = cParams->targetLength + !(cParams->targetLength); - const BYTE* const base = ms->window.base; - const BYTE* const dictBase = ms->window.dictBase; - const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; - const BYTE* anchor = istart; - const U32 endIndex = (U32)((size_t)(istart - base) + srcSize); - const U32 lowLimit = ZSTD_getLowestMatchIndex(ms, endIndex, cParams->windowLog); - const U32 dictStartIndex = lowLimit; - const BYTE* const dictStart = dictBase + dictStartIndex; - const U32 dictLimit = ms->window.dictLimit; - const U32 prefixStartIndex = dictLimit < lowLimit ? lowLimit : dictLimit; - const BYTE* const prefixStart = base + prefixStartIndex; - const BYTE* const dictEnd = dictBase + prefixStartIndex; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - 8; - U32 offset_1=rep[0], offset_2=rep[1]; - - DEBUGLOG(5, "ZSTD_compressBlock_fast_extDict_generic"); - - /* switch to "regular" variant if extDict is invalidated due to maxDistance */ - if (prefixStartIndex == dictStartIndex) - return ZSTD_compressBlock_fast_generic(ms, seqStore, rep, src, srcSize, mls); - - /* Search Loop */ - while (ip < ilimit) { /* < instead of <=, because (ip+1) */ - const size_t h = ZSTD_hashPtr(ip, hlog, mls); - const U32 matchIndex = hashTable[h]; - const BYTE* const matchBase = matchIndex < prefixStartIndex ? dictBase : base; - const BYTE* match = matchBase + matchIndex; - const U32 current = (U32)(ip-base); - const U32 repIndex = current + 1 - offset_1; - const BYTE* const repBase = repIndex < prefixStartIndex ? dictBase : base; - const BYTE* const repMatch = repBase + repIndex; - hashTable[h] = current; /* update hash table */ - assert(offset_1 <= current +1); /* check repIndex */ - - if ( (((U32)((prefixStartIndex-1) - repIndex) >= 3) /* intentional underflow */ & (repIndex > dictStartIndex)) - && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { - const BYTE* const repMatchEnd = repIndex < prefixStartIndex ? dictEnd : iend; - size_t const rLength = ZSTD_count_2segments(ip+1 +4, repMatch +4, iend, repMatchEnd, prefixStart) + 4; - ip++; - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, 0, rLength-MINMATCH); - ip += rLength; - anchor = ip; - } else { - if ( (matchIndex < dictStartIndex) || - (MEM_read32(match) != MEM_read32(ip)) ) { - assert(stepSize >= 1); - ip += ((ip-anchor) >> kSearchStrength) + stepSize; - continue; - } - { const BYTE* const matchEnd = matchIndex < prefixStartIndex ? dictEnd : iend; - const BYTE* const lowMatchPtr = matchIndex < prefixStartIndex ? dictStart : prefixStart; - U32 const offset = current - matchIndex; - size_t mLength = ZSTD_count_2segments(ip+4, match+4, iend, matchEnd, prefixStart) + 4; - while (((ip>anchor) & (match>lowMatchPtr)) && (ip[-1] == match[-1])) { ip--; match--; mLength++; } /* catch up */ - offset_2 = offset_1; offset_1 = offset; /* update offset history */ - ZSTD_storeSeq(seqStore, (size_t)(ip-anchor), anchor, iend, offset + ZSTD_REP_MOVE, mLength-MINMATCH); - ip += mLength; - anchor = ip; - } } - - if (ip <= ilimit) { - /* Fill Table */ - hashTable[ZSTD_hashPtr(base+current+2, hlog, mls)] = current+2; - hashTable[ZSTD_hashPtr(ip-2, hlog, mls)] = (U32)(ip-2-base); - /* check immediate repcode */ - while (ip <= ilimit) { - U32 const current2 = (U32)(ip-base); - U32 const repIndex2 = current2 - offset_2; - const BYTE* const repMatch2 = repIndex2 < prefixStartIndex ? dictBase + repIndex2 : base + repIndex2; - if ( (((U32)((prefixStartIndex-1) - repIndex2) >= 3) & (repIndex2 > dictStartIndex)) /* intentional overflow */ - && (MEM_read32(repMatch2) == MEM_read32(ip)) ) { - const BYTE* const repEnd2 = repIndex2 < prefixStartIndex ? dictEnd : iend; - size_t const repLength2 = ZSTD_count_2segments(ip+4, repMatch2+4, iend, repEnd2, prefixStart) + 4; - { U32 const tmpOffset = offset_2; offset_2 = offset_1; offset_1 = tmpOffset; } /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0 /*litlen*/, anchor, iend, 0 /*offcode*/, repLength2-MINMATCH); - hashTable[ZSTD_hashPtr(ip, hlog, mls)] = current2; - ip += repLength2; - anchor = ip; - continue; - } - break; - } } } - - /* save reps for next block */ - rep[0] = offset_1; - rep[1] = offset_2; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - - -size_t ZSTD_compressBlock_fast_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - U32 const mls = ms->cParams.minMatch; - switch(mls) - { - default: /* includes case 3 */ - case 4 : - return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, 4); - case 5 : - return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, 5); - case 6 : - return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, 6); - case 7 : - return ZSTD_compressBlock_fast_extDict_generic(ms, seqStore, rep, src, srcSize, 7); - } -} diff --git a/vendor/github.com/DataDog/zstd/zstd_fast.h b/vendor/github.com/DataDog/zstd/zstd_fast.h deleted file mode 100644 index b74a88c5..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_fast.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_FAST_H -#define ZSTD_FAST_H - -#if defined (__cplusplus) -extern "C" { -#endif - -#include "mem.h" /* U32 */ -#include "zstd_compress_internal.h" - -void ZSTD_fillHashTable(ZSTD_matchState_t* ms, - void const* end, ZSTD_dictTableLoadMethod_e dtlm); -size_t ZSTD_compressBlock_fast( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_fast_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_fast_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_FAST_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_internal.h b/vendor/github.com/DataDog/zstd/zstd_internal.h deleted file mode 100644 index dcdcbdb8..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_internal.h +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_CCOMMON_H_MODULE -#define ZSTD_CCOMMON_H_MODULE - -/* this module contains definitions which must be identical - * across compression, decompression and dictBuilder. - * It also contains a few functions useful to at least 2 of them - * and which benefit from being inlined */ - -/*-************************************* -* Dependencies -***************************************/ -#include "compiler.h" -#include "mem.h" -#include "debug.h" /* assert, DEBUGLOG, RAWLOG, g_debuglevel */ -#include "error_private.h" -#define ZSTD_STATIC_LINKING_ONLY -#include "zstd.h" -#define FSE_STATIC_LINKING_ONLY -#include "fse.h" -#define HUF_STATIC_LINKING_ONLY -#include "huf.h" -#ifndef XXH_STATIC_LINKING_ONLY -# define XXH_STATIC_LINKING_ONLY /* XXH64_state_t */ -#endif -#include "xxhash.h" /* XXH_reset, update, digest */ - -#if defined (__cplusplus) -extern "C" { -#endif - -/* ---- static assert (debug) --- */ -#define ZSTD_STATIC_ASSERT(c) DEBUG_STATIC_ASSERT(c) -#define ZSTD_isError ERR_isError /* for inlining */ -#define FSE_isError ERR_isError -#define HUF_isError ERR_isError - - -/*-************************************* -* shared macros -***************************************/ -#undef MIN -#undef MAX -#define MIN(a,b) ((a)<(b) ? (a) : (b)) -#define MAX(a,b) ((a)>(b) ? (a) : (b)) - -/** - * Return the specified error if the condition evaluates to true. - * - * In debug modes, prints additional information. - * In order to do that (particularly, printing the conditional that failed), - * this can't just wrap RETURN_ERROR(). - */ -#define RETURN_ERROR_IF(cond, err, ...) \ - if (cond) { \ - RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", __FILE__, __LINE__, ZSTD_QUOTE(cond), ZSTD_QUOTE(ERROR(err))); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return ERROR(err); \ - } - -/** - * Unconditionally return the specified error. - * - * In debug modes, prints additional information. - */ -#define RETURN_ERROR(err, ...) \ - do { \ - RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", __FILE__, __LINE__, ZSTD_QUOTE(ERROR(err))); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return ERROR(err); \ - } while(0); - -/** - * If the provided expression evaluates to an error code, returns that error code. - * - * In debug modes, prints additional information. - */ -#define FORWARD_IF_ERROR(err, ...) \ - do { \ - size_t const err_code = (err); \ - if (ERR_isError(err_code)) { \ - RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", __FILE__, __LINE__, ZSTD_QUOTE(err), ERR_getErrorName(err_code)); \ - RAWLOG(3, ": " __VA_ARGS__); \ - RAWLOG(3, "\n"); \ - return err_code; \ - } \ - } while(0); - - -/*-************************************* -* Common constants -***************************************/ -#define ZSTD_OPT_NUM (1<<12) - -#define ZSTD_REP_NUM 3 /* number of repcodes */ -#define ZSTD_REP_MOVE (ZSTD_REP_NUM-1) -static const U32 repStartValue[ZSTD_REP_NUM] = { 1, 4, 8 }; - -#define KB *(1 <<10) -#define MB *(1 <<20) -#define GB *(1U<<30) - -#define BIT7 128 -#define BIT6 64 -#define BIT5 32 -#define BIT4 16 -#define BIT1 2 -#define BIT0 1 - -#define ZSTD_WINDOWLOG_ABSOLUTEMIN 10 -static const size_t ZSTD_fcs_fieldSize[4] = { 0, 2, 4, 8 }; -static const size_t ZSTD_did_fieldSize[4] = { 0, 1, 2, 4 }; - -#define ZSTD_FRAMEIDSIZE 4 /* magic number size */ - -#define ZSTD_BLOCKHEADERSIZE 3 /* C standard doesn't allow `static const` variable to be init using another `static const` variable */ -static const size_t ZSTD_blockHeaderSize = ZSTD_BLOCKHEADERSIZE; -typedef enum { bt_raw, bt_rle, bt_compressed, bt_reserved } blockType_e; - -#define MIN_SEQUENCES_SIZE 1 /* nbSeq==0 */ -#define MIN_CBLOCK_SIZE (1 /*litCSize*/ + 1 /* RLE or RAW */ + MIN_SEQUENCES_SIZE /* nbSeq==0 */) /* for a non-null block */ - -#define HufLog 12 -typedef enum { set_basic, set_rle, set_compressed, set_repeat } symbolEncodingType_e; - -#define LONGNBSEQ 0x7F00 - -#define MINMATCH 3 - -#define Litbits 8 -#define MaxLit ((1<= 8 || (ovtype == ZSTD_no_overlap && diff <= -WILDCOPY_VECLEN)); - - if (ovtype == ZSTD_overlap_src_before_dst && diff < WILDCOPY_VECLEN) { - /* Handle short offset copies. */ - do { - COPY8(op, ip) - } while (op < oend); - } else { - assert(diff >= WILDCOPY_VECLEN || diff <= -WILDCOPY_VECLEN); - /* Separate out the first two COPY16() calls because the copy length is - * almost certain to be short, so the branches have different - * probabilities. - * On gcc-9 unrolling once is +1.6%, twice is +2%, thrice is +1.8%. - * On clang-8 unrolling once is +1.4%, twice is +3.3%, thrice is +3%. - */ - COPY16(op, ip); - COPY16(op, ip); - if (op >= oend) return; - do { - COPY16(op, ip); - COPY16(op, ip); - } - while (op < oend); - } -} - - -/*-******************************************* -* Private declarations -*********************************************/ -typedef struct seqDef_s { - U32 offset; - U16 litLength; - U16 matchLength; -} seqDef; - -typedef struct { - seqDef* sequencesStart; - seqDef* sequences; - BYTE* litStart; - BYTE* lit; - BYTE* llCode; - BYTE* mlCode; - BYTE* ofCode; - size_t maxNbSeq; - size_t maxNbLit; - U32 longLengthID; /* 0 == no longLength; 1 == Lit.longLength; 2 == Match.longLength; */ - U32 longLengthPos; -} seqStore_t; - -/** - * Contains the compressed frame size and an upper-bound for the decompressed frame size. - * Note: before using `compressedSize`, check for errors using ZSTD_isError(). - * similarly, before using `decompressedBound`, check for errors using: - * `decompressedBound != ZSTD_CONTENTSIZE_ERROR` - */ -typedef struct { - size_t compressedSize; - unsigned long long decompressedBound; -} ZSTD_frameSizeInfo; /* decompress & legacy */ - -const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx); /* compress & dictBuilder */ -void ZSTD_seqToCodes(const seqStore_t* seqStorePtr); /* compress, dictBuilder, decodeCorpus (shouldn't get its definition from here) */ - -/* custom memory allocation functions */ -void* ZSTD_malloc(size_t size, ZSTD_customMem customMem); -void* ZSTD_calloc(size_t size, ZSTD_customMem customMem); -void ZSTD_free(void* ptr, ZSTD_customMem customMem); - - -MEM_STATIC U32 ZSTD_highbit32(U32 val) /* compress, dictBuilder, decodeCorpus */ -{ - assert(val != 0); - { -# if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - _BitScanReverse(&r, val); - return (unsigned)r; -# elif defined(__GNUC__) && (__GNUC__ >= 3) /* GCC Intrinsic */ - return __builtin_clz (val) ^ 31; -# elif defined(__ICCARM__) /* IAR Intrinsic */ - return 31 - __CLZ(val); -# else /* Software version */ - static const U32 DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 }; - U32 v = val; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - return DeBruijnClz[(v * 0x07C4ACDDU) >> 27]; -# endif - } -} - - -/* ZSTD_invalidateRepCodes() : - * ensures next compression will not use repcodes from previous block. - * Note : only works with regular variant; - * do not use with extDict variant ! */ -void ZSTD_invalidateRepCodes(ZSTD_CCtx* cctx); /* zstdmt, adaptive_compression (shouldn't get this definition from here) */ - - -typedef struct { - blockType_e blockType; - U32 lastBlock; - U32 origSize; -} blockProperties_t; /* declared here for decompress and fullbench */ - -/*! ZSTD_getcBlockSize() : - * Provides the size of compressed block from block header `src` */ -/* Used by: decompress, fullbench (does not get its definition from here) */ -size_t ZSTD_getcBlockSize(const void* src, size_t srcSize, - blockProperties_t* bpPtr); - -/*! ZSTD_decodeSeqHeaders() : - * decode sequence header from src */ -/* Used by: decompress, fullbench (does not get its definition from here) */ -size_t ZSTD_decodeSeqHeaders(ZSTD_DCtx* dctx, int* nbSeqPtr, - const void* src, size_t srcSize); - - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_CCOMMON_H_MODULE */ diff --git a/vendor/github.com/DataDog/zstd/zstd_lazy.c b/vendor/github.com/DataDog/zstd/zstd_lazy.c deleted file mode 100644 index 9ad7e03b..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_lazy.c +++ /dev/null @@ -1,1115 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#include "zstd_compress_internal.h" -#include "zstd_lazy.h" - - -/*-************************************* -* Binary Tree search -***************************************/ - -static void -ZSTD_updateDUBT(ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* iend, - U32 mls) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hashLog = cParams->hashLog; - - U32* const bt = ms->chainTable; - U32 const btLog = cParams->chainLog - 1; - U32 const btMask = (1 << btLog) - 1; - - const BYTE* const base = ms->window.base; - U32 const target = (U32)(ip - base); - U32 idx = ms->nextToUpdate; - - if (idx != target) - DEBUGLOG(7, "ZSTD_updateDUBT, from %u to %u (dictLimit:%u)", - idx, target, ms->window.dictLimit); - assert(ip + 8 <= iend); /* condition for ZSTD_hashPtr */ - (void)iend; - - assert(idx >= ms->window.dictLimit); /* condition for valid base+idx */ - for ( ; idx < target ; idx++) { - size_t const h = ZSTD_hashPtr(base + idx, hashLog, mls); /* assumption : ip + 8 <= iend */ - U32 const matchIndex = hashTable[h]; - - U32* const nextCandidatePtr = bt + 2*(idx&btMask); - U32* const sortMarkPtr = nextCandidatePtr + 1; - - DEBUGLOG(8, "ZSTD_updateDUBT: insert %u", idx); - hashTable[h] = idx; /* Update Hash Table */ - *nextCandidatePtr = matchIndex; /* update BT like a chain */ - *sortMarkPtr = ZSTD_DUBT_UNSORTED_MARK; - } - ms->nextToUpdate = target; -} - - -/** ZSTD_insertDUBT1() : - * sort one already inserted but unsorted position - * assumption : current >= btlow == (current - btmask) - * doesn't fail */ -static void -ZSTD_insertDUBT1(ZSTD_matchState_t* ms, - U32 current, const BYTE* inputEnd, - U32 nbCompares, U32 btLow, - const ZSTD_dictMode_e dictMode) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const bt = ms->chainTable; - U32 const btLog = cParams->chainLog - 1; - U32 const btMask = (1 << btLog) - 1; - size_t commonLengthSmaller=0, commonLengthLarger=0; - const BYTE* const base = ms->window.base; - const BYTE* const dictBase = ms->window.dictBase; - const U32 dictLimit = ms->window.dictLimit; - const BYTE* const ip = (current>=dictLimit) ? base + current : dictBase + current; - const BYTE* const iend = (current>=dictLimit) ? inputEnd : dictBase + dictLimit; - const BYTE* const dictEnd = dictBase + dictLimit; - const BYTE* const prefixStart = base + dictLimit; - const BYTE* match; - U32* smallerPtr = bt + 2*(current&btMask); - U32* largerPtr = smallerPtr + 1; - U32 matchIndex = *smallerPtr; /* this candidate is unsorted : next sorted candidate is reached through *smallerPtr, while *largerPtr contains previous unsorted candidate (which is already saved and can be overwritten) */ - U32 dummy32; /* to be nullified at the end */ - U32 const windowValid = ms->window.lowLimit; - U32 const maxDistance = 1U << cParams->windowLog; - U32 const windowLow = (current - windowValid > maxDistance) ? current - maxDistance : windowValid; - - - DEBUGLOG(8, "ZSTD_insertDUBT1(%u) (dictLimit=%u, lowLimit=%u)", - current, dictLimit, windowLow); - assert(current >= btLow); - assert(ip < iend); /* condition for ZSTD_count */ - - while (nbCompares-- && (matchIndex > windowLow)) { - U32* const nextPtr = bt + 2*(matchIndex & btMask); - size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ - assert(matchIndex < current); - /* note : all candidates are now supposed sorted, - * but it's still possible to have nextPtr[1] == ZSTD_DUBT_UNSORTED_MARK - * when a real index has the same value as ZSTD_DUBT_UNSORTED_MARK */ - - if ( (dictMode != ZSTD_extDict) - || (matchIndex+matchLength >= dictLimit) /* both in current segment*/ - || (current < dictLimit) /* both in extDict */) { - const BYTE* const mBase = ( (dictMode != ZSTD_extDict) - || (matchIndex+matchLength >= dictLimit)) ? - base : dictBase; - assert( (matchIndex+matchLength >= dictLimit) /* might be wrong if extDict is incorrectly set to 0 */ - || (current < dictLimit) ); - match = mBase + matchIndex; - matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend); - } else { - match = dictBase + matchIndex; - matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart); - if (matchIndex+matchLength >= dictLimit) - match = base + matchIndex; /* preparation for next read of match[matchLength] */ - } - - DEBUGLOG(8, "ZSTD_insertDUBT1: comparing %u with %u : found %u common bytes ", - current, matchIndex, (U32)matchLength); - - if (ip+matchLength == iend) { /* equal : no way to know if inf or sup */ - break; /* drop , to guarantee consistency ; miss a bit of compression, but other solutions can corrupt tree */ - } - - if (match[matchLength] < ip[matchLength]) { /* necessarily within buffer */ - /* match is smaller than current */ - *smallerPtr = matchIndex; /* update smaller idx */ - commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */ - if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop searching */ - DEBUGLOG(8, "ZSTD_insertDUBT1: %u (>btLow=%u) is smaller : next => %u", - matchIndex, btLow, nextPtr[1]); - smallerPtr = nextPtr+1; /* new "candidate" => larger than match, which was smaller than target */ - matchIndex = nextPtr[1]; /* new matchIndex, larger than previous and closer to current */ - } else { - /* match is larger than current */ - *largerPtr = matchIndex; - commonLengthLarger = matchLength; - if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop searching */ - DEBUGLOG(8, "ZSTD_insertDUBT1: %u (>btLow=%u) is larger => %u", - matchIndex, btLow, nextPtr[0]); - largerPtr = nextPtr; - matchIndex = nextPtr[0]; - } } - - *smallerPtr = *largerPtr = 0; -} - - -static size_t -ZSTD_DUBT_findBetterDictMatch ( - ZSTD_matchState_t* ms, - const BYTE* const ip, const BYTE* const iend, - size_t* offsetPtr, - size_t bestLength, - U32 nbCompares, - U32 const mls, - const ZSTD_dictMode_e dictMode) -{ - const ZSTD_matchState_t * const dms = ms->dictMatchState; - const ZSTD_compressionParameters* const dmsCParams = &dms->cParams; - const U32 * const dictHashTable = dms->hashTable; - U32 const hashLog = dmsCParams->hashLog; - size_t const h = ZSTD_hashPtr(ip, hashLog, mls); - U32 dictMatchIndex = dictHashTable[h]; - - const BYTE* const base = ms->window.base; - const BYTE* const prefixStart = base + ms->window.dictLimit; - U32 const current = (U32)(ip-base); - const BYTE* const dictBase = dms->window.base; - const BYTE* const dictEnd = dms->window.nextSrc; - U32 const dictHighLimit = (U32)(dms->window.nextSrc - dms->window.base); - U32 const dictLowLimit = dms->window.lowLimit; - U32 const dictIndexDelta = ms->window.lowLimit - dictHighLimit; - - U32* const dictBt = dms->chainTable; - U32 const btLog = dmsCParams->chainLog - 1; - U32 const btMask = (1 << btLog) - 1; - U32 const btLow = (btMask >= dictHighLimit - dictLowLimit) ? dictLowLimit : dictHighLimit - btMask; - - size_t commonLengthSmaller=0, commonLengthLarger=0; - - (void)dictMode; - assert(dictMode == ZSTD_dictMatchState); - - while (nbCompares-- && (dictMatchIndex > dictLowLimit)) { - U32* const nextPtr = dictBt + 2*(dictMatchIndex & btMask); - size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ - const BYTE* match = dictBase + dictMatchIndex; - matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart); - if (dictMatchIndex+matchLength >= dictHighLimit) - match = base + dictMatchIndex + dictIndexDelta; /* to prepare for next usage of match[matchLength] */ - - if (matchLength > bestLength) { - U32 matchIndex = dictMatchIndex + dictIndexDelta; - if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit32(current-matchIndex+1) - ZSTD_highbit32((U32)offsetPtr[0]+1)) ) { - DEBUGLOG(9, "ZSTD_DUBT_findBetterDictMatch(%u) : found better match length %u -> %u and offsetCode %u -> %u (dictMatchIndex %u, matchIndex %u)", - current, (U32)bestLength, (U32)matchLength, (U32)*offsetPtr, ZSTD_REP_MOVE + current - matchIndex, dictMatchIndex, matchIndex); - bestLength = matchLength, *offsetPtr = ZSTD_REP_MOVE + current - matchIndex; - } - if (ip+matchLength == iend) { /* reached end of input : ip[matchLength] is not valid, no way to know if it's larger or smaller than match */ - break; /* drop, to guarantee consistency (miss a little bit of compression) */ - } - } - - if (match[matchLength] < ip[matchLength]) { - if (dictMatchIndex <= btLow) { break; } /* beyond tree size, stop the search */ - commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */ - dictMatchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to current) */ - } else { - /* match is larger than current */ - if (dictMatchIndex <= btLow) { break; } /* beyond tree size, stop the search */ - commonLengthLarger = matchLength; - dictMatchIndex = nextPtr[0]; - } - } - - if (bestLength >= MINMATCH) { - U32 const mIndex = current - ((U32)*offsetPtr - ZSTD_REP_MOVE); (void)mIndex; - DEBUGLOG(8, "ZSTD_DUBT_findBetterDictMatch(%u) : found match of length %u and offsetCode %u (pos %u)", - current, (U32)bestLength, (U32)*offsetPtr, mIndex); - } - return bestLength; - -} - - -static size_t -ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, - const BYTE* const ip, const BYTE* const iend, - size_t* offsetPtr, - U32 const mls, - const ZSTD_dictMode_e dictMode) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hashLog = cParams->hashLog; - size_t const h = ZSTD_hashPtr(ip, hashLog, mls); - U32 matchIndex = hashTable[h]; - - const BYTE* const base = ms->window.base; - U32 const current = (U32)(ip-base); - U32 const windowLow = ZSTD_getLowestMatchIndex(ms, current, cParams->windowLog); - - U32* const bt = ms->chainTable; - U32 const btLog = cParams->chainLog - 1; - U32 const btMask = (1 << btLog) - 1; - U32 const btLow = (btMask >= current) ? 0 : current - btMask; - U32 const unsortLimit = MAX(btLow, windowLow); - - U32* nextCandidate = bt + 2*(matchIndex&btMask); - U32* unsortedMark = bt + 2*(matchIndex&btMask) + 1; - U32 nbCompares = 1U << cParams->searchLog; - U32 nbCandidates = nbCompares; - U32 previousCandidate = 0; - - DEBUGLOG(7, "ZSTD_DUBT_findBestMatch (%u) ", current); - assert(ip <= iend-8); /* required for h calculation */ - - /* reach end of unsorted candidates list */ - while ( (matchIndex > unsortLimit) - && (*unsortedMark == ZSTD_DUBT_UNSORTED_MARK) - && (nbCandidates > 1) ) { - DEBUGLOG(8, "ZSTD_DUBT_findBestMatch: candidate %u is unsorted", - matchIndex); - *unsortedMark = previousCandidate; /* the unsortedMark becomes a reversed chain, to move up back to original position */ - previousCandidate = matchIndex; - matchIndex = *nextCandidate; - nextCandidate = bt + 2*(matchIndex&btMask); - unsortedMark = bt + 2*(matchIndex&btMask) + 1; - nbCandidates --; - } - - /* nullify last candidate if it's still unsorted - * simplification, detrimental to compression ratio, beneficial for speed */ - if ( (matchIndex > unsortLimit) - && (*unsortedMark==ZSTD_DUBT_UNSORTED_MARK) ) { - DEBUGLOG(7, "ZSTD_DUBT_findBestMatch: nullify last unsorted candidate %u", - matchIndex); - *nextCandidate = *unsortedMark = 0; - } - - /* batch sort stacked candidates */ - matchIndex = previousCandidate; - while (matchIndex) { /* will end on matchIndex == 0 */ - U32* const nextCandidateIdxPtr = bt + 2*(matchIndex&btMask) + 1; - U32 const nextCandidateIdx = *nextCandidateIdxPtr; - ZSTD_insertDUBT1(ms, matchIndex, iend, - nbCandidates, unsortLimit, dictMode); - matchIndex = nextCandidateIdx; - nbCandidates++; - } - - /* find longest match */ - { size_t commonLengthSmaller = 0, commonLengthLarger = 0; - const BYTE* const dictBase = ms->window.dictBase; - const U32 dictLimit = ms->window.dictLimit; - const BYTE* const dictEnd = dictBase + dictLimit; - const BYTE* const prefixStart = base + dictLimit; - U32* smallerPtr = bt + 2*(current&btMask); - U32* largerPtr = bt + 2*(current&btMask) + 1; - U32 matchEndIdx = current + 8 + 1; - U32 dummy32; /* to be nullified at the end */ - size_t bestLength = 0; - - matchIndex = hashTable[h]; - hashTable[h] = current; /* Update Hash Table */ - - while (nbCompares-- && (matchIndex > windowLow)) { - U32* const nextPtr = bt + 2*(matchIndex & btMask); - size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ - const BYTE* match; - - if ((dictMode != ZSTD_extDict) || (matchIndex+matchLength >= dictLimit)) { - match = base + matchIndex; - matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend); - } else { - match = dictBase + matchIndex; - matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart); - if (matchIndex+matchLength >= dictLimit) - match = base + matchIndex; /* to prepare for next usage of match[matchLength] */ - } - - if (matchLength > bestLength) { - if (matchLength > matchEndIdx - matchIndex) - matchEndIdx = matchIndex + (U32)matchLength; - if ( (4*(int)(matchLength-bestLength)) > (int)(ZSTD_highbit32(current-matchIndex+1) - ZSTD_highbit32((U32)offsetPtr[0]+1)) ) - bestLength = matchLength, *offsetPtr = ZSTD_REP_MOVE + current - matchIndex; - if (ip+matchLength == iend) { /* equal : no way to know if inf or sup */ - if (dictMode == ZSTD_dictMatchState) { - nbCompares = 0; /* in addition to avoiding checking any - * further in this loop, make sure we - * skip checking in the dictionary. */ - } - break; /* drop, to guarantee consistency (miss a little bit of compression) */ - } - } - - if (match[matchLength] < ip[matchLength]) { - /* match is smaller than current */ - *smallerPtr = matchIndex; /* update smaller idx */ - commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */ - if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop the search */ - smallerPtr = nextPtr+1; /* new "smaller" => larger of match */ - matchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to current) */ - } else { - /* match is larger than current */ - *largerPtr = matchIndex; - commonLengthLarger = matchLength; - if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop the search */ - largerPtr = nextPtr; - matchIndex = nextPtr[0]; - } } - - *smallerPtr = *largerPtr = 0; - - if (dictMode == ZSTD_dictMatchState && nbCompares) { - bestLength = ZSTD_DUBT_findBetterDictMatch( - ms, ip, iend, - offsetPtr, bestLength, nbCompares, - mls, dictMode); - } - - assert(matchEndIdx > current+8); /* ensure nextToUpdate is increased */ - ms->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */ - if (bestLength >= MINMATCH) { - U32 const mIndex = current - ((U32)*offsetPtr - ZSTD_REP_MOVE); (void)mIndex; - DEBUGLOG(8, "ZSTD_DUBT_findBestMatch(%u) : found match of length %u and offsetCode %u (pos %u)", - current, (U32)bestLength, (U32)*offsetPtr, mIndex); - } - return bestLength; - } -} - - -/** ZSTD_BtFindBestMatch() : Tree updater, providing best match */ -FORCE_INLINE_TEMPLATE size_t -ZSTD_BtFindBestMatch( ZSTD_matchState_t* ms, - const BYTE* const ip, const BYTE* const iLimit, - size_t* offsetPtr, - const U32 mls /* template */, - const ZSTD_dictMode_e dictMode) -{ - DEBUGLOG(7, "ZSTD_BtFindBestMatch"); - if (ip < ms->window.base + ms->nextToUpdate) return 0; /* skipped area */ - ZSTD_updateDUBT(ms, ip, iLimit, mls); - return ZSTD_DUBT_findBestMatch(ms, ip, iLimit, offsetPtr, mls, dictMode); -} - - -static size_t -ZSTD_BtFindBestMatch_selectMLS ( ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 4, ZSTD_noDict); - case 5 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 5, ZSTD_noDict); - case 7 : - case 6 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 6, ZSTD_noDict); - } -} - - -static size_t ZSTD_BtFindBestMatch_dictMatchState_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 4, ZSTD_dictMatchState); - case 5 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 5, ZSTD_dictMatchState); - case 7 : - case 6 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 6, ZSTD_dictMatchState); - } -} - - -static size_t ZSTD_BtFindBestMatch_extDict_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 4, ZSTD_extDict); - case 5 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 5, ZSTD_extDict); - case 7 : - case 6 : return ZSTD_BtFindBestMatch(ms, ip, iLimit, offsetPtr, 6, ZSTD_extDict); - } -} - - - -/* ********************************* -* Hash Chain -***********************************/ -#define NEXT_IN_CHAIN(d, mask) chainTable[(d) & (mask)] - -/* Update chains up to ip (excluded) - Assumption : always within prefix (i.e. not within extDict) */ -static U32 ZSTD_insertAndFindFirstIndex_internal( - ZSTD_matchState_t* ms, - const ZSTD_compressionParameters* const cParams, - const BYTE* ip, U32 const mls) -{ - U32* const hashTable = ms->hashTable; - const U32 hashLog = cParams->hashLog; - U32* const chainTable = ms->chainTable; - const U32 chainMask = (1 << cParams->chainLog) - 1; - const BYTE* const base = ms->window.base; - const U32 target = (U32)(ip - base); - U32 idx = ms->nextToUpdate; - - while(idx < target) { /* catch up */ - size_t const h = ZSTD_hashPtr(base+idx, hashLog, mls); - NEXT_IN_CHAIN(idx, chainMask) = hashTable[h]; - hashTable[h] = idx; - idx++; - } - - ms->nextToUpdate = target; - return hashTable[ZSTD_hashPtr(ip, hashLog, mls)]; -} - -U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip) { - const ZSTD_compressionParameters* const cParams = &ms->cParams; - return ZSTD_insertAndFindFirstIndex_internal(ms, cParams, ip, ms->cParams.minMatch); -} - - -/* inlining is important to hardwire a hot branch (template emulation) */ -FORCE_INLINE_TEMPLATE -size_t ZSTD_HcFindBestMatch_generic ( - ZSTD_matchState_t* ms, - const BYTE* const ip, const BYTE* const iLimit, - size_t* offsetPtr, - const U32 mls, const ZSTD_dictMode_e dictMode) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const chainTable = ms->chainTable; - const U32 chainSize = (1 << cParams->chainLog); - const U32 chainMask = chainSize-1; - const BYTE* const base = ms->window.base; - const BYTE* const dictBase = ms->window.dictBase; - const U32 dictLimit = ms->window.dictLimit; - const BYTE* const prefixStart = base + dictLimit; - const BYTE* const dictEnd = dictBase + dictLimit; - const U32 current = (U32)(ip-base); - const U32 maxDistance = 1U << cParams->windowLog; - const U32 lowestValid = ms->window.lowLimit; - const U32 withinMaxDistance = (current - lowestValid > maxDistance) ? current - maxDistance : lowestValid; - const U32 isDictionary = (ms->loadedDictEnd != 0); - const U32 lowLimit = isDictionary ? lowestValid : withinMaxDistance; - const U32 minChain = current > chainSize ? current - chainSize : 0; - U32 nbAttempts = 1U << cParams->searchLog; - size_t ml=4-1; - - /* HC4 match finder */ - U32 matchIndex = ZSTD_insertAndFindFirstIndex_internal(ms, cParams, ip, mls); - - for ( ; (matchIndex>lowLimit) & (nbAttempts>0) ; nbAttempts--) { - size_t currentMl=0; - if ((dictMode != ZSTD_extDict) || matchIndex >= dictLimit) { - const BYTE* const match = base + matchIndex; - assert(matchIndex >= dictLimit); /* ensures this is true if dictMode != ZSTD_extDict */ - if (match[ml] == ip[ml]) /* potentially better */ - currentMl = ZSTD_count(ip, match, iLimit); - } else { - const BYTE* const match = dictBase + matchIndex; - assert(match+4 <= dictEnd); - if (MEM_read32(match) == MEM_read32(ip)) /* assumption : matchIndex <= dictLimit-4 (by table construction) */ - currentMl = ZSTD_count_2segments(ip+4, match+4, iLimit, dictEnd, prefixStart) + 4; - } - - /* save best solution */ - if (currentMl > ml) { - ml = currentMl; - *offsetPtr = current - matchIndex + ZSTD_REP_MOVE; - if (ip+currentMl == iLimit) break; /* best possible, avoids read overflow on next attempt */ - } - - if (matchIndex <= minChain) break; - matchIndex = NEXT_IN_CHAIN(matchIndex, chainMask); - } - - if (dictMode == ZSTD_dictMatchState) { - const ZSTD_matchState_t* const dms = ms->dictMatchState; - const U32* const dmsChainTable = dms->chainTable; - const U32 dmsChainSize = (1 << dms->cParams.chainLog); - const U32 dmsChainMask = dmsChainSize - 1; - const U32 dmsLowestIndex = dms->window.dictLimit; - const BYTE* const dmsBase = dms->window.base; - const BYTE* const dmsEnd = dms->window.nextSrc; - const U32 dmsSize = (U32)(dmsEnd - dmsBase); - const U32 dmsIndexDelta = dictLimit - dmsSize; - const U32 dmsMinChain = dmsSize > dmsChainSize ? dmsSize - dmsChainSize : 0; - - matchIndex = dms->hashTable[ZSTD_hashPtr(ip, dms->cParams.hashLog, mls)]; - - for ( ; (matchIndex>dmsLowestIndex) & (nbAttempts>0) ; nbAttempts--) { - size_t currentMl=0; - const BYTE* const match = dmsBase + matchIndex; - assert(match+4 <= dmsEnd); - if (MEM_read32(match) == MEM_read32(ip)) /* assumption : matchIndex <= dictLimit-4 (by table construction) */ - currentMl = ZSTD_count_2segments(ip+4, match+4, iLimit, dmsEnd, prefixStart) + 4; - - /* save best solution */ - if (currentMl > ml) { - ml = currentMl; - *offsetPtr = current - (matchIndex + dmsIndexDelta) + ZSTD_REP_MOVE; - if (ip+currentMl == iLimit) break; /* best possible, avoids read overflow on next attempt */ - } - - if (matchIndex <= dmsMinChain) break; - matchIndex = dmsChainTable[matchIndex & dmsChainMask]; - } - } - - return ml; -} - - -FORCE_INLINE_TEMPLATE size_t ZSTD_HcFindBestMatch_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_noDict); - case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_noDict); - case 7 : - case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_noDict); - } -} - - -static size_t ZSTD_HcFindBestMatch_dictMatchState_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_dictMatchState); - case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_dictMatchState); - case 7 : - case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_dictMatchState); - } -} - - -FORCE_INLINE_TEMPLATE size_t ZSTD_HcFindBestMatch_extDict_selectMLS ( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* const iLimit, - size_t* offsetPtr) -{ - switch(ms->cParams.minMatch) - { - default : /* includes case 3 */ - case 4 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 4, ZSTD_extDict); - case 5 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 5, ZSTD_extDict); - case 7 : - case 6 : return ZSTD_HcFindBestMatch_generic(ms, ip, iLimit, offsetPtr, 6, ZSTD_extDict); - } -} - - -/* ******************************* -* Common parser - lazy strategy -*********************************/ -typedef enum { search_hashChain, search_binaryTree } searchMethod_e; - -FORCE_INLINE_TEMPLATE size_t -ZSTD_compressBlock_lazy_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, - U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize, - const searchMethod_e searchMethod, const U32 depth, - ZSTD_dictMode_e const dictMode) -{ - const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; - const BYTE* anchor = istart; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - 8; - const BYTE* const base = ms->window.base; - const U32 prefixLowestIndex = ms->window.dictLimit; - const BYTE* const prefixLowest = base + prefixLowestIndex; - - typedef size_t (*searchMax_f)( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* iLimit, size_t* offsetPtr); - searchMax_f const searchMax = dictMode == ZSTD_dictMatchState ? - (searchMethod==search_binaryTree ? ZSTD_BtFindBestMatch_dictMatchState_selectMLS - : ZSTD_HcFindBestMatch_dictMatchState_selectMLS) : - (searchMethod==search_binaryTree ? ZSTD_BtFindBestMatch_selectMLS - : ZSTD_HcFindBestMatch_selectMLS); - U32 offset_1 = rep[0], offset_2 = rep[1], savedOffset=0; - - const ZSTD_matchState_t* const dms = ms->dictMatchState; - const U32 dictLowestIndex = dictMode == ZSTD_dictMatchState ? - dms->window.dictLimit : 0; - const BYTE* const dictBase = dictMode == ZSTD_dictMatchState ? - dms->window.base : NULL; - const BYTE* const dictLowest = dictMode == ZSTD_dictMatchState ? - dictBase + dictLowestIndex : NULL; - const BYTE* const dictEnd = dictMode == ZSTD_dictMatchState ? - dms->window.nextSrc : NULL; - const U32 dictIndexDelta = dictMode == ZSTD_dictMatchState ? - prefixLowestIndex - (U32)(dictEnd - dictBase) : - 0; - const U32 dictAndPrefixLength = (U32)(ip - prefixLowest + dictEnd - dictLowest); - - /* init */ - ip += (dictAndPrefixLength == 0); - if (dictMode == ZSTD_noDict) { - U32 const maxRep = (U32)(ip - prefixLowest); - if (offset_2 > maxRep) savedOffset = offset_2, offset_2 = 0; - if (offset_1 > maxRep) savedOffset = offset_1, offset_1 = 0; - } - if (dictMode == ZSTD_dictMatchState) { - /* dictMatchState repCode checks don't currently handle repCode == 0 - * disabling. */ - assert(offset_1 <= dictAndPrefixLength); - assert(offset_2 <= dictAndPrefixLength); - } - - /* Match Loop */ - while (ip < ilimit) { - size_t matchLength=0; - size_t offset=0; - const BYTE* start=ip+1; - - /* check repCode */ - if (dictMode == ZSTD_dictMatchState) { - const U32 repIndex = (U32)(ip - base) + 1 - offset_1; - const BYTE* repMatch = (dictMode == ZSTD_dictMatchState - && repIndex < prefixLowestIndex) ? - dictBase + (repIndex - dictIndexDelta) : - base + repIndex; - if (((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */) - && (MEM_read32(repMatch) == MEM_read32(ip+1)) ) { - const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend; - matchLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4; - if (depth==0) goto _storeSequence; - } - } - if ( dictMode == ZSTD_noDict - && ((offset_1 > 0) & (MEM_read32(ip+1-offset_1) == MEM_read32(ip+1)))) { - matchLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4; - if (depth==0) goto _storeSequence; - } - - /* first search (depth 0) */ - { size_t offsetFound = 999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offsetFound); - if (ml2 > matchLength) - matchLength = ml2, start = ip, offset=offsetFound; - } - - if (matchLength < 4) { - ip += ((ip-anchor) >> kSearchStrength) + 1; /* jump faster over incompressible sections */ - continue; - } - - /* let's try to find a better solution */ - if (depth>=1) - while (ip0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) { - size_t const mlRep = ZSTD_count(ip+4, ip+4-offset_1, iend) + 4; - int const gain2 = (int)(mlRep * 3); - int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offset+1) + 1); - if ((mlRep >= 4) && (gain2 > gain1)) - matchLength = mlRep, offset = 0, start = ip; - } - if (dictMode == ZSTD_dictMatchState) { - const U32 repIndex = (U32)(ip - base) - offset_1; - const BYTE* repMatch = repIndex < prefixLowestIndex ? - dictBase + (repIndex - dictIndexDelta) : - base + repIndex; - if (((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */) - && (MEM_read32(repMatch) == MEM_read32(ip)) ) { - const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend; - size_t const mlRep = ZSTD_count_2segments(ip+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4; - int const gain2 = (int)(mlRep * 3); - int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offset+1) + 1); - if ((mlRep >= 4) && (gain2 > gain1)) - matchLength = mlRep, offset = 0, start = ip; - } - } - { size_t offset2=999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offset2); - int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 4); - if ((ml2 >= 4) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; - continue; /* search a better one */ - } } - - /* let's find an even better one */ - if ((depth==2) && (ip0) & (MEM_read32(ip) == MEM_read32(ip - offset_1)))) { - size_t const mlRep = ZSTD_count(ip+4, ip+4-offset_1, iend) + 4; - int const gain2 = (int)(mlRep * 4); - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 1); - if ((mlRep >= 4) && (gain2 > gain1)) - matchLength = mlRep, offset = 0, start = ip; - } - if (dictMode == ZSTD_dictMatchState) { - const U32 repIndex = (U32)(ip - base) - offset_1; - const BYTE* repMatch = repIndex < prefixLowestIndex ? - dictBase + (repIndex - dictIndexDelta) : - base + repIndex; - if (((U32)((prefixLowestIndex-1) - repIndex) >= 3 /* intentional underflow */) - && (MEM_read32(repMatch) == MEM_read32(ip)) ) { - const BYTE* repMatchEnd = repIndex < prefixLowestIndex ? dictEnd : iend; - size_t const mlRep = ZSTD_count_2segments(ip+4, repMatch+4, iend, repMatchEnd, prefixLowest) + 4; - int const gain2 = (int)(mlRep * 4); - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 1); - if ((mlRep >= 4) && (gain2 > gain1)) - matchLength = mlRep, offset = 0, start = ip; - } - } - { size_t offset2=999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offset2); - int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 7); - if ((ml2 >= 4) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; - continue; - } } } - break; /* nothing found : store previous solution */ - } - - /* NOTE: - * start[-offset+ZSTD_REP_MOVE-1] is undefined behavior. - * (-offset+ZSTD_REP_MOVE-1) is unsigned, and is added to start, which - * overflows the pointer, which is undefined behavior. - */ - /* catch up */ - if (offset) { - if (dictMode == ZSTD_noDict) { - while ( ((start > anchor) & (start - (offset-ZSTD_REP_MOVE) > prefixLowest)) - && (start[-1] == (start-(offset-ZSTD_REP_MOVE))[-1]) ) /* only search for offset within prefix */ - { start--; matchLength++; } - } - if (dictMode == ZSTD_dictMatchState) { - U32 const matchIndex = (U32)((start-base) - (offset - ZSTD_REP_MOVE)); - const BYTE* match = (matchIndex < prefixLowestIndex) ? dictBase + matchIndex - dictIndexDelta : base + matchIndex; - const BYTE* const mStart = (matchIndex < prefixLowestIndex) ? dictLowest : prefixLowest; - while ((start>anchor) && (match>mStart) && (start[-1] == match[-1])) { start--; match--; matchLength++; } /* catch up */ - } - offset_2 = offset_1; offset_1 = (U32)(offset - ZSTD_REP_MOVE); - } - /* store sequence */ -_storeSequence: - { size_t const litLength = start - anchor; - ZSTD_storeSeq(seqStore, litLength, anchor, iend, (U32)offset, matchLength-MINMATCH); - anchor = ip = start + matchLength; - } - - /* check immediate repcode */ - if (dictMode == ZSTD_dictMatchState) { - while (ip <= ilimit) { - U32 const current2 = (U32)(ip-base); - U32 const repIndex = current2 - offset_2; - const BYTE* repMatch = dictMode == ZSTD_dictMatchState - && repIndex < prefixLowestIndex ? - dictBase - dictIndexDelta + repIndex : - base + repIndex; - if ( ((U32)((prefixLowestIndex-1) - (U32)repIndex) >= 3 /* intentional overflow */) - && (MEM_read32(repMatch) == MEM_read32(ip)) ) { - const BYTE* const repEnd2 = repIndex < prefixLowestIndex ? dictEnd : iend; - matchLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd2, prefixLowest) + 4; - offset = offset_2; offset_2 = offset_1; offset_1 = (U32)offset; /* swap offset_2 <=> offset_1 */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, matchLength-MINMATCH); - ip += matchLength; - anchor = ip; - continue; - } - break; - } - } - - if (dictMode == ZSTD_noDict) { - while ( ((ip <= ilimit) & (offset_2>0)) - && (MEM_read32(ip) == MEM_read32(ip - offset_2)) ) { - /* store sequence */ - matchLength = ZSTD_count(ip+4, ip+4-offset_2, iend) + 4; - offset = offset_2; offset_2 = offset_1; offset_1 = (U32)offset; /* swap repcodes */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, matchLength-MINMATCH); - ip += matchLength; - anchor = ip; - continue; /* faster when present ... (?) */ - } } } - - /* Save reps for next block */ - rep[0] = offset_1 ? offset_1 : savedOffset; - rep[1] = offset_2 ? offset_2 : savedOffset; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - - -size_t ZSTD_compressBlock_btlazy2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_noDict); -} - -size_t ZSTD_compressBlock_lazy2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_noDict); -} - -size_t ZSTD_compressBlock_lazy( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_noDict); -} - -size_t ZSTD_compressBlock_greedy( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_noDict); -} - -size_t ZSTD_compressBlock_btlazy2_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2, ZSTD_dictMatchState); -} - -size_t ZSTD_compressBlock_lazy2_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2, ZSTD_dictMatchState); -} - -size_t ZSTD_compressBlock_lazy_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1, ZSTD_dictMatchState); -} - -size_t ZSTD_compressBlock_greedy_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0, ZSTD_dictMatchState); -} - - -FORCE_INLINE_TEMPLATE -size_t ZSTD_compressBlock_lazy_extDict_generic( - ZSTD_matchState_t* ms, seqStore_t* seqStore, - U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize, - const searchMethod_e searchMethod, const U32 depth) -{ - const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; - const BYTE* anchor = istart; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - 8; - const BYTE* const base = ms->window.base; - const U32 dictLimit = ms->window.dictLimit; - const U32 lowestIndex = ms->window.lowLimit; - const BYTE* const prefixStart = base + dictLimit; - const BYTE* const dictBase = ms->window.dictBase; - const BYTE* const dictEnd = dictBase + dictLimit; - const BYTE* const dictStart = dictBase + lowestIndex; - - typedef size_t (*searchMax_f)( - ZSTD_matchState_t* ms, - const BYTE* ip, const BYTE* iLimit, size_t* offsetPtr); - searchMax_f searchMax = searchMethod==search_binaryTree ? ZSTD_BtFindBestMatch_extDict_selectMLS : ZSTD_HcFindBestMatch_extDict_selectMLS; - - U32 offset_1 = rep[0], offset_2 = rep[1]; - - /* init */ - ip += (ip == prefixStart); - - /* Match Loop */ - while (ip < ilimit) { - size_t matchLength=0; - size_t offset=0; - const BYTE* start=ip+1; - U32 current = (U32)(ip-base); - - /* check repCode */ - { const U32 repIndex = (U32)(current+1 - offset_1); - const BYTE* const repBase = repIndex < dictLimit ? dictBase : base; - const BYTE* const repMatch = repBase + repIndex; - if (((U32)((dictLimit-1) - repIndex) >= 3) & (repIndex > lowestIndex)) /* intentional overflow */ - if (MEM_read32(ip+1) == MEM_read32(repMatch)) { - /* repcode detected we should take it */ - const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend; - matchLength = ZSTD_count_2segments(ip+1+4, repMatch+4, iend, repEnd, prefixStart) + 4; - if (depth==0) goto _storeSequence; - } } - - /* first search (depth 0) */ - { size_t offsetFound = 999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offsetFound); - if (ml2 > matchLength) - matchLength = ml2, start = ip, offset=offsetFound; - } - - if (matchLength < 4) { - ip += ((ip-anchor) >> kSearchStrength) + 1; /* jump faster over incompressible sections */ - continue; - } - - /* let's try to find a better solution */ - if (depth>=1) - while (ip= 3) & (repIndex > lowestIndex)) /* intentional overflow */ - if (MEM_read32(ip) == MEM_read32(repMatch)) { - /* repcode detected */ - const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend; - size_t const repLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd, prefixStart) + 4; - int const gain2 = (int)(repLength * 3); - int const gain1 = (int)(matchLength*3 - ZSTD_highbit32((U32)offset+1) + 1); - if ((repLength >= 4) && (gain2 > gain1)) - matchLength = repLength, offset = 0, start = ip; - } } - - /* search match, depth 1 */ - { size_t offset2=999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offset2); - int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 4); - if ((ml2 >= 4) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; - continue; /* search a better one */ - } } - - /* let's find an even better one */ - if ((depth==2) && (ip= 3) & (repIndex > lowestIndex)) /* intentional overflow */ - if (MEM_read32(ip) == MEM_read32(repMatch)) { - /* repcode detected */ - const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend; - size_t const repLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd, prefixStart) + 4; - int const gain2 = (int)(repLength * 4); - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 1); - if ((repLength >= 4) && (gain2 > gain1)) - matchLength = repLength, offset = 0, start = ip; - } } - - /* search match, depth 2 */ - { size_t offset2=999999999; - size_t const ml2 = searchMax(ms, ip, iend, &offset2); - int const gain2 = (int)(ml2*4 - ZSTD_highbit32((U32)offset2+1)); /* raw approx */ - int const gain1 = (int)(matchLength*4 - ZSTD_highbit32((U32)offset+1) + 7); - if ((ml2 >= 4) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; - continue; - } } } - break; /* nothing found : store previous solution */ - } - - /* catch up */ - if (offset) { - U32 const matchIndex = (U32)((start-base) - (offset - ZSTD_REP_MOVE)); - const BYTE* match = (matchIndex < dictLimit) ? dictBase + matchIndex : base + matchIndex; - const BYTE* const mStart = (matchIndex < dictLimit) ? dictStart : prefixStart; - while ((start>anchor) && (match>mStart) && (start[-1] == match[-1])) { start--; match--; matchLength++; } /* catch up */ - offset_2 = offset_1; offset_1 = (U32)(offset - ZSTD_REP_MOVE); - } - - /* store sequence */ -_storeSequence: - { size_t const litLength = start - anchor; - ZSTD_storeSeq(seqStore, litLength, anchor, iend, (U32)offset, matchLength-MINMATCH); - anchor = ip = start + matchLength; - } - - /* check immediate repcode */ - while (ip <= ilimit) { - const U32 repIndex = (U32)((ip-base) - offset_2); - const BYTE* const repBase = repIndex < dictLimit ? dictBase : base; - const BYTE* const repMatch = repBase + repIndex; - if (((U32)((dictLimit-1) - repIndex) >= 3) & (repIndex > lowestIndex)) /* intentional overflow */ - if (MEM_read32(ip) == MEM_read32(repMatch)) { - /* repcode detected we should take it */ - const BYTE* const repEnd = repIndex < dictLimit ? dictEnd : iend; - matchLength = ZSTD_count_2segments(ip+4, repMatch+4, iend, repEnd, prefixStart) + 4; - offset = offset_2; offset_2 = offset_1; offset_1 = (U32)offset; /* swap offset history */ - ZSTD_storeSeq(seqStore, 0, anchor, iend, 0, matchLength-MINMATCH); - ip += matchLength; - anchor = ip; - continue; /* faster when present ... (?) */ - } - break; - } } - - /* Save reps for next block */ - rep[0] = offset_1; - rep[1] = offset_2; - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - - -size_t ZSTD_compressBlock_greedy_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 0); -} - -size_t ZSTD_compressBlock_lazy_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) - -{ - return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 1); -} - -size_t ZSTD_compressBlock_lazy2_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) - -{ - return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_hashChain, 2); -} - -size_t ZSTD_compressBlock_btlazy2_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) - -{ - return ZSTD_compressBlock_lazy_extDict_generic(ms, seqStore, rep, src, srcSize, search_binaryTree, 2); -} diff --git a/vendor/github.com/DataDog/zstd/zstd_lazy.h b/vendor/github.com/DataDog/zstd/zstd_lazy.h deleted file mode 100644 index bb176306..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_lazy.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_LAZY_H -#define ZSTD_LAZY_H - -#if defined (__cplusplus) -extern "C" { -#endif - -#include "zstd_compress_internal.h" - -U32 ZSTD_insertAndFindFirstIndex(ZSTD_matchState_t* ms, const BYTE* ip); - -void ZSTD_preserveUnsortedMark (U32* const table, U32 const size, U32 const reducerValue); /*! used in ZSTD_reduceIndex(). preemptively increase value of ZSTD_DUBT_UNSORTED_MARK */ - -size_t ZSTD_compressBlock_btlazy2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_greedy( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - -size_t ZSTD_compressBlock_btlazy2_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy2_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_greedy_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - -size_t ZSTD_compressBlock_greedy_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_lazy2_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_btlazy2_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_LAZY_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_ldm.c b/vendor/github.com/DataDog/zstd/zstd_ldm.c deleted file mode 100644 index c3312ad3..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_ldm.c +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - */ - -#include "zstd_ldm.h" - -#include "debug.h" -#include "zstd_fast.h" /* ZSTD_fillHashTable() */ -#include "zstd_double_fast.h" /* ZSTD_fillDoubleHashTable() */ - -#define LDM_BUCKET_SIZE_LOG 3 -#define LDM_MIN_MATCH_LENGTH 64 -#define LDM_HASH_RLOG 7 -#define LDM_HASH_CHAR_OFFSET 10 - -void ZSTD_ldm_adjustParameters(ldmParams_t* params, - ZSTD_compressionParameters const* cParams) -{ - params->windowLog = cParams->windowLog; - ZSTD_STATIC_ASSERT(LDM_BUCKET_SIZE_LOG <= ZSTD_LDM_BUCKETSIZELOG_MAX); - DEBUGLOG(4, "ZSTD_ldm_adjustParameters"); - if (!params->bucketSizeLog) params->bucketSizeLog = LDM_BUCKET_SIZE_LOG; - if (!params->minMatchLength) params->minMatchLength = LDM_MIN_MATCH_LENGTH; - if (cParams->strategy >= ZSTD_btopt) { - /* Get out of the way of the optimal parser */ - U32 const minMatch = MAX(cParams->targetLength, params->minMatchLength); - assert(minMatch >= ZSTD_LDM_MINMATCH_MIN); - assert(minMatch <= ZSTD_LDM_MINMATCH_MAX); - params->minMatchLength = minMatch; - } - if (params->hashLog == 0) { - params->hashLog = MAX(ZSTD_HASHLOG_MIN, params->windowLog - LDM_HASH_RLOG); - assert(params->hashLog <= ZSTD_HASHLOG_MAX); - } - if (params->hashRateLog == 0) { - params->hashRateLog = params->windowLog < params->hashLog - ? 0 - : params->windowLog - params->hashLog; - } - params->bucketSizeLog = MIN(params->bucketSizeLog, params->hashLog); -} - -size_t ZSTD_ldm_getTableSize(ldmParams_t params) -{ - size_t const ldmHSize = ((size_t)1) << params.hashLog; - size_t const ldmBucketSizeLog = MIN(params.bucketSizeLog, params.hashLog); - size_t const ldmBucketSize = ((size_t)1) << (params.hashLog - ldmBucketSizeLog); - size_t const totalSize = ZSTD_cwksp_alloc_size(ldmBucketSize) - + ZSTD_cwksp_alloc_size(ldmHSize * sizeof(ldmEntry_t)); - return params.enableLdm ? totalSize : 0; -} - -size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize) -{ - return params.enableLdm ? (maxChunkSize / params.minMatchLength) : 0; -} - -/** ZSTD_ldm_getSmallHash() : - * numBits should be <= 32 - * If numBits==0, returns 0. - * @return : the most significant numBits of value. */ -static U32 ZSTD_ldm_getSmallHash(U64 value, U32 numBits) -{ - assert(numBits <= 32); - return numBits == 0 ? 0 : (U32)(value >> (64 - numBits)); -} - -/** ZSTD_ldm_getChecksum() : - * numBitsToDiscard should be <= 32 - * @return : the next most significant 32 bits after numBitsToDiscard */ -static U32 ZSTD_ldm_getChecksum(U64 hash, U32 numBitsToDiscard) -{ - assert(numBitsToDiscard <= 32); - return (hash >> (64 - 32 - numBitsToDiscard)) & 0xFFFFFFFF; -} - -/** ZSTD_ldm_getTag() ; - * Given the hash, returns the most significant numTagBits bits - * after (32 + hbits) bits. - * - * If there are not enough bits remaining, return the last - * numTagBits bits. */ -static U32 ZSTD_ldm_getTag(U64 hash, U32 hbits, U32 numTagBits) -{ - assert(numTagBits < 32 && hbits <= 32); - if (32 - hbits < numTagBits) { - return hash & (((U32)1 << numTagBits) - 1); - } else { - return (hash >> (32 - hbits - numTagBits)) & (((U32)1 << numTagBits) - 1); - } -} - -/** ZSTD_ldm_getBucket() : - * Returns a pointer to the start of the bucket associated with hash. */ -static ldmEntry_t* ZSTD_ldm_getBucket( - ldmState_t* ldmState, size_t hash, ldmParams_t const ldmParams) -{ - return ldmState->hashTable + (hash << ldmParams.bucketSizeLog); -} - -/** ZSTD_ldm_insertEntry() : - * Insert the entry with corresponding hash into the hash table */ -static void ZSTD_ldm_insertEntry(ldmState_t* ldmState, - size_t const hash, const ldmEntry_t entry, - ldmParams_t const ldmParams) -{ - BYTE* const bucketOffsets = ldmState->bucketOffsets; - *(ZSTD_ldm_getBucket(ldmState, hash, ldmParams) + bucketOffsets[hash]) = entry; - bucketOffsets[hash]++; - bucketOffsets[hash] &= ((U32)1 << ldmParams.bucketSizeLog) - 1; -} - -/** ZSTD_ldm_makeEntryAndInsertByTag() : - * - * Gets the small hash, checksum, and tag from the rollingHash. - * - * If the tag matches (1 << ldmParams.hashRateLog)-1, then - * creates an ldmEntry from the offset, and inserts it into the hash table. - * - * hBits is the length of the small hash, which is the most significant hBits - * of rollingHash. The checksum is the next 32 most significant bits, followed - * by ldmParams.hashRateLog bits that make up the tag. */ -static void ZSTD_ldm_makeEntryAndInsertByTag(ldmState_t* ldmState, - U64 const rollingHash, - U32 const hBits, - U32 const offset, - ldmParams_t const ldmParams) -{ - U32 const tag = ZSTD_ldm_getTag(rollingHash, hBits, ldmParams.hashRateLog); - U32 const tagMask = ((U32)1 << ldmParams.hashRateLog) - 1; - if (tag == tagMask) { - U32 const hash = ZSTD_ldm_getSmallHash(rollingHash, hBits); - U32 const checksum = ZSTD_ldm_getChecksum(rollingHash, hBits); - ldmEntry_t entry; - entry.offset = offset; - entry.checksum = checksum; - ZSTD_ldm_insertEntry(ldmState, hash, entry, ldmParams); - } -} - -/** ZSTD_ldm_countBackwardsMatch() : - * Returns the number of bytes that match backwards before pIn and pMatch. - * - * We count only bytes where pMatch >= pBase and pIn >= pAnchor. */ -static size_t ZSTD_ldm_countBackwardsMatch( - const BYTE* pIn, const BYTE* pAnchor, - const BYTE* pMatch, const BYTE* pBase) -{ - size_t matchLength = 0; - while (pIn > pAnchor && pMatch > pBase && pIn[-1] == pMatch[-1]) { - pIn--; - pMatch--; - matchLength++; - } - return matchLength; -} - -/** ZSTD_ldm_fillFastTables() : - * - * Fills the relevant tables for the ZSTD_fast and ZSTD_dfast strategies. - * This is similar to ZSTD_loadDictionaryContent. - * - * The tables for the other strategies are filled within their - * block compressors. */ -static size_t ZSTD_ldm_fillFastTables(ZSTD_matchState_t* ms, - void const* end) -{ - const BYTE* const iend = (const BYTE*)end; - - switch(ms->cParams.strategy) - { - case ZSTD_fast: - ZSTD_fillHashTable(ms, iend, ZSTD_dtlm_fast); - break; - - case ZSTD_dfast: - ZSTD_fillDoubleHashTable(ms, iend, ZSTD_dtlm_fast); - break; - - case ZSTD_greedy: - case ZSTD_lazy: - case ZSTD_lazy2: - case ZSTD_btlazy2: - case ZSTD_btopt: - case ZSTD_btultra: - case ZSTD_btultra2: - break; - default: - assert(0); /* not possible : not a valid strategy id */ - } - - return 0; -} - -/** ZSTD_ldm_fillLdmHashTable() : - * - * Fills hashTable from (lastHashed + 1) to iend (non-inclusive). - * lastHash is the rolling hash that corresponds to lastHashed. - * - * Returns the rolling hash corresponding to position iend-1. */ -static U64 ZSTD_ldm_fillLdmHashTable(ldmState_t* state, - U64 lastHash, const BYTE* lastHashed, - const BYTE* iend, const BYTE* base, - U32 hBits, ldmParams_t const ldmParams) -{ - U64 rollingHash = lastHash; - const BYTE* cur = lastHashed + 1; - - while (cur < iend) { - rollingHash = ZSTD_rollingHash_rotate(rollingHash, cur[-1], - cur[ldmParams.minMatchLength-1], - state->hashPower); - ZSTD_ldm_makeEntryAndInsertByTag(state, - rollingHash, hBits, - (U32)(cur - base), ldmParams); - ++cur; - } - return rollingHash; -} - - -/** ZSTD_ldm_limitTableUpdate() : - * - * Sets cctx->nextToUpdate to a position corresponding closer to anchor - * if it is far way - * (after a long match, only update tables a limited amount). */ -static void ZSTD_ldm_limitTableUpdate(ZSTD_matchState_t* ms, const BYTE* anchor) -{ - U32 const current = (U32)(anchor - ms->window.base); - if (current > ms->nextToUpdate + 1024) { - ms->nextToUpdate = - current - MIN(512, current - ms->nextToUpdate - 1024); - } -} - -static size_t ZSTD_ldm_generateSequences_internal( - ldmState_t* ldmState, rawSeqStore_t* rawSeqStore, - ldmParams_t const* params, void const* src, size_t srcSize) -{ - /* LDM parameters */ - int const extDict = ZSTD_window_hasExtDict(ldmState->window); - U32 const minMatchLength = params->minMatchLength; - U64 const hashPower = ldmState->hashPower; - U32 const hBits = params->hashLog - params->bucketSizeLog; - U32 const ldmBucketSize = 1U << params->bucketSizeLog; - U32 const hashRateLog = params->hashRateLog; - U32 const ldmTagMask = (1U << params->hashRateLog) - 1; - /* Prefix and extDict parameters */ - U32 const dictLimit = ldmState->window.dictLimit; - U32 const lowestIndex = extDict ? ldmState->window.lowLimit : dictLimit; - BYTE const* const base = ldmState->window.base; - BYTE const* const dictBase = extDict ? ldmState->window.dictBase : NULL; - BYTE const* const dictStart = extDict ? dictBase + lowestIndex : NULL; - BYTE const* const dictEnd = extDict ? dictBase + dictLimit : NULL; - BYTE const* const lowPrefixPtr = base + dictLimit; - /* Input bounds */ - BYTE const* const istart = (BYTE const*)src; - BYTE const* const iend = istart + srcSize; - BYTE const* const ilimit = iend - MAX(minMatchLength, HASH_READ_SIZE); - /* Input positions */ - BYTE const* anchor = istart; - BYTE const* ip = istart; - /* Rolling hash */ - BYTE const* lastHashed = NULL; - U64 rollingHash = 0; - - while (ip <= ilimit) { - size_t mLength; - U32 const current = (U32)(ip - base); - size_t forwardMatchLength = 0, backwardMatchLength = 0; - ldmEntry_t* bestEntry = NULL; - if (ip != istart) { - rollingHash = ZSTD_rollingHash_rotate(rollingHash, lastHashed[0], - lastHashed[minMatchLength], - hashPower); - } else { - rollingHash = ZSTD_rollingHash_compute(ip, minMatchLength); - } - lastHashed = ip; - - /* Do not insert and do not look for a match */ - if (ZSTD_ldm_getTag(rollingHash, hBits, hashRateLog) != ldmTagMask) { - ip++; - continue; - } - - /* Get the best entry and compute the match lengths */ - { - ldmEntry_t* const bucket = - ZSTD_ldm_getBucket(ldmState, - ZSTD_ldm_getSmallHash(rollingHash, hBits), - *params); - ldmEntry_t* cur; - size_t bestMatchLength = 0; - U32 const checksum = ZSTD_ldm_getChecksum(rollingHash, hBits); - - for (cur = bucket; cur < bucket + ldmBucketSize; ++cur) { - size_t curForwardMatchLength, curBackwardMatchLength, - curTotalMatchLength; - if (cur->checksum != checksum || cur->offset <= lowestIndex) { - continue; - } - if (extDict) { - BYTE const* const curMatchBase = - cur->offset < dictLimit ? dictBase : base; - BYTE const* const pMatch = curMatchBase + cur->offset; - BYTE const* const matchEnd = - cur->offset < dictLimit ? dictEnd : iend; - BYTE const* const lowMatchPtr = - cur->offset < dictLimit ? dictStart : lowPrefixPtr; - - curForwardMatchLength = ZSTD_count_2segments( - ip, pMatch, iend, - matchEnd, lowPrefixPtr); - if (curForwardMatchLength < minMatchLength) { - continue; - } - curBackwardMatchLength = - ZSTD_ldm_countBackwardsMatch(ip, anchor, pMatch, - lowMatchPtr); - curTotalMatchLength = curForwardMatchLength + - curBackwardMatchLength; - } else { /* !extDict */ - BYTE const* const pMatch = base + cur->offset; - curForwardMatchLength = ZSTD_count(ip, pMatch, iend); - if (curForwardMatchLength < minMatchLength) { - continue; - } - curBackwardMatchLength = - ZSTD_ldm_countBackwardsMatch(ip, anchor, pMatch, - lowPrefixPtr); - curTotalMatchLength = curForwardMatchLength + - curBackwardMatchLength; - } - - if (curTotalMatchLength > bestMatchLength) { - bestMatchLength = curTotalMatchLength; - forwardMatchLength = curForwardMatchLength; - backwardMatchLength = curBackwardMatchLength; - bestEntry = cur; - } - } - } - - /* No match found -- continue searching */ - if (bestEntry == NULL) { - ZSTD_ldm_makeEntryAndInsertByTag(ldmState, rollingHash, - hBits, current, - *params); - ip++; - continue; - } - - /* Match found */ - mLength = forwardMatchLength + backwardMatchLength; - ip -= backwardMatchLength; - - { - /* Store the sequence: - * ip = current - backwardMatchLength - * The match is at (bestEntry->offset - backwardMatchLength) - */ - U32 const matchIndex = bestEntry->offset; - U32 const offset = current - matchIndex; - rawSeq* const seq = rawSeqStore->seq + rawSeqStore->size; - - /* Out of sequence storage */ - if (rawSeqStore->size == rawSeqStore->capacity) - return ERROR(dstSize_tooSmall); - seq->litLength = (U32)(ip - anchor); - seq->matchLength = (U32)mLength; - seq->offset = offset; - rawSeqStore->size++; - } - - /* Insert the current entry into the hash table */ - ZSTD_ldm_makeEntryAndInsertByTag(ldmState, rollingHash, hBits, - (U32)(lastHashed - base), - *params); - - assert(ip + backwardMatchLength == lastHashed); - - /* Fill the hash table from lastHashed+1 to ip+mLength*/ - /* Heuristic: don't need to fill the entire table at end of block */ - if (ip + mLength <= ilimit) { - rollingHash = ZSTD_ldm_fillLdmHashTable( - ldmState, rollingHash, lastHashed, - ip + mLength, base, hBits, *params); - lastHashed = ip + mLength - 1; - } - ip += mLength; - anchor = ip; - } - return iend - anchor; -} - -/*! ZSTD_ldm_reduceTable() : - * reduce table indexes by `reducerValue` */ -static void ZSTD_ldm_reduceTable(ldmEntry_t* const table, U32 const size, - U32 const reducerValue) -{ - U32 u; - for (u = 0; u < size; u++) { - if (table[u].offset < reducerValue) table[u].offset = 0; - else table[u].offset -= reducerValue; - } -} - -size_t ZSTD_ldm_generateSequences( - ldmState_t* ldmState, rawSeqStore_t* sequences, - ldmParams_t const* params, void const* src, size_t srcSize) -{ - U32 const maxDist = 1U << params->windowLog; - BYTE const* const istart = (BYTE const*)src; - BYTE const* const iend = istart + srcSize; - size_t const kMaxChunkSize = 1 << 20; - size_t const nbChunks = (srcSize / kMaxChunkSize) + ((srcSize % kMaxChunkSize) != 0); - size_t chunk; - size_t leftoverSize = 0; - - assert(ZSTD_CHUNKSIZE_MAX >= kMaxChunkSize); - /* Check that ZSTD_window_update() has been called for this chunk prior - * to passing it to this function. - */ - assert(ldmState->window.nextSrc >= (BYTE const*)src + srcSize); - /* The input could be very large (in zstdmt), so it must be broken up into - * chunks to enforce the maximum distance and handle overflow correction. - */ - assert(sequences->pos <= sequences->size); - assert(sequences->size <= sequences->capacity); - for (chunk = 0; chunk < nbChunks && sequences->size < sequences->capacity; ++chunk) { - BYTE const* const chunkStart = istart + chunk * kMaxChunkSize; - size_t const remaining = (size_t)(iend - chunkStart); - BYTE const *const chunkEnd = - (remaining < kMaxChunkSize) ? iend : chunkStart + kMaxChunkSize; - size_t const chunkSize = chunkEnd - chunkStart; - size_t newLeftoverSize; - size_t const prevSize = sequences->size; - - assert(chunkStart < iend); - /* 1. Perform overflow correction if necessary. */ - if (ZSTD_window_needOverflowCorrection(ldmState->window, chunkEnd)) { - U32 const ldmHSize = 1U << params->hashLog; - U32 const correction = ZSTD_window_correctOverflow( - &ldmState->window, /* cycleLog */ 0, maxDist, chunkStart); - ZSTD_ldm_reduceTable(ldmState->hashTable, ldmHSize, correction); - } - /* 2. We enforce the maximum offset allowed. - * - * kMaxChunkSize should be small enough that we don't lose too much of - * the window through early invalidation. - * TODO: * Test the chunk size. - * * Try invalidation after the sequence generation and test the - * the offset against maxDist directly. - */ - ZSTD_window_enforceMaxDist(&ldmState->window, chunkEnd, maxDist, NULL, NULL); - /* 3. Generate the sequences for the chunk, and get newLeftoverSize. */ - newLeftoverSize = ZSTD_ldm_generateSequences_internal( - ldmState, sequences, params, chunkStart, chunkSize); - if (ZSTD_isError(newLeftoverSize)) - return newLeftoverSize; - /* 4. We add the leftover literals from previous iterations to the first - * newly generated sequence, or add the `newLeftoverSize` if none are - * generated. - */ - /* Prepend the leftover literals from the last call */ - if (prevSize < sequences->size) { - sequences->seq[prevSize].litLength += (U32)leftoverSize; - leftoverSize = newLeftoverSize; - } else { - assert(newLeftoverSize == chunkSize); - leftoverSize += chunkSize; - } - } - return 0; -} - -void ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize, U32 const minMatch) { - while (srcSize > 0 && rawSeqStore->pos < rawSeqStore->size) { - rawSeq* seq = rawSeqStore->seq + rawSeqStore->pos; - if (srcSize <= seq->litLength) { - /* Skip past srcSize literals */ - seq->litLength -= (U32)srcSize; - return; - } - srcSize -= seq->litLength; - seq->litLength = 0; - if (srcSize < seq->matchLength) { - /* Skip past the first srcSize of the match */ - seq->matchLength -= (U32)srcSize; - if (seq->matchLength < minMatch) { - /* The match is too short, omit it */ - if (rawSeqStore->pos + 1 < rawSeqStore->size) { - seq[1].litLength += seq[0].matchLength; - } - rawSeqStore->pos++; - } - return; - } - srcSize -= seq->matchLength; - seq->matchLength = 0; - rawSeqStore->pos++; - } -} - -/** - * If the sequence length is longer than remaining then the sequence is split - * between this block and the next. - * - * Returns the current sequence to handle, or if the rest of the block should - * be literals, it returns a sequence with offset == 0. - */ -static rawSeq maybeSplitSequence(rawSeqStore_t* rawSeqStore, - U32 const remaining, U32 const minMatch) -{ - rawSeq sequence = rawSeqStore->seq[rawSeqStore->pos]; - assert(sequence.offset > 0); - /* Likely: No partial sequence */ - if (remaining >= sequence.litLength + sequence.matchLength) { - rawSeqStore->pos++; - return sequence; - } - /* Cut the sequence short (offset == 0 ==> rest is literals). */ - if (remaining <= sequence.litLength) { - sequence.offset = 0; - } else if (remaining < sequence.litLength + sequence.matchLength) { - sequence.matchLength = remaining - sequence.litLength; - if (sequence.matchLength < minMatch) { - sequence.offset = 0; - } - } - /* Skip past `remaining` bytes for the future sequences. */ - ZSTD_ldm_skipSequences(rawSeqStore, remaining, minMatch); - return sequence; -} - -size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - unsigned const minMatch = cParams->minMatch; - ZSTD_blockCompressor const blockCompressor = - ZSTD_selectBlockCompressor(cParams->strategy, ZSTD_matchState_dictMode(ms)); - /* Input bounds */ - BYTE const* const istart = (BYTE const*)src; - BYTE const* const iend = istart + srcSize; - /* Input positions */ - BYTE const* ip = istart; - - DEBUGLOG(5, "ZSTD_ldm_blockCompress: srcSize=%zu", srcSize); - assert(rawSeqStore->pos <= rawSeqStore->size); - assert(rawSeqStore->size <= rawSeqStore->capacity); - /* Loop through each sequence and apply the block compressor to the lits */ - while (rawSeqStore->pos < rawSeqStore->size && ip < iend) { - /* maybeSplitSequence updates rawSeqStore->pos */ - rawSeq const sequence = maybeSplitSequence(rawSeqStore, - (U32)(iend - ip), minMatch); - int i; - /* End signal */ - if (sequence.offset == 0) - break; - - assert(sequence.offset <= (1U << cParams->windowLog)); - assert(ip + sequence.litLength + sequence.matchLength <= iend); - - /* Fill tables for block compressor */ - ZSTD_ldm_limitTableUpdate(ms, ip); - ZSTD_ldm_fillFastTables(ms, ip); - /* Run the block compressor */ - DEBUGLOG(5, "calling block compressor on segment of size %u", sequence.litLength); - { - size_t const newLitLength = - blockCompressor(ms, seqStore, rep, ip, sequence.litLength); - ip += sequence.litLength; - /* Update the repcodes */ - for (i = ZSTD_REP_NUM - 1; i > 0; i--) - rep[i] = rep[i-1]; - rep[0] = sequence.offset; - /* Store the sequence */ - ZSTD_storeSeq(seqStore, newLitLength, ip - newLitLength, iend, - sequence.offset + ZSTD_REP_MOVE, - sequence.matchLength - MINMATCH); - ip += sequence.matchLength; - } - } - /* Fill the tables for the block compressor */ - ZSTD_ldm_limitTableUpdate(ms, ip); - ZSTD_ldm_fillFastTables(ms, ip); - /* Compress the last literals */ - return blockCompressor(ms, seqStore, rep, ip, iend - ip); -} diff --git a/vendor/github.com/DataDog/zstd/zstd_ldm.h b/vendor/github.com/DataDog/zstd/zstd_ldm.h deleted file mode 100644 index a4784612..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_ldm.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - */ - -#ifndef ZSTD_LDM_H -#define ZSTD_LDM_H - -#if defined (__cplusplus) -extern "C" { -#endif - -#include "zstd_compress_internal.h" /* ldmParams_t, U32 */ -#include "zstd.h" /* ZSTD_CCtx, size_t */ - -/*-************************************* -* Long distance matching -***************************************/ - -#define ZSTD_LDM_DEFAULT_WINDOW_LOG ZSTD_WINDOWLOG_LIMIT_DEFAULT - -/** - * ZSTD_ldm_generateSequences(): - * - * Generates the sequences using the long distance match finder. - * Generates long range matching sequences in `sequences`, which parse a prefix - * of the source. `sequences` must be large enough to store every sequence, - * which can be checked with `ZSTD_ldm_getMaxNbSeq()`. - * @returns 0 or an error code. - * - * NOTE: The user must have called ZSTD_window_update() for all of the input - * they have, even if they pass it to ZSTD_ldm_generateSequences() in chunks. - * NOTE: This function returns an error if it runs out of space to store - * sequences. - */ -size_t ZSTD_ldm_generateSequences( - ldmState_t* ldms, rawSeqStore_t* sequences, - ldmParams_t const* params, void const* src, size_t srcSize); - -/** - * ZSTD_ldm_blockCompress(): - * - * Compresses a block using the predefined sequences, along with a secondary - * block compressor. The literals section of every sequence is passed to the - * secondary block compressor, and those sequences are interspersed with the - * predefined sequences. Returns the length of the last literals. - * Updates `rawSeqStore.pos` to indicate how many sequences have been consumed. - * `rawSeqStore.seq` may also be updated to split the last sequence between two - * blocks. - * @return The length of the last literals. - * - * NOTE: The source must be at most the maximum block size, but the predefined - * sequences can be any size, and may be longer than the block. In the case that - * they are longer than the block, the last sequences may need to be split into - * two. We handle that case correctly, and update `rawSeqStore` appropriately. - * NOTE: This function does not return any errors. - */ -size_t ZSTD_ldm_blockCompress(rawSeqStore_t* rawSeqStore, - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - -/** - * ZSTD_ldm_skipSequences(): - * - * Skip past `srcSize` bytes worth of sequences in `rawSeqStore`. - * Avoids emitting matches less than `minMatch` bytes. - * Must be called for data with is not passed to ZSTD_ldm_blockCompress(). - */ -void ZSTD_ldm_skipSequences(rawSeqStore_t* rawSeqStore, size_t srcSize, - U32 const minMatch); - - -/** ZSTD_ldm_getTableSize() : - * Estimate the space needed for long distance matching tables or 0 if LDM is - * disabled. - */ -size_t ZSTD_ldm_getTableSize(ldmParams_t params); - -/** ZSTD_ldm_getSeqSpace() : - * Return an upper bound on the number of sequences that can be produced by - * the long distance matcher, or 0 if LDM is disabled. - */ -size_t ZSTD_ldm_getMaxNbSeq(ldmParams_t params, size_t maxChunkSize); - -/** ZSTD_ldm_adjustParameters() : - * If the params->hashRateLog is not set, set it to its default value based on - * windowLog and params->hashLog. - * - * Ensures that params->bucketSizeLog is <= params->hashLog (setting it to - * params->hashLog if it is not). - * - * Ensures that the minMatchLength >= targetLength during optimal parsing. - */ -void ZSTD_ldm_adjustParameters(ldmParams_t* params, - ZSTD_compressionParameters const* cParams); - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_FAST_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_legacy.h b/vendor/github.com/DataDog/zstd/zstd_legacy.h deleted file mode 100644 index 0dbd3c7a..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_legacy.h +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_LEGACY_H -#define ZSTD_LEGACY_H - -#if defined (__cplusplus) -extern "C" { -#endif - -/* ************************************* -* Includes -***************************************/ -#include "mem.h" /* MEM_STATIC */ -#include "error_private.h" /* ERROR */ -#include "zstd_internal.h" /* ZSTD_inBuffer, ZSTD_outBuffer, ZSTD_frameSizeInfo */ - -#if !defined (ZSTD_LEGACY_SUPPORT) || (ZSTD_LEGACY_SUPPORT == 0) -# undef ZSTD_LEGACY_SUPPORT -# define ZSTD_LEGACY_SUPPORT 8 -#endif - -#if (ZSTD_LEGACY_SUPPORT <= 1) -# include "zstd_v01.h" -#endif -#if (ZSTD_LEGACY_SUPPORT <= 2) -# include "zstd_v02.h" -#endif -#if (ZSTD_LEGACY_SUPPORT <= 3) -# include "zstd_v03.h" -#endif -#if (ZSTD_LEGACY_SUPPORT <= 4) -# include "zstd_v04.h" -#endif -#if (ZSTD_LEGACY_SUPPORT <= 5) -# include "zstd_v05.h" -#endif -#if (ZSTD_LEGACY_SUPPORT <= 6) -# include "zstd_v06.h" -#endif -#if (ZSTD_LEGACY_SUPPORT <= 7) -# include "zstd_v07.h" -#endif - -/** ZSTD_isLegacy() : - @return : > 0 if supported by legacy decoder. 0 otherwise. - return value is the version. -*/ -MEM_STATIC unsigned ZSTD_isLegacy(const void* src, size_t srcSize) -{ - U32 magicNumberLE; - if (srcSize<4) return 0; - magicNumberLE = MEM_readLE32(src); - switch(magicNumberLE) - { -#if (ZSTD_LEGACY_SUPPORT <= 1) - case ZSTDv01_magicNumberLE:return 1; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 2) - case ZSTDv02_magicNumber : return 2; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 3) - case ZSTDv03_magicNumber : return 3; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 4) - case ZSTDv04_magicNumber : return 4; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 5) - case ZSTDv05_MAGICNUMBER : return 5; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 6) - case ZSTDv06_MAGICNUMBER : return 6; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 7) - case ZSTDv07_MAGICNUMBER : return 7; -#endif - default : return 0; - } -} - - -MEM_STATIC unsigned long long ZSTD_getDecompressedSize_legacy(const void* src, size_t srcSize) -{ - U32 const version = ZSTD_isLegacy(src, srcSize); - if (version < 5) return 0; /* no decompressed size in frame header, or not a legacy format */ -#if (ZSTD_LEGACY_SUPPORT <= 5) - if (version==5) { - ZSTDv05_parameters fParams; - size_t const frResult = ZSTDv05_getFrameParams(&fParams, src, srcSize); - if (frResult != 0) return 0; - return fParams.srcSize; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 6) - if (version==6) { - ZSTDv06_frameParams fParams; - size_t const frResult = ZSTDv06_getFrameParams(&fParams, src, srcSize); - if (frResult != 0) return 0; - return fParams.frameContentSize; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 7) - if (version==7) { - ZSTDv07_frameParams fParams; - size_t const frResult = ZSTDv07_getFrameParams(&fParams, src, srcSize); - if (frResult != 0) return 0; - return fParams.frameContentSize; - } -#endif - return 0; /* should not be possible */ -} - - -MEM_STATIC size_t ZSTD_decompressLegacy( - void* dst, size_t dstCapacity, - const void* src, size_t compressedSize, - const void* dict,size_t dictSize) -{ - U32 const version = ZSTD_isLegacy(src, compressedSize); - (void)dst; (void)dstCapacity; (void)dict; (void)dictSize; /* unused when ZSTD_LEGACY_SUPPORT >= 8 */ - switch(version) - { -#if (ZSTD_LEGACY_SUPPORT <= 1) - case 1 : - return ZSTDv01_decompress(dst, dstCapacity, src, compressedSize); -#endif -#if (ZSTD_LEGACY_SUPPORT <= 2) - case 2 : - return ZSTDv02_decompress(dst, dstCapacity, src, compressedSize); -#endif -#if (ZSTD_LEGACY_SUPPORT <= 3) - case 3 : - return ZSTDv03_decompress(dst, dstCapacity, src, compressedSize); -#endif -#if (ZSTD_LEGACY_SUPPORT <= 4) - case 4 : - return ZSTDv04_decompress(dst, dstCapacity, src, compressedSize); -#endif -#if (ZSTD_LEGACY_SUPPORT <= 5) - case 5 : - { size_t result; - ZSTDv05_DCtx* const zd = ZSTDv05_createDCtx(); - if (zd==NULL) return ERROR(memory_allocation); - result = ZSTDv05_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize); - ZSTDv05_freeDCtx(zd); - return result; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 6) - case 6 : - { size_t result; - ZSTDv06_DCtx* const zd = ZSTDv06_createDCtx(); - if (zd==NULL) return ERROR(memory_allocation); - result = ZSTDv06_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize); - ZSTDv06_freeDCtx(zd); - return result; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 7) - case 7 : - { size_t result; - ZSTDv07_DCtx* const zd = ZSTDv07_createDCtx(); - if (zd==NULL) return ERROR(memory_allocation); - result = ZSTDv07_decompress_usingDict(zd, dst, dstCapacity, src, compressedSize, dict, dictSize); - ZSTDv07_freeDCtx(zd); - return result; - } -#endif - default : - return ERROR(prefix_unknown); - } -} - -MEM_STATIC ZSTD_frameSizeInfo ZSTD_findFrameSizeInfoLegacy(const void *src, size_t srcSize) -{ - ZSTD_frameSizeInfo frameSizeInfo; - U32 const version = ZSTD_isLegacy(src, srcSize); - switch(version) - { -#if (ZSTD_LEGACY_SUPPORT <= 1) - case 1 : - ZSTDv01_findFrameSizeInfoLegacy(src, srcSize, - &frameSizeInfo.compressedSize, - &frameSizeInfo.decompressedBound); - break; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 2) - case 2 : - ZSTDv02_findFrameSizeInfoLegacy(src, srcSize, - &frameSizeInfo.compressedSize, - &frameSizeInfo.decompressedBound); - break; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 3) - case 3 : - ZSTDv03_findFrameSizeInfoLegacy(src, srcSize, - &frameSizeInfo.compressedSize, - &frameSizeInfo.decompressedBound); - break; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 4) - case 4 : - ZSTDv04_findFrameSizeInfoLegacy(src, srcSize, - &frameSizeInfo.compressedSize, - &frameSizeInfo.decompressedBound); - break; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 5) - case 5 : - ZSTDv05_findFrameSizeInfoLegacy(src, srcSize, - &frameSizeInfo.compressedSize, - &frameSizeInfo.decompressedBound); - break; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 6) - case 6 : - ZSTDv06_findFrameSizeInfoLegacy(src, srcSize, - &frameSizeInfo.compressedSize, - &frameSizeInfo.decompressedBound); - break; -#endif -#if (ZSTD_LEGACY_SUPPORT <= 7) - case 7 : - ZSTDv07_findFrameSizeInfoLegacy(src, srcSize, - &frameSizeInfo.compressedSize, - &frameSizeInfo.decompressedBound); - break; -#endif - default : - frameSizeInfo.compressedSize = ERROR(prefix_unknown); - frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR; - break; - } - if (!ZSTD_isError(frameSizeInfo.compressedSize) && frameSizeInfo.compressedSize > srcSize) { - frameSizeInfo.compressedSize = ERROR(srcSize_wrong); - frameSizeInfo.decompressedBound = ZSTD_CONTENTSIZE_ERROR; - } - return frameSizeInfo; -} - -MEM_STATIC size_t ZSTD_findFrameCompressedSizeLegacy(const void *src, size_t srcSize) -{ - ZSTD_frameSizeInfo frameSizeInfo = ZSTD_findFrameSizeInfoLegacy(src, srcSize); - return frameSizeInfo.compressedSize; -} - -MEM_STATIC size_t ZSTD_freeLegacyStreamContext(void* legacyContext, U32 version) -{ - switch(version) - { - default : - case 1 : - case 2 : - case 3 : - (void)legacyContext; - return ERROR(version_unsupported); -#if (ZSTD_LEGACY_SUPPORT <= 4) - case 4 : return ZBUFFv04_freeDCtx((ZBUFFv04_DCtx*)legacyContext); -#endif -#if (ZSTD_LEGACY_SUPPORT <= 5) - case 5 : return ZBUFFv05_freeDCtx((ZBUFFv05_DCtx*)legacyContext); -#endif -#if (ZSTD_LEGACY_SUPPORT <= 6) - case 6 : return ZBUFFv06_freeDCtx((ZBUFFv06_DCtx*)legacyContext); -#endif -#if (ZSTD_LEGACY_SUPPORT <= 7) - case 7 : return ZBUFFv07_freeDCtx((ZBUFFv07_DCtx*)legacyContext); -#endif - } -} - - -MEM_STATIC size_t ZSTD_initLegacyStream(void** legacyContext, U32 prevVersion, U32 newVersion, - const void* dict, size_t dictSize) -{ - DEBUGLOG(5, "ZSTD_initLegacyStream for v0.%u", newVersion); - if (prevVersion != newVersion) ZSTD_freeLegacyStreamContext(*legacyContext, prevVersion); - switch(newVersion) - { - default : - case 1 : - case 2 : - case 3 : - (void)dict; (void)dictSize; - return 0; -#if (ZSTD_LEGACY_SUPPORT <= 4) - case 4 : - { - ZBUFFv04_DCtx* dctx = (prevVersion != newVersion) ? ZBUFFv04_createDCtx() : (ZBUFFv04_DCtx*)*legacyContext; - if (dctx==NULL) return ERROR(memory_allocation); - ZBUFFv04_decompressInit(dctx); - ZBUFFv04_decompressWithDictionary(dctx, dict, dictSize); - *legacyContext = dctx; - return 0; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 5) - case 5 : - { - ZBUFFv05_DCtx* dctx = (prevVersion != newVersion) ? ZBUFFv05_createDCtx() : (ZBUFFv05_DCtx*)*legacyContext; - if (dctx==NULL) return ERROR(memory_allocation); - ZBUFFv05_decompressInitDictionary(dctx, dict, dictSize); - *legacyContext = dctx; - return 0; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 6) - case 6 : - { - ZBUFFv06_DCtx* dctx = (prevVersion != newVersion) ? ZBUFFv06_createDCtx() : (ZBUFFv06_DCtx*)*legacyContext; - if (dctx==NULL) return ERROR(memory_allocation); - ZBUFFv06_decompressInitDictionary(dctx, dict, dictSize); - *legacyContext = dctx; - return 0; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 7) - case 7 : - { - ZBUFFv07_DCtx* dctx = (prevVersion != newVersion) ? ZBUFFv07_createDCtx() : (ZBUFFv07_DCtx*)*legacyContext; - if (dctx==NULL) return ERROR(memory_allocation); - ZBUFFv07_decompressInitDictionary(dctx, dict, dictSize); - *legacyContext = dctx; - return 0; - } -#endif - } -} - - - -MEM_STATIC size_t ZSTD_decompressLegacyStream(void* legacyContext, U32 version, - ZSTD_outBuffer* output, ZSTD_inBuffer* input) -{ - DEBUGLOG(5, "ZSTD_decompressLegacyStream for v0.%u", version); - switch(version) - { - default : - case 1 : - case 2 : - case 3 : - (void)legacyContext; (void)output; (void)input; - return ERROR(version_unsupported); -#if (ZSTD_LEGACY_SUPPORT <= 4) - case 4 : - { - ZBUFFv04_DCtx* dctx = (ZBUFFv04_DCtx*) legacyContext; - const void* src = (const char*)input->src + input->pos; - size_t readSize = input->size - input->pos; - void* dst = (char*)output->dst + output->pos; - size_t decodedSize = output->size - output->pos; - size_t const hintSize = ZBUFFv04_decompressContinue(dctx, dst, &decodedSize, src, &readSize); - output->pos += decodedSize; - input->pos += readSize; - return hintSize; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 5) - case 5 : - { - ZBUFFv05_DCtx* dctx = (ZBUFFv05_DCtx*) legacyContext; - const void* src = (const char*)input->src + input->pos; - size_t readSize = input->size - input->pos; - void* dst = (char*)output->dst + output->pos; - size_t decodedSize = output->size - output->pos; - size_t const hintSize = ZBUFFv05_decompressContinue(dctx, dst, &decodedSize, src, &readSize); - output->pos += decodedSize; - input->pos += readSize; - return hintSize; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 6) - case 6 : - { - ZBUFFv06_DCtx* dctx = (ZBUFFv06_DCtx*) legacyContext; - const void* src = (const char*)input->src + input->pos; - size_t readSize = input->size - input->pos; - void* dst = (char*)output->dst + output->pos; - size_t decodedSize = output->size - output->pos; - size_t const hintSize = ZBUFFv06_decompressContinue(dctx, dst, &decodedSize, src, &readSize); - output->pos += decodedSize; - input->pos += readSize; - return hintSize; - } -#endif -#if (ZSTD_LEGACY_SUPPORT <= 7) - case 7 : - { - ZBUFFv07_DCtx* dctx = (ZBUFFv07_DCtx*) legacyContext; - const void* src = (const char*)input->src + input->pos; - size_t readSize = input->size - input->pos; - void* dst = (char*)output->dst + output->pos; - size_t decodedSize = output->size - output->pos; - size_t const hintSize = ZBUFFv07_decompressContinue(dctx, dst, &decodedSize, src, &readSize); - output->pos += decodedSize; - input->pos += readSize; - return hintSize; - } -#endif - } -} - - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_LEGACY_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_opt.c b/vendor/github.com/DataDog/zstd/zstd_opt.c deleted file mode 100644 index 2e50fca6..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_opt.c +++ /dev/null @@ -1,1246 +0,0 @@ -/* - * Copyright (c) 2016-present, Przemyslaw Skibinski, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#include "zstd_compress_internal.h" -#include "hist.h" -#include "zstd_opt.h" - - -#define ZSTD_LITFREQ_ADD 2 /* scaling factor for litFreq, so that frequencies adapt faster to new stats */ -#define ZSTD_FREQ_DIV 4 /* log factor when using previous stats to init next stats */ -#define ZSTD_MAX_PRICE (1<<30) - -#define ZSTD_PREDEF_THRESHOLD 1024 /* if srcSize < ZSTD_PREDEF_THRESHOLD, symbols' cost is assumed static, directly determined by pre-defined distributions */ - - -/*-************************************* -* Price functions for optimal parser -***************************************/ - -#if 0 /* approximation at bit level */ -# define BITCOST_ACCURACY 0 -# define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY) -# define WEIGHT(stat) ((void)opt, ZSTD_bitWeight(stat)) -#elif 0 /* fractional bit accuracy */ -# define BITCOST_ACCURACY 8 -# define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY) -# define WEIGHT(stat,opt) ((void)opt, ZSTD_fracWeight(stat)) -#else /* opt==approx, ultra==accurate */ -# define BITCOST_ACCURACY 8 -# define BITCOST_MULTIPLIER (1 << BITCOST_ACCURACY) -# define WEIGHT(stat,opt) (opt ? ZSTD_fracWeight(stat) : ZSTD_bitWeight(stat)) -#endif - -MEM_STATIC U32 ZSTD_bitWeight(U32 stat) -{ - return (ZSTD_highbit32(stat+1) * BITCOST_MULTIPLIER); -} - -MEM_STATIC U32 ZSTD_fracWeight(U32 rawStat) -{ - U32 const stat = rawStat + 1; - U32 const hb = ZSTD_highbit32(stat); - U32 const BWeight = hb * BITCOST_MULTIPLIER; - U32 const FWeight = (stat << BITCOST_ACCURACY) >> hb; - U32 const weight = BWeight + FWeight; - assert(hb + BITCOST_ACCURACY < 31); - return weight; -} - -#if (DEBUGLEVEL>=2) -/* debugging function, - * @return price in bytes as fractional value - * for debug messages only */ -MEM_STATIC double ZSTD_fCost(U32 price) -{ - return (double)price / (BITCOST_MULTIPLIER*8); -} -#endif - -static int ZSTD_compressedLiterals(optState_t const* const optPtr) -{ - return optPtr->literalCompressionMode != ZSTD_lcm_uncompressed; -} - -static void ZSTD_setBasePrices(optState_t* optPtr, int optLevel) -{ - if (ZSTD_compressedLiterals(optPtr)) - optPtr->litSumBasePrice = WEIGHT(optPtr->litSum, optLevel); - optPtr->litLengthSumBasePrice = WEIGHT(optPtr->litLengthSum, optLevel); - optPtr->matchLengthSumBasePrice = WEIGHT(optPtr->matchLengthSum, optLevel); - optPtr->offCodeSumBasePrice = WEIGHT(optPtr->offCodeSum, optLevel); -} - - -/* ZSTD_downscaleStat() : - * reduce all elements in table by a factor 2^(ZSTD_FREQ_DIV+malus) - * return the resulting sum of elements */ -static U32 ZSTD_downscaleStat(unsigned* table, U32 lastEltIndex, int malus) -{ - U32 s, sum=0; - DEBUGLOG(5, "ZSTD_downscaleStat (nbElts=%u)", (unsigned)lastEltIndex+1); - assert(ZSTD_FREQ_DIV+malus > 0 && ZSTD_FREQ_DIV+malus < 31); - for (s=0; s> (ZSTD_FREQ_DIV+malus)); - sum += table[s]; - } - return sum; -} - -/* ZSTD_rescaleFreqs() : - * if first block (detected by optPtr->litLengthSum == 0) : init statistics - * take hints from dictionary if there is one - * or init from zero, using src for literals stats, or flat 1 for match symbols - * otherwise downscale existing stats, to be used as seed for next block. - */ -static void -ZSTD_rescaleFreqs(optState_t* const optPtr, - const BYTE* const src, size_t const srcSize, - int const optLevel) -{ - int const compressedLiterals = ZSTD_compressedLiterals(optPtr); - DEBUGLOG(5, "ZSTD_rescaleFreqs (srcSize=%u)", (unsigned)srcSize); - optPtr->priceType = zop_dynamic; - - if (optPtr->litLengthSum == 0) { /* first block : init */ - if (srcSize <= ZSTD_PREDEF_THRESHOLD) { /* heuristic */ - DEBUGLOG(5, "(srcSize <= ZSTD_PREDEF_THRESHOLD) => zop_predef"); - optPtr->priceType = zop_predef; - } - - assert(optPtr->symbolCosts != NULL); - if (optPtr->symbolCosts->huf.repeatMode == HUF_repeat_valid) { - /* huffman table presumed generated by dictionary */ - optPtr->priceType = zop_dynamic; - - if (compressedLiterals) { - unsigned lit; - assert(optPtr->litFreq != NULL); - optPtr->litSum = 0; - for (lit=0; lit<=MaxLit; lit++) { - U32 const scaleLog = 11; /* scale to 2K */ - U32 const bitCost = HUF_getNbBits(optPtr->symbolCosts->huf.CTable, lit); - assert(bitCost <= scaleLog); - optPtr->litFreq[lit] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; - optPtr->litSum += optPtr->litFreq[lit]; - } } - - { unsigned ll; - FSE_CState_t llstate; - FSE_initCState(&llstate, optPtr->symbolCosts->fse.litlengthCTable); - optPtr->litLengthSum = 0; - for (ll=0; ll<=MaxLL; ll++) { - U32 const scaleLog = 10; /* scale to 1K */ - U32 const bitCost = FSE_getMaxNbBits(llstate.symbolTT, ll); - assert(bitCost < scaleLog); - optPtr->litLengthFreq[ll] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; - optPtr->litLengthSum += optPtr->litLengthFreq[ll]; - } } - - { unsigned ml; - FSE_CState_t mlstate; - FSE_initCState(&mlstate, optPtr->symbolCosts->fse.matchlengthCTable); - optPtr->matchLengthSum = 0; - for (ml=0; ml<=MaxML; ml++) { - U32 const scaleLog = 10; - U32 const bitCost = FSE_getMaxNbBits(mlstate.symbolTT, ml); - assert(bitCost < scaleLog); - optPtr->matchLengthFreq[ml] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; - optPtr->matchLengthSum += optPtr->matchLengthFreq[ml]; - } } - - { unsigned of; - FSE_CState_t ofstate; - FSE_initCState(&ofstate, optPtr->symbolCosts->fse.offcodeCTable); - optPtr->offCodeSum = 0; - for (of=0; of<=MaxOff; of++) { - U32 const scaleLog = 10; - U32 const bitCost = FSE_getMaxNbBits(ofstate.symbolTT, of); - assert(bitCost < scaleLog); - optPtr->offCodeFreq[of] = bitCost ? 1 << (scaleLog-bitCost) : 1 /*minimum to calculate cost*/; - optPtr->offCodeSum += optPtr->offCodeFreq[of]; - } } - - } else { /* not a dictionary */ - - assert(optPtr->litFreq != NULL); - if (compressedLiterals) { - unsigned lit = MaxLit; - HIST_count_simple(optPtr->litFreq, &lit, src, srcSize); /* use raw first block to init statistics */ - optPtr->litSum = ZSTD_downscaleStat(optPtr->litFreq, MaxLit, 1); - } - - { unsigned ll; - for (ll=0; ll<=MaxLL; ll++) - optPtr->litLengthFreq[ll] = 1; - } - optPtr->litLengthSum = MaxLL+1; - - { unsigned ml; - for (ml=0; ml<=MaxML; ml++) - optPtr->matchLengthFreq[ml] = 1; - } - optPtr->matchLengthSum = MaxML+1; - - { unsigned of; - for (of=0; of<=MaxOff; of++) - optPtr->offCodeFreq[of] = 1; - } - optPtr->offCodeSum = MaxOff+1; - - } - - } else { /* new block : re-use previous statistics, scaled down */ - - if (compressedLiterals) - optPtr->litSum = ZSTD_downscaleStat(optPtr->litFreq, MaxLit, 1); - optPtr->litLengthSum = ZSTD_downscaleStat(optPtr->litLengthFreq, MaxLL, 0); - optPtr->matchLengthSum = ZSTD_downscaleStat(optPtr->matchLengthFreq, MaxML, 0); - optPtr->offCodeSum = ZSTD_downscaleStat(optPtr->offCodeFreq, MaxOff, 0); - } - - ZSTD_setBasePrices(optPtr, optLevel); -} - -/* ZSTD_rawLiteralsCost() : - * price of literals (only) in specified segment (which length can be 0). - * does not include price of literalLength symbol */ -static U32 ZSTD_rawLiteralsCost(const BYTE* const literals, U32 const litLength, - const optState_t* const optPtr, - int optLevel) -{ - if (litLength == 0) return 0; - - if (!ZSTD_compressedLiterals(optPtr)) - return (litLength << 3) * BITCOST_MULTIPLIER; /* Uncompressed - 8 bytes per literal. */ - - if (optPtr->priceType == zop_predef) - return (litLength*6) * BITCOST_MULTIPLIER; /* 6 bit per literal - no statistic used */ - - /* dynamic statistics */ - { U32 price = litLength * optPtr->litSumBasePrice; - U32 u; - for (u=0; u < litLength; u++) { - assert(WEIGHT(optPtr->litFreq[literals[u]], optLevel) <= optPtr->litSumBasePrice); /* literal cost should never be negative */ - price -= WEIGHT(optPtr->litFreq[literals[u]], optLevel); - } - return price; - } -} - -/* ZSTD_litLengthPrice() : - * cost of literalLength symbol */ -static U32 ZSTD_litLengthPrice(U32 const litLength, const optState_t* const optPtr, int optLevel) -{ - if (optPtr->priceType == zop_predef) return WEIGHT(litLength, optLevel); - - /* dynamic statistics */ - { U32 const llCode = ZSTD_LLcode(litLength); - return (LL_bits[llCode] * BITCOST_MULTIPLIER) - + optPtr->litLengthSumBasePrice - - WEIGHT(optPtr->litLengthFreq[llCode], optLevel); - } -} - -/* ZSTD_litLengthContribution() : - * @return ( cost(litlength) - cost(0) ) - * this value can then be added to rawLiteralsCost() - * to provide a cost which is directly comparable to a match ending at same position */ -static int ZSTD_litLengthContribution(U32 const litLength, const optState_t* const optPtr, int optLevel) -{ - if (optPtr->priceType >= zop_predef) return (int)WEIGHT(litLength, optLevel); - - /* dynamic statistics */ - { U32 const llCode = ZSTD_LLcode(litLength); - int const contribution = (int)(LL_bits[llCode] * BITCOST_MULTIPLIER) - + (int)WEIGHT(optPtr->litLengthFreq[0], optLevel) /* note: log2litLengthSum cancel out */ - - (int)WEIGHT(optPtr->litLengthFreq[llCode], optLevel); -#if 1 - return contribution; -#else - return MAX(0, contribution); /* sometimes better, sometimes not ... */ -#endif - } -} - -/* ZSTD_literalsContribution() : - * creates a fake cost for the literals part of a sequence - * which can be compared to the ending cost of a match - * should a new match start at this position */ -static int ZSTD_literalsContribution(const BYTE* const literals, U32 const litLength, - const optState_t* const optPtr, - int optLevel) -{ - int const contribution = (int)ZSTD_rawLiteralsCost(literals, litLength, optPtr, optLevel) - + ZSTD_litLengthContribution(litLength, optPtr, optLevel); - return contribution; -} - -/* ZSTD_getMatchPrice() : - * Provides the cost of the match part (offset + matchLength) of a sequence - * Must be combined with ZSTD_fullLiteralsCost() to get the full cost of a sequence. - * optLevel: when <2, favors small offset for decompression speed (improved cache efficiency) */ -FORCE_INLINE_TEMPLATE U32 -ZSTD_getMatchPrice(U32 const offset, - U32 const matchLength, - const optState_t* const optPtr, - int const optLevel) -{ - U32 price; - U32 const offCode = ZSTD_highbit32(offset+1); - U32 const mlBase = matchLength - MINMATCH; - assert(matchLength >= MINMATCH); - - if (optPtr->priceType == zop_predef) /* fixed scheme, do not use statistics */ - return WEIGHT(mlBase, optLevel) + ((16 + offCode) * BITCOST_MULTIPLIER); - - /* dynamic statistics */ - price = (offCode * BITCOST_MULTIPLIER) + (optPtr->offCodeSumBasePrice - WEIGHT(optPtr->offCodeFreq[offCode], optLevel)); - if ((optLevel<2) /*static*/ && offCode >= 20) - price += (offCode-19)*2 * BITCOST_MULTIPLIER; /* handicap for long distance offsets, favor decompression speed */ - - /* match Length */ - { U32 const mlCode = ZSTD_MLcode(mlBase); - price += (ML_bits[mlCode] * BITCOST_MULTIPLIER) + (optPtr->matchLengthSumBasePrice - WEIGHT(optPtr->matchLengthFreq[mlCode], optLevel)); - } - - price += BITCOST_MULTIPLIER / 5; /* heuristic : make matches a bit more costly to favor less sequences -> faster decompression speed */ - - DEBUGLOG(8, "ZSTD_getMatchPrice(ml:%u) = %u", matchLength, price); - return price; -} - -/* ZSTD_updateStats() : - * assumption : literals + litLengtn <= iend */ -static void ZSTD_updateStats(optState_t* const optPtr, - U32 litLength, const BYTE* literals, - U32 offsetCode, U32 matchLength) -{ - /* literals */ - if (ZSTD_compressedLiterals(optPtr)) { - U32 u; - for (u=0; u < litLength; u++) - optPtr->litFreq[literals[u]] += ZSTD_LITFREQ_ADD; - optPtr->litSum += litLength*ZSTD_LITFREQ_ADD; - } - - /* literal Length */ - { U32 const llCode = ZSTD_LLcode(litLength); - optPtr->litLengthFreq[llCode]++; - optPtr->litLengthSum++; - } - - /* match offset code (0-2=>repCode; 3+=>offset+2) */ - { U32 const offCode = ZSTD_highbit32(offsetCode+1); - assert(offCode <= MaxOff); - optPtr->offCodeFreq[offCode]++; - optPtr->offCodeSum++; - } - - /* match Length */ - { U32 const mlBase = matchLength - MINMATCH; - U32 const mlCode = ZSTD_MLcode(mlBase); - optPtr->matchLengthFreq[mlCode]++; - optPtr->matchLengthSum++; - } -} - - -/* ZSTD_readMINMATCH() : - * function safe only for comparisons - * assumption : memPtr must be at least 4 bytes before end of buffer */ -MEM_STATIC U32 ZSTD_readMINMATCH(const void* memPtr, U32 length) -{ - switch (length) - { - default : - case 4 : return MEM_read32(memPtr); - case 3 : if (MEM_isLittleEndian()) - return MEM_read32(memPtr)<<8; - else - return MEM_read32(memPtr)>>8; - } -} - - -/* Update hashTable3 up to ip (excluded) - Assumption : always within prefix (i.e. not within extDict) */ -static U32 ZSTD_insertAndFindFirstIndexHash3 (ZSTD_matchState_t* ms, - U32* nextToUpdate3, - const BYTE* const ip) -{ - U32* const hashTable3 = ms->hashTable3; - U32 const hashLog3 = ms->hashLog3; - const BYTE* const base = ms->window.base; - U32 idx = *nextToUpdate3; - U32 const target = (U32)(ip - base); - size_t const hash3 = ZSTD_hash3Ptr(ip, hashLog3); - assert(hashLog3 > 0); - - while(idx < target) { - hashTable3[ZSTD_hash3Ptr(base+idx, hashLog3)] = idx; - idx++; - } - - *nextToUpdate3 = target; - return hashTable3[hash3]; -} - - -/*-************************************* -* Binary Tree search -***************************************/ -/** ZSTD_insertBt1() : add one or multiple positions to tree. - * ip : assumed <= iend-8 . - * @return : nb of positions added */ -static U32 ZSTD_insertBt1( - ZSTD_matchState_t* ms, - const BYTE* const ip, const BYTE* const iend, - U32 const mls, const int extDict) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32* const hashTable = ms->hashTable; - U32 const hashLog = cParams->hashLog; - size_t const h = ZSTD_hashPtr(ip, hashLog, mls); - U32* const bt = ms->chainTable; - U32 const btLog = cParams->chainLog - 1; - U32 const btMask = (1 << btLog) - 1; - U32 matchIndex = hashTable[h]; - size_t commonLengthSmaller=0, commonLengthLarger=0; - const BYTE* const base = ms->window.base; - const BYTE* const dictBase = ms->window.dictBase; - const U32 dictLimit = ms->window.dictLimit; - const BYTE* const dictEnd = dictBase + dictLimit; - const BYTE* const prefixStart = base + dictLimit; - const BYTE* match; - const U32 current = (U32)(ip-base); - const U32 btLow = btMask >= current ? 0 : current - btMask; - U32* smallerPtr = bt + 2*(current&btMask); - U32* largerPtr = smallerPtr + 1; - U32 dummy32; /* to be nullified at the end */ - U32 const windowLow = ms->window.lowLimit; - U32 matchEndIdx = current+8+1; - size_t bestLength = 8; - U32 nbCompares = 1U << cParams->searchLog; -#ifdef ZSTD_C_PREDICT - U32 predictedSmall = *(bt + 2*((current-1)&btMask) + 0); - U32 predictedLarge = *(bt + 2*((current-1)&btMask) + 1); - predictedSmall += (predictedSmall>0); - predictedLarge += (predictedLarge>0); -#endif /* ZSTD_C_PREDICT */ - - DEBUGLOG(8, "ZSTD_insertBt1 (%u)", current); - - assert(ip <= iend-8); /* required for h calculation */ - hashTable[h] = current; /* Update Hash Table */ - - assert(windowLow > 0); - while (nbCompares-- && (matchIndex >= windowLow)) { - U32* const nextPtr = bt + 2*(matchIndex & btMask); - size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ - assert(matchIndex < current); - -#ifdef ZSTD_C_PREDICT /* note : can create issues when hlog small <= 11 */ - const U32* predictPtr = bt + 2*((matchIndex-1) & btMask); /* written this way, as bt is a roll buffer */ - if (matchIndex == predictedSmall) { - /* no need to check length, result known */ - *smallerPtr = matchIndex; - if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop the search */ - smallerPtr = nextPtr+1; /* new "smaller" => larger of match */ - matchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to current) */ - predictedSmall = predictPtr[1] + (predictPtr[1]>0); - continue; - } - if (matchIndex == predictedLarge) { - *largerPtr = matchIndex; - if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop the search */ - largerPtr = nextPtr; - matchIndex = nextPtr[0]; - predictedLarge = predictPtr[0] + (predictPtr[0]>0); - continue; - } -#endif - - if (!extDict || (matchIndex+matchLength >= dictLimit)) { - assert(matchIndex+matchLength >= dictLimit); /* might be wrong if actually extDict */ - match = base + matchIndex; - matchLength += ZSTD_count(ip+matchLength, match+matchLength, iend); - } else { - match = dictBase + matchIndex; - matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iend, dictEnd, prefixStart); - if (matchIndex+matchLength >= dictLimit) - match = base + matchIndex; /* to prepare for next usage of match[matchLength] */ - } - - if (matchLength > bestLength) { - bestLength = matchLength; - if (matchLength > matchEndIdx - matchIndex) - matchEndIdx = matchIndex + (U32)matchLength; - } - - if (ip+matchLength == iend) { /* equal : no way to know if inf or sup */ - break; /* drop , to guarantee consistency ; miss a bit of compression, but other solutions can corrupt tree */ - } - - if (match[matchLength] < ip[matchLength]) { /* necessarily within buffer */ - /* match is smaller than current */ - *smallerPtr = matchIndex; /* update smaller idx */ - commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */ - if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop searching */ - smallerPtr = nextPtr+1; /* new "candidate" => larger than match, which was smaller than target */ - matchIndex = nextPtr[1]; /* new matchIndex, larger than previous and closer to current */ - } else { - /* match is larger than current */ - *largerPtr = matchIndex; - commonLengthLarger = matchLength; - if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop searching */ - largerPtr = nextPtr; - matchIndex = nextPtr[0]; - } } - - *smallerPtr = *largerPtr = 0; - { U32 positions = 0; - if (bestLength > 384) positions = MIN(192, (U32)(bestLength - 384)); /* speed optimization */ - assert(matchEndIdx > current + 8); - return MAX(positions, matchEndIdx - (current + 8)); - } -} - -FORCE_INLINE_TEMPLATE -void ZSTD_updateTree_internal( - ZSTD_matchState_t* ms, - const BYTE* const ip, const BYTE* const iend, - const U32 mls, const ZSTD_dictMode_e dictMode) -{ - const BYTE* const base = ms->window.base; - U32 const target = (U32)(ip - base); - U32 idx = ms->nextToUpdate; - DEBUGLOG(6, "ZSTD_updateTree_internal, from %u to %u (dictMode:%u)", - idx, target, dictMode); - - while(idx < target) { - U32 const forward = ZSTD_insertBt1(ms, base+idx, iend, mls, dictMode == ZSTD_extDict); - assert(idx < (U32)(idx + forward)); - idx += forward; - } - assert((size_t)(ip - base) <= (size_t)(U32)(-1)); - assert((size_t)(iend - base) <= (size_t)(U32)(-1)); - ms->nextToUpdate = target; -} - -void ZSTD_updateTree(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend) { - ZSTD_updateTree_internal(ms, ip, iend, ms->cParams.minMatch, ZSTD_noDict); -} - -FORCE_INLINE_TEMPLATE -U32 ZSTD_insertBtAndGetAllMatches ( - ZSTD_match_t* matches, /* store result (found matches) in this table (presumed large enough) */ - ZSTD_matchState_t* ms, - U32* nextToUpdate3, - const BYTE* const ip, const BYTE* const iLimit, const ZSTD_dictMode_e dictMode, - const U32 rep[ZSTD_REP_NUM], - U32 const ll0, /* tells if associated literal length is 0 or not. This value must be 0 or 1 */ - const U32 lengthToBeat, - U32 const mls /* template */) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32 const sufficient_len = MIN(cParams->targetLength, ZSTD_OPT_NUM -1); - const BYTE* const base = ms->window.base; - U32 const current = (U32)(ip-base); - U32 const hashLog = cParams->hashLog; - U32 const minMatch = (mls==3) ? 3 : 4; - U32* const hashTable = ms->hashTable; - size_t const h = ZSTD_hashPtr(ip, hashLog, mls); - U32 matchIndex = hashTable[h]; - U32* const bt = ms->chainTable; - U32 const btLog = cParams->chainLog - 1; - U32 const btMask= (1U << btLog) - 1; - size_t commonLengthSmaller=0, commonLengthLarger=0; - const BYTE* const dictBase = ms->window.dictBase; - U32 const dictLimit = ms->window.dictLimit; - const BYTE* const dictEnd = dictBase + dictLimit; - const BYTE* const prefixStart = base + dictLimit; - U32 const btLow = (btMask >= current) ? 0 : current - btMask; - U32 const windowLow = ZSTD_getLowestMatchIndex(ms, current, cParams->windowLog); - U32 const matchLow = windowLow ? windowLow : 1; - U32* smallerPtr = bt + 2*(current&btMask); - U32* largerPtr = bt + 2*(current&btMask) + 1; - U32 matchEndIdx = current+8+1; /* farthest referenced position of any match => detects repetitive patterns */ - U32 dummy32; /* to be nullified at the end */ - U32 mnum = 0; - U32 nbCompares = 1U << cParams->searchLog; - - const ZSTD_matchState_t* dms = dictMode == ZSTD_dictMatchState ? ms->dictMatchState : NULL; - const ZSTD_compressionParameters* const dmsCParams = - dictMode == ZSTD_dictMatchState ? &dms->cParams : NULL; - const BYTE* const dmsBase = dictMode == ZSTD_dictMatchState ? dms->window.base : NULL; - const BYTE* const dmsEnd = dictMode == ZSTD_dictMatchState ? dms->window.nextSrc : NULL; - U32 const dmsHighLimit = dictMode == ZSTD_dictMatchState ? (U32)(dmsEnd - dmsBase) : 0; - U32 const dmsLowLimit = dictMode == ZSTD_dictMatchState ? dms->window.lowLimit : 0; - U32 const dmsIndexDelta = dictMode == ZSTD_dictMatchState ? windowLow - dmsHighLimit : 0; - U32 const dmsHashLog = dictMode == ZSTD_dictMatchState ? dmsCParams->hashLog : hashLog; - U32 const dmsBtLog = dictMode == ZSTD_dictMatchState ? dmsCParams->chainLog - 1 : btLog; - U32 const dmsBtMask = dictMode == ZSTD_dictMatchState ? (1U << dmsBtLog) - 1 : 0; - U32 const dmsBtLow = dictMode == ZSTD_dictMatchState && dmsBtMask < dmsHighLimit - dmsLowLimit ? dmsHighLimit - dmsBtMask : dmsLowLimit; - - size_t bestLength = lengthToBeat-1; - DEBUGLOG(8, "ZSTD_insertBtAndGetAllMatches: current=%u", current); - - /* check repCode */ - assert(ll0 <= 1); /* necessarily 1 or 0 */ - { U32 const lastR = ZSTD_REP_NUM + ll0; - U32 repCode; - for (repCode = ll0; repCode < lastR; repCode++) { - U32 const repOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode]; - U32 const repIndex = current - repOffset; - U32 repLen = 0; - assert(current >= dictLimit); - if (repOffset-1 /* intentional overflow, discards 0 and -1 */ < current-dictLimit) { /* equivalent to `current > repIndex >= dictLimit` */ - if (ZSTD_readMINMATCH(ip, minMatch) == ZSTD_readMINMATCH(ip - repOffset, minMatch)) { - repLen = (U32)ZSTD_count(ip+minMatch, ip+minMatch-repOffset, iLimit) + minMatch; - } - } else { /* repIndex < dictLimit || repIndex >= current */ - const BYTE* const repMatch = dictMode == ZSTD_dictMatchState ? - dmsBase + repIndex - dmsIndexDelta : - dictBase + repIndex; - assert(current >= windowLow); - if ( dictMode == ZSTD_extDict - && ( ((repOffset-1) /*intentional overflow*/ < current - windowLow) /* equivalent to `current > repIndex >= windowLow` */ - & (((U32)((dictLimit-1) - repIndex) >= 3) ) /* intentional overflow : do not test positions overlapping 2 memory segments */) - && (ZSTD_readMINMATCH(ip, minMatch) == ZSTD_readMINMATCH(repMatch, minMatch)) ) { - repLen = (U32)ZSTD_count_2segments(ip+minMatch, repMatch+minMatch, iLimit, dictEnd, prefixStart) + minMatch; - } - if (dictMode == ZSTD_dictMatchState - && ( ((repOffset-1) /*intentional overflow*/ < current - (dmsLowLimit + dmsIndexDelta)) /* equivalent to `current > repIndex >= dmsLowLimit` */ - & ((U32)((dictLimit-1) - repIndex) >= 3) ) /* intentional overflow : do not test positions overlapping 2 memory segments */ - && (ZSTD_readMINMATCH(ip, minMatch) == ZSTD_readMINMATCH(repMatch, minMatch)) ) { - repLen = (U32)ZSTD_count_2segments(ip+minMatch, repMatch+minMatch, iLimit, dmsEnd, prefixStart) + minMatch; - } } - /* save longer solution */ - if (repLen > bestLength) { - DEBUGLOG(8, "found repCode %u (ll0:%u, offset:%u) of length %u", - repCode, ll0, repOffset, repLen); - bestLength = repLen; - matches[mnum].off = repCode - ll0; - matches[mnum].len = (U32)repLen; - mnum++; - if ( (repLen > sufficient_len) - | (ip+repLen == iLimit) ) { /* best possible */ - return mnum; - } } } } - - /* HC3 match finder */ - if ((mls == 3) /*static*/ && (bestLength < mls)) { - U32 const matchIndex3 = ZSTD_insertAndFindFirstIndexHash3(ms, nextToUpdate3, ip); - if ((matchIndex3 >= matchLow) - & (current - matchIndex3 < (1<<18)) /*heuristic : longer distance likely too expensive*/ ) { - size_t mlen; - if ((dictMode == ZSTD_noDict) /*static*/ || (dictMode == ZSTD_dictMatchState) /*static*/ || (matchIndex3 >= dictLimit)) { - const BYTE* const match = base + matchIndex3; - mlen = ZSTD_count(ip, match, iLimit); - } else { - const BYTE* const match = dictBase + matchIndex3; - mlen = ZSTD_count_2segments(ip, match, iLimit, dictEnd, prefixStart); - } - - /* save best solution */ - if (mlen >= mls /* == 3 > bestLength */) { - DEBUGLOG(8, "found small match with hlog3, of length %u", - (U32)mlen); - bestLength = mlen; - assert(current > matchIndex3); - assert(mnum==0); /* no prior solution */ - matches[0].off = (current - matchIndex3) + ZSTD_REP_MOVE; - matches[0].len = (U32)mlen; - mnum = 1; - if ( (mlen > sufficient_len) | - (ip+mlen == iLimit) ) { /* best possible length */ - ms->nextToUpdate = current+1; /* skip insertion */ - return 1; - } } } - /* no dictMatchState lookup: dicts don't have a populated HC3 table */ - } - - hashTable[h] = current; /* Update Hash Table */ - - while (nbCompares-- && (matchIndex >= matchLow)) { - U32* const nextPtr = bt + 2*(matchIndex & btMask); - const BYTE* match; - size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ - assert(current > matchIndex); - - if ((dictMode == ZSTD_noDict) || (dictMode == ZSTD_dictMatchState) || (matchIndex+matchLength >= dictLimit)) { - assert(matchIndex+matchLength >= dictLimit); /* ensure the condition is correct when !extDict */ - match = base + matchIndex; - if (matchIndex >= dictLimit) assert(memcmp(match, ip, matchLength) == 0); /* ensure early section of match is equal as expected */ - matchLength += ZSTD_count(ip+matchLength, match+matchLength, iLimit); - } else { - match = dictBase + matchIndex; - assert(memcmp(match, ip, matchLength) == 0); /* ensure early section of match is equal as expected */ - matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iLimit, dictEnd, prefixStart); - if (matchIndex+matchLength >= dictLimit) - match = base + matchIndex; /* prepare for match[matchLength] read */ - } - - if (matchLength > bestLength) { - DEBUGLOG(8, "found match of length %u at distance %u (offCode=%u)", - (U32)matchLength, current - matchIndex, current - matchIndex + ZSTD_REP_MOVE); - assert(matchEndIdx > matchIndex); - if (matchLength > matchEndIdx - matchIndex) - matchEndIdx = matchIndex + (U32)matchLength; - bestLength = matchLength; - matches[mnum].off = (current - matchIndex) + ZSTD_REP_MOVE; - matches[mnum].len = (U32)matchLength; - mnum++; - if ( (matchLength > ZSTD_OPT_NUM) - | (ip+matchLength == iLimit) /* equal : no way to know if inf or sup */) { - if (dictMode == ZSTD_dictMatchState) nbCompares = 0; /* break should also skip searching dms */ - break; /* drop, to preserve bt consistency (miss a little bit of compression) */ - } - } - - if (match[matchLength] < ip[matchLength]) { - /* match smaller than current */ - *smallerPtr = matchIndex; /* update smaller idx */ - commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */ - if (matchIndex <= btLow) { smallerPtr=&dummy32; break; } /* beyond tree size, stop the search */ - smallerPtr = nextPtr+1; /* new candidate => larger than match, which was smaller than current */ - matchIndex = nextPtr[1]; /* new matchIndex, larger than previous, closer to current */ - } else { - *largerPtr = matchIndex; - commonLengthLarger = matchLength; - if (matchIndex <= btLow) { largerPtr=&dummy32; break; } /* beyond tree size, stop the search */ - largerPtr = nextPtr; - matchIndex = nextPtr[0]; - } } - - *smallerPtr = *largerPtr = 0; - - if (dictMode == ZSTD_dictMatchState && nbCompares) { - size_t const dmsH = ZSTD_hashPtr(ip, dmsHashLog, mls); - U32 dictMatchIndex = dms->hashTable[dmsH]; - const U32* const dmsBt = dms->chainTable; - commonLengthSmaller = commonLengthLarger = 0; - while (nbCompares-- && (dictMatchIndex > dmsLowLimit)) { - const U32* const nextPtr = dmsBt + 2*(dictMatchIndex & dmsBtMask); - size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */ - const BYTE* match = dmsBase + dictMatchIndex; - matchLength += ZSTD_count_2segments(ip+matchLength, match+matchLength, iLimit, dmsEnd, prefixStart); - if (dictMatchIndex+matchLength >= dmsHighLimit) - match = base + dictMatchIndex + dmsIndexDelta; /* to prepare for next usage of match[matchLength] */ - - if (matchLength > bestLength) { - matchIndex = dictMatchIndex + dmsIndexDelta; - DEBUGLOG(8, "found dms match of length %u at distance %u (offCode=%u)", - (U32)matchLength, current - matchIndex, current - matchIndex + ZSTD_REP_MOVE); - if (matchLength > matchEndIdx - matchIndex) - matchEndIdx = matchIndex + (U32)matchLength; - bestLength = matchLength; - matches[mnum].off = (current - matchIndex) + ZSTD_REP_MOVE; - matches[mnum].len = (U32)matchLength; - mnum++; - if ( (matchLength > ZSTD_OPT_NUM) - | (ip+matchLength == iLimit) /* equal : no way to know if inf or sup */) { - break; /* drop, to guarantee consistency (miss a little bit of compression) */ - } - } - - if (dictMatchIndex <= dmsBtLow) { break; } /* beyond tree size, stop the search */ - if (match[matchLength] < ip[matchLength]) { - commonLengthSmaller = matchLength; /* all smaller will now have at least this guaranteed common length */ - dictMatchIndex = nextPtr[1]; /* new matchIndex larger than previous (closer to current) */ - } else { - /* match is larger than current */ - commonLengthLarger = matchLength; - dictMatchIndex = nextPtr[0]; - } - } - } - - assert(matchEndIdx > current+8); - ms->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */ - return mnum; -} - - -FORCE_INLINE_TEMPLATE U32 ZSTD_BtGetAllMatches ( - ZSTD_match_t* matches, /* store result (match found, increasing size) in this table */ - ZSTD_matchState_t* ms, - U32* nextToUpdate3, - const BYTE* ip, const BYTE* const iHighLimit, const ZSTD_dictMode_e dictMode, - const U32 rep[ZSTD_REP_NUM], - U32 const ll0, - U32 const lengthToBeat) -{ - const ZSTD_compressionParameters* const cParams = &ms->cParams; - U32 const matchLengthSearch = cParams->minMatch; - DEBUGLOG(8, "ZSTD_BtGetAllMatches"); - if (ip < ms->window.base + ms->nextToUpdate) return 0; /* skipped area */ - ZSTD_updateTree_internal(ms, ip, iHighLimit, matchLengthSearch, dictMode); - switch(matchLengthSearch) - { - case 3 : return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, 3); - default : - case 4 : return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, 4); - case 5 : return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, 5); - case 7 : - case 6 : return ZSTD_insertBtAndGetAllMatches(matches, ms, nextToUpdate3, ip, iHighLimit, dictMode, rep, ll0, lengthToBeat, 6); - } -} - - -/*-******************************* -* Optimal parser -*********************************/ -typedef struct repcodes_s { - U32 rep[3]; -} repcodes_t; - -static repcodes_t ZSTD_updateRep(U32 const rep[3], U32 const offset, U32 const ll0) -{ - repcodes_t newReps; - if (offset >= ZSTD_REP_NUM) { /* full offset */ - newReps.rep[2] = rep[1]; - newReps.rep[1] = rep[0]; - newReps.rep[0] = offset - ZSTD_REP_MOVE; - } else { /* repcode */ - U32 const repCode = offset + ll0; - if (repCode > 0) { /* note : if repCode==0, no change */ - U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode]; - newReps.rep[2] = (repCode >= 2) ? rep[1] : rep[2]; - newReps.rep[1] = rep[0]; - newReps.rep[0] = currentOffset; - } else { /* repCode == 0 */ - memcpy(&newReps, rep, sizeof(newReps)); - } - } - return newReps; -} - - -static U32 ZSTD_totalLen(ZSTD_optimal_t sol) -{ - return sol.litlen + sol.mlen; -} - -#if 0 /* debug */ - -static void -listStats(const U32* table, int lastEltID) -{ - int const nbElts = lastEltID + 1; - int enb; - for (enb=0; enb < nbElts; enb++) { - (void)table; - //RAWLOG(2, "%3i:%3i, ", enb, table[enb]); - RAWLOG(2, "%4i,", table[enb]); - } - RAWLOG(2, " \n"); -} - -#endif - -FORCE_INLINE_TEMPLATE size_t -ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms, - seqStore_t* seqStore, - U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize, - const int optLevel, - const ZSTD_dictMode_e dictMode) -{ - optState_t* const optStatePtr = &ms->opt; - const BYTE* const istart = (const BYTE*)src; - const BYTE* ip = istart; - const BYTE* anchor = istart; - const BYTE* const iend = istart + srcSize; - const BYTE* const ilimit = iend - 8; - const BYTE* const base = ms->window.base; - const BYTE* const prefixStart = base + ms->window.dictLimit; - const ZSTD_compressionParameters* const cParams = &ms->cParams; - - U32 const sufficient_len = MIN(cParams->targetLength, ZSTD_OPT_NUM -1); - U32 const minMatch = (cParams->minMatch == 3) ? 3 : 4; - U32 nextToUpdate3 = ms->nextToUpdate; - - ZSTD_optimal_t* const opt = optStatePtr->priceTable; - ZSTD_match_t* const matches = optStatePtr->matchTable; - ZSTD_optimal_t lastSequence; - - /* init */ - DEBUGLOG(5, "ZSTD_compressBlock_opt_generic: current=%u, prefix=%u, nextToUpdate=%u", - (U32)(ip - base), ms->window.dictLimit, ms->nextToUpdate); - assert(optLevel <= 2); - ZSTD_rescaleFreqs(optStatePtr, (const BYTE*)src, srcSize, optLevel); - ip += (ip==prefixStart); - - /* Match Loop */ - while (ip < ilimit) { - U32 cur, last_pos = 0; - - /* find first match */ - { U32 const litlen = (U32)(ip - anchor); - U32 const ll0 = !litlen; - U32 const nbMatches = ZSTD_BtGetAllMatches(matches, ms, &nextToUpdate3, ip, iend, dictMode, rep, ll0, minMatch); - if (!nbMatches) { ip++; continue; } - - /* initialize opt[0] */ - { U32 i ; for (i=0; i immediate encoding */ - { U32 const maxML = matches[nbMatches-1].len; - U32 const maxOffset = matches[nbMatches-1].off; - DEBUGLOG(6, "found %u matches of maxLength=%u and maxOffCode=%u at cPos=%u => start new series", - nbMatches, maxML, maxOffset, (U32)(ip-prefixStart)); - - if (maxML > sufficient_len) { - lastSequence.litlen = litlen; - lastSequence.mlen = maxML; - lastSequence.off = maxOffset; - DEBUGLOG(6, "large match (%u>%u), immediate encoding", - maxML, sufficient_len); - cur = 0; - last_pos = ZSTD_totalLen(lastSequence); - goto _shortestPath; - } } - - /* set prices for first matches starting position == 0 */ - { U32 const literalsPrice = opt[0].price + ZSTD_litLengthPrice(0, optStatePtr, optLevel); - U32 pos; - U32 matchNb; - for (pos = 1; pos < minMatch; pos++) { - opt[pos].price = ZSTD_MAX_PRICE; /* mlen, litlen and price will be fixed during forward scanning */ - } - for (matchNb = 0; matchNb < nbMatches; matchNb++) { - U32 const offset = matches[matchNb].off; - U32 const end = matches[matchNb].len; - repcodes_t const repHistory = ZSTD_updateRep(rep, offset, ll0); - for ( ; pos <= end ; pos++ ) { - U32 const matchPrice = ZSTD_getMatchPrice(offset, pos, optStatePtr, optLevel); - U32 const sequencePrice = literalsPrice + matchPrice; - DEBUGLOG(7, "rPos:%u => set initial price : %.2f", - pos, ZSTD_fCost(sequencePrice)); - opt[pos].mlen = pos; - opt[pos].off = offset; - opt[pos].litlen = litlen; - opt[pos].price = sequencePrice; - ZSTD_STATIC_ASSERT(sizeof(opt[pos].rep) == sizeof(repHistory)); - memcpy(opt[pos].rep, &repHistory, sizeof(repHistory)); - } } - last_pos = pos-1; - } - } - - /* check further positions */ - for (cur = 1; cur <= last_pos; cur++) { - const BYTE* const inr = ip + cur; - assert(cur < ZSTD_OPT_NUM); - DEBUGLOG(7, "cPos:%zi==rPos:%u", inr-istart, cur) - - /* Fix current position with one literal if cheaper */ - { U32 const litlen = (opt[cur-1].mlen == 0) ? opt[cur-1].litlen + 1 : 1; - int const price = opt[cur-1].price - + ZSTD_rawLiteralsCost(ip+cur-1, 1, optStatePtr, optLevel) - + ZSTD_litLengthPrice(litlen, optStatePtr, optLevel) - - ZSTD_litLengthPrice(litlen-1, optStatePtr, optLevel); - assert(price < 1000000000); /* overflow check */ - if (price <= opt[cur].price) { - DEBUGLOG(7, "cPos:%zi==rPos:%u : better price (%.2f<=%.2f) using literal (ll==%u) (hist:%u,%u,%u)", - inr-istart, cur, ZSTD_fCost(price), ZSTD_fCost(opt[cur].price), litlen, - opt[cur-1].rep[0], opt[cur-1].rep[1], opt[cur-1].rep[2]); - opt[cur].mlen = 0; - opt[cur].off = 0; - opt[cur].litlen = litlen; - opt[cur].price = price; - memcpy(opt[cur].rep, opt[cur-1].rep, sizeof(opt[cur].rep)); - } else { - DEBUGLOG(7, "cPos:%zi==rPos:%u : literal would cost more (%.2f>%.2f) (hist:%u,%u,%u)", - inr-istart, cur, ZSTD_fCost(price), ZSTD_fCost(opt[cur].price), - opt[cur].rep[0], opt[cur].rep[1], opt[cur].rep[2]); - } - } - - /* last match must start at a minimum distance of 8 from oend */ - if (inr > ilimit) continue; - - if (cur == last_pos) break; - - if ( (optLevel==0) /*static_test*/ - && (opt[cur+1].price <= opt[cur].price + (BITCOST_MULTIPLIER/2)) ) { - DEBUGLOG(7, "move to next rPos:%u : price is <=", cur+1); - continue; /* skip unpromising positions; about ~+6% speed, -0.01 ratio */ - } - - { U32 const ll0 = (opt[cur].mlen != 0); - U32 const litlen = (opt[cur].mlen == 0) ? opt[cur].litlen : 0; - U32 const previousPrice = opt[cur].price; - U32 const basePrice = previousPrice + ZSTD_litLengthPrice(0, optStatePtr, optLevel); - U32 const nbMatches = ZSTD_BtGetAllMatches(matches, ms, &nextToUpdate3, inr, iend, dictMode, opt[cur].rep, ll0, minMatch); - U32 matchNb; - if (!nbMatches) { - DEBUGLOG(7, "rPos:%u : no match found", cur); - continue; - } - - { U32 const maxML = matches[nbMatches-1].len; - DEBUGLOG(7, "cPos:%zi==rPos:%u, found %u matches, of maxLength=%u", - inr-istart, cur, nbMatches, maxML); - - if ( (maxML > sufficient_len) - || (cur + maxML >= ZSTD_OPT_NUM) ) { - lastSequence.mlen = maxML; - lastSequence.off = matches[nbMatches-1].off; - lastSequence.litlen = litlen; - cur -= (opt[cur].mlen==0) ? opt[cur].litlen : 0; /* last sequence is actually only literals, fix cur to last match - note : may underflow, in which case, it's first sequence, and it's okay */ - last_pos = cur + ZSTD_totalLen(lastSequence); - if (cur > ZSTD_OPT_NUM) cur = 0; /* underflow => first match */ - goto _shortestPath; - } } - - /* set prices using matches found at position == cur */ - for (matchNb = 0; matchNb < nbMatches; matchNb++) { - U32 const offset = matches[matchNb].off; - repcodes_t const repHistory = ZSTD_updateRep(opt[cur].rep, offset, ll0); - U32 const lastML = matches[matchNb].len; - U32 const startML = (matchNb>0) ? matches[matchNb-1].len+1 : minMatch; - U32 mlen; - - DEBUGLOG(7, "testing match %u => offCode=%4u, mlen=%2u, llen=%2u", - matchNb, matches[matchNb].off, lastML, litlen); - - for (mlen = lastML; mlen >= startML; mlen--) { /* scan downward */ - U32 const pos = cur + mlen; - int const price = basePrice + ZSTD_getMatchPrice(offset, mlen, optStatePtr, optLevel); - - if ((pos > last_pos) || (price < opt[pos].price)) { - DEBUGLOG(7, "rPos:%u (ml=%2u) => new better price (%.2f<%.2f)", - pos, mlen, ZSTD_fCost(price), ZSTD_fCost(opt[pos].price)); - while (last_pos < pos) { opt[last_pos+1].price = ZSTD_MAX_PRICE; last_pos++; } /* fill empty positions */ - opt[pos].mlen = mlen; - opt[pos].off = offset; - opt[pos].litlen = litlen; - opt[pos].price = price; - ZSTD_STATIC_ASSERT(sizeof(opt[pos].rep) == sizeof(repHistory)); - memcpy(opt[pos].rep, &repHistory, sizeof(repHistory)); - } else { - DEBUGLOG(7, "rPos:%u (ml=%2u) => new price is worse (%.2f>=%.2f)", - pos, mlen, ZSTD_fCost(price), ZSTD_fCost(opt[pos].price)); - if (optLevel==0) break; /* early update abort; gets ~+10% speed for about -0.01 ratio loss */ - } - } } } - } /* for (cur = 1; cur <= last_pos; cur++) */ - - lastSequence = opt[last_pos]; - cur = last_pos > ZSTD_totalLen(lastSequence) ? last_pos - ZSTD_totalLen(lastSequence) : 0; /* single sequence, and it starts before `ip` */ - assert(cur < ZSTD_OPT_NUM); /* control overflow*/ - -_shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ - assert(opt[0].mlen == 0); - - { U32 const storeEnd = cur + 1; - U32 storeStart = storeEnd; - U32 seqPos = cur; - - DEBUGLOG(6, "start reverse traversal (last_pos:%u, cur:%u)", - last_pos, cur); (void)last_pos; - assert(storeEnd < ZSTD_OPT_NUM); - DEBUGLOG(6, "last sequence copied into pos=%u (llen=%u,mlen=%u,ofc=%u)", - storeEnd, lastSequence.litlen, lastSequence.mlen, lastSequence.off); - opt[storeEnd] = lastSequence; - while (seqPos > 0) { - U32 const backDist = ZSTD_totalLen(opt[seqPos]); - storeStart--; - DEBUGLOG(6, "sequence from rPos=%u copied into pos=%u (llen=%u,mlen=%u,ofc=%u)", - seqPos, storeStart, opt[seqPos].litlen, opt[seqPos].mlen, opt[seqPos].off); - opt[storeStart] = opt[seqPos]; - seqPos = (seqPos > backDist) ? seqPos - backDist : 0; - } - - /* save sequences */ - DEBUGLOG(6, "sending selected sequences into seqStore") - { U32 storePos; - for (storePos=storeStart; storePos <= storeEnd; storePos++) { - U32 const llen = opt[storePos].litlen; - U32 const mlen = opt[storePos].mlen; - U32 const offCode = opt[storePos].off; - U32 const advance = llen + mlen; - DEBUGLOG(6, "considering seq starting at %zi, llen=%u, mlen=%u", - anchor - istart, (unsigned)llen, (unsigned)mlen); - - if (mlen==0) { /* only literals => must be last "sequence", actually starting a new stream of sequences */ - assert(storePos == storeEnd); /* must be last sequence */ - ip = anchor + llen; /* last "sequence" is a bunch of literals => don't progress anchor */ - continue; /* will finish */ - } - - /* repcodes update : like ZSTD_updateRep(), but update in place */ - if (offCode >= ZSTD_REP_NUM) { /* full offset */ - rep[2] = rep[1]; - rep[1] = rep[0]; - rep[0] = offCode - ZSTD_REP_MOVE; - } else { /* repcode */ - U32 const repCode = offCode + (llen==0); - if (repCode) { /* note : if repCode==0, no change */ - U32 const currentOffset = (repCode==ZSTD_REP_NUM) ? (rep[0] - 1) : rep[repCode]; - if (repCode >= 2) rep[2] = rep[1]; - rep[1] = rep[0]; - rep[0] = currentOffset; - } } - - assert(anchor + llen <= iend); - ZSTD_updateStats(optStatePtr, llen, anchor, offCode, mlen); - ZSTD_storeSeq(seqStore, llen, anchor, iend, offCode, mlen-MINMATCH); - anchor += advance; - ip = anchor; - } } - ZSTD_setBasePrices(optStatePtr, optLevel); - } - - } /* while (ip < ilimit) */ - - /* Return the last literals size */ - return (size_t)(iend - anchor); -} - - -size_t ZSTD_compressBlock_btopt( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) -{ - DEBUGLOG(5, "ZSTD_compressBlock_btopt"); - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 0 /*optLevel*/, ZSTD_noDict); -} - - -/* used in 2-pass strategy */ -static U32 ZSTD_upscaleStat(unsigned* table, U32 lastEltIndex, int bonus) -{ - U32 s, sum=0; - assert(ZSTD_FREQ_DIV+bonus >= 0); - for (s=0; slitSum = ZSTD_upscaleStat(optPtr->litFreq, MaxLit, 0); - optPtr->litLengthSum = ZSTD_upscaleStat(optPtr->litLengthFreq, MaxLL, 0); - optPtr->matchLengthSum = ZSTD_upscaleStat(optPtr->matchLengthFreq, MaxML, 0); - optPtr->offCodeSum = ZSTD_upscaleStat(optPtr->offCodeFreq, MaxOff, 0); -} - -/* ZSTD_initStats_ultra(): - * make a first compression pass, just to seed stats with more accurate starting values. - * only works on first block, with no dictionary and no ldm. - * this function cannot error, hence its contract must be respected. - */ -static void -ZSTD_initStats_ultra(ZSTD_matchState_t* ms, - seqStore_t* seqStore, - U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) -{ - U32 tmpRep[ZSTD_REP_NUM]; /* updated rep codes will sink here */ - memcpy(tmpRep, rep, sizeof(tmpRep)); - - DEBUGLOG(4, "ZSTD_initStats_ultra (srcSize=%zu)", srcSize); - assert(ms->opt.litLengthSum == 0); /* first block */ - assert(seqStore->sequences == seqStore->sequencesStart); /* no ldm */ - assert(ms->window.dictLimit == ms->window.lowLimit); /* no dictionary */ - assert(ms->window.dictLimit - ms->nextToUpdate <= 1); /* no prefix (note: intentional overflow, defined as 2-complement) */ - - ZSTD_compressBlock_opt_generic(ms, seqStore, tmpRep, src, srcSize, 2 /*optLevel*/, ZSTD_noDict); /* generate stats into ms->opt*/ - - /* invalidate first scan from history */ - ZSTD_resetSeqStore(seqStore); - ms->window.base -= srcSize; - ms->window.dictLimit += (U32)srcSize; - ms->window.lowLimit = ms->window.dictLimit; - ms->nextToUpdate = ms->window.dictLimit; - - /* re-inforce weight of collected statistics */ - ZSTD_upscaleStats(&ms->opt); -} - -size_t ZSTD_compressBlock_btultra( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) -{ - DEBUGLOG(5, "ZSTD_compressBlock_btultra (srcSize=%zu)", srcSize); - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /*optLevel*/, ZSTD_noDict); -} - -size_t ZSTD_compressBlock_btultra2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) -{ - U32 const current = (U32)((const BYTE*)src - ms->window.base); - DEBUGLOG(5, "ZSTD_compressBlock_btultra2 (srcSize=%zu)", srcSize); - - /* 2-pass strategy: - * this strategy makes a first pass over first block to collect statistics - * and seed next round's statistics with it. - * After 1st pass, function forgets everything, and starts a new block. - * Consequently, this can only work if no data has been previously loaded in tables, - * aka, no dictionary, no prefix, no ldm preprocessing. - * The compression ratio gain is generally small (~0.5% on first block), - * the cost is 2x cpu time on first block. */ - assert(srcSize <= ZSTD_BLOCKSIZE_MAX); - if ( (ms->opt.litLengthSum==0) /* first block */ - && (seqStore->sequences == seqStore->sequencesStart) /* no ldm */ - && (ms->window.dictLimit == ms->window.lowLimit) /* no dictionary */ - && (current == ms->window.dictLimit) /* start of frame, nothing already loaded nor skipped */ - && (srcSize > ZSTD_PREDEF_THRESHOLD) - ) { - ZSTD_initStats_ultra(ms, seqStore, rep, src, srcSize); - } - - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /*optLevel*/, ZSTD_noDict); -} - -size_t ZSTD_compressBlock_btopt_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) -{ - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 0 /*optLevel*/, ZSTD_dictMatchState); -} - -size_t ZSTD_compressBlock_btultra_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) -{ - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /*optLevel*/, ZSTD_dictMatchState); -} - -size_t ZSTD_compressBlock_btopt_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) -{ - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 0 /*optLevel*/, ZSTD_extDict); -} - -size_t ZSTD_compressBlock_btultra_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - const void* src, size_t srcSize) -{ - return ZSTD_compressBlock_opt_generic(ms, seqStore, rep, src, srcSize, 2 /*optLevel*/, ZSTD_extDict); -} - -/* note : no btultra2 variant for extDict nor dictMatchState, - * because btultra2 is not meant to work with dictionaries - * and is only specific for the first block (no prefix) */ diff --git a/vendor/github.com/DataDog/zstd/zstd_opt.h b/vendor/github.com/DataDog/zstd/zstd_opt.h deleted file mode 100644 index 094f7476..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_opt.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_OPT_H -#define ZSTD_OPT_H - -#if defined (__cplusplus) -extern "C" { -#endif - -#include "zstd_compress_internal.h" - -/* used in ZSTD_loadDictionaryContent() */ -void ZSTD_updateTree(ZSTD_matchState_t* ms, const BYTE* ip, const BYTE* iend); - -size_t ZSTD_compressBlock_btopt( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_btultra( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_btultra2( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - - -size_t ZSTD_compressBlock_btopt_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_btultra_dictMatchState( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - -size_t ZSTD_compressBlock_btopt_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); -size_t ZSTD_compressBlock_btultra_extDict( - ZSTD_matchState_t* ms, seqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], - void const* src, size_t srcSize); - - /* note : no btultra2 variant for extDict nor dictMatchState, - * because btultra2 is not meant to work with dictionaries - * and is only specific for the first block (no prefix) */ - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_OPT_H */ diff --git a/vendor/github.com/DataDog/zstd/zstd_stream.go b/vendor/github.com/DataDog/zstd/zstd_stream.go deleted file mode 100644 index 2df078c3..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_stream.go +++ /dev/null @@ -1,454 +0,0 @@ -package zstd - -/* -#define ZSTD_STATIC_LINKING_ONLY -#include "stdint.h" // for uintptr_t -#include "zstd.h" - -typedef struct compressStream2_result_s { - size_t return_code; - size_t bytes_consumed; - size_t bytes_written; -} compressStream2_result; - -static void ZSTD_compressStream2_wrapper(compressStream2_result* result, ZSTD_CCtx* ctx, uintptr_t dst, size_t maxDstSize, const uintptr_t src, size_t srcSize) { - ZSTD_outBuffer outBuffer = { (void*)dst, maxDstSize, 0 }; - ZSTD_inBuffer inBuffer = { (void*)src, srcSize, 0 }; - size_t retCode = ZSTD_compressStream2(ctx, &outBuffer, &inBuffer, ZSTD_e_continue); - - result->return_code = retCode; - result->bytes_consumed = inBuffer.pos; - result->bytes_written = outBuffer.pos; -} - -static void ZSTD_compressStream2_finish(compressStream2_result* result, ZSTD_CCtx* ctx, uintptr_t dst, size_t maxDstSize, const uintptr_t src, size_t srcSize) { - ZSTD_outBuffer outBuffer = { (void*)dst, maxDstSize, 0 }; - ZSTD_inBuffer inBuffer = { (void*)src, srcSize, 0 }; - size_t retCode = ZSTD_compressStream2(ctx, &outBuffer, &inBuffer, ZSTD_e_end); - - result->return_code = retCode; - result->bytes_consumed = inBuffer.pos; - result->bytes_written = outBuffer.pos; -} - -// decompressStream2_result is the same as compressStream2_result, but keep 2 separate struct for easier changes -typedef struct decompressStream2_result_s { - size_t return_code; - size_t bytes_consumed; - size_t bytes_written; -} decompressStream2_result; - -static void ZSTD_decompressStream_wrapper(decompressStream2_result* result, ZSTD_DCtx* ctx, uintptr_t dst, size_t maxDstSize, const uintptr_t src, size_t srcSize) { - ZSTD_outBuffer outBuffer = { (void*)dst, maxDstSize, 0 }; - ZSTD_inBuffer inBuffer = { (void*)src, srcSize, 0 }; - size_t retCode = ZSTD_decompressStream(ctx, &outBuffer, &inBuffer); - - result->return_code = retCode; - result->bytes_consumed = inBuffer.pos; - result->bytes_written = outBuffer.pos; -} -*/ -import "C" -import ( - "errors" - "fmt" - "io" - "runtime" - "sync" - "unsafe" -) - -var errShortRead = errors.New("short read") -var errReaderClosed = errors.New("Reader is closed") - -// Writer is an io.WriteCloser that zstd-compresses its input. -type Writer struct { - CompressionLevel int - - ctx *C.ZSTD_CCtx - dict []byte - srcBuffer []byte - dstBuffer []byte - firstError error - underlyingWriter io.Writer - resultBuffer *C.compressStream2_result -} - -func resize(in []byte, newSize int) []byte { - if in == nil { - return make([]byte, newSize) - } - if newSize <= cap(in) { - return in[:newSize] - } - toAdd := newSize - len(in) - return append(in, make([]byte, toAdd)...) -} - -// NewWriter creates a new Writer with default compression options. Writes to -// the writer will be written in compressed form to w. -func NewWriter(w io.Writer) *Writer { - return NewWriterLevelDict(w, DefaultCompression, nil) -} - -// NewWriterLevel is like NewWriter but specifies the compression level instead -// of assuming default compression. -// -// The level can be DefaultCompression or any integer value between BestSpeed -// and BestCompression inclusive. -func NewWriterLevel(w io.Writer, level int) *Writer { - return NewWriterLevelDict(w, level, nil) - -} - -// NewWriterLevelDict is like NewWriterLevel but specifies a dictionary to -// compress with. If the dictionary is empty or nil it is ignored. The dictionary -// should not be modified until the writer is closed. -func NewWriterLevelDict(w io.Writer, level int, dict []byte) *Writer { - var err error - ctx := C.ZSTD_createCStream() - - // Load dictionnary if any - if dict != nil { - err = getError(int(C.ZSTD_CCtx_loadDictionary(ctx, - unsafe.Pointer(&dict[0]), - C.size_t(len(dict)), - ))) - } - - if err == nil { - // Only set level if the ctx is not in error already - err = getError(int(C.ZSTD_CCtx_setParameter(ctx, C.ZSTD_c_compressionLevel, C.int(level)))) - } - - return &Writer{ - CompressionLevel: level, - ctx: ctx, - dict: dict, - srcBuffer: make([]byte, 0), - dstBuffer: make([]byte, CompressBound(1024)), - firstError: err, - underlyingWriter: w, - resultBuffer: new(C.compressStream2_result), - } -} - -// Write writes a compressed form of p to the underlying io.Writer. -func (w *Writer) Write(p []byte) (int, error) { - if w.firstError != nil { - return 0, w.firstError - } - if len(p) == 0 { - return 0, nil - } - // Check if dstBuffer is enough - w.dstBuffer = w.dstBuffer[0:cap(w.dstBuffer)] - if len(w.dstBuffer) < CompressBound(len(p)) { - w.dstBuffer = make([]byte, CompressBound(len(p))) - } - - // Do not do an extra memcopy if zstd ingest all input data - srcData := p - fastPath := len(w.srcBuffer) == 0 - if !fastPath { - w.srcBuffer = append(w.srcBuffer, p...) - srcData = w.srcBuffer - } - - srcPtr := C.uintptr_t(uintptr(0)) // Do not point anywhere, if src is empty - if len(srcData) > 0 { - srcPtr = C.uintptr_t(uintptr(unsafe.Pointer(&srcData[0]))) - } - - C.ZSTD_compressStream2_wrapper( - w.resultBuffer, - w.ctx, - C.uintptr_t(uintptr(unsafe.Pointer(&w.dstBuffer[0]))), - C.size_t(len(w.dstBuffer)), - srcPtr, - C.size_t(len(srcData)), - ) - runtime.KeepAlive(p) // Ensure p is kept until here so pointer doesn't disappear during C call - ret := int(w.resultBuffer.return_code) - if err := getError(ret); err != nil { - return 0, err - } - - consumed := int(w.resultBuffer.bytes_consumed) - if !fastPath { - w.srcBuffer = w.srcBuffer[consumed:] - } else { - remaining := len(p) - consumed - if remaining > 0 { - // We still have some non-consumed data, copy remaining data to srcBuffer - // Try to not reallocate w.srcBuffer if we already have enough space - if cap(w.srcBuffer) >= remaining { - w.srcBuffer = w.srcBuffer[0:remaining] - } else { - w.srcBuffer = make([]byte, remaining) - } - copy(w.srcBuffer, p[consumed:]) - } - } - - written := int(w.resultBuffer.bytes_written) - // Write to underlying buffer - _, err := w.underlyingWriter.Write(w.dstBuffer[:written]) - - // Same behaviour as zlib, we can't know how much data we wrote, only - // if there was an error - if err != nil { - return 0, err - } - return len(p), err -} - -// Close closes the Writer, flushing any unwritten data to the underlying -// io.Writer and freeing objects, but does not close the underlying io.Writer. -func (w *Writer) Close() error { - if w.firstError != nil { - return w.firstError - } - - ret := 1 // So we loop at least once - for ret > 0 { - srcPtr := C.uintptr_t(uintptr(0)) // Do not point anywhere, if src is empty - if len(w.srcBuffer) > 0 { - srcPtr = C.uintptr_t(uintptr(unsafe.Pointer(&w.srcBuffer[0]))) - } - - C.ZSTD_compressStream2_finish( - w.resultBuffer, - w.ctx, - C.uintptr_t(uintptr(unsafe.Pointer(&w.dstBuffer[0]))), - C.size_t(len(w.dstBuffer)), - srcPtr, - C.size_t(len(w.srcBuffer)), - ) - ret = int(w.resultBuffer.return_code) - if err := getError(ret); err != nil { - return err - } - w.srcBuffer = w.srcBuffer[w.resultBuffer.bytes_consumed:] - written := int(w.resultBuffer.bytes_written) - w.underlyingWriter.Write(w.dstBuffer[:written]) - - if ret > 0 { // We have a hint if we need to resize the dstBuffer - w.dstBuffer = w.dstBuffer[:cap(w.dstBuffer)] - if len(w.dstBuffer) < ret { - w.dstBuffer = make([]byte, ret) - } - } - } - - return getError(int(C.ZSTD_freeCStream(w.ctx))) -} - -// cSize is the recommended size of reader.compressionBuffer. This func and -// invocation allow for a one-time check for validity. -var cSize = func() int { - v := int(C.ZSTD_DStreamInSize()) - if v <= 0 { - panic(fmt.Errorf("ZSTD_DStreamInSize() returned invalid size: %v", v)) - } - return v -}() - -// dSize is the recommended size of reader.decompressionBuffer. This func and -// invocation allow for a one-time check for validity. -var dSize = func() int { - v := int(C.ZSTD_DStreamOutSize()) - if v <= 0 { - panic(fmt.Errorf("ZSTD_DStreamOutSize() returned invalid size: %v", v)) - } - return v -}() - -// cPool is a pool of buffers for use in reader.compressionBuffer. Buffers are -// taken from the pool in NewReaderDict, returned in reader.Close(). Returns a -// pointer to a slice to avoid the extra allocation of returning the slice as a -// value. -var cPool = sync.Pool{ - New: func() interface{} { - buff := make([]byte, cSize) - return &buff - }, -} - -// dPool is a pool of buffers for use in reader.decompressionBuffer. Buffers are -// taken from the pool in NewReaderDict, returned in reader.Close(). Returns a -// pointer to a slice to avoid the extra allocation of returning the slice as a -// value. -var dPool = sync.Pool{ - New: func() interface{} { - buff := make([]byte, dSize) - return &buff - }, -} - -// reader is an io.ReadCloser that decompresses when read from. -type reader struct { - ctx *C.ZSTD_DCtx - compressionBuffer []byte - compressionLeft int - decompressionBuffer []byte - decompOff int - decompSize int - dict []byte - firstError error - recommendedSrcSize int - resultBuffer *C.decompressStream2_result - underlyingReader io.Reader -} - -// NewReader creates a new io.ReadCloser. Reads from the returned ReadCloser -// read and decompress data from r. It is the caller's responsibility to call -// Close on the ReadCloser when done. If this is not done, underlying objects -// in the zstd library will not be freed. -func NewReader(r io.Reader) io.ReadCloser { - return NewReaderDict(r, nil) -} - -// NewReaderDict is like NewReader but uses a preset dictionary. NewReaderDict -// ignores the dictionary if it is nil. -func NewReaderDict(r io.Reader, dict []byte) io.ReadCloser { - var err error - ctx := C.ZSTD_createDStream() - if len(dict) == 0 { - err = getError(int(C.ZSTD_initDStream(ctx))) - } else { - err = getError(int(C.ZSTD_DCtx_reset(ctx, C.ZSTD_reset_session_only))) - if err == nil { - // Only load dictionary if we succesfully inited the context - err = getError(int(C.ZSTD_DCtx_loadDictionary( - ctx, - unsafe.Pointer(&dict[0]), - C.size_t(len(dict))))) - } - } - compressionBufferP := cPool.Get().(*[]byte) - decompressionBufferP := dPool.Get().(*[]byte) - return &reader{ - ctx: ctx, - dict: dict, - compressionBuffer: *compressionBufferP, - decompressionBuffer: *decompressionBufferP, - firstError: err, - recommendedSrcSize: cSize, - resultBuffer: new(C.decompressStream2_result), - underlyingReader: r, - } -} - -// Close frees the allocated C objects -func (r *reader) Close() error { - if r.firstError != nil { - return r.firstError - } - - cb := r.compressionBuffer - db := r.decompressionBuffer - // Ensure that we won't resuse buffer - r.firstError = errReaderClosed - r.compressionBuffer = nil - r.decompressionBuffer = nil - - cPool.Put(&cb) - dPool.Put(&db) - return getError(int(C.ZSTD_freeDStream(r.ctx))) -} - -func (r *reader) Read(p []byte) (int, error) { - if r.firstError != nil { - return 0, r.firstError - } - - // If we already have enough bytes, return - if r.decompSize-r.decompOff >= len(p) { - copy(p, r.decompressionBuffer[r.decompOff:]) - r.decompOff += len(p) - return len(p), nil - } - - copy(p, r.decompressionBuffer[r.decompOff:r.decompSize]) - got := r.decompSize - r.decompOff - r.decompSize = 0 - r.decompOff = 0 - - for got < len(p) { - // Populate src - src := r.compressionBuffer - reader := r.underlyingReader - n, err := TryReadFull(reader, src[r.compressionLeft:]) - if err != nil && err != errShortRead { // Handle underlying reader errors first - return 0, fmt.Errorf("failed to read from underlying reader: %s", err) - } else if n == 0 && r.compressionLeft == 0 { - return got, io.EOF - } - src = src[:r.compressionLeft+n] - - // C code - srcPtr := C.uintptr_t(uintptr(0)) // Do not point anywhere, if src is empty - if len(src) > 0 { - srcPtr = C.uintptr_t(uintptr(unsafe.Pointer(&src[0]))) - } - - C.ZSTD_decompressStream_wrapper( - r.resultBuffer, - r.ctx, - C.uintptr_t(uintptr(unsafe.Pointer(&r.decompressionBuffer[0]))), - C.size_t(len(r.decompressionBuffer)), - srcPtr, - C.size_t(len(src)), - ) - retCode := int(r.resultBuffer.return_code) - - // Keep src here eventhough we reuse later, the code might be deleted at some point - runtime.KeepAlive(src) - if err = getError(retCode); err != nil { - return 0, fmt.Errorf("failed to decompress: %s", err) - } - - // Put everything in buffer - bytesConsumed := int(r.resultBuffer.bytes_consumed) - if bytesConsumed < len(src) { - left := src[bytesConsumed:] - copy(r.compressionBuffer, left) - } - r.compressionLeft = len(src) - int(bytesConsumed) - r.decompSize = int(r.resultBuffer.bytes_written) - r.decompOff = copy(p[got:], r.decompressionBuffer[:r.decompSize]) - got += r.decompOff - - // Resize buffers - nsize := retCode // Hint for next src buffer size - if nsize <= 0 { - // Reset to recommended size - nsize = r.recommendedSrcSize - } - if nsize < r.compressionLeft { - nsize = r.compressionLeft - } - r.compressionBuffer = resize(r.compressionBuffer, nsize) - } - return got, nil -} - -// TryReadFull reads buffer just as ReadFull does -// Here we expect that buffer may end and we do not return ErrUnexpectedEOF as ReadAtLeast does. -// We return errShortRead instead to distinguish short reads and failures. -// We cannot use ReadFull/ReadAtLeast because it masks Reader errors, such as network failures -// and causes panic instead of error. -func TryReadFull(r io.Reader, buf []byte) (n int, err error) { - for n < len(buf) && err == nil { - var nn int - nn, err = r.Read(buf[n:]) - n += nn - } - if n == len(buf) && err == io.EOF { - err = nil // EOF at the end is somewhat expected - } else if err == io.EOF { - err = errShortRead - } - return -} diff --git a/vendor/github.com/DataDog/zstd/zstd_v01.c b/vendor/github.com/DataDog/zstd/zstd_v01.c deleted file mode 100644 index 8112527f..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_v01.c +++ /dev/null @@ -1,2152 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -/****************************************** -* Includes -******************************************/ -#include /* size_t, ptrdiff_t */ -#include "zstd_v01.h" -#include "error_private.h" - - -/****************************************** -* Static allocation -******************************************/ -/* You can statically allocate FSE CTable/DTable as a table of unsigned using below macro */ -#define FSE_DTABLE_SIZE_U32(maxTableLog) (1 + (1<2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) -* Increasing memory usage improves compression ratio -* Reduced memory usage can improve speed, due to cache effect -* Recommended max value is 14, for 16KB, which nicely fits into Intel x86 L1 cache */ -#define FSE_MAX_MEMORY_USAGE 14 -#define FSE_DEFAULT_MEMORY_USAGE 13 - -/* FSE_MAX_SYMBOL_VALUE : -* Maximum symbol value authorized. -* Required for proper stack allocation */ -#define FSE_MAX_SYMBOL_VALUE 255 - - -/**************************************************************** -* template functions type & suffix -****************************************************************/ -#define FSE_FUNCTION_TYPE BYTE -#define FSE_FUNCTION_EXTENSION - - -/**************************************************************** -* Byte symbol type -****************************************************************/ -typedef struct -{ - unsigned short newState; - unsigned char symbol; - unsigned char nbBits; -} FSE_decode_t; /* size == U32 */ - - - -/**************************************************************** -* Compiler specifics -****************************************************************/ -#ifdef _MSC_VER /* Visual Studio */ -# define FORCE_INLINE static __forceinline -# include /* For Visual 2005 */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */ -#else -# define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) -# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# ifdef __GNUC__ -# define FORCE_INLINE static inline __attribute__((always_inline)) -# else -# define FORCE_INLINE static inline -# endif -# else -# define FORCE_INLINE static -# endif /* __STDC_VERSION__ */ -#endif - - -/**************************************************************** -* Includes -****************************************************************/ -#include /* malloc, free, qsort */ -#include /* memcpy, memset */ -#include /* printf (debug) */ - - -#ifndef MEM_ACCESS_MODULE -#define MEM_ACCESS_MODULE -/**************************************************************** -* Basic Types -*****************************************************************/ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# include -typedef uint8_t BYTE; -typedef uint16_t U16; -typedef int16_t S16; -typedef uint32_t U32; -typedef int32_t S32; -typedef uint64_t U64; -typedef int64_t S64; -#else -typedef unsigned char BYTE; -typedef unsigned short U16; -typedef signed short S16; -typedef unsigned int U32; -typedef signed int S32; -typedef unsigned long long U64; -typedef signed long long S64; -#endif - -#endif /* MEM_ACCESS_MODULE */ - -/**************************************************************** -* Memory I/O -*****************************************************************/ -/* FSE_FORCE_MEMORY_ACCESS - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets generating assembly depending on alignment. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef FSE_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define FSE_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define FSE_FORCE_MEMORY_ACCESS 1 -# endif -#endif - - -static unsigned FSE_32bits(void) -{ - return sizeof(void*)==4; -} - -static unsigned FSE_isLittleEndian(void) -{ - const union { U32 i; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */ - return one.c[0]; -} - -#if defined(FSE_FORCE_MEMORY_ACCESS) && (FSE_FORCE_MEMORY_ACCESS==2) - -static U16 FSE_read16(const void* memPtr) { return *(const U16*) memPtr; } -static U32 FSE_read32(const void* memPtr) { return *(const U32*) memPtr; } -static U64 FSE_read64(const void* memPtr) { return *(const U64*) memPtr; } - -#elif defined(FSE_FORCE_MEMORY_ACCESS) && (FSE_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; U64 u64; } __attribute__((packed)) unalign; - -static U16 FSE_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -static U32 FSE_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -static U64 FSE_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -#else - -static U16 FSE_read16(const void* memPtr) -{ - U16 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -static U32 FSE_read32(const void* memPtr) -{ - U32 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -static U64 FSE_read64(const void* memPtr) -{ - U64 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -#endif // FSE_FORCE_MEMORY_ACCESS - -static U16 FSE_readLE16(const void* memPtr) -{ - if (FSE_isLittleEndian()) - return FSE_read16(memPtr); - else - { - const BYTE* p = (const BYTE*)memPtr; - return (U16)(p[0] + (p[1]<<8)); - } -} - -static U32 FSE_readLE32(const void* memPtr) -{ - if (FSE_isLittleEndian()) - return FSE_read32(memPtr); - else - { - const BYTE* p = (const BYTE*)memPtr; - return (U32)((U32)p[0] + ((U32)p[1]<<8) + ((U32)p[2]<<16) + ((U32)p[3]<<24)); - } -} - - -static U64 FSE_readLE64(const void* memPtr) -{ - if (FSE_isLittleEndian()) - return FSE_read64(memPtr); - else - { - const BYTE* p = (const BYTE*)memPtr; - return (U64)((U64)p[0] + ((U64)p[1]<<8) + ((U64)p[2]<<16) + ((U64)p[3]<<24) - + ((U64)p[4]<<32) + ((U64)p[5]<<40) + ((U64)p[6]<<48) + ((U64)p[7]<<56)); - } -} - -static size_t FSE_readLEST(const void* memPtr) -{ - if (FSE_32bits()) - return (size_t)FSE_readLE32(memPtr); - else - return (size_t)FSE_readLE64(memPtr); -} - - - -/**************************************************************** -* Constants -*****************************************************************/ -#define FSE_MAX_TABLELOG (FSE_MAX_MEMORY_USAGE-2) -#define FSE_MAX_TABLESIZE (1U< FSE_TABLELOG_ABSOLUTE_MAX -#error "FSE_MAX_TABLELOG > FSE_TABLELOG_ABSOLUTE_MAX is not supported" -#endif - - -/**************************************************************** -* Error Management -****************************************************************/ -#define FSE_STATIC_ASSERT(c) { enum { FSE_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ - - -/**************************************************************** -* Complex types -****************************************************************/ -typedef struct -{ - int deltaFindState; - U32 deltaNbBits; -} FSE_symbolCompressionTransform; /* total 8 bytes */ - -typedef U32 DTable_max_t[FSE_DTABLE_SIZE_U32(FSE_MAX_TABLELOG)]; - -/**************************************************************** -* Internal functions -****************************************************************/ -FORCE_INLINE unsigned FSE_highbit32 (U32 val) -{ -# if defined(_MSC_VER) /* Visual */ - unsigned long r; - _BitScanReverse ( &r, val ); - return (unsigned) r; -# elif defined(__GNUC__) && (GCC_VERSION >= 304) /* GCC Intrinsic */ - return __builtin_clz (val) ^ 31; -# else /* Software version */ - static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 }; - U32 v = val; - unsigned r; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - r = DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27]; - return r; -# endif -} - - -/**************************************************************** -* Templates -****************************************************************/ -/* - designed to be included - for type-specific functions (template emulation in C) - Objective is to write these functions only once, for improved maintenance -*/ - -/* safety checks */ -#ifndef FSE_FUNCTION_EXTENSION -# error "FSE_FUNCTION_EXTENSION must be defined" -#endif -#ifndef FSE_FUNCTION_TYPE -# error "FSE_FUNCTION_TYPE must be defined" -#endif - -/* Function names */ -#define FSE_CAT(X,Y) X##Y -#define FSE_FUNCTION_NAME(X,Y) FSE_CAT(X,Y) -#define FSE_TYPE_NAME(X,Y) FSE_CAT(X,Y) - - - -static U32 FSE_tableStep(U32 tableSize) { return (tableSize>>1) + (tableSize>>3) + 3; } - -#define FSE_DECODE_TYPE FSE_decode_t - - -typedef struct { - U16 tableLog; - U16 fastMode; -} FSE_DTableHeader; /* sizeof U32 */ - -static size_t FSE_buildDTable -(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog) -{ - void* ptr = dt; - FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr; - FSE_DECODE_TYPE* const tableDecode = (FSE_DECODE_TYPE*)(ptr) + 1; /* because dt is unsigned, 32-bits aligned on 32-bits */ - const U32 tableSize = 1 << tableLog; - const U32 tableMask = tableSize-1; - const U32 step = FSE_tableStep(tableSize); - U16 symbolNext[FSE_MAX_SYMBOL_VALUE+1]; - U32 position = 0; - U32 highThreshold = tableSize-1; - const S16 largeLimit= (S16)(1 << (tableLog-1)); - U32 noLarge = 1; - U32 s; - - /* Sanity Checks */ - if (maxSymbolValue > FSE_MAX_SYMBOL_VALUE) return (size_t)-FSE_ERROR_maxSymbolValue_tooLarge; - if (tableLog > FSE_MAX_TABLELOG) return (size_t)-FSE_ERROR_tableLog_tooLarge; - - /* Init, lay down lowprob symbols */ - DTableH[0].tableLog = (U16)tableLog; - for (s=0; s<=maxSymbolValue; s++) - { - if (normalizedCounter[s]==-1) - { - tableDecode[highThreshold--].symbol = (FSE_FUNCTION_TYPE)s; - symbolNext[s] = 1; - } - else - { - if (normalizedCounter[s] >= largeLimit) noLarge=0; - symbolNext[s] = normalizedCounter[s]; - } - } - - /* Spread symbols */ - for (s=0; s<=maxSymbolValue; s++) - { - int i; - for (i=0; i highThreshold) position = (position + step) & tableMask; /* lowprob area */ - } - } - - if (position!=0) return (size_t)-FSE_ERROR_GENERIC; /* position must reach all cells once, otherwise normalizedCounter is incorrect */ - - /* Build Decoding table */ - { - U32 i; - for (i=0; ifastMode = (U16)noLarge; - return 0; -} - - -/****************************************** -* FSE byte symbol -******************************************/ -#ifndef FSE_COMMONDEFS_ONLY - -static unsigned FSE_isError(size_t code) { return (code > (size_t)(-FSE_ERROR_maxCode)); } - -static short FSE_abs(short a) -{ - return a<0? -a : a; -} - - -/**************************************************************** -* Header bitstream management -****************************************************************/ -static size_t FSE_readNCount (short* normalizedCounter, unsigned* maxSVPtr, unsigned* tableLogPtr, - const void* headerBuffer, size_t hbSize) -{ - const BYTE* const istart = (const BYTE*) headerBuffer; - const BYTE* const iend = istart + hbSize; - const BYTE* ip = istart; - int nbBits; - int remaining; - int threshold; - U32 bitStream; - int bitCount; - unsigned charnum = 0; - int previous0 = 0; - - if (hbSize < 4) return (size_t)-FSE_ERROR_srcSize_wrong; - bitStream = FSE_readLE32(ip); - nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG; /* extract tableLog */ - if (nbBits > FSE_TABLELOG_ABSOLUTE_MAX) return (size_t)-FSE_ERROR_tableLog_tooLarge; - bitStream >>= 4; - bitCount = 4; - *tableLogPtr = nbBits; - remaining = (1<1) && (charnum<=*maxSVPtr)) - { - if (previous0) - { - unsigned n0 = charnum; - while ((bitStream & 0xFFFF) == 0xFFFF) - { - n0+=24; - if (ip < iend-5) - { - ip+=2; - bitStream = FSE_readLE32(ip) >> bitCount; - } - else - { - bitStream >>= 16; - bitCount+=16; - } - } - while ((bitStream & 3) == 3) - { - n0+=3; - bitStream>>=2; - bitCount+=2; - } - n0 += bitStream & 3; - bitCount += 2; - if (n0 > *maxSVPtr) return (size_t)-FSE_ERROR_maxSymbolValue_tooSmall; - while (charnum < n0) normalizedCounter[charnum++] = 0; - if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) - { - ip += bitCount>>3; - bitCount &= 7; - bitStream = FSE_readLE32(ip) >> bitCount; - } - else - bitStream >>= 2; - } - { - const short max = (short)((2*threshold-1)-remaining); - short count; - - if ((bitStream & (threshold-1)) < (U32)max) - { - count = (short)(bitStream & (threshold-1)); - bitCount += nbBits-1; - } - else - { - count = (short)(bitStream & (2*threshold-1)); - if (count >= threshold) count -= max; - bitCount += nbBits; - } - - count--; /* extra accuracy */ - remaining -= FSE_abs(count); - normalizedCounter[charnum++] = count; - previous0 = !count; - while (remaining < threshold) - { - nbBits--; - threshold >>= 1; - } - - { - if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) - { - ip += bitCount>>3; - bitCount &= 7; - } - else - { - bitCount -= (int)(8 * (iend - 4 - ip)); - ip = iend - 4; - } - bitStream = FSE_readLE32(ip) >> (bitCount & 31); - } - } - } - if (remaining != 1) return (size_t)-FSE_ERROR_GENERIC; - *maxSVPtr = charnum-1; - - ip += (bitCount+7)>>3; - if ((size_t)(ip-istart) > hbSize) return (size_t)-FSE_ERROR_srcSize_wrong; - return ip-istart; -} - - -/********************************************************* -* Decompression (Byte symbols) -*********************************************************/ -static size_t FSE_buildDTable_rle (FSE_DTable* dt, BYTE symbolValue) -{ - void* ptr = dt; - FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr; - FSE_decode_t* const cell = (FSE_decode_t*)(ptr) + 1; /* because dt is unsigned */ - - DTableH->tableLog = 0; - DTableH->fastMode = 0; - - cell->newState = 0; - cell->symbol = symbolValue; - cell->nbBits = 0; - - return 0; -} - - -static size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits) -{ - void* ptr = dt; - FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr; - FSE_decode_t* const dinfo = (FSE_decode_t*)(ptr) + 1; /* because dt is unsigned */ - const unsigned tableSize = 1 << nbBits; - const unsigned tableMask = tableSize - 1; - const unsigned maxSymbolValue = tableMask; - unsigned s; - - /* Sanity checks */ - if (nbBits < 1) return (size_t)-FSE_ERROR_GENERIC; /* min size */ - - /* Build Decoding Table */ - DTableH->tableLog = (U16)nbBits; - DTableH->fastMode = 1; - for (s=0; s<=maxSymbolValue; s++) - { - dinfo[s].newState = 0; - dinfo[s].symbol = (BYTE)s; - dinfo[s].nbBits = (BYTE)nbBits; - } - - return 0; -} - - -/* FSE_initDStream - * Initialize a FSE_DStream_t. - * srcBuffer must point at the beginning of an FSE block. - * The function result is the size of the FSE_block (== srcSize). - * If srcSize is too small, the function will return an errorCode; - */ -static size_t FSE_initDStream(FSE_DStream_t* bitD, const void* srcBuffer, size_t srcSize) -{ - if (srcSize < 1) return (size_t)-FSE_ERROR_srcSize_wrong; - - if (srcSize >= sizeof(size_t)) - { - U32 contain32; - bitD->start = (const char*)srcBuffer; - bitD->ptr = (const char*)srcBuffer + srcSize - sizeof(size_t); - bitD->bitContainer = FSE_readLEST(bitD->ptr); - contain32 = ((const BYTE*)srcBuffer)[srcSize-1]; - if (contain32 == 0) return (size_t)-FSE_ERROR_GENERIC; /* stop bit not present */ - bitD->bitsConsumed = 8 - FSE_highbit32(contain32); - } - else - { - U32 contain32; - bitD->start = (const char*)srcBuffer; - bitD->ptr = bitD->start; - bitD->bitContainer = *(const BYTE*)(bitD->start); - switch(srcSize) - { - case 7: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[6]) << (sizeof(size_t)*8 - 16); - /* fallthrough */ - case 6: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[5]) << (sizeof(size_t)*8 - 24); - /* fallthrough */ - case 5: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[4]) << (sizeof(size_t)*8 - 32); - /* fallthrough */ - case 4: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[3]) << 24; - /* fallthrough */ - case 3: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[2]) << 16; - /* fallthrough */ - case 2: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[1]) << 8; - /* fallthrough */ - default:; - } - contain32 = ((const BYTE*)srcBuffer)[srcSize-1]; - if (contain32 == 0) return (size_t)-FSE_ERROR_GENERIC; /* stop bit not present */ - bitD->bitsConsumed = 8 - FSE_highbit32(contain32); - bitD->bitsConsumed += (U32)(sizeof(size_t) - srcSize)*8; - } - - return srcSize; -} - - -/*!FSE_lookBits - * Provides next n bits from the bitContainer. - * bitContainer is not modified (bits are still present for next read/look) - * On 32-bits, maxNbBits==25 - * On 64-bits, maxNbBits==57 - * return : value extracted. - */ -static size_t FSE_lookBits(FSE_DStream_t* bitD, U32 nbBits) -{ - const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; - return ((bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> 1) >> ((bitMask-nbBits) & bitMask); -} - -static size_t FSE_lookBitsFast(FSE_DStream_t* bitD, U32 nbBits) /* only if nbBits >= 1 !! */ -{ - const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; - return (bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> (((bitMask+1)-nbBits) & bitMask); -} - -static void FSE_skipBits(FSE_DStream_t* bitD, U32 nbBits) -{ - bitD->bitsConsumed += nbBits; -} - - -/*!FSE_readBits - * Read next n bits from the bitContainer. - * On 32-bits, don't read more than maxNbBits==25 - * On 64-bits, don't read more than maxNbBits==57 - * Use the fast variant *only* if n >= 1. - * return : value extracted. - */ -static size_t FSE_readBits(FSE_DStream_t* bitD, U32 nbBits) -{ - size_t value = FSE_lookBits(bitD, nbBits); - FSE_skipBits(bitD, nbBits); - return value; -} - -static size_t FSE_readBitsFast(FSE_DStream_t* bitD, U32 nbBits) /* only if nbBits >= 1 !! */ -{ - size_t value = FSE_lookBitsFast(bitD, nbBits); - FSE_skipBits(bitD, nbBits); - return value; -} - -static unsigned FSE_reloadDStream(FSE_DStream_t* bitD) -{ - if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8)) /* should never happen */ - return FSE_DStream_tooFar; - - if (bitD->ptr >= bitD->start + sizeof(bitD->bitContainer)) - { - bitD->ptr -= bitD->bitsConsumed >> 3; - bitD->bitsConsumed &= 7; - bitD->bitContainer = FSE_readLEST(bitD->ptr); - return FSE_DStream_unfinished; - } - if (bitD->ptr == bitD->start) - { - if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return FSE_DStream_endOfBuffer; - return FSE_DStream_completed; - } - { - U32 nbBytes = bitD->bitsConsumed >> 3; - U32 result = FSE_DStream_unfinished; - if (bitD->ptr - nbBytes < bitD->start) - { - nbBytes = (U32)(bitD->ptr - bitD->start); /* ptr > start */ - result = FSE_DStream_endOfBuffer; - } - bitD->ptr -= nbBytes; - bitD->bitsConsumed -= nbBytes*8; - bitD->bitContainer = FSE_readLEST(bitD->ptr); /* reminder : srcSize > sizeof(bitD) */ - return result; - } -} - - -static void FSE_initDState(FSE_DState_t* DStatePtr, FSE_DStream_t* bitD, const FSE_DTable* dt) -{ - const void* ptr = dt; - const FSE_DTableHeader* const DTableH = (const FSE_DTableHeader*)ptr; - DStatePtr->state = FSE_readBits(bitD, DTableH->tableLog); - FSE_reloadDStream(bitD); - DStatePtr->table = dt + 1; -} - -static BYTE FSE_decodeSymbol(FSE_DState_t* DStatePtr, FSE_DStream_t* bitD) -{ - const FSE_decode_t DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; - const U32 nbBits = DInfo.nbBits; - BYTE symbol = DInfo.symbol; - size_t lowBits = FSE_readBits(bitD, nbBits); - - DStatePtr->state = DInfo.newState + lowBits; - return symbol; -} - -static BYTE FSE_decodeSymbolFast(FSE_DState_t* DStatePtr, FSE_DStream_t* bitD) -{ - const FSE_decode_t DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; - const U32 nbBits = DInfo.nbBits; - BYTE symbol = DInfo.symbol; - size_t lowBits = FSE_readBitsFast(bitD, nbBits); - - DStatePtr->state = DInfo.newState + lowBits; - return symbol; -} - -/* FSE_endOfDStream - Tells if bitD has reached end of bitStream or not */ - -static unsigned FSE_endOfDStream(const FSE_DStream_t* bitD) -{ - return ((bitD->ptr == bitD->start) && (bitD->bitsConsumed == sizeof(bitD->bitContainer)*8)); -} - -static unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr) -{ - return DStatePtr->state == 0; -} - - -FORCE_INLINE size_t FSE_decompress_usingDTable_generic( - void* dst, size_t maxDstSize, - const void* cSrc, size_t cSrcSize, - const FSE_DTable* dt, const unsigned fast) -{ - BYTE* const ostart = (BYTE*) dst; - BYTE* op = ostart; - BYTE* const omax = op + maxDstSize; - BYTE* const olimit = omax-3; - - FSE_DStream_t bitD; - FSE_DState_t state1; - FSE_DState_t state2; - size_t errorCode; - - /* Init */ - errorCode = FSE_initDStream(&bitD, cSrc, cSrcSize); /* replaced last arg by maxCompressed Size */ - if (FSE_isError(errorCode)) return errorCode; - - FSE_initDState(&state1, &bitD, dt); - FSE_initDState(&state2, &bitD, dt); - -#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD) - - /* 4 symbols per loop */ - for ( ; (FSE_reloadDStream(&bitD)==FSE_DStream_unfinished) && (op sizeof(bitD.bitContainer)*8) /* This test must be static */ - FSE_reloadDStream(&bitD); - - op[1] = FSE_GETSYMBOL(&state2); - - if (FSE_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */ - { if (FSE_reloadDStream(&bitD) > FSE_DStream_unfinished) { op+=2; break; } } - - op[2] = FSE_GETSYMBOL(&state1); - - if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */ - FSE_reloadDStream(&bitD); - - op[3] = FSE_GETSYMBOL(&state2); - } - - /* tail */ - /* note : FSE_reloadDStream(&bitD) >= FSE_DStream_partiallyFilled; Ends at exactly FSE_DStream_completed */ - while (1) - { - if ( (FSE_reloadDStream(&bitD)>FSE_DStream_completed) || (op==omax) || (FSE_endOfDStream(&bitD) && (fast || FSE_endOfDState(&state1))) ) - break; - - *op++ = FSE_GETSYMBOL(&state1); - - if ( (FSE_reloadDStream(&bitD)>FSE_DStream_completed) || (op==omax) || (FSE_endOfDStream(&bitD) && (fast || FSE_endOfDState(&state2))) ) - break; - - *op++ = FSE_GETSYMBOL(&state2); - } - - /* end ? */ - if (FSE_endOfDStream(&bitD) && FSE_endOfDState(&state1) && FSE_endOfDState(&state2)) - return op-ostart; - - if (op==omax) return (size_t)-FSE_ERROR_dstSize_tooSmall; /* dst buffer is full, but cSrc unfinished */ - - return (size_t)-FSE_ERROR_corruptionDetected; -} - - -static size_t FSE_decompress_usingDTable(void* dst, size_t originalSize, - const void* cSrc, size_t cSrcSize, - const FSE_DTable* dt) -{ - FSE_DTableHeader DTableH; - memcpy(&DTableH, dt, sizeof(DTableH)); /* memcpy() into local variable, to avoid strict aliasing warning */ - - /* select fast mode (static) */ - if (DTableH.fastMode) return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1); - return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0); -} - - -static size_t FSE_decompress(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize) -{ - const BYTE* const istart = (const BYTE*)cSrc; - const BYTE* ip = istart; - short counting[FSE_MAX_SYMBOL_VALUE+1]; - DTable_max_t dt; /* Static analyzer seems unable to understand this table will be properly initialized later */ - unsigned tableLog; - unsigned maxSymbolValue = FSE_MAX_SYMBOL_VALUE; - size_t errorCode; - - if (cSrcSize<2) return (size_t)-FSE_ERROR_srcSize_wrong; /* too small input size */ - - /* normal FSE decoding mode */ - errorCode = FSE_readNCount (counting, &maxSymbolValue, &tableLog, istart, cSrcSize); - if (FSE_isError(errorCode)) return errorCode; - if (errorCode >= cSrcSize) return (size_t)-FSE_ERROR_srcSize_wrong; /* too small input size */ - ip += errorCode; - cSrcSize -= errorCode; - - errorCode = FSE_buildDTable (dt, counting, maxSymbolValue, tableLog); - if (FSE_isError(errorCode)) return errorCode; - - /* always return, even if it is an error code */ - return FSE_decompress_usingDTable (dst, maxDstSize, ip, cSrcSize, dt); -} - - - -/* ******************************************************* -* Huff0 : Huffman block compression -*********************************************************/ -#define HUF_MAX_SYMBOL_VALUE 255 -#define HUF_DEFAULT_TABLELOG 12 /* used by default, when not specified */ -#define HUF_MAX_TABLELOG 12 /* max possible tableLog; for allocation purpose; can be modified */ -#define HUF_ABSOLUTEMAX_TABLELOG 16 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */ -#if (HUF_MAX_TABLELOG > HUF_ABSOLUTEMAX_TABLELOG) -# error "HUF_MAX_TABLELOG is too large !" -#endif - -typedef struct HUF_CElt_s { - U16 val; - BYTE nbBits; -} HUF_CElt ; - -typedef struct nodeElt_s { - U32 count; - U16 parent; - BYTE byte; - BYTE nbBits; -} nodeElt; - - -/* ******************************************************* -* Huff0 : Huffman block decompression -*********************************************************/ -typedef struct { - BYTE byte; - BYTE nbBits; -} HUF_DElt; - -static size_t HUF_readDTable (U16* DTable, const void* src, size_t srcSize) -{ - BYTE huffWeight[HUF_MAX_SYMBOL_VALUE + 1]; - U32 rankVal[HUF_ABSOLUTEMAX_TABLELOG + 1]; /* large enough for values from 0 to 16 */ - U32 weightTotal; - U32 maxBits; - const BYTE* ip = (const BYTE*) src; - size_t iSize; - size_t oSize; - U32 n; - U32 nextRankStart; - void* ptr = DTable+1; - HUF_DElt* const dt = (HUF_DElt*)ptr; - - if (!srcSize) return (size_t)-FSE_ERROR_srcSize_wrong; - iSize = ip[0]; - - FSE_STATIC_ASSERT(sizeof(HUF_DElt) == sizeof(U16)); /* if compilation fails here, assertion is false */ - //memset(huffWeight, 0, sizeof(huffWeight)); /* should not be necessary, but some analyzer complain ... */ - if (iSize >= 128) /* special header */ - { - if (iSize >= (242)) /* RLE */ - { - static int l[14] = { 1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64, 127, 128 }; - oSize = l[iSize-242]; - memset(huffWeight, 1, sizeof(huffWeight)); - iSize = 0; - } - else /* Incompressible */ - { - oSize = iSize - 127; - iSize = ((oSize+1)/2); - if (iSize+1 > srcSize) return (size_t)-FSE_ERROR_srcSize_wrong; - ip += 1; - for (n=0; n> 4; - huffWeight[n+1] = ip[n/2] & 15; - } - } - } - else /* header compressed with FSE (normal case) */ - { - if (iSize+1 > srcSize) return (size_t)-FSE_ERROR_srcSize_wrong; - oSize = FSE_decompress(huffWeight, HUF_MAX_SYMBOL_VALUE, ip+1, iSize); /* max 255 values decoded, last one is implied */ - if (FSE_isError(oSize)) return oSize; - } - - /* collect weight stats */ - memset(rankVal, 0, sizeof(rankVal)); - weightTotal = 0; - for (n=0; n= HUF_ABSOLUTEMAX_TABLELOG) return (size_t)-FSE_ERROR_corruptionDetected; - rankVal[huffWeight[n]]++; - weightTotal += (1 << huffWeight[n]) >> 1; - } - if (weightTotal == 0) return (size_t)-FSE_ERROR_corruptionDetected; - - /* get last non-null symbol weight (implied, total must be 2^n) */ - maxBits = FSE_highbit32(weightTotal) + 1; - if (maxBits > DTable[0]) return (size_t)-FSE_ERROR_tableLog_tooLarge; /* DTable is too small */ - DTable[0] = (U16)maxBits; - { - U32 total = 1 << maxBits; - U32 rest = total - weightTotal; - U32 verif = 1 << FSE_highbit32(rest); - U32 lastWeight = FSE_highbit32(rest) + 1; - if (verif != rest) return (size_t)-FSE_ERROR_corruptionDetected; /* last value must be a clean power of 2 */ - huffWeight[oSize] = (BYTE)lastWeight; - rankVal[lastWeight]++; - } - - /* check tree construction validity */ - if ((rankVal[1] < 2) || (rankVal[1] & 1)) return (size_t)-FSE_ERROR_corruptionDetected; /* by construction : at least 2 elts of rank 1, must be even */ - - /* Prepare ranks */ - nextRankStart = 0; - for (n=1; n<=maxBits; n++) - { - U32 current = nextRankStart; - nextRankStart += (rankVal[n] << (n-1)); - rankVal[n] = current; - } - - /* fill DTable */ - for (n=0; n<=oSize; n++) - { - const U32 w = huffWeight[n]; - const U32 length = (1 << w) >> 1; - U32 i; - HUF_DElt D; - D.byte = (BYTE)n; D.nbBits = (BYTE)(maxBits + 1 - w); - for (i = rankVal[w]; i < rankVal[w] + length; i++) - dt[i] = D; - rankVal[w] += length; - } - - return iSize+1; -} - - -static BYTE HUF_decodeSymbol(FSE_DStream_t* Dstream, const HUF_DElt* dt, const U32 dtLog) -{ - const size_t val = FSE_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */ - const BYTE c = dt[val].byte; - FSE_skipBits(Dstream, dt[val].nbBits); - return c; -} - -static size_t HUF_decompress_usingDTable( /* -3% slower when non static */ - void* dst, size_t maxDstSize, - const void* cSrc, size_t cSrcSize, - const U16* DTable) -{ - if (cSrcSize < 6) return (size_t)-FSE_ERROR_srcSize_wrong; - { - BYTE* const ostart = (BYTE*) dst; - BYTE* op = ostart; - BYTE* const omax = op + maxDstSize; - BYTE* const olimit = omax-15; - - const void* ptr = DTable; - const HUF_DElt* const dt = (const HUF_DElt*)(ptr)+1; - const U32 dtLog = DTable[0]; - size_t errorCode; - U32 reloadStatus; - - /* Init */ - - const U16* jumpTable = (const U16*)cSrc; - const size_t length1 = FSE_readLE16(jumpTable); - const size_t length2 = FSE_readLE16(jumpTable+1); - const size_t length3 = FSE_readLE16(jumpTable+2); - const size_t length4 = cSrcSize - 6 - length1 - length2 - length3; // check coherency !! - const char* const start1 = (const char*)(cSrc) + 6; - const char* const start2 = start1 + length1; - const char* const start3 = start2 + length2; - const char* const start4 = start3 + length3; - FSE_DStream_t bitD1, bitD2, bitD3, bitD4; - - if (length1+length2+length3+6 >= cSrcSize) return (size_t)-FSE_ERROR_srcSize_wrong; - - errorCode = FSE_initDStream(&bitD1, start1, length1); - if (FSE_isError(errorCode)) return errorCode; - errorCode = FSE_initDStream(&bitD2, start2, length2); - if (FSE_isError(errorCode)) return errorCode; - errorCode = FSE_initDStream(&bitD3, start3, length3); - if (FSE_isError(errorCode)) return errorCode; - errorCode = FSE_initDStream(&bitD4, start4, length4); - if (FSE_isError(errorCode)) return errorCode; - - reloadStatus=FSE_reloadDStream(&bitD2); - - /* 16 symbols per loop */ - for ( ; (reloadStatus12)) FSE_reloadDStream(&Dstream) - - #define HUF_DECODE_SYMBOL_2(n, Dstream) \ - op[n] = HUF_decodeSymbol(&Dstream, dt, dtLog); \ - if (FSE_32bits()) FSE_reloadDStream(&Dstream) - - HUF_DECODE_SYMBOL_1( 0, bitD1); - HUF_DECODE_SYMBOL_1( 1, bitD2); - HUF_DECODE_SYMBOL_1( 2, bitD3); - HUF_DECODE_SYMBOL_1( 3, bitD4); - HUF_DECODE_SYMBOL_2( 4, bitD1); - HUF_DECODE_SYMBOL_2( 5, bitD2); - HUF_DECODE_SYMBOL_2( 6, bitD3); - HUF_DECODE_SYMBOL_2( 7, bitD4); - HUF_DECODE_SYMBOL_1( 8, bitD1); - HUF_DECODE_SYMBOL_1( 9, bitD2); - HUF_DECODE_SYMBOL_1(10, bitD3); - HUF_DECODE_SYMBOL_1(11, bitD4); - HUF_DECODE_SYMBOL_0(12, bitD1); - HUF_DECODE_SYMBOL_0(13, bitD2); - HUF_DECODE_SYMBOL_0(14, bitD3); - HUF_DECODE_SYMBOL_0(15, bitD4); - } - - if (reloadStatus!=FSE_DStream_completed) /* not complete : some bitStream might be FSE_DStream_unfinished */ - return (size_t)-FSE_ERROR_corruptionDetected; - - /* tail */ - { - // bitTail = bitD1; // *much* slower : -20% !??! - FSE_DStream_t bitTail; - bitTail.ptr = bitD1.ptr; - bitTail.bitsConsumed = bitD1.bitsConsumed; - bitTail.bitContainer = bitD1.bitContainer; // required in case of FSE_DStream_endOfBuffer - bitTail.start = start1; - for ( ; (FSE_reloadDStream(&bitTail) < FSE_DStream_completed) && (op= cSrcSize) return (size_t)-FSE_ERROR_srcSize_wrong; - ip += errorCode; - cSrcSize -= errorCode; - - return HUF_decompress_usingDTable (dst, maxDstSize, ip, cSrcSize, DTable); -} - - -#endif /* FSE_COMMONDEFS_ONLY */ - -/* - zstd - standard compression library - Copyright (C) 2014-2015, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - zstd source repository : https://github.com/Cyan4973/zstd - - ztsd public forum : https://groups.google.com/forum/#!forum/lz4c -*/ - -/**************************************************************** -* Tuning parameters -*****************************************************************/ -/* MEMORY_USAGE : -* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) -* Increasing memory usage improves compression ratio -* Reduced memory usage can improve speed, due to cache effect */ -#define ZSTD_MEMORY_USAGE 17 - - -/************************************** - CPU Feature Detection -**************************************/ -/* - * Automated efficient unaligned memory access detection - * Based on known hardware architectures - * This list will be updated thanks to feedbacks - */ -#if defined(CPU_HAS_EFFICIENT_UNALIGNED_MEMORY_ACCESS) \ - || defined(__ARM_FEATURE_UNALIGNED) \ - || defined(__i386__) || defined(__x86_64__) \ - || defined(_M_IX86) || defined(_M_X64) \ - || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_8__) \ - || (defined(_M_ARM) && (_M_ARM >= 7)) -# define ZSTD_UNALIGNED_ACCESS 1 -#else -# define ZSTD_UNALIGNED_ACCESS 0 -#endif - - -/******************************************************** -* Includes -*********************************************************/ -#include /* calloc */ -#include /* memcpy, memmove */ -#include /* debug : printf */ - - -/******************************************************** -* Compiler specifics -*********************************************************/ -#ifdef __AVX2__ -# include /* AVX2 intrinsics */ -#endif - -#ifdef _MSC_VER /* Visual Studio */ -# include /* For Visual 2005 */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -# pragma warning(disable : 4324) /* disable: C4324: padded structure */ -#endif - - -#ifndef MEM_ACCESS_MODULE -#define MEM_ACCESS_MODULE -/******************************************************** -* Basic Types -*********************************************************/ -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# include -typedef uint8_t BYTE; -typedef uint16_t U16; -typedef int16_t S16; -typedef uint32_t U32; -typedef int32_t S32; -typedef uint64_t U64; -#else -typedef unsigned char BYTE; -typedef unsigned short U16; -typedef signed short S16; -typedef unsigned int U32; -typedef signed int S32; -typedef unsigned long long U64; -#endif - -#endif /* MEM_ACCESS_MODULE */ - - -/******************************************************** -* Constants -*********************************************************/ -static const U32 ZSTD_magicNumber = 0xFD2FB51E; /* 3rd version : seqNb header */ - -#define HASH_LOG (ZSTD_MEMORY_USAGE - 2) -#define HASH_TABLESIZE (1 << HASH_LOG) -#define HASH_MASK (HASH_TABLESIZE - 1) - -#define KNUTH 2654435761 - -#define BIT7 128 -#define BIT6 64 -#define BIT5 32 -#define BIT4 16 - -#define KB *(1 <<10) -#define MB *(1 <<20) -#define GB *(1U<<30) - -#define BLOCKSIZE (128 KB) /* define, for static allocation */ - -#define WORKPLACESIZE (BLOCKSIZE*3) -#define MINMATCH 4 -#define MLbits 7 -#define LLbits 6 -#define Offbits 5 -#define MaxML ((1<>3]; -#else - U32 hashTable[HASH_TABLESIZE]; -#endif - BYTE buffer[WORKPLACESIZE]; -} cctxi_t; - - - - -/************************************** -* Error Management -**************************************/ -/* published entry point */ -unsigned ZSTDv01_isError(size_t code) { return ERR_isError(code); } - - -/************************************** -* Tool functions -**************************************/ -#define ZSTD_VERSION_MAJOR 0 /* for breaking interface changes */ -#define ZSTD_VERSION_MINOR 1 /* for new (non-breaking) interface capabilities */ -#define ZSTD_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */ -#define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) - -/************************************************************** -* Decompression code -**************************************************************/ - -static size_t ZSTDv01_getcBlockSize(const void* src, size_t srcSize, blockProperties_t* bpPtr) -{ - const BYTE* const in = (const BYTE* const)src; - BYTE headerFlags; - U32 cSize; - - if (srcSize < 3) return ERROR(srcSize_wrong); - - headerFlags = *in; - cSize = in[2] + (in[1]<<8) + ((in[0] & 7)<<16); - - bpPtr->blockType = (blockType_t)(headerFlags >> 6); - bpPtr->origSize = (bpPtr->blockType == bt_rle) ? cSize : 0; - - if (bpPtr->blockType == bt_end) return 0; - if (bpPtr->blockType == bt_rle) return 1; - return cSize; -} - - -static size_t ZSTD_copyUncompressedBlock(void* dst, size_t maxDstSize, const void* src, size_t srcSize) -{ - if (srcSize > maxDstSize) return ERROR(dstSize_tooSmall); - memcpy(dst, src, srcSize); - return srcSize; -} - - -static size_t ZSTD_decompressLiterals(void* ctx, - void* dst, size_t maxDstSize, - const void* src, size_t srcSize) -{ - BYTE* op = (BYTE*)dst; - BYTE* const oend = op + maxDstSize; - const BYTE* ip = (const BYTE*)src; - size_t errorCode; - size_t litSize; - - /* check : minimum 2, for litSize, +1, for content */ - if (srcSize <= 3) return ERROR(corruption_detected); - - litSize = ip[1] + (ip[0]<<8); - litSize += ((ip[-3] >> 3) & 7) << 16; // mmmmh.... - op = oend - litSize; - - (void)ctx; - if (litSize > maxDstSize) return ERROR(dstSize_tooSmall); - errorCode = HUF_decompress(op, litSize, ip+2, srcSize-2); - if (FSE_isError(errorCode)) return ERROR(GENERIC); - return litSize; -} - - -static size_t ZSTDv01_decodeLiteralsBlock(void* ctx, - void* dst, size_t maxDstSize, - const BYTE** litStart, size_t* litSize, - const void* src, size_t srcSize) -{ - const BYTE* const istart = (const BYTE* const)src; - const BYTE* ip = istart; - BYTE* const ostart = (BYTE* const)dst; - BYTE* const oend = ostart + maxDstSize; - blockProperties_t litbp; - - size_t litcSize = ZSTDv01_getcBlockSize(src, srcSize, &litbp); - if (ZSTDv01_isError(litcSize)) return litcSize; - if (litcSize > srcSize - ZSTD_blockHeaderSize) return ERROR(srcSize_wrong); - ip += ZSTD_blockHeaderSize; - - switch(litbp.blockType) - { - case bt_raw: - *litStart = ip; - ip += litcSize; - *litSize = litcSize; - break; - case bt_rle: - { - size_t rleSize = litbp.origSize; - if (rleSize>maxDstSize) return ERROR(dstSize_tooSmall); - if (!srcSize) return ERROR(srcSize_wrong); - memset(oend - rleSize, *ip, rleSize); - *litStart = oend - rleSize; - *litSize = rleSize; - ip++; - break; - } - case bt_compressed: - { - size_t decodedLitSize = ZSTD_decompressLiterals(ctx, dst, maxDstSize, ip, litcSize); - if (ZSTDv01_isError(decodedLitSize)) return decodedLitSize; - *litStart = oend - decodedLitSize; - *litSize = decodedLitSize; - ip += litcSize; - break; - } - case bt_end: - default: - return ERROR(GENERIC); - } - - return ip-istart; -} - - -static size_t ZSTDv01_decodeSeqHeaders(int* nbSeq, const BYTE** dumpsPtr, size_t* dumpsLengthPtr, - FSE_DTable* DTableLL, FSE_DTable* DTableML, FSE_DTable* DTableOffb, - const void* src, size_t srcSize) -{ - const BYTE* const istart = (const BYTE* const)src; - const BYTE* ip = istart; - const BYTE* const iend = istart + srcSize; - U32 LLtype, Offtype, MLtype; - U32 LLlog, Offlog, MLlog; - size_t dumpsLength; - - /* check */ - if (srcSize < 5) return ERROR(srcSize_wrong); - - /* SeqHead */ - *nbSeq = ZSTD_readLE16(ip); ip+=2; - LLtype = *ip >> 6; - Offtype = (*ip >> 4) & 3; - MLtype = (*ip >> 2) & 3; - if (*ip & 2) - { - dumpsLength = ip[2]; - dumpsLength += ip[1] << 8; - ip += 3; - } - else - { - dumpsLength = ip[1]; - dumpsLength += (ip[0] & 1) << 8; - ip += 2; - } - *dumpsPtr = ip; - ip += dumpsLength; - *dumpsLengthPtr = dumpsLength; - - /* check */ - if (ip > iend-3) return ERROR(srcSize_wrong); /* min : all 3 are "raw", hence no header, but at least xxLog bits per type */ - - /* sequences */ - { - S16 norm[MaxML+1]; /* assumption : MaxML >= MaxLL and MaxOff */ - size_t headerSize; - - /* Build DTables */ - switch(LLtype) - { - case bt_rle : - LLlog = 0; - FSE_buildDTable_rle(DTableLL, *ip++); break; - case bt_raw : - LLlog = LLbits; - FSE_buildDTable_raw(DTableLL, LLbits); break; - default : - { U32 max = MaxLL; - headerSize = FSE_readNCount(norm, &max, &LLlog, ip, iend-ip); - if (FSE_isError(headerSize)) return ERROR(GENERIC); - if (LLlog > LLFSELog) return ERROR(corruption_detected); - ip += headerSize; - FSE_buildDTable(DTableLL, norm, max, LLlog); - } } - - switch(Offtype) - { - case bt_rle : - Offlog = 0; - if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */ - FSE_buildDTable_rle(DTableOffb, *ip++); break; - case bt_raw : - Offlog = Offbits; - FSE_buildDTable_raw(DTableOffb, Offbits); break; - default : - { U32 max = MaxOff; - headerSize = FSE_readNCount(norm, &max, &Offlog, ip, iend-ip); - if (FSE_isError(headerSize)) return ERROR(GENERIC); - if (Offlog > OffFSELog) return ERROR(corruption_detected); - ip += headerSize; - FSE_buildDTable(DTableOffb, norm, max, Offlog); - } } - - switch(MLtype) - { - case bt_rle : - MLlog = 0; - if (ip > iend-2) return ERROR(srcSize_wrong); /* min : "raw", hence no header, but at least xxLog bits */ - FSE_buildDTable_rle(DTableML, *ip++); break; - case bt_raw : - MLlog = MLbits; - FSE_buildDTable_raw(DTableML, MLbits); break; - default : - { U32 max = MaxML; - headerSize = FSE_readNCount(norm, &max, &MLlog, ip, iend-ip); - if (FSE_isError(headerSize)) return ERROR(GENERIC); - if (MLlog > MLFSELog) return ERROR(corruption_detected); - ip += headerSize; - FSE_buildDTable(DTableML, norm, max, MLlog); - } } } - - return ip-istart; -} - - -typedef struct { - size_t litLength; - size_t offset; - size_t matchLength; -} seq_t; - -typedef struct { - FSE_DStream_t DStream; - FSE_DState_t stateLL; - FSE_DState_t stateOffb; - FSE_DState_t stateML; - size_t prevOffset; - const BYTE* dumps; - const BYTE* dumpsEnd; -} seqState_t; - - -static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState) -{ - size_t litLength; - size_t prevOffset; - size_t offset; - size_t matchLength; - const BYTE* dumps = seqState->dumps; - const BYTE* const de = seqState->dumpsEnd; - - /* Literal length */ - litLength = FSE_decodeSymbol(&(seqState->stateLL), &(seqState->DStream)); - prevOffset = litLength ? seq->offset : seqState->prevOffset; - seqState->prevOffset = seq->offset; - if (litLength == MaxLL) - { - const U32 add = dumpsstateOffb), &(seqState->DStream)); - if (ZSTD_32bits()) FSE_reloadDStream(&(seqState->DStream)); - nbBits = offsetCode - 1; - if (offsetCode==0) nbBits = 0; /* cmove */ - offset = ((size_t)1 << (nbBits & ((sizeof(offset)*8)-1))) + FSE_readBits(&(seqState->DStream), nbBits); - if (ZSTD_32bits()) FSE_reloadDStream(&(seqState->DStream)); - if (offsetCode==0) offset = prevOffset; - } - - /* MatchLength */ - matchLength = FSE_decodeSymbol(&(seqState->stateML), &(seqState->DStream)); - if (matchLength == MaxML) - { - const U32 add = dumpslitLength = litLength; - seq->offset = offset; - seq->matchLength = matchLength; - seqState->dumps = dumps; -} - - -static size_t ZSTD_execSequence(BYTE* op, - seq_t sequence, - const BYTE** litPtr, const BYTE* const litLimit, - BYTE* const base, BYTE* const oend) -{ - static const int dec32table[] = {0, 1, 2, 1, 4, 4, 4, 4}; /* added */ - static const int dec64table[] = {8, 8, 8, 7, 8, 9,10,11}; /* subtracted */ - const BYTE* const ostart = op; - const size_t litLength = sequence.litLength; - BYTE* const endMatch = op + litLength + sequence.matchLength; /* risk : address space overflow (32-bits) */ - const BYTE* const litEnd = *litPtr + litLength; - - /* check */ - if (endMatch > oend) return ERROR(dstSize_tooSmall); /* overwrite beyond dst buffer */ - if (litEnd > litLimit) return ERROR(corruption_detected); - if (sequence.matchLength > (size_t)(*litPtr-op)) return ERROR(dstSize_tooSmall); /* overwrite literal segment */ - - /* copy Literals */ - if (((size_t)(*litPtr - op) < 8) || ((size_t)(oend-litEnd) < 8) || (op+litLength > oend-8)) - memmove(op, *litPtr, litLength); /* overwrite risk */ - else - ZSTD_wildcopy(op, *litPtr, litLength); - op += litLength; - *litPtr = litEnd; /* update for next sequence */ - - /* check : last match must be at a minimum distance of 8 from end of dest buffer */ - if (oend-op < 8) return ERROR(dstSize_tooSmall); - - /* copy Match */ - { - const U32 overlapRisk = (((size_t)(litEnd - endMatch)) < 12); - const BYTE* match = op - sequence.offset; /* possible underflow at op - offset ? */ - size_t qutt = 12; - U64 saved[2]; - - /* check */ - if (match < base) return ERROR(corruption_detected); - if (sequence.offset > (size_t)base) return ERROR(corruption_detected); - - /* save beginning of literal sequence, in case of write overlap */ - if (overlapRisk) - { - if ((endMatch + qutt) > oend) qutt = oend-endMatch; - memcpy(saved, endMatch, qutt); - } - - if (sequence.offset < 8) - { - const int dec64 = dec64table[sequence.offset]; - op[0] = match[0]; - op[1] = match[1]; - op[2] = match[2]; - op[3] = match[3]; - match += dec32table[sequence.offset]; - ZSTD_copy4(op+4, match); - match -= dec64; - } else { ZSTD_copy8(op, match); } - op += 8; match += 8; - - if (endMatch > oend-(16-MINMATCH)) - { - if (op < oend-8) - { - ZSTD_wildcopy(op, match, (oend-8) - op); - match += (oend-8) - op; - op = oend-8; - } - while (opLLTable; - U32* DTableML = dctx->MLTable; - U32* DTableOffb = dctx->OffTable; - BYTE* const base = (BYTE*) (dctx->base); - - /* Build Decoding Tables */ - errorCode = ZSTDv01_decodeSeqHeaders(&nbSeq, &dumps, &dumpsLength, - DTableLL, DTableML, DTableOffb, - ip, iend-ip); - if (ZSTDv01_isError(errorCode)) return errorCode; - ip += errorCode; - - /* Regen sequences */ - { - seq_t sequence; - seqState_t seqState; - - memset(&sequence, 0, sizeof(sequence)); - seqState.dumps = dumps; - seqState.dumpsEnd = dumps + dumpsLength; - seqState.prevOffset = 1; - errorCode = FSE_initDStream(&(seqState.DStream), ip, iend-ip); - if (FSE_isError(errorCode)) return ERROR(corruption_detected); - FSE_initDState(&(seqState.stateLL), &(seqState.DStream), DTableLL); - FSE_initDState(&(seqState.stateOffb), &(seqState.DStream), DTableOffb); - FSE_initDState(&(seqState.stateML), &(seqState.DStream), DTableML); - - for ( ; (FSE_reloadDStream(&(seqState.DStream)) <= FSE_DStream_completed) && (nbSeq>0) ; ) - { - size_t oneSeqSize; - nbSeq--; - ZSTD_decodeSequence(&sequence, &seqState); - oneSeqSize = ZSTD_execSequence(op, sequence, &litPtr, litEnd, base, oend); - if (ZSTDv01_isError(oneSeqSize)) return oneSeqSize; - op += oneSeqSize; - } - - /* check if reached exact end */ - if ( !FSE_endOfDStream(&(seqState.DStream)) ) return ERROR(corruption_detected); /* requested too much : data is corrupted */ - if (nbSeq<0) return ERROR(corruption_detected); /* requested too many sequences : data is corrupted */ - - /* last literal segment */ - { - size_t lastLLSize = litEnd - litPtr; - if (op+lastLLSize > oend) return ERROR(dstSize_tooSmall); - if (op != litPtr) memmove(op, litPtr, lastLLSize); - op += lastLLSize; - } - } - - return op-ostart; -} - - -static size_t ZSTD_decompressBlock( - void* ctx, - void* dst, size_t maxDstSize, - const void* src, size_t srcSize) -{ - /* blockType == blockCompressed, srcSize is trusted */ - const BYTE* ip = (const BYTE*)src; - const BYTE* litPtr = NULL; - size_t litSize = 0; - size_t errorCode; - - /* Decode literals sub-block */ - errorCode = ZSTDv01_decodeLiteralsBlock(ctx, dst, maxDstSize, &litPtr, &litSize, src, srcSize); - if (ZSTDv01_isError(errorCode)) return errorCode; - ip += errorCode; - srcSize -= errorCode; - - return ZSTD_decompressSequences(ctx, dst, maxDstSize, ip, srcSize, litPtr, litSize); -} - - -size_t ZSTDv01_decompressDCtx(void* ctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize) -{ - const BYTE* ip = (const BYTE*)src; - const BYTE* iend = ip + srcSize; - BYTE* const ostart = (BYTE* const)dst; - BYTE* op = ostart; - BYTE* const oend = ostart + maxDstSize; - size_t remainingSize = srcSize; - U32 magicNumber; - size_t errorCode=0; - blockProperties_t blockProperties; - - /* Frame Header */ - if (srcSize < ZSTD_frameHeaderSize+ZSTD_blockHeaderSize) return ERROR(srcSize_wrong); - magicNumber = ZSTD_readBE32(src); - if (magicNumber != ZSTD_magicNumber) return ERROR(prefix_unknown); - ip += ZSTD_frameHeaderSize; remainingSize -= ZSTD_frameHeaderSize; - - /* Loop on each block */ - while (1) - { - size_t blockSize = ZSTDv01_getcBlockSize(ip, iend-ip, &blockProperties); - if (ZSTDv01_isError(blockSize)) return blockSize; - - ip += ZSTD_blockHeaderSize; - remainingSize -= ZSTD_blockHeaderSize; - if (blockSize > remainingSize) return ERROR(srcSize_wrong); - - switch(blockProperties.blockType) - { - case bt_compressed: - errorCode = ZSTD_decompressBlock(ctx, op, oend-op, ip, blockSize); - break; - case bt_raw : - errorCode = ZSTD_copyUncompressedBlock(op, oend-op, ip, blockSize); - break; - case bt_rle : - return ERROR(GENERIC); /* not yet supported */ - break; - case bt_end : - /* end of frame */ - if (remainingSize) return ERROR(srcSize_wrong); - break; - default: - return ERROR(GENERIC); - } - if (blockSize == 0) break; /* bt_end */ - - if (ZSTDv01_isError(errorCode)) return errorCode; - op += errorCode; - ip += blockSize; - remainingSize -= blockSize; - } - - return op-ostart; -} - -size_t ZSTDv01_decompress(void* dst, size_t maxDstSize, const void* src, size_t srcSize) -{ - dctx_t ctx; - ctx.base = dst; - return ZSTDv01_decompressDCtx(&ctx, dst, maxDstSize, src, srcSize); -} - -/* ZSTD_errorFrameSizeInfoLegacy() : - assumes `cSize` and `dBound` are _not_ NULL */ -static void ZSTD_errorFrameSizeInfoLegacy(size_t* cSize, unsigned long long* dBound, size_t ret) -{ - *cSize = ret; - *dBound = ZSTD_CONTENTSIZE_ERROR; -} - -void ZSTDv01_findFrameSizeInfoLegacy(const void *src, size_t srcSize, size_t* cSize, unsigned long long* dBound) -{ - const BYTE* ip = (const BYTE*)src; - size_t remainingSize = srcSize; - size_t nbBlocks = 0; - U32 magicNumber; - blockProperties_t blockProperties; - - /* Frame Header */ - if (srcSize < ZSTD_frameHeaderSize+ZSTD_blockHeaderSize) { - ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong)); - return; - } - magicNumber = ZSTD_readBE32(src); - if (magicNumber != ZSTD_magicNumber) { - ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(prefix_unknown)); - return; - } - ip += ZSTD_frameHeaderSize; remainingSize -= ZSTD_frameHeaderSize; - - /* Loop on each block */ - while (1) - { - size_t blockSize = ZSTDv01_getcBlockSize(ip, remainingSize, &blockProperties); - if (ZSTDv01_isError(blockSize)) { - ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, blockSize); - return; - } - - ip += ZSTD_blockHeaderSize; - remainingSize -= ZSTD_blockHeaderSize; - if (blockSize > remainingSize) { - ZSTD_errorFrameSizeInfoLegacy(cSize, dBound, ERROR(srcSize_wrong)); - return; - } - - if (blockSize == 0) break; /* bt_end */ - - ip += blockSize; - remainingSize -= blockSize; - nbBlocks++; - } - - *cSize = ip - (const BYTE*)src; - *dBound = nbBlocks * BLOCKSIZE; -} - -/******************************* -* Streaming Decompression API -*******************************/ - -size_t ZSTDv01_resetDCtx(ZSTDv01_Dctx* dctx) -{ - dctx->expected = ZSTD_frameHeaderSize; - dctx->phase = 0; - dctx->previousDstEnd = NULL; - dctx->base = NULL; - return 0; -} - -ZSTDv01_Dctx* ZSTDv01_createDCtx(void) -{ - ZSTDv01_Dctx* dctx = (ZSTDv01_Dctx*)malloc(sizeof(ZSTDv01_Dctx)); - if (dctx==NULL) return NULL; - ZSTDv01_resetDCtx(dctx); - return dctx; -} - -size_t ZSTDv01_freeDCtx(ZSTDv01_Dctx* dctx) -{ - free(dctx); - return 0; -} - -size_t ZSTDv01_nextSrcSizeToDecompress(ZSTDv01_Dctx* dctx) -{ - return ((dctx_t*)dctx)->expected; -} - -size_t ZSTDv01_decompressContinue(ZSTDv01_Dctx* dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize) -{ - dctx_t* ctx = (dctx_t*)dctx; - - /* Sanity check */ - if (srcSize != ctx->expected) return ERROR(srcSize_wrong); - if (dst != ctx->previousDstEnd) /* not contiguous */ - ctx->base = dst; - - /* Decompress : frame header */ - if (ctx->phase == 0) - { - /* Check frame magic header */ - U32 magicNumber = ZSTD_readBE32(src); - if (magicNumber != ZSTD_magicNumber) return ERROR(prefix_unknown); - ctx->phase = 1; - ctx->expected = ZSTD_blockHeaderSize; - return 0; - } - - /* Decompress : block header */ - if (ctx->phase == 1) - { - blockProperties_t bp; - size_t blockSize = ZSTDv01_getcBlockSize(src, ZSTD_blockHeaderSize, &bp); - if (ZSTDv01_isError(blockSize)) return blockSize; - if (bp.blockType == bt_end) - { - ctx->expected = 0; - ctx->phase = 0; - } - else - { - ctx->expected = blockSize; - ctx->bType = bp.blockType; - ctx->phase = 2; - } - - return 0; - } - - /* Decompress : block content */ - { - size_t rSize; - switch(ctx->bType) - { - case bt_compressed: - rSize = ZSTD_decompressBlock(ctx, dst, maxDstSize, src, srcSize); - break; - case bt_raw : - rSize = ZSTD_copyUncompressedBlock(dst, maxDstSize, src, srcSize); - break; - case bt_rle : - return ERROR(GENERIC); /* not yet handled */ - break; - case bt_end : /* should never happen (filtered at phase 1) */ - rSize = 0; - break; - default: - return ERROR(GENERIC); - } - ctx->phase = 1; - ctx->expected = ZSTD_blockHeaderSize; - ctx->previousDstEnd = (void*)( ((char*)dst) + rSize); - return rSize; - } - -} diff --git a/vendor/github.com/DataDog/zstd/zstd_v01.h b/vendor/github.com/DataDog/zstd/zstd_v01.h deleted file mode 100644 index 245f9dd3..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_v01.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - -#ifndef ZSTD_V01_H_28739879432 -#define ZSTD_V01_H_28739879432 - -#if defined (__cplusplus) -extern "C" { -#endif - -/* ************************************* -* Includes -***************************************/ -#include /* size_t */ - - -/* ************************************* -* Simple one-step function -***************************************/ -/** -ZSTDv01_decompress() : decompress ZSTD frames compliant with v0.1.x format - compressedSize : is the exact source size - maxOriginalSize : is the size of the 'dst' buffer, which must be already allocated. - It must be equal or larger than originalSize, otherwise decompression will fail. - return : the number of bytes decompressed into destination buffer (originalSize) - or an errorCode if it fails (which can be tested using ZSTDv01_isError()) -*/ -size_t ZSTDv01_decompress( void* dst, size_t maxOriginalSize, - const void* src, size_t compressedSize); - - /** - ZSTDv01_findFrameSizeInfoLegacy() : get the source length and decompressed bound of a ZSTD frame compliant with v0.1.x format - srcSize : The size of the 'src' buffer, at least as large as the frame pointed to by 'src' - cSize (output parameter) : the number of bytes that would be read to decompress this frame - or an error code if it fails (which can be tested using ZSTDv01_isError()) - dBound (output parameter) : an upper-bound for the decompressed size of the data in the frame - or ZSTD_CONTENTSIZE_ERROR if an error occurs - - note : assumes `cSize` and `dBound` are _not_ NULL. - */ -void ZSTDv01_findFrameSizeInfoLegacy(const void *src, size_t srcSize, - size_t* cSize, unsigned long long* dBound); - -/** -ZSTDv01_isError() : tells if the result of ZSTDv01_decompress() is an error -*/ -unsigned ZSTDv01_isError(size_t code); - - -/* ************************************* -* Advanced functions -***************************************/ -typedef struct ZSTDv01_Dctx_s ZSTDv01_Dctx; -ZSTDv01_Dctx* ZSTDv01_createDCtx(void); -size_t ZSTDv01_freeDCtx(ZSTDv01_Dctx* dctx); - -size_t ZSTDv01_decompressDCtx(void* ctx, - void* dst, size_t maxOriginalSize, - const void* src, size_t compressedSize); - -/* ************************************* -* Streaming functions -***************************************/ -size_t ZSTDv01_resetDCtx(ZSTDv01_Dctx* dctx); - -size_t ZSTDv01_nextSrcSizeToDecompress(ZSTDv01_Dctx* dctx); -size_t ZSTDv01_decompressContinue(ZSTDv01_Dctx* dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize); -/** - Use above functions alternatively. - ZSTD_nextSrcSizeToDecompress() tells how much bytes to provide as 'srcSize' to ZSTD_decompressContinue(). - ZSTD_decompressContinue() will use previous data blocks to improve compression if they are located prior to current block. - Result is the number of bytes regenerated within 'dst'. - It can be zero, which is not an error; it just means ZSTD_decompressContinue() has decoded some header. -*/ - -/* ************************************* -* Prefix - version detection -***************************************/ -#define ZSTDv01_magicNumber 0xFD2FB51E /* Big Endian version */ -#define ZSTDv01_magicNumberLE 0x1EB52FFD /* Little Endian version */ - - -#if defined (__cplusplus) -} -#endif - -#endif /* ZSTD_V01_H_28739879432 */ diff --git a/vendor/github.com/DataDog/zstd/zstd_v02.c b/vendor/github.com/DataDog/zstd/zstd_v02.c deleted file mode 100644 index c8783799..00000000 --- a/vendor/github.com/DataDog/zstd/zstd_v02.c +++ /dev/null @@ -1,3514 +0,0 @@ -/* - * Copyright (c) 2016-present, Yann Collet, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under both the BSD-style license (found in the - * LICENSE file in the root directory of this source tree) and the GPLv2 (found - * in the COPYING file in the root directory of this source tree). - * You may select, at your option, one of the above-listed licenses. - */ - - -#include /* size_t, ptrdiff_t */ -#include "zstd_v02.h" -#include "error_private.h" - - -/****************************************** -* Compiler-specific -******************************************/ -#if defined(_MSC_VER) /* Visual Studio */ -# include /* _byteswap_ulong */ -# include /* _byteswap_* */ -#endif - - -/* ****************************************************************** - mem.h - low-level memory access routines - Copyright (C) 2013-2015, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ -#ifndef MEM_H_MODULE -#define MEM_H_MODULE - -#if defined (__cplusplus) -extern "C" { -#endif - -/****************************************** -* Includes -******************************************/ -#include /* size_t, ptrdiff_t */ -#include /* memcpy */ - - -/****************************************** -* Compiler-specific -******************************************/ -#if defined(__GNUC__) -# define MEM_STATIC static __attribute__((unused)) -#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define MEM_STATIC static inline -#elif defined(_MSC_VER) -# define MEM_STATIC static __inline -#else -# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif - - -/**************************************************************** -* Basic Types -*****************************************************************/ -#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# include - typedef uint8_t BYTE; - typedef uint16_t U16; - typedef int16_t S16; - typedef uint32_t U32; - typedef int32_t S32; - typedef uint64_t U64; - typedef int64_t S64; -#else - typedef unsigned char BYTE; - typedef unsigned short U16; - typedef signed short S16; - typedef unsigned int U32; - typedef signed int S32; - typedef unsigned long long U64; - typedef signed long long S64; -#endif - - -/**************************************************************** -* Memory I/O -*****************************************************************/ -/* MEM_FORCE_MEMORY_ACCESS - * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable. - * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal. - * The below switch allow to select different access method for improved performance. - * Method 0 (default) : use `memcpy()`. Safe and portable. - * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable). - * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`. - * Method 2 : direct access. This method is portable but violate C standard. - * It can generate buggy code on targets generating assembly depending on alignment. - * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6) - * See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details. - * Prefer these methods in priority order (0 > 1 > 2) - */ -#ifndef MEM_FORCE_MEMORY_ACCESS /* can be defined externally, on command line for example */ -# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) ) -# define MEM_FORCE_MEMORY_ACCESS 2 -# elif (defined(__INTEL_COMPILER) && !defined(WIN32)) || \ - (defined(__GNUC__) && ( defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) )) -# define MEM_FORCE_MEMORY_ACCESS 1 -# endif -#endif - -MEM_STATIC unsigned MEM_32bits(void) { return sizeof(void*)==4; } -MEM_STATIC unsigned MEM_64bits(void) { return sizeof(void*)==8; } - -MEM_STATIC unsigned MEM_isLittleEndian(void) -{ - const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */ - return one.c[0]; -} - -#if defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==2) - -/* violates C standard on structure alignment. -Only use if no other choice to achieve best performance on target platform */ -MEM_STATIC U16 MEM_read16(const void* memPtr) { return *(const U16*) memPtr; } -MEM_STATIC U32 MEM_read32(const void* memPtr) { return *(const U32*) memPtr; } -MEM_STATIC U64 MEM_read64(const void* memPtr) { return *(const U64*) memPtr; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } - -#elif defined(MEM_FORCE_MEMORY_ACCESS) && (MEM_FORCE_MEMORY_ACCESS==1) - -/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */ -/* currently only defined for gcc and icc */ -typedef union { U16 u16; U32 u32; U64 u64; } __attribute__((packed)) unalign; - -MEM_STATIC U16 MEM_read16(const void* ptr) { return ((const unalign*)ptr)->u16; } -MEM_STATIC U32 MEM_read32(const void* ptr) { return ((const unalign*)ptr)->u32; } -MEM_STATIC U64 MEM_read64(const void* ptr) { return ((const unalign*)ptr)->u64; } - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; } - -#else - -/* default method, safe and standard. - can sometimes prove slower */ - -MEM_STATIC U16 MEM_read16(const void* memPtr) -{ - U16 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -MEM_STATIC U32 MEM_read32(const void* memPtr) -{ - U32 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -MEM_STATIC U64 MEM_read64(const void* memPtr) -{ - U64 val; memcpy(&val, memPtr, sizeof(val)); return val; -} - -MEM_STATIC void MEM_write16(void* memPtr, U16 value) -{ - memcpy(memPtr, &value, sizeof(value)); -} - -#endif // MEM_FORCE_MEMORY_ACCESS - - -MEM_STATIC U16 MEM_readLE16(const void* memPtr) -{ - if (MEM_isLittleEndian()) - return MEM_read16(memPtr); - else - { - const BYTE* p = (const BYTE*)memPtr; - return (U16)(p[0] + (p[1]<<8)); - } -} - -MEM_STATIC void MEM_writeLE16(void* memPtr, U16 val) -{ - if (MEM_isLittleEndian()) - { - MEM_write16(memPtr, val); - } - else - { - BYTE* p = (BYTE*)memPtr; - p[0] = (BYTE)val; - p[1] = (BYTE)(val>>8); - } -} - -MEM_STATIC U32 MEM_readLE24(const void* memPtr) -{ - return MEM_readLE16(memPtr) + (((const BYTE*)memPtr)[2] << 16); -} - -MEM_STATIC U32 MEM_readLE32(const void* memPtr) -{ - if (MEM_isLittleEndian()) - return MEM_read32(memPtr); - else - { - const BYTE* p = (const BYTE*)memPtr; - return (U32)((U32)p[0] + ((U32)p[1]<<8) + ((U32)p[2]<<16) + ((U32)p[3]<<24)); - } -} - - -MEM_STATIC U64 MEM_readLE64(const void* memPtr) -{ - if (MEM_isLittleEndian()) - return MEM_read64(memPtr); - else - { - const BYTE* p = (const BYTE*)memPtr; - return (U64)((U64)p[0] + ((U64)p[1]<<8) + ((U64)p[2]<<16) + ((U64)p[3]<<24) - + ((U64)p[4]<<32) + ((U64)p[5]<<40) + ((U64)p[6]<<48) + ((U64)p[7]<<56)); - } -} - - -MEM_STATIC size_t MEM_readLEST(const void* memPtr) -{ - if (MEM_32bits()) - return (size_t)MEM_readLE32(memPtr); - else - return (size_t)MEM_readLE64(memPtr); -} - -#if defined (__cplusplus) -} -#endif - -#endif /* MEM_H_MODULE */ - - -/* ****************************************************************** - bitstream - Part of NewGen Entropy library - header file (to include) - Copyright (C) 2013-2015, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - Source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ -#ifndef BITSTREAM_H_MODULE -#define BITSTREAM_H_MODULE - -#if defined (__cplusplus) -extern "C" { -#endif - - -/* -* This API consists of small unitary functions, which highly benefit from being inlined. -* Since link-time-optimization is not available for all compilers, -* these functions are defined into a .h to be included. -*/ - - -/********************************************** -* bitStream decompression API (read backward) -**********************************************/ -typedef struct -{ - size_t bitContainer; - unsigned bitsConsumed; - const char* ptr; - const char* start; -} BIT_DStream_t; - -typedef enum { BIT_DStream_unfinished = 0, - BIT_DStream_endOfBuffer = 1, - BIT_DStream_completed = 2, - BIT_DStream_overflow = 3 } BIT_DStream_status; /* result of BIT_reloadDStream() */ - /* 1,2,4,8 would be better for bitmap combinations, but slows down performance a bit ... :( */ - -MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize); -MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, unsigned nbBits); -MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD); -MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* bitD); - - -/****************************************** -* unsafe API -******************************************/ -MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, unsigned nbBits); -/* faster, but works only if nbBits >= 1 */ - - - -/**************************************************************** -* Helper functions -****************************************************************/ -MEM_STATIC unsigned BIT_highbit32 (U32 val) -{ -# if defined(_MSC_VER) /* Visual */ - unsigned long r=0; - _BitScanReverse ( &r, val ); - return (unsigned) r; -# elif defined(__GNUC__) && (__GNUC__ >= 3) /* Use GCC Intrinsic */ - return __builtin_clz (val) ^ 31; -# else /* Software version */ - static const unsigned DeBruijnClz[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 }; - U32 v = val; - unsigned r; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - r = DeBruijnClz[ (U32) (v * 0x07C4ACDDU) >> 27]; - return r; -# endif -} - - - -/********************************************************** -* bitStream decoding -**********************************************************/ - -/*!BIT_initDStream -* Initialize a BIT_DStream_t. -* @bitD : a pointer to an already allocated BIT_DStream_t structure -* @srcBuffer must point at the beginning of a bitStream -* @srcSize must be the exact size of the bitStream -* @result : size of stream (== srcSize) or an errorCode if a problem is detected -*/ -MEM_STATIC size_t BIT_initDStream(BIT_DStream_t* bitD, const void* srcBuffer, size_t srcSize) -{ - if (srcSize < 1) { memset(bitD, 0, sizeof(*bitD)); return ERROR(srcSize_wrong); } - - if (srcSize >= sizeof(size_t)) /* normal case */ - { - U32 contain32; - bitD->start = (const char*)srcBuffer; - bitD->ptr = (const char*)srcBuffer + srcSize - sizeof(size_t); - bitD->bitContainer = MEM_readLEST(bitD->ptr); - contain32 = ((const BYTE*)srcBuffer)[srcSize-1]; - if (contain32 == 0) return ERROR(GENERIC); /* endMark not present */ - bitD->bitsConsumed = 8 - BIT_highbit32(contain32); - } - else - { - U32 contain32; - bitD->start = (const char*)srcBuffer; - bitD->ptr = bitD->start; - bitD->bitContainer = *(const BYTE*)(bitD->start); - switch(srcSize) - { - case 7: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[6]) << (sizeof(size_t)*8 - 16); - /* fallthrough */ - case 6: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[5]) << (sizeof(size_t)*8 - 24); - /* fallthrough */ - case 5: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[4]) << (sizeof(size_t)*8 - 32); - /* fallthrough */ - case 4: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[3]) << 24; - /* fallthrough */ - case 3: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[2]) << 16; - /* fallthrough */ - case 2: bitD->bitContainer += (size_t)(((const BYTE*)(bitD->start))[1]) << 8; - /* fallthrough */ - default:; - } - contain32 = ((const BYTE*)srcBuffer)[srcSize-1]; - if (contain32 == 0) return ERROR(GENERIC); /* endMark not present */ - bitD->bitsConsumed = 8 - BIT_highbit32(contain32); - bitD->bitsConsumed += (U32)(sizeof(size_t) - srcSize)*8; - } - - return srcSize; -} - -MEM_STATIC size_t BIT_lookBits(BIT_DStream_t* bitD, U32 nbBits) -{ - const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; - return ((bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> 1) >> ((bitMask-nbBits) & bitMask); -} - -/*! BIT_lookBitsFast : -* unsafe version; only works only if nbBits >= 1 */ -MEM_STATIC size_t BIT_lookBitsFast(BIT_DStream_t* bitD, U32 nbBits) -{ - const U32 bitMask = sizeof(bitD->bitContainer)*8 - 1; - return (bitD->bitContainer << (bitD->bitsConsumed & bitMask)) >> (((bitMask+1)-nbBits) & bitMask); -} - -MEM_STATIC void BIT_skipBits(BIT_DStream_t* bitD, U32 nbBits) -{ - bitD->bitsConsumed += nbBits; -} - -MEM_STATIC size_t BIT_readBits(BIT_DStream_t* bitD, U32 nbBits) -{ - size_t value = BIT_lookBits(bitD, nbBits); - BIT_skipBits(bitD, nbBits); - return value; -} - -/*!BIT_readBitsFast : -* unsafe version; only works only if nbBits >= 1 */ -MEM_STATIC size_t BIT_readBitsFast(BIT_DStream_t* bitD, U32 nbBits) -{ - size_t value = BIT_lookBitsFast(bitD, nbBits); - BIT_skipBits(bitD, nbBits); - return value; -} - -MEM_STATIC BIT_DStream_status BIT_reloadDStream(BIT_DStream_t* bitD) -{ - if (bitD->bitsConsumed > (sizeof(bitD->bitContainer)*8)) /* should never happen */ - return BIT_DStream_overflow; - - if (bitD->ptr >= bitD->start + sizeof(bitD->bitContainer)) - { - bitD->ptr -= bitD->bitsConsumed >> 3; - bitD->bitsConsumed &= 7; - bitD->bitContainer = MEM_readLEST(bitD->ptr); - return BIT_DStream_unfinished; - } - if (bitD->ptr == bitD->start) - { - if (bitD->bitsConsumed < sizeof(bitD->bitContainer)*8) return BIT_DStream_endOfBuffer; - return BIT_DStream_completed; - } - { - U32 nbBytes = bitD->bitsConsumed >> 3; - BIT_DStream_status result = BIT_DStream_unfinished; - if (bitD->ptr - nbBytes < bitD->start) - { - nbBytes = (U32)(bitD->ptr - bitD->start); /* ptr > start */ - result = BIT_DStream_endOfBuffer; - } - bitD->ptr -= nbBytes; - bitD->bitsConsumed -= nbBytes*8; - bitD->bitContainer = MEM_readLEST(bitD->ptr); /* reminder : srcSize > sizeof(bitD) */ - return result; - } -} - -/*! BIT_endOfDStream -* @return Tells if DStream has reached its exact end -*/ -MEM_STATIC unsigned BIT_endOfDStream(const BIT_DStream_t* DStream) -{ - return ((DStream->ptr == DStream->start) && (DStream->bitsConsumed == sizeof(DStream->bitContainer)*8)); -} - -#if defined (__cplusplus) -} -#endif - -#endif /* BITSTREAM_H_MODULE */ -/* ****************************************************************** - Error codes and messages - Copyright (C) 2013-2015, Yann Collet - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - Source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ -#ifndef ERROR_H_MODULE -#define ERROR_H_MODULE - -#if defined (__cplusplus) -extern "C" { -#endif - - -/****************************************** -* Compiler-specific -******************************************/ -#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -# define ERR_STATIC static inline -#elif defined(_MSC_VER) -# define ERR_STATIC static __inline -#elif defined(__GNUC__) -# define ERR_STATIC static __attribute__((unused)) -#else -# define ERR_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */ -#endif - - -/****************************************** -* Error Management -******************************************/ -#define PREFIX(name) ZSTD_error_##name - -#define ERROR(name) (size_t)-PREFIX(name) - -#define ERROR_LIST(ITEM) \ - ITEM(PREFIX(No_Error)) ITEM(PREFIX(GENERIC)) \ - ITEM(PREFIX(dstSize_tooSmall)) ITEM(PREFIX(srcSize_wrong)) \ - ITEM(PREFIX(prefix_unknown)) ITEM(PREFIX(corruption_detected)) \ - ITEM(PREFIX(tableLog_tooLarge)) ITEM(PREFIX(maxSymbolValue_tooLarge)) ITEM(PREFIX(maxSymbolValue_tooSmall)) \ - ITEM(PREFIX(maxCode)) - -#define ERROR_GENERATE_ENUM(ENUM) ENUM, -typedef enum { ERROR_LIST(ERROR_GENERATE_ENUM) } ERR_codes; /* enum is exposed, to detect & handle specific errors; compare function result to -enum value */ - -#define ERROR_CONVERTTOSTRING(STRING) #STRING, -#define ERROR_GENERATE_STRING(EXPR) ERROR_CONVERTTOSTRING(EXPR) -static const char* ERR_strings[] = { ERROR_LIST(ERROR_GENERATE_STRING) }; - -ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); } - -ERR_STATIC const char* ERR_getErrorName(size_t code) -{ - static const char* codeError = "Unspecified error code"; - if (ERR_isError(code)) return ERR_strings[-(int)(code)]; - return codeError; -} - - -#if defined (__cplusplus) -} -#endif - -#endif /* ERROR_H_MODULE */ -/* -Constructor and Destructor of type FSE_CTable - Note that its size depends on 'tableLog' and 'maxSymbolValue' */ -typedef unsigned FSE_CTable; /* don't allocate that. It's just a way to be more restrictive than void* */ -typedef unsigned FSE_DTable; /* don't allocate that. It's just a way to be more restrictive than void* */ - - -/* ****************************************************************** - FSE : Finite State Entropy coder - header file for static linking (only) - Copyright (C) 2013-2015, Yann Collet - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - Source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ -#if defined (__cplusplus) -extern "C" { -#endif - - -/****************************************** -* Static allocation -******************************************/ -/* FSE buffer bounds */ -#define FSE_NCOUNTBOUND 512 -#define FSE_BLOCKBOUND(size) (size + (size>>7)) -#define FSE_COMPRESSBOUND(size) (FSE_NCOUNTBOUND + FSE_BLOCKBOUND(size)) /* Macro version, useful for static allocation */ - -/* You can statically allocate FSE CTable/DTable as a table of unsigned using below macro */ -#define FSE_CTABLE_SIZE_U32(maxTableLog, maxSymbolValue) (1 + (1<<(maxTableLog-1)) + ((maxSymbolValue+1)*2)) -#define FSE_DTABLE_SIZE_U32(maxTableLog) (1 + (1<= 1 (otherwise, result will be corrupted) */ - - -/****************************************** -* Implementation of inline functions -******************************************/ - -/* decompression */ - -typedef struct { - U16 tableLog; - U16 fastMode; -} FSE_DTableHeader; /* sizeof U32 */ - -typedef struct -{ - unsigned short newState; - unsigned char symbol; - unsigned char nbBits; -} FSE_decode_t; /* size == U32 */ - -MEM_STATIC void FSE_initDState(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD, const FSE_DTable* dt) -{ - FSE_DTableHeader DTableH; - memcpy(&DTableH, dt, sizeof(DTableH)); - DStatePtr->state = BIT_readBits(bitD, DTableH.tableLog); - BIT_reloadDStream(bitD); - DStatePtr->table = dt + 1; -} - -MEM_STATIC BYTE FSE_decodeSymbol(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD) -{ - const FSE_decode_t DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; - const U32 nbBits = DInfo.nbBits; - BYTE symbol = DInfo.symbol; - size_t lowBits = BIT_readBits(bitD, nbBits); - - DStatePtr->state = DInfo.newState + lowBits; - return symbol; -} - -MEM_STATIC BYTE FSE_decodeSymbolFast(FSE_DState_t* DStatePtr, BIT_DStream_t* bitD) -{ - const FSE_decode_t DInfo = ((const FSE_decode_t*)(DStatePtr->table))[DStatePtr->state]; - const U32 nbBits = DInfo.nbBits; - BYTE symbol = DInfo.symbol; - size_t lowBits = BIT_readBitsFast(bitD, nbBits); - - DStatePtr->state = DInfo.newState + lowBits; - return symbol; -} - -MEM_STATIC unsigned FSE_endOfDState(const FSE_DState_t* DStatePtr) -{ - return DStatePtr->state == 0; -} - - -#if defined (__cplusplus) -} -#endif -/* ****************************************************************** - Huff0 : Huffman coder, part of New Generation Entropy library - header file for static linking (only) - Copyright (C) 2013-2015, Yann Collet - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - Source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ - -#if defined (__cplusplus) -extern "C" { -#endif - -/****************************************** -* Static allocation macros -******************************************/ -/* Huff0 buffer bounds */ -#define HUF_CTABLEBOUND 129 -#define HUF_BLOCKBOUND(size) (size + (size>>8) + 8) /* only true if incompressible pre-filtered with fast heuristic */ -#define HUF_COMPRESSBOUND(size) (HUF_CTABLEBOUND + HUF_BLOCKBOUND(size)) /* Macro version, useful for static allocation */ - -/* static allocation of Huff0's DTable */ -#define HUF_DTABLE_SIZE(maxTableLog) (1 + (1< /* size_t */ - - -/* ************************************* -* Version -***************************************/ -#define ZSTD_VERSION_MAJOR 0 /* for breaking interface changes */ -#define ZSTD_VERSION_MINOR 2 /* for new (non-breaking) interface capabilities */ -#define ZSTD_VERSION_RELEASE 2 /* for tweaks, bug-fixes, or development */ -#define ZSTD_VERSION_NUMBER (ZSTD_VERSION_MAJOR *100*100 + ZSTD_VERSION_MINOR *100 + ZSTD_VERSION_RELEASE) - - -/* ************************************* -* Advanced functions -***************************************/ -typedef struct ZSTD_CCtx_s ZSTD_CCtx; /* incomplete type */ - -#if defined (__cplusplus) -} -#endif -/* - zstd - standard compression library - Header File for static linking only - Copyright (C) 2014-2015, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - zstd source repository : https://github.com/Cyan4973/zstd - - ztsd public forum : https://groups.google.com/forum/#!forum/lz4c -*/ - -/* The objects defined into this file should be considered experimental. - * They are not labelled stable, as their prototype may change in the future. - * You can use them for tests, provide feedback, or if you can endure risk of future changes. - */ - -#if defined (__cplusplus) -extern "C" { -#endif - -/* ************************************* -* Streaming functions -***************************************/ - -typedef struct ZSTD_DCtx_s ZSTD_DCtx; - -/* - Use above functions alternatively. - ZSTD_nextSrcSizeToDecompress() tells how much bytes to provide as 'srcSize' to ZSTD_decompressContinue(). - ZSTD_decompressContinue() will use previous data blocks to improve compression if they are located prior to current block. - Result is the number of bytes regenerated within 'dst'. - It can be zero, which is not an error; it just means ZSTD_decompressContinue() has decoded some header. -*/ - -/* ************************************* -* Prefix - version detection -***************************************/ -#define ZSTD_magicNumber 0xFD2FB522 /* v0.2 (current)*/ - - -#if defined (__cplusplus) -} -#endif -/* ****************************************************************** - FSE : Finite State Entropy coder - Copyright (C) 2013-2015, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ - -#ifndef FSE_COMMONDEFS_ONLY - -/**************************************************************** -* Tuning parameters -****************************************************************/ -/* MEMORY_USAGE : -* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) -* Increasing memory usage improves compression ratio -* Reduced memory usage can improve speed, due to cache effect -* Recommended max value is 14, for 16KB, which nicely fits into Intel x86 L1 cache */ -#define FSE_MAX_MEMORY_USAGE 14 -#define FSE_DEFAULT_MEMORY_USAGE 13 - -/* FSE_MAX_SYMBOL_VALUE : -* Maximum symbol value authorized. -* Required for proper stack allocation */ -#define FSE_MAX_SYMBOL_VALUE 255 - - -/**************************************************************** -* template functions type & suffix -****************************************************************/ -#define FSE_FUNCTION_TYPE BYTE -#define FSE_FUNCTION_EXTENSION - - -/**************************************************************** -* Byte symbol type -****************************************************************/ -#endif /* !FSE_COMMONDEFS_ONLY */ - - -/**************************************************************** -* Compiler specifics -****************************************************************/ -#ifdef _MSC_VER /* Visual Studio */ -# define FORCE_INLINE static __forceinline -# include /* For Visual 2005 */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -# pragma warning(disable : 4214) /* disable: C4214: non-int bitfields */ -#else -# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ -# ifdef __GNUC__ -# define FORCE_INLINE static inline __attribute__((always_inline)) -# else -# define FORCE_INLINE static inline -# endif -# else -# define FORCE_INLINE static -# endif /* __STDC_VERSION__ */ -#endif - - -/**************************************************************** -* Includes -****************************************************************/ -#include /* malloc, free, qsort */ -#include /* memcpy, memset */ -#include /* printf (debug) */ - -/**************************************************************** -* Constants -*****************************************************************/ -#define FSE_MAX_TABLELOG (FSE_MAX_MEMORY_USAGE-2) -#define FSE_MAX_TABLESIZE (1U< FSE_TABLELOG_ABSOLUTE_MAX -#error "FSE_MAX_TABLELOG > FSE_TABLELOG_ABSOLUTE_MAX is not supported" -#endif - - -/**************************************************************** -* Error Management -****************************************************************/ -#define FSE_STATIC_ASSERT(c) { enum { FSE_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ - - -/**************************************************************** -* Complex types -****************************************************************/ -typedef U32 DTable_max_t[FSE_DTABLE_SIZE_U32(FSE_MAX_TABLELOG)]; - - -/**************************************************************** -* Templates -****************************************************************/ -/* - designed to be included - for type-specific functions (template emulation in C) - Objective is to write these functions only once, for improved maintenance -*/ - -/* safety checks */ -#ifndef FSE_FUNCTION_EXTENSION -# error "FSE_FUNCTION_EXTENSION must be defined" -#endif -#ifndef FSE_FUNCTION_TYPE -# error "FSE_FUNCTION_TYPE must be defined" -#endif - -/* Function names */ -#define FSE_CAT(X,Y) X##Y -#define FSE_FUNCTION_NAME(X,Y) FSE_CAT(X,Y) -#define FSE_TYPE_NAME(X,Y) FSE_CAT(X,Y) - - -/* Function templates */ - -#define FSE_DECODE_TYPE FSE_decode_t - -static U32 FSE_tableStep(U32 tableSize) { return (tableSize>>1) + (tableSize>>3) + 3; } - -static size_t FSE_buildDTable -(FSE_DTable* dt, const short* normalizedCounter, unsigned maxSymbolValue, unsigned tableLog) -{ - void* ptr = dt+1; - FSE_DECODE_TYPE* const tableDecode = (FSE_DECODE_TYPE*)ptr; - FSE_DTableHeader DTableH; - const U32 tableSize = 1 << tableLog; - const U32 tableMask = tableSize-1; - const U32 step = FSE_tableStep(tableSize); - U16 symbolNext[FSE_MAX_SYMBOL_VALUE+1]; - U32 position = 0; - U32 highThreshold = tableSize-1; - const S16 largeLimit= (S16)(1 << (tableLog-1)); - U32 noLarge = 1; - U32 s; - - /* Sanity Checks */ - if (maxSymbolValue > FSE_MAX_SYMBOL_VALUE) return ERROR(maxSymbolValue_tooLarge); - if (tableLog > FSE_MAX_TABLELOG) return ERROR(tableLog_tooLarge); - - /* Init, lay down lowprob symbols */ - DTableH.tableLog = (U16)tableLog; - for (s=0; s<=maxSymbolValue; s++) - { - if (normalizedCounter[s]==-1) - { - tableDecode[highThreshold--].symbol = (FSE_FUNCTION_TYPE)s; - symbolNext[s] = 1; - } - else - { - if (normalizedCounter[s] >= largeLimit) noLarge=0; - symbolNext[s] = normalizedCounter[s]; - } - } - - /* Spread symbols */ - for (s=0; s<=maxSymbolValue; s++) - { - int i; - for (i=0; i highThreshold) position = (position + step) & tableMask; /* lowprob area */ - } - } - - if (position!=0) return ERROR(GENERIC); /* position must reach all cells once, otherwise normalizedCounter is incorrect */ - - /* Build Decoding table */ - { - U32 i; - for (i=0; i FSE_TABLELOG_ABSOLUTE_MAX) return ERROR(tableLog_tooLarge); - bitStream >>= 4; - bitCount = 4; - *tableLogPtr = nbBits; - remaining = (1<1) && (charnum<=*maxSVPtr)) - { - if (previous0) - { - unsigned n0 = charnum; - while ((bitStream & 0xFFFF) == 0xFFFF) - { - n0+=24; - if (ip < iend-5) - { - ip+=2; - bitStream = MEM_readLE32(ip) >> bitCount; - } - else - { - bitStream >>= 16; - bitCount+=16; - } - } - while ((bitStream & 3) == 3) - { - n0+=3; - bitStream>>=2; - bitCount+=2; - } - n0 += bitStream & 3; - bitCount += 2; - if (n0 > *maxSVPtr) return ERROR(maxSymbolValue_tooSmall); - while (charnum < n0) normalizedCounter[charnum++] = 0; - if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) - { - ip += bitCount>>3; - bitCount &= 7; - bitStream = MEM_readLE32(ip) >> bitCount; - } - else - bitStream >>= 2; - } - { - const short max = (short)((2*threshold-1)-remaining); - short count; - - if ((bitStream & (threshold-1)) < (U32)max) - { - count = (short)(bitStream & (threshold-1)); - bitCount += nbBits-1; - } - else - { - count = (short)(bitStream & (2*threshold-1)); - if (count >= threshold) count -= max; - bitCount += nbBits; - } - - count--; /* extra accuracy */ - remaining -= FSE_abs(count); - normalizedCounter[charnum++] = count; - previous0 = !count; - while (remaining < threshold) - { - nbBits--; - threshold >>= 1; - } - - { - if ((ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) - { - ip += bitCount>>3; - bitCount &= 7; - } - else - { - bitCount -= (int)(8 * (iend - 4 - ip)); - ip = iend - 4; - } - bitStream = MEM_readLE32(ip) >> (bitCount & 31); - } - } - } - if (remaining != 1) return ERROR(GENERIC); - *maxSVPtr = charnum-1; - - ip += (bitCount+7)>>3; - if ((size_t)(ip-istart) > hbSize) return ERROR(srcSize_wrong); - return ip-istart; -} - - -/********************************************************* -* Decompression (Byte symbols) -*********************************************************/ -static size_t FSE_buildDTable_rle (FSE_DTable* dt, BYTE symbolValue) -{ - void* ptr = dt; - FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr; - FSE_decode_t* const cell = (FSE_decode_t*)(ptr) + 1; /* because dt is unsigned */ - - DTableH->tableLog = 0; - DTableH->fastMode = 0; - - cell->newState = 0; - cell->symbol = symbolValue; - cell->nbBits = 0; - - return 0; -} - - -static size_t FSE_buildDTable_raw (FSE_DTable* dt, unsigned nbBits) -{ - void* ptr = dt; - FSE_DTableHeader* const DTableH = (FSE_DTableHeader*)ptr; - FSE_decode_t* const dinfo = (FSE_decode_t*)(ptr) + 1; /* because dt is unsigned */ - const unsigned tableSize = 1 << nbBits; - const unsigned tableMask = tableSize - 1; - const unsigned maxSymbolValue = tableMask; - unsigned s; - - /* Sanity checks */ - if (nbBits < 1) return ERROR(GENERIC); /* min size */ - - /* Build Decoding Table */ - DTableH->tableLog = (U16)nbBits; - DTableH->fastMode = 1; - for (s=0; s<=maxSymbolValue; s++) - { - dinfo[s].newState = 0; - dinfo[s].symbol = (BYTE)s; - dinfo[s].nbBits = (BYTE)nbBits; - } - - return 0; -} - -FORCE_INLINE size_t FSE_decompress_usingDTable_generic( - void* dst, size_t maxDstSize, - const void* cSrc, size_t cSrcSize, - const FSE_DTable* dt, const unsigned fast) -{ - BYTE* const ostart = (BYTE*) dst; - BYTE* op = ostart; - BYTE* const omax = op + maxDstSize; - BYTE* const olimit = omax-3; - - BIT_DStream_t bitD; - FSE_DState_t state1; - FSE_DState_t state2; - size_t errorCode; - - /* Init */ - errorCode = BIT_initDStream(&bitD, cSrc, cSrcSize); /* replaced last arg by maxCompressed Size */ - if (FSE_isError(errorCode)) return errorCode; - - FSE_initDState(&state1, &bitD, dt); - FSE_initDState(&state2, &bitD, dt); - -#define FSE_GETSYMBOL(statePtr) fast ? FSE_decodeSymbolFast(statePtr, &bitD) : FSE_decodeSymbol(statePtr, &bitD) - - /* 4 symbols per loop */ - for ( ; (BIT_reloadDStream(&bitD)==BIT_DStream_unfinished) && (op sizeof(bitD.bitContainer)*8) /* This test must be static */ - BIT_reloadDStream(&bitD); - - op[1] = FSE_GETSYMBOL(&state2); - - if (FSE_MAX_TABLELOG*4+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */ - { if (BIT_reloadDStream(&bitD) > BIT_DStream_unfinished) { op+=2; break; } } - - op[2] = FSE_GETSYMBOL(&state1); - - if (FSE_MAX_TABLELOG*2+7 > sizeof(bitD.bitContainer)*8) /* This test must be static */ - BIT_reloadDStream(&bitD); - - op[3] = FSE_GETSYMBOL(&state2); - } - - /* tail */ - /* note : BIT_reloadDStream(&bitD) >= FSE_DStream_partiallyFilled; Ends at exactly BIT_DStream_completed */ - while (1) - { - if ( (BIT_reloadDStream(&bitD)>BIT_DStream_completed) || (op==omax) || (BIT_endOfDStream(&bitD) && (fast || FSE_endOfDState(&state1))) ) - break; - - *op++ = FSE_GETSYMBOL(&state1); - - if ( (BIT_reloadDStream(&bitD)>BIT_DStream_completed) || (op==omax) || (BIT_endOfDStream(&bitD) && (fast || FSE_endOfDState(&state2))) ) - break; - - *op++ = FSE_GETSYMBOL(&state2); - } - - /* end ? */ - if (BIT_endOfDStream(&bitD) && FSE_endOfDState(&state1) && FSE_endOfDState(&state2)) - return op-ostart; - - if (op==omax) return ERROR(dstSize_tooSmall); /* dst buffer is full, but cSrc unfinished */ - - return ERROR(corruption_detected); -} - - -static size_t FSE_decompress_usingDTable(void* dst, size_t originalSize, - const void* cSrc, size_t cSrcSize, - const FSE_DTable* dt) -{ - FSE_DTableHeader DTableH; - memcpy(&DTableH, dt, sizeof(DTableH)); - - /* select fast mode (static) */ - if (DTableH.fastMode) return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 1); - return FSE_decompress_usingDTable_generic(dst, originalSize, cSrc, cSrcSize, dt, 0); -} - - -static size_t FSE_decompress(void* dst, size_t maxDstSize, const void* cSrc, size_t cSrcSize) -{ - const BYTE* const istart = (const BYTE*)cSrc; - const BYTE* ip = istart; - short counting[FSE_MAX_SYMBOL_VALUE+1]; - DTable_max_t dt; /* Static analyzer seems unable to understand this table will be properly initialized later */ - unsigned tableLog; - unsigned maxSymbolValue = FSE_MAX_SYMBOL_VALUE; - size_t errorCode; - - if (cSrcSize<2) return ERROR(srcSize_wrong); /* too small input size */ - - /* normal FSE decoding mode */ - errorCode = FSE_readNCount (counting, &maxSymbolValue, &tableLog, istart, cSrcSize); - if (FSE_isError(errorCode)) return errorCode; - if (errorCode >= cSrcSize) return ERROR(srcSize_wrong); /* too small input size */ - ip += errorCode; - cSrcSize -= errorCode; - - errorCode = FSE_buildDTable (dt, counting, maxSymbolValue, tableLog); - if (FSE_isError(errorCode)) return errorCode; - - /* always return, even if it is an error code */ - return FSE_decompress_usingDTable (dst, maxDstSize, ip, cSrcSize, dt); -} - - - -#endif /* FSE_COMMONDEFS_ONLY */ -/* ****************************************************************** - Huff0 : Huffman coder, part of New Generation Entropy library - Copyright (C) 2013-2015, Yann Collet. - - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : - - FSE+Huff0 source repository : https://github.com/Cyan4973/FiniteStateEntropy - - Public forum : https://groups.google.com/forum/#!forum/lz4c -****************************************************************** */ - -/**************************************************************** -* Compiler specifics -****************************************************************/ -#if defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) -/* inline is defined */ -#elif defined(_MSC_VER) -# define inline __inline -#else -# define inline /* disable inline */ -#endif - - -#ifdef _MSC_VER /* Visual Studio */ -# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ -#endif - - -/**************************************************************** -* Includes -****************************************************************/ -#include /* malloc, free, qsort */ -#include /* memcpy, memset */ -#include /* printf (debug) */ - -/**************************************************************** -* Error Management -****************************************************************/ -#define HUF_STATIC_ASSERT(c) { enum { HUF_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */ - - -/****************************************** -* Helper functions -******************************************/ -static unsigned HUF_isError(size_t code) { return ERR_isError(code); } - -#define HUF_ABSOLUTEMAX_TABLELOG 16 /* absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work */ -#define HUF_MAX_TABLELOG 12 /* max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG */ -#define HUF_DEFAULT_TABLELOG HUF_MAX_TABLELOG /* tableLog by default, when not specified */ -#define HUF_MAX_SYMBOL_VALUE 255 -#if (HUF_MAX_TABLELOG > HUF_ABSOLUTEMAX_TABLELOG) -# error "HUF_MAX_TABLELOG is too large !" -#endif - - - -/********************************************************* -* Huff0 : Huffman block decompression -*********************************************************/ -typedef struct { BYTE byte; BYTE nbBits; } HUF_DEltX2; /* single-symbol decoding */ - -typedef struct { U16 sequence; BYTE nbBits; BYTE length; } HUF_DEltX4; /* double-symbols decoding */ - -typedef struct { BYTE symbol; BYTE weight; } sortedSymbol_t; - -/*! HUF_readStats - Read compact Huffman tree, saved by HUF_writeCTable - @huffWeight : destination buffer - @return : size read from `src` -*/ -static size_t HUF_readStats(BYTE* huffWeight, size_t hwSize, U32* rankStats, - U32* nbSymbolsPtr, U32* tableLogPtr, - const void* src, size_t srcSize) -{ - U32 weightTotal; - U32 tableLog; - const BYTE* ip = (const BYTE*) src; - size_t iSize; - size_t oSize; - U32 n; - - if (!srcSize) return ERROR(srcSize_wrong); - iSize = ip[0]; - //memset(huffWeight, 0, hwSize); /* is not necessary, even though some analyzer complain ... */ - - if (iSize >= 128) /* special header */ - { - if (iSize >= (242)) /* RLE */ - { - static int l[14] = { 1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64, 127, 128 }; - oSize = l[iSize-242]; - memset(huffWeight, 1, hwSize); - iSize = 0; - } - else /* Incompressible */ - { - oSize = iSize - 127; - iSize = ((oSize+1)/2); - if (iSize+1 > srcSize) return ERROR(srcSize_wrong); - if (oSize >= hwSize) return ERROR(corruption_detected); - ip += 1; - for (n=0; n> 4; - huffWeight[n+1] = ip[n/2] & 15; - } - } - } - else /* header compressed with FSE (normal case) */ - { - if (iSize+1 > srcSize) return ERROR(srcSize_wrong); - oSize = FSE_decompress(huffWeight, hwSize-1, ip+1, iSize); /* max (hwSize-1) values decoded, as last one is implied */ - if (FSE_isError(oSize)) return oSize; - } - - /* collect weight stats */ - memset(rankStats, 0, (HUF_ABSOLUTEMAX_TABLELOG + 1) * sizeof(U32)); - weightTotal = 0; - for (n=0; n= HUF_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected); - rankStats[huffWeight[n]]++; - weightTotal += (1 << huffWeight[n]) >> 1; - } - if (weightTotal == 0) return ERROR(corruption_detected); - - /* get last non-null symbol weight (implied, total must be 2^n) */ - tableLog = BIT_highbit32(weightTotal) + 1; - if (tableLog > HUF_ABSOLUTEMAX_TABLELOG) return ERROR(corruption_detected); - { - U32 total = 1 << tableLog; - U32 rest = total - weightTotal; - U32 verif = 1 << BIT_highbit32(rest); - U32 lastWeight = BIT_highbit32(rest) + 1; - if (verif != rest) return ERROR(corruption_detected); /* last value must be a clean power of 2 */ - huffWeight[oSize] = (BYTE)lastWeight; - rankStats[lastWeight]++; - } - - /* check tree construction validity */ - if ((rankStats[1] < 2) || (rankStats[1] & 1)) return ERROR(corruption_detected); /* by construction : at least 2 elts of rank 1, must be even */ - - /* results */ - *nbSymbolsPtr = (U32)(oSize+1); - *tableLogPtr = tableLog; - return iSize+1; -} - - -/**************************/ -/* single-symbol decoding */ -/**************************/ - -static size_t HUF_readDTableX2 (U16* DTable, const void* src, size_t srcSize) -{ - BYTE huffWeight[HUF_MAX_SYMBOL_VALUE + 1]; - U32 rankVal[HUF_ABSOLUTEMAX_TABLELOG + 1]; /* large enough for values from 0 to 16 */ - U32 tableLog = 0; - const BYTE* ip = (const BYTE*) src; - size_t iSize = ip[0]; - U32 nbSymbols = 0; - U32 n; - U32 nextRankStart; - void* ptr = DTable+1; - HUF_DEltX2* const dt = (HUF_DEltX2*)ptr; - - HUF_STATIC_ASSERT(sizeof(HUF_DEltX2) == sizeof(U16)); /* if compilation fails here, assertion is false */ - //memset(huffWeight, 0, sizeof(huffWeight)); /* is not necessary, even though some analyzer complain ... */ - - iSize = HUF_readStats(huffWeight, HUF_MAX_SYMBOL_VALUE + 1, rankVal, &nbSymbols, &tableLog, src, srcSize); - if (HUF_isError(iSize)) return iSize; - - /* check result */ - if (tableLog > DTable[0]) return ERROR(tableLog_tooLarge); /* DTable is too small */ - DTable[0] = (U16)tableLog; /* maybe should separate sizeof DTable, as allocated, from used size of DTable, in case of DTable re-use */ - - /* Prepare ranks */ - nextRankStart = 0; - for (n=1; n<=tableLog; n++) - { - U32 current = nextRankStart; - nextRankStart += (rankVal[n] << (n-1)); - rankVal[n] = current; - } - - /* fill DTable */ - for (n=0; n> 1; - U32 i; - HUF_DEltX2 D; - D.byte = (BYTE)n; D.nbBits = (BYTE)(tableLog + 1 - w); - for (i = rankVal[w]; i < rankVal[w] + length; i++) - dt[i] = D; - rankVal[w] += length; - } - - return iSize; -} - -static BYTE HUF_decodeSymbolX2(BIT_DStream_t* Dstream, const HUF_DEltX2* dt, const U32 dtLog) -{ - const size_t val = BIT_lookBitsFast(Dstream, dtLog); /* note : dtLog >= 1 */ - const BYTE c = dt[val].byte; - BIT_skipBits(Dstream, dt[val].nbBits); - return c; -} - -#define HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr) \ - *ptr++ = HUF_decodeSymbolX2(DStreamPtr, dt, dtLog) - -#define HUF_DECODE_SYMBOLX2_1(ptr, DStreamPtr) \ - if (MEM_64bits() || (HUF_MAX_TABLELOG<=12)) \ - HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr) - -#define HUF_DECODE_SYMBOLX2_2(ptr, DStreamPtr) \ - if (MEM_64bits()) \ - HUF_DECODE_SYMBOLX2_0(ptr, DStreamPtr) - -static inline size_t HUF_decodeStreamX2(BYTE* p, BIT_DStream_t* const bitDPtr, BYTE* const pEnd, const HUF_DEltX2* const dt, const U32 dtLog) -{ - BYTE* const pStart = p; - - /* up to 4 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p <= pEnd-4)) - { - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_1(p, bitDPtr); - HUF_DECODE_SYMBOLX2_2(p, bitDPtr); - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); - } - - /* closer to the end */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p < pEnd)) - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); - - /* no more data to retrieve from bitstream, hence no need to reload */ - while (p < pEnd) - HUF_DECODE_SYMBOLX2_0(p, bitDPtr); - - return pEnd-pStart; -} - - -static size_t HUF_decompress4X2_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const U16* DTable) -{ - if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ - - { - const BYTE* const istart = (const BYTE*) cSrc; - BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; - - const void* ptr = DTable; - const HUF_DEltX2* const dt = ((const HUF_DEltX2*)ptr) +1; - const U32 dtLog = DTable[0]; - size_t errorCode; - - /* Init */ - BIT_DStream_t bitD1; - BIT_DStream_t bitD2; - BIT_DStream_t bitD3; - BIT_DStream_t bitD4; - const size_t length1 = MEM_readLE16(istart); - const size_t length2 = MEM_readLE16(istart+2); - const size_t length3 = MEM_readLE16(istart+4); - size_t length4; - const BYTE* const istart1 = istart + 6; /* jumpTable */ - const BYTE* const istart2 = istart1 + length1; - const BYTE* const istart3 = istart2 + length2; - const BYTE* const istart4 = istart3 + length3; - const size_t segmentSize = (dstSize+3) / 4; - BYTE* const opStart2 = ostart + segmentSize; - BYTE* const opStart3 = opStart2 + segmentSize; - BYTE* const opStart4 = opStart3 + segmentSize; - BYTE* op1 = ostart; - BYTE* op2 = opStart2; - BYTE* op3 = opStart3; - BYTE* op4 = opStart4; - U32 endSignal; - - length4 = cSrcSize - (length1 + length2 + length3 + 6); - if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ - errorCode = BIT_initDStream(&bitD1, istart1, length1); - if (HUF_isError(errorCode)) return errorCode; - errorCode = BIT_initDStream(&bitD2, istart2, length2); - if (HUF_isError(errorCode)) return errorCode; - errorCode = BIT_initDStream(&bitD3, istart3, length3); - if (HUF_isError(errorCode)) return errorCode; - errorCode = BIT_initDStream(&bitD4, istart4, length4); - if (HUF_isError(errorCode)) return errorCode; - - /* 16-32 symbols per loop (4-8 symbols per stream) */ - endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4); - for ( ; (endSignal==BIT_DStream_unfinished) && (op4<(oend-7)) ; ) - { - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_1(op1, &bitD1); - HUF_DECODE_SYMBOLX2_1(op2, &bitD2); - HUF_DECODE_SYMBOLX2_1(op3, &bitD3); - HUF_DECODE_SYMBOLX2_1(op4, &bitD4); - HUF_DECODE_SYMBOLX2_2(op1, &bitD1); - HUF_DECODE_SYMBOLX2_2(op2, &bitD2); - HUF_DECODE_SYMBOLX2_2(op3, &bitD3); - HUF_DECODE_SYMBOLX2_2(op4, &bitD4); - HUF_DECODE_SYMBOLX2_0(op1, &bitD1); - HUF_DECODE_SYMBOLX2_0(op2, &bitD2); - HUF_DECODE_SYMBOLX2_0(op3, &bitD3); - HUF_DECODE_SYMBOLX2_0(op4, &bitD4); - - endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4); - } - - /* check corruption */ - if (op1 > opStart2) return ERROR(corruption_detected); - if (op2 > opStart3) return ERROR(corruption_detected); - if (op3 > opStart4) return ERROR(corruption_detected); - /* note : op4 supposed already verified within main loop */ - - /* finish bitStreams one by one */ - HUF_decodeStreamX2(op1, &bitD1, opStart2, dt, dtLog); - HUF_decodeStreamX2(op2, &bitD2, opStart3, dt, dtLog); - HUF_decodeStreamX2(op3, &bitD3, opStart4, dt, dtLog); - HUF_decodeStreamX2(op4, &bitD4, oend, dt, dtLog); - - /* check */ - endSignal = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4); - if (!endSignal) return ERROR(corruption_detected); - - /* decoded size */ - return dstSize; - } -} - - -static size_t HUF_decompress4X2 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX2(DTable, HUF_MAX_TABLELOG); - const BYTE* ip = (const BYTE*) cSrc; - size_t errorCode; - - errorCode = HUF_readDTableX2 (DTable, cSrc, cSrcSize); - if (HUF_isError(errorCode)) return errorCode; - if (errorCode >= cSrcSize) return ERROR(srcSize_wrong); - ip += errorCode; - cSrcSize -= errorCode; - - return HUF_decompress4X2_usingDTable (dst, dstSize, ip, cSrcSize, DTable); -} - - -/***************************/ -/* double-symbols decoding */ -/***************************/ - -static void HUF_fillDTableX4Level2(HUF_DEltX4* DTable, U32 sizeLog, const U32 consumed, - const U32* rankValOrigin, const int minWeight, - const sortedSymbol_t* sortedSymbols, const U32 sortedListSize, - U32 nbBitsBaseline, U16 baseSeq) -{ - HUF_DEltX4 DElt; - U32 rankVal[HUF_ABSOLUTEMAX_TABLELOG + 1]; - U32 s; - - /* get pre-calculated rankVal */ - memcpy(rankVal, rankValOrigin, sizeof(rankVal)); - - /* fill skipped values */ - if (minWeight>1) - { - U32 i, skipSize = rankVal[minWeight]; - MEM_writeLE16(&(DElt.sequence), baseSeq); - DElt.nbBits = (BYTE)(consumed); - DElt.length = 1; - for (i = 0; i < skipSize; i++) - DTable[i] = DElt; - } - - /* fill DTable */ - for (s=0; s= 1 */ - - rankVal[weight] += length; - } -} - -typedef U32 rankVal_t[HUF_ABSOLUTEMAX_TABLELOG][HUF_ABSOLUTEMAX_TABLELOG + 1]; - -static void HUF_fillDTableX4(HUF_DEltX4* DTable, const U32 targetLog, - const sortedSymbol_t* sortedList, const U32 sortedListSize, - const U32* rankStart, rankVal_t rankValOrigin, const U32 maxWeight, - const U32 nbBitsBaseline) -{ - U32 rankVal[HUF_ABSOLUTEMAX_TABLELOG + 1]; - const int scaleLog = nbBitsBaseline - targetLog; /* note : targetLog >= srcLog, hence scaleLog <= 1 */ - const U32 minBits = nbBitsBaseline - maxWeight; - U32 s; - - memcpy(rankVal, rankValOrigin, sizeof(rankVal)); - - /* fill DTable */ - for (s=0; s= minBits) /* enough room for a second symbol */ - { - U32 sortedRank; - int minWeight = nbBits + scaleLog; - if (minWeight < 1) minWeight = 1; - sortedRank = rankStart[minWeight]; - HUF_fillDTableX4Level2(DTable+start, targetLog-nbBits, nbBits, - rankValOrigin[nbBits], minWeight, - sortedList+sortedRank, sortedListSize-sortedRank, - nbBitsBaseline, symbol); - } - else - { - U32 i; - const U32 end = start + length; - HUF_DEltX4 DElt; - - MEM_writeLE16(&(DElt.sequence), symbol); - DElt.nbBits = (BYTE)(nbBits); - DElt.length = 1; - for (i = start; i < end; i++) - DTable[i] = DElt; - } - rankVal[weight] += length; - } -} - -static size_t HUF_readDTableX4 (U32* DTable, const void* src, size_t srcSize) -{ - BYTE weightList[HUF_MAX_SYMBOL_VALUE + 1]; - sortedSymbol_t sortedSymbol[HUF_MAX_SYMBOL_VALUE + 1]; - U32 rankStats[HUF_ABSOLUTEMAX_TABLELOG + 1] = { 0 }; - U32 rankStart0[HUF_ABSOLUTEMAX_TABLELOG + 2] = { 0 }; - U32* const rankStart = rankStart0+1; - rankVal_t rankVal; - U32 tableLog, maxW, sizeOfSort, nbSymbols; - const U32 memLog = DTable[0]; - const BYTE* ip = (const BYTE*) src; - size_t iSize = ip[0]; - void* ptr = DTable; - HUF_DEltX4* const dt = ((HUF_DEltX4*)ptr) + 1; - - HUF_STATIC_ASSERT(sizeof(HUF_DEltX4) == sizeof(U32)); /* if compilation fails here, assertion is false */ - if (memLog > HUF_ABSOLUTEMAX_TABLELOG) return ERROR(tableLog_tooLarge); - //memset(weightList, 0, sizeof(weightList)); /* is not necessary, even though some analyzer complain ... */ - - iSize = HUF_readStats(weightList, HUF_MAX_SYMBOL_VALUE + 1, rankStats, &nbSymbols, &tableLog, src, srcSize); - if (HUF_isError(iSize)) return iSize; - - /* check result */ - if (tableLog > memLog) return ERROR(tableLog_tooLarge); /* DTable can't fit code depth */ - - /* find maxWeight */ - for (maxW = tableLog; rankStats[maxW]==0; maxW--) - {if (!maxW) return ERROR(GENERIC); } /* necessarily finds a solution before maxW==0 */ - - /* Get start index of each weight */ - { - U32 w, nextRankStart = 0; - for (w=1; w<=maxW; w++) - { - U32 current = nextRankStart; - nextRankStart += rankStats[w]; - rankStart[w] = current; - } - rankStart[0] = nextRankStart; /* put all 0w symbols at the end of sorted list*/ - sizeOfSort = nextRankStart; - } - - /* sort symbols by weight */ - { - U32 s; - for (s=0; s> consumed; - } - } - } - - HUF_fillDTableX4(dt, memLog, - sortedSymbol, sizeOfSort, - rankStart0, rankVal, maxW, - tableLog+1); - - return iSize; -} - - -static U32 HUF_decodeSymbolX4(void* op, BIT_DStream_t* DStream, const HUF_DEltX4* dt, const U32 dtLog) -{ - const size_t val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ - memcpy(op, dt+val, 2); - BIT_skipBits(DStream, dt[val].nbBits); - return dt[val].length; -} - -static U32 HUF_decodeLastSymbolX4(void* op, BIT_DStream_t* DStream, const HUF_DEltX4* dt, const U32 dtLog) -{ - const size_t val = BIT_lookBitsFast(DStream, dtLog); /* note : dtLog >= 1 */ - memcpy(op, dt+val, 1); - if (dt[val].length==1) BIT_skipBits(DStream, dt[val].nbBits); - else - { - if (DStream->bitsConsumed < (sizeof(DStream->bitContainer)*8)) - { - BIT_skipBits(DStream, dt[val].nbBits); - if (DStream->bitsConsumed > (sizeof(DStream->bitContainer)*8)) - DStream->bitsConsumed = (sizeof(DStream->bitContainer)*8); /* ugly hack; works only because it's the last symbol. Note : can't easily extract nbBits from just this symbol */ - } - } - return 1; -} - - -#define HUF_DECODE_SYMBOLX4_0(ptr, DStreamPtr) \ - ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog) - -#define HUF_DECODE_SYMBOLX4_1(ptr, DStreamPtr) \ - if (MEM_64bits() || (HUF_MAX_TABLELOG<=12)) \ - ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog) - -#define HUF_DECODE_SYMBOLX4_2(ptr, DStreamPtr) \ - if (MEM_64bits()) \ - ptr += HUF_decodeSymbolX4(ptr, DStreamPtr, dt, dtLog) - -static inline size_t HUF_decodeStreamX4(BYTE* p, BIT_DStream_t* bitDPtr, BYTE* const pEnd, const HUF_DEltX4* const dt, const U32 dtLog) -{ - BYTE* const pStart = p; - - /* up to 8 symbols at a time */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p < pEnd-7)) - { - HUF_DECODE_SYMBOLX4_2(p, bitDPtr); - HUF_DECODE_SYMBOLX4_1(p, bitDPtr); - HUF_DECODE_SYMBOLX4_2(p, bitDPtr); - HUF_DECODE_SYMBOLX4_0(p, bitDPtr); - } - - /* closer to the end */ - while ((BIT_reloadDStream(bitDPtr) == BIT_DStream_unfinished) && (p <= pEnd-2)) - HUF_DECODE_SYMBOLX4_0(p, bitDPtr); - - while (p <= pEnd-2) - HUF_DECODE_SYMBOLX4_0(p, bitDPtr); /* no need to reload : reached the end of DStream */ - - if (p < pEnd) - p += HUF_decodeLastSymbolX4(p, bitDPtr, dt, dtLog); - - return p-pStart; -} - - - -static size_t HUF_decompress4X4_usingDTable( - void* dst, size_t dstSize, - const void* cSrc, size_t cSrcSize, - const U32* DTable) -{ - if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */ - - { - const BYTE* const istart = (const BYTE*) cSrc; - BYTE* const ostart = (BYTE*) dst; - BYTE* const oend = ostart + dstSize; - - const void* ptr = DTable; - const HUF_DEltX4* const dt = ((const HUF_DEltX4*)ptr) +1; - const U32 dtLog = DTable[0]; - size_t errorCode; - - /* Init */ - BIT_DStream_t bitD1; - BIT_DStream_t bitD2; - BIT_DStream_t bitD3; - BIT_DStream_t bitD4; - const size_t length1 = MEM_readLE16(istart); - const size_t length2 = MEM_readLE16(istart+2); - const size_t length3 = MEM_readLE16(istart+4); - size_t length4; - const BYTE* const istart1 = istart + 6; /* jumpTable */ - const BYTE* const istart2 = istart1 + length1; - const BYTE* const istart3 = istart2 + length2; - const BYTE* const istart4 = istart3 + length3; - const size_t segmentSize = (dstSize+3) / 4; - BYTE* const opStart2 = ostart + segmentSize; - BYTE* const opStart3 = opStart2 + segmentSize; - BYTE* const opStart4 = opStart3 + segmentSize; - BYTE* op1 = ostart; - BYTE* op2 = opStart2; - BYTE* op3 = opStart3; - BYTE* op4 = opStart4; - U32 endSignal; - - length4 = cSrcSize - (length1 + length2 + length3 + 6); - if (length4 > cSrcSize) return ERROR(corruption_detected); /* overflow */ - errorCode = BIT_initDStream(&bitD1, istart1, length1); - if (HUF_isError(errorCode)) return errorCode; - errorCode = BIT_initDStream(&bitD2, istart2, length2); - if (HUF_isError(errorCode)) return errorCode; - errorCode = BIT_initDStream(&bitD3, istart3, length3); - if (HUF_isError(errorCode)) return errorCode; - errorCode = BIT_initDStream(&bitD4, istart4, length4); - if (HUF_isError(errorCode)) return errorCode; - - /* 16-32 symbols per loop (4-8 symbols per stream) */ - endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4); - for ( ; (endSignal==BIT_DStream_unfinished) && (op4<(oend-7)) ; ) - { - HUF_DECODE_SYMBOLX4_2(op1, &bitD1); - HUF_DECODE_SYMBOLX4_2(op2, &bitD2); - HUF_DECODE_SYMBOLX4_2(op3, &bitD3); - HUF_DECODE_SYMBOLX4_2(op4, &bitD4); - HUF_DECODE_SYMBOLX4_1(op1, &bitD1); - HUF_DECODE_SYMBOLX4_1(op2, &bitD2); - HUF_DECODE_SYMBOLX4_1(op3, &bitD3); - HUF_DECODE_SYMBOLX4_1(op4, &bitD4); - HUF_DECODE_SYMBOLX4_2(op1, &bitD1); - HUF_DECODE_SYMBOLX4_2(op2, &bitD2); - HUF_DECODE_SYMBOLX4_2(op3, &bitD3); - HUF_DECODE_SYMBOLX4_2(op4, &bitD4); - HUF_DECODE_SYMBOLX4_0(op1, &bitD1); - HUF_DECODE_SYMBOLX4_0(op2, &bitD2); - HUF_DECODE_SYMBOLX4_0(op3, &bitD3); - HUF_DECODE_SYMBOLX4_0(op4, &bitD4); - - endSignal = BIT_reloadDStream(&bitD1) | BIT_reloadDStream(&bitD2) | BIT_reloadDStream(&bitD3) | BIT_reloadDStream(&bitD4); - } - - /* check corruption */ - if (op1 > opStart2) return ERROR(corruption_detected); - if (op2 > opStart3) return ERROR(corruption_detected); - if (op3 > opStart4) return ERROR(corruption_detected); - /* note : op4 supposed already verified within main loop */ - - /* finish bitStreams one by one */ - HUF_decodeStreamX4(op1, &bitD1, opStart2, dt, dtLog); - HUF_decodeStreamX4(op2, &bitD2, opStart3, dt, dtLog); - HUF_decodeStreamX4(op3, &bitD3, opStart4, dt, dtLog); - HUF_decodeStreamX4(op4, &bitD4, oend, dt, dtLog); - - /* check */ - endSignal = BIT_endOfDStream(&bitD1) & BIT_endOfDStream(&bitD2) & BIT_endOfDStream(&bitD3) & BIT_endOfDStream(&bitD4); - if (!endSignal) return ERROR(corruption_detected); - - /* decoded size */ - return dstSize; - } -} - - -static size_t HUF_decompress4X4 (void* dst, size_t dstSize, const void* cSrc, size_t cSrcSize) -{ - HUF_CREATE_STATIC_DTABLEX4(DTable, HUF_MAX_TABLELOG); - const BYTE* ip = (const BYTE*) cSrc; - - size_t hSize = HUF_readDTableX4 (DTable, cSrc, cSrcSize); - if (HUF_isError(hSize)) return hSize; - if (hSize >= cSrcSize) return ERROR(srcSize_wrong); - ip += hSize; - cSrcSize -= hSize; - - return HUF_decompress4X4_usingDTable (dst, dstSize, ip, cSrcSize, DTable); -} - - -/**********************************/ -/* quad-symbol decoding */ -/**********************************/ -typedef struct { BYTE nbBits; BYTE nbBytes; } HUF_DDescX6; -typedef union { BYTE byte[4]; U32 sequence; } HUF_DSeqX6; - -/* recursive, up to level 3; may benefit from