提交v2初始版本

This commit is contained in:
boyce
2024-04-09 16:40:13 +08:00
parent 96d02c8f71
commit 161a67c8a1
57 changed files with 123 additions and 123 deletions

View File

@@ -2,9 +2,9 @@ package cluster
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"strings" "strings"
"sync" "sync"
) )

View File

@@ -2,11 +2,11 @@ package cluster
import ( import (
"errors" "errors"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"time" "time"
"github.com/duanhf2012/origin/util/timer" "github.com/duanhf2012/origin/v2/util/timer"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
) )

View File

@@ -2,8 +2,8 @@ package cluster
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
"os" "os"
"path/filepath" "path/filepath"

View File

@@ -4,7 +4,7 @@ import (
"errors" "errors"
"runtime" "runtime"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"sync/atomic" "sync/atomic"
) )

View File

@@ -8,8 +8,8 @@ import (
"fmt" "fmt"
"runtime" "runtime"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/util/queue" "github.com/duanhf2012/origin/v2/util/queue"
) )
var idleTimeout = int64(2 * time.Second) var idleTimeout = int64(2 * time.Second)

View File

@@ -7,7 +7,7 @@ import (
"fmt" "fmt"
"runtime" "runtime"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
) )
type task struct { type task struct {

View File

@@ -2,7 +2,7 @@ package event
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"runtime" "runtime"
"sync" "sync"
) )

View File

@@ -1,6 +1,6 @@
package event package event
import "github.com/duanhf2012/origin/util/sync" import "github.com/duanhf2012/origin/v2/util/sync"
// eventPool的内存池,缓存Event // eventPool的内存池,缓存Event
const defaultMaxEventChannelNum = 2000000 const defaultMaxEventChannelNum = 2000000

2
go.mod
View File

@@ -1,4 +1,4 @@
module github.com/duanhf2012/origin/v2 module github.com/duanhf2012/origin/v2/v2
go 1.21 go 1.21

View File

@@ -3,7 +3,7 @@ package log
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/duanhf2012/origin/util/bytespool" "github.com/duanhf2012/origin/v2/util/bytespool"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
"io" "io"
"log/slog" "log/slog"

View File

@@ -3,7 +3,7 @@ package network
import ( import (
"crypto/tls" "crypto/tls"
"errors" "errors"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"net/http" "net/http"
"time" "time"
) )

View File

@@ -3,8 +3,8 @@ package processor
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/util/bytespool" "github.com/duanhf2012/origin/v2/util/bytespool"
"reflect" "reflect"
) )

View File

@@ -3,7 +3,7 @@ package processor
import ( import (
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"github.com/duanhf2012/origin/util/bytespool" "github.com/duanhf2012/origin/v2/util/bytespool"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"reflect" "reflect"
) )

View File

