Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nakama
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public-projects
Nakama
Commits
89e0985b
Commit
89e0985b
authored
4 years ago
by
Andrei Mihu
Browse files
Options
Downloads
Patches
Plain Diff
Add extra gob registration types.
parent
f4cfa6a6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/match_registry.go
+10
-5
10 additions, 5 deletions
server/match_registry.go
server/match_registry_test.go
+35
-0
35 additions, 0 deletions
server/match_registry_test.go
with
45 additions
and
5 deletions
server/match_registry.go
+
10
−
5
View file @
89e0985b
...
...
@@ -20,26 +20,31 @@ import (
"encoding/gob"
"encoding/json"
"fmt"
"github.com/blevesearch/bleve/search/query"
"strings"
"sync"
"time"
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/analysis/analyzer/keyword"
"github.com/blevesearch/bleve/search/query"
"github.com/gofrs/uuid"
"github.com/golang/protobuf/ptypes/wrappers"
"github.com/heroiclabs/nakama-common/api"
"github.com/heroiclabs/nakama-common/runtime"
"github.com/pkg/errors"
"go.uber.org/atomic"
"go.uber.org/zap"
)
func
init
()
{
// Ensure gob can deal with maps of interfaces.
gob
.
Register
(
map
[
string
]
interface
{}{})
// Ensure gob can deal with slices of interfaces.
gob
.
Register
([]
interface
{}{})
// Ensure gob can deal with typical types that might be used in match parameters.
gob
.
Register
(
map
[
string
]
interface
{}(
nil
))
gob
.
Register
([]
interface
{}(
nil
))
gob
.
Register
([]
runtime
.
MatchmakerEntry
(
nil
))
gob
.
Register
(
MatchmakerEntry
{})
gob
.
Register
([]
*
api
.
User
(
nil
))
gob
.
Register
([]
*
api
.
Account
(
nil
))
gob
.
Register
([]
*
api
.
Friend
(
nil
))
}
var
(
...
...
This diff is collapsed.
Click to expand it.
server/match_registry_test.go
0 → 100644
+
35
−
0
View file @
89e0985b
// Copyright 2020 The Nakama Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package
server
import
(
"bytes"
"encoding/gob"
"github.com/gofrs/uuid"
"github.com/heroiclabs/nakama-common/runtime"
"testing"
)
func
TestEncode
(
t
*
testing
.
T
)
{
entries
:=
[]
runtime
.
MatchmakerEntry
{
&
MatchmakerEntry
{
Ticket
:
"123"
,
Presence
:
&
MatchmakerPresence
{
Username
:
"a"
},
SessionID
:
uuid
.
Must
(
uuid
.
NewV4
())},
&
MatchmakerEntry
{
Ticket
:
"456"
,
Presence
:
&
MatchmakerPresence
{
Username
:
"b"
},
SessionID
:
uuid
.
Must
(
uuid
.
NewV4
())},
}
var
buf
bytes
.
Buffer
if
err
:=
gob
.
NewEncoder
(
&
buf
)
.
Encode
(
map
[
string
]
interface
{}{
"foo"
:
entries
});
err
!=
nil
{
t
.
Fatalf
(
"error: %v"
,
err
)
}
t
.
Log
(
"ok"
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment