这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ phalanx_grpc_server_handled_total{grpc_code="Aborted",grpc_method="Cluster",grpc

## Cluster status

This endpoint returns the latest cluster status.
This endpoint returns the latest cluster status.
- `nodes`: Lists the nodes that are joining in the cluster.
- `indexes`: Lists the indexes served by the cluster.
- `indexer_assignment`: Lists which node is responsible for the shard in the index.
Expand Down
4 changes: 2 additions & 2 deletions analysis/analyzer/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (d *AnalyzerDetector) detectLanguage(text string) (string, bool) {
}

iso639_1 := strings.ToLower(language.IsoCode639_1().String())
d.logger.Debug("language detected", zap.String("language", language.String()), zap.String("iso639_1", iso639_1), zap.String("text", text))
// d.logger.Debug("language detected", zap.String("language", language.String()), zap.String("iso639_1", iso639_1), zap.String("text", text))
return iso639_1, exists
}

Expand All @@ -154,7 +154,7 @@ func (d *AnalyzerDetector) getAnalyzer(iso639_1 string) *analysis.Analyzer {
return analyzer.NewStandardAnalyzer()
}

d.logger.Debug("analyzer found", zap.String("iso639_1", iso639_1))
// d.logger.Debug("analyzer found", zap.String("iso639_1", iso639_1))
return langAnalyzer
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/phalanx.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ var (
}