@@ -1,7 +1,7 @@
package network package network
import ( import (
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"net" "net"
"sync" "sync"
"time" "time"

View File

@@ -2,7 +2,7 @@ package network
import ( import (
"errors" "errors"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"net" "net"
"sync" "sync"
"sync/atomic" "sync/atomic"

View File

@@ -3,7 +3,7 @@ package network
import ( import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"github.com/duanhf2012/origin/util/bytespool" "github.com/duanhf2012/origin/v2/util/bytespool"
"io" "io"
"math" "math"
) )

View File

@@ -1,8 +1,8 @@
package network package network
import ( import (
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/util/bytespool" "github.com/duanhf2012/origin/v2/util/bytespool"
"net" "net"
"sync" "sync"
"time" "time"

View File

@@ -1,7 +1,7 @@
package network package network
import ( import (
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"sync" "sync"
"time" "time"

View File

@@ -2,7 +2,7 @@ package network
import ( import (
"errors" "errors"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"net" "net"
"sync" "sync"

View File

@@ -2,7 +2,7 @@ package network
import ( import (
"crypto/tls" "crypto/tls"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"net" "net"
"net/http" "net/http"

View File

@@ -3,13 +3,13 @@ package node
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/cluster" "github.com/duanhf2012/origin/v2/cluster"
"github.com/duanhf2012/origin/console" "github.com/duanhf2012/origin/v2/console"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/profiler" "github.com/duanhf2012/origin/v2/profiler"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"github.com/duanhf2012/origin/util/buildtime" "github.com/duanhf2012/origin/v2/util/buildtime"
"github.com/duanhf2012/origin/util/timer" "github.com/duanhf2012/origin/v2/util/timer"
"io" "io"
"net/http" "net/http"
_ "net/http/pprof" _ "net/http/pprof"
@@ -19,7 +19,7 @@ import (
"strings" "strings"
"syscall" "syscall"
"time" "time"
"github.com/duanhf2012/origin/util/sysprocess" "github.com/duanhf2012/origin/v2/util/sysprocess"
) )
var sig chan os.Signal var sig chan os.Signal

View File

@@ -3,7 +3,7 @@ package profiler
import ( import (
"container/list" "container/list"
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"sync" "sync"
"time" "time"
) )

View File

@@ -2,13 +2,13 @@ package rpc
import ( import (
"errors" "errors"
"github.com/duanhf2012/origin/network" "github.com/duanhf2012/origin/v2/network"
"reflect" "reflect"
"strconv" "strconv"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
) )
const( const(

View File

@@ -3,7 +3,7 @@ package rpc
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/util/bytespool" "github.com/duanhf2012/origin/v2/util/bytespool"
"github.com/pierrec/lz4/v4" "github.com/pierrec/lz4/v4"
"runtime" "runtime"
) )

View File

@@ -1,7 +1,7 @@
package rpc package rpc
import ( import (
"github.com/duanhf2012/origin/util/sync" "github.com/duanhf2012/origin/v2/util/sync"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
"reflect" "reflect"
) )

View File

@@ -2,8 +2,8 @@ package rpc
import ( import (
"errors" "errors"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/network" "github.com/duanhf2012/origin/v2/network"
"reflect" "reflect"
"strings" "strings"
"sync/atomic" "sync/atomic"

View File

@@ -1,7 +1,7 @@
package rpc package rpc
import ( import (
"github.com/duanhf2012/origin/util/sync" "github.com/duanhf2012/origin/v2/util/sync"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"fmt" "fmt"
) )

View File

@@ -3,8 +3,8 @@ package rpc
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/network" "github.com/duanhf2012/origin/v2/network"
"math" "math"
"reflect" "reflect"
"runtime" "runtime"

View File

@@ -1,7 +1,7 @@
package rpc package rpc
import ( import (
"github.com/duanhf2012/origin/util/sync" "github.com/duanhf2012/origin/v2/util/sync"
"reflect" "reflect"
"time" "time"
) )

View File

@@ -3,7 +3,7 @@ package rpc
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"reflect" "reflect"
"runtime" "runtime"
"strings" "strings"

View File

@@ -3,8 +3,8 @@ package rpc
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/network" "github.com/duanhf2012/origin/v2/network"
"math" "math"
"net" "net"
"reflect" "reflect"

View File

@@ -6,11 +6,11 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/duanhf2012/origin/event" "github.com/duanhf2012/origin/v2/event"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
rpcHandle "github.com/duanhf2012/origin/rpc" rpcHandle "github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/util/timer" "github.com/duanhf2012/origin/v2/util/timer"
"github.com/duanhf2012/origin/concurrent" "github.com/duanhf2012/origin/v2/concurrent"
) )
const InitModuleId = 1e9 const InitModuleId = 1e9

View File

@@ -3,17 +3,17 @@ package service
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/event" "github.com/duanhf2012/origin/v2/event"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/profiler" "github.com/duanhf2012/origin/v2/profiler"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/util/timer" "github.com/duanhf2012/origin/v2/util/timer"
"reflect" "reflect"
"runtime" "runtime"
"strconv" "strconv"
"sync" "sync"
"sync/atomic" "sync/atomic"
"github.com/duanhf2012/origin/concurrent" "github.com/duanhf2012/origin/v2/concurrent"
) )
var timerDispatcherLen = 100000 var timerDispatcherLen = 100000

View File

@@ -10,7 +10,7 @@ import (
"net/url" "net/url"
"time" "time"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
) )
type HttpClientModule struct { type HttpClientModule struct {

View File

@@ -1,7 +1,7 @@
package mongomodule package mongomodule
import ( import (
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"gopkg.in/mgo.v2" "gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson" "gopkg.in/mgo.v2/bson"
"sync" "sync"

View File

@@ -4,7 +4,7 @@ import (
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"net/url" "net/url"
"reflect" "reflect"
"strconv" "strconv"
@@ -12,7 +12,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
) )

View File

@@ -5,11 +5,11 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"strconv" "strconv"
"time" "time"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"github.com/gomodule/redigo/redis" "github.com/gomodule/redigo/redis"
) )

View File

@@ -2,10 +2,10 @@ package httpservice
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/event" "github.com/duanhf2012/origin/v2/event"
"github.com/duanhf2012/origin/network" "github.com/duanhf2012/origin/v2/network"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"github.com/duanhf2012/origin/util/uuid" "github.com/duanhf2012/origin/v2/util/uuid"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
"io" "io"
"net/http" "net/http"

View File

@@ -3,10 +3,10 @@ package messagequeueservice
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/cluster" "github.com/duanhf2012/origin/v2/cluster"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/util/coroutine" "github.com/duanhf2012/origin/v2/util/coroutine"
"strings" "strings"
"sync/atomic" "sync/atomic"
"time" "time"

View File

@@ -1,7 +1,7 @@
package messagequeueservice package messagequeueservice
import ( import (
"github.com/duanhf2012/origin/util/algorithms" "github.com/duanhf2012/origin/v2/util/algorithms"
"sync" "sync"
) )

View File

@@ -3,9 +3,9 @@ package messagequeueservice
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"sync" "sync"
) )

View File

@@ -3,9 +3,9 @@ package messagequeueservice
import ( import (
"errors" "errors"
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"github.com/duanhf2012/origin/sysmodule/mongodbmodule" "github.com/duanhf2012/origin/v2/sysmodule/mongodbmodule"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
"time" "time"

View File

@@ -1,8 +1,8 @@
package messagequeueservice package messagequeueservice
import ( import (
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"sync" "sync"
) )

View File

@@ -2,8 +2,8 @@ package messagequeueservice
import ( import (
"errors" "errors"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/util/coroutine" "github.com/duanhf2012/origin/v2/util/coroutine"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"

View File

@@ -2,10 +2,10 @@ package rankservice
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"github.com/duanhf2012/origin/sysmodule/mongodbmodule" "github.com/duanhf2012/origin/v2/sysmodule/mongodbmodule"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
"runtime" "runtime"

View File

@@ -1,9 +1,9 @@
package rankservice package rankservice
import ( import (
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/util/algorithms/skip" "github.com/duanhf2012/origin/v2/util/algorithms/skip"
"github.com/duanhf2012/origin/util/sync" "github.com/duanhf2012/origin/v2/util/sync"
) )
var emptyRankData RankData var emptyRankData RankData

View File

@@ -2,7 +2,7 @@ package rankservice
import ( import (
"container/heap" "container/heap"
"github.com/duanhf2012/origin/util/sync" "github.com/duanhf2012/origin/v2/util/sync"
"time" "time"
) )

View File

@@ -1,8 +1,8 @@
package rankservice package rankservice
import ( import (
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
) )
type RankDataChangeType int8 type RankDataChangeType int8

View File

@@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
) )
const PreMapRankSkipLen = 10 const PreMapRankSkipLen = 10

View File

@@ -4,8 +4,8 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/duanhf2012/origin/rpc" "github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/util/algorithms/skip" "github.com/duanhf2012/origin/v2/util/algorithms/skip"
) )
type RankSkip struct { type RankSkip struct {

View File

@@ -2,13 +2,13 @@ package tcpservice
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/event" "github.com/duanhf2012/origin/v2/event"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/network" "github.com/duanhf2012/origin/v2/network"
"github.com/duanhf2012/origin/network/processor" "github.com/duanhf2012/origin/v2/network/processor"
"github.com/duanhf2012/origin/node" "github.com/duanhf2012/origin/v2/node"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"github.com/duanhf2012/origin/util/bytespool" "github.com/duanhf2012/origin/v2/util/bytespool"
"runtime" "runtime"
"sync" "sync"
"sync/atomic" "sync/atomic"

View File

@@ -2,12 +2,12 @@ package wsservice
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/event" "github.com/duanhf2012/origin/v2/event"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/network" "github.com/duanhf2012/origin/v2/network"
"github.com/duanhf2012/origin/network/processor" "github.com/duanhf2012/origin/v2/network/processor"
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/v2/service"
"github.com/duanhf2012/origin/node" "github.com/duanhf2012/origin/v2/node"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"

View File

@@ -1,12 +1,12 @@
package buildtime package buildtime
/* /*
//查询buildtime包中的位置在github.com/duanhf2012/origin/util/buildtime.BuildTime中 //查询buildtime包中的位置在github.com/duanhf2012/origin/v2/util/buildtime.BuildTime中
go tool nm ./originserver.exe |grep buildtime go tool nm ./originserver.exe |grep buildtime
//编译传入编译时间信息 //编译传入编译时间信息
go build -ldflags "-X 'github.com/duanhf2012/origin/util/buildtime.BuildTime=20200101'" go build -ldflags "-X 'github.com/duanhf2012/origin/v2/util/buildtime.BuildTime=20200101'"
go build -ldflags "-X github.com/duanhf2012/origin/util/buildtime.BuildTime=20200101 -X github.com/duanhf2012/origin/util/buildtime.BuildTag=debug" go build -ldflags "-X github.com/duanhf2012/origin/v2/util/buildtime.BuildTime=20200101 -X github.com/duanhf2012/origin/v2/util/buildtime.BuildTag=debug"
*/ */
var BuildTime string var BuildTime string
var BuildTag string var BuildTag string

View File

@@ -2,7 +2,7 @@ package coroutine
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"reflect" "reflect"
"runtime/debug" "runtime/debug"
) )

View File

@@ -1,7 +1,7 @@
package math package math
import ( import (
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
) )
type NumberType interface { type NumberType interface {

View File

@@ -2,8 +2,8 @@ package timer
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/log" "github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/util/sync" "github.com/duanhf2012/origin/v2/util/sync"
"reflect" "reflect"
"runtime" "runtime"
"time" "time"

View File

@@ -2,7 +2,7 @@ package umap
import ( import (
"fmt" "fmt"
"github.com/duanhf2012/origin/util/hash" "github.com/duanhf2012/origin/v2/util/hash"
"sync" "sync"
"sync/atomic" "sync/atomic"
) )