syntax = "proto3";

package gitaly;

option go_package = "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb";

import "lint.proto";
import "shared.proto";

service CleanupService {
  rpc ApplyBfgObjectMapStream(stream ApplyBfgObjectMapStreamRequest) returns (stream ApplyBfgObjectMapStreamResponse) {
    option (op_type) = {
      op: MUTATOR
    };
  }
}

message ApplyBfgObjectMapStreamRequest {
  // Only available on the first message
  Repository repository = 1 [(target_repository)=true];

  // A raw object-map file as generated by BFG: https://rtyley.github.io/bfg-repo-cleaner
  // Each line in the file has two object SHAs, space-separated - the original
  // SHA of the object, and the SHA after BFG has rewritten the object.
  bytes object_map = 2;
}

message ApplyBfgObjectMapStreamResponse {
	// We send back each parsed entry in the request's object map so the client
	// can take action
	message Entry {
		ObjectType type = 1;
		string old_oid = 2;
		string new_oid = 3;
	}

	repeated Entry entries = 1;
}
