nogfsostad

package
v0.0.0-...-4450389 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package `nogfsostad` implements modules that are combined in `cmd/nogfsostad`.

Package `nogfsostad/observer4`: Watches the FSO registry and initializes repos: FSO shadow repos and GitLab projects.

`Processor`: Coordinates repo initialization, stat, and sha.

`RepoInitializer`: Initializes repos: FSO shadow repos and GitLab projects.

`Session`: Permanent connection to `nogfsoregd` to receive commands.

Package `gits`: Init GitLab projects.

Package `shadows`: FSO shadow repos.

`NewStatServer()`, Package `statd`: GRPC service `nogfso.Stat`.

Index

Constants

View Source
const AAFsoInitRepo = fsoauthz.AAFsoInitRepo

Variables

View Source
var ErrNoSudo = errors.New("no sudo privileges")

Functions

func NewGitNogServer

func NewGitNogServer(
	lg Logger,
	authn auth.Authenticator,
	authz auth.Authorizer,
	proc *Processor,
) *gitnogd.Server

func NewStatServer

func NewStatServer(
	lg Logger,
	authn auth.Authenticator,
	authz auth.Authorizer,
	proc *Processor,
	sysRPCCreds credentials.PerRPCCredentials,
) *statd.Server

Types

type Broadcaster

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

func NewBroadcaster

func NewBroadcaster(
	lg Logger,
	conn *grpc.ClientConn,
	sysRPCCreds credentials.PerRPCCredentials,
) *Broadcaster

func (*Broadcaster) PostGitContentUpdated

func (b *Broadcaster) PostGitContentUpdated(
	ctx context.Context, repoId uuid.I, newHead shadows.Oid,
) error

func (*Broadcaster) PostGitMetaUpdated

func (b *Broadcaster) PostGitMetaUpdated(
	ctx context.Context, repoId uuid.I, newHead shadows.Oid,
) error

func (*Broadcaster) PostGitShaUpdated

func (b *Broadcaster) PostGitShaUpdated(
	ctx context.Context, repoId uuid.I, newHead shadows.Oid,
) error

func (*Broadcaster) PostGitStatUpdated

func (b *Broadcaster) PostGitStatUpdated(
	ctx context.Context, repoId uuid.I, newHead shadows.Oid,
) error

type GitNogWritePolicy

type GitNogWritePolicy int
const (
	GitNogWriteUnspecified GitNogWritePolicy = iota

	// `GitNogWriteAlways` always allows `PutMeta()`.  It is the preferred
	// solution.  See NOE-13.
	GitNogWriteAlways

	// `GitNogWriteUnlessGitlab` could be an alternative as discussed in
	// NOE-13.  Writes would be forbidden here and only allowed via GitLab
	// REST.  Do not use `GitNogWriteUnlessGitlab` without prior design
	// discussion.
	GitNogWriteUnlessGitlab
)

type GitUser

type GitUser struct {
	Name  string
	Email string
}

type InitLimits

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

func NewInitLimits

func NewInitLimits(cfg *InitLimitsConfig) *InitLimits

type InitLimitsConfig

type InitLimitsConfig struct {
	MaxFiles     uint64
	MaxBytes     uint64
	PrefixLimits []PathInitLimit
	RepoLimits   []PathInitLimit
}

type Logger

type Logger interface {
	Infow(msg string, kv ...interface{})
	Warnw(msg string, kv ...interface{})
	Errorw(msg string, kv ...interface{})
}

type PathInitLimit

type PathInitLimit struct {
	Path     string
	MaxFiles uint64
	MaxBytes uint64
}

type Processor

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

func NewProcessor

func NewProcessor(
	lg Logger,
	initLimits *InitLimits,
	shadow *shadows.Filesystem,
	broadcaster *Broadcaster,
	privs Privileges,
	useUdo UseUdo,
) *Processor

func (*Processor) ArchiveRepo

func (p *Processor) ArchiveRepo(
	ctx context.Context,
	repoId uuid.I,
	workingDir string,
	author GitUser,
) error

func (*Processor) DisableRepo4

func (p *Processor) DisableRepo4(
	ctx context.Context, repoId uuid.I,
) error

`DisableRepo4()` is for `observer4/observer.go:Observer`.