// Create index metastore
indexMetastore, err := metastore.NewMetastoreWithUri(indexMetastoreUri, logger)
indexMetastore, err := metastore.NewMetastore(indexMetastoreUri, logger)
if err != nil {
logger.Error("failed to create index metastore", zap.Error(err), zap.Any("uri", indexMetastoreUri))
return err
Expand Down
2 changes: 1 addition & 1 deletion directory/directory_minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (d *MinioDirectory) Stats() (uint64, uint64) {
}

func (d *MinioDirectory) Sync() error {
d.logger.Debug("sync", zap.String("path", d.path))
// d.logger.Debug("sync", zap.String("path", d.path))
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (

ErrInvalidUri = errors.New("invalid URI")

ErrUnsupportedMetastoreType = errors.New("unsupported metastore type")
ErrUnsupportedStorageType = errors.New("unsupported metastore type")
ErrUnsupportedMetastoreEvent = errors.New("unsupported metastore event")

ErrIndexMetadataAlreadyExists = errors.New("index metadata already exists")
Expand Down
377 changes: 119 additions & 258 deletions index/manager.go

Large diffs are not rendered by default.

177 changes: 0 additions & 177 deletions index/metadata.go

This file was deleted.

7 changes: 4 additions & 3 deletions index/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/mosuka/phalanx/directory"
"github.com/mosuka/phalanx/errors"
"github.com/mosuka/phalanx/lock"
"github.com/mosuka/phalanx/metastore"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -100,7 +101,7 @@ func (i *IndexReaders) Contains(indexName string, shardName string) bool {
return i.contains(indexName, shardName)
}

func (i *IndexReaders) open(indexName string, shardName string, indexMetadata *IndexMetadata, shardMetadata *ShardMetadata) error {
func (i *IndexReaders) open(indexName string, shardName string, indexMetadata *metastore.IndexMetadata, shardMetadata *metastore.ShardMetadata) error {
// Create lock manager
lockManager, err := lock.NewLockManagerWithUri(shardMetadata.ShardLockUri, i.logger)
if err != nil {
Expand Down Expand Up @@ -134,7 +135,7 @@ func (i *IndexReaders) open(indexName string, shardName string, indexMetadata *I
return nil
}

func (i *IndexReaders) Open(indexName string, shardName string, indexMetadata *IndexMetadata, shardMetadata *ShardMetadata) error {
func (i *IndexReaders) Open(indexName string, shardName string, indexMetadata *metastore.IndexMetadata, shardMetadata *metastore.ShardMetadata) error {
i.mutex.Lock()
defer i.mutex.Unlock()

Expand Down Expand Up @@ -203,7 +204,7 @@ func (i *IndexReaders) Close(indexName string, shardName string) error {
return i.close(indexName, shardName)
}

func (i *IndexReaders) Reopen(indexName string, shardName string, indexMetadata *IndexMetadata, shardMetadata *ShardMetadata) error {
func (i *IndexReaders) Reopen(indexName string, shardName string, indexMetadata *metastore.IndexMetadata, shardMetadata *metastore.ShardMetadata) error {
i.mutex.Lock()
defer i.mutex.Unlock()

Expand Down
7 changes: 4 additions & 3 deletions index/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/mosuka/phalanx/directory"
"github.com/mosuka/phalanx/errors"
"github.com/mosuka/phalanx/lock"
"github.com/mosuka/phalanx/metastore"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -80,7 +81,7 @@ func (i *IndexWriters) Contains(indexName string, shardName string) bool {
return i.contains(indexName, shardName)
}

func (i *IndexWriters) open(indexName string, shardName string, indexMetadata *IndexMetadata, shardMetadata *ShardMetadata) error {
func (i *IndexWriters) open(indexName string, shardName string, indexMetadata *metastore.IndexMetadata, shardMetadata *metastore.ShardMetadata) error {
// Create lock manager
lockManager, err := lock.NewLockManagerWithUri(shardMetadata.ShardLockUri, i.logger)
if err != nil {
Expand Down Expand Up @@ -114,7 +115,7 @@ func (i *IndexWriters) open(indexName string, shardName string, indexMetadata *I
return nil
}

func (i *IndexWriters) Open(indexName string, shardName string, indexMetadata *IndexMetadata, shardMetadata *ShardMetadata) error {
func (i *IndexWriters) Open(indexName string, shardName string, indexMetadata *metastore.IndexMetadata, shardMetadata *metastore.ShardMetadata) error {
i.mutex.Lock()
defer i.mutex.Unlock()

Expand Down Expand Up @@ -174,7 +175,7 @@ func (i *IndexWriters) Close(indexName string, shardName string) error {
return i.close(indexName, shardName)
}

func (i *IndexWriters) Reopen(indexName string, shardName string, indexMetadata *IndexMetadata, shardMetadata *ShardMetadata) error {
func (i *IndexWriters) Reopen(indexName string, shardName string, indexMetadata *metastore.IndexMetadata, shardMetadata *metastore.ShardMetadata) error {
i.mutex.Lock()
defer i.mutex.Unlock()

Expand Down
4 changes: 2 additions & 2 deletions lock/lock_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ func NewLockManagerWithUri(uri string, logger *zap.Logger) (LockManager, error)
case SchemeType_name[SchemeTypeEtcd]:
return NewEtcdLockManagerWithUri(uri, logger)
default:
err := errors.ErrUnsupportedMetastoreType
err := errors.ErrUnsupportedLockManagerType
lockManagerLogger.Error("unknown lock manager type", zap.Error(err), zap.String("scheme", u.Scheme))
return nil, errors.ErrUnsupportedLockManagerType
return nil, err
}
}
4 changes: 2 additions & 2 deletions lock/lock_manager_etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (m *EtcdLockManager) Lock() (int64, error) {
return 0, err
}

m.logger.Info("locked", zap.String("path", m.path))
// m.logger.Info("locked", zap.String("path", m.path))

return m.mutex.Header().Revision, nil
}
Expand All @@ -87,7 +87,7 @@ func (m *EtcdLockManager) Unlock() error {
return err
}

m.logger.Info("unlocked", zap.String("path", m.path))
// m.logger.Info("unlocked", zap.String("path", m.path))

return nil
}
4 changes: 2 additions & 2 deletions lock/lock_manager_fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (m *FileSystemLockManager) Lock() (int64, error) {
return 0, fmt.Errorf("failed to lock %s", fullPath)
}

m.logger.Info("locked", zap.String("path", fullPath))
// m.logger.Info("locked", zap.String("path", fullPath))

return 0, nil
}
Expand All @@ -87,7 +87,7 @@ func (m *FileSystemLockManager) Unlock() error {
return err
}

m.logger.Info("unlocked", zap.String("path", fullPath))
// m.logger.Info("unlocked", zap.String("path", fullPath))

return nil
}
4 changes: 2 additions & 2 deletions membership/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ func (d *NodeMetadataDelegate) LocalState(join bool) []byte {
return []byte{}
}
func (d *NodeMetadataDelegate) NotifyMsg(msg []byte) {
d.logger.Debug("notify msg", zap.ByteString("msg", msg))
// d.logger.Debug("notify msg", zap.ByteString("msg", msg))
}

func (d *NodeMetadataDelegate) GetBroadcasts(overhead, limit int) [][]byte {
return [][]byte{}
}

func (d *NodeMetadataDelegate) MergeRemoteState(buf []byte, join bool) {
d.logger.Debug("merge remote state", zap.ByteString("buf", buf), zap.Bool("join", join))
// d.logger.Debug("merge remote state", zap.ByteString("buf", buf), zap.Bool("join", join))
}
Loading