binlog

package
v0.0.131 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

*Copyright (c) 2023, kaydxh * *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.

*Copyright (c) 2023, kaydxh * *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.

*Copyright (c) 2022, kaydxh * *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.

*Copyright (c) 2022, kaydxh * *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.

*Copyright (c) 2023, kaydxh * *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.

*Copyright (c) 2022, kaydxh * *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.

*Copyright (c) 2022, kaydxh * *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.

Index

Constants

View Source
const (
	ArchiveTaskScheme = "ArchiveTaskTask"
)

Variables

View Source
var (
	BinlogType_name = map[int32]string{
		0: "BinlogType_DB",
		1: "BinlogType_File",
	}
	BinlogType_value = map[string]int32{
		"BinlogType_DB":   0,
		"BinlogType_File": 1,
	}
)

Enum value maps for BinlogType.

View Source
var File_pkg_binlog_binlog_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type ArchiveTask

type ArchiveTask struct {
	// contains filtered or unexported fields
}

func (ArchiveTask) Scheme

func (t ArchiveTask) Scheme() string

func (ArchiveTask) TaskHandler

func (t ArchiveTask) TaskHandler(ctx context.Context, msg *queue_.Message) (*queue_.MessageResult, error)

type ArchiveTaskArgs

type ArchiveTaskArgs struct {
	LocalFilePath  string
	RemoteRootPath string
}

type Binlog

