提交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 (
"fmt"
"github.com/duanhf2012/origin/log"
"github.com/duanhf2012/origin/rpc"
"github.com/duanhf2012/origin/service"
"github.com/duanhf2012/origin/v2/log"
"github.com/duanhf2012/origin/v2/rpc"
"github.com/duanhf2012/origin/v2/service"
"strings"
"sync"
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
package event
import "github.com/duanhf2012/origin/util/sync"
import "github.com/duanhf2012/origin/v2/util/sync"
// eventPool的内存池,缓存Event
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,12 +1,12 @@
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 build -ldflags "-X 'github.com/duanhf2012/origin/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'"
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 BuildTag string

View File

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

View File

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

View File

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

View File

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