weed_server

package
v0.0.0-...-45e1a9a Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 118 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SequencerType        = "master.sequencer.type"
	SequencerSnowflakeId = "master.sequencer.sequencer_snowflake_id"
)
View Source
const BufferSizeLimit = 1024 * 1024 * 2
View Source
const (
	LockDuration = 10 * time.Second
)
View Source
const (
	// MaxUnsyncedEvents send empty notification with timestamp when certain amount of events have been filtered
	MaxUnsyncedEvents = 1e3
)

Variables

View Source
var (
	OS_UID = uint32(os.Getuid())
	OS_GID = uint32(os.Getgid())

	ErrReadOnly = errors.New("read only")
)
View Source
var StaticFS fs.FS

Functions

func AdjustPassthroughHeaders

func AdjustPassthroughHeaders(w http.ResponseWriter, r *http.Request, filename string)

func InternalError

func InternalError(w http.ResponseWriter)

func NewWebDavFileSystem

func NewWebDavFileSystem(option *WebDavOption) (webdav.FileSystem, error)

func NewWrappedFs

func NewWrappedFs(fs webdav.FileSystem, subFolder string) webdav.FileSystem

NewWrappedFs returns a webdav.FileSystem identical to fs, except it provides access to a sub-folder of fs that is denominated by subFolder. It transparently handles renaming paths and filenames so that the outer part of the wrapped filesystem does not leak out.

func NotFound

func NotFound(w http.ResponseWriter)

func OptionsHandler

func OptionsHandler(w http.ResponseWriter, r *http.Request, isReadOnly bool)

func ProcessRangeRequest

func ProcessRangeRequest(r *http.Request, w http.ResponseWriter, totalSize int64, mimeType string, prepareWriteFn func(offset int64, size int64) (filer.DoStreamContent, error)) error

func SaveAmzMetaData

func SaveAmzMetaData(r *http.Request, existing map[string][]byte, isReplace bool) (metadata map[string][]byte)

func SetEtag

func SetEtag(w http.ResponseWriter, etag string)

Types

type AdminLock

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

type AdminLocks

type AdminLocks struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewAdminLocks

func NewAdminLocks() *AdminLocks

type ClusterStatusResult

type ClusterStatusResult struct {
	IsLeader    bool             `json:"IsLeader,omitempty"`
	Leader      pb.ServerAddress `json:"Leader,omitempty"`
	Peers       []string         `json:"Peers,omitempty"`
	MaxVolumeId needle.VolumeId  `json:"MaxVolumeId,omitempty"`
}

type FileInfo

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

func (*FileInfo) ETag

func (fi *FileInfo) ETag(ctx context.Context) (string, error)

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

func (*FileInfo) ModTime

func (fi *FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (fi *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (fi *FileInfo) Name() string

func (*FileInfo) Size

func (fi *FileInfo) Size() int64

func (*FileInfo) Sys

func (fi *FileInfo) Sys() interface{}

type FilerOption

type FilerOption struct {
	Masters            *pb.ServerDiscovery
	FilerGroup         string
	Collection         string
	DefaultReplication string
	DisableDirListing  bool
	MaxMB              int
	DirListingLimit    int
	DataCenter         string
	Rack               string
	DataNode           string
	DefaultLevelDbDir  string
	DisableHttp        bool
	Host               pb.ServerAddress

	Cipher                bool
	SaveToFilerLimit      int64
	ConcurrentUploadLimit int64
	ShowUIDirectoryDelete bool
	DownloadMaxBytesPs    int64
	DiskType              string
	AllowedOrigins        []string
	ExposeDirectoryData   bool
	// contains filtered or unexported fields
}

type FilerPostResult

type FilerPostResult struct {
	Name  string `json:"name,omitempty"`
	Size  int64  `json:"size,omitempty"`
	Error string `json:"error,omitempty"`
}

type FilerServer

type FilerServer struct {
	filer_pb.UnimplementedSeaweedFilerServer
	// contains filtered or unexported fields
}

func NewFilerServer

func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) (fs *FilerServer, err error)

func (*FilerServer) AppendToEntry

func (*FilerServer) AssignVolume

func (fs *FilerServer) AssignVolume(ctx context.Context, req *filer_pb.AssignVolumeRequest) (resp *filer_pb.AssignVolumeResponse, err error)

func (*FilerServer) CollectionList

func (*FilerServer) CreateEntry

func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntryRequest) (resp *filer_pb.CreateEntryResponse, err error)

func (*FilerServer) DeleteCollection

func (*FilerServer) DeleteEntry

func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer_pb.DeleteEntryRequest) (resp *filer_pb.DeleteEntryResponse, err error)

func (*FilerServer) DeleteTaggingHandler