func (*Processor) EnableRepo4

func (p *Processor) EnableRepo4(
	ctx context.Context, inf *RepoInfo,
) error

`EnableRepo4()` is for `observer4/observer.go:Observer`.

func (*Processor) FreezeRepo

func (p *Processor) FreezeRepo(
	ctx context.Context, repoId uuid.I, author GitUser,
) error

func (*Processor) GetTarttconfig

func (p *Processor) GetTarttconfig(
	ctx context.Context,
	repoId uuid.I,
	gitCommit []byte,
) ([]byte, error)

func (*Processor) GitGcAll

func (p *Processor) GitGcAll(ctx context.Context) error

func (*Processor) GitNogContent

func (p *Processor) GitNogContent(
	ctx context.Context, repoId uuid.I, path string,
) (*pb.ContentO, error)

func (*Processor) GitNogHead

func (p *Processor) GitNogHead(
	ctx context.Context, repoId uuid.I,
) (*pb.HeadO, error)

func (*Processor) GitNogMeta

func (p *Processor) GitNogMeta(
	ctx context.Context, repoId uuid.I,
) (*pb.MetaO, error)

func (*Processor) GitNogPutPathMetadata

func (p *Processor) GitNogPutPathMetadata(
	ctx context.Context, repoId uuid.I, i *pb.PutPathMetadataI,
) (*pb.PutPathMetadataO, error)

func (*Processor) GitNogSummary

func (p *Processor) GitNogSummary(
	ctx context.Context, repoId uuid.I,
) (*pb.SummaryO, error)

func (*Processor) GlobalRepoPath

func (p *Processor) GlobalRepoPath(repoId uuid.I) (string, bool)

func (*Processor) IsKnownRepo

func (p *Processor) IsKnownRepo(repoId uuid.I) bool

func (*Processor) ListMetaTree

func (p *Processor) ListMetaTree(
	ctx context.Context,
	repoId uuid.I,
	gitCommit []byte,
	fn shadows.ListMetaTreeFunc,
) error

func (*Processor) ListStatTree

func (p *Processor) ListStatTree(
	ctx context.Context,
	repoId uuid.I,
	gitCommit []byte,
	prefix string,
	fn shadows.ListStatTreeFunc,
) error

func (*Processor) ListTars

func (p *Processor) ListTars(
	ctx context.Context,
	repoId uuid.I,
	gitCommit []byte,
	fn shadows.ListTarsFunc,
) error

func (*Processor) LockRepo4

func (p *Processor) LockRepo4(
	ctx context.Context, repoId uuid.I,
) error

func (*Processor) RefreshContent

func (p *Processor) RefreshContent(
	ctx context.Context, repoId uuid.I, author statd.User,
) error

func (*Processor) ReinitSubdirTracking

func (p *Processor) ReinitSubdirTracking(
	ctx context.Context,
	repoId uuid.I,
	author statd.User,
	subdirTracking pb.SubdirTracking,
) error

func (*Processor) ResolveGlobaPathInLocalRepo

func (p *Processor) ResolveGlobaPathInLocalRepo(
	globalPath string,
) (repo, sub string, ok bool)

func (*Processor) ShaRepo

func (p *Processor) ShaRepo(
	ctx context.Context, repoId uuid.I, author statd.User,
) error

func (*Processor) StatMtimeRangeOnlyAllRepos

func (p *Processor) StatMtimeRangeOnlyAllRepos(
	ctx context.Context,
	author statd.User,
) error

func (*Processor) StatRepo

func (p *Processor) StatRepo(
	ctx context.Context,
	repoId uuid.I,
	author statd.User,
	opts shadows.StatOptions,
) error

func (*Processor) StatStatus

func (p *Processor) StatStatus(
	ctx context.Context,
	repoId uuid.I,
	fn shadows.StatStatusFunc,
) error

func (*Processor) TarttHead

func (p *Processor) TarttHead(
	ctx context.Context, repoId uuid.I,
) (*pb.TarttHeadO, error)

func (*Processor) TarttIsFrozenArchive

func (p *Processor) TarttIsFrozenArchive(
	ctx context.Context, repoId uuid.I,
) (*shadows.TarttIsFrozenArchiveInfo, error)

func (*Processor) UnarchiveRepo

