public SecretManagerState(FsImageProto.SecretManagerSection s, IList <FsImageProto.SecretManagerSection.DelegationKey > keys, IList <FsImageProto.SecretManagerSection.PersistToken> tokens) { this.section = s; this.keys = keys; this.tokens = tokens; }
/// <exception cref="System.IO.IOException"/> private void DumpSecretManagerSection(InputStream @is) { @out.Write("<SecretManagerSection>"); FsImageProto.SecretManagerSection s = FsImageProto.SecretManagerSection.ParseDelimitedFrom (@is); O("currentId", s.GetCurrentId()).O("tokenSequenceNumber", s.GetTokenSequenceNumber ()); @out.Write("</SecretManagerSection>"); }
/// <exception cref="System.IO.IOException"/> private void LoadSecretManagerSection(InputStream @in) { FsImageProto.SecretManagerSection s = FsImageProto.SecretManagerSection.ParseDelimitedFrom (@in); int numKeys = s.GetNumKeys(); int numTokens = s.GetNumTokens(); AList <FsImageProto.SecretManagerSection.DelegationKey> keys = Lists.NewArrayListWithCapacity (numKeys); AList <FsImageProto.SecretManagerSection.PersistToken> tokens = Lists.NewArrayListWithCapacity (numTokens); for (int i = 0; i < numKeys; ++i) { keys.AddItem(FsImageProto.SecretManagerSection.DelegationKey.ParseDelimitedFrom(@in )); } for (int i_1 = 0; i_1 < numTokens; ++i_1) { tokens.AddItem(FsImageProto.SecretManagerSection.PersistToken.ParseDelimitedFrom( @in)); } fsn.LoadSecretManagerState(s, keys, tokens); }
public virtual DelegationTokenSecretManager.SecretManagerState SaveSecretManagerState () { lock (this) { FsImageProto.SecretManagerSection s = ((FsImageProto.SecretManagerSection)FsImageProto.SecretManagerSection .NewBuilder().SetCurrentId(currentId).SetTokenSequenceNumber(delegationTokenSequenceNumber ).SetNumKeys(allKeys.Count).SetNumTokens(currentTokens.Count).Build()); AList <FsImageProto.SecretManagerSection.DelegationKey> keys = Lists.NewArrayListWithCapacity (allKeys.Count); AList <FsImageProto.SecretManagerSection.PersistToken> tokens = Lists.NewArrayListWithCapacity (currentTokens.Count); foreach (DelegationKey v in allKeys.Values) { FsImageProto.SecretManagerSection.DelegationKey.Builder b = FsImageProto.SecretManagerSection.DelegationKey .NewBuilder().SetId(v.GetKeyId()).SetExpiryDate(v.GetExpiryDate()); if (v.GetEncodedKey() != null) { b.SetKey(ByteString.CopyFrom(v.GetEncodedKey())); } keys.AddItem(((FsImageProto.SecretManagerSection.DelegationKey)b.Build())); } foreach (KeyValuePair <DelegationTokenIdentifier, AbstractDelegationTokenSecretManager.DelegationTokenInformation > e in currentTokens) { DelegationTokenIdentifier id = e.Key; FsImageProto.SecretManagerSection.PersistToken.Builder b = FsImageProto.SecretManagerSection.PersistToken .NewBuilder().SetOwner(id.GetOwner().ToString()).SetRenewer(id.GetRenewer().ToString ()).SetRealUser(id.GetRealUser().ToString()).SetIssueDate(id.GetIssueDate()).SetMaxDate (id.GetMaxDate()).SetSequenceNumber(id.GetSequenceNumber()).SetMasterKeyId(id.GetMasterKeyId ()).SetExpiryDate(e.Value.GetRenewDate()); tokens.AddItem(((FsImageProto.SecretManagerSection.PersistToken)b.Build())); } return(new DelegationTokenSecretManager.SecretManagerState(s, keys, tokens)); } }