func (fs *FilerServer) DeleteTaggingHandler(w http.ResponseWriter, r *http.Request)

remove all Seaweed- prefixed attributes curl -X DELETE http://localhost:8888/path/to/a/file?tagging

func (*FilerServer) DistributedLock

func (fs *FilerServer) DistributedLock(ctx context.Context, req *filer_pb.LockRequest) (resp *filer_pb.LockResponse, err error)

DistributedLock is a grpc handler to handle FilerServer's LockRequest

func (*FilerServer) DistributedUnlock

func (fs *FilerServer) DistributedUnlock(ctx context.Context, req *filer_pb.UnlockRequest) (resp *filer_pb.UnlockResponse, err error)

Unlock is a grpc handler to handle FilerServer's UnlockRequest

func (*FilerServer) FindLockOwner

func (*FilerServer) GetFilerConfiguration

func (*FilerServer) GetOrHeadHandler

func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)

func (*FilerServer) KvGet

func (*FilerServer) KvPut

KvPut sets the key~value. if empty value, delete the kv entry

func (*FilerServer) ListEntries

func (*FilerServer) LookupVolume

func (*FilerServer) OnDlmChangeSnapshot

func (fs *FilerServer) OnDlmChangeSnapshot(snapshot []pb.ServerAddress)

func (*FilerServer) Ping

func (fs *FilerServer) Ping(ctx context.Context, req *filer_pb.PingRequest) (resp *filer_pb.PingResponse, pingErr error)

func (*FilerServer) PostHandler

func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request, contentLength int64)

func (*FilerServer) PutTaggingHandler

func (fs *FilerServer) PutTaggingHandler(w http.ResponseWriter, r *http.Request)

add or replace one file Seaweed- prefixed attributes curl -X PUT -H "Seaweed-Name1: value1" http://localhost:8888/path/to/a/file?tagging

func (*FilerServer) Statistics

func (fs *FilerServer) Statistics(ctx context.Context, req *filer_pb.StatisticsRequest) (resp *filer_pb.StatisticsResponse, err error)

func (*FilerServer) StreamRenameEntry

func (*FilerServer) TransferLocks

TransferLocks is a grpc handler to handle FilerServer's TransferLocksRequest

func (*FilerServer) UpdateEntry

type MasterOption

type MasterOption struct {
	Master            pb.ServerAddress
	MetaFolder        string
	VolumeSizeLimitMB uint32
	VolumePreallocate bool
	// PulseSeconds            int
	DefaultReplicaPlacement string
	GarbageThreshold        float64
	WhiteList               []string
	DisableHttp             bool
	MetricsAddress          string
	MetricsIntervalSec      int
	IsFollower              bool
	EventStore              *event.LevelDbEventStore[*event.MasterServerEvent]
}

type MasterServer

type MasterServer struct {
	master_pb.UnimplementedSeaweedServer

	Topo *topology.Topology

	MasterClient *wdclient.MasterClient

	Cluster *cluster.Cluster

	EventStore *event.LevelDbEventStore[*event.MasterServerEvent]
	// contains filtered or unexported fields
}

func NewMasterServer

func NewMasterServer(r *mux.Router, option *MasterOption, peers map[string]pb.ServerAddress) *MasterServer

func (*MasterServer) Assign

func (*MasterServer) CollectionList

func (*MasterServer) DisableVacuum

func (*MasterServer) EnableVacuum

func (*MasterServer) GetOneFiler

func (ms *MasterServer) GetOneFiler(filerGroup cluster.FilerGroupName) pb.ServerAddress

func (*MasterServer) KeepConnected

func (ms *MasterServer) KeepConnected(stream master_pb.Seaweed_KeepConnectedServer) error

KeepConnected keep a stream gRPC call to the master. Used by clients to know the master is up. And clients gets the up-to-date list of volume locations

func (*MasterServer) LeaseAdminToken

func (*MasterServer) LookupEcVolume

func (*MasterServer) LookupVolume

func (*MasterServer) MerkleStatus

func (*MasterServer) OnPeerUpdate

func (ms *MasterServer) OnPeerUpdate(update *master_pb.ClusterNodeUpdate, startFrom time.Time)

func (*MasterServer) Ping

func (ms *MasterServer) Ping(ctx context.Context, req *master_pb.PingRequest) (resp *master_pb.PingResponse, pingErr error)

func (*MasterServer) ProcessGrowRequest

func (ms *MasterServer) ProcessGrowRequest()

func (*MasterServer) RaftAddServer

func (*MasterServer) RegisterUuids

func (ms *MasterServer) RegisterUuids(heartbeat *master_pb.Heartbeat) (duplicated_uuids []string, err error)

func (*MasterServer) SendHeartbeat

func (ms *MasterServer) SendHeartbeat(stream master_pb.Seaweed_SendHeartbeatServer) error

func (*MasterServer) SetRaftServer

func (ms *MasterServer) SetRaftServer(raftServer *RaftServer)

func (*MasterServer) Shutdown

func (ms *MasterServer) Shutdown()

func (*MasterServer) Statistics

func (*MasterServer) StreamAssign

func (ms *MasterServer) StreamAssign(server master_pb.Seaweed_StreamAssignServer) error

func (*MasterServer) UnRegisterUuids

func (ms *MasterServer) UnRegisterUuids(ip string, port int)

func (*MasterServer) VacuumVolume

func (*MasterServer) VolumeList

type RaftServer

type RaftServer struct {
	RaftHashicorp    *hashicorpRaft.Raft
	TransportManager *transport.Manager

	*raft.GrpcServer
	// contains filtered or unexported fields
}

func NewHashicorpRaftServer

func NewHashicorpRaftServer(option *RaftServerOption) (*RaftServer, error)

func NewRaftServer

func NewRaftServer(option *RaftServerOption) (*RaftServer, error)

func (*RaftServer) AddPeersConfiguration

func (s *RaftServer) AddPeersConfiguration() (cfg raft.Configuration)

func (*RaftServer) DoJoinCommand

func (s *RaftServer) DoJoinCommand()

func (*RaftServer) HealthzHandler

func (s *RaftServer) HealthzHandler(w http.ResponseWriter, r *http.Request)

func (*RaftServer) Peers

func (s *RaftServer) Peers() (members []string)

func (*RaftServer) StatsRaftHandler

func (s *RaftServer) StatsRaftHandler(w http.ResponseWriter, r *http.Request)

func (*RaftServer) StatusHandler

func (s *RaftServer) StatusHandler(w http.ResponseWriter, r *http.Request)

func (*RaftServer) UpdatePeers

func (s *RaftServer) UpdatePeers()

type RaftServerOption

type RaftServerOption struct {
	GrpcDialOption    grpc.DialOption
	Peers             map[string]pb.ServerAddress
	ServerAddr        pb.ServerAddress
	DataDir           string
	Topo              *topology.Topology
	RaftResumeState   bool
	HeartbeatInterval time.Duration
	ElectionTimeout   time.Duration
	RaftBootstrap     bool
}

type StateMachine

type StateMachine struct {
	raft.StateMachine
	// contains filtered or unexported fields
}

func (*StateMachine) Apply

func (s *StateMachine) Apply(l *hashicorpRaft.Log) interface{}

func (StateMachine) Recovery

func (s StateMachine) Recovery(data []byte) error

func (*StateMachine) Restore

func (s *StateMachine) Restore(r io.ReadCloser) error

func (StateMachine) Save

func (s StateMachine) Save() ([]byte, error)

func (*StateMachine) Snapshot

func (s *StateMachine) Snapshot() (hashicorpRaft.FSMSnapshot, error)

type VolumeFileScanner4Tailing

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

generate the volume idx

func (*VolumeFileScanner4Tailing) ReadNeedleBody

func (scanner *VolumeFileScanner4Tailing) ReadNeedleBody() bool

func (*VolumeFileScanner4Tailing) VisitNeedle

func (scanner *VolumeFileScanner4Tailing) VisitNeedle(n *needle.Needle, offset int64, needleHeader, needleBody []byte) error

func (*VolumeFileScanner4Tailing) VisitSuperBlock

func (scanner *VolumeFileScanner4Tailing) VisitSuperBlock(superBlock super_block.SuperBlock) error

type VolumeServer

type VolumeServer struct {
	volume_server_pb.UnimplementedVolumeServerServer

	SeedMasterNodes []pb.ServerAddress

	FixJpgOrientation bool
	ReadMode          string
	// contains filtered or unexported fields
}

func NewVolumeServer

func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
	port int, grpcPort int, publicUrl string,
	folders []string, maxCounts []int32, minFreeSpaces []util.MinFreeSpace, diskTypes []types.DiskType,
	idxFolder string,
	needleMapKind storage.NeedleMapKind,
	masterNodes []pb.ServerAddress, pulseSeconds int,
	dataCenter string, rack string,
	whiteList []string,
	fixJpgOrientation bool,
	readMode string,
	compactionMBPerSecond int,
	fileSizeLimitMB int,
	concurrentUploadLimit int64,
	concurrentDownloadLimit int64,
	inflightUploadDataTimeout time.Duration,
	hasSlowRead bool,
	readBufferSizeMB int,
	ldbTimeout int64,
	eventStore *event.LevelDbEventStore[*event.VolumeServerEvent],
) *VolumeServer

func (*VolumeServer) CopyFile