func (p *Processor) UnarchiveRepo(
	ctx context.Context,
	repoId uuid.I,
	workingDir string,
	author GitUser,
) error

func (*Processor) UnfreezeRepo

func (p *Processor) UnfreezeRepo(
	ctx context.Context, repoId uuid.I, author GitUser,
) error

func (*Processor) UnlockRepo4

func (p *Processor) UnlockRepo4(repoId uuid.I)

func (*Processor) WaitEnableRepo4

func (p *Processor) WaitEnableRepo4(
	ctx context.Context, id uuid.I,
) error

`WaitEnableRepo4()` waits until the repo has been enabled. It is used to synchronize workflow processing during startup. Specifically if a freeze-repo workflow is restarted, it needs to wait until the repo is enabled before it can call `FreezeRepo()`. It calls `WaitEnableRepo4()` to ensure that.

`WaitEnableRepo4()` is only useful for startup. It does not handle disabling repos later. It may return immediately for such a repo even if the repo is currently disabled.

type RepoInfo

type RepoInfo struct {
	Id         uuid.I
	Vid        ulid.I
	GlobalPath string
	HostPath   string
	ShadowPath string
	GitlabSsh  string
}

type RepoInitializer4

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

func NewRepoInitializer4

func NewRepoInitializer4(
	lg Logger,
	proc *Processor,
	conn *grpc.ClientConn,
	sysRPCCreds credentials.PerRPCCredentials,
	hosts []string,
	shadow *shadows.Filesystem,
	broadcaster *Broadcaster,
	gitlab *gits.Gitlab,
) *RepoInitializer4

func (*RepoInitializer4) EnableGitlab

func (ri *RepoInitializer4) EnableGitlab(
	ctx context.Context, repoId uuid.I,
) (*RepoInfo, error)

func (*RepoInitializer4) GetRepo

func (ri *RepoInitializer4) GetRepo(
	ctx context.Context, repoId uuid.I,
) (*RepoInfo, error)

func (*RepoInitializer4) InitRepo

func (ri *RepoInitializer4) InitRepo(
	ctx context.Context, repoId uuid.I,
) (*RepoInfo, error)

func (*RepoInitializer4) MoveRepo

func (ri *RepoInitializer4) MoveRepo(
	ctx context.Context,
	repoId uuid.I,
	oldHostPath string,
	oldShadowPath string,
	newHostPath string,
) (string, error)

type Session

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

func NewSession

func NewSession(
	lg Logger,
	statd pb.StatServer,
	gitnogd pb.GitNogServer,
	gitnogtreed pb.GitNogTreeServer,
	discoveryd pb.DiscoveryServer,
	tarttd pb.TarttServer,
	testUdoD pb.TestUdoServer,
	cfg *SessionConfig,
) *Session

func (*Session) Process

func (se *Session) Process(
	ctx context.Context, conn *grpc.ClientConn,
) error

type SessionConfig

type SessionConfig struct {
	// IsInitRepoAllowed()
	Prefixes             []string
	Hosts                []string
	InitLimits           *InitLimits
	SessionName          string
	TransportCredentials credentials.TransportCredentials
	Authenticator        auth.Authenticator
	Authorizer           auth.Authorizer
	SysRPCCreds          credentials.PerRPCCredentials
}

type UseUdo

type UseUdo struct {
	Rename bool
}

Directories

Path Synopsis
Package `gits`: Init GitLab projects.
Package `gits`: Init GitLab projects.
Package `observer6` contains `Observer` to watch for registry and repo events and trigger actions on a `Processor`, specifically `nogfsostad.Processor`.
Package `observer6` contains `Observer` to watch for registry and repo events and trigger actions on a `Processor`, specifically `nogfsostad.Processor`.
udodprivileges
Package `privileges/udodprivileges` implements interfaces from `privileges/privileges` by gRPCs to a `privileges/daemons.Daemon`.
Package `privileges/udodprivileges` implements interfaces from `privileges/privileges` by gRPCs to a `privileges/daemons.Daemon`.
Package `shadows`: FSO shadow repos.
Package `shadows`: FSO shadow repos.
Package `statd`: GRPC service `nogfso.Stat`.
Package `statd`: GRPC service `nogfso.Stat`.

Jump to

Keyboard shortcuts

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