locks

package
v1.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package locks provides functionality to parse lockIDs.

It can be used to bridge requests from different clients that send lockIDs in different formats. For example, Microsoft Office Online sends the lockID in a JSON string, while other clients send the lockID as a plain string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LegacyLockParser

type LegacyLockParser struct{}

LegacyLockParser is a lock parser that can extract the lockID from a JSON string

func (*LegacyLockParser) ParseLock

func (*LegacyLockParser) ParseLock(id string) string

ParseLock extracts the lockID from a JSON string. For Microsoft Office Online we need to extract the lockID from the JSON string that is sent by the WOPI client. The JSON string is expected to have the following format:

{
  "L": "12345678",
  "F": 4,
  "E": 2,
  "C": "",
  "P": "3453345345346",
  "M": "12345678"
}

or

{
  "S": "12345678",
  "F": 4,
  "E": 2,
  "C": "",
  "P": "3453345345346",
  "M": "12345678"
}

If the JSON string is not in the expected format, the original lockID will be returned.

type LockParser

type LockParser interface {
	ParseLock(id string) string
}

LockParser is the interface that wraps the ParseLock method

type NoopLockParser

type NoopLockParser struct{}

NoopLockParser is a lock parser that does not change the lockID

func (*NoopLockParser) ParseLock

func (*NoopLockParser) ParseLock(id string) string

ParseLock will return the lockID as is

Jump to

Keyboard shortcuts

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