CopyFile client pulls the volume related file from the source server. if req.CompactionRevision != math.MaxUint32, it ensures the compact revision is as expected The copying still stop at req.StopOffset, but you can set it to math.MaxUint64 in order to read all data.

func (*VolumeServer) DeleteHandler

func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request)

func (*VolumeServer) GetMaster

func (vs *VolumeServer) GetMaster(ctx context.Context) pb.ServerAddress

func (*VolumeServer) GetOrHeadHandler

func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)

func (*VolumeServer) LoadNewVolumes

func (vs *VolumeServer) LoadNewVolumes()

func (*VolumeServer) Ping

func (*VolumeServer) PostHandler

func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request)

func (*VolumeServer) ReadNeedleBlob

func (*VolumeServer) ReadNeedleMeta

func (*VolumeServer) SetStopping

func (vs *VolumeServer) SetStopping()

func (*VolumeServer) Shutdown

func (vs *VolumeServer) Shutdown()

func (*VolumeServer) StopHeartbeat

func (vs *VolumeServer) StopHeartbeat() (isAlreadyStopping bool)

func (*VolumeServer) VolumeCopy

VolumeCopy copy the .idx .dat .vif files, and mount the volume

func (*VolumeServer) VolumeEcShardsCopy

VolumeEcShardsCopy copy the .ecx and some ec data slices

func (*VolumeServer) VolumeEcShardsDelete

VolumeEcShardsDelete local delete the .ecx and some ec data slices if not needed the shard should not be mounted before calling this.

func (*VolumeServer) VolumeEcShardsGenerate

VolumeEcShardsGenerate generates the .ecx and .ec00 ~ .ec13 files

func (*VolumeServer) VolumeEcShardsRebuild

VolumeEcShardsRebuild generates the any of the missing .ec00 ~ .ec13 files

func (*VolumeServer) VolumeEcShardsToVolume

VolumeEcShardsToVolume generates the .idx, .dat files from .ecx, .ecj and .ec01 ~ .ec14 files

func (*VolumeServer) VolumeTierMoveDatFromRemote

VolumeTierMoveDatFromRemote copy dat file from a remote tier to local volume server

func (*VolumeServer) VolumeTierMoveDatToRemote

VolumeTierMoveDatToRemote copy dat file to a remote tier

type WebDavFile

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

func (*WebDavFile) Close

func (f *WebDavFile) Close() error

func (*WebDavFile) Read

func (f *WebDavFile) Read(p []byte) (readSize int, err error)

func (*WebDavFile) Readdir

func (f *WebDavFile) Readdir(count int) (ret []os.FileInfo, err error)

func (*WebDavFile) Seek

func (f *WebDavFile) Seek(offset int64, whence int) (int64, error)

func (*WebDavFile) Stat

func (f *WebDavFile) Stat() (os.FileInfo, error)

func (*WebDavFile) Write

func (f *WebDavFile) Write(buf []byte) (int, error)

type WebDavFileSystem

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

func (*WebDavFileSystem) AdjustedUrl

func (fs *WebDavFileSystem) AdjustedUrl(location *filer_pb.Location) string

func (*WebDavFileSystem) GetDataCenter

func (fs *WebDavFileSystem) GetDataCenter() string

func (*WebDavFileSystem) Mkdir

func (fs *WebDavFileSystem) Mkdir(ctx context.Context, fullDirPath string, perm os.FileMode) error

func (*WebDavFileSystem) OpenFile

func (fs *WebDavFileSystem) OpenFile(ctx context.Context, fullFilePath string, flag int, perm os.FileMode) (webdav.File, error)

func (*WebDavFileSystem) RemoveAll

func (fs *WebDavFileSystem) RemoveAll(ctx context.Context, name string) error

func (*WebDavFileSystem) Rename

func (fs *WebDavFileSystem) Rename(ctx context.Context, oldName, newName string) error

func (*WebDavFileSystem) Stat

func (fs *WebDavFileSystem) Stat(ctx context.Context, name string) (os.FileInfo, error)

func (*WebDavFileSystem) WithFilerClient

func (fs *WebDavFileSystem) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error

type WebDavOption

type WebDavOption struct {
	Filer          pb.ServerAddress
	FilerRootPath  string
	DomainName     string
	BucketsPath    string
	GrpcDialOption grpc.DialOption
	Collection     string
	Replication    string
	DiskType       string
	Uid            uint32
	Gid            uint32
	Cipher         bool
	CacheDir       string
	CacheSizeMB    int64
	MaxMB          int
}

type WebDavServer

type WebDavServer struct {
	Handler *webdav.Handler
	// contains filtered or unexported fields
}

func NewWebDavServer

func NewWebDavServer(option *WebDavOption) (ws *WebDavServer, err error)

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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