type Binlog struct {
	Enabled          bool               `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
	BinlogType       BinlogType         `protobuf:"varint,2,opt,name=binlog_type,json=binlogType,proto3,enum=go.pkg.binlog.BinlogType" json:"binlog_type,omitempty"`
	FlushBatchSize   int64              `protobuf:"varint,3,opt,name=flush_batch_size,json=flushBatchSize,proto3" json:"flush_batch_size,omitempty"`
	MaxFlushInterval *duration.Duration `protobuf:"bytes,4,opt,name=max_flush_interval,json=maxFlushInterval,proto3" json:"max_flush_interval,omitempty"`
	FlushTimeout     *duration.Duration `protobuf:"bytes,5,opt,name=flush_timeout,json=flushTimeout,proto3" json:"flush_timeout,omitempty"`
	DbLog            *Binlog_DBLog      `protobuf:"bytes,20,opt,name=db_log,json=dbLog,proto3" json:"db_log,omitempty"`
	FileLog          *Binlog_FileLog    `protobuf:"bytes,21,opt,name=file_log,json=fileLog,proto3" json:"file_log,omitempty"`
	// contains filtered or unexported fields
}

func (*Binlog) Descriptor deprecated

func (*Binlog) Descriptor() ([]byte, []int)

Deprecated: Use Binlog.ProtoReflect.Descriptor instead.

func (*Binlog) GetBinlogType

func (x *Binlog) GetBinlogType() BinlogType

func (*Binlog) GetDbLog

func (x *Binlog) GetDbLog() *Binlog_DBLog

func (*Binlog) GetEnabled

func (x *Binlog) GetEnabled() bool

func (*Binlog) GetFileLog

func (x *Binlog) GetFileLog() *Binlog_FileLog

func (*Binlog) GetFlushBatchSize

func (x *Binlog) GetFlushBatchSize() int64

func (*Binlog) GetFlushTimeout

func (x *Binlog) GetFlushTimeout() *duration.Duration

func (*Binlog) GetMaxFlushInterval

func (x *Binlog) GetMaxFlushInterval() *duration.Duration

func (*Binlog) ProtoMessage

func (*Binlog) ProtoMessage()

func (*Binlog) ProtoReflect

func (x *Binlog) ProtoReflect() protoreflect.Message

func (*Binlog) Reset

func (x *Binlog) Reset()

func (*Binlog) String

func (x *Binlog) String() string

type BinlogOptions

type BinlogOptions struct {
	// contains filtered or unexported fields
}

type BinlogService

type BinlogService struct {
	// contains filtered or unexported fields
}

func NewBinlogService

func NewBinlogService(dataStore ds_.DataStore, taskq *taskq_.Pool, consumers []mq_.Consumer, opts ...BinlogServiceOption) (*BinlogService, error)

func (*BinlogService) ApplyOptions

func (o *BinlogService) ApplyOptions(options ...BinlogServiceOption) *BinlogService

func (*BinlogService) Run

func (srv *BinlogService) Run(ctx context.Context) error

func (*BinlogService) Serve

func (srv *BinlogService) Serve(ctx context.Context) error

func (*BinlogService) Shutdown

func (srv *BinlogService) Shutdown()

type BinlogServiceOption

type BinlogServiceOption interface {
	// contains filtered or unexported methods
}

A BinlogServiceOption sets options.

func WitRootPath

func WitRootPath(rootPath string) BinlogServiceOption

func WithFlushBatchSize

func WithFlushBatchSize(batch int) BinlogServiceOption

func WithFlushInterval

func WithFlushInterval(flushInterval time.Duration) BinlogServiceOption

func WithMessageDecoderFunc

func WithMessageDecoderFunc(f MessageDecoderFunc) BinlogServiceOption

func WithPrefixName

func WithPrefixName(prefixName string) BinlogServiceOption

func WithRotateInterval

func WithRotateInterval(rotateInterval time.Duration) BinlogServiceOption

func WithRotateSize

func WithRotateSize(rotateSize int64) BinlogServiceOption

func WithSufffixName

func WithSufffixName(suffixName string) BinlogServiceOption

type BinlogServiceOptionFunc

type BinlogServiceOptionFunc func(*BinlogService)

BinlogServiceOptionFunc wraps a function that modifies BinlogService into an implementation of the BinlogServiceOption interface.

type BinlogType

type BinlogType int32
const (
	BinlogType_BinlogType_DB   BinlogType = 0
	BinlogType_BinlogType_File BinlogType = 1
)

func (BinlogType) Descriptor

func (BinlogType) Descriptor() protoreflect.EnumDescriptor

func (BinlogType) Enum

func (x BinlogType) Enum() *BinlogType

func (BinlogType) EnumDescriptor deprecated

func (BinlogType) EnumDescriptor() ([]byte, []int)

Deprecated: Use BinlogType.Descriptor instead.

func (BinlogType) Number

func (x BinlogType) Number() protoreflect.EnumNumber

func (BinlogType) String

func (x BinlogType) String() string

func (BinlogType) Type

type Binlog_DBLog

type Binlog_DBLog struct {
	// contains filtered or unexported fields
}

func (*Binlog_DBLog) Descriptor deprecated

func (*Binlog_DBLog) Descriptor() ([]byte, []int)

Deprecated: Use Binlog_DBLog.ProtoReflect.Descriptor instead.

func (*Binlog_DBLog) ProtoMessage

func (*Binlog_DBLog) ProtoMessage()

func (*Binlog_DBLog) ProtoReflect

func (x *Binlog_DBLog) ProtoReflect() protoreflect.Message

func (*Binlog_DBLog) Reset

func (x *Binlog_DBLog) Reset()

func (*Binlog_DBLog) String

func (x *Binlog_DBLog) String() string

type Binlog_FileLog

type Binlog_FileLog struct {
	Filepath       string             `protobuf:"bytes,3,opt,name=filepath,proto3" json:"filepath,omitempty"`
	MaxAge         *duration.Duration `protobuf:"bytes,4,opt,name=max_age,json=maxAge,proto3" json:"max_age,omitempty"`
	MaxCount       int64              `protobuf:"varint,5,opt,name=max_count,json=maxCount,proto3" json:"max_count,omitempty"`
	RotateInterval *duration.Duration `protobuf:"bytes,6,opt,name=rotate_interval,json=rotateInterval,proto3" json:"rotate_interval,omitempty"`
	RotateSize     int64              `protobuf:"varint,7,opt,name=rotate_size,json=rotateSize,proto3" json:"rotate_size,omitempty"`
	// contains filtered or unexported fields
}

func (*Binlog_FileLog) Descriptor deprecated

func (*Binlog_FileLog) Descriptor() ([]byte, []int)

Deprecated: Use Binlog_FileLog.ProtoReflect.Descriptor instead.

func (*Binlog_FileLog) GetFilepath

func (x *Binlog_FileLog) GetFilepath() string

func (*Binlog_FileLog) GetMaxAge

func (x *Binlog_FileLog) GetMaxAge() *duration.Duration

func (*Binlog_FileLog) GetMaxCount

func (x *Binlog_FileLog) GetMaxCount() int64

func (*Binlog_FileLog) GetRotateInterval

func (x *Binlog_FileLog) GetRotateInterval() *duration.Duration

func (*Binlog_FileLog) GetRotateSize

func (x *Binlog_FileLog) GetRotateSize() int64

func (*Binlog_FileLog) ProtoMessage

func (*Binlog_FileLog) ProtoMessage()

func (*Binlog_FileLog) ProtoReflect

func (x *Binlog_FileLog) ProtoReflect() protoreflect.Message

func (*Binlog_FileLog) Reset

func (x *Binlog_FileLog) Reset()

func (*Binlog_FileLog) String

func (x *Binlog_FileLog) String() string

type Channel

type Channel struct {
	Name string
}

type CompletedConfig

type CompletedConfig struct {
	// contains filtered or unexported fields
}

func (CompletedConfig) New

func (c CompletedConfig) New(ctx context.Context, taskq *taskq_.Pool, consumers []mq_.Consumer, opts ...BinlogServiceOption) (*BinlogService, error)

type Config

type Config struct {
	Proto Binlog
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(options ...ConfigOption) *Config

func (*Config) ApplyOptions

func (o *Config) ApplyOptions(options ...ConfigOption) *Config

func (*Config) Complete

func (c *Config) Complete() CompletedConfig

Complete set default ServerRunOptions.

type ConfigOption

type ConfigOption interface {
	// contains filtered or unexported methods
}

A ConfigOption sets options.

func WithViper

func WithViper(v *viper.Viper) ConfigOption

type ConfigOptionFunc

type ConfigOptionFunc func(*Config)

ConfigOptionFunc wraps a function that modifies Client into an implementation of the ConfigOption interface.

type EmptyBinlogServiceOption

type EmptyBinlogServiceOption struct{}

EmptyBinlogServiceUrlOption does not alter the BinlogServiceuration. It can be embedded in another structure to build custom options.

This API is EXPERIMENTAL.

type EmptyConfigOption

type EmptyConfigOption struct{}

EmptyConfigOption does not alter the configuration. It can be embedded in another structure to build custom options.

This API is EXPERIMENTAL.

type MessageDecoderFunc

type MessageDecoderFunc func(ctx context.Context, data []byte) (interface{}, error)

type MessageKeyDecodeFunc

type MessageKeyDecodeFunc func(ctx context.Context, data []byte) (ds_.MessageKey, error)

Directories

Path Synopsis
*Copyright (c) 2023, kaydxh * *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.
*Copyright (c) 2023, kaydxh * *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.
dbstore
*Copyright (c) 2023, kaydxh * *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.
*Copyright (c) 2023, kaydxh * *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.
filestore
*Copyright (c) 2023, kaydxh * *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.
*Copyright (c) 2023, kaydxh * *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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL